Automated update from: http://smariot.no-ip.org/translate
[QuestHelper.git] / collect_spec.lua
blob18a493dfeaaef4f3ed91ba4602e1174014eba354
1 QuestHelper_File["collect_spec.lua"] = "Development Version"
2 QuestHelper_Loadtime["collect_spec.lua"] = GetTime()
4 local Bitstream
6 local classlookup = {
7 ["DEATHKNIGHT"] = "K",
8 ["DRUID"] = "D",
9 ["HUNTER"] = "H",
10 ["MAGE"] = "M",
11 ["PALADIN"] = "N",
12 ["PRIEST"] = "P",
13 ["ROGUE"] = "R",
14 ["SHAMAN"] = "S",
15 ["WARLOCK"] = "L",
16 ["WARRIOR"] = "W"
19 local racelookup = {
20 ["Draenei"] = "R",
21 ["Gnome"] = "G",
22 ["Dwarf"] = "D",
23 ["Human"] = "H",
24 ["NightElf"] = "E",
26 ["Orc"] = "O",
27 ["Troll"] = "T",
28 ["Tauren"] = "N",
29 ["Undead"] = "U",
30 ["BloodElf"] = "B",
31 -- lol i spelled nub
34 local function GetSpecBolus()
35 local _, id = UnitClass("player")
36 local level = UnitLevel("player")
37 local _, race = UnitRace("player")
39 assert(racelookup[race])
41 local bso = Bitstream.Output(8)
43 for t = 1, GetNumTalentTabs() do -- come on. Is this ever not going to be 3? Seriously?
44 for ta = 1, GetNumTalents(t) do
45 local _, _, _, _, rank, _ = GetTalentInfo(t, ta)
46 bso:append(rank, 3)
47 end
48 bso:append(6, 3) -- no 6-point talents, so we use this as an end-of-tree market
49 end
50 bso:append(7, 3) -- end-of-spec! because of *all of those 4-tree classes*
52 return string.format("2%s%s%02d", classlookup[id], racelookup[race] or "", level) .. bso:finish()
53 end
55 function QH_Collect_Spec_Init(_, API)
56 Bitstream = API.Utility_Bitstream
57 QuestHelper: Assert(Bitstream)
59 API.Utility_GetSpecBolus = GetSpecBolus
60 end