public
Description: WoW Addon - Prospecting and Disenchanting Aide
Homepage: http://www.tekkub.net
Clone URL: git://github.com/tekkub/panda.git
Click here to lend your support to: panda and make a donation at www.pledgie.com !
tekkub (author)
Fri Jun 27 20:44:44 -0700 2008
commit  0549be7ae2f3eb24cbe1079fdd19372e4586c7df
tree    4e2431039d3768d1744f442524013ae08fa1a1b2
parent  21e00a5520c69bc10efc9f3f93e7802b4b6043a5
panda / Panda.lua
100644 104 lines (84 sloc) 3.667 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

-------------------------------
-- Addon Namespace --
-------------------------------
 
Panda = DongleStub("Dongle-1.0"):New("Panda")
if tekDebug then Panda:EnableDebug(1, tekDebug:GetFrame("Panda")) end
 
 
function Panda:Initialize()
  local _, title = GetAddOnInfo("Panda")
  local author, version = GetAddOnMetadata("Panda", "Author"), GetAddOnMetadata("Panda", "Version")
  local oh = LibStub("OptionHouse-1.1"):RegisterAddOn("Panda", title, author, version)
  oh:RegisterCategory("Disenchanting", self, "CreateDisenchantingPanel")
  oh:RegisterCategory("Prospecting", self, "CreateProspectingPanel")
  oh:RegisterCategory("Prices", self, "CreateDisenchantingPricePanel")
  oh:RegisterCategory("Gem Cutting", self, "CreateCutGreenBluePanel")
  oh:RegisterCategory("Gem Cutting (Meta)", self, "CreateCutMetaPanel")
  oh:RegisterCategory("Gem Cutting (Epic)", self, "CreateCutPurplePanel")
 
  self:RegisterEvent("LOOT_OPENED")
end
 
 
function Panda:Enable()
  local i, spellname = 1
  repeat
    spellname = GetSpellName(i, BOOKTYPE_SPELL)
    if spellname == "Disenchant" then self.canDisenchant = true end
    if spellname == "Prospecting" then self.canProspect = true end
    if spellname == "Jewelcrafting" then self.canJC = true end
    i = i + 1
  until (self.canDisenchant and self.canProspect and self.canJC) or not spellname
 
  self:RegisterEvent("ADDON_LOADED")
  self:RegisterEvent("TRADE_SKILL_SHOW")
end
 
 
------------------------------
-- Util functions --
------------------------------
 
function Panda:HideTooltip() GameTooltip:Hide() end
function Panda:ShowTooltip()
  if not self.link then return end
 
  GameTooltip:SetOwner(self, "ANCHOR_NONE")
  GameTooltip:SetPoint("TOPLEFT", self, "TOPRIGHT")
  GameTooltip:SetHyperlink(self.link)
end
 
 
function Panda.GS(cash)
  if not cash then return end
  if cash > 999999 then return "|cffffd700".. floor(cash/10000) end
 
  cash = cash/100
  local s = floor(cash%100)
  local g = floor(cash/100)
  if g > 0 then return string.format("|cffffd700%d.|cffc7c7cf%02d", g, s)
  else return string.format("|cffc7c7cf%d", s) end
end
 
 
function Panda.G(cash)
  if not cash then return end
  return "|cffffd700".. floor(cash/10000)
end
 
 
-------------------------
-- Constants --
-------------------------
 
Panda.BC_GREEN_GEMS = {24478, 23077, 21929, 23112, 23079, 23117, 23107}
Panda.BC_BLUE_GEMS = {24479, 23436, 23439, 23440, 23437, 23438, 23441}
Panda.BC_EPIC_GEMS = {32227, 32231, 32229, 32249, 32228, 32230}
Panda.BC_META_GEMS = {25867, 25868}
Panda.CUTS = {
  [23077] = {23094, 23095, 23097, 23096, 28595},
  [21929] = {23098, 23099, 23100, 23101, 31866, 31869},
  [23112] = {23113, 23114, 23115, 23116, 28290, 31860},
  [23079] = {23103, 23104, 23105, 23106},
  [23117] = {23118, 23119, 23120, 23121},
  [23107] = {23108, 23109, 23110, 23111, 31862, 31864},
  [23436] = {24027, 24028, 24029, 24030, 24031, 24032, 24036},
  [23439] = {24058, 24059, 24060, 24061, 31867, 31868, 35316},
  [23440] = {24047, 24048, 24050, 24051, 24052, 24053, 31861, 35315},
  [23437] = {24062, 24065, 24066, 24067, 33782, 35318},
  [23438] = {24033, 24035, 24037, 24039},
  [23441] = {24054, 24055, 24056, 24057, 31863, 31865, 35707},
  [24478] = {32833},
  [24479] = {32836},
  [25867] = {25896, 25897, 25898, 25899, 25901, 32409, 35501},
  [25868] = {25890, 25893, 25894, 25895, 32410, 34220, 35503},
  [32227] = {32193, 32194, 32195, 32196, 32197, 32198, 32199},
  [32231] = {32217, 32218, 32219, 32220, 32221, 32222, 35760},
  [32229] = {32204, 32205, 32206, 32207, 32208, 32209, 32210, 35761},
  [32249] = {32223, 32224, 32225, 32226, 35758, 35759},
  [32228] = {32200, 32201, 32202, 32203},
  [32230] = {32211, 32212, 32213, 32214, 32215, 32216},
}