comparison Main.lua @ 351:e7cbe43d8418 WoD

Fixed bugs with timber loot recording and restricted its recording to only one object for each tree size.
author MMOSimca <MMOSimca@gmail.com>
date Sun, 05 Oct 2014 17:35:53 -0400
parents 37c27a7509c4
children 2776c8b1e253
comparison
equal deleted inserted replaced
350:37c27a7509c4 351:e7cbe43d8418
45 local PLAYER_CLASS = _G.select(2, _G.UnitClass("player")) 45 local PLAYER_CLASS = _G.select(2, _G.UnitClass("player"))
46 local PLAYER_FACTION = _G.UnitFactionGroup("player") 46 local PLAYER_FACTION = _G.UnitFactionGroup("player")
47 local PLAYER_GUID 47 local PLAYER_GUID
48 local PLAYER_NAME = _G.UnitName("player") 48 local PLAYER_NAME = _G.UnitName("player")
49 local PLAYER_RACE = _G.select(2, _G.UnitRace("player")) 49 local PLAYER_RACE = _G.select(2, _G.UnitRace("player"))
50
51 local TIMBER_ITEM_ID = 114781
50 52
51 -- Ignoring NPC casts of the following spells 53 -- Ignoring NPC casts of the following spells
52 local CHI_WAVE_SPELL_ID = 132464 54 local CHI_WAVE_SPELL_ID = 132464
53 local DISGUISE_SPELL_ID = 121308 55 local DISGUISE_SPELL_ID = 121308
54 56
1399 [AF.NPC] = function(item_id, quantity) 1401 [AF.NPC] = function(item_id, quantity)
1400 Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity) 1402 Debug("CHAT_MSG_LOOT: AF.NPC %d (%d)", item_id, quantity)
1401 end, 1403 end,
1402 [AF.OBJECT] = function(item_id, quantity) 1404 [AF.OBJECT] = function(item_id, quantity)
1403 Debug("CHAT_MSG_LOOT: AF.OBJECT %d (%d)", item_id, quantity) 1405 Debug("CHAT_MSG_LOOT: AF.OBJECT %d (%d)", item_id, quantity)
1404 for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id] do 1406 --for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id] do
1405 -- Check for top level object data 1407 -- Check for top level object data
1406 local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id][timber_variant])) 1408 local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id]))
1407 local difficulty_token = InstanceDifficultyToken() 1409 local difficulty_token = InstanceDifficultyToken()
1408 if object_entry[difficulty_token] then 1410 if object_entry[difficulty_token] then
1409 -- Increment loot count 1411 -- Increment loot count
1410 object_entry[difficulty_token]["opening_count"] = object_entry[difficulty_token]["opening_count"] or 0 + 1 1412 object_entry[difficulty_token]["opening_count"] = object_entry[difficulty_token]["opening_count"] or 0 + 1
1411 1413
1412 -- Add drop data 1414 -- Add drop data
1413 object_entry[difficulty_token]["opening"] = entry[difficulty_token]["opening"] or {} 1415 object_entry[difficulty_token]["opening"] = object_entry[difficulty_token]["opening"] or {}
1414 table.insert(object_entry[difficulty_token]["opening"], ("%d:%d"):format(item_id, quantity)) 1416 table.insert(object_entry[difficulty_token]["opening"], ("%d:%d"):format(item_id, quantity))
1415 else 1417 else
1416 Debug("CHAT_MSG_LOOT: When handling timber, the top level loot data was missing for objectID %s.", private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id][timber_variant]) 1418 Debug("CHAT_MSG_LOOT: When handling timber, the top level loot data was missing for objectID %s.", private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id])
1417 end 1419 end
1418 end 1420 --end
1419 end, 1421 end,
1420 [AF.ZONE] = function(item_id, quantity) 1422 [AF.ZONE] = function(item_id, quantity)
1421 Debug("CHAT_MSG_LOOT: AF.ZONE %d (%d)", item_id, quantity) 1423 Debug("CHAT_MSG_LOOT: AF.ZONE %d (%d)", item_id, quantity)
1422 InitializeCurrentLoot() 1424 InitializeCurrentLoot()
1423 current_loot.list[1] = ("%d:%d"):format(item_id, quantity) 1425 current_loot.list[1] = ("%d:%d"):format(item_id, quantity)
2311 2313
2312 if not unit_name then 2314 if not unit_name then
2313 return 2315 return
2314 end 2316 end
2315 local unit_type, unit_id = ParseGUID(_G.UnitGUID("questnpc")) 2317 local unit_type, unit_id = ParseGUID(_G.UnitGUID("questnpc"))
2316 2318 Debug("UpdateQuestJuncture: Updating quest juncture for %s.", ("%s:%d"):format(private.UNIT_TYPE_NAMES[unit_type], unit_id))
2317 if unit_type == private.UNIT_TYPES.OBJECT then 2319 if unit_type == private.UNIT_TYPES.OBJECT then
2318 UpdateDBEntryLocation("objects", unit_id) 2320 UpdateDBEntryLocation("objects", unit_id)
2319 end 2321 end
2320 local quest = DBEntry("quests", _G.GetQuestID()) 2322 local quest = DBEntry("quests", _G.GetQuestID())
2321 quest[point] = quest[point] or {} 2323 quest[point] = quest[point] or {}
2638 private.previous_spell_id = spell_id 2640 private.previous_spell_id = spell_id
2639 2641
2640 -- Handle Logging spell casts 2642 -- Handle Logging spell casts
2641 if private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] then 2643 if private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] then
2642 last_timber_spell_id = spell_id 2644 last_timber_spell_id = spell_id
2643 for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] do 2645 --for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] do
2644 UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id][timber_variant])) 2646 UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id]))
2645 end 2647 --end
2646 return 2648 return
2647 end 2649 end
2648 2650
2649 -- Handle Loot Toast spell casts 2651 -- Handle Loot Toast spell casts
2650 if private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then 2652 if private.LOOT_SPELL_ID_TO_ITEM_ID_MAP[spell_id] then