vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local locals = KC_ITEMS_LOCALS.modules.broker |
2 | local map = KC_ITEMS_LOCALS.maps.enabled |
||
3 | |||
4 | function KC_Broker:SetCut(amount) |
||
5 | if (strfind(amount, "%%")) then |
||
6 | local _, _, number = strfind(amount, "(%d+)%%") |
||
7 | self:SetOpt(self.optPath, "cut", number / 100) |
||
8 | elseif (tonumber(amount)) then |
||
9 | local number = tonumber(amount) |
||
10 | _ = number > 0 and self:SetOpt(self.optPath, "cut", number) |
||
11 | else |
||
12 | self:Msg(locals.errors.amount) |
||
13 | return |
||
14 | end |
||
15 | |||
16 | self:Result(locals.msgs.amount, amount); |
||
17 | end |
||
18 | |||
19 | function KC_Broker:TogAutofill() |
||
20 | local status = self:TogOpt(self.optPath, "autofill"); |
||
21 | |||
22 | if (AuctionFrame and status) then |
||
23 | self:RegisterEvent("NEW_AUCTION_UPDATE", "AutoFill") |
||
24 | self:Hook("StartAuction", "Remember") |
||
25 | elseif (AuctionFrame) then |
||
26 | self:UnregisterEvent("NEW_AUCTION_UPDATE") |
||
27 | self:Unhook("StartAuction") |
||
28 | AuctionsItemText:SetText(self.AuctionsItemText) |
||
29 | end |
||
30 | |||
31 | self:Result(locals.msgs.autofill, status, map); |
||
32 | end |
||
33 | |||
34 | function KC_Broker:RememberDuration() |
||
35 | local status = self:TogOpt(self.optPath, "remduration") |
||
36 | |||
37 | if (AuctionFrame and status) then |
||
38 | self:Hook("AuctionsRadioButton_OnClick", "UpdateDuration") |
||
39 | AuctionsRadioButton_OnClick(self:GetOpt(self.optPath, "duration")) |
||
40 | elseif (AuctionFrame) then |
||
41 | self:Unhook("AuctionsRadioButton_OnClick") |
||
42 | end |
||
43 | |||
44 | self:Result(locals.msgs.remduration, status, map) |
||
45 | end |
||
46 | |||
47 | function KC_Broker:SkipMem() |
||
48 | local status = self:TogOpt(self.optPath, "skipmem") |
||
49 | self:Result(locals.msgs.skipmem, status, map) |
||
50 | end |
||
51 | |||
52 | function KC_Broker:SetMode(mode) |
||
53 | mode = self.common:StrMixed(mode) |
||
54 | |||
55 | if (strfind(locals.modes.all, mode)) then |
||
56 | self:SetOpt(self.optPath, "fillmode", ace.trim(mode)) |
||
57 | self:Result(locals.msgs.mode, mode); |
||
58 | else |
||
59 | self:Msg(locals.errors.mode) |
||
60 | end |
||
61 | end |
||
62 | |||
63 | function KC_Broker:AHColor() |
||
64 | local status = self:TogOpt(self.optPath, "ahcolor") |
||
65 | |||
66 | if (AuctionFrame and status) then |
||
67 | self:Hook("AuctionFrameBrowse_Update") |
||
68 | self:UpdateGuide() |
||
69 | BrowseTitle:SetPoint("TOP",35 , -18) |
||
70 | BrowseTitle:SetText( format("%s - %s", self.BrowseTitle or BrowseTitle:GetText(), locals.labels.guide)) |
||
71 | elseif (AuctionFrame) then |
||
72 | self:Unhook("AuctionFrameBrowse_Update") |
||
73 | BrowseTitle:SetText(self.BrowseTitle) |
||
74 | end |
||
75 | |||
76 | self:Result(locals.msgs.ahcolor, status, map) |
||
77 | end |
||
78 | |||
79 | function KC_Broker:SetAHColor(color, name) |
||
80 | local r, g, b = self.common:Explode(color, " ") |
||
81 | if (not r or not g or not b) then self:Msg(locals.errors.color) return; end |
||
82 | |||
83 | r = self.common:Round(r / 255, 1) |
||
84 | g = self.common:Round(g / 255, 1) |
||
85 | b = self.common:Round(b / 255, 1) |
||
86 | |||
87 | self:SetOpt(self.optPath, name, format("%s!%s!%s", r, g, b)) |
||
88 | self:UpdateGuide() |
||
89 | _ = BrowseTitle and BrowseTitle:SetText( format("%s - %s", self.BrowseTitle, locals.labels.guide)) |
||
90 | |||
91 | local c = {self.common:Explode(self:GetOpt(self.optPath, name), "!")} |
||
92 | local hex = self.common:GetHexCode(c[1], c[2], c[3], true) |
||
93 | |||
94 | self:Msg(format(locals.msgs.colorcode, name, hex)) |
||
95 | end |
||
96 | |||
97 | function KC_Broker:SetKnownColor(color) |
||
98 | self:SetAHColor(color, "knownColor") |
||
99 | end |
||
100 | |||
101 | function KC_Broker:SetVendorColor(color) |
||
102 | self:SetAHColor(color, "sellColor") |
||
103 | end |
||
104 | |||
105 | function KC_Broker:SetBuyColor(color) |
||
106 | self:SetAHColor(color, "buyColor") |
||
107 | end |
||
108 | |||
109 | function KC_Broker:SetMinColor(color) |
||
110 | self:SetAHColor(color, "minColor") |
||
111 | end |