StatLogic 1.1 now uses LibStub instead of AceLibrary
API Documentation
Arguments
- 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
Notes
- 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.
Returns
- link
- string - modified item link
Example
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])
Arguments
- agi
- number - Agility
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- Calculates the attack power from agility for given class.
Returns
- ap
- number - Attack power
- statid
- string - "AP"
Example
local ap = StatLogic:GetAPFromAgi(1) -- GetAPPerAgi
local ap = StatLogic:GetAPFromAgi(10)
local ap = StatLogic:GetAPFromAgi(10, "WARRIOR")
string or number
:GetAPFromStr(str [, class])
Arguments
- str
- number - Strength
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Returns
- 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])
Arguments
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- Gets the attack power per agility for given class.
- Player level does not effect attack power per agility.
- Will check for Cat Form.
Returns
- ap
- number - Attack power per agility
- statid
- string - "AP"
Example
local apPerAgi = StatLogic:GetAPPerAgi()
local apPerAgi = StatLogic:GetAPPerAgi("ROGUE")
string or number
:GetAPPerStr([class])
Arguments
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- Returns the attack power per strength for given class.
- Player level does not effect attack power per strength.
Returns
- ap
- number - Attack power per strength
- statid
- string - "AP"
Example
local ap = StatLogic:GetAPPerStr()
local ap = StatLogic:GetAPPerStr("WARRIOR")
string or number
:GetAvoidanceAfterDR("avoidanceType" , avoidanceBeforeDR [, class])
Arguments
- "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.
Notes
- 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:
- Dodge from Dodge Rating, Defense, Agility.
- Parry from Parry Rating, Defense.
- 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:
- DR for Dodge, Parry, Missed are calculated separately.
- Base avoidances are not affected by DR, (ex: Dodge from base Agility)
- Death Knight's Parry from base Strength is affected by DR, base for parry is 5%.
- Direct avoidance gains from talents and spells(ex: Evasion) are not affected by DR.
- Indirect avoidance gains from talents and spells(ex: +Agility from Kings) are affected by DR
- c and k values depend on class but does not change with level.
| | k | C_p | 1/C_p | C_d | 1/C_d
|
| Warrior | 0.9560 | 47.003525 | 0.021275 | 88.129021 | 0.011347
|
| Paladin | 0.9560 | 47.003525 | 0.021275 | 88.129021 | 0.011347
|
| Hunter | 0.9880 | 145.560408 | 0.006870 | 145.560408 | 0.006870
|
| Rogue | 0.9880 | 145.560408 | 0.006870 | 145.560408 | 0.006870
|
| Priest | 0.9530 | 0 | 0 | 150.375940 | 0.006650
|
| Deathknight | 0.9560 | 47.003525 | 0.021275 | 88.129021 | 0.011347
|
| Shaman | 0.9880 | 145.560408 | 0.006870 | 145.560408 | 0.006870
|
| Mage | 0.9530 | 0 | 0 | 150.375940 | 0.006650
|
| Warlock | 0.9530 | 0 | 0 | 150.375940 | 0.006650
|
| Druid | 0.9720 | 0 | 0 | 116.890707 | 0.008555
|
Returns
- avoidanceAfterDR
- number - avoidance after diminishing returns in percentages.
Example
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)
Arguments
- "avoidanceType"
- string - "DODGE", "PARRY", "MELEE_HIT_AVOID"(NYI)
- gainBeforeDR
- number - Avoidance gain before diminishing returns in percentages.
Notes
- Calculates the avoidance gain after diminishing returns with player's current stats.
Returns
- gainAfterDR
- number - Avoidance gain after diminishing returns in percentages.
Example
-- 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])
Arguments
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- 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.
Returns
- dodge
- number - Base dodge in percentages
- statid
- string - "DODGE"
Example
local baseDodge = StatLogic:GetBaseDodge()
local baseDodge = StatLogic:GetBaseDodge("WARRIOR")
string or number
:GetBlockValueFromStr(str [, class])
Arguments
- str
- number - Strength
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- Calculates the block value from strength for given class.
- Player level does not effect block value per strength.
Returns
- blockValue
- number - Block value
- statid
- string - "BLOCK_VALUE"
Example
local bv = StatLogic:GetBlockValueFromStr(1) -- GetBlockValuePerStr
local bv = StatLogic:GetBlockValueFromStr(10)
local bv = StatLogic:GetBlockValueFromStr(10, "WARRIOR")
string or number
:GetBlockValuePerStr([class])
Arguments
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- Gets the block value per strength for given class.
- Player level does not effect block value per strength.
Returns
- blockValue
- number - Block value per strength
- statid
- string - "BLOCK_VALUE"
Example
local blockPerStr = StatLogic:GetBlockValuePerStr()
local blockPerStr = StatLogic:GetBlockValuePerStr("WARRIOR")
:GetClassIdOrName(class)
Arguments
- class
- number or string - ClassID or "ClassName"
Notes
- 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"
|
Returns
None
Example
StatLogic:GetClassIdOrName("WARRIOR") -- 1
StatLogic:GetClassIdOrName(10) -- "DRUID"
string or number
number
:GetCritFromAgi(agi [, class] [, level])
Arguments
- 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
Notes
- CritPerAgi values reverse engineered by Whitetooth (hotdogee [at] gmail [dot] com)
- Calculates the melee/ranged crit chance from agility for given class and level.
Returns
- crit
- number - Melee/ranged crit percentage
- statid
- string - "MELEE_CRIT"
Example
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)
Arguments
- 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
Notes
- 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.
Returns
- 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,
- }
Example
StatLogic:GetDiff(21417, {}) -- Ring of Unspoken Names
StatLogic:GetDiff(21452) -- Staff of the Ruins
:GetDiffID(item , ignoreEnchant , ignoreGem , red , yellow , blue , meta)
Arguments
- 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
Notes
- 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.
Returns
- 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
Example
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()
Notes
- 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
Returns
- modDodge
- number - The part that is affected by diminishing returns.
- drFreeDodge
- number - The part that isn't affected by diminishing returns.
Example
local modDodge, drFreeDodge = StatLogic:GetDodgeChanceBeforeDR()
:GetDodgeFromAgi(agi)
Arguments
- agi
- number - Agility
Notes
- 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.
Returns
- dodge
- number - Dodge percentage
- statid
- string - "DODGE"
Example
local dodge = StatLogic:GetDodgeFromAgi(1) -- GetDodgePerAgi
local dodge = StatLogic:GetDodgeFromAgi(10)
:GetDodgePerAgi()
Notes
- 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)
Returns
- dodge
- number - Dodge percentage per agility
- statid
- string - "DODGE"
Example
local dodge, statid = StatLogic:GetDodgePerAgi()
string
number
:GetEffectFromDefense([defense] [, attackerLevel])
Arguments
- defense
- string - Total defense value. Default: player's armor value
- attackerLevel
- number - Attacker level. Default: player's level
Notes
- Calculates the effective avoidance% from defense (before diminishing returns) for given attacker level
Returns
- effect
- number - 0.04% per effective defense.
Example
local effect = StatLogic:GetEffectFromDefense(415, 83) -- 0
number
:GetEffectFromRating(rating , id [, level])
Arguments
- rating
- number - Rating value
- id
- number - Rating ID as defined in PaperDollFrame.lua
- level
- number - Level used in calculations. Default: player's level
Notes
- 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)
| RatingID | RatingBase
|
| CR_WEAPON_SKILL | 2.5
|
| CR_DEFENSE_SKILL | 1.5
|
| CR_DODGE | 12
|
| CR_PARRY | 15
|
| CR_BLOCK | 5
|
| CR_HIT_MELEE | 10
|
| CR_HIT_RANGED | 10
|
| CR_HIT_SPELL | 8
|
| CR_CRIT_MELEE | 14
|
| CR_CRIT_RANGED | 14
|
| CR_CRIT_SPELL | 14
|
| CR_HIT_TAKEN_MELEE | 10
|
| CR_HIT_TAKEN_RANGED | 10
|
| CR_HIT_TAKEN_SPELL | 8
|
| CR_CRIT_TAKEN_MELEE | 25
|
| CR_CRIT_TAKEN_RANGED | 25
|
| CR_CRIT_TAKEN_SPELL | 25
|
| CR_HASTE_MELEE | 10
|
| CR_HASTE_RANGED | 10
|
| CR_HASTE_SPELL | 10
|
| CR_WEAPON_SKILL_MAINHAND | 2.5
|
| CR_WEAPON_SKILL_OFFHAND | 2.5
|
| CR_WEAPON_SKILL_RANGED | 2.5
|
| CR_EXPERTISE | 2.5
|
| CR_ARMOR_PENETRATION | 4.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.
Returns
- effect
- number - Effect value
- effect name
- string - Stat ID of converted effect, ex: "DODGE", "PARRY"
Example
StatLogic:GetEffectFromRating(10, CR_DODGE)
StatLogic:GetEffectFromRating(10, CR_DODGE, 70)
:GetGemID(item)
Arguments
- item
- number or string or table - tooltip or itemId or "itemString" or "itemName" or "itemLink"
Notes
- 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.
Returns
- gemID
- number - The gemID of this gem
- gemText
- string - The text shown in the tooltip when socketed in an item
Example
local gemID, gemText = StatLogic:GetGemID(28363)
string or number
:GetHealthRegenFromSpi(spi [, class])
Arguments
- spi
- number - Spirit
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- 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.
Returns
- hp5oc
- number - Health regen per 5 seconds when out of combat
- statid
- string - "HEALTH_REG_OUT_OF_COMBAT"
Example
local hp5oc = StatLogic:GetHealthRegenFromSpi(1) -- GetHealthRegenPerSpi
local hp5oc = StatLogic:GetHealthRegenFromSpi(10)
local hp5oc = StatLogic:GetHealthRegenFromSpi(10, "MAGE")
number
number
:GetNormalManaRegenFromSpi(spi [, int] [, level])
Arguments
- spi
- number - Spirit
- int
- number - Intellect. Default: player's intellect
- level
- number - Level used in calculations. Default: player's level
Notes
- 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
Returns
- mp5o5sr
- number - Mana regen per 5 seconds when out of 5 second rule
- statid
- string - "MANA_REG_NOT_CASTING"
Example
local mp5o5sr = StatLogic:GetNormalManaRegenFromSpi(1) -- GetNormalManaRegenPerSpi
local mp5o5sr = StatLogic:GetNormalManaRegenFromSpi(10, 15)
local mp5o5sr = StatLogic:GetNormalManaRegenFromSpi(10, 15, 70)
}
:GetParryChanceBeforeDR()
Notes
- 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
Returns
- modParry
- number - The part that is affected by diminishing returns.
- drFreeParry
- number - The part that isn't affected by diminishing returns.
Example
local modParry, drFreeParry = StatLogic:GetParryChanceBeforeDR()
string or number
:GetRAPFromAgi(agi [, class])
Arguments
- agi
- number - Agility
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- Calculates the ranged attack power from agility for given class.
Returns
- rap
- number - Ranged attack power
- statid
- string - "RANGED_AP"
Example
local rap = StatLogic:GetRAPFromAgi(1) -- GetRAPPerAgi
local rap = StatLogic:GetRAPFromAgi(10)
local rap = StatLogic:GetRAPFromAgi(10, "WARRIOR")
string or number
:GetRAPPerAgi([class])
Arguments
- class
- string or number - ClassID or "ClassName". Default: PlayerClass
See :GetClassIdOrName(class) for valid class values.
Notes
- Gets the ranged attack power per agility for given class.
- Player level does not effect ranged attack power per agility.
Returns
- rap
- number - Ranged attack power per agility
- statid
- string - "RANGED_AP"
Example
local rapPerAgi = StatLogic:GetRAPPerAgi()
local rapPerAgi = StatLogic:GetRAPPerAgi("HUNTER")
:GetRatingIdOrStatId(rating)
Arguments
- rating
- number or string - RatingID or "StatID"
Notes
- 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"
|
Returns
None
Example
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])
Arguments
- armor
- string - Armor value. Default: player's armor value
- attackerLevel
- number - Attacker level. Default: player's level
Notes
- Calculates the damage reduction from armor for given attacker level.
Returns
- damageRecudtion
- number - Damage reduction value from 0 to 1. (not percentage)
Example
local damageRecudtion = StatLogic:GetReductionFromArmor(35000, 80) -- 0.69676006569452
string or number
number
:GetSpellCritFromInt(int [, class] [, level])
Arguments
- 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
Notes
- SpellCritPerInt values reverse engineered by Whitetooth (hotdogee [at] gmail [dot] com)
- Calculates the spell crit chance from intellect for given class and level.
Returns
- spellcrit
- number - Spell crit percentage
- statid
- string - "SPELL_CRIT"
Example
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])
Arguments
- "stat"
- string - The type of stat mod you want to get
- school
- string - Certain stat mods require an extra school argument
Notes
- 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
| "StatMod" | Initial value | Final adjust | schoo required
|
| "ADD_CRIT_TAKEN" | 0 | 0 | Yes
|
| "ADD_HIT_TAKEN" | 0 | 0 | Yes
|
| "ADD_DODGE" | 0 | 0 | No
|
| "ADD_AP_MOD_INT" | 0 | 0 | No
|
| "ADD_AP_MOD_STA" | 0 | 0 | No
|
| "ADD_AP_MOD_ARMOR" | 0 | 0 | No
|
| "ADD_AP_MOD_SPELL_DMG" | 0 | 0 | No
|
| "ADD_CR_PARRY_MOD_STR" | 0 | 0 | No
|
| "ADD_MANA_REG_MOD_INT" | 0 | 0 | No
|
| "ADD_RANGED_AP_MOD_INT" | 0 | 0 | No
|
| "ADD_ARMOR_MOD_INT" | 0 | 0 | No
|
| "ADD_SCHOOL_SP_MOD_SPI" | 0 | 0 | Yes
|
| "ADD_SPELL_DMG_MOD_AP" | 0 | 0 | No
|
| "ADD_SPELL_DMG_MOD_STA" | 0 | 0 | No
|
| "ADD_SPELL_DMG_MOD_INT" | 0 | 0 | No
|
| "ADD_SPELL_DMG_MOD_SPI" | 0 | 0 | No
|
| "ADD_HEALING_MOD_AP" | 0 | 0 | No
|
| "ADD_HEALING_MOD_STR" | 0 | 0 | No
|
| "ADD_HEALING_MOD_AGI" | 0 | 0 | No
|
| "ADD_HEALING_MOD_STA" | 0 | 0 | No
|
| "ADD_HEALING_MOD_INT" | 0 | 0 | No
|
| "ADD_HEALING_MOD_SPI" | 0 | 0 | No
|
| "ADD_MANA_REG_MOD_NORMAL_MANA_REG" | 0 | 0 | No
|
| "MOD_CRIT_DAMAGE_TAKEN" | 0 | 1 | Yes
|
| "MOD_DMG_TAKEN" | 0 | 1 | Yes
|
| "MOD_CRIT_DAMAGE" | 0 | 1 | Yes
|
| "MOD_DMG" | 0 | 1 | Yes
|
| "MOD_ARMOR" | 1 | 0 | No
|
| "MOD_HEALTH" | 1 | 0 | No
|
| "MOD_MANA" | 1 | 0 | No
|
| "MOD_STR" | 0 | 1 | No
|
| "MOD_AGI" | 0 | 1 | No
|
| "MOD_STA" | 0 | 1 | No
|
| "MOD_INT" | 0 | 1 | No
|
| "MOD_SPI" | 0 | 1 | No
|
| "MOD_BLOCK_VALUE" | 0 | 1 | No
|
| "MOD_AP" | 0 | 1 | No
|
| "MOD_RANGED_AP" | 0 | 1 | No
|
| "MOD_SPELL_DMG" | 0 | 1 | No
|
| "MOD_HEALING" | 0 | 1
|
Returns
None
Example
StatLogic:GetClassIdOrName("MOD_STR")
StatLogic:GetClassIdOrName(10)
:GetStatNameFromID("stat")
Arguments
- "stat"
- string - "StatID". ex: "DODGE", "DODGE_RATING"
Notes
- Returns localized names for stat
Returns
- "longName"
- string - The full name for stat.
- "shortName"
- string - The short name for stat.
Example
local longName, shortName = StatLogic:GetStatNameFromID("FIRE_RES") -- "Fire Resistance", "FR"
:GetSum(item , table)
Arguments
- 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
Notes
- 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.
Returns
- sumTable
- table - The table with stat sum values
- {
- ["itemType"] = itemType,
- ["STAT_ID1"] = value,
- ["STAT_ID2"] = value,
- }
Example
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])
Arguments
- "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
Notes
- Add/Replace item's enchants or gems with given enchants or gems.
Returns
- link
- number - The modified link
Example
local link = StatLogic:ModEnchantGem("Hitem:31052:0:0:0:0:0:0:0", 1394)
:RemoveEnchant("link")
Arguments
- "link"
- string - "itemlink"
Notes
Returns
- link
- number - The modified link
Example
local link = StatLogic:RemoveEnchant("Hitem:31052:425:525:525:525:525:0:0")
:RemoveEnchantGem("link")
Arguments
- "link"
- string - "itemlink"
Notes
- Remove item's gems and enchants.
Returns
- link
- number - The modified link
Example
local link = StatLogic:RemoveEnchantGem("Hitem:31052:425:525:525:525:525:0:0")
:RemoveGem("link")
Arguments
- "link"
- string - "itemlink"
Notes
Returns
- link
- number - The modified link
Example
local link = StatLogic:RemoveGem("Hitem:31052:425:525:525:525:525:0:0")
:SetTip(item)
Arguments
- item
- number or string - itemId or "itemString" or "itemName" or "itemLink"
Notes
- 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.
Returns
None
Example
StatLogic:SetTip("item:3185:0:0:0:0:0:1957")
------------------------------------------------------------------------
r93 | Whitetooth | 2009-12-08 20:45:27 +0000 (Tue, 08 Dec 2009) | 1 line
Changed paths:
M /trunk/LibStatLogic-1.1.toc
- toc 30300
------------------------------------------------------------------------
r92 | Whitetooth | 2009-11-07 17:15:58 +0000 (Sat, 07 Nov 2009) | 1 line
Changed paths:
M /trunk/LibStatLogic-1.1/LibStatLogic-1.1.lua
- Optimized StatModTable for load time
------------------------------------------------------------------------
r91 | Whitetooth | 2009-11-07 17:02:16 +0000 (Sat, 07 Nov 2009) | 1 line
Changed paths:
M /trunk/LibStatLogic-1.1/LibStatLogic-1.1.lua
- Improved support for Warlock: Demonic Knowledge: Now uses ADD_SPELL_DMG_MOD_PET_STA, ADD_SPELL_DMG_MOD_PET_INT, ADD_PET_STA_MOD_STA, ADD_PET_INT_MOD_INT. Where PET_BONUS_STAM is actually 0.75 instead of 0.3.
------------------------------------------------------------------------
r90 | Whitetooth | 2009-10-01 17:57:45 +0000 (Thu, 01 Oct 2009) | 1 line
Changed paths:
M /trunk/LibStatLogic-1.1/LibStatLogic-1.1.lua
- Fixed itemset detection
------------------------------------------------------------------------
Installation Guide
- Exit "World of Warcraft" completely
- Download the mod you want to install
- Make a folder on your desktop called "My Mods"
- Save the .zip/.rar files to this folder.
- If, when you try to download the file, it automatically "opens" it... you need to RIGHT click on the link and "save as..." or "Save Target As".
- Extract the file - commonly known as 'unzipping'
Do this ONE FILE AT A TIME!
- Windows
- Windows XP has a built in ZIP extractor. Double click on the file to open it, inside should be the file or folders needed. Copy these outside to the "My Mods" folder.
- WinRAR: Right click the file, select "Extract Here"
- WinZip: You MUST make sure the option to "Use Folder Names" is CHECKED or it will just extract the files and not make the proper folders how the Authors designed
- Mac Users
- StuffitExpander: Double click the archive to extract it to a folder in the current directory.
- Verify your WoW Installation Path
That is where you are running WoW from and THAT is where you need to install your mods.
- Move to the Addon folder
- Open your World of Warcraft folder. (default is C:\Program Files\World of Warcraft\)
- Go into the "Interface" folder.
- Go into the "AddOns" folder.
- In a new window, open the "My Mods" folder.
- The "My Mods" folder should have the "Addonname" folder in it.
- Move the "Addonname" folder into the "AddOns" folder
- Start World of Warcraft
- Make sure AddOns are installed
- Log in
- At the Character Select screen, look in lower left corner for the "addons" button.
- If button is there: make sure all the mods you installed are listed and make sure "load out of date addons" is checked.
- If the button is NOT there: means you did not install the addons properly. Look at the above screenshots. Try repeating the steps or getting someone who knows more about computers than you do to help.
Translations
When you download a mod, please be sure that the mod is compatible with your translation of wow. Some mods only work on the US versions, while some only work on some of the various European versions. These variations are called "Localizations".
TOC Numbers (Out of Date Mods)
When Blizzard patches WoW, they change the Interface number. This means that all mods will be "out of date" unless or until the author releases a new version for that interface. Some people go into the .toc files and update the numbers themselves, but this is STRONGLY advised against as it will cause problems locating possible incompatibilities addons. When you log into WoW after a patch, you DO NOT have to delete your interface directory. All you have to do is simply tell WoW to ignore the interface numbers and load all the mods anyway. All you have to do is, while at the "character select" screen, look in the lower left corner and click on the "addons" button. A window will pop up listing all your installed mods.
If you look in the upper left corner of that window there should be a box that says "Load Out of Date AddOns". You want to CHECK this box. Now simply go into WoW normally and all your mods should load. As of the 1.9 patch, you will have to do this after EVERY patch/update that Blizzard posts! If you encounter any problems with a mod after a patch, please be sure to let the author of the mod know so they can fix it.
See also: About "Out Of Date AddOns"
Mac Support
WoW addons are not platformed based. As such, they can be used on either Mac or PC. You can extract both .zip and .rar files on a Mac using StuffitExpander.
Directory Structure
World of Warcraft
|_ Interface
|_AddOns
|_*AddonName*
|_ *AddonName*.toc
|_ *AddonName*.xml
|_ *AddonName*.lua
|_ (possibly others as well)...