vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 MINING_NODE_LEVEL = {
2 ["Copper Vein"] = 1,
3 ["Tin Vein"] = 65,
4 ["Incendicite"] = 65,
5 ["Silver Vein"] = 75,
6 ["Iron Deposit"] = 125,
7 ["Indurium Deposit"] = 150,
8 ["Lesser Bloodstone Deposit"] = 155,
9 ["Gold Vein"] = 155,
10 ["Mithril Vein"] = 175,
11 ["Truesilver Vein"] = 230,
12 ["Small Thorium Vein"] = 245,
13 ["Rich Thorium Vein"] = 275,
14 ["Ooze Covered Rich Thorium Vein"] = 275,
15 ["Hakkari Thorium Vein"] = 250,
16 ["Dark Iron Deposit"] = 230,
17 ["Small Obsidian Chunk"] = 305,
18 ["Large Obsidian Chunk"] = 305
19 }
20  
21 HERBALISM_NODE_LEVEL = {
22 ["Peacebloom"] = 1,
23 ["Silverleaf"] = 1,
24 ["Earthroot"] = 15,
25 ["Mageroyal"] = 50,
26 ["Briarthorn"] = 70,
27 ["Stranglekelp"] = 85,
28 ["Bruiseweed"] = 100,
29 ["Wild Steelbloom"] = 115,
30 ["Grave Moss"] = 120,
31 ["Kingsblood"] = 125,
32 ["Liferoot"] = 150,
33 ["Fadeleaf"] = 160,
34 ["Goldthorn"] = 170,
35 ["Khadgar's Whisker"] = 185,
36 ["Wintersbite"] = 195,
37 ["Firebloom"] = 205,
38 ["Purple Lotus"] = 210,
39 ["Arthas' Tears"] = 220,
40 ["Sungrass"] = 230,
41 ["Blindweed"] = 235,
42 ["Ghost Mushroom"] = 245,
43 ["Gromsblood"] = 250,
44 ["Golden Sansam"] = 260,
45 ["Dreamfoil"] = 270,
46 ["Mountain Silversage"] = 280,
47 ["Plaguebloom"] = 285,
48 ["Icecap"] = 290,
49 ["Black Lotus"] = 300
50 }
51  
52 function ProfessionLevel_OnShow()
53 local parentFrame = this:GetParent();
54 local parentFrameName = parentFrame:GetName();
55 local itemName = getglobal(parentFrameName.."TextLeft1"):GetText();
56  
57 if(MINING_NODE_LEVEL[itemName]) then
58 ProfessionLevel_AddMiningInfo(parentFrame, itemName);
59 end
60  
61 if(HERBALISM_NODE_LEVEL[itemName]) then
62 ProfessionLevel_AddHerbalismInfo(parentFrame, itemName);
63 end
64  
65 if(ProfessionLevel_IsSkinnable()) then
66 ProfessionLevel_AddSkinningInfo(parentFrame, itemName);
67 end
68 end
69  
70 function ProfessionLevel_GetProfessionLevel(skill)
71 local numskills = GetNumSkillLines();
72 for c = 1, numskills do
73 local skillname, _, _, skillrank = GetSkillLineInfo(c);
74 if(skillname == skill) then
75 return skillrank;
76 end
77 end
78 return 0;
79 end
80  
81 function ProfessionLevel_AddMiningInfo(frame, itemname)
82 if(MINING_NODE_LEVEL[itemname]) then
83 local levelreq = MINING_NODE_LEVEL[itemname];
84 local MiningLevel = ProfessionLevel_GetProfessionLevel("Mining");
85 if(levelreq <= MiningLevel) then
86 -- High enough
87 frame:AddLine("Mining("..levelreq..") needed",0,1,0);
88 else
89 -- Not high enough
90 frame:AddLine("Mining("..levelreq..") needed.",1,0,0);
91 end
92 frame:SetHeight(frame:GetHeight() + 14);
93 frame:SetWidth(190);
94 end
95 end
96  
97 function ProfessionLevel_AddHerbalismInfo(frame, itemname)
98 if(HERBALISM_NODE_LEVEL[itemname]) then
99 local levelreq = HERBALISM_NODE_LEVEL[itemname];
100 local HerbalismLevel = ProfessionLevel_GetProfessionLevel("Herbalism");
101 if(levelreq <= HerbalismLevel) then
102 -- High enough
103 frame:AddLine("Herbalism("..levelreq..") needed.",0,1,0);
104 else
105 -- Not high enough
106 frame:AddLine("Herbalism("..levelreq..") needed.",1,0,0);
107 end
108 frame:SetHeight(frame:GetHeight() + 14);
109 frame:SetWidth(190);
110 end
111 end
112  
113 function ProfessionLevel_AddSkinningInfo(frame, itemname)
114 local levelreq = 5 * UnitLevel("Mouseover");
115 if(levelreq < 100) then levelreq = 1; end
116 if(levelreq > 0) then
117 local SkinningLevel= ProfessionLevel_GetProfessionLevel("Skinning");
118 if(levelreq <= SkinningLevel) then
119 -- High enough
120 frame:AddLine("Skinning("..levelreq..") needed.",0,1,0);
121 else
122 -- Not high enough
123 frame:AddLine("Skinning("..levelreq..") needed.",1,0,0);
124 end
125 frame:SetHeight(frame:GetHeight() + 14);
126 frame:SetWidth(190);
127 end
128 end
129  
130 function ProfessionLevel_IsSkinnable()
131 for c = 1, GameTooltip:NumLines() do
132 local line = getglobal("GameTooltipTextLeft"..c);
133 if(line and line:GetText() == "Skinnable") then return true; end
134 end
135 return false;
136 end
137