vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -------------------------------------------------------------------------- |
2 | -- Archaeologist.lua |
||
3 | -------------------------------------------------------------------------- |
||
4 | --[[ |
||
5 | Archaeologist |
||
6 | Unearthing Health and Mana values at a unit frame near you. |
||
7 | |||
8 | By: AnduinLothar <KarlKFI@cosmosui.org> |
||
9 | |||
10 | Change Log: |
||
11 | v0.1a |
||
12 | -Adds Text to Unit Frame Status Bars |
||
13 | -Adds Dead/Offline/Ghost text to all unit frames |
||
14 | -Changes health bar color as it decreases |
||
15 | -Status bar prefix is optional |
||
16 | -All status text can be shown as percent or real value (except target HP which is percent from server) |
||
17 | |||
18 | v0.2a |
||
19 | -Fixed Slash commands not working for text. |
||
20 | -Sepperated Player HP/MP/XP text |
||
21 | -Made target percent an option so you can see true values when you target self or party member |
||
22 | |||
23 | v0.3a |
||
24 | -Optimized Slash and Cosmos Reg Code. |
||
25 | -Fixed non-Cosmos saved variables not being saved (also nil pointer bug) |
||
26 | -Fixed text relocation so that the HP and MP text are now slightly sepperated |
||
27 | -Removed partial frame replacement and replaced it with onLoad status bar initializing |
||
28 | |||
29 | v0.4a |
||
30 | -Fixed a hp prefix reshowing bug |
||
31 | -Added Pet Dead Text |
||
32 | -Fixed Pet MP/HP show issue |
||
33 | |||
34 | v0.5a |
||
35 | -TargetFrame healthbars now always display as percent unless max hp is difforent thant 100 (party, player, pet) |
||
36 | |||
37 | v0.6a |
||
38 | -Added 12 Buffs and 12 Debuffs for all party members and pet. |
||
39 | -Moved Pet Happiness to accomidate pet debuffs |
||
40 | -Options to Show or Hide buffs or debuffs (reverts to normal onmouseover behavior when off) |
||
41 | -Show anywhere between 0 and 12 Buffs or Debuffs |
||
42 | -Cleaned up slash command printouts |
||
43 | -Syncronized Cosmos with Slash Commands. Use both if you're thus inspired. |
||
44 | |||
45 | v0.7a |
||
46 | -Added Alternate Debuff Location. |
||
47 | -Added buff tooltips |
||
48 | -Changed Slash Command syntax |
||
49 | -Added Alternate HPMP text location that aligns to the outside of the bar frame. |
||
50 | |||
51 | v1.0 |
||
52 | -Live in Cosmos! |
||
53 | -Spelling Errors Corrected |
||
54 | |||
55 | v1.1 |
||
56 | -Added German Localization |
||
57 | -Sorting of cosmos options. |
||
58 | -Auto Pet Happiness Alt Location Management |
||
59 | |||
60 | v1.2 |
||
61 | -Added French Localization |
||
62 | -Fixed ArchaeologistVars = nil error |
||
63 | -Text is now resizable from 6-20. |
||
64 | Note: due to a blizzard text resizing bug the text will not propperly smooth/rescale once changed. |
||
65 | To correct it go to windowed mode and back to fullscreen. I have notified Blizzard of the bug. |
||
66 | -Made Party/Pet Buff borders green. Debuffs are still red. |
||
67 | |||
68 | v1.3 |
||
69 | -Added 8 Buffs and 8 Debuffs for target frame. |
||
70 | -Target Buffs slightly rearanged. They now extend from right to left so that the 3 extra buffs don't |
||
71 | get covered by the portrait and elite graphics. |
||
72 | -Increased Pet and Party Max buffs/debuffs to 14 |
||
73 | |||
74 | v1.4 |
||
75 | -Fixed the bug that hid status text while moused over. |
||
76 | -Fixed the bug that hid status text while the character frame was open. |
||
77 | |||
78 | v1.41 |
||
79 | -Implimented Smooth Text Resizing Work-around |
||
80 | |||
81 | v1.42 |
||
82 | -Fixed a bug with loading default values from the new text sliders w/o cosmos. |
||
83 | |||
84 | v1.43 |
||
85 | -Fixed a bigger bug with values not saving with slash commands and cosmos. |
||
86 | |||
87 | v1.5 |
||
88 | -Made Target Buffs on top if targeting an ally and Debuffs on top if targeting an enemy. |
||
89 | -Added an alternate option for target buffs to display from right to left. Default is left to right. |
||
90 | -Fixed/Avoided MouseOver hook so that Arch plays nicely with mouse over offsets. |
||
91 | |||
92 | v1.6 |
||
93 | -Added Optional use of the MobHealth2 addon if you are usign it. |
||
94 | http://www.curse-gaming.com/mod.php?addid=1087 |
||
95 | |||
96 | v1.7 |
||
97 | -Added Khaos configuration options |
||
98 | -Updated to work with cosmos MobHealth addon |
||
99 | -No longer displays 0/0 if the health is unknown |
||
100 | -Fixed manabar nil bug. |
||
101 | |||
102 | v1.8 |
||
103 | -Added optional class icons to the Player, Party and Target Frames |
||
104 | |||
105 | v1.9 |
||
106 | -Added optional replacement of unit portraits with large class icons |
||
107 | -Raised Target Buffs slightly to be above the Target portait |
||
108 | -Fixed a nil bug when using class icons on party members. |
||
109 | |||
110 | v2.0 |
||
111 | -Updated TOC to 1700 |
||
112 | -Increased Target Buff and Debuff max to 16 |
||
113 | -Added 16 PartyPet Buffs and Debuffs |
||
114 | -Added Party Pet Buffs/Debuffs mouseover only option |
||
115 | -Updated all Buffs and Debuffs to 16 max |
||
116 | -Added Primary and Secondary Text Displays for every StatusBar |
||
117 | -AltTextLocation now swaps Primary and Secondary Display Text and is sepperated by Unit Type |
||
118 | -Added Text Inversion for all StatusBars (Show how much is missing in % or value) |
||
119 | -Now works with the MobHealth inbedded in MobInfo2 |
||
120 | -Added dynamic font changing (dropdown in khaos) |
||
121 | [Note if you change the font the font shadow will dissapear. To get it back change the font to default and ReloadUI.] |
||
122 | -Added font coloring (color wheel in khaos) |
||
123 | -If in default positions PartyPets, PartyMembers and Target Frames are slightly relocated to make room for Text and Buffs |
||
124 | -Only Move Target Frame if Secondary Display is enabled on Target or Player |
||
125 | -Added Options to either show percent, value, both or neither on the XP bar |
||
126 | -Increased the Frame Level of Target Debuffs to be above the Target Frame |
||
127 | -Added Target debuff aplication overlays |
||
128 | |||
129 | v2.1 |
||
130 | -Archaeologist now requires MCom for simplified Khaos/Cosmos/slash command registration |
||
131 | -All Slash commands are now availible via "/arch" which will bring up a dialog with availible commands. |
||
132 | -Removed Buggy Party Pet Buffs/Debuffs mouseover only option |
||
133 | -Added On/Off/Mouseover options for all statusbar displays via Khaos dropdown menus |
||
134 | -Added AltTextLocation for each status bar |
||
135 | -Added Option to use health values instead of percent on the target when possible |
||
136 | |||
137 | v2.11 |
||
138 | -Fixed CharacterFrame 'Archaeologist_TurnOnPlayerXP' bug |
||
139 | -Fixed a bug where defaults where being set after MCom was registered |
||
140 | -Fixed a bug where duplicate settings where accidentally being saved with Khaos |
||
141 | -Fixed a bug that broke font resizing |
||
142 | |||
143 | v2.12 |
||
144 | -Fixed Font Change bug causing nil error for SetTextHeight |
||
145 | -Prefix now stays on the Primary Display |
||
146 | |||
147 | v2.13 |
||
148 | -TargetFrame Height now adjusts to the same height as the PlayerFrame (fix for TitanBar) |
||
149 | -Fixed for nil error on load involving undefaulted nil options |
||
150 | |||
151 | v2.2 |
||
152 | -Changed 'alt text locations' to 'swap value and percent' (slash command changed as well. Ex: '/arch playerhpswap on') |
||
153 | -Pet happiness location now only moves when debuffs are enabled to the right or secondary text is on. |
||
154 | -Entirely rewrote the Target, Party and PartyPet frame offset relocation scheme based on options involving secondary display visibility, alternate buff positioning and buff/debuff hiding |
||
155 | -Now if party/partypet buffs are hidden the debuffs move up to close the space when applicable |
||
156 | -Party pet buffs disabled by default (normal space offset) |
||
157 | -Added Pet XP Text Display Options: On, Off, Mouseover, Prefix, Percent, Value, Invert |
||
158 | -Enabled Automatic MCom Option Feedback |
||
159 | -TBuffAlt option now wraps target buffs and debuffs in rows on eight. |
||
160 | |||
161 | v2.21 |
||
162 | -Fixed font size save bug. |
||
163 | |||
164 | v2.3 |
||
165 | -Added 6 value/percentage display presets (Preset1-6) |
||
166 | -Added 3 display prefix presets (PrefixOn, PrefixOff, PrefixDefault) |
||
167 | |||
168 | v2.4 |
||
169 | -Added Feign Death detection for party members. |
||
170 | -Added Feign Death detection for player and target. |
||
171 | -Updated German Localization, thanks StarDust |
||
172 | -Updated French Localization, thanks WLMitch |
||
173 | -Fixed Presets not working on German Clients |
||
174 | (Note: MCom isn't French localized yet so slash commands will need the English On/Off while German clients use Ein/Aus) |
||
175 | |||
176 | v2.41 |
||
177 | -Fixed Presets again, should work for French too now. |
||
178 | |||
179 | Known Bugs: Party Pet Buff/Debuff tooltips don't show. |
||
180 | |||
181 | |||
182 | $Id: Archaeologist.lua 2626 2005-10-15 10:42:08Z karlkfi $ |
||
183 | $Rev: 2626 $ |
||
184 | $LastChangedBy: karlkfi $ |
||
185 | $Date: 2005-10-15 03:42:08 -0700 (Sat, 15 Oct 2005) $ |
||
186 | |||
187 | ]]-- |
||
188 | |||
189 | -- <= == == == == == == == == == == == == => |
||
190 | -- => Global Variables |
||
191 | -- <= == == == == == == == == == == == == => |
||
192 | |||
193 | Archaeologist_TextStringPercentStatusBars = { }; |
||
194 | Archaeologist_TextStringValueStatusBars = { }; |
||
195 | Archaeologist_TextStringInvertStatusBars = { }; |
||
196 | Archaeologist_TextStringAltTextStatusBars = { }; |
||
197 | |||
198 | ArchaeologistStatusBars = { }; |
||
199 | ArchaeologistOptionSetName = "Archaeologist"; |
||
200 | |||
201 | ArchaeologistFonts = { |
||
202 | GameFontNormal = "Fonts\\FRIZQT__.TTF"; |
||
203 | NumberFontNormal = "Fonts\\ARIALN.TTF"; |
||
204 | ItemTextFontNormal = "Fonts\\MORPHEUS.TTF"; |
||
205 | }; |
||
206 | |||
207 | ArchaeologistOnOffMouseover = { |
||
208 | [ARCHAEOLOGIST_ON] = "on"; |
||
209 | [ARCHAEOLOGIST_OFF] = "off"; |
||
210 | [ARCHAEOLOGIST_MOUSEOVER] = "mouseover"; |
||
211 | }; |
||
212 | |||
213 | function Archaeologist_DefineStatusBars() |
||
214 | |||
215 | ArchaeologistStatusBars.player = { frame = PlayerFrame, statusText = PlayerStatusText }; |
||
216 | ArchaeologistStatusBars.party1 = { frame = PartyMemberFrame1, statusText = PartyMemberFrame1.statusText }; |
||
217 | ArchaeologistStatusBars.party2 = { frame = PartyMemberFrame2, statusText = PartyMemberFrame2.statusText }; |
||
218 | ArchaeologistStatusBars.party3 = { frame = PartyMemberFrame3, statusText = PartyMemberFrame3.statusText }; |
||
219 | ArchaeologistStatusBars.party4 = { frame = PartyMemberFrame4, statusText = PartyMemberFrame4.statusText }; |
||
220 | ArchaeologistStatusBars.pet = { frame = PetFrame, statusText = PetStatusText }; |
||
221 | ArchaeologistStatusBars.target = { frame = TargetFrame, statusText = TargetDeadText }; |
||
222 | |||
223 | end |
||
224 | |||
225 | -- <= == == == == == == == == == == == == => |
||
226 | -- => Variable Sync Tables |
||
227 | -- <= == == == == == == == == == == == == => |
||
228 | |||
229 | ArchaeologistVars = { }; |
||
230 | ArchaeologistVarData = { }; |
||
231 | |||
232 | function Archaeologist_DefineVarData() |
||
233 | ArchaeologistVarData = { |
||
234 | |||
235 | PLAYERHP = { name = "PlayerHpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_PrimaryOnOffMouseover("player", "healthbar", value); end }, |
||
236 | PLAYERHP2 = { name = "PlayerHp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_SecondaryOnOffMouseover("player", "healthbar", value); Archaeologist_UpdateTargetLocation(); end }, |
||
237 | PLAYERMP = { name = "PlayerMpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_PrimaryOnOffMouseover("player", "manabar", value); end }, |
||
238 | PLAYERMP2 = { name = "PlayerMp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_SecondaryOnOffMouseover("player", "manabar", value); Archaeologist_UpdateTargetLocation(); end }, |
||
239 | PLAYERXP = { name = "PlayerXpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = Archaeologist_PlayerXPOnOffMouseover }, |
||
240 | PLAYERHPINVERT = { name = "PlayerHpInvertEnable", default = 0, func = Archaeologist_TurnOnPlayerHPInvert }, |
||
241 | PLAYERMPINVERT = { name = "PlayerMpInvertEnable", default = 0, func = Archaeologist_TurnOnPlayerMPInvert }, |
||
242 | PLAYERXPINVERT = { name = "PlayerXpInvertEnable", default = 0, func = Archaeologist_TurnOnPlayerXPInvert }, |
||
243 | PLAYERXPP = { name = "PlayerXpPercentEnable", default = 0, func = Archaeologist_TurnOnPlayerXPPercent }, |
||
244 | PLAYERXPV = { name = "PlayerXpValueEnable", default = 1, func = Archaeologist_TurnOnPlayerXPValue }, |
||
245 | PLAYERHPNOPREFIX = { name = "PlayerHpPrefixEnable", default = 0, func = Archaeologist_TurnOffPlayerHPPrefix }, |
||
246 | PLAYERMPNOPREFIX = { name = "PlayerMpPrefixEnable", default = 0, func = Archaeologist_TurnOffPlayerMPPrefix }, |
||
247 | PLAYERXPNOPREFIX = { name = "PlayerXpPrefixEnable", default = 0, func = Archaeologist_TurnOffPlayerXPPrefix }, |
||
248 | PLAYERCLASSICON = { name = "PlayerClassIconEnable", default = 0, func = Archaeologist_TurnOnPlayerClassIcon }, |
||
249 | PLAYERHPSWAP = { name = "PlayerAltHpText", default = 0, func = function(toggle) Archaeologist_SetUnitBarValuePercentSwap("player", "healthbar", toggle); end }, |
||
250 | PLAYERMPSWAP = { name = "PlayerAltMpText", default = 0, func = function(toggle) Archaeologist_SetUnitBarValuePercentSwap("player", "manabar", toggle); end }, |
||
251 | |||
252 | PARTYHP = { name = "PartyHpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) for i=1,4 do Archaeologist_PrimaryOnOffMouseover("party"..i, "healthbar", value); end end }, |
||
253 | PARTYHP2 = { name = "PartyHp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) for i=1,4 do Archaeologist_SecondaryOnOffMouseover("party"..i, "healthbar", value); end end }, |
||
254 | PARTYMP = { name = "PartyMpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) for i=1,4 do Archaeologist_PrimaryOnOffMouseover("party"..i, "manabar", value); end end }, |
||
255 | PARTYMP2 = { name = "PartyMp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) for i=1,4 do Archaeologist_SecondaryOnOffMouseover("party"..i, "manabar", value); end end }, |
||
256 | PARTYHPINVERT = { name = "PartyHpInvertEnable", default = 0, func = Archaeologist_TurnOnPartyHPInvert }, |
||
257 | PARTYMPINVERT = { name = "PartyMpInvertEnable", default = 0, func = Archaeologist_TurnOnPartyMPInvert }, |
||
258 | PARTYHPNOPREFIX = { name = "PartyHpPrefixEnable", default = 1, func = Archaeologist_TurnOffPartyHPPrefix }, |
||
259 | PARTYMPNOPREFIX = { name = "PartyMpPrefixEnable", default = 0, func = Archaeologist_TurnOffPartyMPPrefix }, |
||
260 | PARTYCLASSICON = { name = "PartyClassIconEnable", default = 1, func = Archaeologist_TurnOnPartyClassIcon }, |
||
261 | PARTYHPSWAP = { name = "PartyAltHpText", default = 0, func = function(toggle) for i=1,4 do Archaeologist_SetUnitBarValuePercentSwap("party"..i, "healthbar", toggle); end end }, |
||
262 | PARTYMPSWAP = { name = "PartyAltMpText", default = 0, func = function(toggle) for i=1,4 do Archaeologist_SetUnitBarValuePercentSwap("party"..i, "manabar", toggle); end end }, |
||
263 | |||
264 | PETHP = { name = "PetHpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_PrimaryOnOffMouseover("pet", "healthbar", value); end }, |
||
265 | PETHP2 = { name = "PetHp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_SecondaryOnOffMouseover("pet", "healthbar", value); end }, |
||
266 | PETMP = { name = "PetMpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_PrimaryOnOffMouseover("pet", "manabar", value); end }, |
||
267 | PETMP2 = { name = "PetMp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_SecondaryOnOffMouseover("pet", "manabar", value); end }, |
||
268 | PETXP = { name = "PetXpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = Archaeologist_PetXPOnOffMouseover }, |
||
269 | PETHPINVERT = { name = "PetHpInvertEnable", default = 0, func = Archaeologist_TurnOnPetHPInvert }, |
||
270 | PETMPINVERT = { name = "PetMpInvertEnable", default = 0, func = Archaeologist_TurnOnPetMPInvert }, |
||
271 | PETXPINVERT = { name = "PetXpInvertEnable", default = 0, func = Archaeologist_TurnOnPetXPInvert }, |
||
272 | PETXPP = { name = "PetXpPercentEnable", default = 0, func = Archaeologist_TurnOnPetXPPercent }, |
||
273 | PETXPV = { name = "PetXpValueEnable", default = 1, func = Archaeologist_TurnOnPetXPValue }, |
||
274 | PETHPNOPREFIX = { name = "PetHpPrefixEnable", default = 1, func = Archaeologist_TurnOffPetHPPrefix }, |
||
275 | PETMPNOPREFIX = { name = "PetMpPrefixEnable", default = 0, func = Archaeologist_TurnOffPetMPPrefix }, |
||
276 | PETXPNOPREFIX = { name = "PetXpPrefixEnable", default = 0, func = Archaeologist_TurnOffPetXPPrefix }, |
||
277 | PETHPSWAP = { name = "PetAltHpText", default = 0, func = function(toggle) Archaeologist_SetUnitBarValuePercentSwap("pet", "healthbar", toggle); end }, |
||
278 | PETMPSWAP = { name = "PetAltMpText", default = 0, func = function(toggle) Archaeologist_SetUnitBarValuePercentSwap("pet", "manabar", toggle); end }, |
||
279 | |||
280 | TARGETHP = { name = "TargetHpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_PrimaryOnOffMouseover("target", "healthbar", value); end }, |
||
281 | TARGETHP2 = { name = "TargetHp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_SecondaryOnOffMouseover("target", "healthbar", value); Archaeologist_UpdateTargetLocation(); end }, |
||
282 | TARGETMP = { name = "TargetMpEnable", default = "mouseover", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_PrimaryOnOffMouseover("target", "manabar", value); end }, |
||
283 | TARGETMP2 = { name = "TargetMp2Enable", default = "off", options = ArchaeologistOnOffMouseover, func = function(value) Archaeologist_SecondaryOnOffMouseover("target", "manabar", value); Archaeologist_UpdateTargetLocation(); end }, |
||
284 | TARGETHPINVERT = { name = "TargetHpInvertEnable", default = 0, func = Archaeologist_TurnOnTargetHPInvert }, |
||
285 | TARGETMPINVERT = { name = "TargetMpInvertEnable", default = 0, func = Archaeologist_TurnOnTargetMPInvert }, |
||
286 | TARGETHPNOPREFIX = { name = "TargetHpPrefixEnable", default = 1, func = Archaeologist_TurnOffTargetHPPrefix }, |
||
287 | TARGETMPNOPREFIX = { name = "TargetMpPrefixEnable", default = 0, func = Archaeologist_TurnOffTargetMPPrefix }, |
||
288 | TARGETCLASSICON = { name = "TargetClassIconEnable", default = 1, func = Archaeologist_TurnOnTargetClassIcon }, |
||
289 | TARGETHPSWAP = { name = "TargetAltHpText", default = 0, func = function(toggle) Archaeologist_SetUnitBarValuePercentSwap("target", "healthbar", toggle); end }, |
||
290 | TARGETMPSWAP = { name = "TargetAltMpText", default = 0, func = function(toggle) Archaeologist_SetUnitBarValuePercentSwap("target", "manabar", toggle); end }, |
||
291 | |||
292 | PBUFFS = { name = "PartyBuffDisable", default = 0, func = Archaeologist_TurnOffPartyBuffs }, |
||
293 | PBUFFNUM = { name = "PartyBuffCount", dependencies = {["PartyBuffEnable"]={checked=false}}, default = 16, min = 0, max = 16, func = Archaeologist_SetPartyBuffs }, |
||
294 | |||
295 | PDEBUFFS = { name = "PartyDebuffDisable", default = 0, func = Archaeologist_TurnOffPartyDebuffs }, |
||
296 | PDEBUFFNUM = { name = "PartyDebuffCount", dependencies = {["PartyDebuffEnable"]={checked=false}}, default = 16, min = 0, max = 16, func = Archaeologist_SetPartyDebuffs }, |
||
297 | |||
298 | PPTBUFFS = { name = "PartyPetBuffDisable", default = 1, func = Archaeologist_TurnOffPartyPetBuffs }, |
||
299 | PPTBUFFNUM = { name = "PartyPetBuffCount", dependencies = {["PartyPetBuffEnable"]={checked=false}}, default = 16, min = 0, max = 16, func = Archaeologist_SetPartyPetBuffs }, |
||
300 | |||
301 | PPTDEBUFFS = { name = "PartyPetDebuffDisable", default = 0, func = Archaeologist_TurnOffPartyPetDebuffs }, |
||
302 | PPTDEBUFFNUM = { name = "PartyPetDebuffCount", dependencies = {["PartyPetDebuffEnable"]={checked=false}}, default = 16, min = 0, max = 16, func = Archaeologist_SetPartyPetDebuffs }, |
||
303 | |||
304 | PTBUFFS = { name = "PetBuffDisable", default = 0, func = Archaeologist_TurnOffPetBuffs }, |
||
305 | PTBUFFNUM = { name = "PetBuffCount", dependencies = {["PetBuffEnable"]={checked=false}}, default = 16, min = 0, max = 16, func = Archaeologist_SetPetBuffs }, |
||
306 | |||
307 | PTDEBUFFS = { name = "PetDebuffDisable", default = 0, func = Archaeologist_TurnOffPetDebuffs }, |
||
308 | PTDEBUFFNUM = { name = "PetDebuffCount", dependencies = {["PetDebuffEnable"]={checked=false}}, default = 4, min = 0, max = 16, func = Archaeologist_SetPetDebuffs }, |
||
309 | |||
310 | TBUFFS = { name = "TargetBuffDisable", default = 0, func = Archaeologist_TurnOffTargetBuffs }, |
||
311 | TBUFFNUM = { name = "TargetBuffCount", dependencies = {["TargetBuffEnable"]={checked=false}}, default = 8, min = 0, max = 16, func = Archaeologist_SetTargetBuffs }, |
||
312 | |||
313 | TDEBUFFS = { name = "TargetDebuffDisable", default = 0, func = Archaeologist_TurnOffTargetDebuffs }, |
||
314 | TDEBUFFNUM = { name = "TargetDebuffCount", dependencies = {["TargetDebuffEnable"]={checked=false}}, default = 16, min = 0, max = 16, func = Archaeologist_SetTargetDebuffs }, |
||
315 | |||
316 | HPCOLOR = { name = "HealthGradientEnable", default = 0, func = function() end }, |
||
317 | DEBUFFALT = { name = "DebuffRelocateEnable", default = 0, func = Archaeologist_SetAltDebuffLocation }, |
||
318 | TBUFFALT = { name = "TargetBuffAlignment", default = 0, func = Archaeologist_TargetDebuffButton_Update }, |
||
319 | CLASSPORTRAIT = { name = "ClassPortrait", default = 0, func = Archaeologist_EnableClassPortrait }, |
||
320 | USEHPVALUE = { name = "UseHpValue", default = 0, func = function() Archaeologist_TextStatusBar_UpdateTextString(ArchaeologistStatusBars.target.frame.healthbar); end }; |
||
321 | HPMPLARGESIZE = { name = "LargeTextSize", default = 14, min = 6, max = 20, func = Archaeologist_SetHPMPLargeTextSize }, |
||
322 | HPMPSMALLSIZE = { name = "SmallTextSize", default = 14, min = 6, max = 20, func = Archaeologist_SetHPMPSmallTextSize }, |
||
323 | HPMPLARGEFONT = { name = "LargeFontSelect", default = "Default", options = ArchaeologistLocalizedFonts, func = Archaeologist_SetHPMPLargeFont }, |
||
324 | HPMPSMALLFONT = { name = "SmallFontSelect", default = "Default", options = ArchaeologistLocalizedFonts, func = Archaeologist_SetHPMPSmallFont }, |
||
325 | COLORPHP = { name = "PrimaryHpColorSelect", default = {r=1,g=1,b=1,opacity=1}, func = Archaeologist_SetPrimaryHPColor }, |
||
326 | COLORPMP = { name = "PrimaryMpColorSelect", default = {r=1,g=1,b=1,opacity=1}, func = Archaeologist_SetPrimaryMPColor }, |
||
327 | COLORSHP = { name = "SecondaryHpColorSelect", default = {r=1,g=1,b=1,opacity=1}, func = Archaeologist_SetSecondaryHPColor }, |
||
328 | COLORSMP = { name = "SecondaryMpColorSelect", default = {r=1,g=1,b=1,opacity=1}, func = Archaeologist_SetSecondaryMPColor }, |
||
329 | }; |
||
330 | end |
||
331 | |||
332 | -- <= == == == == == == == == == == == == => |
||
333 | -- => XML Function Calls |
||
334 | -- <= == == == == == == == == == == == == => |
||
335 | |||
336 | local SavedHealthBar_OnValueChanged = nil; |
||
337 | |||
338 | function Archaeologist_OnLoad() |
||
339 | |||
340 | Sea.util.hook( "TargetFrame_CheckDead", "Archaeologist_TargetCheckDead", "replace" ); |
||
341 | Sea.util.hook( "ShowTextStatusBarText", "Archaeologist_ShowTextStatusBarText", "replace" ); |
||
342 | Sea.util.hook( "HideTextStatusBarText", "Archaeologist_HideTextStatusBarText", "replace" ); |
||
343 | Sea.util.hook( "TextStatusBar_UpdateTextString", "Archaeologist_TextStatusBar_UpdateTextString", "replace" ); |
||
344 | Sea.util.hook( "CharacterFrame_OnShow", "Archaeologist_CharacterFrame_OnShow", "replace" ); |
||
345 | Sea.util.hook( "CharacterFrame_OnHide", "Archaeologist_CharacterFrame_OnHide", "replace" ); |
||
346 | Sea.util.hook( "UnitFrame_UpdateManaType", "Archaeologist_UnitFrame_UpdateManaType", "replace" ); |
||
347 | |||
348 | Sea.util.hook( "PartyMemberFrame_RefreshBuffs", "Archaeologist_PartyMemberFrame_RefreshBuffs", "replace" ); |
||
349 | Sea.util.hook( "PetFrame_RefreshBuffs", "Archaeologist_PetFrame_RefreshBuffs", "replace" ); |
||
350 | Sea.util.hook( "PartyMemberBuffTooltip_Update", "Archaeologist_PartyMemberBuffs_Update", "replace" ); |
||
351 | Sea.util.hook( "ShowPartyFrame", "Archaeologist_UpdatePartyMemberBuffs", "after" ); |
||
352 | Sea.util.hook( "TargetDebuffButton_Update", "Archaeologist_TargetDebuffButton_Update", "replace" ); |
||
353 | Sea.util.hook( "PartyMemberFrame_UpdatePet", "Archaeologist_PartyMemberFrame_UpdatePet", "replace" ); |
||
354 | |||
355 | Sea.util.hook( "UnitFrame_Update", "Archaeologist_UnitFrame_Update_After", "after" ); |
||
356 | Sea.util.hook( "UnitFrame_OnEvent", "Archaeologist_UnitFrame_OnEvent_After", "after" ); |
||
357 | Sea.util.hook( "SetTextStatusBarText", "Archaeologist_SetTextStatusBarText", "after" ); |
||
358 | |||
359 | --HealthBar_OnValueChanged manual hook to modify input |
||
360 | if (HealthBar_OnValueChanged ~= SavedHealthBar_OnValueChanged) then |
||
361 | SavedHealthBar_OnValueChanged = HealthBar_OnValueChanged; |
||
362 | HealthBar_OnValueChanged = Archaeologist_HealthBar_OnValueChanged; |
||
363 | end |
||
364 | |||
365 | this:RegisterEvent("VARIABLES_LOADED"); |
||
366 | this:RegisterEvent("UNIT_HEALTH"); |
||
367 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
368 | this:RegisterEvent("PLAYER_TARGET_CHANGED"); |
||
369 | this:RegisterEvent("PARTY_MEMBERS_CHANGED"); |
||
370 | this:RegisterEvent("PARTY_MEMBER_DISABLE"); |
||
371 | this:RegisterEvent("PARTY_MEMBER_ENABLE"); |
||
372 | this:RegisterEvent("UNIT_AURA"); |
||
373 | |||
374 | Archaeologist_DefineVarData(); |
||
375 | Archaeologist_InitializeAddedStatusBarTexts(); |
||
376 | Archaeologist_DefineStatusBars(); |
||
377 | Archaeologist_HookStatusBars_OnLeave(); -- Add Hiding Handlers for 2ndary Displays |
||
378 | Archaeologist_VarSync_SavedToVars(); --set all to default since nothing has loaded yet |
||
379 | end |
||
380 | |||
381 | function Archaeologist_OnEvent(event) |
||
382 | if (event == "VARIABLES_LOADED") then |
||
383 | |||
384 | local _, class = UnitClass("player"); |
||
385 | Archaeologist_PlayerIsHunter = (class == "HUNTER"); |
||
386 | |||
387 | if (not ArchaeologistVars) then |
||
388 | ArchaeologistVars = { }; |
||
389 | end |
||
390 | |||
391 | if (MobHealth_OnEvent) then |
||
392 | if (MI2_OnEvent) then |
||
393 | Sea.util.hook( "MI2_OnEvent", "Archaeologist_MobHealth_OnEvent", "after" ); |
||
394 | else |
||
395 | Sea.util.hook( "MobHealth_OnEvent", "Archaeologist_MobHealth_OnEvent", "after" ); |
||
396 | end |
||
397 | ArchaeologistVarData["MOBHEALTH"] = { name = "UseMobHealth", default = 0, func = Archaeologist_EnableMobHealth }; |
||
398 | end |
||
399 | |||
400 | Archaeologist_VarSync_SavedToVars(); |
||
401 | --Fix the nil pet buff error, by not hooking this function until after the variable is not nil |
||
402 | Sea.util.hook( "PartyMemberFrame_RefreshPetBuffs", "Archaeologist_PartyMemberFrame_RefreshPetBuffs", "replace" ); |
||
403 | Archaeologist_RegisterForMCom(); |
||
404 | |||
405 | if (not Khaos) and (not Cosmos_RegisterConfiguration) then |
||
406 | Archaeologist_VarSync_VarsToLive(); |
||
407 | RegisterForSave("ArchaeologistVars"); |
||
408 | end |
||
409 | |||
410 | Archaeologist_PlayerCheckDead(); |
||
411 | Archaeologist_UpdatePartyMembersDead(); |
||
412 | Archaeologist_PetCheckDead(); |
||
413 | Archaeologist_HideOrigTargetBuffs(); |
||
414 | Archaeologist_UpdateOverlapPositions() |
||
415 | |||
416 | elseif ( event == "PLAYER_ENTERING_WORLD" ) then |
||
417 | Archaeologist_UpdatePartyMemberBuffs(); |
||
418 | Archaeologist_UpdatePlayerClassIcon(); |
||
419 | |||
420 | elseif ( event == "UNIT_HEALTH" ) then |
||
421 | if (arg1 == "player") then |
||
422 | Archaeologist_PlayerCheckDead(); |
||
423 | elseif (arg1 == "target") then |
||
424 | --called by hook |
||
425 | --Archaeologist_TargetCheckDead(); |
||
426 | elseif (arg1 == "pet") then |
||
427 | Archaeologist_PetCheckDead(); |
||
428 | else |
||
429 | local partyIndex = Archaeologist_PartyIndexFromUnit(arg1); |
||
430 | Archaeologist_PartyCheckDead(partyIndex); |
||
431 | end |
||
432 | |||
433 | elseif (event == "PLAYER_TARGET_CHANGED") then |
||
434 | Archaeologist_UpdateTargetClassIcon(); |
||
435 | |||
436 | elseif (event == "PARTY_MEMBERS_CHANGED") then |
||
437 | Archaeologist_UpdatePartyMembersDead(); |
||
438 | Archaeologist_UpdatePartyClassIcons(); |
||
439 | |||
440 | elseif (event == "PARTY_MEMBER_ENABLE") then |
||
441 | local partyIndex = Archaeologist_PartyIndexFromName(arg1); |
||
442 | Archaeologist_PartyCheckDead(partyIndex); |
||
443 | |||
444 | elseif (event == "PARTY_MEMBER_DISABLE") then |
||
445 | local partyIndex = Archaeologist_PartyIndexFromName(arg1); |
||
446 | Archaeologist_PartyCheckDead(partyIndex); |
||
447 | |||
448 | elseif (event == "UNIT_AURA") then |
||
449 | local partyIndex = Archaeologist_PartyIndexFromUnit(arg1); |
||
450 | Archaeologist_PartyCheckDead(partyIndex); |
||
451 | if (arg1 == "pet") then |
||
452 | Archaeologist_PetCheckDead(); |
||
453 | elseif (arg1 == "player") and (Archaeologist_PlayerIsHunter) then |
||
454 | --Scan for feigning |
||
455 | PlayerFrame.feigning = nil; |
||
456 | for i=1, 24 do |
||
457 | texture = UnitBuff("player", i); |
||
458 | if (texture == "Interface\\Icons\\Ability_Rogue_FeignDeath") then |
||
459 | PlayerFrame.feigning = true; |
||
460 | end |
||
461 | end |
||
462 | end |
||
463 | end |
||
464 | |||
465 | end |
||
466 | |||
467 | -- <= == == == == == == == == == == == == => |
||
468 | -- => Status Bar Initializing |
||
469 | -- <= == == == == == == == == == == == == => |
||
470 | |||
471 | function Archaeologist_SetTextStatusBarText(bar, text, text2) |
||
472 | if ( not bar or not text2 ) then |
||
473 | return |
||
474 | end |
||
475 | bar.TextString2 = text2; |
||
476 | end |
||
477 | |||
478 | function Archaeologist_InitializeAddedStatusBarTexts() |
||
479 | |||
480 | SetTextStatusBarText(PartyMemberFrame1HealthBar, PartyMemberFrame1HealthBarTextString, PartyMemberFrame1HealthBarTextString2); |
||
481 | SetTextStatusBarText(PartyMemberFrame2HealthBar, PartyMemberFrame2HealthBarTextString, PartyMemberFrame2HealthBarTextString2); |
||
482 | SetTextStatusBarText(PartyMemberFrame3HealthBar, PartyMemberFrame3HealthBarTextString, PartyMemberFrame3HealthBarTextString2); |
||
483 | SetTextStatusBarText(PartyMemberFrame4HealthBar, PartyMemberFrame4HealthBarTextString, PartyMemberFrame4HealthBarTextString2); |
||
484 | |||
485 | SetTextStatusBarText(PartyMemberFrame1ManaBar, PartyMemberFrame1ManaBarTextString, PartyMemberFrame1ManaBarTextString2); |
||
486 | SetTextStatusBarText(PartyMemberFrame2ManaBar, PartyMemberFrame2ManaBarTextString, PartyMemberFrame2ManaBarTextString2); |
||
487 | SetTextStatusBarText(PartyMemberFrame3ManaBar, PartyMemberFrame3ManaBarTextString, PartyMemberFrame3ManaBarTextString2); |
||
488 | SetTextStatusBarText(PartyMemberFrame4ManaBar, PartyMemberFrame4ManaBarTextString, PartyMemberFrame4ManaBarTextString2); |
||
489 | |||
490 | SetTextStatusBarText(TargetFrameHealthBar, TargetFrameHealthBarTextString, TargetFrameHealthBarTextString2); |
||
491 | SetTextStatusBarText(TargetFrameManaBar, TargetFrameManaBarTextString, TargetFrameManaBarTextString2); |
||
492 | |||
493 | SetTextStatusBarText(PetFrameHealthBar, PetFrameHealthBarText, PetFrameHealthBarText2String); |
||
494 | SetTextStatusBarText(PetFrameManaBar, PetFrameManaBarText, PetFrameManaBarText2String); |
||
495 | |||
496 | SetTextStatusBarText(PlayerFrameHealthBar, PlayerFrameHealthBarText, PlayerFrameHealthBarText2String); |
||
497 | SetTextStatusBarText(PlayerFrameManaBar, PlayerFrameManaBarText, PlayerFrameManaBarText2String); |
||
498 | end |
||
499 | |||
500 | -- <= == == == == == == == == == == == == => |
||
501 | -- => Variable Sync |
||
502 | -- <= == == == == == == == == == == == == => |
||
503 | |||
504 | function Archaeologist_VarSync_SavedToVars() |
||
505 | --sync saved values with internal values, else use default stored, else default to 0 |
||
506 | for index, var in ArchaeologistVarData do |
||
507 | if (ArchaeologistVars[index]) then |
||
508 | --already saved |
||
509 | elseif (var.default) then |
||
510 | ArchaeologistVars[index] = var.default; |
||
511 | else |
||
512 | ArchaeologistVars[index] = 0; |
||
513 | end |
||
514 | end |
||
515 | end |
||
516 | |||
517 | |||
518 | function Archaeologist_VarSync_VarsToLive() |
||
519 | --sync live status with internal values, else use default stored, else default to 0 |
||
520 | for index, var in ArchaeologistVarData do |
||
521 | if (var.min) and (var.max) then --slider |
||
522 | if (ArchaeologistVars[index]) and (var.func) then |
||
523 | var.func(ArchaeologistVars[index]) |
||
524 | elseif (var.func) and (var.default) then |
||
525 | var.func(var.default); |
||
526 | elseif (var.func) then |
||
527 | var.func(0); |
||
528 | end |
||
529 | elseif (type(var.default) == "table") then --colorwheel |
||
530 | if (ArchaeologistVars[index]) and (var.func) then |
||
531 | var.func(ArchaeologistVars[index]) |
||
532 | elseif (var.func) and (var.default) then |
||
533 | var.func(var.default); |
||
534 | elseif (var.func) then |
||
535 | var.func({}); |
||
536 | end |
||
537 | elseif (ArchaeologistVars[index]) and (var.func) then |
||
538 | var.func(ArchaeologistVars[index]) |
||
539 | elseif (var.func) and (var.default) then |
||
540 | var.func(var.default); |
||
541 | elseif (var.func) then |
||
542 | var.func(0); |
||
543 | end |
||
544 | end |
||
545 | end |
||
546 | |||
547 | |||
548 | -- <= == == == == == == == == == == == == => |
||
549 | -- => HP Color Mod |
||
550 | -- <= == == == == == == == == == == == == => |
||
551 | |||
552 | function Archaeologist_HealthBar_OnValueChanged(value, smooth) |
||
553 | if (ArchaeologistVars) then |
||
554 | if (ArchaeologistVars["HPCOLOR"] == 1) then |
||
555 | smooth = not smooth; |
||
556 | end |
||
557 | end |
||
558 | SavedHealthBar_OnValueChanged(value, smooth) |
||
559 | end |
||
560 | |||
561 | -- <= == == == == == == == == == == == == => |
||
562 | -- => HPMP Text Size |
||
563 | -- <= == == == == == == == == == == == == => |
||
564 | |||
565 | function Archaeologist_SetHPMPLargeTextSize(size) |
||
566 | if (type(size) ~= "number") then |
||
567 | return; |
||
568 | end |
||
569 | local barParent = ArchaeologistStatusBars["player"].frame; |
||
570 | barParent.healthbar.TextString:SetTextHeight(size); |
||
571 | barParent.manabar.TextString:SetTextHeight(size); |
||
572 | barParent.healthbar.TextString2:SetTextHeight(size); |
||
573 | barParent.manabar.TextString2:SetTextHeight(size); |
||
574 | local scale = barParent:GetScale(); |
||
575 | barParent:SetScale(scale+.1); |
||
576 | barParent:SetScale(scale); |
||
577 | barParent = ArchaeologistStatusBars["target"].frame; |
||
578 | barParent.healthbar.TextString:SetTextHeight(size); |
||
579 | barParent.manabar.TextString:SetTextHeight(size); |
||
580 | barParent.healthbar.TextString2:SetTextHeight(size); |
||
581 | barParent.manabar.TextString2:SetTextHeight(size); |
||
582 | scale = barParent:GetScale(); |
||
583 | barParent:SetScale(scale+.1); |
||
584 | barParent:SetScale(scale); |
||
585 | end |
||
586 | |||
587 | function Archaeologist_SetHPMPSmallTextSize(size) |
||
588 | if (type(size) ~= "number") then |
||
589 | return; |
||
590 | end |
||
591 | local barParent = ArchaeologistStatusBars["pet"].frame; |
||
592 | barParent.healthbar.TextString:SetTextHeight(size); |
||
593 | barParent.manabar.TextString:SetTextHeight(size); |
||
594 | barParent.healthbar.TextString2:SetTextHeight(size); |
||
595 | barParent.manabar.TextString2:SetTextHeight(size); |
||
596 | local scale = barParent:GetScale(); |
||
597 | barParent:SetScale(scale+.1); |
||
598 | barParent:SetScale(scale); |
||
599 | for i=1, 4 do |
||
600 | barParent = ArchaeologistStatusBars["party"..i].frame; |
||
601 | barParent.healthbar.TextString:SetTextHeight(size); |
||
602 | barParent.manabar.TextString:SetTextHeight(size); |
||
603 | barParent.healthbar.TextString2:SetTextHeight(size); |
||
604 | barParent.manabar.TextString2:SetTextHeight(size); |
||
605 | scale = barParent:GetScale(); |
||
606 | barParent:SetScale(scale+.1); |
||
607 | barParent:SetScale(scale); |
||
608 | end |
||
609 | end |
||
610 | |||
611 | -- <= == == == == == == == == == == == == => <= == == == == == == == == == == == == => |
||
612 | -- => Toggle Functions |
||
613 | -- <= == == == == == == == == == == == == => <= == == == == == == == == == == == == => |
||
614 | |||
615 | -- <= == == == == == == == == == == == == => |
||
616 | -- => TurnOn HP/MP/XP Functions |
||
617 | -- <= == == == == == == == == == == == == => |
||
618 | |||
619 | function Archaeologist_PrimaryOnOffMouseover(unit, bartype, value) |
||
620 | OverrideShowStatusBarText(ArchaeologistStatusBars[unit].frame[bartype], value); |
||
621 | end |
||
622 | |||
623 | function Archaeologist_SecondaryOnOffMouseover(unit, bartype, value) |
||
624 | OverrideShowStatusBarText2(ArchaeologistStatusBars[unit].frame[bartype], value); |
||
625 | if (unit == "pet") then |
||
626 | Archaeologist_SetPetFrameHappinessLocation(); |
||
627 | end |
||
628 | end |
||
629 | |||
630 | function Archaeologist_PlayerXPOnOffMouseover(toggle) |
||
631 | OverrideShowStatusBarText(MainMenuExpBar, toggle); |
||
632 | end |
||
633 | |||
634 | function Archaeologist_PetXPOnOffMouseover(toggle) |
||
635 | OverrideShowStatusBarText(PetPaperDollFrameExpBar, toggle); |
||
636 | end |
||
637 | |||
638 | function Archaeologist_RestorePlayerHP() |
||
639 | Archaeologist_PrimaryOnOffMouseover("player", "healthbar", ArchaeologistVars["PLAYERHP"]); |
||
640 | end |
||
641 | |||
642 | function Archaeologist_RestorePlayerMP() |
||
643 | Archaeologist_PrimaryOnOffMouseover("player", "manabar", ArchaeologistVars["PLAYERMP"]); |
||
644 | end |
||
645 | |||
646 | function Archaeologist_RestorePlayerXP() |
||
647 | Archaeologist_PlayerXPOnOffMouseover(ArchaeologistVars["PLAYERXP"]) |
||
648 | end |
||
649 | |||
650 | -- <= == == == == == == == == == == == == => |
||
651 | -- => Change HP/MP/XP Values to Percent Functions |
||
652 | -- <= == == == == == == == == == == == == => |
||
653 | |||
654 | function Archaeologist_TurnOnPlayerXPPercent(toggle) |
||
655 | Archaeologist_TextStringPercentStatusBars["MainMenuExpBar"] = toggle; |
||
656 | Archaeologist_TextStatusBar_UpdateTextString(MainMenuExpBar); |
||
657 | end |
||
658 | |||
659 | function Archaeologist_TurnOnPlayerXPValue(toggle) |
||
660 | Archaeologist_TextStringValueStatusBars["MainMenuExpBar"] = toggle; |
||
661 | Archaeologist_TextStatusBar_UpdateTextString(MainMenuExpBar); |
||
662 | end |
||
663 | |||
664 | function Archaeologist_TurnOnPetXPPercent(toggle) |
||
665 | Archaeologist_TextStringPercentStatusBars["PetPaperDollFrameExpBar"] = toggle; |
||
666 | Archaeologist_TextStatusBar_UpdateTextString(PetPaperDollFrameExpBar); |
||
667 | end |
||
668 | |||
669 | function Archaeologist_TurnOnPetXPValue(toggle) |
||
670 | Archaeologist_TextStringValueStatusBars["PetPaperDollFrameExpBar"] = toggle; |
||
671 | Archaeologist_TextStatusBar_UpdateTextString(PetPaperDollFrameExpBar); |
||
672 | end |
||
673 | |||
674 | -- <= == == == == == == == == == == == == => |
||
675 | -- => Invert HP/MP/XP Values |
||
676 | -- <= == == == == == == == == == == == == => |
||
677 | |||
678 | function Archaeologist_TurnOnPlayerHPInvert(toggle) |
||
679 | local statusBar = ArchaeologistStatusBars["player"].frame.healthbar; |
||
680 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
681 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
682 | end |
||
683 | |||
684 | function Archaeologist_TurnOnPlayerMPInvert(toggle) |
||
685 | local statusBar = ArchaeologistStatusBars["player"].frame.manabar; |
||
686 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
687 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
688 | end |
||
689 | |||
690 | function Archaeologist_TurnOnPlayerXPInvert(toggle) |
||
691 | Archaeologist_TextStringInvertStatusBars["MainMenuExpBar"] = toggle; |
||
692 | Archaeologist_TextStatusBar_UpdateTextString(MainMenuExpBar); |
||
693 | end |
||
694 | |||
695 | function Archaeologist_TurnOnPartyHPInvert(toggle) |
||
696 | local statusBar = ArchaeologistStatusBars["party1"].frame.healthbar; |
||
697 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
698 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
699 | |||
700 | statusBar = ArchaeologistStatusBars["party2"].frame.healthbar; |
||
701 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
702 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
703 | |||
704 | statusBar = ArchaeologistStatusBars["party3"].frame.healthbar; |
||
705 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
706 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
707 | |||
708 | statusBar = ArchaeologistStatusBars["party4"].frame.healthbar; |
||
709 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
710 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
711 | end |
||
712 | |||
713 | function Archaeologist_TurnOnPartyMPInvert(toggle) |
||
714 | local statusBar = ArchaeologistStatusBars["party1"].frame.manabar; |
||
715 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
716 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
717 | |||
718 | statusBar = ArchaeologistStatusBars["party2"].frame.manabar; |
||
719 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
720 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
721 | |||
722 | statusBar = ArchaeologistStatusBars["party3"].frame.manabar; |
||
723 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
724 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
725 | |||
726 | statusBar = ArchaeologistStatusBars["party4"].frame.manabar; |
||
727 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
728 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
729 | end |
||
730 | |||
731 | --only used to call onload since no more accurate data is provided |
||
732 | function Archaeologist_TurnOnTargetHPInvert(toggle) |
||
733 | local statusBar = ArchaeologistStatusBars["target"].frame.healthbar; |
||
734 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
735 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
736 | end |
||
737 | |||
738 | function Archaeologist_TurnOnTargetMPInvert(toggle) |
||
739 | local statusBar = ArchaeologistStatusBars["target"].frame.manabar; |
||
740 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
741 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
742 | end |
||
743 | |||
744 | |||
745 | function Archaeologist_TurnOnPetHPInvert(toggle) |
||
746 | local statusBar = ArchaeologistStatusBars["pet"].frame.healthbar; |
||
747 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
748 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
749 | end |
||
750 | |||
751 | function Archaeologist_TurnOnPetMPInvert(toggle) |
||
752 | local statusBar = ArchaeologistStatusBars["pet"].frame.manabar; |
||
753 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
754 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
755 | end |
||
756 | |||
757 | function Archaeologist_TurnOnPetXPInvert(toggle) |
||
758 | local statusBar = PetPaperDollFrameExpBar; |
||
759 | Archaeologist_TextStringInvertStatusBars[statusBar:GetName()] = toggle; |
||
760 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
761 | end |
||
762 | |||
763 | -- <= == == == == == == == == == == == == => |
||
764 | -- => Hide HP/MP/XP Value Prefix Functions |
||
765 | -- <= == == == == == == == == == == == == => |
||
766 | |||
767 | function Archaeologist_UnitFrame_UpdateManaType(unitFrame) |
||
768 | if ( not unitFrame ) then |
||
769 | unitFrame = this; |
||
770 | end |
||
771 | if ( not unitFrame.manabar ) then |
||
772 | return; |
||
773 | end |
||
774 | local info = ManaBarColor[UnitPowerType(unitFrame.unit)]; |
||
775 | unitFrame.manabar:SetStatusBarColor(info.r, info.g, info.b); |
||
776 | |||
777 | -- Update the manabar prefix only if not hidden |
||
778 | if ( Archaeologist_ManaPrefixNotHidden(unitFrame) ) then |
||
779 | SetTextStatusBarTextPrefix(unitFrame.manabar, info.prefix); |
||
780 | TextStatusBar_UpdateTextString(unitFrame.manabar); |
||
781 | end |
||
782 | |||
783 | -- Setup newbie tooltip |
||
784 | if ( unitFrame:GetName() == "PlayerFrame" ) then |
||
785 | unitFrame.manabar.tooltipTitle = info.prefix; |
||
786 | unitFrame.manabar.tooltipText = getglobal("NEWBIE_TOOLTIP_MANABAR"..UnitPowerType(unitFrame.unit)); |
||
787 | else |
||
788 | unitFrame.manabar.tooltipTitle = nil; |
||
789 | unitFrame.manabar.tooltipText = nil; |
||
790 | end |
||
791 | |||
792 | end |
||
793 | |||
794 | |||
795 | function Archaeologist_ManaPrefixNotHidden(frame) |
||
796 | if ( (ArchaeologistVars["PLAYERMPNOPREFIX"] == 0) and (frame == ArchaeologistStatusBars.player.frame) ) or |
||
797 | ( (ArchaeologistVars["PARTYMPNOPREFIX"] == 0) and ( |
||
798 | (frame == ArchaeologistStatusBars.party1.frame) or |
||
799 | (frame == ArchaeologistStatusBars.party2.frame) or |
||
800 | (frame == ArchaeologistStatusBars.party3.frame) or |
||
801 | (frame == ArchaeologistStatusBars.party4.frame) |
||
802 | ) ) or |
||
803 | ( (ArchaeologistVars["PETMPNOPREFIX"] == 0) and (frame == ArchaeologistStatusBars.pet.frame) ) or |
||
804 | ( (ArchaeologistVars["TARGETMPNOPREFIX"] == 0) and (frame == ArchaeologistStatusBars.target.frame) ) |
||
805 | then |
||
806 | return true; |
||
807 | end |
||
808 | end |
||
809 | |||
810 | |||
811 | function Archaeologist_TurnOffUnitHPPrefix(unit, toggle) |
||
812 | local statusBar = ArchaeologistStatusBars[unit].frame.healthbar; |
||
813 | if (toggle == 1) then |
||
814 | SetTextStatusBarTextPrefix(statusBar, nil); |
||
815 | else |
||
816 | SetTextStatusBarTextPrefix(statusBar, TEXT(HEALTH)); |
||
817 | end |
||
818 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
819 | end |
||
820 | |||
821 | function Archaeologist_TurnOffUnitMPPrefix(unit, toggle) |
||
822 | local statusBar = ArchaeologistStatusBars[unit].frame.manabar; |
||
823 | if (toggle == 1) then |
||
824 | SetTextStatusBarTextPrefix(statusBar, nil); |
||
825 | else |
||
826 | SetTextStatusBarTextPrefix(statusBar, ManaBarColor[UnitPowerType(unit)].prefix); |
||
827 | end |
||
828 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
829 | end |
||
830 | |||
831 | |||
832 | function Archaeologist_TurnOffPlayerHPPrefix(toggle) |
||
833 | Archaeologist_TurnOffUnitHPPrefix("player", toggle) |
||
834 | end |
||
835 | |||
836 | function Archaeologist_TurnOffPlayerMPPrefix(toggle) |
||
837 | Archaeologist_TurnOffUnitMPPrefix("player", toggle) |
||
838 | end |
||
839 | |||
840 | function Archaeologist_TurnOffPlayerXPPrefix(toggle) |
||
841 | local statusBar = MainMenuExpBar; |
||
842 | if (toggle == 1) then |
||
843 | SetTextStatusBarTextPrefix(statusBar, nil); |
||
844 | else |
||
845 | SetTextStatusBarTextPrefix(statusBar, TEXT(XP)); |
||
846 | end |
||
847 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
848 | end |
||
849 | |||
850 | function Archaeologist_TurnOffPartyHPPrefix(toggle) |
||
851 | Archaeologist_TurnOffUnitHPPrefix("party1", toggle) |
||
852 | Archaeologist_TurnOffUnitHPPrefix("party2", toggle) |
||
853 | Archaeologist_TurnOffUnitHPPrefix("party3", toggle) |
||
854 | Archaeologist_TurnOffUnitHPPrefix("party4", toggle) |
||
855 | end |
||
856 | |||
857 | function Archaeologist_TurnOffPartyMPPrefix(toggle) |
||
858 | Archaeologist_TurnOffUnitMPPrefix("party1", toggle) |
||
859 | Archaeologist_TurnOffUnitMPPrefix("party2", toggle) |
||
860 | Archaeologist_TurnOffUnitMPPrefix("party3", toggle) |
||
861 | Archaeologist_TurnOffUnitMPPrefix("party4", toggle) |
||
862 | end |
||
863 | |||
864 | function Archaeologist_TurnOffTargetHPPrefix(toggle) |
||
865 | Archaeologist_TurnOffUnitHPPrefix("target", toggle) |
||
866 | end |
||
867 | |||
868 | function Archaeologist_TurnOffTargetMPPrefix(toggle) |
||
869 | Archaeologist_TurnOffUnitMPPrefix("target", toggle) |
||
870 | end |
||
871 | |||
872 | |||
873 | function Archaeologist_TurnOffPetHPPrefix(toggle) |
||
874 | Archaeologist_TurnOffUnitHPPrefix("pet", toggle) |
||
875 | end |
||
876 | |||
877 | function Archaeologist_TurnOffPetMPPrefix(toggle) |
||
878 | Archaeologist_TurnOffUnitMPPrefix("pet", toggle) |
||
879 | end |
||
880 | |||
881 | function Archaeologist_TurnOffPetXPPrefix(toggle) |
||
882 | local statusBar = PetPaperDollFrameExpBar; |
||
883 | if (toggle == 1) then |
||
884 | SetTextStatusBarTextPrefix(statusBar, nil); |
||
885 | else |
||
886 | SetTextStatusBarTextPrefix(statusBar, TEXT(XP)); |
||
887 | end |
||
888 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
889 | end |
||
890 | |||
891 | |||
892 | -- <= == == == == == == == == == == == == => |
||
893 | -- => Status HP/MP/XP Bar Overrides |
||
894 | -- <= == == == == == == == == == == == == => |
||
895 | |||
896 | function OverrideShowStatusBarText(bar, toggle) |
||
897 | if (type(toggle) == "string") then |
||
898 | if (toggle == "on") then |
||
899 | SetStatusBarTextOverride(bar, 1); |
||
900 | elseif (toggle == "off") then |
||
901 | SetStatusBarTextOverride(bar, 0); |
||
902 | else --mouseover |
||
903 | SetStatusBarTextOverride(bar, nil); |
||
904 | end |
||
905 | else |
||
906 | if (toggle == 1) then |
||
907 | SetStatusBarTextOverride(bar, 1); |
||
908 | else |
||
909 | SetStatusBarTextOverride(bar, nil); |
||
910 | end |
||
911 | end |
||
912 | end |
||
913 | |||
914 | function OverrideShowStatusBarText2(bar, toggle) |
||
915 | if (type(toggle) == "string") then |
||
916 | if (toggle == "on") then |
||
917 | SetStatusBarTextOverride2(bar, 1); |
||
918 | elseif (toggle == "off") then |
||
919 | SetStatusBarTextOverride2(bar, 0); |
||
920 | else --mouseover |
||
921 | SetStatusBarTextOverride2(bar, nil); |
||
922 | end |
||
923 | else |
||
924 | if (toggle == 1) then |
||
925 | SetStatusBarTextOverride2(bar, 1); |
||
926 | else |
||
927 | SetStatusBarTextOverride2(bar, nil); |
||
928 | end |
||
929 | end |
||
930 | end |
||
931 | |||
932 | --[[unused.. yet |
||
933 | function OverrideHideStatusBarText(bar, toggle) |
||
934 | if (toggle == 1) then |
||
935 | SetStatusBarTextOverride(bar, 0); |
||
936 | else |
||
937 | SetStatusBarTextOverride(bar, nil); |
||
938 | end |
||
939 | end |
||
940 | ]]-- |
||
941 | |||
942 | --sets the override for StatusBarTexts. |
||
943 | --override = nil removes override, 0 sets to hide, 1 sets to show |
||
944 | function SetStatusBarTextOverride(bar, override) |
||
945 | if(not bar) then |
||
946 | return; |
||
947 | end |
||
948 | if(override == "1" or override == 1 or override == "show") then |
||
949 | bar.override = "show"; |
||
950 | --UIOptionsFrameCheckButtons["STATUS_BAR_TEXT"].value = "1" |
||
951 | ShowTextStatusBarText(bar); |
||
952 | elseif(override == "0" or override == 0 or override == "hide") then |
||
953 | bar.override = "hide"; |
||
954 | HideTextStatusBarText(bar); |
||
955 | else |
||
956 | bar.override = nil; |
||
957 | HideTextStatusBarText(bar); |
||
958 | end |
||
959 | end |
||
960 | |||
961 | --sets the override for secondary StatusBarTexts. |
||
962 | --override = nil removes override, 0 sets to hide, 1 sets to show |
||
963 | function SetStatusBarTextOverride2(bar, override) |
||
964 | if(not bar) then |
||
965 | return; |
||
966 | end |
||
967 | if(override == "1" or override == 1 or override == "show") then |
||
968 | bar.override2 = "show"; |
||
969 | Archaeologist_ShowTextStatusBarText2(bar); |
||
970 | elseif(override == "0" or override == 0 or override == "hide") then |
||
971 | bar.override2 = "hide"; |
||
972 | Archaeologist_HideTextStatusBarText2(bar); |
||
973 | else |
||
974 | bar.override2 = nil; |
||
975 | Archaeologist_HideTextStatusBarText2(bar); |
||
976 | end |
||
977 | end |
||
978 | |||
979 | |||
980 | --updates old lockShow to the new override notation |
||
981 | local function ConvertLockShowToOverrideSyntax(bar) |
||
982 | if (bar.textLockable) then |
||
983 | bar.textLockable = nil; |
||
984 | end |
||
985 | if (bar.lockShow) then |
||
986 | if (bar.lockShow == 1) then |
||
987 | bar.override = "show"; |
||
988 | end |
||
989 | bar.lockShow = nil; |
||
990 | end |
||
991 | end |
||
992 | |||
993 | |||
994 | --allows the setting of textStatusBar.oneText to override other values if value = 1 |
||
995 | --used to hide hp text of a ghost |
||
996 | --also added optional percents |
||
997 | function Archaeologist_TextStatusBar_UpdateTextString(textStatusBar) |
||
998 | if ( not textStatusBar ) then |
||
999 | textStatusBar = this; |
||
1000 | end |
||
1001 | local string = textStatusBar.TextString; |
||
1002 | local string2 = textStatusBar.TextString2; |
||
1003 | if (string) then |
||
1004 | local value = textStatusBar:GetValue(); |
||
1005 | local valueMin, valueMax = textStatusBar:GetMinMaxValues(); |
||
1006 | if ( valueMax > 0 ) then |
||
1007 | textStatusBar:Show(); |
||
1008 | if ( value == 0 and textStatusBar.zeroText ) then |
||
1009 | string:SetText(textStatusBar.zeroText); |
||
1010 | textStatusBar.isZero = 1; |
||
1011 | ShowTextStatusBarText(textStatusBar); |
||
1012 | elseif ( value == 1 and textStatusBar.oneText ) then |
||
1013 | string:SetText(textStatusBar.oneText); |
||
1014 | textStatusBar.isOne = 1; |
||
1015 | string:Show(); |
||
1016 | ShowTextStatusBarText(textStatusBar); |
||
1017 | else |
||
1018 | textStatusBar.isZero = nil; |
||
1019 | textStatusBar.isOne = nil; |
||
1020 | |||
1021 | local stringText1, stringText2 = Archaeologist_GetCurrentTextStrings( |
||
1022 | value, valueMax, |
||
1023 | textStatusBar.prefix, |
||
1024 | (not Archaeologist_TextStringPercentStatusBars[textStatusBar:GetName()]) or (Archaeologist_TextStringPercentStatusBars[textStatusBar:GetName()] == 1), |
||
1025 | (Archaeologist_TextStringValueStatusBars[textStatusBar:GetName()] == 1), |
||
1026 | (Archaeologist_TextStringInvertStatusBars[textStatusBar:GetName()] == 1), |
||
1027 | (textStatusBar == TargetFrame.healthbar) and (valueMax == 100), |
||
1028 | (Archaeologist_TextStringAltTextStatusBars[textStatusBar:GetName()] == 1), |
||
1029 | (textStatusBar == TargetFrame.healthbar) and (ArchaeologistVars["USEHPVALUE"] == 1) |
||
1030 | ); |
||
1031 | string:SetText(stringText1); |
||
1032 | if (string2) then |
||
1033 | string2:SetText(stringText2); |
||
1034 | end |
||
1035 | |||
1036 | if (textStatusBar.override == "show") or (textStatusBar:GetLeft()) and (MouseIsOver(textStatusBar)) then |
||
1037 | ShowTextStatusBarText(textStatusBar); |
||
1038 | else |
||
1039 | HideTextStatusBarText(textStatusBar); |
||
1040 | end |
||
1041 | |||
1042 | if (textStatusBar.override2 == "show") or (textStatusBar:GetLeft()) and (MouseIsOver(textStatusBar)) then |
||
1043 | Archaeologist_ShowTextStatusBarText2(textStatusBar); |
||
1044 | else |
||
1045 | Archaeologist_HideTextStatusBarText2(textStatusBar); |
||
1046 | end |
||
1047 | end |
||
1048 | else |
||
1049 | textStatusBar:Hide(); |
||
1050 | end |
||
1051 | end |
||
1052 | end |
||
1053 | |||
1054 | function Archaeologist_GetCurrentTextStrings(value, valueMax, prefix, percent, exactValue, invert, isMob, altText, useHpValue) |
||
1055 | |||
1056 | local stringText1 = ""; |
||
1057 | local stringText2 = ""; |
||
1058 | local percentText = ""; |
||
1059 | local valueText = ""; |
||
1060 | |||
1061 | if (invert) then |
||
1062 | percentText = "-"..(100 - Sea.math.round(value / valueMax * 100)).."%"; |
||
1063 | else |
||
1064 | percentText = Sea.math.round(value / valueMax * 100).."%"; |
||
1065 | end |
||
1066 | |||
1067 | if (isMob) then |
||
1068 | if (MobHealth_GetTargetCurHP) and (MobHealth_GetTargetMaxHP) and (ArchaeologistVars["MOBHEALTH"] == 1) then |
||
1069 | local mobValue = MobHealth_GetTargetCurHP(); |
||
1070 | local mobValueMax = MobHealth_GetTargetMaxHP(); |
||
1071 | if (mobValue) and (mobValueMax) and (mobValueMax ~= 0) then |
||
1072 | if (invert) then |
||
1073 | valueText = "-"..(mobValueMax-mobValue).." / "..mobValueMax; |
||
1074 | else |
||
1075 | valueText = mobValue.." / "..mobValueMax; |
||
1076 | end |
||
1077 | end |
||
1078 | end |
||
1079 | elseif (invert) then |
||
1080 | valueText = "-"..(valueMax-value).." / "..valueMax; |
||
1081 | else |
||
1082 | valueText = value.." / "..valueMax; |
||
1083 | end |
||
1084 | |||
1085 | if (percent) and (exactValue) then |
||
1086 | stringText1 = percentText.." "..valueText; |
||
1087 | stringText2 = percentText.." "..valueText; |
||
1088 | elseif (useHpValue) and (valueText ~= "") then |
||
1089 | stringText1 = valueText; |
||
1090 | stringText2 = valueText; |
||
1091 | elseif (percent) then |
||
1092 | stringText1 = percentText; |
||
1093 | stringText2 = valueText; |
||
1094 | elseif (exactValue) then |
||
1095 | stringText1 = valueText; |
||
1096 | stringText2 = valueText; |
||
1097 | end |
||
1098 | |||
1099 | if (altText) then |
||
1100 | local temp = stringText1; |
||
1101 | stringText1 = stringText2; |
||
1102 | stringText2 = temp; |
||
1103 | end |
||
1104 | if (prefix) then |
||
1105 | stringText1 = prefix.." "..stringText1; |
||
1106 | end |
||
1107 | return stringText1, stringText2; |
||
1108 | end |
||
1109 | |||
1110 | --removes lockShow and adds override |
||
1111 | function Archaeologist_ShowTextStatusBarText(bar) |
||
1112 | if ( bar and bar.TextString ) then |
||
1113 | ConvertLockShowToOverrideSyntax(bar); |
||
1114 | if (bar.override ~= "hide") then |
||
1115 | bar.TextString:Show(); |
||
1116 | end |
||
1117 | end |
||
1118 | end |
||
1119 | |||
1120 | function Archaeologist_ShowTextStatusBarText2(bar) |
||
1121 | if ( bar and bar.TextString2 ) then |
||
1122 | if (bar.override2 ~= "hide") then |
||
1123 | bar.TextString2:Show(); |
||
1124 | end |
||
1125 | end |
||
1126 | end |
||
1127 | |||
1128 | --removes old lockShow, adds override, adds visibility for isOne, and removes UIOptions check |
||
1129 | --effectively breaks the 'Show HP/Mana/XP Always Vislible' in the default UIOptions |
||
1130 | function Archaeologist_HideTextStatusBarText(bar) |
||
1131 | if ( bar and bar.TextString ) then |
||
1132 | ConvertLockShowToOverrideSyntax(bar); |
||
1133 | if (bar.override == "hide") then |
||
1134 | bar.TextString:Hide(); |
||
1135 | elseif (bar.isZero) or (bar.isOne) or (bar.override == "show") then -- or (MouseIsOver(bar)) then |
||
1136 | bar.TextString:Show(); |
||
1137 | else |
||
1138 | bar.TextString:Hide(); |
||
1139 | end |
||
1140 | end |
||
1141 | end |
||
1142 | |||
1143 | function Archaeologist_HideTextStatusBarText2(bar) |
||
1144 | if ( bar and bar.TextString2 ) then |
||
1145 | if (bar.override2 == "hide") then |
||
1146 | bar.TextString2:Hide(); |
||
1147 | elseif (bar.isZero) or (bar.isOne) or (bar.override2 == "show") then -- or (MouseIsOver(bar)) then |
||
1148 | bar.TextString2:Show(); |
||
1149 | else |
||
1150 | bar.TextString2:Hide(); |
||
1151 | end |
||
1152 | end |
||
1153 | end |
||
1154 | |||
1155 | function Archaeologist_HookStatusBars_OnLeave() |
||
1156 | local afterHook = function(bar) |
||
1157 | Archaeologist_HideTextStatusBarText2(bar); |
||
1158 | end |
||
1159 | for unit, data in ArchaeologistStatusBars do |
||
1160 | local bar1 = data.frame.healthbar; |
||
1161 | setglobal("Archaeologist_"..bar1:GetName().."_OnLeave_orig", bar1:GetScript("OnLeave")); |
||
1162 | bar1:SetScript("OnLeave", function() getglobal("Archaeologist_"..bar1:GetName().."_OnLeave_orig")(); afterHook(bar1); end); |
||
1163 | |||
1164 | local bar2 = data.frame.manabar; |
||
1165 | setglobal("Archaeologist_"..bar2:GetName().."_OnLeave_orig", bar2:GetScript("OnLeave")); |
||
1166 | bar2:SetScript("OnLeave", function() getglobal("Archaeologist_"..bar2:GetName().."_OnLeave_orig")(); afterHook(bar2); end); |
||
1167 | end |
||
1168 | end |
||
1169 | |||
1170 | --sets bar.oneText |
||
1171 | function SetTextStatusBarTextOneText(bar, oneText) |
||
1172 | if ( bar and bar.TextString ) then |
||
1173 | bar.oneText = oneText; |
||
1174 | end |
||
1175 | end |
||
1176 | |||
1177 | function Archaeologist_CharacterFrame_OnShow() |
||
1178 | PlaySound("igCharacterInfoOpen"); |
||
1179 | SetPortraitTexture(CharacterFramePortrait, "player"); |
||
1180 | CharacterNameText:SetText(UnitPVPName("player")); |
||
1181 | UpdateMicroButtons(); |
||
1182 | OverrideShowStatusBarText(PlayerFrameHealthBar, 1); |
||
1183 | OverrideShowStatusBarText(PlayerFrameManaBar, 1); |
||
1184 | OverrideShowStatusBarText(MainMenuExpBar, 1); |
||
1185 | end |
||
1186 | |||
1187 | function Archaeologist_CharacterFrame_OnHide() |
||
1188 | PlaySound("igCharacterInfoClose"); |
||
1189 | UpdateMicroButtons(); |
||
1190 | Archaeologist_RestorePlayerHP(); |
||
1191 | Archaeologist_RestorePlayerMP(); |
||
1192 | Archaeologist_RestorePlayerXP(); |
||
1193 | end |
||
1194 | |||
1195 | -- <= == == == == == == == == == == == == => |
||
1196 | -- => Dead/Offline/Ghost Status Overrides |
||
1197 | -- <= == == == == == == == == == == == == => |
||
1198 | |||
1199 | |||
1200 | function Archaeologist_TargetCheckDead() |
||
1201 | local unit = "target"; |
||
1202 | local healthbar = ArchaeologistStatusBars[unit].frame.healthbar; |
||
1203 | local manabar = ArchaeologistStatusBars[unit].frame.manabar; |
||
1204 | local statusText = ArchaeologistStatusBars[unit].statusText; |
||
1205 | Archaeologist_UnitCheckDead(unit, statusText, healthbar, manabar); |
||
1206 | end |
||
1207 | |||
1208 | |||
1209 | function Archaeologist_PartyCheckDead(partyIndex) |
||
1210 | if (type(partyIndex) ~= "number") then |
||
1211 | return; |
||
1212 | end |
||
1213 | local unit = "party"..partyIndex; |
||
1214 | local healthbar = ArchaeologistStatusBars[unit].frame.healthbar; |
||
1215 | local manabar = ArchaeologistStatusBars[unit].frame.manabar; |
||
1216 | local statusText = ArchaeologistStatusBars[unit].statusText; |
||
1217 | Archaeologist_UnitCheckDead(unit, statusText, healthbar, manabar); |
||
1218 | end |
||
1219 | |||
1220 | |||
1221 | function Archaeologist_UpdatePartyMembersDead() |
||
1222 | if (GetNumPartyMembers() > 0) then |
||
1223 | for i=1, GetNumPartyMembers() do |
||
1224 | Archaeologist_PartyCheckDead(i); |
||
1225 | end |
||
1226 | end |
||
1227 | end |
||
1228 | |||
1229 | |||
1230 | function Archaeologist_PlayerCheckDead() |
||
1231 | local unit = "player"; |
||
1232 | local healthbar = ArchaeologistStatusBars[unit].frame.healthbar; |
||
1233 | local manabar = ArchaeologistStatusBars[unit].frame.manabar; |
||
1234 | local statusText = ArchaeologistStatusBars[unit].statusText; |
||
1235 | Archaeologist_UnitCheckDead(unit, statusText, healthbar, manabar); |
||
1236 | end |
||
1237 | |||
1238 | |||
1239 | function Archaeologist_PetCheckDead() |
||
1240 | local unit = "pet"; |
||
1241 | local healthbar = ArchaeologistStatusBars[unit].frame.healthbar; |
||
1242 | local manabar = ArchaeologistStatusBars[unit].frame.manabar; |
||
1243 | local statusText = ArchaeologistStatusBars[unit].statusText; |
||
1244 | Archaeologist_UnitCheckDead(unit, statusText, healthbar, manabar); |
||
1245 | end |
||
1246 | |||
1247 | |||
1248 | function Archaeologist_UnitCheckDead(unit, statusText, healthbar, manabar) |
||
1249 | --adds Dead text if unit is Dead |
||
1250 | --adds Offline text if unit is a player and not connected |
||
1251 | --adds Ghost/Wisp text if unit is a player |
||
1252 | |||
1253 | if ( UnitIsDead(unit) ) and ( Archaeologist_UnitIsConnected(unit) ) then |
||
1254 | local _, class = UnitClass(unit); |
||
1255 | if (ArchaeologistStatusBars[unit].frame.feigning) or (class == "HUNTER" and UnitIsEnemy("player", unit)) then |
||
1256 | statusText:SetText(FEIGN_DEATH); |
||
1257 | else |
||
1258 | statusText:SetText(DEAD); |
||
1259 | end |
||
1260 | statusText:Show(); |
||
1261 | |||
1262 | --hide health/mana if dead |
||
1263 | SetTextStatusBarTextZeroText(healthbar, ""); |
||
1264 | SetTextStatusBarTextZeroText(manabar, ""); |
||
1265 | |||
1266 | elseif ( UnitIsPlayer(unit) ) and ( not Archaeologist_UnitIsConnected(unit) ) then |
||
1267 | |||
1268 | statusText:SetText(PLAYER_OFFLINE); |
||
1269 | healthbar:Hide(); |
||
1270 | manabar:Hide(); |
||
1271 | --!!!!!!!!!!! |
||
1272 | --^^ add a status bar hook to change this. |
||
1273 | --!!!!!!!!!!! |
||
1274 | statusText:Show(); |
||
1275 | |||
1276 | --hide health/mana if offline |
||
1277 | SetTextStatusBarTextZeroText(healthbar, ""); |
||
1278 | SetTextStatusBarTextZeroText(manabar, ""); |
||
1279 | |||
1280 | elseif ( UnitIsGhost(unit) ) then |
||
1281 | |||
1282 | if ( UnitRace(unit) == "Night Elf" ) then |
||
1283 | statusText:SetText(PLAYER_WISP); |
||
1284 | else |
||
1285 | statusText:SetText(PLAYER_GHOST); |
||
1286 | end |
||
1287 | statusText:Show(); |
||
1288 | |||
1289 | --hide health/mana if ghost |
||
1290 | SetTextStatusBarTextOneText(healthbar, ""); |
||
1291 | SetTextStatusBarTextZeroText(manabar, ""); |
||
1292 | |||
1293 | else |
||
1294 | |||
1295 | statusText:Hide(); |
||
1296 | |||
1297 | --show health/mana if not dead, offline or ghost |
||
1298 | SetTextStatusBarTextZeroText(healthbar, nil); |
||
1299 | SetTextStatusBarTextOneText(healthbar, nil); |
||
1300 | SetTextStatusBarTextZeroText(manabar, nil); |
||
1301 | |||
1302 | --reset to override show |
||
1303 | ShowTextStatusBarText(healthbar); |
||
1304 | |||
1305 | end |
||
1306 | |||
1307 | TextStatusBar_UpdateTextString(healthbar); |
||
1308 | TextStatusBar_UpdateTextString(manabar); |
||
1309 | |||
1310 | end |
||
1311 | |||
1312 | function Archaeologist_UnitIsConnected(unit) |
||
1313 | ArchaeologistTooltip:SetUnit(unit); |
||
1314 | local tooltipOfflineLine = Sea.wow.tooltip.scan("ArchaeologistTooltip")[3]; |
||
1315 | Sea.wow.tooltip.clear("ArchaeologistTooltip"); |
||
1316 | local tooltipOfflineText; |
||
1317 | if ( tooltipOfflineLine ) then |
||
1318 | tooltipOfflineText = tooltipOfflineLine.left; |
||
1319 | end |
||
1320 | if (tooltipOfflineText == PLAYER_OFFLINE) then |
||
1321 | return; |
||
1322 | end |
||
1323 | return UnitIsConnected(unit); |
||
1324 | end |
||
1325 | |||
1326 | |||
1327 | -- <= == == == == == == == == == == == == => |
||
1328 | -- => Party and Pet Buffs |
||
1329 | -- <= == == == == == == == == == == == == => |
||
1330 | |||
1331 | function Archaeologist_UpdateOverlapPositions() |
||
1332 | Archaeologist_UpdatePartyMemberLocations(); |
||
1333 | Archaeologist_UpdatePartyPetLocations(); |
||
1334 | Archaeologist_UpdateTargetLocation(); |
||
1335 | end |
||
1336 | |||
1337 | function Archaeologist_UpdatePartyMemberLocations() |
||
1338 | local partyY = 0; --Normal Offset |
||
1339 | if (ArchaeologistVars["PPTBUFFS"] == 0) and (ArchaeologistVars["PPTDEBUFFS"] == 0) then |
||
1340 | partyY = -20; --Party Frames moved down 20 to make room for PartyPet Buffs and Debuffs |
||
1341 | end |
||
1342 | |||
1343 | if (not PartyMemberFrame2:IsUserPlaced()) then |
||
1344 | PartyMemberFrame2:ClearAllPoints() |
||
1345 | PartyMemberFrame2:SetPoint("TOPLEFT", "PartyMemberFrame1PetFrame", "BOTTOMLEFT", -23, -10+partyY); |
||
1346 | end |
||
1347 | if (not PartyMemberFrame3:IsUserPlaced()) then |
||
1348 | PartyMemberFrame3:ClearAllPoints() |
||
1349 | PartyMemberFrame3:SetPoint("TOPLEFT", "PartyMemberFrame2PetFrame", "BOTTOMLEFT", -23, -10+partyY); |
||
1350 | end |
||
1351 | if (not PartyMemberFrame4:IsUserPlaced()) then |
||
1352 | PartyMemberFrame4:ClearAllPoints() |
||
1353 | PartyMemberFrame4:SetPoint("TOPLEFT", "PartyMemberFrame3PetFrame", "BOTTOMLEFT", -23, -10+partyY); |
||
1354 | end |
||
1355 | end |
||
1356 | |||
1357 | function Archaeologist_UpdateTargetLocation() |
||
1358 | if (not TargetFrame:IsUserPlaced()) and (not PlayerFrame:IsUserPlaced()) then |
||
1359 | if (PlayerFrame:GetRight()) then |
||
1360 | local y = TargetFrame:GetTop() - UIParent:GetTop(); |
||
1361 | local x = PlayerFrame:GetRight(); |
||
1362 | if (ArchaeologistVars["TARGETHP2"] == "on") or (ArchaeologistVars["TARGETMP2"] == "on") or (ArchaeologistVars["PLAYERHP2"] == "on") or (ArchaeologistVars["PLAYERMP2"] == "on") then |
||
1363 | -- Only Move if the Secondary Display is on |
||
1364 | TargetFrame:ClearAllPoints() |
||
1365 | TargetFrame:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", x+145, y); |
||
1366 | elseif (ArchaeologistVars["TARGETHP2"] == "mouseover") or (ArchaeologistVars["TARGETMP2"] == "mouseover") or (ArchaeologistVars["PLAYERHP2"] == "mouseover") or (ArchaeologistVars["PLAYERMP2"] == "mouseover") then |
||
1367 | -- Adjust for single Secondary Display mouseover |
||
1368 | TargetFrame:ClearAllPoints(); |
||
1369 | TargetFrame:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", x+75, y); |
||
1370 | else |
||
1371 | --Default |
||
1372 | TargetFrame:ClearAllPoints(); |
||
1373 | TargetFrame:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 250, y); |
||
1374 | end |
||
1375 | else |
||
1376 | --Dumb GetLeft == nil bug... don't do anything |
||
1377 | end |
||
1378 | end |
||
1379 | end |
||
1380 | |||
1381 | function Archaeologist_PartyMemberFrame_UpdatePet(id) |
||
1382 | if ( not id ) then |
||
1383 | id = this:GetID(); |
||
1384 | end |
||
1385 | |||
1386 | local frameName = "PartyMemberFrame"..id; |
||
1387 | local petFrame = getglobal("PartyMemberFrame"..id.."PetFrame"); |
||
1388 | |||
1389 | local partypetY = 0; --Normal Offset |
||
1390 | if ( UnitIsConnected("party"..id) and UnitExists("partypet"..id) and SHOW_PARTY_PETS == "1" ) then |
||
1391 | petFrame:Show(); |
||
1392 | if (not petFrame:IsUserPlaced()) then |
||
1393 | if (ArchaeologistVars["PBUFFS"] == 0) and (ArchaeologistVars["PDEBUFFS"] == 0) and (ArchaeologistVars["DEBUFFALT"] == 1) then |
||
1394 | partypetY = -20; --PartyPet Frames moved down 20 to make room for Pet Buffs and Debuffs |
||
1395 | end |
||
1396 | end |
||
1397 | else |
||
1398 | petFrame:Hide(); |
||
1399 | if (not petFrame:IsUserPlaced()) then |
||
1400 | partypetY = 16 --PartyPet Frames moved up 16 to close party member gap |
||
1401 | end |
||
1402 | end |
||
1403 | |||
1404 | petFrame:ClearAllPoints(); |
||
1405 | petFrame:SetPoint("TOPLEFT", frameName, "TOPLEFT", 23, -43+partypetY); |
||
1406 | |||
1407 | PartyMemberFrame_RefreshPetBuffs(id); |
||
1408 | end |
||
1409 | |||
1410 | |||
1411 | function Archaeologist_PartyMemberFrame_RefreshBuffs() |
||
1412 | |||
1413 | local texture; |
||
1414 | if ( ArchaeologistVars["PBUFFS"] == 1 ) then |
||
1415 | for i=1, ArchaeologistVarData["PBUFFNUM"].max do |
||
1416 | getglobal(this:GetName().."NewBuff"..i):Hide(); |
||
1417 | end |
||
1418 | else |
||
1419 | this.feigning = nil; |
||
1420 | for i=1, ArchaeologistVarData["PBUFFNUM"].max do |
||
1421 | texture = UnitBuff("party"..this:GetID(), i); |
||
1422 | if (texture == "Interface\\Icons\\Ability_Rogue_FeignDeath") then |
||
1423 | this.feigning = true; |
||
1424 | end |
||
1425 | if ( texture ) and (i <= ArchaeologistVars["PBUFFNUM"]) then |
||
1426 | getglobal(this:GetName().."NewBuff"..i.."Icon"):SetTexture(texture); |
||
1427 | getglobal(this:GetName().."NewBuff"..i):SetID(i); |
||
1428 | getglobal(this:GetName().."NewBuff"..i):Show(); |
||
1429 | else |
||
1430 | getglobal(this:GetName().."NewBuff"..i):Hide(); |
||
1431 | end |
||
1432 | end |
||
1433 | end |
||
1434 | |||
1435 | if ( ArchaeologistVars["PDEBUFFS"] == 1 ) then |
||
1436 | for i=1, ArchaeologistVarData["PDEBUFFNUM"].max do |
||
1437 | getglobal(this:GetName().."NewDebuff"..i):Hide(); |
||
1438 | end |
||
1439 | else |
||
1440 | local texture; |
||
1441 | for i=1, ArchaeologistVarData["PDEBUFFNUM"].max do |
||
1442 | texture = UnitDebuff("party"..this:GetID(), i); |
||
1443 | if (texture) and (i <= ArchaeologistVars["PDEBUFFNUM"]) then |
||
1444 | getglobal(this:GetName().."NewDebuff"..i.."Icon"):SetTexture(texture); |
||
1445 | getglobal(this:GetName().."NewDebuff"..i):SetID(i); |
||
1446 | getglobal(this:GetName().."NewDebuff"..i):Show(); |
||
1447 | else |
||
1448 | getglobal(this:GetName().."NewDebuff"..i):Hide(); |
||
1449 | end |
||
1450 | end |
||
1451 | end |
||
1452 | |||
1453 | end |
||
1454 | |||
1455 | function Archaeologist_PartyMemberFrame_RefreshPetBuffs(id) |
||
1456 | if ( not id ) then |
||
1457 | id = this:GetID(); |
||
1458 | end |
||
1459 | local texture; |
||
1460 | local petFrame = "PartyMemberFrame"..id.."PetFrame" |
||
1461 | if ( ArchaeologistVars["PPTBUFFS"] == 1 ) then |
||
1462 | for i=1, ArchaeologistVarData["PPTBUFFNUM"].max do |
||
1463 | getglobal(petFrame.."NewBuff"..i):Hide(); |
||
1464 | end |
||
1465 | else |
||
1466 | for i=1, ArchaeologistVarData["PPTBUFFNUM"].max do |
||
1467 | texture = UnitBuff("partypet"..id, i); |
||
1468 | if ( texture ) and (i <= ArchaeologistVars["PPTBUFFNUM"]) then |
||
1469 | getglobal(petFrame.."NewBuff"..i.."Icon"):SetTexture(texture); |
||
1470 | getglobal(petFrame.."NewBuff"..i):Show(); |
||
1471 | else |
||
1472 | getglobal(petFrame.."NewBuff"..i):Hide(); |
||
1473 | end |
||
1474 | end |
||
1475 | end |
||
1476 | |||
1477 | if ( ArchaeologistVars["PPTDEBUFFS"] == 1 ) then |
||
1478 | for i=1, ArchaeologistVarData["PPTDEBUFFNUM"].max do |
||
1479 | getglobal(petFrame.."NewDebuff"..i):Hide(); |
||
1480 | end |
||
1481 | else |
||
1482 | for i=1, ArchaeologistVarData["PPTDEBUFFNUM"].max do |
||
1483 | texture = UnitDebuff("partypet"..id, i); |
||
1484 | if ( texture ) and (i <= ArchaeologistVars["PPTDEBUFFNUM"]) then |
||
1485 | getglobal(petFrame.."NewDebuff"..i.."Icon"):SetTexture(texture); |
||
1486 | getglobal(petFrame.."NewDebuff"..i):Show(); |
||
1487 | else |
||
1488 | getglobal(petFrame.."NewDebuff"..i):Hide(); |
||
1489 | end |
||
1490 | end |
||
1491 | end |
||
1492 | end |
||
1493 | |||
1494 | function Archaeologist_PetFrame_RefreshBuffs() |
||
1495 | |||
1496 | local texture; |
||
1497 | if ( ArchaeologistVars["PTBUFFS"] == 1 ) then |
||
1498 | for i=1, ArchaeologistVarData["PTBUFFNUM"].max do |
||
1499 | getglobal("PetFrameNewBuff"..i):Hide(); |
||
1500 | end |
||
1501 | else |
||
1502 | for i=1, ArchaeologistVarData["PTBUFFNUM"].max do |
||
1503 | texture = UnitBuff("pet", i); |
||
1504 | if ( texture ) and (i <= ArchaeologistVars["PTBUFFNUM"]) then |
||
1505 | getglobal("PetFrameNewBuff"..i.."Icon"):SetTexture(texture); |
||
1506 | getglobal("PetFrameNewBuff"..i):SetID(i); |
||
1507 | getglobal("PetFrameNewBuff"..i):Show(); |
||
1508 | else |
||
1509 | getglobal("PetFrameNewBuff"..i):Hide(); |
||
1510 | end |
||
1511 | end |
||
1512 | end |
||
1513 | |||
1514 | if ( ArchaeologistVars["PTDEBUFFS"] == 1 ) then |
||
1515 | for i=1, ArchaeologistVarData["PTDEBUFFNUM"].max do |
||
1516 | getglobal("PetFrameNewDebuff"..i):Hide(); |
||
1517 | end |
||
1518 | else |
||
1519 | local texture; |
||
1520 | for i=1, ArchaeologistVarData["PTDEBUFFNUM"].max do |
||
1521 | texture = UnitDebuff("pet", i); |
||
1522 | if (texture) and (i <= ArchaeologistVars["PTDEBUFFNUM"]) then |
||
1523 | getglobal("PetFrameNewDebuff"..i.."Icon"):SetTexture(texture); |
||
1524 | getglobal("PetFrameNewDebuff"..i):SetID(i); |
||
1525 | getglobal("PetFrameNewDebuff"..i):Show(); |
||
1526 | else |
||
1527 | getglobal("PetFrameNewDebuff"..i):Hide(); |
||
1528 | end |
||
1529 | end |
||
1530 | end |
||
1531 | |||
1532 | end |
||
1533 | |||
1534 | function Archaeologist_PetFrame_UpdateDebuffLocations() |
||
1535 | if (ArchaeologistVars["DEBUFFALT"] == 1) then |
||
1536 | if ( ArchaeologistVars["PTBUFFS"] == 1 ) then |
||
1537 | PetFrameNewDebuff1:ClearAllPoints(); |
||
1538 | PetFrameNewDebuff1:SetPoint("TOPLEFT", "PetFrame", "TOPLEFT", 48, -42); |
||
1539 | else |
||
1540 | PetFrameNewDebuff1:ClearAllPoints(); |
||
1541 | PetFrameNewDebuff1:SetPoint("TOP", "PetFrameNewBuff1", "BOTTOM", 0, -2); |
||
1542 | end |
||
1543 | else |
||
1544 | PetFrameNewDebuff1:ClearAllPoints(); |
||
1545 | PetFrameNewDebuff1:SetPoint("TOPLEFT", "PetFrame", "TOPLEFT", 120, -24); |
||
1546 | end |
||
1547 | end |
||
1548 | |||
1549 | function Archaeologist_PartyFrame_UpdateDebuffLocations() |
||
1550 | if (ArchaeologistVars["DEBUFFALT"] == 1) then |
||
1551 | if ( ArchaeologistVars["PBUFFS"] == 1 ) then |
||
1552 | for i=1, 4 do |
||
1553 | getglobal("PartyMemberFrame"..i.."NewDebuff1"):ClearAllPoints(); |
||
1554 | getglobal("PartyMemberFrame"..i.."NewDebuff1"):SetPoint("TOPLEFT", "PartyMemberFrame"..i, "TOPLEFT", 124, -12); |
||
1555 | end |
||
1556 | else |
||
1557 | for i=1, 4 do |
||
1558 | getglobal("PartyMemberFrame"..i.."NewDebuff1"):ClearAllPoints(); |
||
1559 | getglobal("PartyMemberFrame"..i.."NewDebuff1"):SetPoint("TOP", "PartyMemberFrame"..i.."NewBuff1", "BOTTOM", 0, -2); |
||
1560 | end |
||
1561 | end |
||
1562 | else |
||
1563 | for i=1, 4 do |
||
1564 | getglobal("PartyMemberFrame"..i.."NewDebuff1"):ClearAllPoints(); |
||
1565 | getglobal("PartyMemberFrame"..i.."NewDebuff1"):SetPoint("TOPLEFT", "PartyMemberFrame"..i, "TOPLEFT", 124, -14); |
||
1566 | end |
||
1567 | end |
||
1568 | Archaeologist_UpdatePartyPetLocations(); |
||
1569 | end |
||
1570 | |||
1571 | function Archaeologist_PartyPetFrame_UpdateDebuffLocations() |
||
1572 | if ( ArchaeologistVars["PPTBUFFS"] == 1 ) then |
||
1573 | for i=1, 4 do |
||
1574 | getglobal("PartyMemberFrame"..i.."PetFrameNewDebuff1"):ClearAllPoints(); |
||
1575 | getglobal("PartyMemberFrame"..i.."PetFrameNewDebuff1"):SetPoint("TOPLEFT", "PartyMemberFrame"..i.."PetFrame", "TOPLEFT", 24, -16); |
||
1576 | end |
||
1577 | else |
||
1578 | for i=1, 4 do |
||
1579 | getglobal("PartyMemberFrame"..i.."PetFrameNewDebuff1"):ClearAllPoints(); |
||
1580 | getglobal("PartyMemberFrame"..i.."PetFrameNewDebuff1"):SetPoint("TOP", "PartyMemberFrame"..i.."PetFrameNewBuff1", "BOTTOM", 0, -2); |
||
1581 | end |
||
1582 | end |
||
1583 | Archaeologist_UpdatePartyMemberLocations(); |
||
1584 | end |
||
1585 | |||
1586 | |||
1587 | function Archaeologist_UpdatePartyMemberBuffs() |
||
1588 | local tempThis = this; |
||
1589 | for i=1, MAX_PARTY_MEMBERS do |
||
1590 | if ( GetPartyMember(i) ) then |
||
1591 | this = getglobal("PartyMemberFrame"..i); |
||
1592 | Archaeologist_PartyMemberFrame_RefreshBuffs() |
||
1593 | end |
||
1594 | end |
||
1595 | this = tempThis; |
||
1596 | end |
||
1597 | |||
1598 | function Archaeologist_UpdatePartyPetBuffs() |
||
1599 | PartyMemberFrame_RefreshPetBuffs(1); |
||
1600 | PartyMemberFrame_RefreshPetBuffs(2); |
||
1601 | PartyMemberFrame_RefreshPetBuffs(3); |
||
1602 | PartyMemberFrame_RefreshPetBuffs(4); |
||
1603 | end |
||
1604 | |||
1605 | function Archaeologist_UpdatePartyPetLocations() |
||
1606 | PartyMemberFrame_UpdatePet(1); |
||
1607 | PartyMemberFrame_UpdatePet(2); |
||
1608 | PartyMemberFrame_UpdatePet(3); |
||
1609 | PartyMemberFrame_UpdatePet(4); |
||
1610 | end |
||
1611 | |||
1612 | function Archaeologist_PartyMemberBuffs_Update() |
||
1613 | --only show buff tooltip on mouseover if buffs are hidden |
||
1614 | if (arg1 == "pet") then |
||
1615 | return (ArchaeologistVars["PTBUFFS"] == 1); |
||
1616 | end |
||
1617 | return (ArchaeologistVars["PBUFFS"] == 1); |
||
1618 | end |
||
1619 | |||
1620 | |||
1621 | function Archaeologist_TurnOffPartyBuffs(toggle) |
||
1622 | Archaeologist_UpdatePartyMemberBuffs(); |
||
1623 | Archaeologist_PartyFrame_UpdateDebuffLocations(); |
||
1624 | end |
||
1625 | |||
1626 | function Archaeologist_TurnOffPartyPetBuffs(toggle) |
||
1627 | Archaeologist_UpdatePartyPetBuffs(); |
||
1628 | Archaeologist_PartyPetFrame_UpdateDebuffLocations(); |
||
1629 | end |
||
1630 | |||
1631 | function Archaeologist_TurnOffPetBuffs(toggle) |
||
1632 | Archaeologist_PetFrame_RefreshBuffs(); |
||
1633 | Archaeologist_PetFrame_UpdateDebuffLocations(); |
||
1634 | end |
||
1635 | |||
1636 | |||
1637 | function Archaeologist_TurnOffPartyDebuffs(toggle) |
||
1638 | Archaeologist_UpdatePartyMemberBuffs(); |
||
1639 | Archaeologist_UpdatePartyPetLocations(); |
||
1640 | end |
||
1641 | |||
1642 | function Archaeologist_TurnOffPartyPetDebuffs(toggle) |
||
1643 | Archaeologist_UpdatePartyPetBuffs(); |
||
1644 | Archaeologist_UpdatePartyMemberLocations(); |
||
1645 | end |
||
1646 | |||
1647 | function Archaeologist_TurnOffPetDebuffs(toggle) |
||
1648 | Archaeologist_PetFrame_RefreshBuffs(); |
||
1649 | end |
||
1650 | |||
1651 | |||
1652 | function Archaeologist_SetPartyBuffs(count) |
||
1653 | if (count) then |
||
1654 | Archaeologist_UpdatePartyMemberBuffs(); |
||
1655 | end |
||
1656 | end |
||
1657 | |||
1658 | function Archaeologist_SetPartyPetBuffs(count) |
||
1659 | if (count) then |
||
1660 | Archaeologist_UpdatePartyPetBuffs(); |
||
1661 | end |
||
1662 | end |
||
1663 | |||
1664 | function Archaeologist_SetPetBuffs(count) |
||
1665 | if (count) then |
||
1666 | Archaeologist_PetFrame_RefreshBuffs(); |
||
1667 | end |
||
1668 | end |
||
1669 | |||
1670 | |||
1671 | function Archaeologist_SetPartyDebuffs(count) |
||
1672 | if (count) then |
||
1673 | Archaeologist_UpdatePartyMemberBuffs(); |
||
1674 | end |
||
1675 | end |
||
1676 | |||
1677 | function Archaeologist_SetPartyPetDebuffs(count) |
||
1678 | if (count) then |
||
1679 | Archaeologist_UpdatePartyPetBuffs(); |
||
1680 | end |
||
1681 | end |
||
1682 | |||
1683 | function Archaeologist_SetPetDebuffs(count) |
||
1684 | if (count) then |
||
1685 | Archaeologist_PetFrame_RefreshBuffs(); |
||
1686 | end |
||
1687 | end |
||
1688 | |||
1689 | -- <= == == == == == == == == == == == == => |
||
1690 | -- => Target Buffs |
||
1691 | -- <= == == == == == == == == == == == == => |
||
1692 | |||
1693 | function Archaeologist_HideOrigTargetBuffs() |
||
1694 | for i=1, MAX_TARGET_BUFFS do |
||
1695 | getglobal("TargetFrameBuff"..i):Hide(); |
||
1696 | end |
||
1697 | for i=1, MAX_TARGET_DEBUFFS do |
||
1698 | getglobal("TargetFrameDebuff"..i):Hide(); |
||
1699 | end |
||
1700 | --for i=1, MAX_PARTY_DEBUFFS do |
||
1701 | -- getglobal("PartyMemberFrame"..i.."PetFrameDebuff"):Hide(); |
||
1702 | --end |
||
1703 | end |
||
1704 | |||
1705 | function Archaeologist_TargetDebuffButton_Update() |
||
1706 | |||
1707 | local button, debuff, debuffButton, buff, buffButton, debuffCount, debuffApplications; |
||
1708 | local numBuffs = 0; |
||
1709 | TargetFrame.feigning = nil; |
||
1710 | for i=1, ArchaeologistVarData["TBUFFNUM"].max do |
||
1711 | buff = UnitBuff("target", i); |
||
1712 | if (buff == "Interface\\Icons\\Ability_Rogue_FeignDeath") then |
||
1713 | TargetFrame.feigning = true; |
||
1714 | end |
||
1715 | button = getglobal("TargetFrameNewBuff"..i); |
||
1716 | if ( buff ) and (i <= ArchaeologistVars["TBUFFNUM"]) and (ArchaeologistVars["TBUFFS"] == 0) then |
||
1717 | getglobal("TargetFrameNewBuff"..i.."Icon"):SetTexture(buff); |
||
1718 | button:Show(); |
||
1719 | button.id = i; |
||
1720 | numBuffs = numBuffs + 1; |
||
1721 | else |
||
1722 | button:Hide(); |
||
1723 | end |
||
1724 | end |
||
1725 | local numDebuffs = 0; |
||
1726 | for i=1, ArchaeologistVarData["TDEBUFFNUM"].max do |
||
1727 | debuff, debuffApplications = UnitDebuff("target", i); |
||
1728 | button = getglobal("TargetFrameNewDebuff"..i); |
||
1729 | if ( debuff ) and (i <= ArchaeologistVars["TDEBUFFNUM"]) and (ArchaeologistVars["TDEBUFFS"] == 0) then |
||
1730 | getglobal("TargetFrameNewDebuff"..i.."Icon"):SetTexture(debuff); |
||
1731 | debuffCount = getglobal("TargetFrameNewDebuff"..i.."Count"); |
||
1732 | if ( debuffApplications > 1 ) then |
||
1733 | debuffCount:SetText(debuffApplications); |
||
1734 | debuffCount:Show(); |
||
1735 | else |
||
1736 | debuffCount:Hide(); |
||
1737 | end |
||
1738 | button:Show(); |
||
1739 | numDebuffs = numDebuffs + 1; |
||
1740 | else |
||
1741 | button:Hide(); |
||
1742 | end |
||
1743 | button.id = i; |
||
1744 | end |
||
1745 | |||
1746 | Archaeologist_TargetBuffs_UpdateAlignment(numBuffs, numDebuffs); |
||
1747 | end |
||
1748 | |||
1749 | function Archaeologist_TargetBuffs_UpdateAlignment(numBuffs, numDebuffs) |
||
1750 | |||
1751 | -- Position buffs depending on whether the targeted unit is friendly or not |
||
1752 | local topBuffPrefix = "TargetFrameNewDebuff"; |
||
1753 | local bottomBuffPrefix = "TargetFrameNewBuff"; |
||
1754 | local numTopBuffs = numDebuffs; |
||
1755 | local numBottomBuffs = numBuffs; |
||
1756 | if (UnitIsFriend("player", "target")) then |
||
1757 | topBuffPrefix = "TargetFrameNewBuff"; |
||
1758 | bottomBuffPrefix = "TargetFrameNewDebuff"; |
||
1759 | numTopBuffs = numBuffs; |
||
1760 | numBottomBuffs = numDebuffs; |
||
1761 | end |
||
1762 | |||
1763 | TargetFrameNewBuff1:ClearAllPoints(); |
||
1764 | TargetFrameNewBuff9:ClearAllPoints(); |
||
1765 | TargetFrameNewDebuff1:ClearAllPoints(); |
||
1766 | TargetFrameNewDebuff9:ClearAllPoints(); |
||
1767 | |||
1768 | getglobal(topBuffPrefix..1):SetPoint("TOPLEFT", "TargetFrame", "BOTTOMLEFT", 5, 32); |
||
1769 | if (ArchaeologistVars["TBUFFALT"] == 1) and (numTopBuffs >= 9) then |
||
1770 | getglobal(topBuffPrefix..9):SetPoint("TOPLEFT", topBuffPrefix..1, "BOTTOMLEFT", 0, -2); |
||
1771 | getglobal(bottomBuffPrefix..1):SetPoint("TOPLEFT", topBuffPrefix..9, "BOTTOMLEFT", 0, -2); |
||
1772 | else |
||
1773 | getglobal(topBuffPrefix..9):SetPoint("LEFT", topBuffPrefix..8, "RIGHT", 3, 0); |
||
1774 | getglobal(bottomBuffPrefix..1):SetPoint("TOPLEFT", topBuffPrefix..1, "BOTTOMLEFT", 0, -2); |
||
1775 | end |
||
1776 | if (ArchaeologistVars["TBUFFALT"] == 1) and (numBottomBuffs >= 9) then |
||
1777 | getglobal(bottomBuffPrefix..9):SetPoint("TOPLEFT", bottomBuffPrefix..1, "BOTTOMLEFT", 0, -2); |
||
1778 | else |
||
1779 | getglobal(bottomBuffPrefix..9):SetPoint("LEFT", bottomBuffPrefix..8, "RIGHT", 3, 0); |
||
1780 | end |
||
1781 | |||
1782 | end |
||
1783 | |||
1784 | function Archaeologist_TurnOffTargetBuffs(toggle) |
||
1785 | TargetDebuffButton_Update(); |
||
1786 | end |
||
1787 | |||
1788 | function Archaeologist_TurnOffTargetDebuffs(toggle) |
||
1789 | TargetDebuffButton_Update(); |
||
1790 | end |
||
1791 | |||
1792 | |||
1793 | function Archaeologist_SetTargetBuffs(count) |
||
1794 | if (count) then |
||
1795 | TargetDebuffButton_Update(); |
||
1796 | end |
||
1797 | end |
||
1798 | |||
1799 | |||
1800 | function Archaeologist_SetTargetDebuffs(count) |
||
1801 | if (count) then |
||
1802 | TargetDebuffButton_Update(); |
||
1803 | end |
||
1804 | end |
||
1805 | |||
1806 | -- <= == == == == == == == == == == == == => |
||
1807 | -- => Alternate Options |
||
1808 | -- <= == == == == == == == == == == == == => |
||
1809 | |||
1810 | function Archaeologist_SetAltDebuffLocation(toggle) |
||
1811 | Archaeologist_PetFrame_UpdateDebuffLocations(); |
||
1812 | Archaeologist_SetPetFrameHappinessLocation(); |
||
1813 | Archaeologist_PartyFrame_UpdateDebuffLocations(); |
||
1814 | end |
||
1815 | |||
1816 | function Archaeologist_SetUnitBarValuePercentSwap(unit, barType, toggle) |
||
1817 | local statusBar = ArchaeologistStatusBars[unit].frame[barType]; |
||
1818 | Archaeologist_TextStringAltTextStatusBars[statusBar:GetName()] = toggle; |
||
1819 | Archaeologist_TextStatusBar_UpdateTextString(statusBar); |
||
1820 | end |
||
1821 | |||
1822 | function Archaeologist_SetPetFrameHappinessLocation() |
||
1823 | if (ArchaeologistVars["PETHP2"] == "on") or (ArchaeologistVars["PETHP2"] == "mouseover") or |
||
1824 | (ArchaeologistVars["PETMP2"] == "on") or (ArchaeologistVars["PETMP2"] == "mouseover") or |
||
1825 | ((ArchaeologistVars["DEBUFFALT"] == 0) and (ArchaeologistVars["PTDEBUFFS"] == 0)) then |
||
1826 | --alt position |
||
1827 | PetFrameHappiness:ClearAllPoints(); |
||
1828 | PetFrameHappiness:SetPoint("TOPRIGHT", "PetFrame", "BOTTOMLEFT", 8, 15); |
||
1829 | else |
||
1830 | --normal position |
||
1831 | PetFrameHappiness:ClearAllPoints(); |
||
1832 | PetFrameHappiness:SetPoint("LEFT", "PetFrame", "RIGHT", -7, -4); |
||
1833 | end |
||
1834 | |||
1835 | end |
||
1836 | |||
1837 | -- <= == == == == == == == == == == == == => |
||
1838 | -- => Font Options |
||
1839 | -- <= == == == == == == == == == == == == => |
||
1840 | |||
1841 | function Archaeologist_SetPrimaryHPColor(colorTable) |
||
1842 | for unit, data in ArchaeologistStatusBars do |
||
1843 | data.frame.healthbar.TextString:SetTextColor(colorTable.r, colorTable.g, colorTable.b, colorTable.opacity); |
||
1844 | end |
||
1845 | end |
||
1846 | |||
1847 | function Archaeologist_SetPrimaryMPColor(colorTable) |
||
1848 | for unit, data in ArchaeologistStatusBars do |
||
1849 | data.frame.manabar.TextString:SetTextColor(colorTable.r, colorTable.g, colorTable.b, colorTable.opacity); |
||
1850 | end |
||
1851 | end |
||
1852 | |||
1853 | function Archaeologist_SetSecondaryHPColor(colorTable) |
||
1854 | for unit, data in ArchaeologistStatusBars do |
||
1855 | data.frame.healthbar.TextString2:SetTextColor(colorTable.r, colorTable.g, colorTable.b, colorTable.opacity); |
||
1856 | end |
||
1857 | end |
||
1858 | |||
1859 | function Archaeologist_SetSecondaryMPColor(colorTable) |
||
1860 | for unit, data in ArchaeologistStatusBars do |
||
1861 | data.frame.manabar.TextString2:SetTextColor(colorTable.r, colorTable.g, colorTable.b, colorTable.opacity); |
||
1862 | end |
||
1863 | end |
||
1864 | |||
1865 | function Archaeologist_SetHPMPLargeFont(key) |
||
1866 | if (not key) then |
||
1867 | return; |
||
1868 | end |
||
1869 | local font = ArchaeologistFonts[key]; |
||
1870 | if (not font) then |
||
1871 | -- Will reset to default on next Reload |
||
1872 | return; |
||
1873 | end |
||
1874 | local frame; |
||
1875 | local size = ArchaeologistVars["HPMPLARGESIZE"]; |
||
1876 | for i, unit in {"player", "target"} do |
||
1877 | frame = ArchaeologistStatusBars[unit].frame; |
||
1878 | frame.healthbar.TextString:SetFont(font, size); |
||
1879 | frame.healthbar.TextString2:SetFont(font, size); |
||
1880 | frame.manabar.TextString:SetFont(font, size); |
||
1881 | frame.manabar.TextString2:SetFont(font, size); |
||
1882 | end |
||
1883 | Archaeologist_SetHPMPLargeTextSize(size); --Size corrects refonting problem with linebreaks |
||
1884 | end |
||
1885 | |||
1886 | function Archaeologist_SetHPMPSmallFont(key) |
||
1887 | if (not key) then |
||
1888 | return; |
||
1889 | end |
||
1890 | local font = ArchaeologistFonts[key]; |
||
1891 | if (not font) then |
||
1892 | -- Will reset to default on next Reload |
||
1893 | return; |
||
1894 | end |
||
1895 | local frame; |
||
1896 | local size = ArchaeologistVars["HPMPSMALLSIZE"]; |
||
1897 | for i, unit in {"party1", "party2", "party3", "party4", "pet"} do |
||
1898 | frame = ArchaeologistStatusBars[unit].frame; |
||
1899 | frame.healthbar.TextString:SetFont(font, size); |
||
1900 | frame.healthbar.TextString2:SetFont(font, size); |
||
1901 | frame.manabar.TextString:SetFont(font, size); |
||
1902 | frame.manabar.TextString2:SetFont(font, size); |
||
1903 | end |
||
1904 | Archaeologist_SetHPMPSmallTextSize(size); --Size corrects refonting problem with linebreaks |
||
1905 | end |
||
1906 | |||
1907 | -- <= == == == == == == == == == == == == => |
||
1908 | -- => MobHealth2 Compatibility |
||
1909 | -- <= == == == == == == == == == == == == => |
||
1910 | |||
1911 | |||
1912 | function Archaeologist_MobHealth_OnEvent(event) |
||
1913 | if (event == "PLAYER_TARGET_CHANGED") then |
||
1914 | --Archaeologist_TargetCheckDead(); |
||
1915 | TextStatusBar_UpdateTextString(ArchaeologistStatusBars.target.frame.healthbar); |
||
1916 | --Sea.io.print("MobHealth2: PLAYER_TARGET_CHANGED"); |
||
1917 | end |
||
1918 | end |
||
1919 | |||
1920 | |||
1921 | function Archaeologist_EnableMobHealth(toggle) |
||
1922 | local frame; |
||
1923 | if (MI2_MobHealthFrame) then |
||
1924 | frame = MI2_MobHealthFrame; |
||
1925 | elseif (MobHealthFrame) then |
||
1926 | frame = MobHealthFrame; |
||
1927 | else |
||
1928 | return; |
||
1929 | end |
||
1930 | if (toggle == 1) then |
||
1931 | frame:Hide(); |
||
1932 | else |
||
1933 | frame:Show(); |
||
1934 | end |
||
1935 | end |
||
1936 | |||
1937 | -- <= == == == == == == == == == == == == => |
||
1938 | -- => Class Icons |
||
1939 | -- <= == == == == == == == == == == == == => |
||
1940 | |||
1941 | function Archaeologist_TurnOnPartyClassIcon(toggle) |
||
1942 | Archaeologist_UpdatePartyClassIcons(); |
||
1943 | if (toggle == 1) then |
||
1944 | for i=1, 4 do |
||
1945 | getglobal("PartyMemberFrame"..i.."MasterIcon"):ClearAllPoints(); |
||
1946 | getglobal("PartyMemberFrame"..i.."MasterIcon"):SetPoint("TOPLEFT", "PartyMemberFrame"..i, "TOPLEFT", 15, 5); |
||
1947 | end |
||
1948 | else |
||
1949 | for i=1, 4 do |
||
1950 | getglobal("PartyMemberFrame"..i.."MasterIcon"):ClearAllPoints(); |
||
1951 | getglobal("PartyMemberFrame"..i.."MasterIcon"):SetPoint("TOPLEFT", "PartyMemberFrame"..i, "TOPLEFT", 32, 0); |
||
1952 | end |
||
1953 | end |
||
1954 | end |
||
1955 | |||
1956 | function Archaeologist_UpdatePartyClassIcons() |
||
1957 | if (ArchaeologistVars["PARTYCLASSICON"] == 1) then |
||
1958 | local localizedClass, englishClass, icon; |
||
1959 | for i=1, GetNumPartyMembers() do |
||
1960 | localizedClass, englishClass = UnitClass("party"..i); |
||
1961 | icon = getglobal("PartyMemberFrame"..i.."ClassIcon"); |
||
1962 | if (englishClass) then |
||
1963 | if (not icon:IsVisible()) then |
||
1964 | icon:Show(); |
||
1965 | end |
||
1966 | getglobal(icon:GetName().."Texture"):SetTexture("Interface\\AddOns\\Archaeologist\\Skin\\ClassIcons\\"..Sea.string.capitalizeWords(englishClass)); |
||
1967 | else |
||
1968 | if (icon:IsVisible()) then |
||
1969 | icon:Hide(); |
||
1970 | end |
||
1971 | end |
||
1972 | end |
||
1973 | else |
||
1974 | for i=1, GetNumPartyMembers() do |
||
1975 | icon = getglobal("PartyMemberFrame"..i.."ClassIcon"); |
||
1976 | if (icon:IsVisible()) then |
||
1977 | icon:Hide(); |
||
1978 | end |
||
1979 | end |
||
1980 | end |
||
1981 | end |
||
1982 | |||
1983 | function Archaeologist_TurnOnTargetClassIcon(toggle) |
||
1984 | Archaeologist_UpdateTargetClassIcon(); |
||
1985 | end |
||
1986 | |||
1987 | function Archaeologist_UpdateTargetClassIcon() |
||
1988 | if (ArchaeologistVars["TARGETCLASSICON"] == 1) then |
||
1989 | if (UnitIsPlayer("target")) then |
||
1990 | local localizedClass, englishClass = UnitClass("target"); |
||
1991 | if (not TargetFrameClassIcon:IsVisible()) then |
||
1992 | TargetFrameClassIcon:Show(); |
||
1993 | end |
||
1994 | TargetFrameClassIconTexture:SetTexture("Interface\\AddOns\\Archaeologist\\Skin\\ClassIcons\\"..Sea.string.capitalizeWords(englishClass)); |
||
1995 | else |
||
1996 | TargetFrameClassIcon:Hide(); |
||
1997 | end |
||
1998 | else |
||
1999 | if (TargetFrameClassIcon:IsVisible()) then |
||
2000 | TargetFrameClassIcon:Hide(); |
||
2001 | end |
||
2002 | end |
||
2003 | end |
||
2004 | |||
2005 | function Archaeologist_TurnOnPlayerClassIcon(toggle) |
||
2006 | Archaeologist_UpdatePlayerClassIcon(); |
||
2007 | if (toggle == 1) then |
||
2008 | PlayerMasterIcon:ClearAllPoints(); |
||
2009 | PlayerMasterIcon:SetPoint("TOPLEFT", "PlayerFrame", "TOPLEFT", 65, -2); |
||
2010 | else |
||
2011 | PlayerMasterIcon:ClearAllPoints(); |
||
2012 | PlayerMasterIcon:SetPoint("TOPLEFT", "PlayerFrame", "TOPLEFT", 80, -10); |
||
2013 | end |
||
2014 | end |
||
2015 | |||
2016 | function Archaeologist_UpdatePlayerClassIcon() |
||
2017 | if (ArchaeologistVars["PLAYERCLASSICON"] == 1) then |
||
2018 | local localizedClass, englishClass = UnitClass("player"); |
||
2019 | if (not PlayerFrameClassIcon:IsVisible()) then |
||
2020 | PlayerFrameClassIcon:Show(); |
||
2021 | end |
||
2022 | PlayerFrameClassIconTexture:SetTexture("Interface\\AddOns\\Archaeologist\\Skin\\ClassIcons\\"..Sea.string.capitalizeWords(englishClass)); |
||
2023 | else |
||
2024 | if (PlayerFrameClassIcon:IsVisible()) then |
||
2025 | PlayerFrameClassIcon:Hide(); |
||
2026 | end |
||
2027 | end |
||
2028 | end |
||
2029 | |||
2030 | function Archaeologist_ClassIcon_OnLoad() |
||
2031 | this:SetFrameLevel(this:GetFrameLevel()+2); |
||
2032 | end |
||
2033 | |||
2034 | function Archaeologist_EnableClassPortrait(toggle) |
||
2035 | if (toggle == 1) then |
||
2036 | for unit, data in ArchaeologistStatusBars do |
||
2037 | if (unit ~= "pet") then |
||
2038 | if (UnitIsPlayer(unit)) then |
||
2039 | local localizedClass, englishClass = UnitClass(unit); |
||
2040 | if (englishClass) then |
||
2041 | data.frame.portrait:SetTexture("Interface\\AddOns\\Archaeologist\\Skin\\PortraitIcons\\"..Sea.string.capitalizeWords(englishClass)); |
||
2042 | end |
||
2043 | end |
||
2044 | end |
||
2045 | end |
||
2046 | else |
||
2047 | SetPortraitTexture(PlayerFrame.portrait, "player"); |
||
2048 | SetPortraitTexture(TargetFrame.portrait, "target"); |
||
2049 | SetPortraitTexture(PartyMemberFrame1.portrait, "party1"); |
||
2050 | SetPortraitTexture(PartyMemberFrame2.portrait, "party2"); |
||
2051 | SetPortraitTexture(PartyMemberFrame3.portrait, "party3"); |
||
2052 | SetPortraitTexture(PartyMemberFrame4.portrait, "party4"); |
||
2053 | end |
||
2054 | end |
||
2055 | |||
2056 | function Archaeologist_UnitFrame_Update_After() |
||
2057 | if (ArchaeologistVars["CLASSPORTRAIT"] == 1) then |
||
2058 | if (UnitIsPlayer(this.unit)) then |
||
2059 | local localizedClass, englishClass = UnitClass(this.unit); |
||
2060 | if (englishClass) then |
||
2061 | this.portrait:SetTexture("Interface\\AddOns\\Archaeologist\\Skin\\PortraitIcons\\"..Sea.string.capitalizeWords(englishClass)); |
||
2062 | end |
||
2063 | end |
||
2064 | end |
||
2065 | end |
||
2066 | |||
2067 | function Archaeologist_UnitFrame_OnEvent_After(event) |
||
2068 | if (ArchaeologistVars["CLASSPORTRAIT"] == 1) then |
||
2069 | if ( (event == "UNIT_PORTRAIT_UPDATE") and (arg1 == this.unit) ) then |
||
2070 | if (UnitIsPlayer(this.unit)) then |
||
2071 | local localizedClass, englishClass = UnitClass(this.unit); |
||
2072 | if (englishClass) then |
||
2073 | this.portrait:SetTexture("Interface\\AddOns\\Archaeologist\\Skin\\PortraitIcons\\"..Sea.string.capitalizeWords(englishClass)); |
||
2074 | end |
||
2075 | end |
||
2076 | end |
||
2077 | end |
||
2078 | end |
||
2079 | |||
2080 | -- <= == == == == == == == == == == == == => |
||
2081 | -- => Helpful Funcs |
||
2082 | -- <= == == == == == == == == == == == == => |
||
2083 | |||
2084 | -- 1 => 0, 0 => 1 |
||
2085 | function BinaryInvert(oneZero) |
||
2086 | if oneZero == 1 then |
||
2087 | return 0; |
||
2088 | else |
||
2089 | return 1; |
||
2090 | end |
||
2091 | end |
||
2092 | |||
2093 | function Archaeologist_PartyIndexFromName(name) |
||
2094 | for i=1, GetNumPartyMembers() do |
||
2095 | if ( name == UnitName("party"..i) ) then |
||
2096 | return i; |
||
2097 | end |
||
2098 | end |
||
2099 | end |
||
2100 | |||
2101 | |||
2102 | function Archaeologist_PartyIndexFromUnit(unit) |
||
2103 | if (type(unit) == "string") then |
||
2104 | if ( strsub(unit,0, string.len(unit)-1) == "party" ) then |
||
2105 | local partyIndex = tonumber( strsub(unit,string.len(unit)) ); |
||
2106 | return partyIndex; |
||
2107 | end |
||
2108 | end |
||
2109 | end |
||
2110 | |||
2111 | |||
2112 | function Archaeologist_PartyIndexFromFrame(frame) |
||
2113 | local frameName = frame:GetName(); |
||
2114 | if (frameName) then |
||
2115 | if ( strsub(frameName,0, string.len(frameName)-1) == "PartyMemberFrame" ) then |
||
2116 | local frameIndex = frame:GetID(); |
||
2117 | if (frameIndex > 0) then |
||
2118 | return frameIndex; |
||
2119 | end |
||
2120 | end |
||
2121 | end |
||
2122 | end |
||
2123 | |||
2124 | -- <= == == == == == == == == == == == => |
||
2125 | -- => Presets |
||
2126 | -- <= == == == == == == == == == == == => |
||
2127 | |||
2128 | function Archaeologist_SetValuePercentPresets(index) |
||
2129 | if (index) then |
||
2130 | local id = MCom.getComID("/arch"); |
||
2131 | if (index == 1) then |
||
2132 | -- Values on the Bars |
||
2133 | for k, v in {"player", "pet", "party", "target"} do |
||
2134 | MCom.SlashCommandHandler(id, v.."hp "..ARCHAEOLOGIST_ON); |
||
2135 | MCom.SlashCommandHandler(id, v.."hp2 "..ARCHAEOLOGIST_OFF); |
||
2136 | MCom.SlashCommandHandler(id, v.."mp "..ARCHAEOLOGIST_ON); |
||
2137 | MCom.SlashCommandHandler(id, v.."mp2 "..ARCHAEOLOGIST_OFF); |
||
2138 | |||
2139 | MCom.SlashCommandHandler(id, v.."hpinvert "..ARCHAEOLOGIST_OFF); |
||
2140 | MCom.SlashCommandHandler(id, v.."mpinvert "..ARCHAEOLOGIST_OFF); |
||
2141 | |||
2142 | MCom.SlashCommandHandler(id, v.."hpswap "..ARCHAEOLOGIST_ON); |
||
2143 | MCom.SlashCommandHandler(id, v.."mpswap "..ARCHAEOLOGIST_ON); |
||
2144 | end |
||
2145 | |||
2146 | MCom.SlashCommandHandler(id, "targethpswap "..ARCHAEOLOGIST_OFF); |
||
2147 | MCom.SlashCommandHandler(id, "usehpvalue "..ARCHAEOLOGIST_ON); |
||
2148 | if (MobHealth_OnEvent) then |
||
2149 | MCom.SlashCommandHandler(id, "mobhealth "..ARCHAEOLOGIST_ON); |
||
2150 | end |
||
2151 | |||
2152 | elseif (index == 2) then |
||
2153 | -- Values next to the Bars |
||
2154 | for k, v in {"player", "pet", "party", "target"} do |
||
2155 | MCom.SlashCommandHandler(id, v.."hp "..ARCHAEOLOGIST_OFF); |
||
2156 | MCom.SlashCommandHandler(id, v.."hp2 "..ARCHAEOLOGIST_ON); |
||
2157 | MCom.SlashCommandHandler(id, v.."mp "..ARCHAEOLOGIST_OFF); |
||
2158 | MCom.SlashCommandHandler(id, v.."mp2 "..ARCHAEOLOGIST_ON); |
||
2159 | |||
2160 | MCom.SlashCommandHandler(id, v.."hpinvert "..ARCHAEOLOGIST_OFF); |
||
2161 | MCom.SlashCommandHandler(id, v.."mpinvert "..ARCHAEOLOGIST_OFF); |
||
2162 | |||
2163 | MCom.SlashCommandHandler(id, v.."hpswap "..ARCHAEOLOGIST_OFF); |
||
2164 | MCom.SlashCommandHandler(id, v.."mpswap "..ARCHAEOLOGIST_OFF); |
||
2165 | end |
||
2166 | |||
2167 | MCom.SlashCommandHandler(id, "targethpswap "..ARCHAEOLOGIST_ON); |
||
2168 | MCom.SlashCommandHandler(id, "usehpvalue "..ARCHAEOLOGIST_ON); |
||
2169 | if (MobHealth_OnEvent) then |
||
2170 | MCom.SlashCommandHandler(id, "mobhealth "..ARCHAEOLOGIST_ON); |
||
2171 | end |
||
2172 | |||
2173 | elseif (index == 3) then |
||
2174 | -- Percentage on the Bars |
||
2175 | for k, v in {"player", "pet", "party", "target"} do |
||
2176 | MCom.SlashCommandHandler(id, v.."hp "..ARCHAEOLOGIST_ON); |
||
2177 | MCom.SlashCommandHandler(id, v.."hp2 "..ARCHAEOLOGIST_OFF); |
||
2178 | MCom.SlashCommandHandler(id, v.."mp "..ARCHAEOLOGIST_ON); |
||
2179 | MCom.SlashCommandHandler(id, v.."mp2 "..ARCHAEOLOGIST_OFF); |
||
2180 | |||
2181 | MCom.SlashCommandHandler(id, v.."hpinvert "..ARCHAEOLOGIST_OFF); |
||
2182 | MCom.SlashCommandHandler(id, v.."mpinvert "..ARCHAEOLOGIST_OFF); |
||
2183 | |||
2184 | MCom.SlashCommandHandler(id, v.."hpswap "..ARCHAEOLOGIST_OFF); |
||
2185 | MCom.SlashCommandHandler(id, v.."mpswap "..ARCHAEOLOGIST_OFF); |
||
2186 | end |
||
2187 | |||
2188 | MCom.SlashCommandHandler(id, "usehpvalue "..ARCHAEOLOGIST_OFF); |
||
2189 | |||
2190 | elseif (index == 4) then |
||
2191 | -- Percentage next to the Bars |
||
2192 | for k, v in {"player", "pet", "party", "target"} do |
||
2193 | MCom.SlashCommandHandler(id, v.."hp "..ARCHAEOLOGIST_OFF); |
||
2194 | MCom.SlashCommandHandler(id, v.."hp2 "..ARCHAEOLOGIST_ON); |
||
2195 | MCom.SlashCommandHandler(id, v.."mp "..ARCHAEOLOGIST_OFF); |
||
2196 | MCom.SlashCommandHandler(id, v.."mp2 "..ARCHAEOLOGIST_ON); |
||
2197 | |||
2198 | MCom.SlashCommandHandler(id, v.."hpinvert "..ARCHAEOLOGIST_OFF); |
||
2199 | MCom.SlashCommandHandler(id, v.."mpinvert "..ARCHAEOLOGIST_OFF); |
||
2200 | |||
2201 | MCom.SlashCommandHandler(id, v.."hpswap "..ARCHAEOLOGIST_ON); |
||
2202 | MCom.SlashCommandHandler(id, v.."mpswap "..ARCHAEOLOGIST_ON); |
||
2203 | end |
||
2204 | |||
2205 | MCom.SlashCommandHandler(id, "usehpvalue "..ARCHAEOLOGIST_OFF); |
||
2206 | |||
2207 | elseif (index == 5) then |
||
2208 | -- Percentage on the Bars, Values next to the Bars |
||
2209 | for k, v in {"player", "pet", "party", "target"} do |
||
2210 | MCom.SlashCommandHandler(id, v.."hp "..ARCHAEOLOGIST_ON); |
||
2211 | MCom.SlashCommandHandler(id, v.."hp2 "..ARCHAEOLOGIST_ON); |
||
2212 | MCom.SlashCommandHandler(id, v.."mp "..ARCHAEOLOGIST_ON); |
||
2213 | MCom.SlashCommandHandler(id, v.."mp2 "..ARCHAEOLOGIST_ON); |
||
2214 | |||
2215 | MCom.SlashCommandHandler(id, v.."hpinvert "..ARCHAEOLOGIST_OFF); |
||
2216 | MCom.SlashCommandHandler(id, v.."mpinvert "..ARCHAEOLOGIST_OFF); |
||
2217 | |||
2218 | MCom.SlashCommandHandler(id, v.."hpswap "..ARCHAEOLOGIST_OFF); |
||
2219 | MCom.SlashCommandHandler(id, v.."mpswap "..ARCHAEOLOGIST_OFF); |
||
2220 | end |
||
2221 | |||
2222 | MCom.SlashCommandHandler(id, "usehpvalue "..ARCHAEOLOGIST_OFF); |
||
2223 | if (MobHealth_OnEvent) then |
||
2224 | MCom.SlashCommandHandler(id, "mobhealth "..ARCHAEOLOGIST_ON); |
||
2225 | end |
||
2226 | |||
2227 | elseif (index == 6) then |
||
2228 | -- Values on the Bars, Percentage next to the Bars |
||
2229 | for k, v in {"player", "pet", "party", "target"} do |
||
2230 | MCom.SlashCommandHandler(id, v.."hp "..ARCHAEOLOGIST_ON); |
||
2231 | MCom.SlashCommandHandler(id, v.."hp2 "..ARCHAEOLOGIST_ON); |
||
2232 | MCom.SlashCommandHandler(id, v.."mp "..ARCHAEOLOGIST_ON); |
||
2233 | MCom.SlashCommandHandler(id, v.."mp2 "..ARCHAEOLOGIST_ON); |
||
2234 | |||
2235 | MCom.SlashCommandHandler(id, v.."hpinvert "..ARCHAEOLOGIST_OFF); |
||
2236 | MCom.SlashCommandHandler(id, v.."mpinvert "..ARCHAEOLOGIST_OFF); |
||
2237 | |||
2238 | MCom.SlashCommandHandler(id, v.."hpswap "..ARCHAEOLOGIST_ON); |
||
2239 | MCom.SlashCommandHandler(id, v.."mpswap "..ARCHAEOLOGIST_ON); |
||
2240 | end |
||
2241 | |||
2242 | MCom.SlashCommandHandler(id, "usehpvalue "..ARCHAEOLOGIST_OFF); |
||
2243 | if (MobHealth_OnEvent) then |
||
2244 | MCom.SlashCommandHandler(id, "mobhealth "..ARCHAEOLOGIST_ON); |
||
2245 | end |
||
2246 | |||
2247 | end |
||
2248 | |||
2249 | if (Khaos) and (KhaosFrame:IsVisible()) then |
||
2250 | Khaos.refresh(false, false, true); |
||
2251 | elseif (CosmosMasterFrame) and (CosmosMasterFrame:IsVisible()) and (not CosmosMasterFrame_IsLoading) then |
||
2252 | CosmosMaster_DrawData(); |
||
2253 | end |
||
2254 | end |
||
2255 | end |
||
2256 | |||
2257 | function Archaeologist_SetPrefixPresets(index) |
||
2258 | if (index) then |
||
2259 | local id = MCom.getComID("/arch"); |
||
2260 | if (index == 1) then |
||
2261 | -- All off |
||
2262 | for k, v in {"player", "pet", "party", "target"} do |
||
2263 | MCom.SlashCommandHandler(id, v.."hpnoprefix "..ARCHAEOLOGIST_ON); |
||
2264 | MCom.SlashCommandHandler(id, v.."mpnoprefix "..ARCHAEOLOGIST_ON); |
||
2265 | end |
||
2266 | |||
2267 | MCom.SlashCommandHandler(id, "playerxpnoprefix "..ARCHAEOLOGIST_ON); |
||
2268 | MCom.SlashCommandHandler(id, "petxpnoprefix "..ARCHAEOLOGIST_ON); |
||
2269 | |||
2270 | elseif (index == 2) then |
||
2271 | -- All on |
||
2272 | for k, v in {"player", "pet", "party", "target"} do |
||
2273 | MCom.SlashCommandHandler(id, v.."hpnoprefix "..ARCHAEOLOGIST_OFF); |
||
2274 | MCom.SlashCommandHandler(id, v.."mpnoprefix "..ARCHAEOLOGIST_OFF); |
||
2275 | end |
||
2276 | |||
2277 | MCom.SlashCommandHandler(id, "playerxpnoprefix "..ARCHAEOLOGIST_OFF); |
||
2278 | MCom.SlashCommandHandler(id, "petxpnoprefix "..ARCHAEOLOGIST_OFF); |
||
2279 | |||
2280 | elseif (index == 3) then |
||
2281 | -- All default |
||
2282 | for k, v in {"player", "pet", "party", "target"} do |
||
2283 | MCom.SlashCommandHandler(id, v.."hpnoprefix "..ArchaeologistVarData[strupper(v.."hpnoprefix")].default); |
||
2284 | MCom.SlashCommandHandler(id, v.."mpnoprefix "..ArchaeologistVarData[strupper(v.."mpnoprefix")].default); |
||
2285 | end |
||
2286 | |||
2287 | MCom.SlashCommandHandler(id, "playerxpnoprefix "..ArchaeologistVarData[strupper("playerxpnoprefix")].default); |
||
2288 | MCom.SlashCommandHandler(id, "petxpnoprefix "..ArchaeologistVarData[strupper("petxpnoprefix")].default); |
||
2289 | |||
2290 | end |
||
2291 | |||
2292 | if (Khaos) and (KhaosFrame:IsVisible()) then |
||
2293 | Khaos.refresh(false, false, true); |
||
2294 | elseif (CosmosMasterFrame) and (CosmosMasterFrame:IsVisible()) and (not CosmosMasterFrame_IsLoading) then |
||
2295 | CosmosMaster_DrawData(); |
||
2296 | end |
||
2297 | end |
||
2298 | end |
||
2299 | |||
2300 | -- <= == == == == == == == == == == == => |
||
2301 | -- => Configuration Registeration |
||
2302 | -- <= == == == == == == == == == == == => |
||
2303 | |||
2304 | function Archaeologist_RegisterForMCom() |
||
2305 | |||
2306 | local optionSet = {}; |
||
2307 | |||
2308 | -- <= == == == == == == == == == == == => |
||
2309 | -- => Presets Registering |
||
2310 | -- <= == == == == == == == == == == == => |
||
2311 | |||
2312 | table.insert(optionSet, { |
||
2313 | id="PresetsHeader"; |
||
2314 | text=ARCHAEOLOGIST_CONFIG_PRESETS; |
||
2315 | helptext=ARCHAEOLOGIST_CONFIG_PRESETS; |
||
2316 | type=K_HEADER; |
||
2317 | difficulty=1; |
||
2318 | }); |
||
2319 | |||
2320 | table.insert(optionSet, { |
||
2321 | id="Preset1ValuesOnBars"; |
||
2322 | type=K_BUTTON; |
||
2323 | text=ARCHAEOLOGIST_CONFIG_VALUES_ON_BARS; |
||
2324 | helptext=ARCHAEOLOGIST_CONFIG_VALUES_ON_BARS; |
||
2325 | callback=function()Archaeologist_SetValuePercentPresets(1)end; |
||
2326 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2327 | mcopts = { |
||
2328 | subcom = string.lower("Preset1"); |
||
2329 | }; |
||
2330 | }); |
||
2331 | |||
2332 | table.insert(optionSet, { |
||
2333 | id="Preset2ValuesNextToBars"; |
||
2334 | type=K_BUTTON; |
||
2335 | text=ARCHAEOLOGIST_CONFIG_VALUES_NEXTTO_BARS; |
||
2336 | helptext=ARCHAEOLOGIST_CONFIG_VALUES_NEXTTO_BARS; |
||
2337 | callback=function()Archaeologist_SetValuePercentPresets(2)end; |
||
2338 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2339 | mcopts = { |
||
2340 | subcom = string.lower("Preset2"); |
||
2341 | }; |
||
2342 | }); |
||
2343 | |||
2344 | table.insert(optionSet, { |
||
2345 | id="Preset3PercentageOnBars"; |
||
2346 | type=K_BUTTON; |
||
2347 | text=ARCHAEOLOGIST_CONFIG_PERCENTAGE_ON_BARS; |
||
2348 | helptext=ARCHAEOLOGIST_CONFIG_PERCENTAGE_ON_BARS; |
||
2349 | callback=function()Archaeologist_SetValuePercentPresets(3)end; |
||
2350 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2351 | mcopts = { |
||
2352 | subcom = string.lower("Preset3"); |
||
2353 | }; |
||
2354 | }); |
||
2355 | |||
2356 | table.insert(optionSet, { |
||
2357 | id="Preset4PercentageNextToBars"; |
||
2358 | type=K_BUTTON; |
||
2359 | text=ARCHAEOLOGIST_CONFIG_PERCENTAGE_NEXTTO_BARS; |
||
2360 | helptext=ARCHAEOLOGIST_CONFIG_PERCENTAGE_NEXTTO_BARS; |
||
2361 | callback=function()Archaeologist_SetValuePercentPresets(4)end; |
||
2362 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2363 | mcopts = { |
||
2364 | subcom = string.lower("Preset4"); |
||
2365 | }; |
||
2366 | }); |
||
2367 | |||
2368 | table.insert(optionSet, { |
||
2369 | id="Preset5PercentageOnValuesNextToBars"; |
||
2370 | type=K_BUTTON; |
||
2371 | text=ARCHAEOLOGIST_CONFIG_PERCENTAGE_ON_VALUES_NEXTTO_BARS; |
||
2372 | helptext=ARCHAEOLOGIST_CONFIG_PERCENTAGE_ON_VALUES_NEXTTO_BARS; |
||
2373 | callback=function()Archaeologist_SetValuePercentPresets(5)end; |
||
2374 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2375 | mcopts = { |
||
2376 | subcom = string.lower("Preset5"); |
||
2377 | }; |
||
2378 | }); |
||
2379 | |||
2380 | table.insert(optionSet, { |
||
2381 | id="Preset6ValuesOnPercentageNextToBars"; |
||
2382 | type=K_BUTTON; |
||
2383 | text=ARCHAEOLOGIST_CONFIG_VALUES_ON_PERCENTAGE_NEXTTO_BARS; |
||
2384 | helptext=ARCHAEOLOGIST_CONFIG_VALUES_ON_PERCENTAGE_NEXTTO_BARS; |
||
2385 | callback=function()Archaeologist_SetValuePercentPresets(6)end; |
||
2386 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2387 | mcopts = { |
||
2388 | subcom = string.lower("Preset6"); |
||
2389 | }; |
||
2390 | }); |
||
2391 | |||
2392 | table.insert(optionSet, { |
||
2393 | id="Preset1PrefixesOff"; |
||
2394 | type=K_BUTTON; |
||
2395 | text=ARCHAEOLOGIST_CONFIG_PREFIXES_OFF; |
||
2396 | helptext=ARCHAEOLOGIST_CONFIG_PREFIXES_OFF; |
||
2397 | callback=function()Archaeologist_SetPrefixPresets(1)end; |
||
2398 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2399 | mcopts = { |
||
2400 | subcom = string.lower("PrefixOff"); |
||
2401 | }; |
||
2402 | }); |
||
2403 | |||
2404 | table.insert(optionSet, { |
||
2405 | id="Preset1PrefixesOn"; |
||
2406 | type=K_BUTTON; |
||
2407 | text=ARCHAEOLOGIST_CONFIG_PREFIXES_ON; |
||
2408 | helptext=ARCHAEOLOGIST_CONFIG_PREFIXES_ON; |
||
2409 | callback=function()Archaeologist_SetPrefixPresets(2)end; |
||
2410 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2411 | mcopts = { |
||
2412 | subcom = string.lower("PrefixOn"); |
||
2413 | }; |
||
2414 | }); |
||
2415 | |||
2416 | table.insert(optionSet, { |
||
2417 | id="Preset1PrefixesDefault"; |
||
2418 | type=K_BUTTON; |
||
2419 | text=ARCHAEOLOGIST_CONFIG_PREFIXES_DEFAULT; |
||
2420 | helptext=ARCHAEOLOGIST_CONFIG_PREFIXES_DEFAULT; |
||
2421 | callback=function()Archaeologist_SetPrefixPresets(3)end; |
||
2422 | setup={buttonText=ARCHAEOLOGIST_CONFIG_SET}; |
||
2423 | mcopts = { |
||
2424 | subcom = string.lower("PrefixDefault"); |
||
2425 | }; |
||
2426 | }); |
||
2427 | |||
2428 | |||
2429 | -- <= == == == == == == == == == == == => |
||
2430 | -- => Looped Registering |
||
2431 | -- <= == == == == == == == == == == == => |
||
2432 | |||
2433 | local varPrefixes = { "PLAYER", "PARTY", "PET", "TARGET" }; |
||
2434 | |||
2435 | table.sort(varPrefixes); |
||
2436 | for index, varPrefix in varPrefixes do |
||
2437 | |||
2438 | local header = { |
||
2439 | id = Sea.string.capitalizeWords(varPrefix).."Header"; |
||
2440 | type = K_HEADER; |
||
2441 | difficulty = 1; |
||
2442 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_SEP"); |
||
2443 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_SEP_INFO"); |
||
2444 | }; |
||
2445 | |||
2446 | table.insert(optionSet, header); |
||
2447 | |||
2448 | local keyList = Sea.table.getKeyList(ArchaeologistVarData); |
||
2449 | local sorter = function(a,b) |
||
2450 | if ( type(getglobal("ARCHAEOLOGIST_CONFIG_"..a)) == type(getglobal("ARCHAEOLOGIST_CONFIG_"..b)) and type(getglobal("ARCHAEOLOGIST_CONFIG_"..a)) ~= "nil") then |
||
2451 | return (getglobal("ARCHAEOLOGIST_CONFIG_"..a) < getglobal("ARCHAEOLOGIST_CONFIG_"..b)); |
||
2452 | else |
||
2453 | return false; |
||
2454 | end |
||
2455 | end |
||
2456 | table.sort(keyList, sorter); |
||
2457 | |||
2458 | for k, index in keyList do |
||
2459 | local var = ArchaeologistVarData[index]; |
||
2460 | if (type(index) == "string") then |
||
2461 | if (strsub(index, 0, string.len(varPrefix)) == varPrefix) then |
||
2462 | |||
2463 | local f = ArchaeologistVarData[index].func; |
||
2464 | local option; |
||
2465 | if (type(ArchaeologistVarData[index].options) == "table") then |
||
2466 | option = { |
||
2467 | id = ArchaeologistVarData[index].name; |
||
2468 | type = K_PULLDOWN; |
||
2469 | difficulty = 1; |
||
2470 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..index); |
||
2471 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..index.."_INFO"); |
||
2472 | --feedback = function(state) return Archaeologist_Feedback(index, state.value) end; |
||
2473 | dependencies = ArchaeologistVarData[index].dependencies; |
||
2474 | |||
2475 | default = { |
||
2476 | key = ArchaeologistVarData[index].default; |
||
2477 | }; |
||
2478 | disabled = { |
||
2479 | key = ArchaeologistVarData[index].default; |
||
2480 | }; |
||
2481 | setup = { |
||
2482 | options = ArchaeologistVarData[index].options; |
||
2483 | multiSelect = false; |
||
2484 | }; |
||
2485 | mcopts = { |
||
2486 | subcom = string.lower(index); |
||
2487 | --subhelp = getglobal("ARCHAEOLOGIST_CONFIG_"..index.."_INFO"); |
||
2488 | varchoice = "ArchaeologistVars."..index; |
||
2489 | update = function(varName) f(Sea.util.getValue(varName)); end; |
||
2490 | noupdate = function(varName) f(Sea.util.getValue(varName)); end; |
||
2491 | }; |
||
2492 | }; |
||
2493 | else |
||
2494 | option = { |
||
2495 | id = ArchaeologistVarData[index].name; |
||
2496 | check = true; |
||
2497 | type = K_TEXT; |
||
2498 | difficulty = 1; |
||
2499 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..index); |
||
2500 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..index.."_INFO"); |
||
2501 | --feedback = function(state) return Archaeologist_Feedback(index, state.checked) end; |
||
2502 | default = { |
||
2503 | checked = false; |
||
2504 | }; |
||
2505 | disabled = { |
||
2506 | checked = false; |
||
2507 | }; |
||
2508 | dependencies = ArchaeologistVarData[index].dependencies; |
||
2509 | mcopts = { |
||
2510 | subcom = string.lower(index); |
||
2511 | varbool = "ArchaeologistVars."..index; |
||
2512 | update = function(varName) f(Sea.util.getValue(varName)); end; |
||
2513 | noupdate = function(varName) f(Sea.util.getValue(varName)); end; |
||
2514 | }; |
||
2515 | }; |
||
2516 | |||
2517 | if ( ArchaeologistVarData[index].default == 1 ) then |
||
2518 | option.default.checked = true; |
||
2519 | option.disabled.checked = true; |
||
2520 | end |
||
2521 | end |
||
2522 | |||
2523 | table.insert(optionSet, option); |
||
2524 | end |
||
2525 | end |
||
2526 | end |
||
2527 | |||
2528 | end |
||
2529 | |||
2530 | -- <= == == == == == == == == == == == => |
||
2531 | -- => Alternate Options Registering |
||
2532 | -- <= == == == == == == == == == == == => |
||
2533 | |||
2534 | local varPrefix = "ALTOPTS"; |
||
2535 | |||
2536 | local header = { |
||
2537 | id = Sea.string.capitalizeWords(varPrefix).."Header"; |
||
2538 | type = K_HEADER; |
||
2539 | difficulty = 2; |
||
2540 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_SEP"); |
||
2541 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_SEP_INFO"); |
||
2542 | }; |
||
2543 | table.insert(optionSet, header); |
||
2544 | |||
2545 | varPrefixes = { "HPCOLOR", "DEBUFFALT", "TBUFFALT", "CLASSPORTRAIT", "USEHPVALUE" }; |
||
2546 | |||
2547 | if ( MobHealth_OnEvent ) then |
||
2548 | table.insert(varPrefixes, "MOBHEALTH" ); |
||
2549 | end |
||
2550 | |||
2551 | for index, varPrefix in varPrefixes do |
||
2552 | local f = ArchaeologistVarData[varPrefix].func; |
||
2553 | local option = { |
||
2554 | id = ArchaeologistVarData[varPrefix].name; |
||
2555 | check = true; |
||
2556 | type = K_TEXT; |
||
2557 | difficulty = 2; |
||
2558 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix); |
||
2559 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_INFO"); |
||
2560 | --feedback = function(state) return Archaeologist_Feedback(varPrefix, state.checked) end; |
||
2561 | default = { |
||
2562 | checked = false; |
||
2563 | }; |
||
2564 | disabled = { |
||
2565 | checked = false; |
||
2566 | }; |
||
2567 | dependencies = ArchaeologistVarData[varPrefix].dependencies; |
||
2568 | mcopts = { |
||
2569 | subcom = string.lower(varPrefix); |
||
2570 | varbool = "ArchaeologistVars."..varPrefix; |
||
2571 | update = function(varName) f(Sea.util.getValue(varName)); end; |
||
2572 | noupdate = function(varName) f(Sea.util.getValue(varName)); end; |
||
2573 | }; |
||
2574 | }; |
||
2575 | if ( ArchaeologistVarData[varPrefix].default == 1 ) then |
||
2576 | option.default.checked = true; |
||
2577 | option.disabled.checked = true; |
||
2578 | end |
||
2579 | |||
2580 | table.insert(optionSet, option); |
||
2581 | end |
||
2582 | |||
2583 | -- <= == == == == == == == == == == == => |
||
2584 | -- => Font Options Registering |
||
2585 | -- <= == == == == == == == == == == == => |
||
2586 | |||
2587 | local varPrefix = "FONTOPTS"; |
||
2588 | |||
2589 | local header = { |
||
2590 | id = Sea.string.capitalizeWords(varPrefix).."Header"; |
||
2591 | type = K_HEADER; |
||
2592 | difficulty = 3; |
||
2593 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_SEP"); |
||
2594 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_SEP_INFO"); |
||
2595 | }; |
||
2596 | table.insert(optionSet, header); |
||
2597 | |||
2598 | varPrefixes = { "HPMPLARGE", "HPMPSMALL" }; |
||
2599 | |||
2600 | for index, varPrefix in varPrefixes do |
||
2601 | local id = varPrefix.."FONT"; |
||
2602 | local f = ArchaeologistVarData[id].func; |
||
2603 | local option = { |
||
2604 | id = ArchaeologistVarData[id].name; |
||
2605 | type = K_PULLDOWN; |
||
2606 | difficulty = 3; |
||
2607 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..id); |
||
2608 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..id); |
||
2609 | --feedback = function(state) return Archaeologist_Feedback(id, state.value) end; |
||
2610 | dependencies = ArchaeologistVarData[id].dependencies; |
||
2611 | |||
2612 | default = { |
||
2613 | key = ArchaeologistVarData[id].default; |
||
2614 | }; |
||
2615 | disabled = { |
||
2616 | key = ArchaeologistVarData[id].default; |
||
2617 | }; |
||
2618 | setup = { |
||
2619 | options = ArchaeologistVarData[id].options; |
||
2620 | multiSelect = false; |
||
2621 | }; |
||
2622 | mcopts = { |
||
2623 | subcom = string.lower(id); |
||
2624 | subhelp = getglobal("ARCHAEOLOGIST_CONFIG_"..id.."_INFO"); |
||
2625 | varchoice = "ArchaeologistVars."..id; |
||
2626 | update = function(varName) f(Sea.util.getValue(varName)); end; |
||
2627 | noupdate = function(varName) f(Sea.util.getValue(varName)); end; |
||
2628 | }; |
||
2629 | }; |
||
2630 | table.insert(optionSet, option); |
||
2631 | |||
2632 | local id = varPrefix.."SIZE"; |
||
2633 | local f = ArchaeologistVarData[id].func; |
||
2634 | local option = { |
||
2635 | id = ArchaeologistVarData[id].name; |
||
2636 | type = K_SLIDER; |
||
2637 | difficulty = 3; |
||
2638 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..id); |
||
2639 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..id); |
||
2640 | --feedback = function(state) return Archaeologist_Feedback(id, state.checked) end; |
||
2641 | dependencies = ArchaeologistVarData[id].dependencies; |
||
2642 | |||
2643 | default = { |
||
2644 | slider = ArchaeologistVarData[id].default; |
||
2645 | }; |
||
2646 | disabled = { |
||
2647 | slider = ArchaeologistVarData[id].default; |
||
2648 | }; |
||
2649 | setup = { |
||
2650 | sliderMin = ArchaeologistVarData[id].min; |
||
2651 | sliderMax = ArchaeologistVarData[id].max; |
||
2652 | sliderStep = 1; |
||
2653 | sliderText = getglobal("ARCHAEOLOGIST_CONFIG_"..id.."_SLIDER_TEXT"); |
||
2654 | }; |
||
2655 | mcopts = { |
||
2656 | subcom = string.lower(id); |
||
2657 | varnum = "ArchaeologistVars."..id; |
||
2658 | update = function(varName) f(Sea.util.getValue(varName)); end; |
||
2659 | noupdate = function(varName) f(Sea.util.getValue(varName)); end; |
||
2660 | }; |
||
2661 | }; |
||
2662 | if ( ArchaeologistVars[id] == 1 ) then |
||
2663 | option.default.checked = true; |
||
2664 | end |
||
2665 | table.insert(optionSet, option); |
||
2666 | end |
||
2667 | |||
2668 | varPrefixes = { "COLORPHP", "COLORPMP", "COLORSHP", "COLORSMP" }; |
||
2669 | |||
2670 | for index, varPrefix in varPrefixes do |
||
2671 | |||
2672 | local data = ArchaeologistVarData[varPrefix]; |
||
2673 | local subcom = string.lower(varPrefix); |
||
2674 | local varcolor = "ArchaeologistVars."..varPrefix; |
||
2675 | local colorResetFeedback = function(state) |
||
2676 | return string.format(ARCHAEOLOGIST_COLOR_RESET, Sea.string.colorToString(state.color), data.name ); |
||
2677 | end |
||
2678 | |||
2679 | table.insert( |
||
2680 | optionSet, |
||
2681 | { |
||
2682 | id=ArchaeologistVarData[varPrefix].name; |
||
2683 | text=getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix); |
||
2684 | helptext=getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_INFO"); |
||
2685 | difficulty=3; |
||
2686 | type=K_COLORPICKER; |
||
2687 | setup= { |
||
2688 | hasOpacity=true; |
||
2689 | }; |
||
2690 | default={ |
||
2691 | color=ArchaeologistVarData[varPrefix].default; |
||
2692 | }; |
||
2693 | disabled={ |
||
2694 | color=ArchaeologistVarData[varPrefix].default; |
||
2695 | }; |
||
2696 | mcopts = { |
||
2697 | subcom = subcom; |
||
2698 | varcolor = varcolor; |
||
2699 | update = function(varName) data.func(Sea.util.getValue(varName)); end; |
||
2700 | noupdate = function(varName) data.func(Sea.util.getValue(varName)); end; |
||
2701 | }; |
||
2702 | } |
||
2703 | ); |
||
2704 | table.insert( |
||
2705 | optionSet, |
||
2706 | { |
||
2707 | id=ArchaeologistVarData[varPrefix].name.."Reset"; |
||
2708 | text=getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_RESET"); |
||
2709 | helptext=getglobal("ARCHAEOLOGIST_CONFIG_"..varPrefix.."_RESET_INFO"); |
||
2710 | difficulty=3; |
||
2711 | callback=function(state) |
||
2712 | --Khaos.setSetKey(KhaosCore.getCurrentSet(), data.name, {color=data.default}); |
||
2713 | --Khaos.refresh(false, false, true); --Refresh Visible |
||
2714 | Sea.util.setValue(varcolor, data.default); |
||
2715 | MCom.updateUI(ARCHAEOLOGIST_SUPER_SLASH_COMMAND, subcom) |
||
2716 | end; |
||
2717 | --feedback=colorResetFeedback; |
||
2718 | type=K_BUTTON; |
||
2719 | setup = { |
||
2720 | buttonText=RESET; |
||
2721 | }; |
||
2722 | } |
||
2723 | ); |
||
2724 | end |
||
2725 | |||
2726 | -- <= == == == == == == == == == == == => |
||
2727 | -- => Buff Registering |
||
2728 | -- <= == == == == == == == == == == == => |
||
2729 | |||
2730 | local varSections = { |
||
2731 | PARTYBUFFS = { "PBUFF", "PDEBUFF" }; |
||
2732 | PARTYPETBUFFS = { "PPTBUFF", "PPTDEBUFF" }; |
||
2733 | PETBUFFS = { "PTBUFF", "PTDEBUFF" }; |
||
2734 | TARGETBUFFS = { "TBUFF", "TDEBUFF" }; |
||
2735 | }; |
||
2736 | |||
2737 | for headerPrefix, varPrefixes in varSections do |
||
2738 | |||
2739 | local header = { |
||
2740 | id = Sea.string.capitalizeWords(headerPrefix).."Header"; |
||
2741 | type = K_HEADER; |
||
2742 | difficulty = 2; |
||
2743 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..headerPrefix.."_SEP"); |
||
2744 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..headerPrefix.."_SEP_INFO"); |
||
2745 | }; |
||
2746 | table.insert(optionSet, header); |
||
2747 | |||
2748 | for index, varPrefix in varPrefixes do |
||
2749 | local id = varPrefix.."S"; |
||
2750 | local f = ArchaeologistVarData[id].func; |
||
2751 | local option = { |
||
2752 | id = ArchaeologistVarData[id].name; |
||
2753 | check = true; |
||
2754 | type = K_TEXT; |
||
2755 | difficulty = 2; |
||
2756 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..id); |
||
2757 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..id.."_INFO"); |
||
2758 | --feedback = function(state) return Archaeologist_Feedback(id, state.checked) end; |
||
2759 | default = { |
||
2760 | checked = false; |
||
2761 | }; |
||
2762 | disabled = { |
||
2763 | checked = false; |
||
2764 | }; |
||
2765 | dependencies = ArchaeologistVarData[id].dependencies; |
||
2766 | mcopts = { |
||
2767 | subcom = string.lower(id); |
||
2768 | varbool = "ArchaeologistVars."..id; |
||
2769 | update = function(varName) f(Sea.util.getValue(varName)); end; |
||
2770 | noupdate = function(varName) f(Sea.util.getValue(varName)); end; |
||
2771 | }; |
||
2772 | }; |
||
2773 | if ( ArchaeologistVars[id] == 1 ) then |
||
2774 | option.default.checked = true; |
||
2775 | end |
||
2776 | |||
2777 | table.insert(optionSet, option); |
||
2778 | |||
2779 | local id = varPrefix.."NUM"; |
||
2780 | local f = ArchaeologistVarData[id].func; |
||
2781 | |||
2782 | local optionSlider = { |
||
2783 | id = ArchaeologistVarData[id].name; |
||
2784 | type = K_SLIDER; |
||
2785 | difficulty = 2; |
||
2786 | text = getglobal("ARCHAEOLOGIST_CONFIG_"..id); |
||
2787 | helptext = getglobal("ARCHAEOLOGIST_CONFIG_"..id.."_INFO"); |
||
2788 | --feedback = function(state) return Archaeologist_Feedback(id, state.slider) end; |
||
2789 | dependencies = ArchaeologistVarData[id].dependencies; |
||
2790 | |||
2791 | default = { |
||
2792 | slider = ArchaeologistVarData[id].default; |
||
2793 | }; |
||
2794 | disabled = { |
||
2795 | slider = ArchaeologistVarData[id].default; |
||
2796 | }; |
||
2797 | setup = { |
||
2798 | sliderMin = ArchaeologistVarData[id].min; |
||
2799 | sliderMax = ArchaeologistVarData[id].max; |
||
2800 | sliderStep = 1; |
||
2801 | sliderText = getglobal("ARCHAEOLOGIST_CONFIG_"..id.."_SLIDER_TEXT"); |
||
2802 | }; |
||
2803 | mcopts = { |
||
2804 | subcom = string.lower(id); |
||
2805 | varnum = "ArchaeologistVars."..id; |
||
2806 | update = function(varName) f(Sea.util.getValue(varName)); end; |
||
2807 | noupdate = function(varName) f(Sea.util.getValue(varName)); end; |
||
2808 | }; |
||
2809 | }; |
||
2810 | if ( ArchaeologistVars[id] == 1 ) then |
||
2811 | option.default.checked = true; |
||
2812 | end |
||
2813 | |||
2814 | table.insert(optionSet, optionSlider); |
||
2815 | end |
||
2816 | |||
2817 | end |
||
2818 | |||
2819 | -- <= == == == == == == == == == == == => |
||
2820 | -- => Config Set Registering |
||
2821 | -- <= == == == == == == == == == == == => |
||
2822 | |||
2823 | MCom.registerSmart( |
||
2824 | { |
||
2825 | supercom = ARCHAEOLOGIST_SUPER_SLASH_COMMAND; |
||
2826 | uifolder = "frames", |
||
2827 | uiset = { |
||
2828 | id = ArchaeologistOptionSetName; |
||
2829 | text = ARCHAEOLOGIST_CONFIG_SEP; |
||
2830 | helptext = ARCHAEOLOGIST_CONFIG_SEP_INFO; |
||
2831 | difficulty = 1; |
||
2832 | options = optionSet; |
||
2833 | } |
||
2834 | } |
||
2835 | ); |
||
2836 | |||
2837 | end |
||
2838 | |||
2839 | function Archaeologist_Feedback(id, setToValue) |
||
2840 | if (not id) then |
||
2841 | id = "Unknown"; |
||
2842 | end |
||
2843 | if (not setToValue) then |
||
2844 | setToValue = "false"; |
||
2845 | end |
||
2846 | return string.format(ARCHAEOLOGIST_FEEDBACK_STRING, id, tostring(setToValue)); |
||
2847 | end |