diff Main.lua @ 45:5d5a490724ec

Make everything have a loot count.
author James D. Callahan III <jcallahan@curse.com>
date Fri, 15 Jun 2012 11:57:54 -0500
parents 2a9bb8175562
children 786292c0bcc8
line wrap: on
line diff
--- a/Main.lua	Thu Jun 14 16:41:01 2012 -0500
+++ b/Main.lua	Fri Jun 15 11:57:54 2012 -0500
@@ -736,13 +736,16 @@
             return
         end
         local loot_type = action_data.label or "drops"
+        local loot_count = ("%s_count"):format(loot_type)
         local loot_data
 
         if top_field then
+            entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1
             entry[top_field] = entry[top_field] or {}
             entry[top_field][loot_type] = entry[top_field][loot_type] or {}
             loot_data = entry[top_field][loot_type]
         else
+            entry[loot_count] = (entry[loot_count] or 0) + 1
             entry[loot_type] = entry[loot_type] or {}
             loot_data = entry[loot_type]
         end
@@ -755,9 +758,6 @@
 
     local LOOT_UPDATE_FUNCS = {
         [AF.ITEM] = function()
-            local item = DBEntry("items", action_data.identifier)
-            local loot_count = ("%s_count"):format(action_data.label or "drops")
-            item[loot_count] = (item[loot_count] or 0) + 1
             GenericLootUpdate("items")
         end,
         [AF.NPC] = function()