comparison Main.lua @ 140:f45ff137cf8f

Improved detection of fishing nodes on mouseover.
author James D. Callahan III <jcallahan@curse.com>
date Thu, 27 Sep 2012 06:39:41 -0500
parents aa48190cb5eb
children 2c2b7d91ca19
comparison
equal deleted inserted replaced
139:aa48190cb5eb 140:f45ff137cf8f
56 CHAT_MSG_MONSTER_WHISPER = "RecordQuote", 56 CHAT_MSG_MONSTER_WHISPER = "RecordQuote",
57 CHAT_MSG_MONSTER_YELL = "RecordQuote", 57 CHAT_MSG_MONSTER_YELL = "RecordQuote",
58 CHAT_MSG_SYSTEM = true, 58 CHAT_MSG_SYSTEM = true,
59 COMBAT_LOG_EVENT_UNFILTERED = true, 59 COMBAT_LOG_EVENT_UNFILTERED = true,
60 COMBAT_TEXT_UPDATE = true, 60 COMBAT_TEXT_UPDATE = true,
61 CURSOR_UPDATE = true,
61 FORGE_MASTER_OPENED = true, 62 FORGE_MASTER_OPENED = true,
62 GOSSIP_SHOW = true, 63 GOSSIP_SHOW = true,
63 GUILDBANKFRAME_OPENED = true, 64 GUILDBANKFRAME_OPENED = true,
64 ITEM_TEXT_BEGIN = true, 65 ITEM_TEXT_BEGIN = true,
65 LOOT_CLOSED = true, 66 LOOT_CLOSED = true,
1027 npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier) 1028 npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier)
1028 end 1029 end
1029 end -- do-block 1030 end -- do-block
1030 1031
1031 1032
1033 function WDP:CURSOR_UPDATE(event_name)
1034 if current_action.fishing_target or _G.Minimap:IsMouseOver() or not private.SPELL_FLAGS_BY_LABEL[current_action.spell_label] then
1035 return
1036 end
1037 local text = _G["GameTooltipTextLeft1"]:GetText()
1038
1039 if not text or text == "Fishing Bobber" then
1040 text = "NONE"
1041 else
1042 current_action.fishing_target = true
1043 end
1044 current_action.identifier = ("%s:%s"):format(current_action.spell_label, text)
1045 end
1046
1047
1032 function WDP:ITEM_TEXT_BEGIN(event_name) 1048 function WDP:ITEM_TEXT_BEGIN(event_name)
1033 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc")) 1049 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc"))
1034 1050
1035 if not unit_idnum or unit_type ~= private.UNIT_TYPES.OBJECT or _G.UnitName("npc") ~= _G.ItemTextGetItem() then 1051 if not unit_idnum or unit_type ~= private.UNIT_TYPES.OBJECT or _G.UnitName("npc") ~= _G.ItemTextGetItem() then
1036 return 1052 return
1086 current_action.identifier = id_num 1102 current_action.identifier = id_num
1087 return true 1103 return true
1088 end, 1104 end,
1089 [AF.OBJECT] = true, 1105 [AF.OBJECT] = true,
1090 [AF.ZONE] = function() 1106 [AF.ZONE] = function()
1091 return _G.IsFishingLoot() 1107 if not _G.IsFishingLoot() then
1108 return false
1109 end
1110 current_action.zone_data = UpdateDBEntryLocation("zones", current_action.identifier)
1111 return true
1092 end, 1112 end,
1093 } 1113 }
1094 1114
1095 1115
1096 local LOOT_UPDATE_FUNCS = { 1116 local LOOT_UPDATE_FUNCS = {
1737 return 1757 return
1738 end 1758 end
1739 current_action.object_name = target_name 1759 current_action.object_name = target_name
1740 current_action.target_type = AF.OBJECT 1760 current_action.target_type = AF.OBJECT
1741 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then 1761 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then
1742 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name.
1743 current_action.zone_data = UpdateDBEntryLocation("zones", identifier)
1744 current_action.target_type = AF.ZONE 1762 current_action.target_type = AF.ZONE
1745 current_action.identifier = identifier
1746 end 1763 end
1747 end 1764 end
1748 private.tracked_line = spell_line 1765 private.tracked_line = spell_line
1749 end 1766 end
1750 1767