From 61ea7b9833d6e66f74c271a1c5d7ef00cc40bc9b Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Sat, 2 Apr 2011 09:57:02 -0500 Subject: [PATCH] Detect if a trainer's coordinates are incorrect in the database. Also, don't check for found_whatever - send the output if it isn't empty. --- Scanner.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Scanner.lua b/Scanner.lua index 4d5fa31..7f4353e 100644 --- a/Scanner.lua +++ b/Scanner.lua @@ -198,12 +198,17 @@ do if recipe:CraftedItemID() then matching_recipe = nil end - - if not private.trainer_list[trainer_id] then + local trainer_entry = private.trainer_list[trainer_id] + local trainer_x, trainer_y = _G.GetPlayerMapPosition("player") + + if trainer_entry and trainer_entry.coord_x ~= trainer_x or trainer_entry.coord_y ~= trainer_y then + table.insert(output, ("%s appears to have different coordinates than those in the database - a trainer dump for %s will fix this."):format(trainer_name, trainer_profession)) + trainer_entry.coord_x = trainer_x + trainer_entry.coord_y = trainer_y + elseif not trainer_entry then table.insert(output, ("%s was not found in the trainer list - a trainer dump for %s will fix this."):format(trainer_name, trainer_profession)) _G.SetMapToCurrentZone() -- Make sure were are looking at the right zone - local trainer_x, trainer_y = _G.GetPlayerMapPosition("player") private:AddTrainer(trainer_id, trainer_name, _G.GetRealZoneText(), ("%.2f"):format(trainer_x * 100), ("%.2f"):format(trainer_y * 100), private.Player.faction) end @@ -319,7 +324,7 @@ do end end - if found_missing or found_extra or found_fixed_item or found_wrong_level or found_unconfirmed_level then + if #output > 0 then if found_extra and trainer_profession == private.professions.Engineering then table.insert(output, "\nSome goggles may be listed as extra. These goggles ONLY show up for the classes who can make them, so they may be false positives.") end -- 1.7.9.5