LibStatLogic-1.1

This project is abandoned and its default file will likely not work with the most recent version of World of Warcraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

StatLogic 1.1 now uses LibStub instead of AceLibrary. StatLogic 1.1 will remain 3.0 compatible(China is still in wotlk), use StatLogic 1.2 for 4.0.

API Documentation

:BuildGemmedTooltip(item , red , yellow , blue , meta)

<font size="3">Arguments</font>
item
number or string or table - tooltip or itemId or "itemString" or "itemName" or "itemLink"
red
number or string - gemID to replace a red socket
yellow
number or string - gemID to replace a yellow socket
blue
number or string - gemID to replace a blue socket
meta
number or string - gemID to replace a meta socket
<font size="3">Notes</font>
  • Returns a modified link with all empty sockets replaced with the specified gems, sockets already gemmed will remain.
  • item:
tooltip
table - The tooltip showing the item
itemId
number - The numeric ID of the item. ie. 12345
"itemString"
string - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
Also supports partial itemStrings, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
"itemName"
string - The Name of the Item, ex: "Hearthstone"
The item must have been equiped, in your bags or in your bank once in this session for this to work.
"itemLink"
string - The itemLink, when Shift-Clicking items.
<font size="3">Returns</font>
link
string - modified item link
<font size="3">Example</font>
local link = StatLogic:BuildGemmedTooltip(28619, 3119, 3119, 3119, 3119)
StatLogic:SetTip("item:28619")
StatLogic:SetTip(StatLogic:BuildGemmedTooltip(28619, 3119, 3119, 3119, 3119))
string or number

:GetAPFromAgi(agi [, class])

<font size="3">Arguments</font>
agi
number - Agility
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Calculates the attack power from agility for given class.
<font size="3">Returns</font>
ap
number - Attack power
statid
string - "AP"
<font size="3">Example</font>
local ap = StatLogic:GetAPFromAgi(1) -- GetAPPerAgi
local ap = StatLogic:GetAPFromAgi(10)
local ap = StatLogic:GetAPFromAgi(10, "WARRIOR")
string or number

:GetAPFromStr(str [, class])

<font size="3">Arguments</font>
str
number - Strength
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Returns</font>
ap
number - Attack power
statid
string - "AP"
Examples: local ap = StatLogic:GetAPFromStr(1) -- GetAPPerStr local ap = StatLogic:GetAPFromStr(10) local ap = StatLogic:GetAPFromStr(10, "WARRIOR")
string or number

:GetAPPerAgi([class])

<font size="3">Arguments</font>
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Gets the attack power per agility for given class.
  • Player level does not effect attack power per agility.
  • Will check for Cat Form.
<font size="3">Returns</font>
ap
number - Attack power per agility
statid
string - "AP"
<font size="3">Example</font>
local apPerAgi = StatLogic:GetAPPerAgi()
local apPerAgi = StatLogic:GetAPPerAgi("ROGUE")
string or number

:GetAPPerStr([class])

<font size="3">Arguments</font>
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Returns the attack power per strength for given class.
  • Player level does not effect attack power per strength.
<font size="3">Returns</font>
ap
number - Attack power per strength
statid
string - "AP"
<font size="3">Example</font>
local ap = StatLogic:GetAPPerStr()
local ap = StatLogic:GetAPPerStr("WARRIOR")
string or number

:GetAvoidanceAfterDR("avoidanceType" , avoidanceBeforeDR [, class])

<font size="3">Arguments</font>
"avoidanceType"
string - "DODGE", "PARRY", "MELEE_HIT_AVOID"(NYI)
avoidanceBeforeDR
number - amount of avoidance before diminishing returns in percentages.
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Avoidance DR formula and k, C_p, C_d constants derived by Whitetooth (hotdogee [at] gmail [dot] com)
  • avoidanceBeforeDR is the part that is affected by diminishing returns.
  • See :GetClassIdOrName(class) for valid class values.
  • Calculates the avoidance after diminishing returns, this includes:
    1. Dodge from Dodge Rating, Defense, Agility.
    2. Parry from Parry Rating, Defense.
    3. Chance to be missed from Defense.
  • The DR formula: 1/x' = 1/c+k/x
    • x' is the diminished stat before converting to IEEE754.
    • x is the stat before diminishing returns.
    • c is the cap of the stat, and changes with class.
    • k is is a value that changes with class.
  • Formula details:
    1. DR for Dodge, Parry, Missed are calculated separately.
    2. Base avoidances are not affected by DR, (ex: Dodge from base Agility)
    3. Death Knight's Parry from base Strength is affected by DR, base for parry is 5%.
    4. Direct avoidance gains from talents and spells(ex: Evasion) are not affected by DR.
    5. Indirect avoidance gains from talents and spells(ex: +Agility from Kings) are affected by DR
    6. c and k values depend on class but does not change with level.
