comparison Main.lua @ 522:39c3576943ba

Added a debug message for Ephemeral Crystals and switched to the localized reference for 'type'.
author MMOSimca <mmosimca@gmail.com>
date Wed, 16 Nov 2016 04:00:23 -0500
parents 3fee2a08fdaa
children 4d8f02877b4f
comparison
equal deleted inserted replaced
521:cafa3a30dff8 522:39c3576943ba
955 Debug(...) 955 Debug(...)
956 end 956 end
957 end 957 end
958 local func = EVENT_MAPPING[event_name] 958 local func = EVENT_MAPPING[event_name]
959 959
960 if _G.type(func) == "boolean" then 960 if type(func) == "boolean" then
961 self[event_name](self, ...) 961 self[event_name](self, ...)
962 elseif _G.type(func) == "function" then 962 elseif type(func) == "function" then
963 self[func](self, ...) 963 self[func](self, ...)
964 end 964 end
965 end 965 end
966 966
967 967
970 970
971 for event_name, mapping in pairs(EVENT_MAPPING) do 971 for event_name, mapping in pairs(EVENT_MAPPING) do
972 if EVENT_DEBUG then 972 if EVENT_DEBUG then
973 self:RegisterEvent(event_name, "EventDispatcher") 973 self:RegisterEvent(event_name, "EventDispatcher")
974 else 974 else
975 self:RegisterEvent(event_name, (_G.type(mapping) ~= "boolean") and mapping or nil) 975 self:RegisterEvent(event_name, (type(mapping) ~= "boolean") and mapping or nil)
976 end 976 end
977 end 977 end
978 978
979 -- Gather known languages 979 -- Gather known languages
980 for index = 1, _G.GetNumLanguages() do 980 for index = 1, _G.GetNumLanguages() do
2160 return 2160 return
2161 end 2161 end
2162 local location_token = ("%d:%d:%d"):format(current_loot.map_level, current_loot.x, current_loot.y) 2162 local location_token = ("%d:%d:%d"):format(current_loot.map_level, current_loot.x, current_loot.y)
2163 2163
2164 -- This will start life as a boolean true. 2164 -- This will start life as a boolean true.
2165 if _G.type(current_loot.zone_data[location_token]) ~= "table" then 2165 if type(current_loot.zone_data[location_token]) ~= "table" then
2166 current_loot.zone_data[location_token] = { 2166 current_loot.zone_data[location_token] = {
2167 drops = {} 2167 drops = {}
2168 } 2168 }
2169 end 2169 end
2170 local loot_count = ("%s_count"):format(current_loot.label) 2170 local loot_count = ("%s_count"):format(current_loot.label)
2340 if not verify_func or not update_func then 2340 if not verify_func or not update_func then
2341 Debug("%s: The current action's target type is unsupported or nil.", event_name) 2341 Debug("%s: The current action's target type is unsupported or nil.", event_name)
2342 return 2342 return
2343 end 2343 end
2344 2344
2345 if _G.type(verify_func) == "function" and not verify_func() then 2345 if type(verify_func) == "function" and not verify_func() then
2346 Debug("%s: The current action type, %s, is supported but has failed loot verification.", event_name, private.ACTION_TYPE_NAMES[current_action.target_type]) 2346 Debug("%s: The current action type, %s, is supported but has failed loot verification.", event_name, private.ACTION_TYPE_NAMES[current_action.target_type])
2347 return 2347 return
2348 end 2348 end
2349 local guids_used = {} 2349 local guids_used = {}
2350 2350
3013 end 3013 end
3014 3014
3015 -- For Ephemeral Crystals (uses a combination of mouseover text and a 'Update Interactions' spell cast to detect the object - this is incredibly hacky but there is no alternative) 3015 -- For Ephemeral Crystals (uses a combination of mouseover text and a 'Update Interactions' spell cast to detect the object - this is incredibly hacky but there is no alternative)
3016 local text = _G["GameTooltipTextLeft1"] and _G["GameTooltipTextLeft1"]:GetText() or nil 3016 local text = _G["GameTooltipTextLeft1"] and _G["GameTooltipTextLeft1"]:GetText() or nil
3017 if spell_id == SPELL_ID_UPDATE_INTERACTIONS and text and text == "Ephemeral Crystal" then 3017 if spell_id == SPELL_ID_UPDATE_INTERACTIONS and text and text == "Ephemeral Crystal" then
3018 Debug("%s: Detected location for an Ephemeral Crystal.", event_name)
3018 for index = 1, #private.EPHEMERAL_CRYSTAL_OBJECT_IDS do 3019 for index = 1, #private.EPHEMERAL_CRYSTAL_OBJECT_IDS do
3019 UpdateDBEntryLocation("objects", private.EPHEMERAL_CRYSTAL_OBJECT_IDS[index]) 3020 UpdateDBEntryLocation("objects", private.EPHEMERAL_CRYSTAL_OBJECT_IDS[index])
3020 end 3021 end
3021 end 3022 end
3022 3023