comparison Main.lua @ 205:6cac044fd0f9

In the LOOT_OPENED NPC verify function, only set current_action.identifier to the unit_id of the player's target if the identifier is nil.
author James D. Callahan III <jcallahan@curse.com>
date Mon, 10 Dec 2012 16:20:06 -0600
parents 83fdf52f0310
children d401bf9aa80c
comparison
equal deleted inserted replaced
204:c68b7c7b6b92 205:6cac044fd0f9
1417 end, 1417 end,
1418 [AF.NPC] = function() 1418 [AF.NPC] = function()
1419 if not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then 1419 if not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then
1420 return false 1420 return false
1421 end 1421 end
1422 local unit_type, id_num = ParseGUID(_G.UnitGUID("target")) 1422
1423 current_action.identifier = id_num 1423 if not current_action.identifier then
1424 local unit_type, id_num = ParseGUID(_G.UnitGUID("target"))
1425 current_action.identifier = id_num
1426 end
1424 return true 1427 return true
1425 end, 1428 end,
1426 [AF.OBJECT] = true, 1429 [AF.OBJECT] = true,
1427 [AF.ZONE] = function() 1430 [AF.ZONE] = function()
1428 if not _G.IsFishingLoot() then 1431 if not _G.IsFishingLoot() then
1533 end 1536 end
1534 1537
1535 if not current_action.target_type then 1538 if not current_action.target_type then
1536 return 1539 return
1537 end 1540 end
1538
1539 local verify_func = LOOT_OPENED_VERIFY_FUNCS[current_action.target_type] 1541 local verify_func = LOOT_OPENED_VERIFY_FUNCS[current_action.target_type]
1540 local update_func = LOOT_OPENED_UPDATE_FUNCS[current_action.target_type] 1542 local update_func = LOOT_OPENED_UPDATE_FUNCS[current_action.target_type]
1541 1543
1542 if not verify_func or not update_func then 1544 if not verify_func or not update_func then
1543 return 1545 return
2009 local spell_label = private.SPELL_LABELS_BY_NAME[spell_name] 2011 local spell_label = private.SPELL_LABELS_BY_NAME[spell_name]
2010 2012
2011 if not spell_label then 2013 if not spell_label then
2012 return 2014 return
2013 end 2015 end
2014 table.wipe(current_action)
2015
2016 local item_name, item_link = _G.GameTooltip:GetItem() 2016 local item_name, item_link = _G.GameTooltip:GetItem()
2017 local unit_name, unit_id = _G.GameTooltip:GetUnit() 2017 local unit_name, unit_id = _G.GameTooltip:GetUnit()
2018 2018
2019 if not unit_name and _G.UnitName("target") == target_name then 2019 if not unit_name and _G.UnitName("target") == target_name then
2020 unit_name = target_name 2020 unit_name = target_name
2021 unit_id = "target" 2021 unit_id = "target"
2022 end 2022 end
2023 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label] 2023 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label]
2024 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData() 2024 local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData()
2025 2025
2026 table.wipe(current_action)
2026 current_action.instance_token = instance_token 2027 current_action.instance_token = instance_token
2027 current_action.map_level = map_level 2028 current_action.map_level = map_level
2028 current_action.x = x 2029 current_action.x = x
2029 current_action.y = y 2030 current_action.y = y
2030 current_action.zone_data = ("%s:%d"):format(zone_name, area_id) 2031 current_action.zone_data = ("%s:%d"):format(zone_name, area_id)