kC_p1/C_pC_d1/C_d
Warrior0.956047.0035250.02127588.1290210.011347
Paladin0.956047.0035250.02127588.1290210.011347
Hunter0.9880145.5604080.006870145.5604080.006870
Rogue0.9880145.5604080.006870145.5604080.006870
Priest0.953000150.3759400.006650
Deathknight0.956047.0035250.02127588.1290210.011347
Shaman0.9880145.5604080.006870145.5604080.006870
Mage0.953000150.3759400.006650
Warlock0.953000150.3759400.006650
Druid0.972000116.8907070.008555
<font size="3">Returns</font>
avoidanceAfterDR
number - avoidance after diminishing returns in percentages.
<font size="3">Example</font>
local modParry, drFreeParry = StatLogic:GetParryChanceBeforeDR()
local modParryAfterDR = StatLogic:GetAvoidanceAfterDR("PARRY", modParry)
local parry = modParryAfterDR + drFreeParry
local modParryAfterDR = StatLogic:GetAvoidanceAfterDR("PARRY", modParry, "WARRIOR")
local parry = modParryAfterDR + drFreeParry

:GetAvoidanceGainAfterDR("avoidanceType" , gainBeforeDR)

<font size="3">Arguments</font>
"avoidanceType"
string - "DODGE", "PARRY", "MELEE_HIT_AVOID"(NYI)
gainBeforeDR
number - Avoidance gain before diminishing returns in percentages.
<font size="3">Notes</font>
  • Calculates the avoidance gain after diminishing returns with player's current stats.
<font size="3">Returns</font>
gainAfterDR
number - Avoidance gain after diminishing returns in percentages.
<font size="3">Example</font>
-- How much dodge will I gain with +30 Agi after DR?
local gainAfterDR = StatLogic:GetAvoidanceGainAfterDR("DODGE", 30*StatLogic:GetDodgePerAgi())
-- How much dodge will I gain with +20 Parry Rating after DR?
local gainAfterDR = StatLogic:GetAvoidanceGainAfterDR("PARRY", StatLogic:GetEffectFromRating(20, CR_PARRY))
string or number

:GetBaseDodge([class])

<font size="3">Arguments</font>
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • BaseDodge values derived by Whitetooth (hotdogee [at] gmail [dot] com)
  • Gets the base dodge percentage for given class.
  • Base dodge is the amount of dodge you have with 0 Agility, independent of level.
<font size="3">Returns</font>
dodge
number - Base dodge in percentages
statid
string - "DODGE"
<font size="3">Example</font>
local baseDodge = StatLogic:GetBaseDodge()
local baseDodge = StatLogic:GetBaseDodge("WARRIOR")
string or number

:GetBlockValueFromStr(str [, class])

<font size="3">Arguments</font>
str
number - Strength
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Calculates the block value from strength for given class.
  • Player level does not effect block value per strength.
<font size="3">Returns</font>
blockValue
number - Block value
statid
string - "BLOCK_VALUE"
<font size="3">Example</font>
local bv = StatLogic:GetBlockValueFromStr(1) -- GetBlockValuePerStr
local bv = StatLogic:GetBlockValueFromStr(10)
local bv = StatLogic:GetBlockValueFromStr(10, "WARRIOR")
string or number

:GetBlockValuePerStr([class])

<font size="3">Arguments</font>
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Gets the block value per strength for given class.
  • Player level does not effect block value per strength.
<font size="3">Returns</font>
blockValue
number - Block value per strength
statid
string - "BLOCK_VALUE"
<font size="3">Example</font>
local blockPerStr = StatLogic:GetBlockValuePerStr()
local blockPerStr = StatLogic:GetBlockValuePerStr("WARRIOR")

:GetClassIdOrName(class)

<font size="3">Arguments</font>
class
number or string - ClassID or "ClassName"
<font size="3">Notes</font>
  • Converts ClassID to and from "ClassName"
  • class:
ClassID"ClassName"
1"WARRIOR"
2"PALADIN"
3"HUNTER"
4"ROGUE"
5"PRIEST"
6"DEATHKNIGHT"
7"SHAMAN"
8"MAGE"
9"WARLOCK"
10"DRUID"
<font size="3">Returns</font> None <font size="3">Example</font>
StatLogic:GetClassIdOrName("WARRIOR") -- 1
StatLogic:GetClassIdOrName(10) -- "DRUID"
string or number number

:GetCritFromAgi(agi [, class] [, level])

