mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
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:
parent
2ce8993986
commit
473b2ab5c6
@ -3342,18 +3342,36 @@ void PlayerbotFactory::InitReagents()
|
||||
items.push_back({44615, 40}); // Devout Candle
|
||||
break;
|
||||
case CLASS_SHAMAN:
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user