Mercurial > wow > wowdb-profiler
comparison Main.lua @ 337:48f7f671fc77 WoD
Moved two constant tables to Constants.lua and restructured a pair of them to be a single table. Replaced UnitManaMax with UnitPowerMax (other was deprecated).
| author | MMOSimca <MMOSimca@gmail.com> |
|---|---|
| date | Fri, 05 Sep 2014 01:50:04 -0400 |
| parents | cba0e57a71b7 |
| children | 9b683a560ed3 |
comparison
equal
deleted
inserted
replaced
| 336:cba0e57a71b7 | 337:48f7f671fc77 |
|---|---|
| 46 local PLAYER_FACTION = _G.UnitFactionGroup("player") | 46 local PLAYER_FACTION = _G.UnitFactionGroup("player") |
| 47 local PLAYER_GUID | 47 local PLAYER_GUID |
| 48 local PLAYER_NAME = _G.UnitName("player") | 48 local PLAYER_NAME = _G.UnitName("player") |
| 49 local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) | 49 local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) |
| 50 | 50 |
| 51 -- Ignoring NPC casts of the following spells | |
| 51 local CHI_WAVE_SPELL_ID = 132464 | 52 local CHI_WAVE_SPELL_ID = 132464 |
| 52 local DISGUISE_SPELL_ID = 121308 | 53 local DISGUISE_SPELL_ID = 121308 |
| 53 | 54 |
| 54 -- Constant for duplicate boss data; a dirty hack to get around world bosses that cannot be identified individually and cannot be linked on wowdb because they are not in a raid | 55 -- Constant for duplicate boss data; a dirty hack to get around world bosses that cannot be identified individually and cannot be linked on wowdb because they are not in a raid |
| 55 local DUPLICATE_WORLD_BOSS_IDS = { | 56 local DUPLICATE_WORLD_BOSS_IDS = { |
| 1116 encounter_data[npc_level] = level_data | 1117 encounter_data[npc_level] = level_data |
| 1117 end | 1118 end |
| 1118 level_data.max_health = level_data.max_health or _G.UnitHealthMax("target") | 1119 level_data.max_health = level_data.max_health or _G.UnitHealthMax("target") |
| 1119 | 1120 |
| 1120 if not level_data.power then | 1121 if not level_data.power then |
| 1121 local max_power = _G.UnitManaMax("target") | 1122 local max_power = _G.UnitPowerMax("target") |
| 1122 | 1123 |
| 1123 if max_power > 0 then | 1124 if max_power > 0 then |
| 1124 local power_type = _G.UnitPowerType("target") | 1125 local power_type = _G.UnitPowerType("target") |
| 1125 level_data.power = ("%s:%d"):format(POWER_TYPE_NAMES[tostring(power_type)] or power_type, max_power) | 1126 level_data.power = ("%s:%d"):format(POWER_TYPE_NAMES[tostring(power_type)] or power_type, max_power) |
| 1126 end | 1127 end |
| 1277 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) | 1278 table.insert(encounter_data[loot_label], ("money:%d"):format(quantity)) |
| 1278 elseif loot_type == "currency" then | 1279 elseif loot_type == "currency" then |
| 1279 local currency_texture = CurrencyLinkToTexture(item_link) | 1280 local currency_texture = CurrencyLinkToTexture(item_link) |
| 1280 if currency_texture and currency_texture ~= "" then | 1281 if currency_texture and currency_texture ~= "" then |
| 1281 Debug("%s: %s X %d", event_name, currency_texture, quantity) | 1282 Debug("%s: %s X %d", event_name, currency_texture, quantity) |
| 1282 -- workaround for Patch 5.4.0 bug with Flexible raid Siege of Orgrimmar bosses and Valor Points | 1283 -- Workaround for Patch 5.4.0 bug with Flexible raid Siege of Orgrimmar bosses and Valor Points |
| 1283 if quantity > 1000 and currency_texture == "pvecurrency-valor" then | 1284 if quantity > 1000 and currency_texture == "pvecurrency-valor" then |
| 1284 quantity = math.floor(quantity / 100) | 1285 quantity = math.floor(quantity / 100) |
| 1285 end | 1286 end |
| 1286 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) | 1287 table.insert(encounter_data[loot_label], ("currency:%d:%s"):format(quantity, currency_texture)) |
| 1287 else | 1288 else |
| 1572 if NON_DAMAGE_EVENTS[sub_event] then | 1573 if NON_DAMAGE_EVENTS[sub_event] then |
| 1573 table.wipe(previous_combat_event) | 1574 table.wipe(previous_combat_event) |
| 1574 end | 1575 end |
| 1575 end | 1576 end |
| 1576 | 1577 |
| 1578 | |
| 1577 local DIPLOMACY_SPELL_ID = 20599 | 1579 local DIPLOMACY_SPELL_ID = 20599 |
| 1578 local MR_POP_RANK1_SPELL_ID = 78634 | 1580 local MR_POP_RANK1_SPELL_ID = 78634 |
| 1579 local MR_POP_RANK2_SPELL_ID = 78635 | 1581 local MR_POP_RANK2_SPELL_ID = 78635 |
| 1580 | 1582 local FACTION_NAMES = private.FACTION_NAMES |
| 1581 local REP_BUFFS = { | 1583 local REP_BUFFS = private.REP_BUFFS |
| 1582 [_G.GetSpellInfo(30754)] = "CENARION_FAVOR", | |
| 1583 [_G.GetSpellInfo(24705)] = "GRIM_VISAGE", | |
| 1584 [_G.GetSpellInfo(32098)] = "HONOR_HOLD_FAVOR", | |
| 1585 [_G.GetSpellInfo(39913)] = "NAZGRELS_FERVOR", | |
| 1586 [_G.GetSpellInfo(39953)] = "SONG_OF_BATTLE", | |
| 1587 [_G.GetSpellInfo(61849)] = "SPIRIT_OF_SHARING", | |
| 1588 [_G.GetSpellInfo(32096)] = "THRALLMARS_FAVOR", | |
| 1589 [_G.GetSpellInfo(39911)] = "TROLLBANES_COMMAND", | |
| 1590 [_G.GetSpellInfo(95987)] = "UNBURDENED", | |
| 1591 [_G.GetSpellInfo(100951)] = "WOW_ANNIVERSARY", | |
| 1592 } | |
| 1593 | |
| 1594 | |
| 1595 local FACTION_NAMES = { | |
| 1596 CENARION_CIRCLE = _G.GetFactionInfoByID(609), | |
| 1597 HONOR_HOLD = _G.GetFactionInfoByID(946), | |
| 1598 THE_SHATAR = _G.GetFactionInfoByID(935), | |
| 1599 THRALLMAR = _G.GetFactionInfoByID(947), | |
| 1600 } | |
| 1601 | |
| 1602 | |
| 1603 local MODIFIERS = { | |
| 1604 CENARION_FAVOR = { | |
| 1605 faction = FACTION_NAMES.CENARION_CIRCLE, | |
| 1606 modifier = 0.25, | |
| 1607 }, | |
| 1608 GRIM_VISAGE = { | |
| 1609 modifier = 0.1, | |
| 1610 }, | |
| 1611 HONOR_HOLD_FAVOR = { | |
| 1612 faction = FACTION_NAMES.HONOR_HOLD, | |
| 1613 modifier = 0.25, | |
| 1614 }, | |
| 1615 NAZGRELS_FERVOR = { | |
| 1616 faction = FACTION_NAMES.THRALLMAR, | |
| 1617 modifier = 0.1, | |
| 1618 }, | |
| 1619 SONG_OF_BATTLE = { | |
| 1620 faction = FACTION_NAMES.THE_SHATAR, | |
| 1621 modifier = 0.1, | |
| 1622 }, | |
| 1623 SPIRIT_OF_SHARING = { | |
| 1624 modifier = 0.1, | |
| 1625 }, | |
| 1626 THRALLMARS_FAVOR = { | |
| 1627 faction = FACTION_NAMES.THRALLMAR, | |
| 1628 modifier = 0.25, | |
| 1629 }, | |
| 1630 TROLLBANES_COMMAND = { | |
| 1631 faction = FACTION_NAMES.HONOR_HOLD, | |
| 1632 modifier = 0.1, | |
| 1633 }, | |
| 1634 UNBURDENED = { | |
| 1635 modifier = 0.1, | |
| 1636 }, | |
| 1637 WOW_ANNIVERSARY = { | |
| 1638 modifier = 0.08, | |
| 1639 } | |
| 1640 } | |
| 1641 | 1584 |
| 1642 | 1585 |
| 1643 function WDP:COMBAT_TEXT_UPDATE(event_name, message_type, faction_name, amount) | 1586 function WDP:COMBAT_TEXT_UPDATE(event_name, message_type, faction_name, amount) |
| 1644 if message_type ~= "FACTION" or not killed_npc_id then | 1587 if message_type ~= "FACTION" or not killed_npc_id then |
| 1645 return | 1588 return |
| 1669 modifier = modifier + 0.1 | 1612 modifier = modifier + 0.1 |
| 1670 elseif _G.IsSpellKnown(MR_POP_RANK1_SPELL_ID) then | 1613 elseif _G.IsSpellKnown(MR_POP_RANK1_SPELL_ID) then |
| 1671 modifier = modifier + 0.05 | 1614 modifier = modifier + 0.05 |
| 1672 end | 1615 end |
| 1673 | 1616 |
| 1674 for buff_name, buff_label in pairs(REP_BUFFS) do | 1617 for buff_name, rep_data_table in pairs(REP_BUFFS) do |
| 1675 if _G.UnitBuff("player", buff_name) then | 1618 if _G.UnitBuff("player", buff_name) then |
| 1676 local modded_faction = MODIFIERS[buff_label].faction | 1619 local modded_faction = rep_data_table.faction |
| 1677 | 1620 |
| 1678 if not modded_faction or faction_name == modded_faction then | 1621 if not modded_faction or faction_name == modded_faction then |
| 1679 modifier = modifier + MODIFIERS[buff_label].modifier | 1622 modifier = modifier + rep_data_table.modifier |
| 1680 end | 1623 end |
| 1681 end | 1624 end |
| 1682 end | 1625 end |
| 1683 npc.reputations = npc.reputations or {} | 1626 npc.reputations = npc.reputations or {} |
| 1684 npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier) | 1627 npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier) |
