vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local locals = KC_ITEMS_LOCALS.modules.common |
2 | |||
3 | local frame = AceGUI:new() |
||
4 | local config = { |
||
5 | name = "KC_ItemsStatsFrame", |
||
6 | type = ACEGUI_BASIC_DIALOG, |
||
7 | backdrop = "none", |
||
8 | width = 175, |
||
9 | height = 65, |
||
10 | OnShow = "OnShow", |
||
11 | elements = { |
||
12 | P = { |
||
13 | type = ACEGUI_OPTIONSBOX, |
||
14 | title = "", |
||
15 | width = 175, |
||
16 | height = 65, |
||
17 | anchors = { |
||
18 | topleft = {xOffset = 0, yOffset = 0} |
||
19 | }, |
||
20 | elements = { |
||
21 | Line1 = { |
||
22 | type = ACEGUI_FONTSTRING, |
||
23 | value = "", |
||
24 | anchors = { |
||
25 | clear = TRUE, |
||
26 | topleft = {relTo = "KC_ItemsStatsFrameP", relPoint= "topleft", xOffset = 10, yOffset = -9}, |
||
27 | }, |
||
28 | }, |
||
29 | Line2 = { |
||
30 | type = ACEGUI_FONTSTRING, |
||
31 | value = "", |
||
32 | anchors = { |
||
33 | clear = TRUE, |
||
34 | topleft = {relTo = "KC_ItemsStatsFramePLine1", relPoint= "bottomleft", xOffset = 0, yOffset = -3}, |
||
35 | }, |
||
36 | }, |
||
37 | Line3 = { |
||
38 | type = ACEGUI_FONTSTRING, |
||
39 | value = "", |
||
40 | anchors = { |
||
41 | clear = TRUE, |
||
42 | topleft = {relTo = "KC_ItemsStatsFramePLine2", relPoint= "bottomleft", xOffset = 0, yOffset = -3}, |
||
43 | }, |
||
44 | }, |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 | |||
50 | function frame:OnShow() |
||
51 | self:RefreshStats() |
||
52 | end |
||
53 | |||
54 | function frame:RefreshStats() |
||
55 | if (not self.P:IsVisible()) then return end |
||
56 | |||
57 | local sItemCount, sSubCount, sSellCount, sBuyCount, sSellPercent, sBuyPercent = self.app:Explode(self.app.app.db:get("stats"), ",") |
||
58 | if (type(sSellPercent) == "string") then return end |
||
59 | |||
60 | self.P.Line1:SetValue(format("Item Count: \t%s", sSubCount)) |
||
61 | self.P.Line2:SetValue(format("Sell Values: \t%s (%s%%)", floor(sSubCount * (sSellPercent/100)), sSellPercent)) |
||
62 | self.P.Line3:SetValue(format("Buy Values: \t%s (%s%%)", floor(sSubCount * (sBuyPercent/100)), sBuyPercent)) |
||
63 | |||
64 | local width = math.max(self.P.Line1:GetWidth(), self.P.Line3:GetWidth(), self.P.Line2:GetWidth()) |
||
65 | |||
66 | self:SetWidth(width + 20) |
||
67 | self.P:SetWidth(width + 20) |
||
68 | end |
||
69 | |||
70 | frame:Initialize(KC_Common, config) |
||
71 | KC_Common.frame = frame |