Details | Compare with Previous | View Log
Line No. | Rev | Author | Line |
---|---|---|---|
1 | 2 | Wildbreath-135052 | fernir_UI = CreateFrame("Frame", nil, UIParent) |
2 | Wildbreath-135052 | fernir_UI:Show() |
|
3 | Wildbreath-135052 | ||
4 | Wildbreath-135052 | --[[ Options start here ]] |
|
5 | Wildbreath-135052 | local _G = getfenv(0) |
|
6 | Wildbreath-135052 | local guildtable = {} |
|
7 | Wildbreath-135052 | local objects = {} |
|
8 | Wildbreath-135052 | local get_guild = "# / #" |
|
9 | Wildbreath-135052 | local tcolor = "637eae" |
|
10 | Wildbreath-135052 | local settings = oUF_Settings |
|
11 | Wildbreath-135052 | local objCount = 12 |
|
12 | Wildbreath-135052 | local damage, ctime, stime = 0, 0, 0 |
|
13 | Wildbreath-135052 | ||
14 | Wildbreath-135052 | --[[ Options end ]] |
|
15 | Wildbreath-135052 | ||
16 | Wildbreath-135052 | ||
17 | Wildbreath-135052 | SlashCmdList.RELOADUI = ReloadUI |
|
18 | Wildbreath-135052 | SLASH_RELOADUI1 = "/rl" |
|
19 | Wildbreath-135052 | SLASH_RELOADUI2 = "/кд" |
|
20 | Wildbreath-135052 | ||
21 | Wildbreath-135052 | SlashCmdList.RCSLASH = DoReadyCheck |
|
22 | Wildbreath-135052 | SLASH_RCSLASH1 = "/rc" |
|
23 | Wildbreath-135052 | SLASH_RCSLASH2 = "/кÑ" |
|
24 | Wildbreath-135052 | ||
25 | Wildbreath-135052 | ||
26 | Wildbreath-135052 | util = { |
|
27 | Wildbreath-135052 | ||
28 | Wildbreath-135052 | round = function(val, num) return (floor(val*10*num))/(10*num) end, |
|
29 | Wildbreath-135052 | rgbt2str = function(col) local r, g, b = unpack(col) return format("|cff%02x%02x%02x", r*255, g*255, b*255) end, |
|
30 | Wildbreath-135052 | rgb2str = function(r, g, b) return format("|cff%02x%02x%02x", r*255, g*255, b*255) end, |
|
31 | Wildbreath-135052 | money = function(val) return format("|cffffd700%d|r.|cffbbbbdd%d|r.|cffeda55f%d|r", mod(val/10000, 10000), mod(val/100, 100), mod(val, 100)) end, |
|
32 | Wildbreath-135052 | ||
33 | Wildbreath-135052 | level = function(val) |
|
34 | Wildbreath-135052 | local lcol = GetDifficultyColor(val) |
|
35 | Wildbreath-135052 | if not lcol then return 1, 1, 1 end |
|
36 | Wildbreath-135052 | return lcol.r, lcol.g, lcol.b |
|
37 | Wildbreath-135052 | end, |
|
38 | Wildbreath-135052 | ||
39 | Wildbreath-135052 | letter = function(value) |
|
40 | Wildbreath-135052 | if value then |
|
41 | Wildbreath-135052 | if value < 1 then |
|
42 | Wildbreath-135052 | return string.format("%.2f", value) |
|
43 | Wildbreath-135052 | elseif value >= 10000000 then |
|
44 | Wildbreath-135052 | return string.format("%.1fm", value / 1000000) |
|
45 | Wildbreath-135052 | elseif value >= 1000000 then |
|
46 | Wildbreath-135052 | return string.format("%.2fm", value / 1000000) |
|
47 | Wildbreath-135052 | elseif value >= 100000 then |
|
48 | Wildbreath-135052 | return string.format("%.0fk", value / 1000) |
|
49 | Wildbreath-135052 | elseif value >= 10000 then |
|
50 | Wildbreath-135052 | return string.format("%.1fk", value / 1000) |
|
51 | Wildbreath-135052 | else |
|
52 | Wildbreath-135052 | return math.ceil(value) |
|
53 | Wildbreath-135052 | end |
|
54 | Wildbreath-135052 | end |
|
55 | Wildbreath-135052 | end, |
|
56 | Wildbreath-135052 | ||
57 | Wildbreath-135052 | gradient_s = function(val, bad, good) |
|
58 | Wildbreath-135052 | gradient = function(val, bad, good) |
|
59 | Wildbreath-135052 | local percent, r, g |
|
60 | Wildbreath-135052 | if (good > bad) then |
|
61 | Wildbreath-135052 | percent = val/(good-bad) |
|
62 | Wildbreath-135052 | else |
|
63 | Wildbreath-135052 | percent = 1-val/(bad-good) |
|
64 | Wildbreath-135052 | end |
|
65 | Wildbreath-135052 | if (percent > 1) then percent = 1 end |
|
66 | Wildbreath-135052 | if (percent < 0) then percent = 0 end |
|
67 | Wildbreath-135052 | if(percent < 0.5) then r, g = 1, 2*percent else r, g = (1-percent)*2, 1 end |
|
68 | Wildbreath-135052 | return r, g, 0 |
|
69 | Wildbreath-135052 | end |
|
70 | Wildbreath-135052 | return util.rgb2str(gradient(val, bad, good))..val.."|r" |
|
71 | Wildbreath-135052 | end, |
|
72 | Wildbreath-135052 | ||
73 | Wildbreath-135052 | } |
|
74 | Wildbreath-135052 | ||
75 | Wildbreath-135052 | local line = function(m1, m2) GameTooltip:AddDoubleLine(m1, m2, 0.5, 02, 0.7, 0.7, 0.7, 0.2) end |
|
76 | Wildbreath-135052 | local space = function() GameTooltip:AddLine("\n") end |
|
77 | Wildbreath-135052 | ||
78 | Wildbreath-135052 | local aFrame = CreateFrame("Frame", "fernir_UI_Window", MinimapCanvas) |
|
79 | Wildbreath-135052 | ||
80 | Wildbreath-135052 | local createFs = function(parent, justify, ownfsize) |
|
81 | Wildbreath-135052 | local f = parent:CreateFontString(nil, "OVERLAY") |
|
82 | Wildbreath-135052 | f:SetFont(settings.font, ownfsize or settings.fsize, "THINOUTLINE") |
|
83 | Wildbreath-135052 | if(justify) then f:SetJustifyH(justify) end |
|
84 | Wildbreath-135052 | return f |
|
85 | Wildbreath-135052 | end |
|
86 | Wildbreath-135052 | ||
87 | Wildbreath-135052 | fernir_UI.PLAYER_LOGIN = function(self, ...) |
|
88 | Wildbreath-135052 | if (settings.UIScale) then |
|
89 | Wildbreath-135052 | local index = GetCurrentResolution() |
|
90 | Wildbreath-135052 | local resolution = select(index, GetScreenResolutions()) |
|
91 | Wildbreath-135052 | if(resolution == "1680x1050" or resolution == "1920x1080" or resolution == "1920x1200" or resolution == "1600x900" or resolution == "1440x900") then |
|
92 | Wildbreath-135052 | SetCVar("useUiScale", 1) |
|
93 | Wildbreath-135052 | SetCVar("uiScale", 768/string.match(({GetScreenResolutions()})[GetCurrentResolution()], "%d+x(%d+)")) |
|
94 | Wildbreath-135052 | else |
|
95 | Wildbreath-135052 | print("Current resolution:", resolution) |
|
96 | Wildbreath-135052 | SetCVar("useUiScale", 0) |
|
97 | Wildbreath-135052 | StaticPopup_Show("DISABLE_UI") |
|
98 | Wildbreath-135052 | end |
|
99 | Wildbreath-135052 | end |
|
100 | Wildbreath-135052 | end |
|
101 | Wildbreath-135052 | ||
102 | Wildbreath-135052 | fernir_UI.ADDON_LOADED = function(self, ...) |
|
103 | Wildbreath-135052 | ||
104 | Wildbreath-135052 | if arg1 ~= "fernir_UI" then |
|
105 | Wildbreath-135052 | return |
|
106 | Wildbreath-135052 | end |
|
107 | Wildbreath-135052 | ||
108 | Wildbreath-135052 | --[[ Changing some variables ]] |
|
109 | Wildbreath-135052 | ||
110 | Wildbreath-135052 | SetCVar("screenshotQuality", 10) |
|
111 | Wildbreath-135052 | SetCVar("cameraDistanceMax", 50) |
|
112 | Wildbreath-135052 | SetCVar("cameraDistanceMaxFactor", 3.4) |
|
113 | Wildbreath-135052 | ||
114 | Wildbreath-135052 | aFrame:SetFrameStrata("BACKGROUND") |
|
115 | Wildbreath-135052 | local tt = aFrame:CreateTexture(nil, "BACKGROUND") |
|
116 | Wildbreath-135052 | tt:SetTexture(settings.texture) |
|
117 | Wildbreath-135052 | tt:SetVertexColor(.2, .2, .2, .4) |
|
118 | Wildbreath-135052 | tt:SetAllPoints(aFrame) |
|
119 | Wildbreath-135052 | aFrame:SetPoint("TOPLEFT", UIParent) |
|
120 | Wildbreath-135052 | aFrame:SetPoint("TOPRIGHT", UIParent) |
|
121 | Wildbreath-135052 | aFrame:SetHeight(15) |
|
122 | Wildbreath-135052 | aFrame:Show() |
|
123 | Wildbreath-135052 | ||
124 | Wildbreath-135052 | cString("gold") |
|
125 | Wildbreath-135052 | cString("dura", "progress", 0, 100) |
|
126 | Wildbreath-135052 | cString("lag") |
|
127 | Wildbreath-135052 | cString("guild", show_guild) |
|
128 | Wildbreath-135052 | cString("loot") |
|
129 | Wildbreath-135052 | cString("xp", "progress", 0, 100) |
|
130 | Wildbreath-135052 | cString("mem", show_addons) |
|
131 | Wildbreath-135052 | cString("wgtime") |
|
132 | Wildbreath-135052 | cString("honor") |
|
133 | Wildbreath-135052 | cString("fps", "progress", 0, 200) |
|
134 | Wildbreath-135052 | cString("dps") |
|
135 | Wildbreath-135052 | cString("zone") |
|
136 | Wildbreath-135052 | ||
137 | Wildbreath-135052 | checkStats() |
|
138 | Wildbreath-135052 | ||
139 | Wildbreath-135052 | for i, object in pairs(objects) do |
|
140 | Wildbreath-135052 | object.bar:SetWidth(object.text:GetStringWidth()+30) |
|
141 | Wildbreath-135052 | end |
|
142 | Wildbreath-135052 | ||
143 | Wildbreath-135052 | --GuildRoster() |
|
144 | Wildbreath-135052 | fernir_UI.GUILD_ROSTER_UPDATE() |
|
145 | Wildbreath-135052 | ||
146 | Wildbreath-135052 | updFrame = CreateFrame("Frame") |
|
147 | Wildbreath-135052 | updFrame.timeSinceLastUpdate = 0 |
|
148 | Wildbreath-135052 | updFrame:SetScript("OnUpdate", function(this, elapsed) |
|
149 | Wildbreath-135052 | updFrame.timeSinceLastUpdate = updFrame.timeSinceLastUpdate + elapsed |
|
150 | Wildbreath-135052 | ||
151 | Wildbreath-135052 | if (updFrame.timeSinceLastUpdate >= 1) then |
|
152 | Wildbreath-135052 | checkStats() |
|
153 | Wildbreath-135052 | updFrame.timeSinceLastUpdate = 0 |
|
154 | Wildbreath-135052 | end |
|
155 | Wildbreath-135052 | end) |
|
156 | Wildbreath-135052 | end |
|
157 | Wildbreath-135052 | ||
158 | Wildbreath-135052 | function checkStats() |
|
159 | Wildbreath-135052 | for i, object in pairs(objects) do |
|
160 | Wildbreath-135052 | if (i=="gold") then |
|
161 | Wildbreath-135052 | object.text:SetText("|TInterface\\BUTTONS\\UI-GroupLoot-Coin-Up:0:0:0:-1|t "..util.money(GetMoney())) |
|
162 | Wildbreath-135052 | elseif i=="dura" then |
|
163 | Wildbreath-135052 | object.text:SetText("|TInterface\\MINIMAP\\Tracking\\Repair:0:0:0:-1|t "..select(1, show_durability()).." ") |
|
164 | Wildbreath-135052 | object.progress:SetValue(select(2, show_durability()) or 0) |
|
165 | Wildbreath-135052 | elseif i=="fps" then |
|
166 | Wildbreath-135052 | object.text:SetText(" |cff"..tcolor.." fps:|r "..floor(GetFramerate())) |
|
167 | Wildbreath-135052 | object.progress:SetValue(floor(GetFramerate())) |
|
168 | Wildbreath-135052 | elseif i=="tm" then |
|
169 | Wildbreath-135052 | object.text:SetText("|cff"..tcolor.." T: |r"..date("%H:%M").." ") |
|
170 | Wildbreath-135052 | elseif i=="lag" then |
|
171 | Wildbreath-135052 | object.text:SetText("|TInterface\\MINIMAP\\Tracking\\FlightMaster:0:0:0:-1|t "..select(3, GetNetStats())) |
|
172 | Wildbreath-135052 | elseif i=="loot" then |
|
173 | Wildbreath-135052 | if UnitInParty("player") or UnitInRaid("player") then |
|
174 | Wildbreath-135052 | object.text:SetText("|TInterface\\MINIMAP\\Tracking\\Banker:0:0:0:-1|t "..show_loot()) |
|
175 | Wildbreath-135052 | end |
|
176 | Wildbreath-135052 | elseif i=="xp" then |
|
177 | Wildbreath-135052 | if UnitLevel("player") < 80 then |
|
178 | Wildbreath-135052 | object.text:SetText("|cff"..tcolor.." XP:|r |caa0033ee"..util.letter((UnitXPMax("player")-UnitXP("player")) + 1).." ("..util.letter(GetXPExhaustion() or 0)..")|r") |
|
179 | Wildbreath-135052 | object.progress:SetValue((floor((UnitXP("player")/UnitXPMax("player"))*100))) |
|
180 | Wildbreath-135052 | else |
|
181 | Wildbreath-135052 | object.progress = nil |
|
182 | Wildbreath-135052 | end |
|
183 | Wildbreath-135052 | elseif i=="guild" then |
|
184 | Wildbreath-135052 | if IsInGuild() then |
|
185 | Wildbreath-135052 | object.text:SetText("|TInterface\\MINIMAP\\Tracking\\Profession:0:0:0:-1|t "..get_guild) |
|
186 | Wildbreath-135052 | end |
|
187 | Wildbreath-135052 | elseif i=="mem" then |
|
188 | Wildbreath-135052 | object.text:SetText("|cff"..tcolor.." M:|r "..memoryval(collectgarbage("count"))) |
|
189 | Wildbreath-135052 | elseif i=="wgtime" then |
|
190 | Wildbreath-135052 | object.text:SetText("|TInterface\\PVPFrame\\PVP-Currency-Alliance:0:0:0:-1|t "..WGConvertTime(GetWintergraspWaitTime())) |
|
191 | Wildbreath-135052 | elseif i=="honor" then |
|
192 | Wildbreath-135052 | object.text:SetText("|TInterface\\MINIMAP\\Tracking\\BattleMaster:0:0:0:-1|t "..util.letter(GetHonorCurrency())) |
|
193 | Wildbreath-135052 | elseif i=="zone" then |
|
194 | Wildbreath-135052 | object.text:SetText(GetMinimapZoneText()) |
|
195 | Wildbreath-135052 | elseif i=="dps" then |
|
196 | Wildbreath-135052 | else |
|
197 | Wildbreath-135052 | end |
|
198 | Wildbreath-135052 | end |
|
199 | Wildbreath-135052 | end |
|
200 | Wildbreath-135052 | ||
201 | Wildbreath-135052 | function WGConvertTime(value) |
|
202 | Wildbreath-135052 | if(value~=nil)then |
|
203 | Wildbreath-135052 | local hours = floor(value / 3600) |
|
204 | Wildbreath-135052 | local minutes = value - (hours * 3600) |
|
205 | Wildbreath-135052 | minutescorrupt = floor(minutes / 60) |
|
206 | Wildbreath-135052 | if(minutescorrupt < 10)then minutesfixed = "0"..minutescorrupt.."" |
|
207 | Wildbreath-135052 | else minutesfixed = minutescorrupt end |
|
208 | Wildbreath-135052 | local seconds = floor(value - ((hours * 3600) + (minutescorrupt * 60))) |
|
209 | Wildbreath-135052 | if(seconds < 10)then secondsfixed = "0"..seconds.."" |
|
210 | Wildbreath-135052 | else secondsfixed = seconds end |
|
211 | Wildbreath-135052 | if (hours > 0) then |
|
212 | Wildbreath-135052 | return hours..":"..minutesfixed..":"..secondsfixed |
|
213 | Wildbreath-135052 | elseif (minutescorrupt > 0) then |
|
214 | Wildbreath-135052 | return "0:"..minutesfixed..":"..secondsfixed |
|
215 | Wildbreath-135052 | else |
|
216 | Wildbreath-135052 | return "0:00:"..secondsfixed |
|
217 | Wildbreath-135052 | end |
|
218 | Wildbreath-135052 | end |
|
219 | Wildbreath-135052 | return "" |
|
220 | Wildbreath-135052 | end |
|
221 | Wildbreath-135052 | ||
222 | Wildbreath-135052 | function show_addons() |
|
223 | Wildbreath-135052 | GameTooltip:SetOwner(aFrame, "ANCHOR_BOTTOMRIGHT") |
|
224 | Wildbreath-135052 | local total, addons, all_mem = 0, {}, collectgarbage("count") |
|
225 | Wildbreath-135052 | UpdateAddOnMemoryUsage() |
|
226 | Wildbreath-135052 | for i=1, GetNumAddOns(), 1 do |
|
227 | Wildbreath-135052 | if (GetAddOnMemoryUsage(i) > 0 ) then |
|
228 | Wildbreath-135052 | memory = GetAddOnMemoryUsage(i) |
|
229 | Wildbreath-135052 | entry = {name=GetAddOnInfo(i), memory = memory} |
|
230 | Wildbreath-135052 | table.insert(addons, entry) |
|
231 | Wildbreath-135052 | total = total + memory |
|
232 | Wildbreath-135052 | end |
|
233 | Wildbreath-135052 | end |
|
234 | Wildbreath-135052 | table.sort(addons, function(a, b) return a.memory > b.memory end) |
|
235 | Wildbreath-135052 | line("ADDONS MEMORY USAGE :", "\n") |
|
236 | Wildbreath-135052 | i = 0 |
|
237 | Wildbreath-135052 | for _, entry in pairs(addons) do |
|
238 | Wildbreath-135052 | line(entry.name, memoryval(entry.memory)) |
|
239 | Wildbreath-135052 | i = i + 1 |
|
240 | Wildbreath-135052 | if i >= 50 then break end |
|
241 | Wildbreath-135052 | end |
|
242 | Wildbreath-135052 | space() |
|
243 | Wildbreath-135052 | line("Addons", memoryval(total)) |
|
244 | Wildbreath-135052 | line("Blizz", memoryval(all_mem-total)) |
|
245 | Wildbreath-135052 | line("Total", memoryval(all_mem)) |
|
246 | Wildbreath-135052 | if not UnitAffectingCombat("player") then GameTooltip:Show() end |
|
247 | Wildbreath-135052 | end |
|
248 | Wildbreath-135052 | ||
249 | Wildbreath-135052 | function cString(name, point, ...) |
|
250 | Wildbreath-135052 | ||
251 | Wildbreath-135052 | local lastobject = nil |
|
252 | Wildbreath-135052 | for i, object in pairs(objects) do |
|
253 | Wildbreath-135052 | if object.child == false then |
|
254 | Wildbreath-135052 | objects[i].child = true |
|
255 | Wildbreath-135052 | lastobject = objects[i] |
|
256 | Wildbreath-135052 | break |
|
257 | Wildbreath-135052 | end |
|
258 | Wildbreath-135052 | end |
|
259 | Wildbreath-135052 | ||
260 | Wildbreath-135052 | local btn = CreateFrame("Frame", nil, aFrame) |
|
261 | Wildbreath-135052 | ||
262 | Wildbreath-135052 | if (lastobject) then |
|
263 | Wildbreath-135052 | btn:SetPoint("LEFT", lastobject.bar, "RIGHT", 0, 0) |
|
264 | Wildbreath-135052 | else |
|
265 | Wildbreath-135052 | btn:SetPoint("LEFT", aFrame, "LEFT", 0, 0) |
|
266 | Wildbreath-135052 | end |
|
267 | Wildbreath-135052 | ||
268 | Wildbreath-135052 | btn:SetWidth(UIParent:GetWidth()/objCount) |
|
269 | Wildbreath-135052 | btn:SetHeight(aFrame:GetHeight()) |
|
270 | Wildbreath-135052 | btn:EnableMouse(true) |
|
271 | Wildbreath-135052 | btn:Show() |
|
272 | Wildbreath-135052 | ||
273 | Wildbreath-135052 | ||
274 | Wildbreath-135052 | if type(point) == "string" then |
|
275 | Wildbreath-135052 | if point == "progress" then |
|
276 | Wildbreath-135052 | local val1, val2 = select(1, ...) |
|
277 | Wildbreath-135052 | btn.pb = CreateFrame("StatusBar", nil, btn) |
|
278 | Wildbreath-135052 | btn.pb:SetStatusBarTexture(settings.striped) |
|
279 | Wildbreath-135052 | btn.pb:SetStatusBarColor(.15, .15, .15) |
|
280 | Wildbreath-135052 | btn.pb.frequentUpdates = true |
|
281 | Wildbreath-135052 | btn.pb:SetPoint("TOPLEFT", btn, "TOPLEFT", 1, -1) |
|
282 | Wildbreath-135052 | btn.pb:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -1, 1) |
|
283 | Wildbreath-135052 | btn.pb:SetMinMaxValues(val1, val2) |
|
284 | Wildbreath-135052 | ||
285 | Wildbreath-135052 | local ppbg = btn.pb:CreateTexture(nil, "BACKGROUND") |
|
286 | Wildbreath-135052 | ppbg:SetTexture(settings.texture) |
|
287 | Wildbreath-135052 | ppbg:SetAllPoints(btn.pb) |
|
288 | Wildbreath-135052 | ppbg:SetVertexColor(.3, .3, .3) |
|
289 | Wildbreath-135052 | ||
290 | Wildbreath-135052 | local zstr = createFs(btn.pb, nil, 10) |
|
291 | Wildbreath-135052 | zstr:SetAllPoints(btn.pb) |
|
292 | Wildbreath-135052 | ||
293 | Wildbreath-135052 | objects[name] = { |
|
294 | Wildbreath-135052 | ["text"] = zstr, |
|
295 | Wildbreath-135052 | ["bar"] = btn, |
|
296 | Wildbreath-135052 | ["progress"] = btn.pb, |
|
297 | Wildbreath-135052 | ["child"] = false, |
|
298 | Wildbreath-135052 | } |
|
299 | Wildbreath-135052 | end |
|
300 | Wildbreath-135052 | elseif type(point) == "function" then |
|
301 | Wildbreath-135052 | btn:SetScript("OnEnter", point) |
|
302 | Wildbreath-135052 | btn:SetScript("OnLeave", function() GameTooltip:Hide() end) |
|
303 | Wildbreath-135052 | ||
304 | Wildbreath-135052 | local zstr = btn:CreateFontString(nil, "OVERLAY") |
|
305 | Wildbreath-135052 | zstr:SetFont(settings.font, 10, "THINOUTLINE") |
|
306 | Wildbreath-135052 | zstr:SetAllPoints(btn) |
|
307 | Wildbreath-135052 | zstr:SetTextColor(0, 1, 0.2, 1) |
|
308 | Wildbreath-135052 | zstr:SetJustifyV("MIDDLE") |
|
309 | Wildbreath-135052 | ||
310 | Wildbreath-135052 | objects[name] = { |
|
311 | Wildbreath-135052 | ["text"] = zstr, |
|
312 | Wildbreath-135052 | ["bar"] = btn, |
|
313 | Wildbreath-135052 | ["progress"] = nil, |
|
314 | Wildbreath-135052 | ["child"] = false, |
|
315 | Wildbreath-135052 | } |
|
316 | Wildbreath-135052 | ||
317 | Wildbreath-135052 | else |
|
318 | Wildbreath-135052 | local zstr = btn:CreateFontString(nil, "OVERLAY") |
|
319 | Wildbreath-135052 | zstr:SetFont(settings.font, 10, "THINOUTLINE") |
|
320 | Wildbreath-135052 | zstr:SetAllPoints(btn) |
|
321 | Wildbreath-135052 | zstr:SetTextColor(0, 1, 0.2, 1) |
|
322 | Wildbreath-135052 | zstr:SetJustifyV("MIDDLE") |
|
323 | Wildbreath-135052 | ||
324 | Wildbreath-135052 | objects[name] = { |
|
325 | Wildbreath-135052 | ["text"] = zstr, |
|
326 | Wildbreath-135052 | ["bar"] = btn, |
|
327 | Wildbreath-135052 | ["progress"] = nil, |
|
328 | Wildbreath-135052 | ["child"] = false, |
|
329 | Wildbreath-135052 | } |
|
330 | Wildbreath-135052 | end |
|
331 | Wildbreath-135052 | ||
332 | Wildbreath-135052 | return btn |
|
333 | Wildbreath-135052 | end |
|
334 | Wildbreath-135052 | ||
335 | Wildbreath-135052 | function show_durability() |
|
336 | Wildbreath-135052 | local cost, ndx, durability, d_val, d_max = GetRepairAllCost(), 0, 0, 0, 0 |
|
337 | Wildbreath-135052 | for slot = 0, 19 do |
|
338 | Wildbreath-135052 | d_val, d_max = GetInventoryItemDurability(slot) |
|
339 | Wildbreath-135052 | if(d_val) then durability = durability + d_val/d_max*100 ndx=ndx+1 |
|
340 | Wildbreath-135052 | end |
|
341 | Wildbreath-135052 | end |
|
342 | Wildbreath-135052 | durability = floor(durability/ndx) |
|
343 | Wildbreath-135052 | local out_string = util.gradient_s(floor(durability), 0, 100).." % " |
|
344 | Wildbreath-135052 | if(cost > 0) then return out_string.."["..cost.."]" end |
|
345 | Wildbreath-135052 | return out_string, durability+1 |
|
346 | Wildbreath-135052 | end |
|
347 | Wildbreath-135052 | ||
348 | Wildbreath-135052 | function show_guild() |
|
349 | Wildbreath-135052 | GameTooltip:SetOwner(aFrame, "ANCHOR_BOTTOMRIGHT") |
|
350 | Wildbreath-135052 | line("guild :", GetGuildInfo("player")) |
|
351 | Wildbreath-135052 | space() |
|
352 | Wildbreath-135052 | for _, val in ipairs(guildtable) do |
|
353 | Wildbreath-135052 | line(string.format("|cffdddd00%s|r %s|r [ %s ]", val[1], classcol(val[9])..val[2], val[4], val[5]), val[5]) |
|
354 | Wildbreath-135052 | end |
|
355 | Wildbreath-135052 | if not UnitAffectingCombat("player") then GameTooltip:Show() end |
|
356 | Wildbreath-135052 | end |
|
357 | Wildbreath-135052 | ||
358 | Wildbreath-135052 | function memoryval(val) |
|
359 | Wildbreath-135052 | if val > 1024 then return floor(val/1024).." mb" |
|
360 | Wildbreath-135052 | else return floor(val).." kb" end |
|
361 | Wildbreath-135052 | end |
|
362 | Wildbreath-135052 | ||
363 | Wildbreath-135052 | fernir_UI.GUILD_ROSTER_UPDATE = function(self, ...) |
|
364 | Wildbreath-135052 | local total, online = 0, 0 |
|
365 | Wildbreath-135052 | guildtable = {} |
|
366 | Wildbreath-135052 | if IsInGuild() then |
|
367 | Wildbreath-135052 | total = GetNumGuildMembers(true) |
|
368 | Wildbreath-135052 | for ndx = 0, total do |
|
369 | Wildbreath-135052 | name, rnk, irnk, lvl, class, zone, note, onote, on, status, engclass = GetGuildRosterInfo(ndx) |
|
370 | Wildbreath-135052 | if(on and name) then |
|
371 | Wildbreath-135052 | online = online + on |
|
372 | Wildbreath-135052 | table.insert(guildtable, {lvl, name, class, zone, note, onote, on, status, engclass}) |
|
373 | Wildbreath-135052 | end |
|
374 | Wildbreath-135052 | end |
|
375 | Wildbreath-135052 | end |
|
376 | Wildbreath-135052 | get_guild = online.."/"..total |
|
377 | Wildbreath-135052 | end |
|
378 | Wildbreath-135052 | ||
379 | Wildbreath-135052 | function show_loot() |
|
380 | Wildbreath-135052 | local lootmethod, masterlooterPartyID, masterlooterRaidID = GetLootMethod() |
|
381 | Wildbreath-135052 | local master = "" |
|
382 | Wildbreath-135052 | if masterlooterPartyID then |
|
383 | Wildbreath-135052 | master = ", "..UnitName("party"..masterlooterPartyID) |
|
384 | Wildbreath-135052 | elseif masterlooterRaidID then |
|
385 | Wildbreath-135052 | master = ", "..UnitName("raid"..masterlooterPartyID) |
|
386 | Wildbreath-135052 | else |
|
387 | Wildbreath-135052 | master = "" |
|
388 | Wildbreath-135052 | end |
|
389 | Wildbreath-135052 | ||
390 | Wildbreath-135052 | objects["loot"].bar:SetWidth(objects["loot"].text:GetStringWidth()+30) |
|
391 | Wildbreath-135052 | return format("%s %s", lootmethod, master) |
|
392 | Wildbreath-135052 | end |
|
393 | Wildbreath-135052 | ||
394 | Wildbreath-135052 | function classcol(class) |
|
395 | Wildbreath-135052 | if not _G["RAID_CLASS_COLORS"] then return ("|cffffffff") end |
|
396 | Wildbreath-135052 | local color = _G["RAID_CLASS_COLORS"][strupper(class)] |
|
397 | Wildbreath-135052 | return format("|cff%02x%02x%02x", color.r*255, color.g*255, color.b*255) |
|
398 | Wildbreath-135052 | end |
|
399 | Wildbreath-135052 | ||
400 | Wildbreath-135052 | ||
401 | Wildbreath-135052 | ||
402 | Wildbreath-135052 | fernir_UI.PLAYER_ENTERING_WORLD = function(self, ...) |
|
403 | Wildbreath-135052 | fernir_UI:UnregisterEvent("PLAYER_ENTERING_WORLD" ) |
|
404 | Wildbreath-135052 | ||
405 | Wildbreath-135052 | --WatchFrame:ClearAllPoints() |
|
406 | Wildbreath-135052 | --WatchFrame:SetPoint("TOPLEFT", "UIParent", "TOPRIGHT", -350, -300) |
|
407 | Wildbreath-135052 | --WatchFrame:SetHeight(600) |
|
408 | Wildbreath-135052 | --WatchFrame.ClearAllPoints = function() end |
|
409 | Wildbreath-135052 | --WatchFrame.SetPoint = function() end |
|
410 | Wildbreath-135052 | --WatchFrame.SetAllPoints = function() end |
|
411 | Wildbreath-135052 | ||
412 | Wildbreath-135052 | local color = _G["RAID_CLASS_COLORS"][select(2, UnitClass("player"))] or {0,0,0} |
|
413 | Wildbreath-135052 | tcolor = format("%02x%02x%02x", color.r*255, color.g*255, color.b*255) --"637eae" |
|
414 | Wildbreath-135052 | end |
|
415 | Wildbreath-135052 | ||
416 | Wildbreath-135052 | fernir_UI.PLAYER_REGEN_ENABLED = function(self, ...) |
|
417 | Wildbreath-135052 | damage = 0 |
|
418 | Wildbreath-135052 | stime = 0 |
|
419 | Wildbreath-135052 | ctime = 0 |
|
420 | Wildbreath-135052 | self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
|
421 | Wildbreath-135052 | end |
|
422 | Wildbreath-135052 | ||
423 | Wildbreath-135052 | fernir_UI.PLAYER_REGEN_DISABLED = function(self, ...) |
|
424 | Wildbreath-135052 | stime = GetTime() |
|
425 | Wildbreath-135052 | self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
|
426 | Wildbreath-135052 | end |
|
427 | Wildbreath-135052 | ||
428 | Wildbreath-135052 | fernir_UI.COMBAT_LOG_EVENT_UNFILTERED = function(_, _, timestamp, event, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, meleedamage, _, _, spelldamage) |
|
429 | Wildbreath-135052 | if sourceGUID == UnitGUID("player") or sourceGUID == UnitGUID("playerpet") then |
|
430 | Wildbreath-135052 | local duration = 1 |
|
431 | Wildbreath-135052 | if ( event == "SWING_DAMAGE" ) then |
|
432 | Wildbreath-135052 | damage = damage + meleedamage |
|
433 | Wildbreath-135052 | ctime = GetTime() |
|
434 | Wildbreath-135052 | if ((ctime - stime) > 1) then |
|
435 | Wildbreath-135052 | duration = ctime - stime |
|
436 | Wildbreath-135052 | end |
|
437 | Wildbreath-135052 | objects["dps"].text:SetText(" |cff"..tcolor.." DPS:|r "..floor(damage / duration)) |
|
438 | Wildbreath-135052 | objects["dps"].bar:SetWidth(objects["dps"].text:GetStringWidth() + 30) |
|
439 | Wildbreath-135052 | elseif (event == "SPELL_DAMAGE" or event == "SPELL_PERIODIC_DAMAGE") then |
|
440 | Wildbreath-135052 | damage = damage + spelldamage |
|
441 | Wildbreath-135052 | ||
442 | Wildbreath-135052 | ctime = GetTime() |
|
443 | Wildbreath-135052 | if ((ctime - stime) > 1) then |
|
444 | Wildbreath-135052 | duration = ctime - stime |
|
445 | Wildbreath-135052 | end |
|
446 | Wildbreath-135052 | objects["dps"].text:SetText(" |cff"..tcolor.." DPS:|r "..floor(damage / duration)) |
|
447 | Wildbreath-135052 | objects["dps"].bar:SetWidth(objects["dps"].text:GetStringWidth() + 30) |
|
448 | Wildbreath-135052 | end |
|
449 | Wildbreath-135052 | end |
|
450 | Wildbreath-135052 | end |
|
451 | Wildbreath-135052 | ||
452 | Wildbreath-135052 | ||
453 | Wildbreath-135052 | WatchFrame:SetFrameStrata("TOOLTIP") |
|
454 | Wildbreath-135052 | WatchFrame:ClearAllPoints() |
|
455 | Wildbreath-135052 | --WatchFrame:SetPoint("TOPLEFT", UIParent, "TOPRIGHT", 350,-300) |
|
456 | Wildbreath-135052 | WatchFrame:SetHeight(600) |
|
457 | Wildbreath-135052 | WatchFrame.ClearAllPoints = function() end |
|
458 | Wildbreath-135052 | WatchFrame.SetPoint = function() end |
|
459 | Wildbreath-135052 | WatchFrame.SetAllPoints = function() end |
|
460 | Wildbreath-135052 | WatchFrame:SetMovable(true) |
|
461 | Wildbreath-135052 | WatchFrameCollapseExpandButton:RegisterForDrag("LeftButton") |
|
462 | Wildbreath-135052 | WatchFrame:SetUserPlaced(true) |
|
463 | Wildbreath-135052 | WatchFrameCollapseExpandButton:HookScript('OnDragStart', function(self) WatchFrame:StartMoving() end) |
|
464 | Wildbreath-135052 | WatchFrameCollapseExpandButton:HookScript('OnDragStop', function(self) WatchFrame:StopMovingOrSizing() end) |
|
465 | Wildbreath-135052 | WatchFrameCollapseExpandButton.Hide = function() end |
|
466 | Wildbreath-135052 | ||
467 | Wildbreath-135052 | fernir_UI:RegisterEvent("ADDON_LOADED") |
|
468 | Wildbreath-135052 | fernir_UI:RegisterEvent("PLAYER_ENTERING_WORLD") |
|
469 | Wildbreath-135052 | fernir_UI:RegisterEvent("GUILD_ROSTER_UPDATE") |
|
470 | Wildbreath-135052 | fernir_UI:RegisterEvent("PLAYER_LOGIN") |
|
471 | Wildbreath-135052 | fernir_UI:RegisterEvent("PLAYER_REGEN_DISABLED") |
|
472 | Wildbreath-135052 | fernir_UI:RegisterEvent("PLAYER_REGEN_ENABLED") |
|
473 | Wildbreath-135052 | ||
474 | Wildbreath-135052 | fernir_UI:SetScript("OnEvent", function(self, event, ...) self[event](self, event, ...) end) |