vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 ---------------------------------------------------
2 -- Caster Stats v0.9.5.1 by RMS
3 ---------------------------------------------------
4 --[[
5  
6 Adds a line to the stat section of the character frame below armor. This line can be
7 set to either show your total "+Spell Damage" or "+Healing" via the command line.
8 Like the other stats in the character screen it provides more information when you
9 mouse over it. The tooltip will display the totals for plus healing, spell damage,
10 all individual schools of damage, spell crit, spell to hit, mana regen etc...
11  
12 The information that is displayed is only additional stats provided by your gear.
13 If you do not have any of the the listed stats it will not be visible. Caster Stats
14 does not currently calculate crit, or mana regen from stats like int, spirit, or
15 base crit. It is only mean't to be a quick way of finding the bonuses you are
16 getting from your gear. I may implement more features in the future however.
17  
18 While there are other mods out there that can total these stats for you, I wanted
19 something that was more intune with the melee character stats. Something simple
20 yet informative.
21  
22 -Config
23 "/cstats" - Slash command for Caster Stats
24 "/cstats [damagetype]" - Allows you to choose the stat visible in the character screen. "damage" or "healing".
25  
26 -------------------------------------------------------------------------------------
27 v0.9.5.1
28 -- Now totals +damage to individual schools of magic as before
29  
30 v0.9.5
31 -- Updated for 1.10
32 -- Now uses Bonus Scanner (http://www.curse-gaming.com/mod.php?addid=2384) to find bonuses instead of reinventing the wheel each patch/new item stat with my own scanner. This also allows prevents FR DE localizations from needing to be created multiple times. Bonusscanner is included in the download.
33 -- Added detection for negative spell resist to target (not yet implemented by Bonus Scanner)
34 -- Relocated the stats to be inside the frame with other stats
35 -- As before Caster Stats is not visible if you are a Warrior/Rogue, but now in addition healing does not show if you are not a healing class
36 -- Added FE DE localization. Please report if they are functional as I reformatted previous submissions. Will need modified version for both for the negative resists either way.
37  
38 v0.9.4
39 -- Updated for 1.9
40 -- Change the comand line to /cstats to be compatible with "Combat Stats"
41 -- Mana regen now works again as wording was changed in 1.9
42 -- Wizard and Brilliant Oils are now detected
43  
44 v0.9.3
45 -- Sets are now correctly identified and set bonuses only counted once.
46 -- Now also totals health regeneration.
47 -- Added the Winter's Might enchant.
48  
49 v0.9.2
50 -- Updated mana regen and spell crit detection.
51  
52 v0.9.1
53 -- Now detects TankPoints and moves CasterStats to a new location if needed.
54 -- Fixed issues with +spell crit and +spell hit not showing under certain conditions.
55 -- Fixed issues where values weren't getting reset on rescan.
56  
57 ]]--
58  
59 reportThis = 0;
60  
61 local casterStats = {
62 stats = {};
63 statTypes = {
64 'HEAL', -- healing
65 'DMG', -- spell damage
66 'ARCANEDMG', -- arcane spell damage
67 'FIREDMG', -- fire spell damage
68 'FROSTDMG', -- frost spell damage
69 'HOLYDMG', -- holy spell damage
70 'NATUREDMG', -- nature spell damage
71 'SHADOWDMG', -- shadow spell damage
72 'SPELLCRIT', -- chance to crit with spells
73 'HOLYCRIT', -- chance to crit with holy spells
74 'HEALTHREG', -- health regeneration per 5 sec.
75 'MANAREG', -- mana regeneration per 5 sec.
76 'SPELLTOHIT', -- spell chance to hit
77 'NEGRES' -- target resist decrease
78 };
79 };
80  
81 function CS_OnLoad()
82 -- Register the command prompt command
83 SLASH_CSTATS1 = "/cstats";
84 SlashCmdList["CSTATS"] = CS_CommandHandler;
85  
86 -- Add negative resist functionality to BONUS SCANNER
87 table.insert(BONUSSCANNER_PATTERNS_PASSIVE, CS_BONUSSCANNER_ADD_NEGRES);
88 table.insert(BonusScanner.types, "NEGRES");
89  
90 -- Hook the Bonus Scanner function
91 BonusScanner_Update = UpdateCS;
92 end
93  
94  
95 -- Rescan the inventory
96 function UpdateCS()
97 local class;
98 _, class = UnitClass("player");
99  
100 -- Only update if the Character Frame is visible to the user
101 if (CharacterFrame:IsVisible() and class ~= "ROGUE" and class ~= "WARRIOR") then
102 -- Reacquire the stats information
103 for i, type in casterStats.statTypes do
104 casterStats.stats[type] = BonusScanner:GetBonus(type);
105 end
106  
107 if (ThereAreStats() or 1) then
108 SetFrameValues();
109 else
110 ClearFrameValues();
111 end
112 end
113 end
114  
115  
116 -- Setup and show the tooltip on mouse over
117 function CSFrame_OnEnter()
118 local class;
119 _, class = UnitClass("player");
120  
121 if (class ~= "ROGUE" and class ~= "WARRIOR") then
122 GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
123 GameTooltip:SetText("Caster Stats", 1, 1, 1);
124  
125 -- Loop through all the stats and add the ones that exist to the tooltip
126 for i, type in casterStats.statTypes do
127 if (casterStats.stats[type] ~= 0) then
128 if (string.find(type, ".+DMG")) then
129 GameTooltip:AddDoubleLine(CS_STAT_NAMES[type] .. ":", "(+" .. casterStats.stats[type] .. ") +" .. (casterStats.stats[type] + casterStats.stats['DMG']), NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 0, 1, 0);
130 -- Check for NEGRES TYPE.
131 elseif (string.find(type, "NEGRES")) then
132 GameTooltip:AddDoubleLine(CS_STAT_NAMES[type] .. ":", "-" .. casterStats.stats[type], NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 0, 1, 0);
133 -- Check for REGEN TYPE.
134 elseif (string.find(type, "REG")) then
135 GameTooltip:AddDoubleLine(CS_STAT_NAMES[type] .. ":", casterStats.stats[type] .. "/5s", NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 0, 1, 0);
136 -- Check for CRIT/HIT TYPE.
137 elseif (string.find(type, "CRIT") or string.find(type, "HIT")) then
138 GameTooltip:AddDoubleLine(CS_STAT_NAMES[type] .. ":", "+" .. casterStats.stats[type] .. "%", NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 0, 1, 0);
139 -- No special output
140 else
141 -- Check if it is the healing stat and only display it if it is a healing class
142 if (string.find(type, "HEAL")) then
143 if (class == "DRUID" or class == "PRIEST" or class == "PALADIN" or class == "SHAMAN") then
144 GameTooltip:AddDoubleLine(CS_STAT_NAMES[type] .. ":", "+" .. casterStats.stats[type], NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 0, 1, 0);
145 end
146 else
147 GameTooltip:AddDoubleLine(CS_STAT_NAMES[type] .. ":", "+" .. casterStats.stats[type], NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 0, 1, 0);
148 end
149 end
150 end
151 end
152  
153 GameTooltip:Show();
154 end
155 end
156  
157  
158 -- Populate the frame
159 function SetFrameValues()
160 local unit = "player";
161 local label = getglobal("CSFrameLabel");
162 local text = getglobal("CSFrameStatText");
163 text:SetTextColor(0, 1, 0, 1);
164  
165 CharacterAttributesFrame:SetPoint("TOPLEFT", "PaperDollFrame", "TOPLEFT", 67, -279);
166 PlayerStatBackgroundMiddle:SetHeight(65);
167  
168 if (reportThis == 1) then
169 label:SetText(CS_STAT_NAMES['HEAL'] .. ":");
170 text:SetText("+" .. casterStats.stats['HEAL']);
171 else
172 label:SetText(CS_STAT_NAMES['DMG'] .. ":");
173 text:SetText("+" .. casterStats.stats['DMG']);
174 end
175 end
176  
177  
178 -- Empty the frame
179 function ClearFrameValues()
180 local label = getglobal("CSFrameLabel");
181 local text = getglobal("CSFrameStatText");
182  
183 label:SetText("");
184 text:SetText("");
185 end
186  
187  
188 -- Returns true if at least 1 stat has been recorded
189 function ThereAreStats()
190 for i, currentStat in casterStats.stats do
191 if (currentStat ~= 0) then
192 return true;
193 end
194 end
195 end
196  
197  
198 -- Handles the command line
199 function CS_CommandHandler( msg )
200 if (msg == CS_DMG_TOGGLE) then
201 reportThis = 0;
202 UpdateCS();
203 DEFAULT_CHAT_FRAME:AddMessage(CS_FEEDBACK_STATCHANGE.." \""..CS_DMG_TOGGLE.."\"");
204 elseif (msg == CS_HEALING_TOGGLE) then
205 reportThis = 1;
206 UpdateCS();
207 DEFAULT_CHAT_FRAME:AddMessage(CS_FEEDBACK_STATCHANGE.." \""..CS_HEALING_TOGGLE.."\"");
208 else
209 if(reportThis == 0) then
210 reportThis = 1;
211 else
212 reportThis = 0;
213 end
214 end
215 end
216  
217