comparison Main.lua @ 8:1b4111ac80c6

Return the instance type (NONE included) in CurrentLocationData()
author James D. Callahan III <jcallahan@curse.com>
date Mon, 30 Apr 2012 10:49:10 -0500
parents 17900d196389
children 796bf179557a
comparison
equal deleted inserted replaced
7:17900d196389 8:1b4111ac80c6
100 end 100 end
101 101
102 if _G.DungeonUsesTerrainMap() then 102 if _G.DungeonUsesTerrainMap() then
103 map_level = map_level - 1 103 map_level = map_level - 1
104 end 104 end
105 return _G.GetRealZoneText(), ("%.2f"):format(x * 100), ("%.2f"):format(y * 100), map_level or 0 105 local _, instance_type = _G.IsInInstance()
106 return _G.GetRealZoneText(), ("%.2f"):format(x * 100), ("%.2f"):format(y * 100), map_level or 0, instance_type:upper()
106 end 107 end
107 108
108 109
109 local function ItemLinkToID(item_link) 110 local function ItemLinkToID(item_link)
110 if not item_link then 111 if not item_link then
199 local unit_type, unit_idnum = self:ParseGUID(_G.UnitGUID("target")) 200 local unit_type, unit_idnum = self:ParseGUID(_G.UnitGUID("target"))
200 201
201 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then 202 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then
202 return 203 return
203 end 204 end
204 local zone_name, x, y, map_level = CurrentLocationData() 205 local zone_name, x, y, map_level, instance_type = CurrentLocationData()
205 local npc_data = NPCEntry(unit_idnum).stats[("level_%d"):format(_G.UnitLevel("target"))] 206 local npc_data = NPCEntry(unit_idnum).stats[("level_%d"):format(_G.UnitLevel("target"))]
206 npc_data.locations = npc_data.locations or {} 207 npc_data.locations = npc_data.locations or {}
207 208
208 if not npc_data.locations[zone_name] then 209 if not npc_data.locations[zone_name] then
209 npc_data.locations[zone_name] = {} 210 npc_data.locations[zone_name] = {}
210 end 211 end
211 npc_data.locations[zone_name][("%s:%s:%s"):format(map_level, x, y)] = true 212 npc_data.locations[zone_name][("%s:%s:%s:%s"):format(instance_type, map_level, x, y)] = true
212 end 213 end
213 214
214 215
215 ----------------------------------------------------------------------- 216 -----------------------------------------------------------------------
216 -- Event handlers. 217 -- Event handlers.
476 if not tt_item_name and not tt_unit_name then 477 if not tt_item_name and not tt_unit_name then
477 if target_name == "" then 478 if target_name == "" then
478 return 479 return
479 end 480 end
480 481
481 local zone_name, x, y, map_level = CurrentLocationData() 482 local zone_name, x, y, map_level, instance_type = CurrentLocationData()
482 483
483 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then 484 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then
485 action_data.instance_type = instance_type
484 action_data.map_level = map_level 486 action_data.map_level = map_level
485 action_data.name = target_name 487 action_data.name = target_name
486 action_data.type = AF.OBJECT 488 action_data.type = AF.OBJECT
487 action_data.x = x 489 action_data.x = x
488 action_data.y = y 490 action_data.y = y