vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | SmartPet_OPTIONS_TITLE = "SmartPet Options"; |
2 | |||
3 | function SmartPetOptions_Toggle() --Toggles SmartPet GUI |
||
4 | if (SmartPetOptionsFrame:IsVisible()) then |
||
5 | SmartPetOptionsFrame:Hide(); |
||
6 | else |
||
7 | SmartPetOptionsFrame:Show(); |
||
8 | end |
||
9 | end |
||
10 | |||
11 | function SmartPetEnable_Toggle() --Toggles SmartPet On/Off |
||
12 | if (SmartPet_Config.Enabled) then |
||
13 | SmartPet_Config.Enabled = false; |
||
14 | SmartPet_AllOptions:Hide(); |
||
15 | else |
||
16 | SmartPet_Config.Enabled = true; |
||
17 | SmartPet_AllOptions:Show(); |
||
18 | end |
||
19 | SmartPet_UpdateActionIcons(true); |
||
20 | end |
||
21 | |||
22 | function SmartPetChannelSet() --Sets Pet Health Warning Channel |
||
23 | if ( (SmartPet_AutoWarnChannelEditBox:GetNumber() < 0 ) or (SmartPet_AutoWarnChannelEditBox == nil) )then |
||
24 | SmartPet_Config.ChannelNumber = 1; |
||
25 | else |
||
26 | SmartPet_Config.ChannelNumber = SmartPet_AutoWarnChannelEditBox:GetNumber(); |
||
27 | end |
||
28 | SmartPet_Config.Channel = "channel"; |
||
29 | end |
||
30 | |||
31 | |||
32 | function SmartPetAutowarn_Toggle() |
||
33 | SmartPet_OnSlashCommand(SMARTPET_AUTOWARN); |
||
34 | end |
||
35 | |||
36 | |||
37 | function SmartPetOptions_OnLoad() |
||
38 | UIPanelWindows['SmartPetOptionsFrame'] = {area = 'center', pushable = 0}; |
||
39 | tinsert(UISpecialFrames, "SmartPetOptionsFrame") |
||
40 | end |
||
41 | |||
42 | |||
43 | function SmartPetOptions_OnShow() |
||
44 | SmartPetEnableToggleButton:SetChecked(SmartPet_Config.Enabled); |
||
45 | SmartPetToolTipsToggleButton:SetChecked(SmartPet_Config.ToolTips); |
||
46 | SmartPetAutoWarnToggleButton:SetChecked(SmartPet_Config.AutoWarn); |
||
47 | SmartPetAutoCowerToggleButton:SetChecked(SmartPet_Config.AutoCower); |
||
48 | SmartPetAutoWarnPercentEditBox:SetText(SmartPet_Config.WarnHealth); |
||
49 | SmartPetAutoCowerPercentEditBox:SetText(SmartPet_Config.CowerHealth); |
||
50 | SmartPetNoChaseToggleButton:SetChecked(SmartPet_Config.NoChase); |
||
51 | SmartPetOptionsToggleButton:SetChecked(SmartPet_Config.Icon); |
||
52 | SmartPetSmartFocusCheckBox:SetChecked(SmartPet_Config.SmartFocus); |
||
53 | SmartPetAttackAlert:SetChecked(SmartPet_Config.Alert); |
||
54 | SmartPetScatterToggleButton:SetChecked(SmartPet_Config.Scatter); |
||
55 | SmartPetSpellOnAttackToggleButton:SetChecked(SmartPet_Config.SpellAttack); |
||
56 | SmartPetHealthWarning_Group:SetChecked((SmartPet_Config.Channel == "party")); |
||
57 | SmartPetHealthWarning_Say:SetChecked((SmartPet_Config.Channel == "say")); |
||
58 | SmartPetHealthWarning_Raid:SetChecked((SmartPet_Config.Channel == "raid")); |
||
59 | SmartPetHealthWarning_Guild:SetChecked((SmartPet_Config.Channel == "guild")); |
||
60 | SmartPetHealthWarning_Channel:SetChecked((SmartPet_Config.Channel == "channel")); |
||
61 | SmartPet_AutoWarnChannelEditBox:SetText(SmartPet_Config.ChannelNumber); |
||
62 | SmartPetAttackRunCheckBox:SetChecked(SmartPet_Config.RushAttack); |
||
63 | SmartPetRecallAlert:SetChecked(SmartPet_Config.RecallWarn); |
||
64 | |||
65 | if (SmartPet_Config.Spell ~= "") then |
||
66 | local spellName, spellRank = GetSpellName( SmartPet_Config.Spell, SmartPet_Config.SpellBook); |
||
67 | SmartPetAttackSpell:SetNormalTexture(GetSpellTexture(SmartPet_Config.Spell, SmartPet_Config.SpellBook)); |
||
68 | SmartPetAttackSpellText:SetText(spellName.." "..spellRank); |
||
69 | end |
||
70 | |||
71 | if (SmartPet_Config.Enabled) then |
||
72 | SmartPet_AllOptions:Show(); |
||
73 | else |
||
74 | SmartPet_AllOptions:Hide(); |
||
75 | end |
||
76 | if (SmartPet_Config.AutoWarn) then |
||
77 | SmartPet_HealthWarningChanels:Show(); |
||
78 | else |
||
79 | SmartPet_HealthWarningChanels:Hide(); |
||
80 | end |
||
81 | if (SmartPet_Config.Scatter) then |
||
82 | SmartPet_ScatterOptions:Show(); |
||
83 | else |
||
84 | SmartPet_ScatterOptions:Hide(); |
||
85 | end |
||
86 | |||
87 | if (SmartPet_Config.ScatterMood == PetPassiveMode) then |
||
88 | SmartPetScatterPassiveButton:SetChecked(true); |
||
89 | SmartPetScatterDefensiveButton:SetChecked(false); |
||
90 | elseif (SmartPet_Config.ScatterMood == PetDefensiveMode) then |
||
91 | SmartPetScatterDefensiveButton:SetChecked(true); |
||
92 | SmartPetScatterPassiveButton:SetChecked(false); |
||
93 | else |
||
94 | SmartPetScatterDefensiveButton:SetChecked(false); |
||
95 | SmartPetScatterPassiveButton:SetChecked(false); |
||
96 | end |
||
97 | |||
98 | if (SmartPet_Config.ScatterOrder == PetFollow) then |
||
99 | SmartPetScatterFollowButton:SetChecked(true); |
||
100 | SmartPetScatterStayButton:SetChecked(false); |
||
101 | elseif (SmartPet_Config.ScatterOrder == PetWait) then |
||
102 | SmartPetScatterStayButton:SetChecked(true); |
||
103 | SmartPetScatterFollowButton:SetChecked(false); |
||
104 | else |
||
105 | SmartPetScatterStayButton:SetChecked(false); |
||
106 | SmartPetScatterFollowButton:SetChecked(false); |
||
107 | end |
||
108 | |||
109 | --Hides settings not relevent to warlocks |
||
110 | if (SmartPet_Vars.Class == "WARLOCK") then |
||
111 | SmartPetAutoCowerToggleButton:Hide(); |
||
112 | SmartPetAutoCowerPercentEditBox:Hide(); |
||
113 | SmartPetSmartFocusCheckBox:Hide(); |
||
114 | SmartPetAttackRunCheckBox:Hide(); |
||
115 | SmartPetScatterToggleButton:Hide(); |
||
116 | SmartPet_ScatterOptions:Hide(); |
||
117 | end |
||
118 | |||
119 | end |
||
120 | |||
121 | |||
122 | function SmartPetOptions_Init() |
||
123 | end |
||
124 | |||
125 | |||
126 | function SmartPetOptions_OnHide() |
||
127 | if(MYADDONS_ACTIVE_OPTIONSFRAME == this) then |
||
128 | ShowUIPanel(myAddOnsFrame); |
||
129 | end |
||
130 | end |
||
131 | |||
132 | --Sets spell to use on attack when droped in attack spell slot |
||
133 | function SmartPetSelectedSpell() |
||
134 | if (SmartPet_Vars.PickedUp_Spell == "") then |
||
135 | SmartPetClearSpell(); |
||
136 | return |
||
137 | end |
||
138 | |||
139 | local spellName, spellRank = GetSpellName( SmartPet_Vars.PickedUp_Spell , SmartPet_Vars.PickedUp_SpellBook); |
||
140 | --SmartPet_AddInfoMessage(spellName); |
||
141 | --SmartPet_AddInfoMessage(spellRank); |
||
142 | --SmartPet_AddInfoMessage(GetSpellTexture(SmartPet_Vars.PickedUp_Spell , SmartPet_Vars.PickedUp_SpellBook )); |
||
143 | SmartPetAttackSpell:SetNormalTexture(GetSpellTexture(SmartPet_Vars.PickedUp_Spell , SmartPet_Vars.PickedUp_SpellBook )); |
||
144 | ResetCursor(); |
||
145 | PickupSpell(SmartPet_Vars.PickedUp_Spell , SmartPet_Vars.PickedUp_SpellBook) ; |
||
146 | SmartPetAttackSpellText:SetText(spellName..spellRank); |
||
147 | SmartPet_Config.Spell = SmartPet_Vars.PickedUp_Spell; |
||
148 | SmartPet_Config.SpellBook = SmartPet_Vars.PickedUp_SpellBook; |
||
149 | SmartPet_Vars.PickedUp_Spell = ""; |
||
150 | SmartPet_Vars.PickedUp_SpellBook = ""; |
||
151 | end |
||
152 | |||
153 | --removes selected spell from cursor when droping on attack spell slot |
||
154 | function SmartPetClearSpell() |
||
155 | SmartPetAttackSpell:SetNormalTexture("Interface\\Buttons\\UI-EmptySlot-Disabled"); |
||
156 | SmartPetAttackSpellText:SetText("None"); |
||
157 | SmartPet_Config.Spell = ""; |
||
158 | SmartPet_Config.SpellBook = ""; |
||
159 | end |
||
160 | |||
161 | -- |
||
162 | function SmartPetScatterMoodToggle(mood) |
||
163 | if (mood == "passive") then |
||
164 | SmartPet_Config.ScatterMood = PetPassiveMode; |
||
165 | SmartPetScatterPassiveButton:SetChecked(true); |
||
166 | SmartPetScatterDefensiveButton:SetChecked(false); |
||
167 | elseif (mood == "defensive") then |
||
168 | SmartPet_Config.ScatterMood = PetDefensiveMode; |
||
169 | SmartPetScatterDefensiveButton:SetChecked(true); |
||
170 | SmartPetScatterPassiveButton:SetChecked(false); |
||
171 | else |
||
172 | SmartPet_Config.ScatterMood = ""; |
||
173 | SmartPetScatterDefensiveButton:SetChecked(false); |
||
174 | SmartPetScatterPassiveButton:SetChecked(false); |
||
175 | end |
||
176 | end |
||
177 | |||
178 | function SmartPetScatterCommandToggle(order) |
||
179 | if (order == "follow") then |
||
180 | SmartPet_Config.ScatterOrder = PetFollow; |
||
181 | SmartPetScatterFollowButton:SetChecked(true); |
||
182 | SmartPetScatterStayButton:SetChecked(false); |
||
183 | elseif (order == "stay") then |
||
184 | SmartPet_Config.ScatterOrder = PetWait; |
||
185 | SmartPetScatterStayButton:SetChecked(true); |
||
186 | SmartPetScatterFollowButton:SetChecked(false); |
||
187 | else |
||
188 | SmartPet_Config.ScatterOrder = ""; |
||
189 | SmartPetScatterStayButton:SetChecked(false); |
||
190 | SmartPetScatterFollowButton:SetChecked(false); |
||
191 | end |
||
192 | end |