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,8 +1,10 @@
/*
* 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 "LootStrategyValue.h"
#include "AiObjectContext.h"
#include "ItemUsageValue.h"
#include "LootObjectStack.h"
@@ -10,62 +12,48 @@
class NormalLootStrategy : public LootStrategy
{
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override
{
std::ostringstream out;
out << proto->ItemId;
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", out.str());
return usage != ITEM_USAGE_NONE;
}
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override
{
std::ostringstream out;
out << proto->ItemId;
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", out.str());
return usage != ITEM_USAGE_NONE;
}
std::string const GetName() override
{
return "normal";
}
std::string const GetName() override { return "normal"; }
};
class GrayLootStrategy : public NormalLootStrategy
{
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override
{
return NormalLootStrategy::CanLoot(proto, context) || proto->Quality == ITEM_QUALITY_POOR;
}
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override
{
return NormalLootStrategy::CanLoot(proto, context) || proto->Quality == ITEM_QUALITY_POOR;
}
std::string const GetName() override
{
return "gray";
}
std::string const GetName() override { return "gray"; }
};
class DisenchantLootStrategy : public NormalLootStrategy
{
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override
{
return NormalLootStrategy::CanLoot(proto, context) || (proto->Quality >= ITEM_QUALITY_UNCOMMON && proto->Bonding != BIND_WHEN_PICKED_UP &&
(proto->Class == ITEM_CLASS_ARMOR || proto->Class == ITEM_CLASS_WEAPON));
}
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override
{
return NormalLootStrategy::CanLoot(proto, context) ||
(proto->Quality >= ITEM_QUALITY_UNCOMMON && proto->Bonding != BIND_WHEN_PICKED_UP &&
(proto->Class == ITEM_CLASS_ARMOR || proto->Class == ITEM_CLASS_WEAPON));
}
std::string const GetName() override
{
return "disenchant";
}
std::string const GetName() override { return "disenchant"; }
};
class AllLootStrategy : public LootStrategy
{
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override
{
return true;
}
public:
bool CanLoot(ItemTemplate const* proto, AiObjectContext* context) override { return true; }
std::string const GetName() override
{
return "all";
}
std::string const GetName() override { return "all"; }
};
LootStrategyValue::~LootStrategyValue()
@@ -92,10 +80,7 @@ LootStrategy* LootStrategyValue::instance(std::string const strategy)
return normal;
}
std::string const LootStrategyValue::Save()
{
return value ? value->GetName() : "?";
}
std::string const LootStrategyValue::Save() { return value ? value->GetName() : "?"; }
bool LootStrategyValue::Load(std::string const text)
{