vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Name: Babble-Class-2.0 |
||
3 | Revision: $Rev: 8339 $ |
||
4 | Author(s): ckknight (ckknight@gmail.com) |
||
5 | Website: http://ckknight.wowinterface.com/ |
||
6 | Documentation: http://wiki.wowace.com/index.php/Babble-Class-2.0 |
||
7 | SVN: http://svn.wowace.com/root/trunk/BabbleLib/Babble-Class-2.0 |
||
8 | Description: A library to provide localizations for classes. |
||
9 | Dependencies: AceLibrary, AceLocale-2.0 |
||
10 | ]] |
||
11 | |||
12 | local MAJOR_VERSION = "Babble-Class-2.0" |
||
13 | local MINOR_VERSION = "$Revision: 8339 $" |
||
14 | |||
15 | if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end |
||
16 | if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end |
||
17 | |||
18 | if not AceLibrary:HasInstance("AceLocale-2.0") then error(MAJOR_VERSION .. " requires AceLocale-2.0") end |
||
19 | |||
20 | local BabbleClass = AceLibrary("AceLocale-2.0"):new(MAJOR_VERSION) |
||
21 | |||
22 | -- uncomment below for debug information |
||
23 | -- BabbleClass:EnableDebugging() |
||
24 | |||
25 | BabbleClass:RegisterTranslations("enUS", function() |
||
26 | return { |
||
27 | ["Warlock"] = "Warlock", |
||
28 | ["Warrior"] = "Warrior", |
||
29 | ["Hunter"] = "Hunter", |
||
30 | ["Mage"] = "Mage", |
||
31 | ["Priest"] = "Priest", |
||
32 | ["Druid"] = "Druid", |
||
33 | ["Paladin"] = "Paladin", |
||
34 | ["Shaman"] = "Shaman", |
||
35 | ["Rogue"] = "Rogue", |
||
36 | } |
||
37 | end) |
||
38 | |||
39 | BabbleClass:RegisterTranslations("deDE", function() |
||
40 | return { |
||
41 | ["Warlock"] = "Hexenmeister", |
||
42 | ["Warrior"] = "Krieger", |
||
43 | ["Hunter"] = "Jäger", |
||
44 | ["Mage"] = "Magier", |
||
45 | ["Priest"] = "Priester", |
||
46 | ["Druid"] = "Druide", |
||
47 | ["Paladin"] = "Paladin", |
||
48 | ["Shaman"] = "Schamane", |
||
49 | ["Rogue"] = "Schurke", |
||
50 | } |
||
51 | end) |
||
52 | |||
53 | BabbleClass:RegisterTranslations("frFR", function() |
||
54 | return { |
||
55 | ["Warlock"] = "Démoniste", |
||
56 | ["Warrior"] = "Guerrier", |
||
57 | ["Hunter"] = "Chasseur", |
||
58 | ["Mage"] = "Mage", |
||
59 | ["Priest"] = "Prêtre", |
||
60 | ["Druid"] = "Druide", |
||
61 | ["Paladin"] = "Paladin", |
||
62 | ["Shaman"] = "Chaman", |
||
63 | ["Rogue"] = "Voleur", |
||
64 | } |
||
65 | end) |
||
66 | |||
67 | BabbleClass:RegisterTranslations("zhCN", function() |
||
68 | return { |
||
69 | ["Warlock"] = "术士", |
||
70 | ["Warrior"] = "战士", |
||
71 | ["Hunter"] = "猎人", |
||
72 | ["Mage"] = "法师", |
||
73 | ["Priest"] = "牧师", |
||
74 | ["Druid"] = "德鲁伊", |
||
75 | ["Paladin"] = "圣骑士", |
||
76 | ["Shaman"] = "萨满祭祀", |
||
77 | ["Rogue"] = "盗贼", |
||
78 | } |
||
79 | end) |
||
80 | |||
81 | BabbleClass:RegisterTranslations("koKR", function() |
||
82 | return { |
||
83 | ["Warlock"] = "흑마법사", |
||
84 | ["Warrior"] = "전사", |
||
85 | ["Hunter"] = "사냥꾼", |
||
86 | ["Mage"] = "마법사", |
||
87 | ["Priest"] = "사제", |
||
88 | ["Druid"] = "드루이드", |
||
89 | ["Paladin"] = "성기사", |
||
90 | ["Shaman"] = "주술사", |
||
91 | ["Rogue"] = "도적", |
||
92 | } |
||
93 | end) |
||
94 | |||
95 | BabbleClass:Debug() |
||
96 | BabbleClass:SetStrictness(true) |
||
97 | |||
98 | function BabbleClass:GetColor(class) |
||
99 | self:argCheck(class, 2, "string") |
||
100 | if string.find(class, "^[A-Z]*$") then |
||
101 | class = string.upper(strsub(class, 1, 1)) .. string.lower(strsub(class, 2)) |
||
102 | elseif self:HasReverseTranslation(class) then |
||
103 | class = self:GetReverseTranslation(class) |
||
104 | end |
||
105 | if class == "Warlock" then |
||
106 | return RAID_CLASS_COLORS["WARLOCK"].r, RAID_CLASS_COLORS["WARLOCK"].g, RAID_CLASS_COLORS["WARLOCK"].b |
||
107 | elseif class == "Warrior" then |
||
108 | return RAID_CLASS_COLORS["WARRIOR"].r, RAID_CLASS_COLORS["WARRIOR"].g, RAID_CLASS_COLORS["WARRIOR"].b |
||
109 | elseif class == "Hunter" then |
||
110 | return RAID_CLASS_COLORS["HUNTER"].r, RAID_CLASS_COLORS["HUNTER"].g, RAID_CLASS_COLORS["HUNTER"].b |
||
111 | elseif class == "Mage" then |
||
112 | return RAID_CLASS_COLORS["MAGE"].r, RAID_CLASS_COLORS["MAGE"].g, RAID_CLASS_COLORS["MAGE"].b |
||
113 | elseif class == "Priest" then |
||
114 | return RAID_CLASS_COLORS["PRIEST"].r, RAID_CLASS_COLORS["PRIEST"].g, RAID_CLASS_COLORS["PRIEST"].b |
||
115 | elseif class == "Druid" then |
||
116 | return RAID_CLASS_COLORS["DRUID"].r, RAID_CLASS_COLORS["DRUID"].g, RAID_CLASS_COLORS["DRUID"].b |
||
117 | elseif class == "Paladin" then |
||
118 | return RAID_CLASS_COLORS["PALADIN"].r, RAID_CLASS_COLORS["PALADIN"].g, RAID_CLASS_COLORS["PALADIN"].b |
||
119 | elseif class == "Shaman" then |
||
120 | return RAID_CLASS_COLORS["SHAMAN"].r, RAID_CLASS_COLORS["SHAMAN"].g, RAID_CLASS_COLORS["SHAMAN"].b |
||
121 | elseif class == "Rogue" then |
||
122 | return RAID_CLASS_COLORS["ROGUE"].r, RAID_CLASS_COLORS["ROGUE"].g, RAID_CLASS_COLORS["ROGUE"].b |
||
123 | end |
||
124 | return 0.63, 0.63, 0.63 |
||
125 | end |
||
126 | |||
127 | function BabbleClass:GetHexColor(class) |
||
128 | self:argCheck(class, 2, "string") |
||
129 | local r, g, b = self:GetColor(class) |
||
130 | return string.format("%02x%02x%02x", r * 255, g * 255, b * 255) |
||
131 | end |
||
132 | |||
133 | AceLibrary:Register(BabbleClass, MAJOR_VERSION, MINOR_VERSION) |
||
134 | BabbleClass = nil |