Mercurial > wow > emfor1
diff CensusPlusProfiler.lua @ 6:10c85be19b56
rebase on CensusPlus-40000-4.3.2.zip;
added worgen
added 81 - 85
| author | EmFor |
|---|---|
| date | Fri, 10 Dec 2010 15:47:23 +0100 |
| parents | edfa01041183 |
| children |
line wrap: on
line diff
--- a/CensusPlusProfiler.lua Tue Mar 30 15:39:26 2010 +0000 +++ b/CensusPlusProfiler.lua Fri Dec 10 15:47:23 2010 +0100 @@ -1,23 +1,23 @@ ---[[ - CensusPlus for World of Warcraft(tm). - - Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com - - License: - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program(see GLP.txt); if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]] +--[[ + CensusPlus for World of Warcraft(tm). + + Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com + + License: + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program(see GLP.txt); if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]] CensusPlus_DoThisCharacter = false; @@ -87,11 +87,11 @@ }; function CP_ProfileFrame_OnLoad() - - -- Shut it down for now - if( true ) then - return; - end + + -- Shut it down for now + if( true ) then + return; + end this:RegisterEvent("VARIABLES_LOADED"); if ( myCPProfile_ALLEVENTS ) then -- unused, but keep for testing this:RegisterEvent("PLAYER_GUILD_UPDATE"); @@ -123,7 +123,7 @@ ]]-- function CP_ProfileFrame_OnEvent(event, arg1, arg2) - + -- crapout if we're not ready to process, or if not enabled if ( ( event == "UNIT_INVENTORY_CHANGED" and arg1 ~= "player" ) or not myCPProfile_ENABLED or not UnitName("player") or UnitName("player") == UNKNOWNOBJECT or not GetCVar("realmName") or not CensusPlus_DoThisCharacter ) then return; @@ -352,57 +352,57 @@ spellName,subSpellName = GetSpellName(spellIndex,BOOKTYPE_SPELL); end --[[ - local speed, offhandSpeed = UnitAttackSpeed("player"); - local minDamage, maxDamage, minOffHandDamage, maxOffHandDamage, physicalBonusPos, physicalBonusNeg, percent = UnitDamage("player"); - local baseDamage = (minDamage + maxDamage) * 0.5; - local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; - local damagePerSecond = max( fullDamage, 1 ) / speed; - minDamage = max( floor( minDamage ), 1 ); - maxDamage = max( ceil( maxDamage ),1 ); - speed = string.format( "%.2f", speed ); - damagePerSecond = string.format( "%.1f", damagePerSecond ); - local damagerange = minDamage.." - "..maxDamage; - local output = INVTYPE_WEAPONMAINHAND .. "<br>" - .. ATTACK_SPEED_COLON .. speed .. "<br>" - .. DAMAGE_COLON .. damagerange .. "<br>" - .. DAMAGE_PER_SECOND .. damagePerSecond - if ( offhandSpeed ) then - local offhandBaseDamage = (minOffHandDamage + maxOffHandDamage) * 0.5; - local offhandFullDamage = (offhandBaseDamage + physicalBonusPos + physicalBonusNeg) * percent; - local offhandDamagePerSecond = (max(offhandFullDamage,1) / offhandSpeed); - minOffHandDamage=max(floor(minOffHandDamage),1); - maxOffHandDamage=max(ceil(maxOffHandDamage),1); - local damagerange = minOffHandDamage.." - "..maxOffHandDamage; - offhandDamagePerSecond = string.format( "%.1f", offhandDamagePerSecond ); - offhandSpeed=string.format("%.2f", offhandSpeed); - output = output .. INVTYPE_WEAPONOFFHAND .. "<br>" - .. ATTACK_SPEED_COLON .. offhandSpeed .. "<br>" - .. DAMAGE_COLON .. damagerange .. "<br>" - .. DAMAGE_PER_SECOND .. offhandDamagePerSecond; - end - CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRangeTooltip"] = output; - - local speed, minDamage, maxDamage = UnitRangedDamage("player"); - minDamage = (minDamage / percent) - physicalBonusPos - physicalBonusNeg; - maxDamage = (maxDamage / percent) - physicalBonusPos - physicalBonusNeg; - local baseDamage = (minDamage + maxDamage) * 0.5; - local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; - local damagePerSecond = (max(fullDamage,1) / speed); - minDamage = max(floor(minDamage),1); - maxDamage = max(ceil(maxDamage),1); - speed=string.format("%.2f", speed); - damagePerSecond=string.format("%.1f", damagePerSecond); - local damagerange = max(floor(minDamage),1).." - "..max(ceil(maxDamage),1); - output = INVTYPE_RANGED .. "<br>" - .. ATTACK_SPEED_COLON .. speed .. "<br>" - .. DAMAGE_COLON .. damagerange .. "<br>" - .. DAMAGE_PER_SECOND .. damagePerSecond; - local base,pos,neg=UnitRangedAttack( "player" ); - if(base==0) then - CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = ""; - else - CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = output; - end + local speed, offhandSpeed = UnitAttackSpeed("player"); + local minDamage, maxDamage, minOffHandDamage, maxOffHandDamage, physicalBonusPos, physicalBonusNeg, percent = UnitDamage("player"); + local baseDamage = (minDamage + maxDamage) * 0.5; + local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; + local damagePerSecond = max( fullDamage, 1 ) / speed; + minDamage = max( floor( minDamage ), 1 ); + maxDamage = max( ceil( maxDamage ),1 ); + speed = string.format( "%.2f", speed ); + damagePerSecond = string.format( "%.1f", damagePerSecond ); + local damagerange = minDamage.." - "..maxDamage; + local output = INVTYPE_WEAPONMAINHAND .. "<br>" + .. ATTACK_SPEED_COLON .. speed .. "<br>" + .. DAMAGE_COLON .. damagerange .. "<br>" + .. DAMAGE_PER_SECOND .. damagePerSecond + if ( offhandSpeed ) then + local offhandBaseDamage = (minOffHandDamage + maxOffHandDamage) * 0.5; + local offhandFullDamage = (offhandBaseDamage + physicalBonusPos + physicalBonusNeg) * percent; + local offhandDamagePerSecond = (max(offhandFullDamage,1) / offhandSpeed); + minOffHandDamage=max(floor(minOffHandDamage),1); + maxOffHandDamage=max(ceil(maxOffHandDamage),1); + local damagerange = minOffHandDamage.." - "..maxOffHandDamage; + offhandDamagePerSecond = string.format( "%.1f", offhandDamagePerSecond ); + offhandSpeed=string.format("%.2f", offhandSpeed); + output = output .. INVTYPE_WEAPONOFFHAND .. "<br>" + .. ATTACK_SPEED_COLON .. offhandSpeed .. "<br>" + .. DAMAGE_COLON .. damagerange .. "<br>" + .. DAMAGE_PER_SECOND .. offhandDamagePerSecond; + end + CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Melee Attack"]["DamageRangeTooltip"] = output; + + local speed, minDamage, maxDamage = UnitRangedDamage("player"); + minDamage = (minDamage / percent) - physicalBonusPos - physicalBonusNeg; + maxDamage = (maxDamage / percent) - physicalBonusPos - physicalBonusNeg; + local baseDamage = (minDamage + maxDamage) * 0.5; + local fullDamage = (baseDamage + physicalBonusPos + physicalBonusNeg) * percent; + local damagePerSecond = (max(fullDamage,1) / speed); + minDamage = max(floor(minDamage),1); + maxDamage = max(ceil(maxDamage),1); + speed=string.format("%.2f", speed); + damagePerSecond=string.format("%.1f", damagePerSecond); + local damagerange = max(floor(minDamage),1).." - "..max(ceil(maxDamage),1); + output = INVTYPE_RANGED .. "<br>" + .. ATTACK_SPEED_COLON .. speed .. "<br>" + .. DAMAGE_COLON .. damagerange .. "<br>" + .. DAMAGE_PER_SECOND .. damagePerSecond; + local base,pos,neg=UnitRangedAttack( "player" ); + if(base==0) then + CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = ""; + else + CensusPlus_Profile[GetCVar("realmName")][UnitName("player")]["Ranged Attack"]["DamageRangeTooltip"] = output; + end ]]-- -- put in dps?
