changeset 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
files Constants.lua Main.lua
diffstat 2 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Constants.lua	Sat Oct 04 07:10:44 2014 -0400
+++ b/Constants.lua	Sun Oct 05 17:35:53 2014 -0400
@@ -17,9 +17,9 @@
 -----------------------------------------------------------------------
 -- Map of Alliance Logging NPC Summon spells to all possible Timber objectIDs of the proper tree size
 private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP = {
-    [167902] = { 233604, 233922, 234021, 234080, 234097, 234109, 234110, 234122, 234126, 234193, 234197, 237727, },
-    [167969] = { 233634, 234000, 234022, 234098, 234111, 234119, 234123, 234127, 234194, 234196, 234198, },
-    [168201] = { 233625, 234007, 234023, 234099, 234120, 234124, 234128, 234195, 234199, },
+    [167902] = 234021, --{ 233604, 233922, , 234080, 234097, 234109, 234110, 234122, 234126, 234193, 234197, 237727, },
+    [167969] = 234022, --{ 233634, 234000, , 234098, 234111, 234119, 234123, 234127, 234194, 234196, 234198, },
+    [168201] = 234023, --{ 233625, 234007, , 234099, 234120, 234124, 234128, 234195, 234199, },
 }
 -- Account for Horde spell IDs
 private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[167961] = private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[167902]
--- a/Main.lua	Sat Oct 04 07:10:44 2014 -0400
+++ b/Main.lua	Sun Oct 05 17:35:53 2014 -0400
@@ -48,6 +48,8 @@
 local PLAYER_NAME = _G.UnitName("player")
 local PLAYER_RACE = _G.select(2, _G.UnitRace("player"))
 
+local TIMBER_ITEM_ID = 114781
+
 -- Ignoring NPC casts of the following spells
 local CHI_WAVE_SPELL_ID = 132464
 local DISGUISE_SPELL_ID = 121308
@@ -1401,21 +1403,21 @@
         end,
         [AF.OBJECT] = function(item_id, quantity)
             Debug("CHAT_MSG_LOOT: AF.OBJECT %d (%d)", item_id, quantity)
-            for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id] do
+            --for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id] do
                 -- Check for top level object data
-                local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id][timber_variant]))
+                local object_entry = DBEntry("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[last_timber_spell_id]))
                 local difficulty_token = InstanceDifficultyToken()
                 if object_entry[difficulty_token] then
                     -- Increment loot count
                     object_entry[difficulty_token]["opening_count"] = object_entry[difficulty_token]["opening_count"] or 0 + 1
 
                     -- Add drop data
-                    object_entry[difficulty_token]["opening"] = entry[difficulty_token]["opening"] or {}
+                    object_entry[difficulty_token]["opening"] = object_entry[difficulty_token]["opening"] or {}
                     table.insert(object_entry[difficulty_token]["opening"], ("%d:%d"):format(item_id, quantity))
                 else
-                    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])
+                    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])
                 end
-            end
+            --end
         end,
         [AF.ZONE] = function(item_id, quantity)
             Debug("CHAT_MSG_LOOT: AF.ZONE %d (%d)", item_id, quantity)
@@ -2313,7 +2315,7 @@
             return
         end
         local unit_type, unit_id = ParseGUID(_G.UnitGUID("questnpc"))
-
+        Debug("UpdateQuestJuncture: Updating quest juncture for %s.", ("%s:%d"):format(private.UNIT_TYPE_NAMES[unit_type], unit_id))
         if unit_type == private.UNIT_TYPES.OBJECT then
             UpdateDBEntryLocation("objects", unit_id)
         end
@@ -2640,9 +2642,9 @@
     -- Handle Logging spell casts
     if private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] then
         last_timber_spell_id = spell_id
-        for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] do
-            UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id][timber_variant]))
-        end
+        --for timber_variant = 1, #private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id] do
+        UpdateDBEntryLocation("objects", ("OPENING:%s"):format(private.LOGGING_SPELL_ID_TO_OBJECT_ID_MAP[spell_id]))
+        --end
         return
     end