Run clang-format

This commit is contained in:
Yunfan Li
2024-08-04 10:23:36 +08:00
parent 44da167492
commit 53611c9040
835 changed files with 35085 additions and 31861 deletions

View File

@@ -1,60 +1,62 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
* and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#include "BuffAction.h"
#include "Event.h"
#include "ItemCountValue.h"
#include "Playerbots.h"
class FindBuffVisitor : public IterateItemsVisitor
{
public:
FindBuffVisitor(Player* bot) : IterateItemsVisitor(), bot(bot)
{
}
bool Visit(Item* item) override
{
if (bot->CanUseItem(item->GetTemplate()) != EQUIP_ERR_OK)
return true;
ItemTemplate const* proto = item->GetTemplate();
if (proto->Class != ITEM_CLASS_CONSUMABLE)
return true;
if (proto->SubClass != ITEM_SUBCLASS_ELIXIR && proto->SubClass != ITEM_SUBCLASS_FLASK && proto->SubClass != ITEM_SUBCLASS_SCROLL &&
proto->SubClass != ITEM_SUBCLASS_FOOD && proto->SubClass != ITEM_SUBCLASS_CONSUMABLE_OTHER && proto->SubClass != ITEM_SUBCLASS_ITEM_ENHANCEMENT)
return true;
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; i++)
{
uint32 spellId = proto->Spells[i].SpellId;
if (!spellId)
continue;
if (bot->HasAura(spellId))
return true;
Item* itemForSpell = *GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<Item*>("item for spell", spellId);
if (itemForSpell && itemForSpell->IsInWorld() && itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return true;
if (items.find(proto->SubClass) == items.end())
items[proto->SubClass] = std::vector<Item*>();
items[proto->SubClass].push_back(item);
break;
}
public:
FindBuffVisitor(Player* bot) : IterateItemsVisitor(), bot(bot) {}
bool Visit(Item* item) override
{
if (bot->CanUseItem(item->GetTemplate()) != EQUIP_ERR_OK)
return true;
ItemTemplate const* proto = item->GetTemplate();
if (proto->Class != ITEM_CLASS_CONSUMABLE)
return true;
if (proto->SubClass != ITEM_SUBCLASS_ELIXIR && proto->SubClass != ITEM_SUBCLASS_FLASK &&
proto->SubClass != ITEM_SUBCLASS_SCROLL && proto->SubClass != ITEM_SUBCLASS_FOOD &&
proto->SubClass != ITEM_SUBCLASS_CONSUMABLE_OTHER && proto->SubClass != ITEM_SUBCLASS_ITEM_ENHANCEMENT)
return true;
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; i++)
{
uint32 spellId = proto->Spells[i].SpellId;
if (!spellId)
continue;
if (bot->HasAura(spellId))
return true;
Item* itemForSpell =
*GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<Item*>("item for spell", spellId);
if (itemForSpell && itemForSpell->IsInWorld() && itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return true;
if (items.find(proto->SubClass) == items.end())
items[proto->SubClass] = std::vector<Item*>();
items[proto->SubClass].push_back(item);
break;
}
std::map<uint32, std::vector<Item*> > items;
return true;
}
private:
Player* bot;
std::map<uint32, std::vector<Item*> > items;
private:
Player* bot;
};
void BuffAction::TellHeader(uint32 subClass)