vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | |||
3 | SuperInspect: --------- |
||
4 | copyright 2005-2006 by Chester |
||
5 | |||
6 | ]] |
||
7 | |||
8 | SUPERINSPECT_VERSION = "1.16"; |
||
9 | |||
10 | BINDING_HEADER_SUPERINSPECT = "Super Inspect"; |
||
11 | BINDING_NAME_SUPERINSPECT = "Inspect Target"; |
||
12 | |||
13 | SuperInspect = {}; |
||
14 | |||
15 | UIPanelWindows["SuperInspectFrame"] = { area = "left", pushable = 0 }; |
||
16 | |||
17 | function SuperInspectFrame_Load_OnLoad() |
||
18 | this:RegisterEvent("VARIABLES_LOADED"); |
||
19 | this:RegisterEvent("ADDON_LOADED"); |
||
20 | |||
21 | SLASH_SUPERINSPECT1 = "/superinspect"; |
||
22 | SlashCmdList["SUPERINSPECT"] = function(msg) |
||
23 | SuperInspect_SlashCommand(msg); |
||
24 | end |
||
25 | end |
||
26 | |||
27 | |||
28 | function SuperInspectFrame_Load_OnEvent() |
||
29 | if( event == "VARIABLES_LOADED" ) then |
||
30 | --[[ if( DEFAULT_CHAT_FRAME ) then |
||
31 | DEFAULT_CHAT_FRAME:AddMessage("|cffffd200SuperInspect |cffffff00v"..SUPERINSPECT_VERSION.." loaded."); |
||
32 | if (not IsAddOnLoaded("SuperInspect_UI")) then |
||
33 | --DEFAULT_CHAT_FRAME:AddMessage("|cffffd200SuperInspect is not loaded"); |
||
34 | end |
||
35 | end |
||
36 | ]] |
||
37 | if (not SI_Save) then |
||
38 | SI_Save = { }; |
||
39 | SI_Save.default = 1; |
||
40 | end |
||
41 | |||
42 | InspectUnit = SuperInspect_InspectTargetHooked; |
||
43 | InspectFrame_OnUpdate = SuperInspect_InspectFrame_Nothing; |
||
44 | InspectTitleText = SI_DummyText; |
||
45 | |||
46 | -- keeps the inspect selection from greying out on the targetframe dropdown |
||
47 | UnitPopupButtons["INSPECT"] = { text = TEXT(INSPECT), dist = 0 }; |
||
48 | end |
||
49 | if( event == "ADDON_LOADED" and arg1 == "SuperInspect_UI") then |
||
50 | --DEFAULT_CHAT_FRAME:AddMessage("|cffffd200SuperInspect is loaded!"); |
||
51 | SuperInspectFrame.uiScale = SuperInspect_GetUIScale(); |
||
52 | if (SI_Save.framepos_L or SI_Save.framepos_T) then |
||
53 | SuperInspectFrame:ClearAllPoints(); |
||
54 | SuperInspectFrame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", SI_Save.framepos_L, SI_Save.framepos_T); |
||
55 | else |
||
56 | SuperInspectFrame:ClearAllPoints(); |
||
57 | SuperInspectFrame:SetPoint("CENTER", "UIParent", "CENTER", 0, 0); |
||
58 | SI_Save.framepos_L = SuperInspectFrame:GetLeft(); |
||
59 | SI_Save.framepos_T = SuperInspectFrame:GetTop(); |
||
60 | end |
||
61 | end |
||
62 | end |
||
63 | |||
64 | function SI_AddMessage( text ) |
||
65 | if (not text) then |
||
66 | return; |
||
67 | end |
||
68 | if (SI_Save.debug) then |
||
69 | ChatFrame3:AddMessage(GREEN_FONT_COLOR_CODE..""..text..""); |
||
70 | end |
||
71 | end |
||
72 | |||
73 | function SuperInspect_GetUIScale() |
||
74 | local uiScale; |
||
75 | if ( GetCVar("useUiScale") == "1" ) then |
||
76 | uiScale = tonumber(GetCVar("uiscale")); |
||
77 | else |
||
78 | uiScale = 1.0; |
||
79 | end |
||
80 | return uiScale; |
||
81 | end |
||
82 | |||
83 | function SuperInspect_GetEffectiveScale(frame) |
||
84 | return frame:GetEffectiveScale() |
||
85 | end |
||
86 | |||
87 | function SuperInspect_SetEffectiveScale(frame, scale, parentframe) |
||
88 | frame.scale = scale; -- Saved in case it needs to be re-calculated when the parent's scale changes. |
||
89 | local parent = getglobal(parentframe); |
||
90 | if ( not parent ) then |
||
91 | parent = getglobal("UIParent"); |
||
92 | end |
||
93 | scale = scale / parent:GetEffectiveScale() |
||
94 | frame:SetScale(scale); |
||
95 | end |
||
96 | |||
97 | function SuperInspect_SlashCommand(msg) |
||
98 | if( not msg or msg == "" ) then |
||
99 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect Commands:"); |
||
100 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20/superinspect scale <number> |cff3366ff- scale the window between 0.25 and 2.0 (default is 0.75)"); |
||
101 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20/superinspect reset |cff3366ff- reset the frame to the center of your screen"); |
||
102 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20/superinspect defaulttoggle |cff3366ff- toggle default mode on/off (when on, SI acts like the default inspect window. when off, you can drag and scale the window)"); |
||
103 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20/superinspect itembgtoggle |cff3366ff- toggle the art used to display quality color of items"); |
||
104 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20/superinspect durabilitytoggle |cff3366ff- toggle durability info that is shown when inspecting yourself"); |
||
105 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20/superinspect sound |cff3366ff- toggle the open and close window sound"); |
||
106 | |||
107 | return; |
||
108 | end |
||
109 | if (string.find(msg, "scale") ~= nil) then |
||
110 | for scale in string.gfind(msg, "scale%s(%d.*)") do |
||
111 | SuperInspect.s = tonumber(scale); |
||
112 | end |
||
113 | if (SuperInspect.s) then |
||
114 | if (SuperInspect.s > 2) then |
||
115 | SuperInspect.s = 2; |
||
116 | elseif (SuperInspect.s < 0.25) then |
||
117 | SuperInspect.s = 0.25; |
||
118 | end |
||
119 | if (not IsAddOnLoaded("SuperInspect_UI")) then |
||
120 | UIParentLoadAddOn("SuperInspect_UI"); |
||
121 | end |
||
122 | SuperInspectFrame:SetScale(3); |
||
123 | SuperInspect_SetEffectiveScale(SuperInspectFrame, SuperInspect.s, "UIParent"); |
||
124 | --SuperInspect_ModelFrame:SetScale(SuperInspectFrame:GetEffectiveScale()); |
||
125 | SuperInspect_ResetFrame(); |
||
126 | SuperInspect_ModelFrame:RefreshUnit(); |
||
127 | SI_Save.scale = SuperInspect.s; |
||
128 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: SuperInspect frame scale now set to: "..SuperInspect.s); |
||
129 | else |
||
130 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: Please type a scale number after 'scale' (valid numbers: 0.5-2.0, ex: /superinspect scale 0.8)"); |
||
131 | end |
||
132 | return; |
||
133 | --/script CSG_Main_Frame:SetScale(UIParent:GetScale() * 0.75); |
||
134 | end |
||
135 | if( msg == "reset" ) then |
||
136 | if (not UIParentLoadAddOn("SuperInspect_UI")) then |
||
137 | return; |
||
138 | end |
||
139 | SuperInspect_ResetFrame(); |
||
140 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: resetting frame to the center of the screen"); |
||
141 | end |
||
142 | if( msg == "defaulttoggle" ) then |
||
143 | if (not UIParentLoadAddOn("SuperInspect_UI")) then |
||
144 | return; |
||
145 | end |
||
146 | if (SI_Save.default) then |
||
147 | SI_Save.default = nil; |
||
148 | SuperInspect_ResetFrame(); |
||
149 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: window is not longer Blizzard style (free to move and scale)"); |
||
150 | else |
||
151 | SI_Save.default = 1; |
||
152 | SuperInspect_ResetFrame(); |
||
153 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: window will now behave like the default Blizzard version (scale and position is locked)"); |
||
154 | end |
||
155 | end |
||
156 | if( msg == "itembgtoggle" ) then |
||
157 | if (not UIParentLoadAddOn("SuperInspect_UI")) then |
||
158 | return; |
||
159 | end |
||
160 | if (SI_Save.itembg) then |
||
161 | SI_Save.itembg = nil; |
||
162 | if (SuperInspectFrame:IsVisible()) then |
||
163 | SuperInspectFrame:Hide(); |
||
164 | SuperInspectFrame:Show(); |
||
165 | end |
||
166 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: item quality art is now using BORDERS"); |
||
167 | else |
||
168 | SI_Save.itembg = 1; |
||
169 | if (SuperInspectFrame:IsVisible()) then |
||
170 | SuperInspectFrame:Hide(); |
||
171 | SuperInspectFrame:Show(); |
||
172 | end |
||
173 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: item quality art is now using TABS"); |
||
174 | end |
||
175 | end |
||
176 | --SI_Save.durabilityoff |
||
177 | if( msg == "durabilitytoggle" ) then |
||
178 | if (not UIParentLoadAddOn("SuperInspect_UI")) then |
||
179 | return; |
||
180 | end |
||
181 | |||
182 | if (SI_Save.durabilityoff) then |
||
183 | SI_Save.durabilityoff = nil; |
||
184 | SuperInspect_ResetFrame(); |
||
185 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: durability info will now be shown"); |
||
186 | else |
||
187 | SI_Save.durabilityoff = 1; |
||
188 | SuperInspect_ResetFrame(); |
||
189 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: durability info will no longer be shown"); |
||
190 | end |
||
191 | end |
||
192 | if( msg == "sound" ) then |
||
193 | if (not UIParentLoadAddOn("SuperInspect_UI")) then |
||
194 | return; |
||
195 | end |
||
196 | if (SI_Save.snd) then |
||
197 | SI_Save.snd = nil; |
||
198 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: click sound OFF"); |
||
199 | else |
||
200 | SI_Save.snd = 1; |
||
201 | PlaySound("igCharacterInfoOpen"); |
||
202 | DEFAULT_CHAT_FRAME:AddMessage("|cff20ff20SuperInspect: click sound ON"); |
||
203 | end |
||
204 | end |
||
205 | end |
||
206 | |||
207 | function SuperInspect_InspectFrame_Nothing() |
||
208 | --what |
||
209 | end |
||
210 | |||
211 | function SuperInspect_InspectTarget(unit) |
||
212 | if (not UIParentLoadAddOn("SuperInspect_UI")) then |
||
213 | --UIParentLoadAddOn("SuperInspect_UI"); |
||
214 | --SuperInspect_InspectTarget(unit); |
||
215 | return; |
||
216 | end |
||
217 | if (not unit) then |
||
218 | unit = "target"; |
||
219 | end |
||
220 | if (SuperInspectFrame:IsVisible()) then |
||
221 | HideUIPanel(SuperInspectFrame); |
||
222 | SuperInspect.isVisible = nil; |
||
223 | return; |
||
224 | else |
||
225 | if (not UnitExists("target")) then |
||
226 | TargetUnit("player"); |
||
227 | end |
||
228 | SuperInspect_UpdateModel(unit); |
||
229 | end |
||
230 | end |
||
231 | |||
232 | function SuperInspect_InspectTargetHooked(unit) |
||
233 | if (not UIParentLoadAddOn("SuperInspect_UI")) then |
||
234 | return; |
||
235 | end |
||
236 | if (not unit) then |
||
237 | unit = "target"; |
||
238 | end |
||
239 | if (not UnitExists("target")) then |
||
240 | TargetUnit("player"); |
||
241 | end |
||
242 | SuperInspect_UpdateModel(unit); |
||
243 | end |
||
244 |