Fix: WLK shaman totem quest vs relic totems: avoid keeping 4 totem items when relic exists #2119 (#2197)

## Summary
* Detects shaman relics (relic type, totem subclass) in bags/equipment.
* Skips adding the four classic totem items (5175–5178) when a relic
exists.
* Cleans up any existing totem items from bags/equipment/bank when a
relic exists, while keeping Ankh handling intact.
## Test plan
Verified manually (local environment).

---------

Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com>
Co-authored-by: bash <hermensb@gmail.com>
Co-authored-by: Revision <tkn963@gmail.com>
Co-authored-by: kadeshar <kadeshar@gmail.com>
Co-authored-by: github-actions <github-actions@users.noreply.github.com>
This commit is contained in:
XYUU 2026-03-20 20:37:44 +01:00 committed by GitHub
parent 2ce8993986
commit 473b2ab5c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 7 deletions

View File

@ -3342,18 +3342,36 @@ void PlayerbotFactory::InitReagents()
items.push_back({44615, 40}); // Devout Candle
break;
case CLASS_SHAMAN:
if (level >= 4)
items.push_back({5175, 1}); // Earth Totem
if (level >= 10)
items.push_back({5176, 1}); // Flame Totem
if (level >= 20)
items.push_back({5177, 1}); // Water Totem
{
HasRelicBySubclassVisitor relicVisitor(ITEM_SUBCLASS_ARMOR_TOTEM);
IterateItems(&relicVisitor, (IterateItemsMask)(ITERATE_ITEMS_IN_BAGS | ITERATE_ITEMS_IN_EQUIP));
bool hasRelic = relicVisitor.found;
if (!hasRelic)
{
if (level >= 4)
items.push_back({5175, 1}); // Earth Totem
if (level >= 10)
items.push_back({5176, 1}); // Flame Totem
if (level >= 20)
items.push_back({5177, 1}); // Water Totem
}
else
{
ItemIds totemIds = {5175, 5176, 5177, 5178};
FindItemByIdsVisitor totemVisitor(totemIds);
IterateItems(&totemVisitor, (IterateItemsMask)(ITERATE_ITEMS_IN_BAGS | ITERATE_ITEMS_IN_EQUIP | ITERATE_ITEMS_IN_BANK));
for (Item* item : totemVisitor.GetResult())
bot->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
}
if (level >= 30)
{
items.push_back({5178, 1}); // Air Totem
if (!hasRelic)
items.push_back({5178, 1}); // Air Totem
items.push_back({17030, 20}); // Ankh
}
break;
}
case CLASS_WARLOCK:
items.push_back({6265, 5}); // Soul Shard
break;

View File

@ -66,6 +66,29 @@ private:
Player* bot;
};
class HasRelicBySubclassVisitor : public IterateItemsVisitor
{
public:
HasRelicBySubclassVisitor(uint32 subClass) : subClass(subClass) {}
bool Visit(Item* item) override
{
ItemTemplate const* proto = item->GetTemplate();
if (proto && proto->InventoryType == INVTYPE_RELIC && proto->SubClass == subClass)
{
found = true;
return false;
}
return true;
}
bool found = false;
private:
uint32 subClass;
};
class FindItemsByQualityVisitor : public IterateItemsVisitor
{
public: