vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2 assert( oRA, "oRA not found!")
3  
4 ------------------------------
5 -- Are you local? --
6 ------------------------------
7  
8 local L = AceLibrary("AceLocale-2.2"):new("oRAPDurability")
9 local G = AceLibrary("Gratuity-2.0")
10  
11 ----------------------------
12 -- Localization --
13 ----------------------------
14  
15 L:RegisterTranslations("enUS", function() return {
16 ["durability"] = true,
17 ["Participant/Durability"] = true,
18 ["Options for durability checks."] = true,
19 ["durabilityparticipant"] = true,
20  
21 } end )
22  
23 L:RegisterTranslations("koKR", function() return {
24  
25 ["Participant/Durability"] = "부분/내구도",
26 ["Options for durability checks."] = "내구도 설정",
27  
28 } end )
29  
30 L:RegisterTranslations("zhCN", function() return {
31 ["durability"] = "耐久度",
32 ["Participant/Durability"] = "Participant/Durability",
33 ["Options for durability checks."] = "耐久度检查选项",
34 ["durabilityparticipant"] = "durabilityparticipant",
35  
36 } end )
37  
38 L:RegisterTranslations("zhTW", function() return {
39 ["durability"] = "耐久度",
40 ["Participant/Durability"] = "隊員/耐久度",
41 ["Options for durability checks."] = "耐久度檢查選項",
42 ["durabilityparticipant"] = "durabilityparticipant",
43  
44 } end )
45  
46 L:RegisterTranslations("frFR", function() return {
47 --["durability"] = true,
48 ["Participant/Durability"] = "Participant/Durabilit\195\169",
49 ["Options for durability checks."] = "Options concernant les v\195\169rifications des durabilit\195\169s.",
50 --["durabilityparticipant"] = true,
51 } end )
52  
53 ----------------------------------
54 -- Module Declaration --
55 ----------------------------------
56  
57 oRAPDurability = oRA:NewModule(L["durabilityparticipant"])
58 oRAPDurability.defaults = {
59 }
60 oRAPDurability.participant = true
61 oRAPDurability.name = L["Participant/Durability"]
62 -- oRAPDurability.consoleCmd = L["durability"]
63 -- oRAPDurability.consoleOptions = {
64 -- type = "group",
65 -- desc = L["Options for durability checks."],
66 -- args = {
67 -- }
68 -- }
69  
70 ------------------------------
71 -- Initialization --
72 ------------------------------
73  
74 function oRAPDurability:OnEnable()
75 self:RegisterCheck("DURC", "oRA_DurabilityCheck")
76 end
77  
78 function oRAPDurability:OnDisable()
79 self:UnregisterAllEvents()
80 end
81  
82 ------------------------------
83 -- Event Handlers --
84 ------------------------------
85  
86 function oRAPDurability:oRA_DurabilityCheck(msg, author)
87 if not self:IsValidRequest(author) then return end
88 local cur, max, broken = self:GetDurability()
89 self:SendMessage(string.format("DUR %s %s %s %s", cur, max, broken, author))
90 end
91  
92 ------------------------------
93 -- Utility Functions --
94 ------------------------------
95  
96 function oRAPDurability:GetDurability()
97 local cur, max, broken = 0, 0, 0
98 for i=1,18 do
99 G:Erase()
100 G:SetInventoryItem("player", i)
101 local imin, imax = G:FindDeformat(DURABILITY_TEMPLATE)
102 if imin and imax then
103 imin, imax = tonumber(imin), tonumber(imax)
104 if imin == 0 then broken = broken + 1 end
105 cur = cur + imin
106 max = max + imax
107 end
108  
109 end
110 return cur, max, broken
111 end