From 9f79b7c2d89d751db234170faf9d046ac89d3963 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Sun, 6 Apr 2014 18:47:22 +0000 Subject: [PATCH] Track combat ratings for critical strike, haste and mastery. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1280 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvalePaperDoll.lua | 14 ++++++++++++++ conditions/Snapshot.lua | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/OvalePaperDoll.lua b/OvalePaperDoll.lua index fb6d6f4..883cf9c 100644 --- a/OvalePaperDoll.lua +++ b/OvalePaperDoll.lua @@ -22,7 +22,9 @@ local OvaleStance = nil local OvaleState = nil local tonumber = tonumber +local API_GetCombatRating = GetCombatRating local API_GetCritChance = GetCritChance +local API_GetMastery = GetMastery local API_GetMasteryEffect = GetMasteryEffect local API_GetMeleeHaste = GetMeleeHaste local API_GetRangedCritChance = GetRangedCritChance @@ -40,6 +42,8 @@ local API_UnitLevel = UnitLevel local API_UnitRangedAttackPower = UnitRangedAttackPower local API_UnitSpellHaste = UnitSpellHaste local API_UnitStat = UnitStat +local CR_CRIT_MELEE = CR_CRIT_MELEE +local CR_HASTE_MELEE = CR_HASTE_MELEE -- Player's class. local _, self_class = API_UnitClass("player") @@ -103,6 +107,10 @@ OvalePaperDoll.SNAPSHOT_STATS = { -- percent increase to spell critical strike & haste spellCrit = { default = 0, description = "spell critical strike chance" }, spellHaste = { default = 0, description = "spell haste effect" }, + -- combat rating for mastery, critical strike & haste + masteryRating = { default = 0, description = "mastery rating" }, + critRating = { default = 0, description = "critical strike rating" }, + hasteRating = { default = 0, description = "haste rating" }, -- spellpower spellBonusDamage = { default = 0, description = "spell bonus damage" }, spellBonusHealing = { default = 0, description = "spell bonus healing" }, @@ -204,6 +212,8 @@ function OvalePaperDoll:COMBAT_RATING_UPDATE(event) snapshot.meleeCrit = API_GetCritChance() snapshot.rangedCrit = API_GetRangedCritChance() snapshot.spellCrit = API_GetSpellCritChance(OVALE_SPELLDAMAGE_SCHOOL[self_class]) + snapshot.critRating = API_GetCombatRating(CR_CRIT_MELEE) + snapshot.hasteRating = API_GetCombatRating(CR_HASTE_MELEE) Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, true, "%s", event) Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f%%", self.SNAPSHOT_STATS["meleeCrit"].description, snapshot.meleeCrit) Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, " %s = %f%%", self.SNAPSHOT_STATS["rangedCrit"].description, snapshot.rangedCrit) @@ -212,6 +222,7 @@ end function OvalePaperDoll:MASTERY_UPDATE(event) local snapshot = UpdateCurrentSnapshot() + snapshot.masteryRating = API_GetMastery() if self.level < 80 then snapshot.masteryEffect = 0 else @@ -470,6 +481,9 @@ function OvalePaperDoll:Debug(snapshot) Ovale:FormatPrint("%s: %f%%", self.SNAPSHOT_STATS["rangedCrit"].description, snapshot.rangedCrit) Ovale:FormatPrint("%s: %f%%", self.SNAPSHOT_STATS["rangedHaste"].description, snapshot.rangedHaste) Ovale:FormatPrint("%s: %f%%", self.SNAPSHOT_STATS["masteryEffect"].description, snapshot.masteryEffect) + Ovale:FormatPrint("%s: %f%%", self.SNAPSHOT_STATS["critRating"].description, snapshot.critRating) + Ovale:FormatPrint("%s: %f%%", self.SNAPSHOT_STATS["hasteRating"].description, snapshot.hasteRating) + Ovale:FormatPrint("%s: %f%%", self.SNAPSHOT_STATS["masteryRating"].description, snapshot.masteryRating) Ovale:FormatPrint("%s: %f", self.SNAPSHOT_STATS["baseDamageMultiplier"].description, snapshot.baseDamageMultiplier) Ovale:FormatPrint("%s: %f", self.SNAPSHOT_STATS["mainHandWeaponDamage"].description, snapshot.mainHandWeaponDamage) Ovale:FormatPrint("%s: %f", self.SNAPSHOT_STATS["offHandWeaponDamage"].description, snapshot.offHandWeaponDamage) diff --git a/conditions/Snapshot.lua b/conditions/Snapshot.lua index 88760d3..1133843 100644 --- a/conditions/Snapshot.lua +++ b/conditions/Snapshot.lua @@ -61,6 +61,30 @@ do return Snapshot("attackPower", 0, condition) end + --- Get the current critical strike rating of the player. + -- @name CritRating + -- @paramsig number or boolean + -- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more. + -- @param number Optional. The number to compare against. + -- @return The current critical strike rating. + -- @return A boolean value for the result of the comparison. + + local function CritRating(condition) + return Snapshot("critRating", 0, condition) + end + + --- Get the current haste rating of the player. + -- @name HasteRating + -- @paramsig number or boolean + -- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more. + -- @param number Optional. The number to compare against. + -- @return The current haste rating. + -- @return A boolean value for the result of the comparison. + + local function HasteRating(condition) + return Snapshot("hasteRating", 0, condition) + end + --- Get the current intellect of the player. -- @name Intellect -- @paramsig number or boolean @@ -91,6 +115,18 @@ do return Snapshot("masteryEffect", 0, condition) end + --- Get the current mastery rating of the player. + -- @name MasteryRating + -- @paramsig number or boolean + -- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more. + -- @param number Optional. The number to compare against. + -- @return The current mastery rating. + -- @return A boolean value for the result of the comparison. + + local function MasteryRating(condition) + return Snapshot("masteryRating", 0, condition) + end + --- Get the current melee critical strike chance of the player. -- @name MeleeCritChance -- @paramsig number or boolean @@ -214,9 +250,12 @@ do OvaleCondition:RegisterCondition("agility", false, Agility) OvaleCondition:RegisterCondition("attackpower", false, AttackPower) + OvaleCondition:RegisterCondition("critrating", false, CritRating) + OvaleCondition:RegisterCondition("hasterating", false, HasteRating) OvaleCondition:RegisterCondition("intellect", false, Intellect) OvaleCondition:RegisterCondition("mastery", false, MasteryEffect) OvaleCondition:RegisterCondition("masteryeffect", false, MasteryEffect) + OvaleCondition:RegisterCondition("masteryrating", false, MasteryRating) OvaleCondition:RegisterCondition("meleecritchance", false, MeleeCritChance) OvaleCondition:RegisterCondition("rangedcritchance", false, RangedCritChance) OvaleCondition:RegisterCondition("spellcritchance", false, SpellCritChance) -- 1.7.9.5