<font size="3">Arguments</font>
agi
number - Agility
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
level
number - Level used in calculations. Default: player's level
<font size="3">Notes</font>
  • CritPerAgi values reverse engineered by Whitetooth (hotdogee [at] gmail [dot] com)
  • Calculates the melee/ranged crit chance from agility for given class and level.
<font size="3">Returns</font>
crit
number - Melee/ranged crit percentage
statid
string - "MELEE_CRIT"
<font size="3">Example</font>
local crit = StatLogic:GetCritFromAgi(1) -- GetCritPerAgi
local crit = StatLogic:GetCritFromAgi(10)
local crit = StatLogic:GetCritFromAgi(10, "WARRIOR")
local crit = StatLogic:GetCritFromAgi(10, nil, 70)
local crit = StatLogic:GetCritFromAgi(10, "WARRIOR", 70)

:GetDiff(item , diff1 , diff2 , ignoreEnchant , ignoreGem , red , yellow , blue , meta)

<font size="3">Arguments</font>
item
number or string or table - tooltip or itemId or "itemString" or "itemName" or "itemLink"
diff1
table - Stat difference of item and equipped item 1 are writen to this table if provided
diff2
table - Stat difference of item and equipped item 2 are writen to this table if provided
ignoreEnchant
boolean - Ignore enchants when calculating stat diffrences
ignoreGem
boolean - Ignore gems when calculating stat diffrences
red
number or string - gemID to replace a red socket
yellow
number or string - gemID to replace a yellow socket
blue
number or string - gemID to replace a blue socket
meta
number or string - gemID to replace a meta socket
<font size="3">Notes</font>
  • Calculates the stat diffrence from the specified item and your currently equipped items.
  • item:
tooltip
table - The tooltip showing the item
itemId
number - The numeric ID of the item. ie. 12345
"itemString"
string - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
Also supports partial itemStrings, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
"itemName"
string - The Name of the Item, ex: "Hearthstone"
The item must have been equiped, in your bags or in your bank once in this session for this to work.
"itemLink"
string - The itemLink, when Shift-Clicking items.
<font size="3">Returns</font>
diff1
table - The table with stat diff values for item 1
{
["STAT_ID1"] = value,
["STAT_ID2"] = value,
}
diff2
table - The table with stat diff values for item 2
{
["STAT_ID1"] = value,
["STAT_ID2"] = value,
}
<font size="3">Example</font>
StatLogic:GetDiff(21417, {}) -- Ring of Unspoken Names
StatLogic:GetDiff(21452) -- Staff of the Ruins

:GetDiffID(item , ignoreEnchant , ignoreGem , red , yellow , blue , meta)

<font size="3">Arguments</font>
item
number or string or table - tooltip or itemId or "itemString" or "itemName" or "itemLink"
ignoreEnchant
boolean - Ignore enchants when calculating the id if true
ignoreGem
boolean - Ignore gems when calculating the id if true
red
number or string - gemID to replace a red socket
yellow
number or string - gemID to replace a yellow socket
blue
number or string - gemID to replace a blue socket
meta
number or string - gemID to replace a meta socket
<font size="3">Notes</font>
  • Returns a unique identification string of the diff calculation, the identification string is made up of links concatenated together, can be used for cache indexing
  • item:
tooltip
table - The tooltip showing the item
itemId
number - The numeric ID of the item. ie. 12345
"itemString"
string - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
Also supports partial itemStrings, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
"itemName"
string - The Name of the Item, ex: "Hearthstone"
The item must have been equiped, in your bags or in your bank once in this session for this to work.
"itemLink"
string - The itemLink, when Shift-Clicking items.
<font size="3">Returns</font>
id
string - a unique identification string of the diff calculation, for use as cache key
link
string - link of main item
linkDiff1
string - link of compare item 1
linkDiff2
string - link of compare item 2
<font size="3">Example</font>
StatLogic:GetDiffID(21417) -- Ring of Unspoken Names
StatLogic:GetDiffID("item:18832:2564:0:0:0:0:0:0", true, true) -- Brutality Blade with +15 agi enchant
http://www.wowwiki.com/EnchantId

:GetDodgeChanceBeforeDR()

<font size="3">Notes</font>
  • Calculates your current Dodge% before diminishing returns.
  • Dodge% = modDodge + drFreeDodge
  • drFreeDodge includes:
    • Base dodge
    • Dodge from base agility
    • Dodge modifier from base defense
    • Dodge modifers from talents or spells
  • modDodge includes
    • Dodge from dodge rating
    • Dodge from additional defense
    • Dodge from additional dodge
