Mercurial > wow > wowdb-profiler
comparison Main.lua @ 156:749fdb864fdf
Queue current_area_id updates and prevent any coordinate collection while in combat.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Fri, 05 Oct 2012 15:24:34 -0500 |
parents | 0c4a6ea88403 |
children | d16d4848f059 |
comparison
equal
deleted
inserted
replaced
155:0c4a6ea88403 | 156:749fdb864fdf |
---|---|
32 ----------------------------------------------------------------------- | 32 ----------------------------------------------------------------------- |
33 -- Local constants. | 33 -- Local constants. |
34 ----------------------------------------------------------------------- | 34 ----------------------------------------------------------------------- |
35 local DB_VERSION = 10 | 35 local DB_VERSION = 10 |
36 local DEBUGGING = false | 36 local DEBUGGING = false |
37 local EVENT_DEBUG = false | |
37 | 38 |
38 local DATABASE_DEFAULTS = { | 39 local DATABASE_DEFAULTS = { |
39 char = {}, | 40 char = {}, |
40 global = { | 41 global = { |
41 items = {}, | 42 items = {}, |
70 MERCHANT_CLOSED = true, | 71 MERCHANT_CLOSED = true, |
71 MERCHANT_SHOW = "UpdateMerchantItems", | 72 MERCHANT_SHOW = "UpdateMerchantItems", |
72 MERCHANT_UPDATE = "UpdateMerchantItems", | 73 MERCHANT_UPDATE = "UpdateMerchantItems", |
73 PET_BAR_UPDATE = true, | 74 PET_BAR_UPDATE = true, |
74 PET_JOURNAL_LIST_UPDATE = true, | 75 PET_JOURNAL_LIST_UPDATE = true, |
76 PLAYER_REGEN_DISABLED = true, | |
77 PLAYER_REGEN_ENABLED = true, | |
75 PLAYER_TARGET_CHANGED = true, | 78 PLAYER_TARGET_CHANGED = true, |
76 QUEST_COMPLETE = true, | 79 QUEST_COMPLETE = true, |
77 QUEST_DETAIL = true, | 80 QUEST_DETAIL = true, |
78 QUEST_LOG_UPDATE = true, | 81 QUEST_LOG_UPDATE = true, |
79 QUEST_PROGRESS = true, | 82 QUEST_PROGRESS = true, |
252 return npc | 255 return npc |
253 end | 256 end |
254 | 257 |
255 | 258 |
256 local function CurrentLocationData() | 259 local function CurrentLocationData() |
257 if _G.WorldMapFrame:IsVisible() then | 260 if _G.WorldMapFrame:IsVisible() or private.in_combat then |
258 Debug("Map is opened. Returning 0, 0 for x, y") | |
259 return _G.GetRealZoneText(), current_area_id, 0, 0, 0, InstanceDifficultyToken() | 261 return _G.GetRealZoneText(), current_area_id, 0, 0, 0, InstanceDifficultyToken() |
260 end | 262 end |
261 WDP:SetCurrentAreaID() | 263 WDP:SetCurrentAreaID() |
262 | 264 |
263 local map_level = _G.GetCurrentMapDungeonLevel() or 0 | 265 local map_level = _G.GetCurrentMapDungeonLevel() or 0 |
607 ShrineofTwoMoons = 903, | 609 ShrineofTwoMoons = 903, |
608 ShrineofSevenStars = 905, | 610 ShrineofSevenStars = 905, |
609 } | 611 } |
610 | 612 |
611 function WDP:SetCurrentAreaID(event_name) | 613 function WDP:SetCurrentAreaID(event_name) |
614 if private.in_combat then | |
615 private.set_area_id = true | |
616 return | |
617 end | |
612 local map_area_id = _G.GetCurrentMapAreaID() | 618 local map_area_id = _G.GetCurrentMapAreaID() |
613 | 619 |
614 if map_area_id == current_area_id then | 620 if map_area_id == current_area_id then |
615 return | 621 return |
616 end | 622 end |
675 local func = EVENT_MAPPING[event_name] | 681 local func = EVENT_MAPPING[event_name] |
676 | 682 |
677 if _G.type(func) == "boolean" then | 683 if _G.type(func) == "boolean" then |
678 self[event_name](self, ...) | 684 self[event_name](self, ...) |
679 elseif _G.type(func) == "function" then | 685 elseif _G.type(func) == "function" then |
680 EVENT_MAPPING[event_name](self, ...) | 686 self[EVENT_MAPPING[event_name]](self, ...) |
681 end | 687 end |
682 end | 688 end |
683 | 689 |
684 | 690 |
685 function WDP:OnEnable() | 691 function WDP:OnEnable() |
686 for event_name, mapping in pairs(EVENT_MAPPING) do | 692 for event_name, mapping in pairs(EVENT_MAPPING) do |
687 if DEBUGGING then | 693 if EVENT_DEBUG then |
688 self:RegisterEvent(event_name, "EventDispatcher") | 694 self:RegisterEvent(event_name, "EventDispatcher") |
689 else | 695 else |
690 self:RegisterEvent(event_name, (_G.type(mapping) ~= "boolean") and mapping or nil) | 696 self:RegisterEvent(event_name, (_G.type(mapping) ~= "boolean") and mapping or nil) |
691 end | 697 end |
692 end | 698 end |
1590 end | 1596 end |
1591 end | 1597 end |
1592 end | 1598 end |
1593 | 1599 |
1594 | 1600 |
1601 function WDP:PLAYER_REGEN_DISABLED(event_name) | |
1602 private.in_combat = true | |
1603 end | |
1604 | |
1605 | |
1606 function WDP:PLAYER_REGEN_ENABLED(event_name) | |
1607 private.in_combat = nil | |
1608 | |
1609 if private.set_area_id then | |
1610 self:SetCurrentAreaID(event_name) | |
1611 private.set_area_id = nil | |
1612 end | |
1613 end | |
1614 | |
1615 | |
1595 function WDP:PLAYER_TARGET_CHANGED(event_name) | 1616 function WDP:PLAYER_TARGET_CHANGED(event_name) |
1596 if not PlayerTarget() then | 1617 if not PlayerTarget() then |
1597 return | 1618 return |
1598 end | 1619 end |
1599 current_action.target_type = AF.NPC | 1620 current_action.target_type = AF.NPC |