From 5f9669517f58c3e3e553c9247eaaacab2ca49d4d Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Sat, 27 Mar 2010 22:15:24 -0400 Subject: [PATCH] New database function: addon:AddRecipeWorldDrop() --- ARL.lua | 27 +++++++++++++++++++++------ Datamine.lua | 4 +++- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ARL.lua b/ARL.lua index a4d5f67..95f0a55 100644 --- a/ARL.lua +++ b/ARL.lua @@ -1062,18 +1062,29 @@ do acquire[id_num] = true - if not unit_list[id_num] then + if unit_list and not unit_list[id_num] then --@alpha@ self:Printf("Spell ID %d: %s ID %d does not exist in the database.", spell_id, type_string, id_num) --@end-alpha@ else - local unit = unit_list[id_num] + if not unit_list then + location = type(id_num) == "string" and BZ[id_num] or nil - affiliation = unit.faction - location = unit.location + if location then + affiliation = "world_drop" + addon:Debug("GenericAddRecipeAcquire(): location set as \"%s\".", location) + else + addon:Debug("WORLD_DROP with no location: %d %s", spell_id, private.recipe_list[spell_id].name) + end + else + local unit = unit_list[id_num] + + affiliation = unit.faction + location = unit.location - unit.item_list = unit.item_list or {} - unit.item_list[spell_id] = true + unit.item_list = unit.item_list or {} + unit.item_list[spell_id] = true + end end acquire_list[acquire_type] = acquire_list[acquire_type] or {} acquire_list[acquire_type].recipes = acquire_list[acquire_type].recipes or {} @@ -1103,6 +1114,10 @@ do GenericAddRecipeAcquire(spell_id, A.VENDOR, "Vendor", private.vendor_list, ...) end + function addon:AddRecipeWorldDrop(spell_id, ...) + GenericAddRecipeAcquire(spell_id, A.WORLD_DROP, nil, nil, ...) + end + -- This function can NOT use GenericAddRecipeAcquire() - reputation vendors are more complicated than the other acquire types. function addon:AddRecipeRepVendor(spell_id, faction_id, rep_level, ...) local num_vars = select('#', ...) diff --git a/Datamine.lua b/Datamine.lua index 77d8a4d..2ec832e 100644 --- a/Datamine.lua +++ b/Datamine.lua @@ -1477,6 +1477,7 @@ do [A.TRAINER] = "self:AddRecipeTrainer(%d, %s)", [A.VENDOR] = "self:AddRecipeVendor(%d, %s)", [A.MOB_DROP] = "self:AddRecipeMobDrop(%d, %s)", + [A.WORLD_DROP] = "self:AddRecipeWorldDrop(%d, %s)", } local function RecipeDump(id, single) @@ -1532,7 +1533,8 @@ do local values for id_num in pairs(acquire_info) do - values = values and (values..", "..id_num) or id_num + local saved_id = (type(id_num) == "string" and ("\""..id_num.."\"") or id_num) + values = values and (values..", "..saved_id) or saved_id end tinsert(output, string.format(FUNCTION_FORMATS[acquire_type], recipe.spell_id, values)) else -- 1.7.9.5