<font size="3">Returns</font>
modDodge
number - The part that is affected by diminishing returns.
drFreeDodge
number - The part that isn't affected by diminishing returns.
<font size="3">Example</font>
local modDodge, drFreeDodge = StatLogic:GetDodgeChanceBeforeDR()

:GetDodgeFromAgi(agi)

<font size="3">Arguments</font>
agi
number - Agility
<font size="3">Notes</font>
  • Calculates the dodge chance from agility for your current class and level.
  • Only works for your currect class and current level, does not support class and level args.
<font size="3">Returns</font>
dodge
number - Dodge percentage
statid
string - "DODGE"
<font size="3">Example</font>
local dodge = StatLogic:GetDodgeFromAgi(1) -- GetDodgePerAgi
local dodge = StatLogic:GetDodgeFromAgi(10)

:GetDodgePerAgi()

<font size="3">Notes</font>
  • Formula by Whitetooth (hotdogee [at] gmail [dot] com)
  • Calculates the dodge percentage per agility for your current class and level.
  • Only works for your currect class and current level, does not support class and level args.
  • Calculations got a bit more complicated with the introduction of the avoidance DR in WotLK, these are the values we know or can be calculated easily:
    • D'=Total Dodge% after DR
    • D_r=Dodge from Defense and Dodge Rating before DR
    • D_b=Dodge unaffected by DR (BaseDodge + Dodge from talent/buffs + Lower then normal defense correction)
    • A=Total Agility
    • A_b=Base Agility (This is what you have with no gear on)
    • A_g=Total Agility - Base Agility
    • Let d be the Dodge/Agi value we are going to calculate.
  1     1     k 
 --- = --- + --- 
  x'    c     x 

 x'=D'-D_b-A_b*d 
 x=A_g*d+D_r 

 1/(D'-D_b-A_b*d)=1/C_d+k/(A_g*d+D_r)=(A_g*d+D_r+C_d*k)/(C_d*A_g*d+C_d*D_r) 

 C_d*A_g*d+C_d*D_r=[(D'-D_b)-A_b*d]*[Ag*d+(D_r+C_d*k)] 

 After rearranging the terms, we get an equation of type a*d^2+b*d+c where 
 a=-A_g*A_b 
 b=A_g(D'-D_b)-A_b(D_r+C_d*k)-C_dA_g 
 c=(D'-D_b)(D_r+C_d*k)-C_d*D_r 
    • Dodge/Agi=(-b-(b^2-4ac)^0.5)/(2a)
<font size="3">Returns</font>
dodge
number - Dodge percentage per agility
statid
string - "DODGE"
<font size="3">Example</font>
local dodge, statid = StatLogic:GetDodgePerAgi()
string number

:GetEffectFromDefense([defense] [, attackerLevel])

<font size="3">Arguments</font>
defense
string - Total defense value. Default: player's armor value
attackerLevel
number - Attacker level. Default: player's level
<font size="3">Notes</font>
  • Calculates the effective avoidance% from defense (before diminishing returns) for given attacker level
<font size="3">Returns</font>
effect
number - 0.04% per effective defense.
<font size="3">Example</font>
local effect = StatLogic:GetEffectFromDefense(415, 83) -- 0
number

:GetEffectFromRating(rating , id [, level])

<font size="3">Arguments</font>
rating
number - Rating value
id
number - Rating ID as defined in PaperDollFrame.lua
level
number - Level used in calculations. Default: player's level
<font size="3">Notes</font>
  • Combat Rating formula and constants derived by Whitetooth (hotdogee [at] gmail [dot] com)
  • Calculates the stat effects from ratings for any level.
  • id: Rating ID as definded in PaperDollFrame.lua
CR_WEAPON_SKILL = 1
CR_DEFENSE_SKILL = 2
CR_DODGE = 3
CR_PARRY = 4
CR_BLOCK = 5
CR_HIT_MELEE = 6
CR_HIT_RANGED = 7
CR_HIT_SPELL = 8
CR_CRIT_MELEE = 9
CR_CRIT_RANGED = 10
CR_CRIT_SPELL = 11
CR_HIT_TAKEN_MELEE = 12
CR_HIT_TAKEN_RANGED = 13
CR_HIT_TAKEN_SPELL = 14
CR_CRIT_TAKEN_MELEE = 15
CR_CRIT_TAKEN_RANGED = 16
CR_CRIT_TAKEN_SPELL = 17
CR_HASTE_MELEE = 18
CR_HASTE_RANGED = 19
CR_HASTE_SPELL = 20
CR_WEAPON_SKILL_MAINHAND = 21
CR_WEAPON_SKILL_OFFHAND = 22
CR_WEAPON_SKILL_RANGED = 23
CR_EXPERTISE = 24
CR_ARMOR_PENETRATION = 25
  • The Combat Rating formula:
    • Percentage = Rating / RatingBase / H
      • Level 1 to 10: H = 2/52
      • Level 10 to 60: H = (level-8)/52
      • Level 60 to 70: H = 82/(262-3*level)
      • Level 70 to 80: H = (82/52)*(131/63)^((level-70)/10)
RatingIDRatingBase
CR_WEAPON_SKILL2.5
CR_DEFENSE_SKILL1.5
CR_DODGE12
CR_PARRY15
CR_BLOCK5
CR_HIT_MELEE10
CR_HIT_RANGED10
CR_HIT_SPELL8
CR_CRIT_MELEE14
CR_CRIT_RANGED14
CR_CRIT_SPELL14
CR_HIT_TAKEN_MELEE10
CR_HIT_TAKEN_RANGED10
CR_HIT_TAKEN_SPELL8
CR_CRIT_TAKEN_MELEE25
CR_CRIT_TAKEN_RANGED25
CR_CRIT_TAKEN_SPELL25
CR_HASTE_MELEE10
CR_HASTE_RANGED10
CR_HASTE_SPELL10
CR_WEAPON_SKILL_MAINHAND2.5
CR_WEAPON_SKILL_OFFHAND2.5
CR_WEAPON_SKILL_RANGED2.5
CR_EXPERTISE2.5
CR_ARMOR_PENETRATION4.69512176513672
  • Parry Rating, Defense Rating, Block Rating and Resilience: Low-level players will now convert these ratings into their corresponding defensive stats at the same rate as level 34 players.
<font size="3">Returns</font>
effect
number - Effect value
effect name
string - Stat ID of converted effect, ex: "DODGE", "PARRY"
<font size="3">Example</font>
StatLogic:GetEffectFromRating(10, CR_DODGE)
StatLogic:GetEffectFromRating(10, CR_DODGE, 70)

:GetGemID(item)

<font size="3">Arguments</font>
item
number or string or table - tooltip or itemId or "itemString" or "itemName" or "itemLink"
<font size="3">Notes</font>
  • Returns the gemID and gemText of a gem for use in links
  • item:
tooltip
table - The tooltip showing the item
itemId
number - The numeric ID of the item. ie. 12345
"itemString"
string - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
Also supports partial itemStrings, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
"itemName"
string - The Name of the Item, ex: "Hearthstone"
The item must have been equiped, in your bags or in your bank once in this session for this to work.
"itemLink"
string - The itemLink, when Shift-Clicking items.
<font size="3">Returns</font>
gemID
number - The gemID of this gem
gemText
string - The text shown in the tooltip when socketed in an item
<font size="3">Example</font>
local gemID, gemText = StatLogic:GetGemID(28363)
string or number

:GetHealthRegenFromSpi(spi [, class])

<font size="3">Arguments</font>
spi
number - Spirit
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • HealthRegenPerSpi values derived by Whitetooth (hotdogee [at] gmail [dot] com)
  • Calculates the health regen per 5 seconds when out of combat from spirit for given class.
  • Player level does not effect health regen per spirit.
<font size="3">Returns</font>
hp5oc
number - Health regen per 5 seconds when out of combat
statid
string - "HEALTH_REG_OUT_OF_COMBAT"
<font size="3">Example</font>
local hp5oc = StatLogic:GetHealthRegenFromSpi(1) -- GetHealthRegenPerSpi
local hp5oc = StatLogic:GetHealthRegenFromSpi(10)
local hp5oc = StatLogic:GetHealthRegenFromSpi(10, "MAGE")
number number

:GetNormalManaRegenFromSpi(spi [, int] [, level])

<font size="3">Arguments</font>
spi
number - Spirit
int
number - Intellect. Default: player's intellect
level
number - Level used in calculations. Default: player's level
<font size="3">Notes</font>
  • Formula and BASE_REGEN values derived by Whitetooth (hotdogee [at] gmail [dot] com)
  • Calculates the mana regen per 5 seconds from spirit when out of 5 second rule for given intellect and level.
  • Player class is no longer a parameter
  • ManaRegen(SPI, INT, LEVEL) = (0.001+SPI*BASE_REGEN[LEVEL]*(INT^0.5))*5
<font size="3">Returns</font>
mp5o5sr
number - Mana regen per 5 seconds when out of 5 second rule
statid
string - "MANA_REG_NOT_CASTING"
<font size="3">Example</font>
	local mp5o5sr = StatLogic:GetNormalManaRegenFromSpi(1) -- GetNormalManaRegenPerSpi
	local mp5o5sr = StatLogic:GetNormalManaRegenFromSpi(10, 15)
	local mp5o5sr = StatLogic:GetNormalManaRegenFromSpi(10, 15, 70)
}

:GetParryChanceBeforeDR()

<font size="3">Notes</font>
  • Calculates your current Parry% before diminishing returns.
  • Parry% = modParry + drFreeParry
  • drFreeParry includes:
    • Base parry
    • Parry from base agility
    • Parry modifier from base defense
    • Parry modifers from talents or spells
  • modParry includes
    • Parry from parry rating
    • Parry from additional defense
    • Parry from additional parry
<font size="3">Returns</font>
modParry
number - The part that is affected by diminishing returns.
drFreeParry
number - The part that isn't affected by diminishing returns.
<font size="3">Example</font>
local modParry, drFreeParry = StatLogic:GetParryChanceBeforeDR()
string or number

:GetRAPFromAgi(agi [, class])

<font size="3">Arguments</font>
agi
number - Agility
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Calculates the ranged attack power from agility for given class.
<font size="3">Returns</font>
rap
number - Ranged attack power
statid
string - "RANGED_AP"
<font size="3">Example</font>
local rap = StatLogic:GetRAPFromAgi(1) -- GetRAPPerAgi
local rap = StatLogic:GetRAPFromAgi(10)
local rap = StatLogic:GetRAPFromAgi(10, "WARRIOR")
string or number

:GetRAPPerAgi([class])

<font size="3">Arguments</font>
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
<font size="3">Notes</font>
  • Gets the ranged attack power per agility for given class.
  • Player level does not effect ranged attack power per agility.
<font size="3">Returns</font>
rap
number - Ranged attack power per agility
statid
string - "RANGED_AP"
<font size="3">Example</font>
local rapPerAgi = StatLogic:GetRAPPerAgi()
local rapPerAgi = StatLogic:GetRAPPerAgi("HUNTER")

:GetRatingIdOrStatId(rating)

<font size="3">Arguments</font>
rating
number or string - RatingID or "StatID"
<font size="3">Notes</font>
  • Converts RatingID to and from "StatID"
  • rating:
RatingID
number - As defined in PaperDollFrame.lua of Blizzard default ui
"StatID"
string - The the key values of the DisplayLocale table in StatLogic
RatingID"StatID"
CR_WEAPON_SKILL"WEAPON_RATING"
CR_DEFENSE_SKILL"DEFENSE_RATING"
CR_DODGE"DODGE_RATING"
CR_PARRY"PARRY_RATING"
CR_BLOCK"BLOCK_RATING"
CR_HIT_MELEE"MELEE_HIT_RATING"
CR_HIT_RANGED"RANGED_HIT_RATING"
CR_HIT_SPELL"SPELL_HIT_RATING"
CR_CRIT_MELEE"MELEE_CRIT_RATING"
CR_CRIT_RANGED"RANGED_CRIT_RATING"
CR_CRIT_SPELL"SPELL_CRIT_RATING"
CR_HIT_TAKEN_MELEE"MELEE_HIT_AVOID_RATING"
CR_HIT_TAKEN_RANGED"RANGED_HIT_AVOID_RATING"
CR_HIT_TAKEN_SPELL"SPELL_HIT_AVOID_RATING"
CR_CRIT_TAKEN_MELEE"MELEE_CRIT_AVOID_RATING"
CR_CRIT_TAKEN_RANGED"RANGED_CRIT_AVOID_RATING"
CR_CRIT_TAKEN_SPELL"SPELL_CRIT_AVOID_RATING"
CR_HASTE_MELEE"MELEE_HASTE_RATING"
CR_HASTE_RANGED"RANGED_HASTE_RATING"
CR_HASTE_SPELL"SPELL_HASTE_RATING"
CR_WEAPON_SKILL_MAINHAND"MAINHAND_WEAPON_RATING"
CR_WEAPON_SKILL_OFFHAND"OFFHAND_WEAPON_RATING"
CR_WEAPON_SKILL_RANGED"RANGED_WEAPON_RATING"
CR_EXPERTISE"EXPERTISE_RATING"
CR_ARMOR_PENETRATION"ARMOR_PENETRATION_RATING"
<font size="3">Returns</font> None <font size="3">Example</font>
StatLogic:GetRatingIdOrStatId("CR_WEAPON_SKILL") -- 1
StatLogic:GetRatingIdOrStatId("DEFENSE_RATING") -- 2
StatLogic:GetRatingIdOrStatId("DODGE_RATING") -- 3
StatLogic:GetRatingIdOrStatId(CR_PARRY) -- "PARRY_RATING"
string number

:GetReductionFromArmor([armor] [, attackerLevel])

<font size="3">Arguments</font>
armor
string - Armor value. Default: player's armor value
attackerLevel
number - Attacker level. Default: player's level
<font size="3">Notes</font>
  • Calculates the damage reduction from armor for given attacker level.
<font size="3">Returns</font>
damageRecudtion
number - Damage reduction value from 0 to 1. (not percentage)
<font size="3">Example</font>
local damageRecudtion = StatLogic:GetReductionFromArmor(35000, 80) -- 0.69676006569452
string or number number

:GetSpellCritFromInt(int [, class] [, level])

<font size="3">Arguments</font>
int
number - Intellect
class
string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
level
number - Level used in calculations. Default: player's level
<font size="3">Notes</font>
  • SpellCritPerInt values reverse engineered by Whitetooth (hotdogee [at] gmail [dot] com)
  • Calculates the spell crit chance from intellect for given class and level.
<font size="3">Returns</font>
spellcrit
number - Spell crit percentage
statid
string - "SPELL_CRIT"
<font size="3">Example</font>
local spellCrit = StatLogic:GetSpellCritFromInt(1) -- GetSpellCritPerInt
local spellCrit = StatLogic:GetSpellCritFromInt(10)
local spellCrit = StatLogic:GetSpellCritFromInt(10, "MAGE")
local spellCrit = StatLogic:GetSpellCritFromInt(10, nil, 70)
local spellCrit = StatLogic:GetSpellCritFromInt(10, "MAGE", 70)
string

:GetStatMod("stat" [, school])

<font size="3">Arguments</font>
"stat"
string - The type of stat mod you want to get
school
string - Certain stat mods require an extra school argument
<font size="3">Notes</font>
  • Calculates various stat mod values from talents and buffs.
  • initialValue: sets the initial value for the stat mod.
if initialValue == 0, inter-mod operations are done with addition,
if initialValue == 1, inter-mod operations are done with multiplication,
  • finalAdjust: added to the final result before returning, so we can adjust the return value to be used in addition or multiplication.
for addition: initialValue + finalAdjust = 0
for multiplication: initialValue + finalAdjust = 1
  • stat:
"StatMod"Initial valueFinal adjustschoo required
"ADD_CRIT_TAKEN"00Yes
"ADD_HIT_TAKEN"00Yes
"ADD_DODGE"00No
"ADD_AP_MOD_INT"00No
"ADD_AP_MOD_STA"00No
"ADD_AP_MOD_ARMOR"00No
"ADD_AP_MOD_SPELL_DMG"00No
"ADD_CR_PARRY_MOD_STR"00No
"ADD_MANA_REG_MOD_INT"00No
"ADD_RANGED_AP_MOD_INT"00No
"ADD_ARMOR_MOD_INT"00No
"ADD_SCHOOL_SP_MOD_SPI"00Yes
"ADD_SPELL_DMG_MOD_AP"00No
"ADD_SPELL_DMG_MOD_STA"00No
"ADD_SPELL_DMG_MOD_INT"00No
"ADD_SPELL_DMG_MOD_SPI"00No
"ADD_HEALING_MOD_AP"00No
"ADD_HEALING_MOD_STR"00No
"ADD_HEALING_MOD_AGI"00No
"ADD_HEALING_MOD_STA"00No
"ADD_HEALING_MOD_INT"00No
"ADD_HEALING_MOD_SPI"00No
"ADD_MANA_REG_MOD_NORMAL_MANA_REG"00No
"MOD_CRIT_DAMAGE_TAKEN"01Yes
"MOD_DMG_TAKEN"01Yes
"MOD_CRIT_DAMAGE"01Yes
"MOD_DMG"01Yes
"MOD_ARMOR"10No
"MOD_HEALTH"10No
"MOD_MANA"10No
"MOD_STR"01No
"MOD_AGI"01No
"MOD_STA"01No
"MOD_INT"01No
"MOD_SPI"01No
"MOD_BLOCK_VALUE"01No
"MOD_AP"01No
"MOD_RANGED_AP"01No
"MOD_SPELL_DMG"01No
"MOD_HEALING"01
<font size="3">Returns</font> None <font size="3">Example</font>
StatLogic:GetClassIdOrName("MOD_STR")
StatLogic:GetClassIdOrName(10)

:GetStatNameFromID("stat")

<font size="3">Arguments</font>
"stat"
string - "StatID". ex: "DODGE", "DODGE_RATING"
<font size="3">Notes</font>
  • Returns localized names for stat
<font size="3">Returns</font>
"longName"
string - The full name for stat.
"shortName"
string - The short name for stat.
<font size="3">Example</font>
local longName, shortName = StatLogic:GetStatNameFromID("FIRE_RES") -- "Fire Resistance", "FR"

:GetSum(item , table)

<font size="3">Arguments</font>
item
number or string or table - tooltip or itemId or "itemString" or "itemName" or "itemLink"
table
table - The sum of stat values are writen to this table if provided
<font size="3">Notes</font>
  • Calculates the sum of all stats for a specified item.
  • item:
tooltip
table - The tooltip showing the item
itemId
number - The numeric ID of the item. ie. 12345
"itemString"
string - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
Also supports partial itemStrings, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
"itemName"
string - The Name of the Item, ex: "Hearthstone"
The item must have been equiped, in your bags or in your bank once in this session for this to work.
"itemLink"
string - The itemLink, when Shift-Clicking items.
<font size="3">Returns</font>
sumTable
table - The table with stat sum values
{
["itemType"] = itemType,
["STAT_ID1"] = value,
["STAT_ID2"] = value,
}
<font size="3">Example</font>
StatLogic:GetSum(21417) -- [Ring of Unspoken Names]
StatLogic:GetSum("item:28040:2717")
StatLogic:GetSum("item:19019:117") -- TF
StatLogic:GetSum("item:3185:0:0:0:0:0:1957") -- Acrobatic Staff of Frozen Wrath ID:3185:0:0:0:0:0:1957
StatLogic:GetSum(24396)
SetTip("item:3185:0:0:0:0:0:1957")
-- [Deadly Fire Opal] ID:30582 - Attack Power +8 and Critical Rating +5
-- [Gnomeregan Auto-Blocker 600] ID:29387
StatLogic:GetSum("item:30538:3011:2739:2739:2739:0") -- [Midnight Legguards] with enchant and gems
StatLogic:GetSum("item:30538:3011:2739:2739:2739:0") -- [Midnight Legguards] with enchant and gems
number or string number or string number or string number or string number or string

:ModEnchantGem("link" [, enc] [, gem1] [, gem2] [, gem3] [, gem4])

<font size="3">Arguments</font>
"link"
string - "itemlink"
enc
number or string - enchantID to replace the current enchant. Default: no change
gem1
number or string - gemID to replace the first gem. Default: no change
gem2
number or string - gemID to replace the second gem. Default: no change
gem3
number or string - gemID to replace the third gem. Default: no change
gem4
number or string - gemID to replace the fourth gem. Default: no change
<font size="3">Notes</font>
  • Add/Replace item's enchants or gems with given enchants or gems.
<font size="3">Returns</font>
link
number - The modified link
<font size="3">Example</font>
local link = StatLogic:ModEnchantGem("Hitem:31052:0:0:0:0:0:0:0", 1394)

:RemoveEnchant("link")

<font size="3">Arguments</font>
"link"
string - "itemlink"
<font size="3">Notes</font>
  • Remove item's enchants.
<font size="3">Returns</font>
link
number - The modified link
<font size="3">Example</font>
local link = StatLogic:RemoveEnchant("Hitem:31052:425:525:525:525:525:0:0")

:RemoveEnchantGem("link")

<font size="3">Arguments</font>
"link"
string - "itemlink"
<font size="3">Notes</font>
  • Remove item's gems and enchants.
<font size="3">Returns</font>
link
number - The modified link
<font size="3">Example</font>
local link = StatLogic:RemoveEnchantGem("Hitem:31052:425:525:525:525:525:0:0")

:RemoveGem("link")

<font size="3">Arguments</font>
"link"
string - "itemlink"
<font size="3">Notes</font>
  • Remove item's gems.
<font size="3">Returns</font>
link
number - The modified link
<font size="3">Example</font>
local link = StatLogic:RemoveGem("Hitem:31052:425:525:525:525:525:0:0")

:SetTip(item)

<font size="3">Arguments</font>
item
number or string - itemId or "itemString" or "itemName" or "itemLink"
<font size="3">Notes</font>
  • This is a debugging tool for localizers
  • Displays item in ItemRefTooltip
  • item:
itemId
number - The numeric ID of the item. ie. 12345
"itemString"
string - The full item ID in string format, e.g. "item:12345:0:0:0:0:0:0:0".
Also supports partial itemStrings, by filling up any missing ":x" value with ":0", e.g. "item:12345:0:0:0"
"itemName"
string - The Name of the Item, ex: "Hearthstone"
The item must have been equiped, in your bags or in your bank once in this session for this to work.
"itemLink"
string - The itemLink, when Shift-Clicking items.
<font size="3">Returns</font> None <font size="3">Example</font>
StatLogic:SetTip("item:3185:0:0:0:0:0:1957")

Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files

WoW Retail

  • r93
    Dec 8, 2009
  • r83
    Sep 6, 2009
  • Oct 20, 2010