Mercurial > wow > wowdb-profiler
comparison Main.lua @ 21:a82c5d1134db
Record reputation gains from NPC deaths.
| author | James D. Callahan III <jcallahan@curse.com> |
|---|---|
| date | Wed, 09 May 2012 09:34:49 -0500 |
| parents | dae28edbbd61 |
| children | 7e4ce6371608 |
comparison
equal
deleted
inserted
replaced
| 20:dae28edbbd61 | 21:a82c5d1134db |
|---|---|
| 325 | 325 |
| 326 ----------------------------------------------------------------------- | 326 ----------------------------------------------------------------------- |
| 327 -- Event handlers. | 327 -- Event handlers. |
| 328 ----------------------------------------------------------------------- | 328 ----------------------------------------------------------------------- |
| 329 function WDP:COMBAT_TEXT_UPDATE(event, message_type, faction_name, amount) | 329 function WDP:COMBAT_TEXT_UPDATE(event, message_type, faction_name, amount) |
| 330 -- if message_type ~= "FACTION" or _G.UnitIsUnit("target", "questnpc") then | 330 local npc = DBEntry("npcs", action_data.id_num) |
| 331 -- return | 331 |
| 332 -- end | 332 if not npc then |
| 333 -- local unit_type, unit_idnum = self:ParseGUID(_G.UnitGUID("target")) | 333 return |
| 334 -- local npc = DBEntry("npcs", unit_idnum) | 334 end |
| 335 -- | 335 npc.stats[action_data.npc_level].reputations = npc.stats[action_data.npc_level].reputations or {} |
| 336 -- if not npc then | 336 npc.stats[action_data.npc_level].reputations[faction_name] = amount |
| 337 -- return | |
| 338 -- end | |
| 339 -- npc.reputations = npc.reputations or {} | |
| 340 -- npc.reputations[faction_name] = amount | |
| 341 -- | |
| 342 -- print(("%s: %s, %s, %s"):format(event, message_type, faction_name, amount)) | |
| 343 end | 337 end |
| 344 | 338 |
| 345 | 339 |
| 346 function WDP:LOOT_CLOSED() | 340 function WDP:LOOT_CLOSED() |
| 347 -- table.wipe(action_data) | 341 -- table.wipe(action_data) |
| 637 local unit_type, unit_idnum = self:ParseGUID(_G.UnitGUID("target")) | 631 local unit_type, unit_idnum = self:ParseGUID(_G.UnitGUID("target")) |
| 638 | 632 |
| 639 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then | 633 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then |
| 640 return | 634 return |
| 641 end | 635 end |
| 642 table.wipe(action_data) | |
| 643 | |
| 644 local npc = DBEntry("npcs", unit_idnum) | 636 local npc = DBEntry("npcs", unit_idnum) |
| 645 local _, class_token = _G.UnitClass("target") | 637 local _, class_token = _G.UnitClass("target") |
| 646 npc.class = class_token | 638 npc.class = class_token |
| 647 | 639 |
| 648 UpdateFactionNames() | 640 UpdateFactionNames() |
| 679 if max_power > 0 then | 671 if max_power > 0 then |
| 680 local power_type = _G.UnitPowerType("target") | 672 local power_type = _G.UnitPowerType("target") |
| 681 npc.stats[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) | 673 npc.stats[npc_level].power = ("%s:%d"):format(POWER_TYPE_NAMES[_G.tostring(power_type)] or power_type, max_power) |
| 682 end | 674 end |
| 683 end | 675 end |
| 676 table.wipe(action_data) | |
| 677 action_data.type = AF.NPC | |
| 678 action_data.id_num = unit_idnum | |
| 679 action_data.npc_level = npc_level | |
| 684 end | 680 end |
| 685 end -- do-block | 681 end -- do-block |
| 686 | 682 |
| 687 do | 683 do |
| 688 local function UpdateQuestJuncture(point) | 684 local function UpdateQuestJuncture(point) |
