comparison 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
comparison
equal deleted inserted replaced
44:2a9bb8175562 45:5d5a490724ec
734 734
735 if not entry then 735 if not entry then
736 return 736 return
737 end 737 end
738 local loot_type = action_data.label or "drops" 738 local loot_type = action_data.label or "drops"
739 local loot_count = ("%s_count"):format(loot_type)
739 local loot_data 740 local loot_data
740 741
741 if top_field then 742 if top_field then
743 entry[top_field][loot_count] = (entry[top_field][loot_count] or 0) + 1
742 entry[top_field] = entry[top_field] or {} 744 entry[top_field] = entry[top_field] or {}
743 entry[top_field][loot_type] = entry[top_field][loot_type] or {} 745 entry[top_field][loot_type] = entry[top_field][loot_type] or {}
744 loot_data = entry[top_field][loot_type] 746 loot_data = entry[top_field][loot_type]
745 else 747 else
748 entry[loot_count] = (entry[loot_count] or 0) + 1
746 entry[loot_type] = entry[loot_type] or {} 749 entry[loot_type] = entry[loot_type] or {}
747 loot_data = entry[loot_type] 750 loot_data = entry[loot_type]
748 end 751 end
749 752
750 for index = 1, #action_data.loot_list do 753 for index = 1, #action_data.loot_list do
753 end 756 end
754 757
755 758
756 local LOOT_UPDATE_FUNCS = { 759 local LOOT_UPDATE_FUNCS = {
757 [AF.ITEM] = function() 760 [AF.ITEM] = function()
758 local item = DBEntry("items", action_data.identifier)
759 local loot_count = ("%s_count"):format(action_data.label or "drops")
760 item[loot_count] = (item[loot_count] or 0) + 1
761 GenericLootUpdate("items") 761 GenericLootUpdate("items")
762 end, 762 end,
763 [AF.NPC] = function() 763 [AF.NPC] = function()
764 local npc = NPCEntry(action_data.identifier) 764 local npc = NPCEntry(action_data.identifier)
765 765