Details | Compare with Previous | View Log
Line No. | Rev | Author | Line |
---|---|---|---|
1 | 2 | Wildbreath-135052 | local settings = oUF_Settings |
2 | Wildbreath-135052 | ||
3 | Wildbreath-135052 | local myname, ns = ... |
|
4 | Wildbreath-135052 | ||
5 | Wildbreath-135052 | local locale = GetLocale() |
|
6 | Wildbreath-135052 | ns.rollpairs = locale == "deDE" and { |
|
7 | Wildbreath-135052 | ["(.*) passt automatisch bei (.+), weil [ersi]+ den Gegenstand nicht benutzen kann.$"] = "pass", |
|
8 | Wildbreath-135052 | ["(.*) wurfelt nicht fur: (.+|r)$"] = "pass", |
|
9 | Wildbreath-135052 | ["(.*) hat fur (.+) 'Gier' ausgewahlt"] = "greed", |
|
10 | Wildbreath-135052 | ["(.*) hat fur (.+) 'Bedarf' ausgewahlt"] = "need", |
|
11 | Wildbreath-135052 | ["(.*) hat fur '(.+)' Entzauberung gewahlt."] = "disenchant", |
|
12 | Wildbreath-135052 | } or locale == "frFR" and { |
|
13 | Wildbreath-135052 | ["(.*) a passe pour : (.+) parce qu'((il)|(elle)) ne peut pas ramasser cette objet.$"] = "pass", |
|
14 | Wildbreath-135052 | ["(.*) a passe pour : (.+)"] = "pass", |
|
15 | Wildbreath-135052 | ["(.*) a choisi Cupidite pour : (.+)"] = "greed", |
|
16 | Wildbreath-135052 | ["(.*) a choisi Besoin pour : (.+)"] = "need", |
|
17 | Wildbreath-135052 | } or locale == "ruRU" and { |
|
18 | Wildbreath-135052 | ["(.*) àâòîìàòè÷åñêè ïåðåäàåò ïðåäìåò (.+), ïîñêîëüêó íå ìîæåò åãî çàáðàòü"] = "pass", |
|
19 | Wildbreath-135052 | ["(.*) ïðîïóñêàåò ðîçûãðûø ïðåäìåòà \"(.+)\", ïîñêîëüêó íå ìîæåò åãî çàáðàòü"] = "pass", |
|
20 | Wildbreath-135052 | ["(.*) îòêàçûâàåòñÿ îò ïðåäìåòà (.+)%."] = "pass", |
|
21 | Wildbreath-135052 | ["Ðàçûãðûâàåòñÿ: (.+)%. (.*): \"Íå îòêàæóñü\""] = "greed", |
|
22 | Wildbreath-135052 | ["Ðàçûãðûâàåòñÿ: (.+)%. (.*): \"Ìíå ýòî íóæíî\""] = "need", |
|
23 | Wildbreath-135052 | ["Ðàçûãðûâàåòñÿ: (.+)%. (.*): \"Ðàñïûëèòü\""] = "disenchant", |
|
24 | Wildbreath-135052 | } or locale == "zhTW" and { |
|
25 | Wildbreath-135052 | ["(.*)????:(.+),??"] = "pass", |
|
26 | Wildbreath-135052 | ["(.*)???:(.+)"] = "pass", |
|
27 | Wildbreath-135052 | ["(.*)???????:(.+)"] = "greed", |
|
28 | Wildbreath-135052 | ["(.*)???????:(.+)"] = "need", |
|
29 | Wildbreath-135052 | ["(.*)????:(.+)"] = "disenchant", |
|
30 | Wildbreath-135052 | } or { |
|
31 | Wildbreath-135052 | ["^(.*) automatically passed on: (.+) because s?he cannot loot that item.$"] = "pass", |
|
32 | Wildbreath-135052 | ["^(.*) passed on: (.+|r)$"] = "pass", |
|
33 | Wildbreath-135052 | ["(.*) has selected Greed for: (.+)"] = "greed", |
|
34 | Wildbreath-135052 | ["(.*) has selected Need for: (.+)"] = "need", |
|
35 | Wildbreath-135052 | ["(.*) has selected Disenchant for: (.+)"] = "disenchant", |
|
36 | Wildbreath-135052 | } |
|
37 | Wildbreath-135052 | ||
38 | Wildbreath-135052 | ||
39 | Wildbreath-135052 | local backdrop = { |
|
40 | Wildbreath-135052 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tile = true, tileSize = 16, |
|
41 | Wildbreath-135052 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16, |
|
42 | Wildbreath-135052 | insets = {left = 4, right = 4, top = 4, bottom = 4}, |
|
43 | Wildbreath-135052 | } |
|
44 | Wildbreath-135052 | ||
45 | Wildbreath-135052 | ||
46 | Wildbreath-135052 | local function ClickRoll(frame) |
|
47 | Wildbreath-135052 | RollOnLoot(frame.parent.rollid, frame.rolltype) |
|
48 | Wildbreath-135052 | end |
|
49 | Wildbreath-135052 | ||
50 | Wildbreath-135052 | ||
51 | Wildbreath-135052 | local function HideTip() GameTooltip:Hide() end |
|
52 | Wildbreath-135052 | local function HideTip2() GameTooltip:Hide(); ResetCursor() end |
|
53 | Wildbreath-135052 | ||
54 | Wildbreath-135052 | ||
55 | Wildbreath-135052 | local rolltypes = {"need", "greed", "disenchant", [0] = "pass"} |
|
56 | Wildbreath-135052 | local function SetTip(frame) |
|
57 | Wildbreath-135052 | GameTooltip:SetOwner(frame, "ANCHOR_RIGHT") |
|
58 | Wildbreath-135052 | GameTooltip:SetText(frame.tiptext) |
|
59 | Wildbreath-135052 | if frame:IsEnabled() == 0 then GameTooltip:AddLine("|cffff3333Cannot roll") end |
|
60 | Wildbreath-135052 | for name,roll in pairs(frame.parent.rolls) do if roll == rolltypes[frame.rolltype] then GameTooltip:AddLine(name, 1, 1, 1) end end |
|
61 | Wildbreath-135052 | GameTooltip:Show() |
|
62 | Wildbreath-135052 | end |
|
63 | Wildbreath-135052 | ||
64 | Wildbreath-135052 | ||
65 | Wildbreath-135052 | local function SetItemTip(frame) |
|
66 | Wildbreath-135052 | if not frame.link then return end |
|
67 | Wildbreath-135052 | GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT") |
|
68 | Wildbreath-135052 | GameTooltip:SetHyperlink(frame.link) |
|
69 | Wildbreath-135052 | if IsShiftKeyDown() then GameTooltip_ShowCompareItem() end |
|
70 | Wildbreath-135052 | if IsModifiedClick("DRESSUP") then ShowInspectCursor() else ResetCursor() end |
|
71 | Wildbreath-135052 | end |
|
72 | Wildbreath-135052 | ||
73 | Wildbreath-135052 | ||
74 | Wildbreath-135052 | local function ItemOnUpdate(self) |
|
75 | Wildbreath-135052 | if IsShiftKeyDown() then GameTooltip_ShowCompareItem() end |
|
76 | Wildbreath-135052 | CursorOnUpdate(self) |
|
77 | Wildbreath-135052 | end |
|
78 | Wildbreath-135052 | ||
79 | Wildbreath-135052 | ||
80 | Wildbreath-135052 | local function LootClick(frame) |
|
81 | Wildbreath-135052 | if IsControlKeyDown() then DressUpItemLink(frame.link) |
|
82 | Wildbreath-135052 | elseif IsShiftKeyDown() then ChatEdit_InsertLink(frame.link) end |
|
83 | Wildbreath-135052 | end |
|
84 | Wildbreath-135052 | ||
85 | Wildbreath-135052 | ||
86 | Wildbreath-135052 | local cancelled_rolls = {} |
|
87 | Wildbreath-135052 | local function OnEvent(frame, event, rollid) |
|
88 | Wildbreath-135052 | cancelled_rolls[rollid] = true |
|
89 | Wildbreath-135052 | if frame.rollid ~= rollid then return end |
|
90 | Wildbreath-135052 | ||
91 | Wildbreath-135052 | frame.rollid = nil |
|
92 | Wildbreath-135052 | frame.time = nil |
|
93 | Wildbreath-135052 | frame:Hide() |
|
94 | Wildbreath-135052 | end |
|
95 | Wildbreath-135052 | ||
96 | Wildbreath-135052 | ||
97 | Wildbreath-135052 | local function StatusUpdate(frame) |
|
98 | Wildbreath-135052 | local t = GetLootRollTimeLeft(frame.parent.rollid) |
|
99 | Wildbreath-135052 | local perc = t / frame.parent.time |
|
100 | Wildbreath-135052 | frame.spark:SetPoint("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0) |
|
101 | Wildbreath-135052 | frame:SetValue(t) |
|
102 | Wildbreath-135052 | end |
|
103 | Wildbreath-135052 | ||
104 | Wildbreath-135052 | ||
105 | Wildbreath-135052 | local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext, ...) |
|
106 | Wildbreath-135052 | local f = CreateFrame("Button", nil, parent) |
|
107 | Wildbreath-135052 | f:SetPoint(...) |
|
108 | Wildbreath-135052 | f:SetWidth(28) |
|
109 | Wildbreath-135052 | f:SetHeight(28) |
|
110 | Wildbreath-135052 | f:SetNormalTexture(ntex) |
|
111 | Wildbreath-135052 | if ptex then f:SetPushedTexture(ptex) end |
|
112 | Wildbreath-135052 | f:SetHighlightTexture(htex) |
|
113 | Wildbreath-135052 | f.rolltype = rolltype |
|
114 | Wildbreath-135052 | f.parent = parent |
|
115 | Wildbreath-135052 | f.tiptext = tiptext |
|
116 | Wildbreath-135052 | f:SetScript("OnEnter", SetTip) |
|
117 | Wildbreath-135052 | f:SetScript("OnLeave", HideTip) |
|
118 | Wildbreath-135052 | f:SetScript("OnClick", ClickRoll) |
|
119 | Wildbreath-135052 | f:SetMotionScriptsWhileDisabled(true) |
|
120 | Wildbreath-135052 | local txt = f:CreateFontString(nil, nil, "GameFontHighlightSmallOutline") |
|
121 | Wildbreath-135052 | txt:SetPoint("CENTER", 0, rolltype == 2 and 1 or rolltype == 0 and -1.2 or 0) |
|
122 | Wildbreath-135052 | return f, txt |
|
123 | Wildbreath-135052 | end |
|
124 | Wildbreath-135052 | ||
125 | Wildbreath-135052 | ||
126 | Wildbreath-135052 | local function CreateRollFrame() |
|
127 | Wildbreath-135052 | local frame = CreateFrame("Frame", nil, UIParent) |
|
128 | Wildbreath-135052 | frame:SetWidth(328) |
|
129 | Wildbreath-135052 | frame:SetHeight(26) |
|
130 | Wildbreath-135052 | frame:SetBackdrop(backdrop) |
|
131 | Wildbreath-135052 | frame:SetBackdropColor(0, 0, 0, .9) |
|
132 | Wildbreath-135052 | frame:SetScript("OnEvent", OnEvent) |
|
133 | Wildbreath-135052 | frame:RegisterEvent("CANCEL_LOOT_ROLL") |
|
134 | Wildbreath-135052 | frame:Hide() |
|
135 | Wildbreath-135052 | ||
136 | Wildbreath-135052 | local button = CreateFrame("Button", nil, frame) |
|
137 | Wildbreath-135052 | button:SetPoint("LEFT", 5, 0) |
|
138 | Wildbreath-135052 | button:SetWidth(24) |
|
139 | Wildbreath-135052 | button:SetHeight(24) |
|
140 | Wildbreath-135052 | button:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2") |
|
141 | Wildbreath-135052 | button:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square") |
|
142 | Wildbreath-135052 | button:GetHighlightTexture():SetBlendMode("ADD") |
|
143 | Wildbreath-135052 | button:SetScript("OnEnter", SetItemTip) |
|
144 | Wildbreath-135052 | button:SetScript("OnLeave", HideTip2) |
|
145 | Wildbreath-135052 | button:SetScript("OnUpdate", ItemOnUpdate) |
|
146 | Wildbreath-135052 | button:SetScript("OnClick", LootClick) |
|
147 | Wildbreath-135052 | frame.button = button |
|
148 | Wildbreath-135052 | ||
149 | Wildbreath-135052 | local buttonborder = CreateFrame("Frame", nil, button) |
|
150 | Wildbreath-135052 | buttonborder:SetWidth(32) |
|
151 | Wildbreath-135052 | buttonborder:SetHeight(32) |
|
152 | Wildbreath-135052 | buttonborder:SetPoint("CENTER", button, "CENTER") |
|
153 | Wildbreath-135052 | buttonborder:SetBackdrop(backdrop) |
|
154 | Wildbreath-135052 | buttonborder:SetBackdropColor(1, 1, 1, 0) |
|
155 | Wildbreath-135052 | frame.buttonborder = buttonborder |
|
156 | Wildbreath-135052 | ||
157 | Wildbreath-135052 | local tfade = frame:CreateTexture(nil, "BORDER") |
|
158 | Wildbreath-135052 | tfade:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -4) |
|
159 | Wildbreath-135052 | tfade:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 4) |
|
160 | Wildbreath-135052 | tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground") |
|
161 | Wildbreath-135052 | tfade:SetBlendMode("ADD") |
|
162 | Wildbreath-135052 | tfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .25, .25, .25, 1) |
|
163 | Wildbreath-135052 | ||
164 | Wildbreath-135052 | local status = CreateFrame("StatusBar", nil, frame) |
|
165 | Wildbreath-135052 | status:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -4, -4) |
|
166 | Wildbreath-135052 | status:SetPoint("BOTTOM", frame, "BOTTOM", 0, 4) |
|
167 | Wildbreath-135052 | status:SetPoint("LEFT", frame.button, "RIGHT", -1, 0) |
|
168 | Wildbreath-135052 | status:SetScript("OnUpdate", StatusUpdate) |
|
169 | Wildbreath-135052 | status:SetFrameLevel(status:GetFrameLevel()-1) |
|
170 | Wildbreath-135052 | status:SetStatusBarTexture("Interface\\AddOns\\teksLoot\\DarkBottom.tga") |
|
171 | Wildbreath-135052 | status:SetStatusBarColor(.8, .8, .8, .9) |
|
172 | Wildbreath-135052 | status.parent = frame |
|
173 | Wildbreath-135052 | frame.status = status |
|
174 | Wildbreath-135052 | ||
175 | Wildbreath-135052 | local spark = frame:CreateTexture(nil, "OVERLAY") |
|
176 | Wildbreath-135052 | spark:SetWidth(14) |
|
177 | Wildbreath-135052 | spark:SetHeight(35) |
|
178 | Wildbreath-135052 | spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark") |
|
179 | Wildbreath-135052 | spark:SetBlendMode("ADD") |
|
180 | Wildbreath-135052 | status.spark = spark |
|
181 | Wildbreath-135052 | ||
182 | Wildbreath-135052 | local need, needtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Dice-Up", "Interface\\Buttons\\UI-GroupLoot-Dice-Highlight", "Interface\\Buttons\\UI-GroupLoot-Dice-Down", 1, NEED, "LEFT", frame.button, "RIGHT", 5, -1) |
|
183 | Wildbreath-135052 | local greed, greedtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Coin-Up", "Interface\\Buttons\\UI-GroupLoot-Coin-Highlight", "Interface\\Buttons\\UI-GroupLoot-Coin-Down", 2, GREED, "LEFT", need, "RIGHT", 0, -1) |
|
184 | Wildbreath-135052 | local de, detext |
|
185 | Wildbreath-135052 | de, detext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-DE-Up", "Interface\\Buttons\\UI-GroupLoot-DE-Highlight", "Interface\\Buttons\\UI-GroupLoot-DE-Down", 3, ROLL_DISENCHANT, "LEFT", greed, "RIGHT", 0, -1) |
|
186 | Wildbreath-135052 | local pass, passtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Pass-Up", nil, "Interface\\Buttons\\UI-GroupLoot-Pass-Down", 0, PASS, "LEFT", de or greed, "RIGHT", 0, 2.2) |
|
187 | Wildbreath-135052 | frame.needbutt, frame.greedbutt, frame.disenchantbutt = need, greed, de |
|
188 | Wildbreath-135052 | frame.need, frame.greed, frame.pass, frame.disenchant = needtext, greedtext, passtext, detext |
|
189 | Wildbreath-135052 | ||
190 | Wildbreath-135052 | local bind = frame:CreateFontString() |
|
191 | Wildbreath-135052 | bind:SetPoint("LEFT", pass, "RIGHT", 3, 1) |
|
192 | Wildbreath-135052 | bind:SetFont(settings.font, 13, "THINOUTLINE") |
|
193 | Wildbreath-135052 | frame.fsbind = bind |
|
194 | Wildbreath-135052 | ||
195 | Wildbreath-135052 | local loot = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") |
|
196 | Wildbreath-135052 | loot:SetPoint("LEFT", bind, "RIGHT", 0, .12) |
|
197 | Wildbreath-135052 | loot:SetPoint("RIGHT", frame, "RIGHT", -5, 0) |
|
198 | Wildbreath-135052 | loot:SetHeight(16) |
|
199 | Wildbreath-135052 | loot:SetJustifyH("LEFT") |
|
200 | Wildbreath-135052 | frame.fsloot = loot |
|
201 | Wildbreath-135052 | ||
202 | Wildbreath-135052 | frame.rolls = {} |
|
203 | Wildbreath-135052 | ||
204 | Wildbreath-135052 | return frame |
|
205 | Wildbreath-135052 | end |
|
206 | Wildbreath-135052 | ||
207 | Wildbreath-135052 | ||
208 | Wildbreath-135052 | local anchor = CreateFrame("Button", nil, UIParent) |
|
209 | Wildbreath-135052 | anchor:SetWidth(300) anchor:SetHeight(22) |
|
210 | Wildbreath-135052 | anchor:SetBackdrop(backdrop) |
|
211 | Wildbreath-135052 | anchor:SetBackdropColor(0.25, 0.25, 0.25, 1) |
|
212 | Wildbreath-135052 | local label = anchor:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") |
|
213 | Wildbreath-135052 | label:SetAllPoints(anchor) |
|
214 | Wildbreath-135052 | label:SetText("teksLoot") |
|
215 | Wildbreath-135052 | ||
216 | Wildbreath-135052 | anchor:SetScript("OnClick", anchor.Hide) |
|
217 | Wildbreath-135052 | anchor:SetScript("OnDragStart", anchor.StartMoving) |
|
218 | Wildbreath-135052 | anchor:SetScript("OnDragStop", function(self) |
|
219 | Wildbreath-135052 | self:StopMovingOrSizing() |
|
220 | Wildbreath-135052 | self.db.x, self.db.y = self:GetCenter() |
|
221 | Wildbreath-135052 | end) |
|
222 | Wildbreath-135052 | anchor:SetMovable(true) |
|
223 | Wildbreath-135052 | anchor:EnableMouse(true) |
|
224 | Wildbreath-135052 | anchor:RegisterForDrag("LeftButton") |
|
225 | Wildbreath-135052 | anchor:RegisterForClicks("RightButtonUp") |
|
226 | Wildbreath-135052 | anchor:Hide() |
|
227 | Wildbreath-135052 | ||
228 | Wildbreath-135052 | local frames = {} |
|
229 | Wildbreath-135052 | ||
230 | Wildbreath-135052 | local f = CreateRollFrame() -- Create one for good measure |
|
231 | Wildbreath-135052 | f:SetPoint("TOPLEFT", next(frames) and frames[#frames] or anchor, "BOTTOMLEFT", 0, -4) |
|
232 | Wildbreath-135052 | table.insert(frames, f) |
|
233 | Wildbreath-135052 | ||
234 | Wildbreath-135052 | local function GetFrame() |
|
235 | Wildbreath-135052 | for i,f in ipairs(frames) do |
|
236 | Wildbreath-135052 | if not f.rollid then return f end |
|
237 | Wildbreath-135052 | end |
|
238 | Wildbreath-135052 | ||
239 | Wildbreath-135052 | local f = CreateRollFrame() |
|
240 | Wildbreath-135052 | f:SetPoint("TOPLEFT", next(frames) and frames[#frames] or anchor, "BOTTOMLEFT", 0, -4) |
|
241 | Wildbreath-135052 | table.insert(frames, f) |
|
242 | Wildbreath-135052 | return f |
|
243 | Wildbreath-135052 | end |
|
244 | Wildbreath-135052 | ||
245 | Wildbreath-135052 | ||
246 | Wildbreath-135052 | local function START_LOOT_ROLL(rollid, time) |
|
247 | Wildbreath-135052 | if cancelled_rolls[rollid] then return end |
|
248 | Wildbreath-135052 | ||
249 | Wildbreath-135052 | local f = GetFrame() |
|
250 | Wildbreath-135052 | f.rollid = rollid |
|
251 | Wildbreath-135052 | f.time = time |
|
252 | Wildbreath-135052 | for i in pairs(f.rolls) do f.rolls[i] = nil end |
|
253 | Wildbreath-135052 | f.need:SetText(0) |
|
254 | Wildbreath-135052 | f.greed:SetText(0) |
|
255 | Wildbreath-135052 | f.pass:SetText(0) |
|
256 | Wildbreath-135052 | f.disenchant:SetText(0) |
|
257 | Wildbreath-135052 | ||
258 | Wildbreath-135052 | local texture, name, count, quality, bop, canNeed, canGreed, canDisenchant = GetLootRollItemInfo(rollid) |
|
259 | Wildbreath-135052 | f.button:SetNormalTexture(texture) |
|
260 | Wildbreath-135052 | f.button.link = GetLootRollItemLink(rollid) |
|
261 | Wildbreath-135052 | ||
262 | Wildbreath-135052 | if canNeed then f.needbutt:Enable() else f.needbutt:Disable() end |
|
263 | Wildbreath-135052 | if canGreed then f.greedbutt:Enable() else f.greedbutt:Disable() end |
|
264 | Wildbreath-135052 | if canDisenchant then f.disenchantbutt:Enable() else f.disenchantbutt:Disable() end |
|
265 | Wildbreath-135052 | SetDesaturation(f.needbutt:GetNormalTexture(), not canNeed) |
|
266 | Wildbreath-135052 | SetDesaturation(f.greedbutt:GetNormalTexture(), not canGreed) |
|
267 | Wildbreath-135052 | SetDesaturation(f.disenchantbutt:GetNormalTexture(), not canDisenchant) |
|
268 | Wildbreath-135052 | ||
269 | Wildbreath-135052 | ||
270 | Wildbreath-135052 | f.fsbind:SetText(bop and "BoP" or "BoE") |
|
271 | Wildbreath-135052 | f.fsbind:SetVertexColor(bop and 1 or .3, bop and .3 or 1, bop and .1 or .3) |
|
272 | Wildbreath-135052 | ||
273 | Wildbreath-135052 | local color = ITEM_QUALITY_COLORS[quality] |
|
274 | Wildbreath-135052 | f.fsloot:SetVertexColor(color.r, color.g, color.b) |
|
275 | Wildbreath-135052 | f.fsloot:SetText(name) |
|
276 | Wildbreath-135052 | ||
277 | Wildbreath-135052 | f:SetBackdropBorderColor(color.r, color.g, color.b, 1) |
|
278 | Wildbreath-135052 | f.buttonborder:SetBackdropBorderColor(color.r, color.g, color.b, 1) |
|
279 | Wildbreath-135052 | f.status:SetStatusBarColor(color.r, color.g, color.b, .7) |
|
280 | Wildbreath-135052 | ||
281 | Wildbreath-135052 | f.status:SetMinMaxValues(0, time) |
|
282 | Wildbreath-135052 | f.status:SetValue(time) |
|
283 | Wildbreath-135052 | ||
284 | Wildbreath-135052 | f:SetPoint("CENTER", WorldFrame, "CENTER") |
|
285 | Wildbreath-135052 | f:Show() |
|
286 | Wildbreath-135052 | end |
|
287 | Wildbreath-135052 | ||
288 | Wildbreath-135052 | ||
289 | Wildbreath-135052 | local function ParseRollChoice(msg) |
|
290 | Wildbreath-135052 | for i,v in pairs(ns.rollpairs) do |
|
291 | Wildbreath-135052 | local _, _, playername, itemname = string.find(msg, i) |
|
292 | Wildbreath-135052 | if playername and itemname and playername ~= "Everyone" then return playername, itemname, v end |
|
293 | Wildbreath-135052 | end |
|
294 | Wildbreath-135052 | end |
|
295 | Wildbreath-135052 | ||
296 | Wildbreath-135052 | ||
297 | Wildbreath-135052 | local in_soviet_russia = (GetLocale() == "ruRU") |
|
298 | Wildbreath-135052 | local function CHAT_MSG_LOOT(msg) |
|
299 | Wildbreath-135052 | local playername, itemname, rolltype = ParseRollChoice(msg) |
|
300 | Wildbreath-135052 | if playername and itemname and rolltype then |
|
301 | Wildbreath-135052 | if in_soviet_russia and rolltype ~= "pass" then itemname, playername = playername, itemname end |
|
302 | Wildbreath-135052 | for _,f in ipairs(frames) do |
|
303 | Wildbreath-135052 | if f.rollid and f.button.link == itemname and not f.rolls[playername] then |
|
304 | Wildbreath-135052 | f.rolls[playername] = rolltype |
|
305 | Wildbreath-135052 | f[rolltype]:SetText(tonumber(f[rolltype]:GetText()) + 1) |
|
306 | Wildbreath-135052 | return |
|
307 | Wildbreath-135052 | end |
|
308 | Wildbreath-135052 | end |
|
309 | Wildbreath-135052 | end |
|
310 | Wildbreath-135052 | end |
|
311 | Wildbreath-135052 | ||
312 | Wildbreath-135052 | ||
313 | Wildbreath-135052 | anchor:RegisterEvent("ADDON_LOADED") |
|
314 | Wildbreath-135052 | anchor:SetScript("OnEvent", function(frame, event, addon) |
|
315 | Wildbreath-135052 | if addon ~= "teksLoot" then return end |
|
316 | Wildbreath-135052 | ||
317 | Wildbreath-135052 | anchor:UnregisterEvent("ADDON_LOADED") |
|
318 | Wildbreath-135052 | anchor:RegisterEvent("START_LOOT_ROLL") |
|
319 | Wildbreath-135052 | anchor:RegisterEvent("CHAT_MSG_LOOT") |
|
320 | Wildbreath-135052 | UIParent:UnregisterEvent("START_LOOT_ROLL") |
|
321 | Wildbreath-135052 | UIParent:UnregisterEvent("CANCEL_LOOT_ROLL") |
|
322 | Wildbreath-135052 | ||
323 | Wildbreath-135052 | anchor:SetScript("OnEvent", function(frame, event, ...) if event == "CHAT_MSG_LOOT" then return CHAT_MSG_LOOT(...) else return START_LOOT_ROLL(...) end end) |
|
324 | Wildbreath-135052 | ||
325 | Wildbreath-135052 | ||
326 | Wildbreath-135052 | if not fdb then fdb = {} end |
|
327 | Wildbreath-135052 | anchor.db = fdb |
|
328 | Wildbreath-135052 | anchor:SetPoint("CENTER", UIParent, anchor.db.x and "BOTTOMLEFT" or "BOTTOM", anchor.db.x or 0, anchor.db.y or 221) |
|
329 | Wildbreath-135052 | end) |
|
330 | Wildbreath-135052 | ||
331 | Wildbreath-135052 | ||
332 | Wildbreath-135052 | SlashCmdList["TEKSLOOT"] = function() if anchor:IsVisible() then anchor:Hide() else anchor:Show() end end |
|
333 | Wildbreath-135052 | SLASH_TEKSLOOT1 = "/teksloot" |