From bde27d13ce5eab3ba68f5375119133b3d7936d7d Mon Sep 17 00:00:00 2001 From: Adam Balan Date: Sat, 25 Sep 2021 19:48:53 -0600 Subject: [PATCH] Updated the remove duplicate quest items to take into account duplicate upgraded items --- .../Commands/RemoveDuplicateQuestItems.php | 22 +++++++++++++++++++ resources/info/enchanting/section-1.md | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/RemoveDuplicateQuestItems.php b/app/Console/Commands/RemoveDuplicateQuestItems.php index bfaf9e68c..e1a4163d5 100644 --- a/app/Console/Commands/RemoveDuplicateQuestItems.php +++ b/app/Console/Commands/RemoveDuplicateQuestItems.php @@ -37,26 +37,32 @@ class RemoveDuplicateQuestItems extends Command private $toRemove = [ [ 'to_delete' => 'Weapon Smiths Book', + 'no_duplicates' => 'Weapon Smiths Master Book', 'has_both' => ['Weapon Smiths Book', 'Weapon Smiths Master Book'] ], [ 'to_delete' => 'Spell Weaving Book', + 'no_duplicates' => 'Mages Tome', 'has_both' => ['Spell Weaving Book', 'Mages Tome'] ], [ 'to_delete' => 'Artifact Crafting Book', + 'no_duplicates' => 'Artifact Crafting Masters Book', 'has_both' => ['Artifact Crafting Book', 'Artifact Crafting Masters Book'] ], [ 'to_delete' => 'Blacksmiths Book', + 'no_duplicates' => 'Black Smiths Master Recipes', 'has_both' => ['Blacksmiths Book', 'Black Smiths Master Recipes'] ], [ 'to_delete' => 'Ring Crafters Book', + 'no_duplicates' => 'Ring Crafters Master Book', 'has_both' => ['Ring Crafters Book', 'Ring Crafters Master Book'] ], [ 'to_delete' => 'Enchanters Book', + 'no_duplicates' => 'Enchantresses Diary', 'has_both' => ['Enchanters Book', 'Enchantresses Diary'] ], ]; @@ -98,6 +104,22 @@ public function handle(CharacterService $characterService) })->select('inventory_slots.*')->delete(); } } + + $count = $character->inventory->slots()->join('items', function ($join) use ($remove) { + $join->on('items.id', 'inventory_slots.item_id') + ->where('items.name', $remove['no_duplicates']); + })->select('items.*')->count(); + + if ($count > 1) { + $character->inventory->slots()->join('items', function ($join) use ($remove) { + $join->on('items.id', 'inventory_slots.item_id') + ->where('items.name', $remove['no_duplicates']); + })->select('inventory_slots.*')->get()->each(function($slot, $index) { + if ($index !== 0) { + $slot->delete(); + } + }); + } } } }); diff --git a/resources/info/enchanting/section-1.md b/resources/info/enchanting/section-1.md index acb012784..7142be977 100644 --- a/resources/info/enchanting/section-1.md +++ b/resources/info/enchanting/section-1.md @@ -22,7 +22,7 @@ At level 400, with no additional modifiers from equipment or items, you will hav If the item already has an enchantment on it, for each additional enchantment the item has an additional ten seconds will be added to the default ten seconds. -> ###ATTN! +> ### ATTN! > > If the item already has an enchantment on it, the cost to replace will be 1000 gold + New Affix Cost.