diff --git a/ahbot/AhBot.cpp b/ahbot/AhBot.cpp index 50d43e71..b24be914 100644 --- a/ahbot/AhBot.cpp +++ b/ahbot/AhBot.cpp @@ -32,7 +32,7 @@ bool AhBot::HandleAhBotCommand(ChatHandler* handler, char const* args) uint32 AhBot::auctionIds[MAX_AUCTIONS] = {1,6,7}; uint32 AhBot::auctioneers[MAX_AUCTIONS] = {79707,4656,23442}; -map AhBot::factions; +std::map AhBot::factions; void AhBot::Init() { @@ -118,7 +118,7 @@ void AhBot::ForceUpdate() if (updating) return; - string msg = "AhBot is now checking auctions in the background"; + std::string msg = "AhBot is now checking auctions in the background"; sLog.outString("%s", msg.c_str()); //ostringstream out1; out1 << "|c070cc700 " << msg << " |r"; //sWorld.SendWorldText(3, out1.str().c_str()); @@ -179,10 +179,10 @@ struct SortByPricePredicate } }; -vector AhBot::LoadAuctions(const AuctionHouseObject::AuctionEntryMap& auctionEntryMap, +std::vector AhBot::LoadAuctions(const AuctionHouseObject::AuctionEntryMap& auctionEntryMap, Category*& category, int& auction) { - vector entries; + std::vector entries; for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionEntryMap.begin(); itr != auctionEntryMap.end(); ++itr) { @@ -207,7 +207,7 @@ vector AhBot::LoadAuctions(const AuctionHouseObject::AuctionEntry entries.push_back(entry); } - sort(entries.begin(), entries.end(), SortByPricePredicate()); + std::sort(entries.begin(), entries.end(), SortByPricePredicate()); return entries; } @@ -253,8 +253,8 @@ int AhBot::Answer(int auction, Category* category, ItemBag* inAuctionItems) const AuctionHouseObject::AuctionEntryMap& auctionEntryMap = auctionHouse->GetAuctions(); int64 availableMoney = GetAvailableMoney(auctionIds[auction]); - vector entries = LoadAuctions(auctionEntryMap, category, auction); - for (vector::iterator itr = entries.begin(); itr != entries.end(); ++itr) + std::vector entries = LoadAuctions(auctionEntryMap, category, auction); + for (std::vector::iterator itr = entries.begin(); itr != entries.end(); ++itr) { AuctionEntry *entry = *itr; uint32 owner = entry->owner; @@ -270,8 +270,8 @@ int AhBot::Answer(int auction, Category* category, ItemBag* inAuctionItems) continue; const ItemPrototype* proto = item->GetProto(); - vector items = availableItems.Get(category); - if (find(items.begin(), items.end(), proto->ItemId) == items.end()) + std::vector items = availableItems.Get(category); + if (std::find(items.begin(), items.end(), proto->ItemId) == items.end()) { sLog.outDetail( "%s (x%d) in auction %d: unavailable item", item->GetProto()->Name1, item->GetCount(), auctionIds[auction]); @@ -392,7 +392,7 @@ int AhBot::Answer(int auction, Category* category, ItemBag* inAuctionItems) return answered; } -uint32 AhBot::GetTime(string category, uint32 id, uint32 auctionHouse, uint32 type) +uint32 AhBot::GetTime(std::string category, uint32 id, uint32 auctionHouse, uint32 type) { auto results = CharacterDatabase.PQuery("SELECT MAX(buytime) FROM ahbot_history WHERE item = '%u' AND won = '%u' AND auction_house = '%u' AND category = '%s'", id, type, factions[auctionHouse], category.c_str()); @@ -406,7 +406,7 @@ uint32 AhBot::GetTime(string category, uint32 id, uint32 auctionHouse, uint32 ty return result; } -void AhBot::SetTime(string category, uint32 id, uint32 auctionHouse, uint32 type, uint32 value) +void AhBot::SetTime(std::string category, uint32 id, uint32 auctionHouse, uint32 type, uint32 value) { CharacterDatabase.PExecute("DELETE FROM ahbot_history WHERE item = '%u' AND won = '%u' AND auction_house = '%u' AND category = '%s'", id, type, factions[auctionHouse], category.c_str()); @@ -425,7 +425,7 @@ uint32 AhBot::GetBuyTime(uint32 entry, uint32 itemId, uint32 auctionHouse, Categ uint32 result = entryTime; - string categoryName = category->GetName(); + std::string categoryName = category->GetName(); uint32 categoryTime = GetTime(categoryName, 0, auctionHouse, AHBOT_WON_DELAY); uint32 itemTime = GetTime("item", itemId, auctionHouse, AHBOT_WON_DELAY); @@ -435,7 +435,7 @@ uint32 AhBot::GetBuyTime(uint32 entry, uint32 itemId, uint32 auctionHouse, Categ double rarity = category->GetPricingStrategy()->GetRarityPriceMultiplier(itemId); categoryTime += urand(sAhBotConfig.itemBuyMinInterval, sAhBotConfig.itemBuyMaxInterval) * priceLevel; itemTime += urand(sAhBotConfig.itemBuyMinInterval, sAhBotConfig.itemBuyMaxInterval) * priceLevel / rarity; - entryTime = max(categoryTime, itemTime); + entryTime = std::max(categoryTime, itemTime); SetTime(categoryName, 0, auctionHouse, AHBOT_WON_DELAY, categoryTime); SetTime("item", itemId, auctionHouse, AHBOT_WON_DELAY, itemTime); @@ -448,17 +448,17 @@ uint32 AhBot::GetSellTime(uint32 itemId, uint32 auctionHouse, Category*& categor { uint32 itemSellTime = GetTime("item", itemId, auctionHouse, AHBOT_SELL_DELAY); uint32 itemBuyTime = GetTime("item", itemId, auctionHouse, AHBOT_WON_DELAY); - uint32 itemTime = max(itemSellTime, itemBuyTime); + uint32 itemTime = std::max(itemSellTime, itemBuyTime); if (itemTime > time(0)) return itemTime; uint32 result = itemTime; - string categoryName = category->GetDisplayName(); + std::string categoryName = category->GetDisplayName(); uint32 categorySellTime = GetTime(categoryName, 0, auctionHouse, AHBOT_SELL_DELAY); uint32 categoryBuyTime = GetTime(categoryName, 0, auctionHouse, AHBOT_WON_DELAY); - uint32 categoryTime = max(categorySellTime, categoryBuyTime); + uint32 categoryTime = std::max(categorySellTime, categoryBuyTime); if (categoryTime < time(0)) categoryTime = time(0); if (itemTime < time(0)) itemTime = time(0); @@ -466,7 +466,7 @@ uint32 AhBot::GetSellTime(uint32 itemId, uint32 auctionHouse, Category*& categor double rarity = category->GetPricingStrategy()->GetRarityPriceMultiplier(itemId); categoryTime += urand(sAhBotConfig.itemSellMinInterval, sAhBotConfig.itemSellMaxInterval); itemTime += urand(sAhBotConfig.itemSellMinInterval, sAhBotConfig.itemSellMaxInterval) * rarity; - itemTime = max(itemTime, categoryTime); + itemTime = std::max(itemTime, categoryTime); SetTime(categoryName, 0, auctionHouse, AHBOT_SELL_DELAY, categoryTime); SetTime("item", itemId, auctionHouse, AHBOT_SELL_DELAY, itemTime); @@ -476,7 +476,7 @@ uint32 AhBot::GetSellTime(uint32 itemId, uint32 auctionHouse, Category*& categor int AhBot::AddAuctions(int auction, Category* category, ItemBag* inAuctionItems) { - vector& inAuction = inAuctionItems->Get(category); + std::vector& inAuction = inAuctionItems->Get(category); int32 maxAllowedAuctionCount = categoryMaxAuctionCount[category->GetDisplayName()]; if (inAuctionItems->GetCount(category) >= maxAllowedAuctionCount) @@ -484,7 +484,7 @@ int AhBot::AddAuctions(int auction, Category* category, ItemBag* inAuctionItems) int added = 0; int ladded = 0; - vector available = availableItems.Get(category); + std::vector available = availableItems.Get(category); for (int32 i = 0; i <= maxAllowedAuctionCount && available.size() > 0 && inAuctionItems->GetCount(category) < maxAllowedAuctionCount; ++i) { uint32 index = urand(0, available.size() - 1); @@ -536,7 +536,7 @@ int AhBot::AddAuction(int auction, Category* category, ItemPrototype const* prot return 0; } - string name; + std::string name; if (!sObjectMgr.GetPlayerNameByGUID(ObjectGuid(HIGHGUID_PLAYER, owner), name)) return 0; @@ -608,7 +608,7 @@ int AhBot::AddAuction(int auction, Category* category, ItemPrototype const* prot return 1; } -void AhBot::HandleCommand(string command) +void AhBot::HandleCommand(std::string command) { if (!sAhBotConfig.enabled) return; @@ -662,11 +662,11 @@ void AhBot::HandleCommand(string command) Category* category = CategoryList::instance[i]; if (category->Contains(proto)) { - vector items = availableItems.Get(category); - if (find(items.begin(), items.end(), proto->ItemId) == items.end()) + std::vector items = availableItems.Get(category); + if (std::find(items.begin(), items.end(), proto->ItemId) == items.end()) continue; - ostringstream out; + std::ostringstream out; out << proto->Name1 << " (" << category->GetDisplayName() << "), " << category->GetMaxAllowedAuctionCount() << "x" << category->GetMaxAllowedItemAuctionCount(proto) << "x" << category->GetStackCount(proto) << " max" @@ -678,11 +678,11 @@ void AhBot::HandleCommand(string command) << GetAvailableMoney(auctionIds[auction]) << ") ---\n"; - ostringstream exp1; + std::ostringstream exp1; out << "sell: " << ChatHelper::formatMoney(category->GetPricingStrategy()->GetSellPrice(proto, auctionIds[auction], true, &exp1)); out << " (" << exp1.str().c_str() << ")\n"; - ostringstream exp2; + std::ostringstream exp2; out << "buy: " << ChatHelper::formatMoney(category->GetPricingStrategy()->GetBuyPrice(proto, auctionIds[auction], &exp2)); out << " (" << exp2.str().c_str() << ")\n"; @@ -750,7 +750,7 @@ void AhBot::AddToHistory(AuctionEntry* entry, uint32 won) if (!proto) return; - string category = ""; + std::string category = ""; for (int i = 0; i < CategoryList::instance.size(); i++) { if (CategoryList::instance[i]->Contains(proto)) @@ -807,7 +807,7 @@ uint32 AhBot::GetAvailableMoney(uint32 auctionHouse) { int64 result = sAhBotConfig.alwaysAvailableMoney; - map data; + std::map data; data[AHBOT_WON_PLAYER] = 0; data[AHBOT_WON_SELF] = 0; @@ -868,10 +868,10 @@ void AhBot::CheckCategoryMultipliers() CharacterDatabase.PExecute("DELETE FROM ahbot_category"); - set tmp; + std::set tmp; for (int i = 0; i < CategoryList::instance.size(); i++) { - string name = CategoryList::instance[i]->GetDisplayName(); + std::string name = CategoryList::instance[i]->GetDisplayName(); if (tmp.find(name) != tmp.end()) continue; @@ -925,15 +925,15 @@ bool AhBot::IsBotAuction(uint32 bidder) uint32 AhBot::GetRandomBidder(uint32 auctionHouse) { - vector guids = bidders[factions[auctionHouse]]; + std::vector guids = bidders[factions[auctionHouse]]; if (guids.empty()) return 0; - vector online; - for (vector::iterator i = guids.begin(); i != guids.end(); ++i) + std::vector online; + for (std::vector::iterator i = guids.begin(); i != guids.end(); ++i) { uint32 guid = *i; - string name; + std::string name; if (!sObjectMgr.GetPlayerNameByGUID(ObjectGuid(HIGHGUID_PLAYER, guid), name)) continue; @@ -949,7 +949,7 @@ uint32 AhBot::GetRandomBidder(uint32 auctionHouse) void AhBot::LoadRandomBots() { - for (list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); i++) + for (std::list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); i++) { uint32 accountId = *i; if (!sAccountMgr.GetCharactersCount(accountId)) @@ -997,8 +997,8 @@ int32 AhBot::GetSellPrice(ItemPrototype const* proto) if (!category->Contains(proto)) continue; - vector items = availableItems.Get(category); - if (find(items.begin(), items.end(), proto->ItemId) == items.end()) + std::vector items = availableItems.Get(category); + if (std::find(items.begin(), items.end(), proto->ItemId) == items.end()) continue; for (int auction = 0; auction < MAX_AUCTIONS; auction++) @@ -1027,8 +1027,8 @@ int32 AhBot::GetBuyPrice(ItemPrototype const* proto) if (!category->Contains(proto)) continue; - vector items = availableItems.Get(category); - if (find(items.begin(), items.end(), proto->ItemId) == items.end()) + std::vector items = availableItems.Get(category); + if (std::find(items.begin(), items.end(), proto->ItemId) == items.end()) continue; for (int auction = 0; auction < MAX_AUCTIONS; auction++) @@ -1104,7 +1104,7 @@ void AhBot::CheckSendMail(uint32 bidder, uint32 price, AuctionEntry *entry) } } - ostringstream body; + std::ostringstream body; body << "Hello,\n"; body << "\n"; Item *item = sAuctionMgr.GetAItem(entry->itemGuidLow); @@ -1116,13 +1116,13 @@ void AhBot::CheckSendMail(uint32 bidder, uint32 price, AuctionEntry *entry) body << "\n"; body << "Regards,\n"; - string name; + std::string name; if (!sObjectMgr.GetPlayerNameByGUID(ObjectGuid(HIGHGUID_PLAYER, bidder), name)) return; body << name << "\n"; - ostringstream title; title << "AH Proposition: " << item->GetProto()->Name1; + std::ostringstream title; title << "AH Proposition: " << item->GetProto()->Name1; MailDraft draft(title.str(), body.str()); ObjectGuid receiverGuid(HIGHGUID_PLAYER, entry->owner); draft.SendMailTo(MailReceiver(receiverGuid), MailSender(MAIL_NORMAL, bidder)); @@ -1144,11 +1144,11 @@ void AhBot::Dump() Category* category = CategoryList::instance[i]; if (category->Contains(proto)) { - vector items = availableItems.Get(category); + std::vector items = availableItems.Get(category); if (find(items.begin(), items.end(), proto->ItemId) == items.end()) continue; - ostringstream out; + std::ostringstream out; if (first) { out << proto->ItemId << " (" << proto->Name1 << ") x" << category->GetStackCount(proto) << " - "; @@ -1193,12 +1193,12 @@ void AhBot::CleanupPropositions() } } -void AhBot::DeleteMail(list buffer) +void AhBot::DeleteMail(std::list buffer) { - ostringstream sql; + std::ostringstream sql; sql << "delete from mail where id in ( "; bool first = true; - for (list::iterator j = buffer.begin(); j != buffer.end(); ++j) + for (std::list::iterator j = buffer.begin(); j != buffer.end(); ++j) { if (first) first = false; else sql << ","; sql << "'" << *j << "'"; diff --git a/ahbot/AhBot.h b/ahbot/AhBot.h index b8aff97b..9156c881 100644 --- a/ahbot/AhBot.h +++ b/ahbot/AhBot.h @@ -19,8 +19,6 @@ namespace ahbot { - using namespace std; - class AhBot { public: @@ -38,11 +36,11 @@ namespace ahbot void Init(); void Update(); void ForceUpdate(); - void HandleCommand(string command); + void HandleCommand(std::string command); void Won(AuctionEntry* entry) { AddToHistory(entry); } void Expired(AuctionEntry* entry) {} - double GetCategoryMultiplier(string category) + double GetCategoryMultiplier(std::string category) { return categoryMultipliers[category] ? categoryMultipliers[category] : 1; } @@ -67,33 +65,33 @@ namespace ahbot uint32 GetRandomBidder(uint32 auctionHouse); void LoadRandomBots(); uint32 GetAnswerCount(uint32 itemId, uint32 auctionHouse, uint32 withinTime); - vector LoadAuctions(const AuctionHouseObject::AuctionEntryMap& auctionEntryMap, Category*& category, + std::vector LoadAuctions(const AuctionHouseObject::AuctionEntryMap& auctionEntryMap, Category*& category, int& auction); void FindMinPrice(const AuctionHouseObject::AuctionEntryMap& auctionEntryMap, AuctionEntry*& entry, Item*& item, uint32* minBid, uint32* minBuyout); uint32 GetBuyTime(uint32 entry, uint32 itemId, uint32 auctionHouse, Category*& category, double priceLevel); - uint32 GetTime(string category, uint32 id, uint32 auctionHouse, uint32 type); - void SetTime(string category, uint32 id, uint32 auctionHouse, uint32 type, uint32 value); + uint32 GetTime(std::string category, uint32 id, uint32 auctionHouse, uint32 type); + void SetTime(std::string category, uint32 id, uint32 auctionHouse, uint32 type, uint32 value); uint32 GetSellTime(uint32 itemId, uint32 auctionHouse, Category*& category); void CheckSendMail(uint32 bidder, uint32 price, AuctionEntry *entry); void Dump(); void CleanupPropositions(); - void DeleteMail(list buffer); + void DeleteMail(std::list buffer); public: static uint32 auctionIds[MAX_AUCTIONS]; static uint32 auctioneers[MAX_AUCTIONS]; - static map factions; + static std::map factions; private: AvailableItemsBag availableItems; time_t nextAICheckTime; - map categoryMultipliers; - map categoryMaxAuctionCount; - map categoryMaxItemAuctionCount; - map categoryMultiplierExpireTimes; - map > bidders; - set allBidders; + std::map categoryMultipliers; + std::map categoryMaxAuctionCount; + std::map categoryMaxItemAuctionCount; + std::map categoryMultiplierExpireTimes; + std::map> bidders; + std::set allBidders; bool updating; }; }; diff --git a/ahbot/AhBotConfig.cpp b/ahbot/AhBotConfig.cpp index d69580ee..c41e5890 100644 --- a/ahbot/AhBotConfig.cpp +++ b/ahbot/AhBotConfig.cpp @@ -3,8 +3,6 @@ #include "SystemConfig.h" std::vector split(const std::string &s, char delim); -using namespace std; - INSTANTIATE_SINGLETON_1(AhBotConfig); AhBotConfig::AhBotConfig() @@ -12,10 +10,10 @@ AhBotConfig::AhBotConfig() } template -void LoadSet(string value, T &res) +void LoadSet(std::string value, T &res) { - vector ids = split(value, ','); - for (vector::iterator i = ids.begin(); i != ids.end(); i++) + std::vector ids = split(value, ','); + for (std::vector::iterator i = ids.begin(); i != ids.end(); i++) { uint32 id = atoi((*i).c_str()); if (!id) @@ -54,8 +52,8 @@ bool AhBotConfig::Initialize() stackReducePrice = config.GetIntDefault("AhBot.StackReducePrice", 1000000); priceQualityMultiplier = config.GetFloatDefault("AhBot.PriceQualityMultiplier", 1.0f); underPriceProbability = config.GetFloatDefault("AhBot.UnderPriceProbability", 0.05f); - LoadSet >(config.GetStringDefault("AhBot.IgnoreItemIds", "49283,52200,8494,6345,6891,2460,37164,34835"), ignoreItemIds); - LoadSet >(config.GetStringDefault("AhBot.IgnoreVendorItemIds", "755,858,4592,4593,1710,3827,2455,3385"), ignoreVendorItemIds); + LoadSet >(config.GetStringDefault("AhBot.IgnoreItemIds", "49283,52200,8494,6345,6891,2460,37164,34835"), ignoreItemIds); + LoadSet >(config.GetStringDefault("AhBot.IgnoreVendorItemIds", "755,858,4592,4593,1710,3827,2455,3385"), ignoreVendorItemIds); sendmail = config.GetBoolDefault("AhBot.SendMail", true); diff --git a/ahbot/AhBotConfig.h b/ahbot/AhBotConfig.h index 0136c5d2..13ba5ff6 100644 --- a/ahbot/AhBotConfig.h +++ b/ahbot/AhBotConfig.h @@ -2,8 +2,6 @@ #include "Config/Config.h" -using namespace std; - class AhBotConfig { public: @@ -32,27 +30,27 @@ class AhBotConfig std::set ignoreVendorItemIds; bool sendmail; - float GetSellPriceMultiplier(string category) + float GetSellPriceMultiplier(std::string category) { return GetCategoryParameter(sellPriceMultipliers, "PriceMultiplier.Sell", category, 1.0f); } - float GetBuyPriceMultiplier(string category) + float GetBuyPriceMultiplier(std::string category) { return GetCategoryParameter(buyPriceMultipliers, "PriceMultiplier.Buy", category, 1.0f); } - float GetItemPriceMultiplier(string name) + float GetItemPriceMultiplier(std::string name) { return GetCategoryParameter(itemPriceMultipliers, "PriceMultiplier.Item", name, 1.0f); } - int32 GetMaxAllowedAuctionCount(string category, int32 default_value) + int32 GetMaxAllowedAuctionCount(std::string category, int32 default_value) { return (int32)GetCategoryParameter(maxAuctionCount, "MaxAuctionCount", category, default_value); } - int32 GetMaxAllowedItemAuctionCount(string category, int32 default_value) + int32 GetMaxAllowedItemAuctionCount(std::string category, int32 default_value) { return (int32)GetCategoryParameter(maxItemAuctionCount, "MaxItemTypeCount", category, default_value); } @@ -78,11 +76,11 @@ class AhBotConfig } private: - float GetCategoryParameter(map& cache, string type, string category, float defaultValue) + float GetCategoryParameter(std::map& cache, std::string type, std::string category, float defaultValue) { if (cache.find(category) == cache.end()) { - ostringstream out; out << "AhBot."<< type << "." << category; + std::ostringstream out; out << "AhBot."<< type << "." << category; cache[category] = config.GetFloatDefault(out.str().c_str(), defaultValue); } @@ -91,11 +89,11 @@ class AhBotConfig private: Config config; - map sellPriceMultipliers; - map buyPriceMultipliers; - map itemPriceMultipliers; - map maxAuctionCount; - map maxItemAuctionCount; + std::map sellPriceMultipliers; + std::map buyPriceMultipliers; + std::map itemPriceMultipliers; + std::map maxAuctionCount; + std::map maxItemAuctionCount; }; #define sAhBotConfig MaNGOS::Singleton::Instance() diff --git a/ahbot/Category.cpp b/ahbot/Category.cpp index d9bdf03d..ef75681f 100644 --- a/ahbot/Category.cpp +++ b/ahbot/Category.cpp @@ -14,7 +14,7 @@ uint32 Category::GetStackCount(ItemPrototype const* proto) return 1; double rarity = GetPricingStrategy()->GetRarityPriceMultiplier(proto->ItemId); - return (uint32)max(1.0, proto->GetMaxStackSize() / rarity); + return (uint32)std::max(1.0, proto->GetMaxStackSize() / rarity); } PricingStrategy* Category::GetPricingStrategy() @@ -22,14 +22,14 @@ PricingStrategy* Category::GetPricingStrategy() if (pricingStrategy) return pricingStrategy; - ostringstream out; out << "AhBot.PricingStrategy." << GetName(); - string name = sAhBotConfig.GetStringDefault(out.str().c_str(), "default"); + std::ostringstream out; out << "AhBot.PricingStrategy." << GetName(); + std::string name = sAhBotConfig.GetStringDefault(out.str().c_str(), "default"); return pricingStrategy = PricingStrategyFactory::Create(name, this); } QualityCategoryWrapper::QualityCategoryWrapper(Category* category, uint32 quality) : Category(), quality(quality), category(category) { - ostringstream out; out << category->GetName() << "."; + std::ostringstream out; out << category->GetName() << "."; switch (quality) { case ITEM_QUALITY_POOR: diff --git a/ahbot/Category.h b/ahbot/Category.h index 0c646707..1e03310a 100644 --- a/ahbot/Category.h +++ b/ahbot/Category.h @@ -5,8 +5,6 @@ #include "Entities/ItemPrototype.h" #include "Globals/SharedDefines.h" -using namespace std; - namespace ahbot { class Category @@ -17,9 +15,9 @@ namespace ahbot public: virtual bool Contains(ItemPrototype const* proto) { return false; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return GetName(); } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return GetName(); } virtual uint32 GetStackCount(ItemPrototype const* proto); virtual uint32 GetSkillId() { return 0; } @@ -36,7 +34,7 @@ namespace ahbot return sAhBotConfig.GetMaxAllowedItemAuctionCount(GetName(), sAhBotConfig.GetMaxAllowedItemAuctionCount(typeName, defaultMaxType)); } protected: - string typeName = "default"; + std::string typeName = "default"; int32 defaultMaxType = 1; private: PricingStrategy *pricingStrategy; @@ -52,9 +50,9 @@ namespace ahbot return proto->Class == ITEM_CLASS_CONSUMABLE; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "consumables"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "consumables"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -66,7 +64,7 @@ namespace ahbot return sAhBotConfig.GetMaxAllowedItemAuctionCount(GetName(), sAhBotConfig.GetMaxAllowedItemAuctionCount(typeName, defaultMaxType)); } protected: - string typeName = "consumable"; + std::string typeName = "consumable"; int32 defaultMaxType = 10; }; @@ -79,9 +77,9 @@ namespace ahbot { return proto->Class == ITEM_CLASS_QUEST; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "quest items"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "quest items"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -93,7 +91,7 @@ namespace ahbot return sAhBotConfig.GetMaxAllowedItemAuctionCount(GetName(), sAhBotConfig.GetMaxAllowedItemAuctionCount(typeName, defaultMaxType)); } protected: - string typeName = "quest"; + std::string typeName = "quest"; int32 defaultMaxType = 5; }; @@ -114,8 +112,8 @@ namespace ahbot ; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } virtual uint32 GetMaxAllowedAuctionCount() { @@ -127,7 +125,7 @@ namespace ahbot return sAhBotConfig.GetMaxAllowedItemAuctionCount(GetName(), sAhBotConfig.GetMaxAllowedItemAuctionCount(typeName, defaultMaxType)); } protected: - string typeName = "trade"; + std::string typeName = "trade"; int32 defaultMaxType = 5; }; @@ -141,9 +139,9 @@ namespace ahbot { return proto->Class == ITEM_CLASS_REAGENT; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "reagents"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "reagents"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -155,7 +153,7 @@ namespace ahbot return sAhBotConfig.GetMaxAllowedItemAuctionCount(GetName(), sAhBotConfig.GetMaxAllowedItemAuctionCount(typeName, defaultMaxType)); } protected: - string typeName = "reagent"; + std::string typeName = "reagent"; int32 defaultMaxType = 1; }; @@ -169,9 +167,9 @@ namespace ahbot { return proto->Class == ITEM_CLASS_RECIPE; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "recipes and patterns"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "recipes and patterns"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -188,7 +186,7 @@ namespace ahbot return 1; } protected: - string typeName = "recipe"; + std::string typeName = "recipe"; int32 defaultMaxType = 1; }; @@ -203,9 +201,9 @@ namespace ahbot return (proto->Class == ITEM_CLASS_WEAPON || proto->Class == ITEM_CLASS_ARMOR) && proto->ItemLevel > 1; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "armor and weapons"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "armor and weapons"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -222,7 +220,7 @@ namespace ahbot return 1; } protected: - string typeName = "equip"; + std::string typeName = "equip"; int32 defaultMaxType = 1; }; @@ -237,9 +235,9 @@ namespace ahbot return proto->Class == ITEM_CLASS_QUIVER && proto->ItemLevel > 1; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "quivers and ammo poaches"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "quivers and ammo poaches"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -257,7 +255,7 @@ namespace ahbot } protected: - string typeName = "quiver"; + std::string typeName = "quiver"; int32 defaultMaxType = 1; }; @@ -272,9 +270,9 @@ namespace ahbot return proto->Class == ITEM_CLASS_PROJECTILE; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "projectiles"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "projectiles"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -292,7 +290,7 @@ namespace ahbot } protected: - string typeName = "projectile"; + std::string typeName = "projectile"; int32 defaultMaxType = 5; }; @@ -307,9 +305,9 @@ namespace ahbot return proto->Class == ITEM_CLASS_CONTAINER; } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "containers"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "containers"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -327,7 +325,7 @@ namespace ahbot } protected: - string typeName = "container"; + std::string typeName = "container"; int32 defaultMaxType = 1; }; @@ -345,9 +343,9 @@ namespace ahbot proto->SubClass == ITEM_SUBCLASS_EXPLOSIVES); } - virtual string GetName() { return typeName; } - virtual string GetDisplayName() { return GetName(); } - virtual string GetLabel() { return "devices and explosives"; } + virtual std::string GetName() { return typeName; } + virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetLabel() { return "devices and explosives"; } virtual uint32 GetMaxAllowedAuctionCount() { @@ -360,7 +358,7 @@ namespace ahbot } protected: - string typeName = "devices"; + std::string typeName = "devices"; int32 defaultMaxType = 1; }; @@ -371,9 +369,9 @@ namespace ahbot public: virtual bool Contains(ItemPrototype const* proto); - virtual string GetName() { return category->GetName(); } - virtual string GetDisplayName() { return combinedName; } - virtual string GetLabel() { return category->GetLabel(); } + virtual std::string GetName() { return category->GetName(); } + virtual std::string GetDisplayName() { return combinedName; } + virtual std::string GetLabel() { return category->GetLabel(); } virtual uint32 GetStackCount(ItemPrototype const* proto) { return category->GetStackCount(proto); } virtual PricingStrategy* GetPricingStrategy() { return category->GetPricingStrategy(); } virtual uint32 GetSkillId() { return category->GetSkillId(); } @@ -391,6 +389,6 @@ namespace ahbot private: uint32 quality; Category* category; - string combinedName; + std::string combinedName; }; }; diff --git a/ahbot/ConsumableCategory.h b/ahbot/ConsumableCategory.h index 43c3ab65..5af2a7cc 100644 --- a/ahbot/ConsumableCategory.h +++ b/ahbot/ConsumableCategory.h @@ -2,7 +2,6 @@ #include "Config/Config.h" #include "Category.h" -using namespace std; namespace ahbot { @@ -20,8 +19,8 @@ namespace ahbot proto->SubClass == ITEM_SUBCLASS_FLASK); } - virtual string GetName() { return "consumables.alchemy"; } - virtual string GetLabel() { return "elixirs and potions"; } + virtual std::string GetName() { return "consumables.alchemy"; } + virtual std::string GetLabel() { return "elixirs and potions"; } }; class Scroll : public Consumable @@ -37,8 +36,8 @@ namespace ahbot proto->SubClass == ITEM_SUBCLASS_ITEM_ENHANCEMENT); } - virtual string GetName() { return "consumables.scroll"; } - virtual string GetLabel() { return "scrolls"; } + virtual std::string GetName() { return "consumables.scroll"; } + virtual std::string GetLabel() { return "scrolls"; } }; class Food : public Consumable @@ -57,8 +56,8 @@ namespace ahbot ); } - virtual string GetName() { return "consumables.food"; } - virtual string GetLabel() { return "food and drink"; } + virtual std::string GetName() { return "consumables.food"; } + virtual std::string GetLabel() { return "food and drink"; } }; class Bandage : public Consumable @@ -73,8 +72,8 @@ namespace ahbot proto->SubClass == ITEM_SUBCLASS_BANDAGE; } - virtual string GetName() { return "consumables.bandage"; } - virtual string GetLabel() { return "bandages"; } + virtual std::string GetName() { return "consumables.bandage"; } + virtual std::string GetLabel() { return "bandages"; } }; class ItemEnchant : public Consumable @@ -89,7 +88,7 @@ namespace ahbot proto->SubClass == ITEM_SUBCLASS_CONSUMABLE_OTHER; } - virtual string GetName() { return "consumables.enchant"; } - virtual string GetLabel() { return "item enchants"; } + virtual std::string GetName() { return "consumables.enchant"; } + virtual std::string GetLabel() { return "item enchants"; } }; }; diff --git a/ahbot/ItemBag.cpp b/ahbot/ItemBag.cpp index 28d514e4..3a539529 100644 --- a/ahbot/ItemBag.cpp +++ b/ahbot/ItemBag.cpp @@ -73,7 +73,7 @@ void CategoryList::Add(Category* category) CategoryList::~CategoryList() { - for (vector::const_iterator i = categories.begin(); i != categories.end(); ++i) + for (std::vector::const_iterator i = categories.begin(); i != categories.end(); ++i) delete *i; } @@ -81,7 +81,7 @@ ItemBag::ItemBag() { for (int i = 0; i < CategoryList::instance.size(); i++) { - content[CategoryList::instance[i]] = vector(); + content[CategoryList::instance[i]] = std::vector(); } } @@ -114,8 +114,8 @@ int32 ItemBag::GetCount(Category* category, uint32 item) { uint32 count = 0; - vector& items = content[category]; - for (vector::iterator i = items.begin(); i != items.end(); ++i) + std::vector& items = content[category]; + for (std::vector::iterator i = items.begin(); i != items.end(); ++i) { if (*i == item) count++; @@ -167,7 +167,7 @@ bool ItemBag::Add(ItemPrototype const* proto) void AvailableItemsBag::Load() { - set vendorItems; + std::set vendorItems; auto results = WorldDatabase.PQuery("SELECT item FROM npc_vendor where maxcount = 0"); if (results != NULL) @@ -208,8 +208,8 @@ void InAuctionItemsBag::Load() } } -string InAuctionItemsBag::GetName() +std::string InAuctionItemsBag::GetName() { - ostringstream out; out << "auction house " << auctionId; + std::ostringstream out; out << "auction house " << auctionId; return out.str(); } diff --git a/ahbot/ItemBag.h b/ahbot/ItemBag.h index 9f4eb9bc..9e38b87f 100644 --- a/ahbot/ItemBag.h +++ b/ahbot/ItemBag.h @@ -6,11 +6,8 @@ #include "Util/Util.h" #endif - namespace ahbot { - using namespace std; - class CategoryList { public: @@ -25,11 +22,11 @@ namespace ahbot void Add(Category* category); private: - vector categories; + std::vector categories; }; template - void Shuffle(vector& items) + void Shuffle(std::vector& items) { uint32 count = items.size(); for (uint32 i = 0; i < count * 5; i++) @@ -50,17 +47,17 @@ namespace ahbot public: void Init(bool silent = false); - vector& Get(Category* category) { return content[category]; } + std::vector& Get(Category* category) { return content[category]; } int32 GetCount(Category* category) { return content[category].size(); } int32 GetCount(Category* category, uint32 item); bool Add(ItemPrototype const* proto); protected: virtual void Load() = 0; - virtual string GetName() = 0; + virtual std::string GetName() = 0; protected: - map > content; + std::map > content; }; class AvailableItemsBag : public ItemBag @@ -70,7 +67,7 @@ namespace ahbot protected: virtual void Load(); - virtual string GetName() { return "available"; } + virtual std::string GetName() { return "available"; } }; class InAuctionItemsBag : public ItemBag @@ -80,7 +77,7 @@ namespace ahbot protected: virtual void Load(); - virtual string GetName(); + virtual std::string GetName(); private: uint32 auctionId; diff --git a/ahbot/PricingStrategy.cpp b/ahbot/PricingStrategy.cpp index f758d25d..993ed3f0 100644 --- a/ahbot/PricingStrategy.cpp +++ b/ahbot/PricingStrategy.cpp @@ -8,7 +8,7 @@ using namespace ahbot; -double PricingStrategy::CalculatePrice(ostringstream *explain, ...) +double PricingStrategy::CalculatePrice(std::ostringstream *explain, ...) { va_list vl; va_start(vl, explain); @@ -34,7 +34,7 @@ double PricingStrategy::CalculatePrice(ostringstream *explain, ...) return result; } -uint32 PricingStrategy::GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket, ostringstream *explain) +uint32 PricingStrategy::GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket, std::ostringstream *explain) { double marketPrice = GetMarketPrice(proto->ItemId, auctionHouse); @@ -84,7 +84,7 @@ double PricingStrategy::GetMarketPrice(uint32 itemId, uint32 auctionHouse) return RoundPrice(marketPrice); } -uint32 PricingStrategy::GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, ostringstream *explain) +uint32 PricingStrategy::GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, std::ostringstream *explain) { uint32 untilTime = time(0) - 3600 * 12; double price = CalculatePrice(explain, @@ -148,7 +148,7 @@ double PricingStrategy::GetMultiplier(double count, double firstBuyTime, double { double k1 = (double)count / (double)((time(0) - firstBuyTime) / 3600 / 24 + 1); double k2 = (double)count / (double)((time(0) - lastBuyTime) / 3600 / 24 + 1); - return max(1.0, k1 + k2) * sAhBotConfig.priceMultiplier; + return std::max(1.0, k1 + k2) * sAhBotConfig.priceMultiplier; } double PricingStrategy::GetItemPriceMultiplier(ItemPrototype const* proto, uint32 untilTime, uint32 auctionHouse) @@ -185,11 +185,11 @@ uint32 PricingStrategy::GetDefaultBuyPrice(ItemPrototype const* proto) if (proto->SellPrice) price = proto->SellPrice; if (proto->BuyPrice) - price = max(price, proto->BuyPrice / 4); + price = std::max(price, proto->BuyPrice / 4); price *= 2; - uint32 level = max(proto->ItemLevel, proto->RequiredLevel); + uint32 level = std::max(proto->ItemLevel, proto->RequiredLevel); if (proto->Class == ITEM_CLASS_QUEST) { double result = 1.0; @@ -200,11 +200,11 @@ uint32 PricingStrategy::GetDefaultBuyPrice(ItemPrototype const* proto) if (results) { Field* fields = results->Fetch(); - level = max(fields[0].GetUInt32(), fields[1].GetUInt32()); + level = std::max(fields[0].GetUInt32(), fields[1].GetUInt32()); } } if (!price) price = sAhBotConfig.defaultMinPrice * level * level / 40; - price = max(price, (uint32)1); + price = std::max(price, (uint32)1); return price; } @@ -215,7 +215,7 @@ uint32 PricingStrategy::GetDefaultSellPrice(ItemPrototype const* proto) } -uint32 BuyOnlyRarePricingStrategy::GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, ostringstream *explain) +uint32 BuyOnlyRarePricingStrategy::GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, std::ostringstream *explain) { if (proto->Quality < ITEM_QUALITY_RARE) { @@ -226,7 +226,7 @@ uint32 BuyOnlyRarePricingStrategy::GetBuyPrice(ItemPrototype const* proto, uint3 return PricingStrategy::GetBuyPrice(proto, auctionHouse, explain); } -uint32 BuyOnlyRarePricingStrategy::GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket, ostringstream *explain) +uint32 BuyOnlyRarePricingStrategy::GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket, std::ostringstream *explain) { return PricingStrategy::GetSellPrice(proto, auctionHouse, ignoreMarket, explain); } diff --git a/ahbot/PricingStrategy.h b/ahbot/PricingStrategy.h index fd97f32c..25896cfb 100644 --- a/ahbot/PricingStrategy.h +++ b/ahbot/PricingStrategy.h @@ -2,8 +2,6 @@ #include "Config/Config.h" #include "Entities/ItemPrototype.h" -using namespace std; - namespace ahbot { class Category; @@ -14,8 +12,8 @@ namespace ahbot PricingStrategy(Category* category) : category(category) {} public: - virtual uint32 GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket = false, ostringstream *explain = NULL); - virtual uint32 GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, ostringstream *explain = NULL); + virtual uint32 GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket = false, std::ostringstream *explain = NULL); + virtual uint32 GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, std::ostringstream *explain = NULL); double GetMarketPrice(uint32 itemId, uint32 auctionHouse); virtual double GetRarityPriceMultiplier(uint32 itemId); virtual double GetLevelPriceMultiplier(ItemPrototype const* proto); @@ -28,7 +26,7 @@ namespace ahbot virtual double GetCategoryPriceMultiplier(uint32 untilTime, uint32 auctionHouse); virtual double GetItemPriceMultiplier(ItemPrototype const* proto, uint32 untilTime, uint32 auctionHouse); double GetMultiplier(double count, double firstBuyTime, double lastBuyTime); - double CalculatePrice(ostringstream *explain, ...); + double CalculatePrice(std::ostringstream *explain, ...); protected: Category* category; @@ -40,14 +38,14 @@ namespace ahbot BuyOnlyRarePricingStrategy(Category* category) : PricingStrategy(category) {} public: - virtual uint32 GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, ostringstream *explain = NULL); - virtual uint32 GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket = false, ostringstream *explain = NULL); + virtual uint32 GetBuyPrice(ItemPrototype const* proto, uint32 auctionHouse, std::ostringstream *explain = NULL); + virtual uint32 GetSellPrice(ItemPrototype const* proto, uint32 auctionHouse, bool ignoreMarket = false, std::ostringstream *explain = NULL); }; class PricingStrategyFactory { public: - static PricingStrategy* Create(string name, Category* category) + static PricingStrategy* Create(std::string name, Category* category) { if (name == "buyOnlyRare") return new BuyOnlyRarePricingStrategy(category); diff --git a/ahbot/TradeCategory.cpp b/ahbot/TradeCategory.cpp index 6927f29a..24230cf7 100644 --- a/ahbot/TradeCategory.cpp +++ b/ahbot/TradeCategory.cpp @@ -170,9 +170,9 @@ bool TradeSkill::IsCraftedBy(ItemPrototype const* proto, uint32 spellId) return false; } -string TradeSkill::GetName() +std::string TradeSkill::GetName() { - string name; + std::string name; switch (skill) { case SKILL_TAILORING: @@ -208,9 +208,9 @@ string TradeSkill::GetName() return reagent ? name : name + ".craft"; } -string TradeSkill::GetMainName() +std::string TradeSkill::GetMainName() { - string name; + std::string name; switch (skill) { case SKILL_TAILORING: @@ -246,7 +246,7 @@ string TradeSkill::GetMainName() return name; } -string TradeSkill::GetLabel() +std::string TradeSkill::GetLabel() { if (reagent) { diff --git a/ahbot/TradeCategory.h b/ahbot/TradeCategory.h index 3848b913..85b65353 100644 --- a/ahbot/TradeCategory.h +++ b/ahbot/TradeCategory.h @@ -4,8 +4,6 @@ struct ItemPrototype; struct SpellEntry; -using namespace std; - namespace ahbot { class TradeSkill : public Trade @@ -15,9 +13,9 @@ namespace ahbot public: virtual bool Contains(ItemPrototype const* proto); - virtual string GetName(); - virtual string GetMainName(); - virtual string GetLabel(); + virtual std::string GetName(); + virtual std::string GetMainName(); + virtual std::string GetLabel(); virtual uint32 GetSkillId() { return skill; } virtual uint32 GetMaxAllowedAuctionCount() @@ -30,7 +28,7 @@ namespace ahbot return sAhBotConfig.GetMaxAllowedItemAuctionCount(GetName(), sAhBotConfig.GetMaxAllowedItemAuctionCount(GetMainName(), sAhBotConfig.GetMaxAllowedItemAuctionCount(typeName, defaultMaxType))); } protected: - string typeName = "trade"; + std::string typeName = "trade"; int32 defaultMaxType = 5; private: @@ -39,7 +37,7 @@ namespace ahbot bool IsCraftedBy(ItemPrototype const* proto, uint32 craftId); bool IsCraftedBySpell(ItemPrototype const* proto, SpellEntry const *entry); uint32 skill; - set itemCache; + std::set itemCache; bool reagent; }; diff --git a/playerbot/AiFactory.cpp b/playerbot/AiFactory.cpp index a23aa5f8..7e60834f 100644 --- a/playerbot/AiFactory.cpp +++ b/playerbot/AiFactory.cpp @@ -89,7 +89,7 @@ AiObjectContext* AiFactory::createAiObjectContext(Player* player, PlayerbotAI* a int AiFactory::GetPlayerSpecTab(Player* bot) { - map tabs = GetPlayerSpecTabs(bot); + std::map tabs = GetPlayerSpecTabs(bot); if (bot->GetLevel() >= 10 && ((tabs[0] + tabs[1] + tabs[2]) > 0)) { @@ -127,9 +127,9 @@ int AiFactory::GetPlayerSpecTab(Player* bot) } } -map AiFactory::GetPlayerSpecTabs(Player* bot) +std::map AiFactory::GetPlayerSpecTabs(Player* bot) { - map tabs; + std::map tabs; for (uint32 i = 0; i < uint32(3); i++) tabs[i] = 0; diff --git a/playerbot/AiFactory.h b/playerbot/AiFactory.h index 3dced7bb..1b732f85 100644 --- a/playerbot/AiFactory.h +++ b/playerbot/AiFactory.h @@ -28,6 +28,6 @@ class AiFactory public: static int GetPlayerSpecTab(Player* player); - static map GetPlayerSpecTabs(Player* player); + static std::map GetPlayerSpecTabs(Player* player); static BotRoles GetPlayerRoles(Player* player); }; diff --git a/playerbot/BotTests.cpp b/playerbot/BotTests.cpp index c8c95429..57d73c3f 100644 --- a/playerbot/BotTests.cpp +++ b/playerbot/BotTests.cpp @@ -14,7 +14,7 @@ void LogAnalysis::RunAnalysis() void LogAnalysis::AnalysePid() { - string m_logsDir = sConfig.GetStringDefault("LogsDir"); + std::string m_logsDir = sConfig.GetStringDefault("LogsDir"); if (!m_logsDir.empty()) { if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) @@ -22,7 +22,7 @@ void LogAnalysis::AnalysePid() } std::ifstream in(m_logsDir+"activity_pid.csv", std::ifstream::in); - vector activeBots, totalBots, avgDiff; + std::vector activeBots, totalBots, avgDiff; uint32 runTime, maxBots = 0, start=0; @@ -83,7 +83,7 @@ void LogAnalysis::AnalysePid() std::stringstream ss; ss << hour.count() << " Hours : " << mins.count() << " Minutes : " << secs.count() << " Seconds "; - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "," << "PID" << "," << ss.str().c_str() << "," << aDiff << "," << aBots << "," << maxBots; @@ -95,7 +95,7 @@ void LogAnalysis::AnalysePid() void LogAnalysis::AnalyseEvents() { - string m_logsDir = sConfig.GetStringDefault("LogsDir"); + std::string m_logsDir = sConfig.GetStringDefault("LogsDir"); if (!m_logsDir.empty()) { if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) @@ -106,7 +106,7 @@ void LogAnalysis::AnalyseEvents() if (in.fail()) return; - map eventCount, eventMin; + std::map eventCount, eventMin; eventMin["AcceptInvitationAction"] = 1; eventMin["AcceptQuestAction"] = 1; @@ -143,7 +143,7 @@ void LogAnalysis::AnalyseEvents() eventCount[tokens[2]]++; } while (in.good()); - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "," << "EVENT"; @@ -160,7 +160,7 @@ void LogAnalysis::AnalyseEvents() void LogAnalysis::AnalyseQuests() { - string m_logsDir = sConfig.GetStringDefault("LogsDir"); + std::string m_logsDir = sConfig.GetStringDefault("LogsDir"); if (!m_logsDir.empty()) { if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) @@ -172,7 +172,7 @@ void LogAnalysis::AnalyseQuests() if (in.fail()) return; - map questId, questStartCount, questObjective, questCompletedCount, questEndCount; + std::map questId, questStartCount, questObjective, questCompletedCount, questEndCount; do { @@ -218,7 +218,7 @@ void LogAnalysis::AnalyseQuests() } } while (in.good()); - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "," << "QUEST"; @@ -242,7 +242,7 @@ void LogAnalysis::AnalyseQuests() void LogAnalysis::AnalyseCounts() { - string m_logsDir = sConfig.GetStringDefault("LogsDir"); + std::string m_logsDir = sConfig.GetStringDefault("LogsDir"); if (!m_logsDir.empty()) { if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) @@ -255,7 +255,7 @@ void LogAnalysis::AnalyseCounts() uint32 maxShow = 10; - map countType; + std::map countType; countType["TalkToQuestGiverAction"] = "Quest completed"; countType["EquipAction"] = "Item equiped"; countType["StoreLootAction"] = "Item looted"; @@ -268,7 +268,7 @@ void LogAnalysis::AnalyseCounts() countType["AttackAnythingAction"] = "Mob attacked"; countType["XpGainAction"] = "Mob killed"; - map> counts; + std::map> counts; do { @@ -302,15 +302,15 @@ void LogAnalysis::AnalyseCounts() for (auto& count : counts) { - vector> list; - ostringstream out; + std::vector> list; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "," << "COUNT-" << count.first; for (auto type : count.second) list.push_back(make_pair(type.first, type.second)); - std::sort(list.begin(), list.end(), [](pair i, pair j) { return i.second > j.second; }); + std::sort(list.begin(), list.end(), [](std::pair i, std::pair j) { return i.second > j.second; }); for(auto& l:list) out << ",{" << l.first << "," << l.second << "}"; diff --git a/playerbot/BotTests.h b/playerbot/BotTests.h index 7476db81..6b1ce455 100644 --- a/playerbot/BotTests.h +++ b/playerbot/BotTests.h @@ -1,7 +1,5 @@ #pragma once -using namespace std; - namespace ai { class LogAnalysis diff --git a/playerbot/ChatFilter.cpp b/playerbot/ChatFilter.cpp index 1c09c90b..b3a3a03b 100644 --- a/playerbot/ChatFilter.cpp +++ b/playerbot/ChatFilter.cpp @@ -5,11 +5,10 @@ #include "ChatHelper.h" using namespace ai; -using namespace std; -string ChatFilter::Filter(string message, string filter) +std::string ChatFilter::Filter(std::string message, std::string filter) { - if (message.find("@") == string::npos) + if (message.find("@") == std::string::npos) return message; if(filter.empty()) @@ -25,12 +24,12 @@ class StrategyChatFilter : public ChatFilter StrategyChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "strategy"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@nc=rpg"] = "All bots that have rpg strategy enabled in noncombat state."; retMap["@nonc=travel"] = "All bots that do not have travel strategy enabled in noncombat state."; retMap["@co=melee"] = "All bots that have melee strategy enabled in combat state."; @@ -38,18 +37,18 @@ class StrategyChatFilter : public ChatFilter retMap["@dead=<>"] = "All bots that have <> strategy enabled in dead state."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on their strategies."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); if (message.find("@nc=") == 0) { - string strat = message.substr(message.find("=")+1, message.find(" ") - (message.find("=")+1)); + std::string strat = message.substr(message.find("=")+1, message.find(" ") - (message.find("=")+1)); if (!strat.empty()) { @@ -60,7 +59,7 @@ class StrategyChatFilter : public ChatFilter } if (message.find("@nonc=") == 0) { - string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); + std::string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); if (!strat.empty()) { @@ -72,7 +71,7 @@ class StrategyChatFilter : public ChatFilter } if (message.find("@co=") == 0) { - string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); + std::string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); if (!strat.empty()) { @@ -84,7 +83,7 @@ class StrategyChatFilter : public ChatFilter } if (message.find("@noco=") == 0) { - string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); + std::string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); if (!strat.empty()) { @@ -96,7 +95,7 @@ class StrategyChatFilter : public ChatFilter } if (message.find("@react=") == 0) { - string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); + std::string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); if (!strat.empty()) { @@ -108,7 +107,7 @@ class StrategyChatFilter : public ChatFilter } if (message.find("@noreact=") == 0) { - string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); + std::string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); if (!strat.empty()) { @@ -120,7 +119,7 @@ class StrategyChatFilter : public ChatFilter } if (message.find("@dead=") == 0) { - string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); + std::string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); if (!strat.empty()) { @@ -132,7 +131,7 @@ class StrategyChatFilter : public ChatFilter } if (message.find("@nodead=") == 0) { - string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); + std::string strat = message.substr(message.find("=") + 1, message.find(" ") - (message.find("=") + 1)); if (!strat.empty()) { @@ -153,12 +152,12 @@ class RoleChatFilter : public ChatFilter RoleChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "role"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@tank"] = "All bots that have a tank spec."; retMap["@dps"] = "All bots that do not have a tank or healing spec."; retMap["@heal"] = "All bots that have a healing spec."; @@ -169,12 +168,12 @@ class RoleChatFilter : public ChatFilter retMap["@melee"] = "All bots that use melee attacks."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots with a specific role or weapon range."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); const bool inGroup = bot->GetGroup() != nullptr; @@ -224,29 +223,29 @@ class LevelChatFilter : public ChatFilter LevelChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "level"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@60"] = "All bots that are level 60."; retMap["@10-20"] = "All bots ranging from level 10 to 20."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on level."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); if (message[0] != '@') return message; - if (message.find("-") != string::npos) + if (message.find("-") != std::string::npos) { uint32 fromLevel = atoi(message.substr(message.find("@") + 1, message.find("-")).c_str()); uint32 toLevel = atoi(message.substr(message.find("-") + 1, message.find(" ")).c_str()); @@ -271,22 +270,22 @@ class GearChatFilter : public ChatFilter GearChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "gear"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@tier1"] = "All bots that have an avarage item level comparable to tier1"; retMap["@tier2-3"] = "All bots an avarage item level comparable to tier2 or tier3."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on gear level."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); @@ -298,7 +297,7 @@ class GearChatFilter : public ChatFilter uint32 botTier = 0; uint32 gs = ai->GetEquipGearScore(bot, false, false); - if (message.find("-") != string::npos) + if (message.find("-") != std::string::npos) { fromLevel = atoi(message.substr(message.find("@tier") + 5, message.find("-")).c_str()); toLevel = atoi(message.substr(message.find("-") + 1, message.find(" ")).c_str()); @@ -344,22 +343,22 @@ class CombatTypeChatFilter : public ChatFilter CombatTypeChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "combat"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@ranged"] = "All bots that use ranged attacks."; retMap["@melee"] = "All bots that use melee attacks."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots with a specific weapon range."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); @@ -410,17 +409,17 @@ class RtiChatFilter : public ChatFilter { public: #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "rti"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@star"] = "All bots that are marked with or are targeing something marked with star."; retMap["@circle"] = "All bots that are marked with or are targeing something marked with star."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots that are marked with or are targeting sonething marked with a raid target icon."; } #endif @@ -437,7 +436,7 @@ class RtiChatFilter : public ChatFilter rtis.push_back("@skull"); } - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); Group *group = bot->GetGroup(); @@ -446,9 +445,9 @@ class RtiChatFilter : public ChatFilter bool found = false; bool isRti = false; - for (list::iterator i = rtis.begin(); i != rtis.end(); i++) + for (std::list::iterator i = rtis.begin(); i != rtis.end(); i++) { - string rti = *i; + std::string rti = *i; bool isRti = message.find(rti) == 0; if (!isRti) @@ -477,7 +476,7 @@ class RtiChatFilter : public ChatFilter } private: - list rtis; + std::list rtis; }; class ClassChatFilter : public ChatFilter @@ -500,28 +499,28 @@ class ClassChatFilter : public ChatFilter } #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "class"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@rogue"] = "All rogue bots."; retMap["@warlock"] = "All warlock bots."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots have a certain class."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); bool found = false; bool isClass = false; - for (map::iterator i = classNames.begin(); i != classNames.end(); i++) + for (std::map::iterator i = classNames.begin(); i != classNames.end(); i++) { bool isClass = message.find(i->first) == 0; if (isClass && bot->getClass() != i->second) @@ -539,7 +538,7 @@ class ClassChatFilter : public ChatFilter } private: - map classNames; + std::map classNames; }; class GroupChatFilter : public ChatFilter @@ -548,12 +547,12 @@ class GroupChatFilter : public ChatFilter GroupChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "group"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@group"] = "All bots in a group."; retMap["@group2"] = "All bots in group 2."; retMap["@group4-6"] = "All bots in group 4 to 6."; @@ -564,21 +563,21 @@ class GroupChatFilter : public ChatFilter retMap["@rleader"] = "All bots that are leader of a raid group."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on their group."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); if (message.find("@group") == 0) { - string pnum = message.substr(6, message.find(" ")-6); + std::string pnum = message.substr(6, message.find(" ")-6); int from = atoi(pnum.c_str()); int to = from; - if (pnum.find("-") != string::npos) + if (pnum.find("-") != std::string::npos) { from = atoi(pnum.substr(pnum.find("@") + 1, pnum.find("-")).c_str()); to = atoi(pnum.substr(pnum.find("-") + 1, pnum.find(" ")).c_str()); @@ -642,12 +641,12 @@ class GuildChatFilter : public ChatFilter GuildChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "guild"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@guild"] = "All bots in a guild."; retMap["@guild=raiders"] = "All bots in guild raiders."; retMap["@noguild"] = "All bots not in a guild."; @@ -655,12 +654,12 @@ class GuildChatFilter : public ChatFilter retMap["@rank=Initiate"] = "All bots that have rank Initiate in their guild."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on their guild."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); @@ -669,12 +668,12 @@ class GuildChatFilter : public ChatFilter if (!bot->GetGuildId()) return message; - string pguild = message.substr(7, message.find(" ")-7); + std::string pguild = message.substr(7, message.find(" ")-7); if (!pguild.empty()) { Guild* guild = sGuildMgr.GetGuildById(bot->GetGuildId()); - string guildName = guild->GetName(); + std::string guildName = guild->GetName(); if (pguild.find(guildName) != 0) return message; @@ -687,12 +686,12 @@ class GuildChatFilter : public ChatFilter if (!bot->GetGuildId()) return message; - string pguild = message.substr(6, message.find(" ")); + std::string pguild = message.substr(6, message.find(" ")); if (!pguild.empty()) { Guild* guild = sGuildMgr.GetGuildById(bot->GetGuildId()); - string guildName = guild->GetName(); + std::string guildName = guild->GetName(); if (pguild.find(guildName) == 0) return message; @@ -723,12 +722,12 @@ class GuildChatFilter : public ChatFilter if (!bot->GetGuildId()) return message; - string rank = message.substr(6, message.find(" ")-6); + std::string rank = message.substr(6, message.find(" ")-6); if (!rank.empty()) { Guild* guild = sGuildMgr.GetGuildById(bot->GetGuildId()); - string rankName = guild->GetRankName(guild->GetRank(bot->GetObjectGuid())); + std::string rankName = guild->GetRankName(guild->GetRank(bot->GetObjectGuid())); if (rank.find(rankName) != 0) return message; @@ -747,23 +746,23 @@ class StateChatFilter : public ChatFilter StateChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "state"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@needrepair"] = "All bots that have durability below 20%."; retMap["@outside"] = "All bots that are outside of an instance."; retMap["@inside"] = "All bots that are inside an instance."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on their state."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); AiObjectContext* context = bot->GetPlayerbotAI()->GetAiObjectContext(); @@ -800,32 +799,32 @@ class UsageChatFilter : public ChatFilter UsageChatFilter(PlayerbotAI * ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "usage"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@use=[itemlink]"] = "All bots that have some use for this item."; retMap["@sell=[itemlink]"] = "All bots that will vendor or AH this item."; retMap["@need=[itemlink]"] = "All bots that will roll need on this item."; retMap["@greed=[itemlink]"] = "All bots that will roll greed on this item."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on the use they have for a specific item."; } #endif - string FilterLink(string message) + std::string FilterLink(std::string message) { - if (message.find("@") == string::npos) + if (message.find("@") == std::string::npos) return message; return message.substr(message.find("|r ") + 3); } - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); @@ -833,12 +832,12 @@ class UsageChatFilter : public ChatFilter if (message.find("@use=") == 0) { - string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); + std::string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); if (item.empty()) return message; - set qualifiers = ChatHelper::parseItemQualifiers(item); + std::set qualifiers = ChatHelper::parseItemQualifiers(item); if(qualifiers.empty()) return message; @@ -854,12 +853,12 @@ class UsageChatFilter : public ChatFilter } if (message.find("@sell=") == 0) { - string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); + std::string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); if (item.empty()) return message; - set qualifiers = ChatHelper::parseItemQualifiers(item); + std::set qualifiers = ChatHelper::parseItemQualifiers(item); if (qualifiers.empty()) return message; @@ -875,12 +874,12 @@ class UsageChatFilter : public ChatFilter } if (message.find("@need=") == 0) { - string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); + std::string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); if (item.empty()) return message; - set qualifiers = ChatHelper::parseItemQualifiers(item); + std::set qualifiers = ChatHelper::parseItemQualifiers(item); if (qualifiers.empty()) return message; @@ -896,12 +895,12 @@ class UsageChatFilter : public ChatFilter } if (message.find("@greed=") == 0) { - string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); + std::string item = message.substr(message.find("=") + 1, message.find("|r ") - (message.find("=") + 3)); if (item.empty()) return message; - set qualifiers = ChatHelper::parseItemQualifiers(item); + std::set qualifiers = ChatHelper::parseItemQualifiers(item); if (qualifiers.empty()) return message; @@ -926,27 +925,27 @@ class TalentSpecChatFilter : public ChatFilter TalentSpecChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "talent spec"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@frost"] = "All bots that have frost spec."; retMap["@holy"] = "All bots that have holy spec."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on their primary talent specialisation."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { Player* bot = ai->GetBot(); AiObjectContext* context = ai->GetAiObjectContext(); - string filter = "@" + ChatHelper::specName(bot); + std::string filter = "@" + ChatHelper::specName(bot); if (message.find(filter) == 0) { @@ -963,23 +962,23 @@ class LocationChatFilter : public ChatFilter LocationChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "location"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@azeroth"] = "All bots in azeroth overworld."; retMap["@eastern kingdoms"] = "All bots in eastern kingdoms overworld."; retMap["@dun morogh"] = "All bots in the dun morogh zone."; return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects bots based on map or zone name."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { if (message.find("@") == 0) { @@ -992,8 +991,8 @@ class LocationChatFilter : public ChatFilter if (map) { - string name = map->GetMapName(); - string filter = name; + std::string name = map->GetMapName(); + std::string filter = name; std::transform(filter.begin(), filter.end(), filter.begin(),[](unsigned char c) { return std::tolower(c); }); @@ -1007,8 +1006,8 @@ class LocationChatFilter : public ChatFilter if (bot->GetTerrain()) { - string name = WorldPosition(bot).getAreaName(true, true); - string filter = name; + std::string name = WorldPosition(bot).getAreaName(true, true); + std::string filter = name; std::transform(filter.begin(), filter.end(), filter.begin(),[](unsigned char c) { return std::tolower(c); }); @@ -1030,12 +1029,12 @@ class RandomChatFilter : public ChatFilter RandomChatFilter(PlayerbotAI* ai) : ChatFilter(ai) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { + virtual std::string GetHelpName() { return "random"; } - virtual unordered_map GetFilterExamples() + virtual std::unordered_map GetFilterExamples() { - unordered_map retMap; + std::unordered_map retMap; retMap["@random"] = "50% chance the bot responds."; retMap["@random=25"] = "25% chance the bot responds."; retMap["@fixedrandom"] = "50% chance the bot responds. But always the same bots."; @@ -1043,16 +1042,16 @@ class RandomChatFilter : public ChatFilter return retMap; } - virtual string GetHelpDescription() { + virtual std::string GetHelpDescription() { return "This filter selects random bots."; } #endif - virtual string Filter(string message) override + virtual std::string Filter(std::string message) override { if (message.find("@random=") == 0) { - string num = message.substr(message.find("=") + 1, message.find(" ") - message.find("=")-1); + std::string num = message.substr(message.find("=") + 1, message.find(" ") - message.find("=")-1); if (urand(0, 100) < stoul(num)) return ChatFilter::Filter(message); @@ -1065,7 +1064,7 @@ class RandomChatFilter : public ChatFilter } if (message.find("@fixedrandom=") == 0) { - string num = message.substr(message.find("=") + 1, message.find(" ") - message.find("=") - 1); + std::string num = message.substr(message.find("=") + 1, message.find(" ") - message.find("=") - 1); if (ai->GetFixedBotNumer(BotTypeNumber::CHATFILTER_NUMBER) < stoul(num)) return ChatFilter::Filter(message); @@ -1102,15 +1101,15 @@ CompositeChatFilter::CompositeChatFilter(PlayerbotAI* ai) : ChatFilter(ai) CompositeChatFilter::~CompositeChatFilter() { - for (list::iterator i = filters.begin(); i != filters.end(); i++) + for (std::list::iterator i = filters.begin(); i != filters.end(); i++) delete (*i); } -string CompositeChatFilter::Filter(string message) +std::string CompositeChatFilter::Filter(std::string message) { for (int j = 0; j < filters.size(); ++j) { - for (list::iterator i = filters.begin(); i != filters.end(); i++) + for (std::list::iterator i = filters.begin(); i != filters.end(); i++) { message = (*i)->Filter(message); if (message.empty()) diff --git a/playerbot/ChatFilter.h b/playerbot/ChatFilter.h index a160f0c7..8229b4f4 100644 --- a/playerbot/ChatFilter.h +++ b/playerbot/ChatFilter.h @@ -1,21 +1,19 @@ #pragma once -using namespace std; - namespace ai { class ChatFilter : public PlayerbotAIAware { public: ChatFilter(PlayerbotAI* ai) : PlayerbotAIAware(ai) {} - virtual string Filter(string message) { return Filter(message, ""); } - virtual string Filter(string message, string filter); + virtual std::string Filter(std::string message) { return Filter(message, ""); } + virtual std::string Filter(std::string message, std::string filter); virtual ~ChatFilter() {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dummy"; } - virtual unordered_map GetFilterExamples() {return {};} - virtual string GetHelpDescription() { return ""; } + virtual std::string GetHelpName() { return "dummy"; } + virtual std::unordered_map GetFilterExamples() {return {};} + virtual std::string GetHelpDescription() { return ""; } #endif }; @@ -24,11 +22,11 @@ namespace ai public: CompositeChatFilter(PlayerbotAI* ai); virtual ~CompositeChatFilter(); - string Filter(string message); + std::string Filter(std::string message); #ifdef GenerateBotHelp - virtual list GetFilters() { return filters;} + virtual std::list GetFilters() { return filters;} #endif private: - list filters; + std::list filters; }; }; diff --git a/playerbot/ChatHelper.cpp b/playerbot/ChatHelper.cpp index bd35133a..69fcb131 100644 --- a/playerbot/ChatHelper.cpp +++ b/playerbot/ChatHelper.cpp @@ -7,28 +7,27 @@ #include using namespace ai; -using namespace std; - -map ChatHelper::consumableSubClasses; -map ChatHelper::tradeSubClasses; -map ChatHelper::itemQualities; -map ChatHelper::projectileSubClasses; -map> ChatHelper::itemClasses; -map ChatHelper::slots; -map ChatHelper::skills; -map ChatHelper::chats; -map ChatHelper::classes; -map ChatHelper::races; -map > ChatHelper::specs; -unordered_map> ChatHelper::spellIds; + +std::map ChatHelper::consumableSubClasses; +std::map ChatHelper::tradeSubClasses; +std::map ChatHelper::itemQualities; +std::map ChatHelper::projectileSubClasses; +std::map> ChatHelper::itemClasses; +std::map ChatHelper::slots; +std::map ChatHelper::skills; +std::map ChatHelper::chats; +std::map ChatHelper::classes; +std::map ChatHelper::races; +std::map > ChatHelper::specs; +std::unordered_map> ChatHelper::spellIds; template -static bool substrContainsInMap(string searchTerm, map searchIn) +static bool substrContainsInMap(std::string searchTerm, std::map searchIn) { - for (typename map::iterator i = searchIn.begin(); i != searchIn.end(); ++i) + for (typename std::map::iterator i = searchIn.begin(); i != searchIn.end(); ++i) { - string term = i->first; - if (term.size() > 1 && searchTerm.find(term) != string::npos) + std::string term = i->first; + if (term.size() > 1 && searchTerm.find(term) != std::string::npos) return true; } @@ -211,9 +210,9 @@ ChatHelper::ChatHelper(PlayerbotAI* ai) : PlayerbotAIAware(ai) #endif } -string ChatHelper::formatMoney(uint32 copper) +std::string ChatHelper::formatMoney(uint32 copper) { - ostringstream out; + std::ostringstream out; if (!copper) { out << "0"; @@ -248,10 +247,10 @@ string ChatHelper::formatMoney(uint32 copper) return out.str(); } -uint32 ChatHelper::parseMoney(string& text) +uint32 ChatHelper::parseMoney(std::string& text) { // if user specified money in ##g##s##c format - string acum = ""; + std::string acum = ""; uint32 copper = 0; for (uint8 i = 0; i < text.length(); i++) { @@ -283,7 +282,7 @@ uint32 ChatHelper::parseMoney(string& text) return copper; } -ItemIds ChatHelper::parseItems(string& text) +ItemIds ChatHelper::parseItems(std::string& text) { ItemIds itemIds; @@ -297,7 +296,7 @@ ItemIds ChatHelper::parseItems(string& text) int endPos = text.find(':', pos); if (endPos == -1) break; - string idC = text.substr(pos, endPos - pos); + std::string idC = text.substr(pos, endPos - pos); uint32 id = atol(idC.c_str()); pos = endPos; if (id) @@ -307,9 +306,9 @@ ItemIds ChatHelper::parseItems(string& text) return itemIds; } -set ChatHelper::parseItemQualifiers(string& text) +std::set ChatHelper::parseItemQualifiers(std::string& text) { - set qualifiers; + std::set qualifiers; uint8 pos = 0; while (true) @@ -322,7 +321,7 @@ set ChatHelper::parseItemQualifiers(string& text) if (endPos == -1) break; - string qualifierString = text.substr(pos, endPos - pos); + std::string qualifierString = text.substr(pos, endPos - pos); qualifiers.insert(qualifierString); } @@ -330,9 +329,9 @@ set ChatHelper::parseItemQualifiers(string& text) return qualifiers; } -string ChatHelper::formatQuest(Quest const* quest) +std::string ChatHelper::formatQuest(Quest const* quest) { - ostringstream out; + std::ostringstream out; int loc_idx = sPlayerbotTextMgr.GetLocalePriority(); std::string title = quest->GetTitle(); sObjectMgr.GetQuestLocaleStrings(quest->GetQuestId(), loc_idx, &title); @@ -340,9 +339,9 @@ string ChatHelper::formatQuest(Quest const* quest) return out.str(); } -string ChatHelper::formatGameobject(GameObject* go) +std::string ChatHelper::formatGameobject(GameObject* go) { - ostringstream out; + std::ostringstream out; int loc_idx = sPlayerbotTextMgr.GetLocalePriority(); std::string name = go->GetGOInfo()->name; if (loc_idx >= 0) @@ -358,9 +357,9 @@ string ChatHelper::formatGameobject(GameObject* go) return out.str(); } -string ChatHelper::formatWorldobject(WorldObject* wo) +std::string ChatHelper::formatWorldobject(WorldObject* wo) { - ostringstream out; + std::ostringstream out; int loc_idx = sPlayerbotTextMgr.GetLocalePriority(); std::string name = (wo->IsGameObject() ? ((GameObject*)wo)->GetGOInfo()->name : wo->GetName()); if (loc_idx >= 0 && wo->IsGameObject()) @@ -376,7 +375,7 @@ string ChatHelper::formatWorldobject(WorldObject* wo) return out.str(); } -string ChatHelper::formatWorldEntry(int32 entry) +std::string ChatHelper::formatWorldEntry(int32 entry) { CreatureInfo const* cInfo = NULL; GameObjectInfo const* gInfo = NULL; @@ -386,7 +385,7 @@ string ChatHelper::formatWorldEntry(int32 entry) else gInfo = ObjectMgr::GetGameObjectInfo(entry * -1); - ostringstream out; + std::ostringstream out; out << "|cFFFFFF00|Hentry:" << abs(entry) << ":" << "|h["; int loc_idx = sPlayerbotTextMgr.GetLocalePriority(); @@ -423,20 +422,20 @@ string ChatHelper::formatWorldEntry(int32 entry) return out.str(); } -string ChatHelper::formatSpell(SpellEntry const *sInfo) +std::string ChatHelper::formatSpell(SpellEntry const *sInfo) { - ostringstream out; + std::ostringstream out; out << "|cffffffff|Hspell:" << sInfo->Id << "|h[" << sInfo->SpellName[LOCALE_enUS] << "]|h|r"; return out.str(); } -string ChatHelper::formatItem(ItemQualifier& itemQualifier, int count, int total) +std::string ChatHelper::formatItem(ItemQualifier& itemQualifier, int count, int total) { char color[32]; ItemPrototype const* proto = itemQualifier.GetProto(); sprintf(color, "%x", ItemQualityColors[proto->Quality]); - ostringstream out; + std::ostringstream out; int loc_idx = sPlayerbotTextMgr.GetLocalePriority(); std::string name = proto->Name1; if (loc_idx >= 0) @@ -455,7 +454,7 @@ string ChatHelper::formatItem(ItemQualifier& itemQualifier, int count, int total { if (loc_idx < 0) loc_idx = 0; - string suffix = item_rand->nameSuffix[loc_idx]; + std::string suffix = item_rand->nameSuffix[loc_idx]; name += " " + suffix; } } @@ -472,24 +471,24 @@ string ChatHelper::formatItem(ItemQualifier& itemQualifier, int count, int total return out.str(); } -string ChatHelper::formatItem(ItemPrototype const* proto, int count, int total) +std::string ChatHelper::formatItem(ItemPrototype const* proto, int count, int total) { ItemQualifier ItemQualifier(proto->ItemId); return formatItem(ItemQualifier, count, total); } -string ChatHelper::formatItem(Item* item, int count, int total) +std::string ChatHelper::formatItem(Item* item, int count, int total) { ItemQualifier itemQualifier(item); return formatItem(itemQualifier, count, total); } -string ChatHelper::formatQItem(uint32 itemId) +std::string ChatHelper::formatQItem(uint32 itemId) { char color[32]; sprintf(color, "%x", ItemQualityColors[0]); - ostringstream out; + std::ostringstream out; out << "|c" << color << "|Hitem:" << itemId << ":0:0:0:0:0:0:0" << "|h[item" << "]|h|r"; @@ -497,7 +496,7 @@ string ChatHelper::formatQItem(uint32 itemId) return out.str(); } -ChatMsg ChatHelper::parseChat(string& text) +ChatMsg ChatHelper::parseChat(std::string& text) { if (chats.find(text) != chats.end()) return chats[text]; @@ -505,7 +504,7 @@ ChatMsg ChatHelper::parseChat(string& text) return CHAT_MSG_SYSTEM; } -string ChatHelper::formatChat(ChatMsg chat) +std::string ChatHelper::formatChat(ChatMsg chat) { switch (chat) { @@ -523,15 +522,15 @@ string ChatHelper::formatChat(ChatMsg chat) } -uint32 ChatHelper::parseSpell(string& text) +uint32 ChatHelper::parseSpell(std::string& text) { PlayerbotChatHandler handler(ai->GetBot()); return handler.extractSpellId(text); } -list ChatHelper::parseGameobjects(string& text) +std::list ChatHelper::parseGameobjects(std::string& text) { - list gos; + std::list gos; // Link format // |cFFFFFF00|Hfound:" << guid << ':' << entry << ':' << "|h[" << gInfo->name << "]|h|r"; // |cFFFFFF00|Hfound:9582:1731|h[Copper Vein]|h|r @@ -548,7 +547,7 @@ list ChatHelper::parseGameobjects(string& text) int endPos = text.find(':', pos); // end of window in text 22 if (endPos == -1) //break if error break; - istringstream stream(text.substr(pos, endPos - pos)); + std::istringstream stream(text.substr(pos, endPos - pos)); uint64 guid; stream >> guid; // extract GO entry @@ -557,8 +556,8 @@ list ChatHelper::parseGameobjects(string& text) if (endPos == -1) //break if error break; - std::string entryC = text.substr(pos, endPos - pos); // get string within window i.e entry - uint32 entry = atol(entryC.c_str()); // convert ascii to float + std::string entryC = text.substr(pos, endPos - pos); // get std::string within window i.e entry + uint32 entry = std::atol(entryC.c_str()); // convert ascii to float ObjectGuid lootCurrent = ObjectGuid(guid); @@ -569,9 +568,9 @@ list ChatHelper::parseGameobjects(string& text) return gos; } -list ChatHelper::parseWorldEntries(string& text) +std::list ChatHelper::parseWorldEntries(std::string& text) { - list entries; + std::list entries; // Link format // |cFFFFFF00|Hentry:" << entry << ':' << "|h[" << gInfo->name << "]|h|r"; // |cFFFFFF00|Hfound:9582:1731|h[Copper Vein]|h|r @@ -588,8 +587,8 @@ list ChatHelper::parseWorldEntries(string& text) int endPos = text.find(':', pos); // end of window in text 22 if (endPos == -1) //break if error break; - std::string entryC = text.substr(pos, endPos - pos); // get string within window i.e entry - uint32 entry = atol(entryC.c_str()); // convert ascii to float + std::string entryC = text.substr(pos, endPos - pos); // get std::string within window i.e entry + uint32 entry = std::atol(entryC.c_str()); // convert ascii to float if (entry) entries.push_back(entry); @@ -598,24 +597,24 @@ list ChatHelper::parseWorldEntries(string& text) return entries; } -string ChatHelper::formatQuestObjective(string name, int available, int required) +std::string ChatHelper::formatQuestObjective(std::string name, int available, int required) { - ostringstream out; + std::ostringstream out; out << "|cFFFFFFFF" << name << (available >= required ? "|c0000FF00: " : "|c00FF0000: ") << available << "/" << required << "|r"; return out.str(); } -string ChatHelper::formatValue(string type, string topicCode, string topicName, string color) +std::string ChatHelper::formatValue(std::string type, std::string topicCode, std::string topicName, std::string color) { - ostringstream out; + std::ostringstream out; out << "|c"<< color << "|Hvalue:" << type << ":" << topicCode << "|h[" << topicName << "]|h|r"; return out.str(); } -string ChatHelper::parseValue(string type, string& text) { - string retString; +std::string ChatHelper::parseValue(std::string type, std::string& text) { + std::string retString; std::string pattern = "Hvalue:" + type + ":"; @@ -633,7 +632,7 @@ string ChatHelper::parseValue(string type, string& text) { return retString; } -uint32 ChatHelper::parseItemQuality(string text) +uint32 ChatHelper::parseItemQuality(std::string text) { if (itemQualities.find(text) == itemQualities.end()) return MAX_ITEM_QUALITY; @@ -641,7 +640,7 @@ uint32 ChatHelper::parseItemQuality(string text) return itemQualities[text]; } -bool ChatHelper::parseItemClass(string text, uint32 *itemClass, uint32 *itemSubClass) +bool ChatHelper::parseItemClass(std::string text, uint32 *itemClass, uint32 *itemSubClass) { if (text == "questitem") { @@ -681,7 +680,7 @@ bool ChatHelper::parseItemClass(string text, uint32 *itemClass, uint32 *itemSubC return false; } -uint32 ChatHelper::parseSlot(string text) +uint32 ChatHelper::parseSlot(std::string text) { if (slots.find(text) != slots.end()) return slots[text]; @@ -689,34 +688,34 @@ uint32 ChatHelper::parseSlot(string text) return EQUIPMENT_SLOT_END; } -bool ChatHelper::parseable(string text) +bool ChatHelper::parseable(std::string text) { - return text.find("|H") != string::npos || - text.find("[h:") != string::npos || + return text.find("|H") != std::string::npos || + text.find("[h:") != std::string::npos || text == "questitem" || text == "ammo" || substrContainsInMap(text, consumableSubClasses) || substrContainsInMap(text, tradeSubClasses) || substrContainsInMap(text, itemQualities) || - (substrContainsInMap(text, slots) && text.find("rtsc ") == string::npos) || - (substrContainsInMap(text, chats) && text.find(" on party") == string::npos) || + (substrContainsInMap(text, slots) && text.find("rtsc ") == std::string::npos) || + (substrContainsInMap(text, chats) && text.find(" on party") == std::string::npos) || substrContainsInMap(text, skills) || parseMoney(text) > 0; } -string ChatHelper::specName(Player* player) +std::string ChatHelper::specName(Player* player) { return specs[player->getClass()][AiFactory::GetPlayerSpecTab(player)]; } -string ChatHelper::formatClass(Player* player, int spec) +std::string ChatHelper::formatClass(Player* player, int spec) { uint8 cls = player->getClass(); - ostringstream out; + std::ostringstream out; out << specs[cls][spec] << " ("; - map tabs = AiFactory::GetPlayerSpecTabs(player); + std::map tabs = AiFactory::GetPlayerSpecTabs(player); int c0 = (int)tabs[0]; int c1 = (int)tabs[1]; int c2 = (int)tabs[2]; @@ -729,17 +728,17 @@ string ChatHelper::formatClass(Player* player, int spec) return out.str(); } -string ChatHelper::formatClass(uint8 cls) +std::string ChatHelper::formatClass(uint8 cls) { return classes[cls]; } -string ChatHelper::formatRace(uint8 race) +std::string ChatHelper::formatRace(uint8 race) { return races[race]; } -uint32 ChatHelper::parseSkill(string& text) +uint32 ChatHelper::parseSkill(std::string& text) { if (skills.find(text) != skills.end()) return skills[text]; @@ -747,9 +746,9 @@ uint32 ChatHelper::parseSkill(string& text) return SKILL_NONE; } -string ChatHelper::formatSkill(uint32 skill) +std::string ChatHelper::formatSkill(uint32 skill) { - for (map::iterator i = skills.begin(); i != skills.end(); ++i) + for (std::map::iterator i = skills.begin(); i != skills.end(); ++i) { if (i->second == skill) return i->first; @@ -758,18 +757,18 @@ string ChatHelper::formatSkill(uint32 skill) return ""; } -string ChatHelper::formatAngle(float angle) +std::string ChatHelper::formatAngle(float angle) { - vector headings = { "north", "north west", "west", "south west", "south", "south east", "east", "north east" }; + std::vector headings = { "north", "north west", "west", "south west", "south", "south east", "east", "north east" }; float headingAngle = angle / M_PI_F * 180; return headings[int32(round(headingAngle / 45)) % 8]; } -string ChatHelper::formatWorldPosition(WorldPosition& pos) +std::string ChatHelper::formatWorldPosition(WorldPosition& pos) { - ostringstream out; + std::ostringstream out; out << std::fixed << std::setprecision(2); out << pos.getX() << "," << pos.getY() << "," << pos.getZ(); if (pos.getO()) @@ -783,9 +782,9 @@ string ChatHelper::formatWorldPosition(WorldPosition& pos) } -string ChatHelper::formatGuidPosition(GuidPosition& guidP) +std::string ChatHelper::formatGuidPosition(GuidPosition& guidP) { - ostringstream out; + std::ostringstream out; if (guidP.GetWorldObject()) out << guidP.GetWorldObject()->GetName(); else if (guidP.GetCreatureTemplate()) @@ -804,7 +803,7 @@ string ChatHelper::formatGuidPosition(GuidPosition& guidP) -string ChatHelper::formatBoolean(bool flag) +std::string ChatHelper::formatBoolean(bool flag) { return flag ? "|cff00ff00ON|r" : "|cffffff00OFF|r"; } @@ -812,10 +811,10 @@ string ChatHelper::formatBoolean(bool flag) void ChatHelper::eraseAllSubStr(std::string& mainStr, const std::string& toErase) { size_t pos = std::string::npos; - // Search for the substring in string in a loop untill nothing is found + // Search for the substring in std::string in a loop untill nothing is found while ((pos = mainStr.find(toErase)) != std::string::npos) { - // If found then erase it from string + // If found then erase it from std::string mainStr.erase(pos, toErase.length()); } } @@ -847,7 +846,7 @@ void ChatHelper::PopulateSpellNameList() if (!tempSpell) continue; - string lowerSpellName = tempSpell->SpellName[0]; + std::string lowerSpellName = tempSpell->SpellName[0]; strToLower(lowerSpellName); spellIds[tempSpell->SpellName[0]].push_back(tempSpell->Id); @@ -855,7 +854,7 @@ void ChatHelper::PopulateSpellNameList() } } -vector ChatHelper::SpellIds(const string& name) +std::vector ChatHelper::SpellIds(const std::string& name) { auto spells = spellIds.find(name); diff --git a/playerbot/ChatHelper.h b/playerbot/ChatHelper.h index d3bb5725..0e9ad711 100644 --- a/playerbot/ChatHelper.h +++ b/playerbot/ChatHelper.h @@ -1,9 +1,12 @@ #pragma once +#include +#include +#include +#include +#include -using namespace std; - -typedef set ItemIds; -typedef set SpellIds; +typedef std::set ItemIds; +typedef std::set SpellIds; namespace ai { @@ -18,74 +21,74 @@ namespace ai ChatHelper(PlayerbotAI* ai); public: - static string formatMoney(uint32 copper); - static uint32 parseMoney(string& text); + static std::string formatMoney(uint32 copper); + static uint32 parseMoney(std::string& text); - static string formatQuest(Quest const* quest); + static std::string formatQuest(Quest const* quest); - static string formatItem(ItemQualifier& itemQualifier, int count = 0, int total = 0); - static string formatItem(ItemPrototype const * proto, int count = 0, int total = 0); - static string formatItem(Item* item, int count = 0, int total = 0); - static string formatQItem(uint32 itemId); - static ItemIds parseItems(string& text); - static set parseItemQualifiers(string& text); - static uint32 parseItemQuality(string text); - static bool parseItemClass(string text, uint32* itemClass, uint32* itemSubClass); - static uint32 parseSlot(string text); + static std::string formatItem(ItemQualifier& itemQualifier, int count = 0, int total = 0); + static std::string formatItem(ItemPrototype const * proto, int count = 0, int total = 0); + static std::string formatItem(Item* item, int count = 0, int total = 0); + static std::string formatQItem(uint32 itemId); + static ItemIds parseItems(std::string& text); + static std::set parseItemQualifiers(std::string& text); + static uint32 parseItemQuality(std::string text); + static bool parseItemClass(std::string text, uint32* itemClass, uint32* itemSubClass); + static uint32 parseSlot(std::string text); - static string formatSpell(SpellEntry const *sInfo); - static string formatSpell(uint32 spellId) {const SpellEntry* const spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return ""; return formatSpell(spellInfo);}; - uint32 parseSpell(string& text); + static std::string formatSpell(SpellEntry const *sInfo); + static std::string formatSpell(uint32 spellId) {const SpellEntry* const spellInfo = sSpellTemplate.LookupEntry(spellId); if (!spellInfo) return ""; return formatSpell(spellInfo);}; + uint32 parseSpell(std::string& text); - static string formatGameobject(GameObject* go); - static list parseGameobjects(string& text); + static std::string formatGameobject(GameObject* go); + static std::list parseGameobjects(std::string& text); - static string formatWorldobject(WorldObject* wo); + static std::string formatWorldobject(WorldObject* wo); - static string formatWorldEntry(int32 entry); - static list parseWorldEntries(string& text); + static std::string formatWorldEntry(int32 entry); + static std::list parseWorldEntries(std::string& text); - static string formatQuestObjective(string name, int available, int required); + static std::string formatQuestObjective(std::string name, int available, int required); - static string formatValue(string type, string code, string name, string color = "0000FFFF"); - static string parseValue(string type, string& text); + static std::string formatValue(std::string type, std::string code, std::string name, std::string color = "0000FFFF"); + static std::string parseValue(std::string type, std::string& text); - static string formatChat(ChatMsg chat); - static ChatMsg parseChat(string& text); + static std::string formatChat(ChatMsg chat); + static ChatMsg parseChat(std::string& text); - static string specName(Player* player); - static string formatClass(Player* player, int spec); - static string formatClass(uint8 cls); + static std::string specName(Player* player); + static std::string formatClass(Player* player, int spec); + static std::string formatClass(uint8 cls); - static string formatRace(uint8 race); + static std::string formatRace(uint8 race); - static string formatSkill(uint32 skill); - uint32 parseSkill(string& text); + static std::string formatSkill(uint32 skill); + uint32 parseSkill(std::string& text); - static string formatAngle(float angle); - static string formatWorldPosition(WorldPosition& pos); - static string formatGuidPosition(GuidPosition& guidP); + static std::string formatAngle(float angle); + static std::string formatWorldPosition(WorldPosition& pos); + static std::string formatGuidPosition(GuidPosition& guidP); - static string formatBoolean(bool flag); + static std::string formatBoolean(bool flag); - static bool parseable(string text); + static bool parseable(std::string text); void eraseAllSubStr(std::string& mainStr, const std::string& toErase); static void PopulateSpellNameList(); - static vector SpellIds(const string& name); + static std::vector SpellIds(const std::string& name); private: - static map consumableSubClasses; - static map tradeSubClasses; - static map itemQualities; - static map projectileSubClasses; - static map> itemClasses; - static map slots; - static map skills; - static map chats; - static map classes; - static map races; - static map > specs; - static unordered_map> spellIds; + static std::map consumableSubClasses; + static std::map tradeSubClasses; + static std::map itemQualities; + static std::map projectileSubClasses; + static std::map> itemClasses; + static std::map slots; + static std::map skills; + static std::map chats; + static std::map classes; + static std::map races; + static std::map > specs; + static std::unordered_map> spellIds; }; }; diff --git a/playerbot/FleeManager.cpp b/playerbot/FleeManager.cpp index 4d99672f..93970f06 100644 --- a/playerbot/FleeManager.cpp +++ b/playerbot/FleeManager.cpp @@ -7,14 +7,13 @@ #include "playerbot/ServerFacade.h" using namespace ai; -using namespace std; void FleeManager::calculateDistanceToCreatures(FleePoint *point) { point->minDistance = -1.0f; point->sumDistance = 0.0f; - list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue >("possible targets no los"); - for (list::iterator i = units.begin(); i != units.end(); ++i) + std::list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue >("possible targets no los"); + for (std::list::iterator i = units.begin(); i != units.end(); ++i) { Unit* unit = bot->GetPlayerbotAI()->GetUnit(*i); if (!unit) @@ -30,9 +29,9 @@ void FleeManager::calculateDistanceToCreatures(FleePoint *point) } } -bool intersectsOri(float angle, list& angles, float angleIncrement) +bool intersectsOri(float angle, std::list& angles, float angleIncrement) { - for (list::iterator i = angles.begin(); i != angles.end(); ++i) + for (std::list::iterator i = angles.begin(); i != angles.end(); ++i) { float ori = *i; if (abs(angle - ori) < angleIncrement) return true; @@ -41,7 +40,7 @@ bool intersectsOri(float angle, list& angles, float angleIncrement) return false; } -void FleeManager::calculatePossibleDestinations(list &points) +void FleeManager::calculatePossibleDestinations(std::list &points) { Unit *target = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue("current target"); @@ -52,9 +51,9 @@ void FleeManager::calculatePossibleDestinations(list &points) FleePoint start(bot->GetPlayerbotAI(), botPosX, botPosY, botPosZ); calculateDistanceToCreatures(&start); - list enemyOri; - list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue >("possible targets no los"); - for (list::iterator i = units.begin(); i != units.end(); ++i) + std::list enemyOri; + std::list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue >("possible targets no los"); + for (std::list::iterator i = units.begin(); i != units.end(); ++i) { Unit* unit = bot->GetPlayerbotAI()->GetUnit(*i); if (!unit) @@ -64,10 +63,10 @@ void FleeManager::calculatePossibleDestinations(list &points) enemyOri.push_back(ori); } - float distIncrement = max(sPlayerbotAIConfig.followDistance, (maxAllowedDistance - sPlayerbotAIConfig.tooCloseDistance) / 10.0f); + float distIncrement = std::max(sPlayerbotAIConfig.followDistance, (maxAllowedDistance - sPlayerbotAIConfig.tooCloseDistance) / 10.0f); for (float dist = maxAllowedDistance; dist >= sPlayerbotAIConfig.tooCloseDistance; dist -= distIncrement) { - float angleIncrement = max(M_PI / 20, M_PI / 4 / (1.0 + dist - sPlayerbotAIConfig.tooCloseDistance)); + float angleIncrement = std::max(M_PI / 20, M_PI / 4 / (1.0 + dist - sPlayerbotAIConfig.tooCloseDistance)); for (float add = 0.0f; add < M_PI / 4 + angleIncrement; add += angleIncrement) { for (float angle = add; angle < add + 2 * M_PI_F + angleIncrement; angle += M_PI_F / 4) @@ -124,9 +123,9 @@ bool FleeManager::isTooCloseToEdge(float x, float y, float z, float angle) return false; } -void FleeManager::cleanup(list &points) +void FleeManager::cleanup(std::list &points) { - for (list::iterator i = points.begin(); i != points.end(); i++) + for (std::list::iterator i = points.begin(); i != points.end(); i++) { FleePoint* point = *i; delete point; @@ -139,10 +138,10 @@ bool FleeManager::isBetterThan(FleePoint* point, FleePoint* other) return point->sumDistance - other->sumDistance > 0; } -FleePoint* FleeManager::selectOptimalDestination(list &points) +FleePoint* FleeManager::selectOptimalDestination(std::list &points) { FleePoint* best = NULL; - for (list::iterator i = points.begin(); i != points.end(); i++) + for (std::list::iterator i = points.begin(); i != points.end(); i++) { FleePoint* point = *i; if (!best || isBetterThan(point, best)) @@ -154,7 +153,7 @@ FleePoint* FleeManager::selectOptimalDestination(list &points) bool FleeManager::CalculateDestination(float* rx, float* ry, float* rz) { - list points; + std::list points; calculatePossibleDestinations(points); FleePoint* point = selectOptimalDestination(points); @@ -178,8 +177,8 @@ bool FleeManager::isUseful() bool const inAoe = bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue("has area debuff", "self target")->Get(); if (!inAoe) { - list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue >("possible targets no los"); - for (list::iterator i = units.begin(); i != units.end(); ++i) + std::list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue >("possible targets no los"); + for (std::list::iterator i = units.begin(); i != units.end(); ++i) { Unit* unit = bot->GetPlayerbotAI()->GetUnit(*i); if (unit) diff --git a/playerbot/FleeManager.h b/playerbot/FleeManager.h index 48b50673..9f52fa74 100644 --- a/playerbot/FleeManager.h +++ b/playerbot/FleeManager.h @@ -2,8 +2,6 @@ #include "WorldPosition.h" -using namespace std; - class Player; namespace ai @@ -48,10 +46,10 @@ namespace ai bool isUseful(); private: - void calculatePossibleDestinations(list &points); + void calculatePossibleDestinations(std::list &points); void calculateDistanceToCreatures(FleePoint *point); - void cleanup(list &points); - FleePoint* selectOptimalDestination(list &points); + void cleanup(std::list &points); + FleePoint* selectOptimalDestination(std::list &points); bool isBetterThan(FleePoint* point, FleePoint* other); bool isTooCloseToEdge(float x, float y, float z, float angle); diff --git a/playerbot/GuidPosition.cpp b/playerbot/GuidPosition.cpp index f2534c5b..c9072eef 100644 --- a/playerbot/GuidPosition.cpp +++ b/playerbot/GuidPosition.cpp @@ -9,9 +9,9 @@ using namespace ai; using namespace MaNGOS; -GuidPosition::GuidPosition(string qualifier) +GuidPosition::GuidPosition(std::string qualifier) { - stringstream b(qualifier); + std::stringstream b(qualifier); uint64 g; char p; @@ -26,9 +26,9 @@ GuidPosition::GuidPosition(string qualifier) ObjectGuid::Set(guid); } -string GuidPosition::to_string() const +std::string GuidPosition::to_string() const { - ostringstream b; + std::ostringstream b; char p = '|'; b << this->getMapId() << p << this->coord_x << p << this->coord_y << p << this->coord_z << p << this->orientation << p << GetRawValue(); return b.str(); @@ -173,9 +173,9 @@ bool GuidPosition::IsEventUnspawned() return false; } -string GuidPosition::print() +std::string GuidPosition::print() { - ostringstream out; + std::ostringstream out; out << this->GetRawValue(); out << ';' << mapid << std::fixed << std::setprecision(2); out << ';' << coord_x; diff --git a/playerbot/GuidPosition.h b/playerbot/GuidPosition.h index 8450fa23..f64e2351 100644 --- a/playerbot/GuidPosition.h +++ b/playerbot/GuidPosition.h @@ -16,9 +16,9 @@ namespace ai GuidPosition(GameObjectDataPair const* dataPair) : ObjectGuid(HIGHGUID_GAMEOBJECT, dataPair->second.id, dataPair->first), WorldPosition(dataPair) {}; GuidPosition(WorldObject* wo) : WorldPosition(wo) { ObjectGuid::Set(wo->GetObjectGuid()); }; GuidPosition(HighGuid hi, uint32 entry, uint32 counter = 1, WorldPosition pos = WorldPosition()) : ObjectGuid(hi, entry, counter), WorldPosition(pos) {}; - GuidPosition(string qualifier); + GuidPosition(std::string qualifier); - virtual string to_string() const override; + virtual std::string to_string() const override; CreatureData* GetCreatureData() { return IsCreature() ? sObjectMgr.GetCreatureData(GetCounter()) : nullptr; } CreatureInfo const* GetCreatureTemplate()const {return IsCreature() ? sObjectMgr.GetCreatureTemplate(GetEntry()) : nullptr; }; @@ -47,7 +47,7 @@ namespace ai uint16 GetGameEventId(); bool IsEventUnspawned(); - virtual string print(); + virtual std::string print(); operator bool() const { return getX() != 0 || getY() != 0 || getZ() != 0 || !IsEmpty(); } bool operator!() const { return getX() == 0 && getY() == 0 && getZ() == 0 && IsEmpty(); } diff --git a/playerbot/Helpers.cpp b/playerbot/Helpers.cpp index a7aa5981..3b536dea 100644 --- a/playerbot/Helpers.cpp +++ b/playerbot/Helpers.cpp @@ -18,11 +18,11 @@ void split(std::vector& dest, const std::string& str, const char* d free(pTempStr); } -vector& split(const string &s, char delim, vector &elems) +std::vector& split(const std::string &s, char delim, std::vector &elems) { - stringstream ss(s); - string item; - while(getline(ss, item, delim)) + std::stringstream ss(s); + std::string item; + while(std::getline(ss, item, delim)) { elems.push_back(item); } @@ -30,9 +30,9 @@ vector& split(const string &s, char delim, vector &elems) } -vector split(const string &s, char delim) +std::vector split(const std::string &s, char delim) { - vector elems; + std::vector elems; return split(s, delim, elems); } diff --git a/playerbot/Helpers.h b/playerbot/Helpers.h index 683bd767..3aa2a8f6 100644 --- a/playerbot/Helpers.h +++ b/playerbot/Helpers.h @@ -1,20 +1,20 @@ #pragma once template -map filterList(vector src, string filter) +std::map filterList(std::vector src, std::string filter) { - map result; + std::map result; if (filter.empty() || filter == "*") { int idx = 0; - for (typename vector::iterator i = src.begin(); i != src.end(); ++i) + for (typename std::vector::iterator i = src.begin(); i != src.end(); ++i) result[idx++] = *i; return result; } - if (filter.find("-") != string::npos) + if (filter.find("-") != std::string::npos) { - vector ss = split(filter, '-'); + std::vector ss = split(filter, '-'); int from = 0, to = src.size() - 1; if (!ss[0].empty()) from = atoi(ss[0].c_str()) - 1; if (ss.size() > 1 && !ss[1].empty()) to = atoi(ss[1].c_str()) - 1; @@ -29,8 +29,8 @@ map filterList(vector src, string filter) return result; } - vector ss = split(filter, ','); - for (vector::iterator i = ss.begin(); i != ss.end(); ++i) + std::vector ss = split(filter, ','); + for (std::vector::iterator i = ss.begin(); i != ss.end(); ++i) { int idx = atoi(i->c_str()) - 1; if (idx < 0) idx = 0; diff --git a/playerbot/LazyCalculatedValue.h b/playerbot/LazyCalculatedValue.h index f7d3d312..65ff8db0 100644 --- a/playerbot/LazyCalculatedValue.h +++ b/playerbot/LazyCalculatedValue.h @@ -1,7 +1,5 @@ #pragma once -using namespace std; - namespace ai { template diff --git a/playerbot/LootObjectStack.cpp b/playerbot/LootObjectStack.cpp index ca77abb1..18d1bf68 100644 --- a/playerbot/LootObjectStack.cpp +++ b/playerbot/LootObjectStack.cpp @@ -5,7 +5,6 @@ #include "playerbot/strategy/values/SharedValueContext.h" using namespace ai; -using namespace std; #define MAX_LOOT_OBJECT_COUNT 10 @@ -37,7 +36,7 @@ bool LootTarget::operator< (const LootTarget& other) const void LootTargetList::shrink(time_t fromTime) { - for (set::iterator i = begin(); i != end(); ) + for (std::set::iterator i = begin(); i != end(); ) { if (i->asOfTime <= fromTime) erase(i++); @@ -102,7 +101,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid guid) #else /*if (!guid.IsEmpty()) { - for (auto& entry : GAI_VALUE2(list, "item drop list", -go->GetEntry())) + for (auto& entry : GAI_VALUE2(std::list, "item drop list", -go->GetEntry())) { if (IsNeededForQuest(bot, entry)) { @@ -118,7 +117,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid guid) return; uint32 goId = go->GetGOInfo()->id; - set& skipGoLootList = ai->GetAiObjectContext()->GetValue& >("skip go loot list")->Get(); + std::set& skipGoLootList = ai->GetAiObjectContext()->GetValue& >("skip go loot list")->Get(); if (skipGoLootList.find(goId) != skipGoLootList.end()) return; uint32 lockId = go->GetGOInfo()->GetLockId(); @@ -145,7 +144,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid guid) else if (SkillByLockType(LockType(lockInfo->Index[i])) > 0) { skillId = SkillByLockType(LockType(lockInfo->Index[i])); - reqSkillValue = max((uint32)1, lockInfo->Skill[i]); + reqSkillValue = std::max((uint32)1, lockInfo->Skill[i]); this->guid = guid; } break; @@ -236,7 +235,7 @@ bool LootObject::IsLootPossible(Player* bot) AiObjectContext* context = ai->GetAiObjectContext(); - if (!AI_VALUE2_LAZY(bool, "should loot object", to_string(guid.GetRawValue()))) + if (!AI_VALUE2_LAZY(bool, "should loot object", std::to_string(guid.GetRawValue()))) return false; // Check if the game object has quest loot and bot has the quest for it @@ -292,7 +291,7 @@ bool LootObjectStack::Add(ObjectGuid guid) if (availableLoot.size() < MAX_LOOT_OBJECT_COUNT) return true; - vector ordered = OrderByDistance(); + std::vector ordered = OrderByDistance(); for (size_t i = MAX_LOOT_OBJECT_COUNT; i < ordered.size(); i++) Remove(ordered[i].guid); @@ -313,21 +312,21 @@ void LootObjectStack::Clear() bool LootObjectStack::CanLoot(float maxDistance) { - vector ordered = OrderByDistance(maxDistance); + std::vector ordered = OrderByDistance(maxDistance); return !ordered.empty(); } LootObject LootObjectStack::GetLoot(float maxDistance) { - vector ordered = OrderByDistance(maxDistance); + std::vector ordered = OrderByDistance(maxDistance); return ordered.empty() ? LootObject() : *ordered.begin(); } -vector LootObjectStack::OrderByDistance(float maxDistance) +std::vector LootObjectStack::OrderByDistance(float maxDistance) { availableLoot.shrink(time(0) - 30); - map sortedMap; + std::map sortedMap; LootTargetList safeCopy(availableLoot); for (LootTargetList::iterator i = safeCopy.begin(); i != safeCopy.end(); i++) { @@ -341,8 +340,8 @@ vector LootObjectStack::OrderByDistance(float maxDistance) sortedMap[distance] = lootObject; } - vector result; - for (map::iterator i = sortedMap.begin(); i != sortedMap.end(); i++) + std::vector result; + for (std::map::iterator i = sortedMap.begin(); i != sortedMap.end(); i++) result.push_back(i->second); return result; } diff --git a/playerbot/LootObjectStack.h b/playerbot/LootObjectStack.h index 0ad6f8fd..ec8d4852 100644 --- a/playerbot/LootObjectStack.h +++ b/playerbot/LootObjectStack.h @@ -1,7 +1,5 @@ #pragma once -using namespace std; - namespace ai { class ItemQualifier; @@ -43,7 +41,7 @@ namespace ai time_t asOfTime; }; - class LootTargetList : public set + class LootTargetList : public std::set { public: void shrink(time_t fromTime); @@ -62,7 +60,7 @@ namespace ai LootObject GetLoot(float maxDistance = 0); private: - vector OrderByDistance(float maxDistance = 0); + std::vector OrderByDistance(float maxDistance = 0); private: Player* bot; diff --git a/playerbot/PerformanceMonitor.cpp b/playerbot/PerformanceMonitor.cpp index 892ca4fa..af3176f5 100644 --- a/playerbot/PerformanceMonitor.cpp +++ b/playerbot/PerformanceMonitor.cpp @@ -18,19 +18,19 @@ PerformanceMonitor::~PerformanceMonitor() } -PerformanceMonitorOperation* PerformanceMonitor::start(PerformanceMetric metric, string name, PerformanceStack* stack) +PerformanceMonitorOperation* PerformanceMonitor::start(PerformanceMetric metric, std::string name, PerformanceStack* stack) { if (!sPlayerbotAIConfig.perfMonEnabled) return NULL; - string stackName = name; + std::string stackName = name; if (stack) { if (!stack->empty()) { - ostringstream out; out << stackName << " ["; - for (vector::reverse_iterator i = stack->rbegin(); i != stack->rend(); ++i) + std::ostringstream out; out << stackName << " ["; + for (std::vector::reverse_iterator i = stack->rbegin(); i != stack->rend(); ++i) out << *i << (std::next(i)==stack->rend()? "":"|"); out << "]"; stackName = out.str().c_str(); @@ -52,7 +52,7 @@ PerformanceMonitorOperation* PerformanceMonitor::start(PerformanceMetric metric, #endif } -PerformanceMonitorOperation* PerformanceMonitor::start(PerformanceMetric metric, string name, PlayerbotAI* ai) +PerformanceMonitorOperation* PerformanceMonitor::start(PerformanceMetric metric, std::string name, PlayerbotAI* ai) { if (!sPlayerbotAIConfig.perfMonEnabled) return NULL; @@ -79,11 +79,11 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) sLog.outString("--------------------------------------[TOTAL BOT]------------------------------------------------------"); - for (map >::iterator i = data.begin(); i != data.end(); ++i) + for (std::map >::iterator i = data.begin(); i != data.end(); ++i) { - map pdMap = i->second; + std::map pdMap = i->second; - string key; + std::string key; switch (i->first) { case PERF_MON_TRIGGER: key = "T"; break; @@ -94,16 +94,16 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) default: key = "?"; } - list names; + std::list names; - for (map::iterator j = pdMap.begin(); j != pdMap.end(); ++j) + for (std::map::iterator j = pdMap.begin(); j != pdMap.end(); ++j) { if (key == "Total" && j->first.find("PlayerbotAI") == std::string::npos) continue; names.push_back(j->first); } - names.sort([pdMap](string i, string j) {return pdMap.at(i)->totalTime < pdMap.at(j)->totalTime; }); + names.sort([pdMap](std::string i, std::string j) {return pdMap.at(i)->totalTime < pdMap.at(j)->totalTime; }); float tPerc = 0; uint32 tMin = 99999, tMax = 0, tCount = 0, tTime = 0; @@ -116,7 +116,7 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) float perc = (float)pd->totalTime / (float)total * 100.0f; float secs = (float)pd->totalTime / 1000.0f; float avg = (float)pd->totalTime / (float)pd->count; - string disName = name; + std::string disName = name; if (!fullStack && disName.find("|") != std::string::npos) disName = disName.substr(0, disName.find("|")) + "]"; @@ -178,11 +178,11 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) sLog.outString(" "); sLog.outString("---------------------------------------[PER TICK]------------------------------------------------------"); - for (map >::iterator i = data.begin(); i != data.end(); ++i) + for (std::map >::iterator i = data.begin(); i != data.end(); ++i) { - map pdMap = i->second; + std::map pdMap = i->second; - string key; + std::string key; switch (i->first) { case PERF_MON_TRIGGER: key = "T"; break; @@ -193,14 +193,14 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) default: key = "?"; } - list names; + std::list names; - for (map::iterator j = pdMap.begin(); j != pdMap.end(); ++j) + for (std::map::iterator j = pdMap.begin(); j != pdMap.end(); ++j) { names.push_back(j->first); } - names.sort([pdMap](string i, string j) {return pdMap.at(i)->totalTime < pdMap.at(j)->totalTime; }); + names.sort([pdMap](std::string i, std::string j) {return pdMap.at(i)->totalTime < pdMap.at(j)->totalTime; }); float tPerc = 0, tCount = 0; uint32 tMin = 99999, tMax = 0, tTime = 0; @@ -214,7 +214,7 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) uint32 secs = pd->totalTime / totalCount; float avg = (float)pd->totalTime / (float)pd->count; float amount = (float)pd->count / (float)totalCount; - string disName = name; + std::string disName = name; if (!fullStack && disName.find("|") != std::string::npos) disName = disName.substr(0, disName.find("|")) + "]"; @@ -275,10 +275,10 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) void PerformanceMonitor::Reset() { - for (map >::iterator i = data.begin(); i != data.end(); ++i) + for (std::map >::iterator i = data.begin(); i != data.end(); ++i) { - map pdMap = i->second; - for (map::iterator j = pdMap.begin(); j != pdMap.end(); ++j) + std::map pdMap = i->second; + for (std::map::iterator j = pdMap.begin(); j != pdMap.end(); ++j) { #ifdef CMANGOS PerformanceData* pd = j->second; @@ -289,7 +289,7 @@ void PerformanceMonitor::Reset() } } -PerformanceMonitorOperation::PerformanceMonitorOperation(PerformanceData* data, string name, PerformanceStack* stack) : data(data), name(name), stack(stack) +PerformanceMonitorOperation::PerformanceMonitorOperation(PerformanceData* data, std::string name, PerformanceStack* stack) : data(data), name(name), stack(stack) { #ifdef CMANGOS started = (std::chrono::time_point_cast(std::chrono::high_resolution_clock::now())).time_since_epoch(); diff --git a/playerbot/PerformanceMonitor.h b/playerbot/PerformanceMonitor.h index aad8e2d4..903ebadd 100644 --- a/playerbot/PerformanceMonitor.h +++ b/playerbot/PerformanceMonitor.h @@ -9,9 +9,7 @@ #include #include -using namespace std; - -typedef vector PerformanceStack; +typedef std::vector PerformanceStack; struct PerformanceData { @@ -33,12 +31,12 @@ enum PerformanceMetric class PerformanceMonitorOperation { public: - PerformanceMonitorOperation(PerformanceData* data, string name, PerformanceStack* stack); + PerformanceMonitorOperation(PerformanceData* data, std::string name, PerformanceStack* stack); void finish(); private: PerformanceData* data; - string name; + std::string name; PerformanceStack* stack; #ifdef CMANGOS std::chrono::milliseconds started; @@ -57,12 +55,12 @@ class PerformanceMonitor } public: - PerformanceMonitorOperation* start(PerformanceMetric metric, string name, PerformanceStack* stack = nullptr); - PerformanceMonitorOperation* start(PerformanceMetric metric, string name, PlayerbotAI* ai); + PerformanceMonitorOperation* start(PerformanceMetric metric, std::string name, PerformanceStack* stack = nullptr); + PerformanceMonitorOperation* start(PerformanceMetric metric, std::string name, PlayerbotAI* ai); void PrintStats(bool perTick = false, bool fullStack = false); void Reset(); private: - map > data; + std::map > data; #ifdef CMANGOS std::mutex lock; #endif diff --git a/playerbot/PlayerbotAI.cpp b/playerbot/PlayerbotAI.cpp index 154b2727..3ec132a2 100644 --- a/playerbot/PlayerbotAI.cpp +++ b/playerbot/PlayerbotAI.cpp @@ -46,24 +46,23 @@ #endif using namespace ai; -using namespace std; -vector& split(const string &s, char delim, vector &elems); -vector split(const string &s, char delim); -char * strstri (string str1, string str2); +std::vector& split(const std::string &s, char delim, std::vector &elems); +std::vector split(const std::string &s, char delim); +char * strstri (std::string str1, std::string str2); uint64 extractGuid(WorldPacket& packet); std::string &trim(std::string &s); -set PlayerbotAI::unsecuredCommands; +std::set PlayerbotAI::unsecuredCommands; -uint32 PlayerbotChatHandler::extractQuestId(string str) +uint32 PlayerbotChatHandler::extractQuestId(std::string str) { char* source = (char*)str.c_str(); char* cId = ExtractKeyFromLink(&source,"Hquest"); return cId ? atol(cId) : 0; } -void PacketHandlingHelper::AddHandler(uint16 opcode, string handler, bool shouldDelay) +void PacketHandlingHelper::AddHandler(uint16 opcode, std::string handler, bool shouldDelay) { handlers[opcode] = handler; delay[opcode] = shouldDelay; @@ -74,7 +73,7 @@ void PacketHandlingHelper::Handle(ExternalEventHelper &helper) if (!m_botPacketMutex.try_lock()) //Packets do not have to be handled now. Handle them later. return; - stack delayed; + std::stack delayed; while (!queue.empty()) { @@ -238,7 +237,7 @@ PlayerbotAI::~PlayerbotAI() void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) { - string mapString = WorldPosition(bot).isOverworld() ? to_string(bot->GetMapId()) : "I"; + std::string mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I"; PerformanceMonitorOperation* pmo = sPerformanceMonitor.start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAI " + mapString); if(aiInternalUpdateDelay > elapsed) { @@ -430,7 +429,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) { AiObjectContext* context = aiObjectContext; - list items = AI_VALUE2(list, "inventory items", this->chatHelper.formatQItem(itemId)); + std::list items = AI_VALUE2(std::list, "inventory items", this->chatHelper.formatQItem(itemId)); for (auto item : items) { @@ -472,7 +471,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) { if (HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) { - TellPlayer(GetMaster(), "Jumping off " + string(bot->GetTransport()->GetName())); + TellPlayer(GetMaster(), "Jumping off " + std::string(bot->GetTransport()->GetName())); } WorldPosition botPos(bot); @@ -527,7 +526,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal) bool PlayerbotAI::UpdateAIReaction(uint32 elapsed, bool minimal, bool isStunned) { bool reactionFound; - string mapString = WorldPosition(bot).isOverworld() ? to_string(bot->GetMapId()) : "I"; + std::string mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I"; PerformanceMonitorOperation* pmo = sPerformanceMonitor.start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIReaction " + mapString); const bool reactionInProgress = reactionEngine->Update(elapsed, minimal, isStunned, reactionFound); if (pmo) pmo->finish(); @@ -630,7 +629,7 @@ const Action* PlayerbotAI::GetLastExecutedAction(BotState state) const bool PlayerbotAI::IsImmuneToSpell(uint32 spellId) const { - for (list::iterator i = sPlayerbotAIConfig.immuneSpellIds.begin(); i != sPlayerbotAIConfig.immuneSpellIds.end(); ++i) + for (std::list::iterator i = sPlayerbotAIConfig.immuneSpellIds.begin(); i != sPlayerbotAIConfig.immuneSpellIds.end(); ++i) { if (spellId == (*i)) { @@ -805,13 +804,13 @@ void PlayerbotAI::OnDeath() { WorldPosition botPos(bot); - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; out << std::fixed << std::setprecision(2); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP))); out << subLevel << ","; @@ -829,7 +828,7 @@ void PlayerbotAI::OnDeath() else out << "\"none\",0,100,"; - list targets = AI_VALUE_LAZY(list, "all targets"); + std::list targets = AI_VALUE_LAZY(std::list, "all targets"); out << "\""; @@ -855,7 +854,7 @@ void PlayerbotAI::OnDeath() adds++; } - out << "\"," << to_string(adds); + out << "\"," << std::to_string(adds); sPlayerbotAIConfig.log("deaths.csv", out.str().c_str()); } @@ -883,7 +882,7 @@ void PlayerbotAI::HandleCommands() { ExternalEventHelper helper(aiObjectContext); - list delayed; + std::list delayed; while (!chatCommands.empty()) { ChatCommandHolder holder = chatCommands.front(); @@ -895,7 +894,7 @@ void PlayerbotAI::HandleCommands() continue; } - string command = holder.GetCommand(); + std::string command = holder.GetCommand(); Player* owner = holder.GetOwner(); if (!helper.ParseChatCommand(command, owner) && holder.GetType() == CHAT_MSG_WHISPER) { @@ -907,7 +906,7 @@ void PlayerbotAI::HandleCommands() chatCommands.pop(); } - for (list::iterator i = delayed.begin(); i != delayed.end(); ++i) + for (std::list::iterator i = delayed.begin(); i != delayed.end(); ++i) { chatCommands.push(*i); } @@ -918,13 +917,13 @@ void PlayerbotAI::UpdateAIInternal(uint32 elapsed, bool minimal) if (bot->IsBeingTeleported() || !bot->IsInWorld()) return; - string mapString = WorldPosition(bot).isOverworld() ? to_string(bot->GetMapId()) : "I"; + std::string mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I"; PerformanceMonitorOperation* pmo = sPerformanceMonitor.start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString); ExternalEventHelper helper(aiObjectContext); // chat replies - list delayedResponses; + std::list delayedResponses; while (!chatReplies.empty()) { ChatQueuedReply holder = chatReplies.front(); @@ -939,7 +938,7 @@ void PlayerbotAI::UpdateAIInternal(uint32 elapsed, bool minimal) chatReplies.pop(); } - for (list::iterator i = delayedResponses.begin(); i != delayedResponses.end(); ++i) + for (std::list::iterator i = delayedResponses.begin(); i != delayedResponses.end(); ++i) { chatReplies.push(*i); } @@ -1090,7 +1089,7 @@ void PlayerbotAI::Reset(bool full) } } - aiObjectContext->GetValue&>("ignore rpg target")->Get().clear(); + aiObjectContext->GetValue&>("ignore rpg target")->Get().clear(); if (bot->IsTaxiFlying()) { @@ -1109,9 +1108,9 @@ void PlayerbotAI::Reset(bool full) } } -map chatMap; +std::map chatMap; -bool PlayerbotAI::IsAllowedCommand(string text) +bool PlayerbotAI::IsAllowedCommand(std::string text) { if (unsecuredCommands.empty()) { @@ -1126,7 +1125,7 @@ bool PlayerbotAI::IsAllowedCommand(string text) unsecuredCommands.insert("guild leave"); } - for (set::iterator i = unsecuredCommands.begin(); i != unsecuredCommands.end(); ++i) + for (std::set::iterator i = unsecuredCommands.begin(); i != unsecuredCommands.end(); ++i) { if (text.find(*i) == 0) { @@ -1137,9 +1136,9 @@ bool PlayerbotAI::IsAllowedCommand(string text) return false; } -void PlayerbotAI::HandleCommand(uint32 type, const string& text, Player& fromPlayer, const uint32 lang) +void PlayerbotAI::HandleCommand(uint32 type, const std::string& text, Player& fromPlayer, const uint32 lang) { - string filtered = text; + std::string filtered = text; if (!IsAllowedCommand(filtered) && !GetSecurity()->CheckLevelFor(PlayerbotSecurityLevel::PLAYERBOT_SECURITY_INVITE, type != CHAT_MSG_WHISPER, &fromPlayer)) return; @@ -1155,11 +1154,11 @@ void PlayerbotAI::HandleCommand(uint32 type, const string& text, Player& fromPla if (type == CHAT_MSG_SYSTEM) return; - if (filtered.find(sPlayerbotAIConfig.commandSeparator) != string::npos) + if (filtered.find(sPlayerbotAIConfig.commandSeparator) != std::string::npos) { - vector commands; + std::vector commands; split(commands, filtered, sPlayerbotAIConfig.commandSeparator.c_str()); - for (vector::iterator i = commands.begin(); i != commands.end(); ++i) + for (std::vector::iterator i = commands.begin(); i != commands.end(); ++i) { HandleCommand(type, *i, fromPlayer); } @@ -1182,24 +1181,24 @@ void PlayerbotAI::HandleCommand(uint32 type, const string& text, Player& fromPla chatMap["#a "] = CHAT_MSG_ADDON; chatMap["#g "] = CHAT_MSG_GUILD; } - currentChat = pair(CHAT_MSG_WHISPER, 0); - for (map::iterator i = chatMap.begin(); i != chatMap.end(); ++i) + currentChat = std::pair(CHAT_MSG_WHISPER, 0); + for (std::map::iterator i = chatMap.begin(); i != chatMap.end(); ++i) { if (filtered.find(i->first) == 0) { filtered = filtered.substr(3); - currentChat = pair(i->second, time(0) + 3); + currentChat = std::pair(i->second, time(0) + 3); break; } } - filtered = chatFilter.Filter(trim((string&)filtered)); + filtered = chatFilter.Filter(trim((std::string&)filtered)); if (filtered.empty()) return; if (filtered.substr(0, 6) == "debug ") { - string response = HandleRemoteCommand(filtered.substr(6)); + std::string response = HandleRemoteCommand(filtered.substr(6)); WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_ADDON, response.c_str(), LANG_ADDON, CHAT_TAG_NONE, bot->GetObjectGuid(), bot->GetName()); @@ -1210,7 +1209,7 @@ void PlayerbotAI::HandleCommand(uint32 type, const string& text, Player& fromPla if (!IsAllowedCommand(filtered) && !GetSecurity()->CheckLevelFor(PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, type != CHAT_MSG_WHISPER, &fromPlayer)) return; - if (type == CHAT_MSG_RAID_WARNING && filtered.find(bot->GetName()) != string::npos && filtered.find("award") == string::npos) + if (type == CHAT_MSG_RAID_WARNING && filtered.find(bot->GetName()) != std::string::npos && filtered.find("award") == std::string::npos) { ChatCommandHolder cmd("warning", &fromPlayer, type); chatCommands.push(cmd); @@ -1885,7 +1884,7 @@ void PlayerbotAI::ReInitCurrentEngine() currentEngine->Init(); } -void PlayerbotAI::ChangeStrategy(const string& names, BotState type) +void PlayerbotAI::ChangeStrategy(const std::string& names, BotState type) { if(type == BotState::BOT_STATE_ALL) { @@ -1954,7 +1953,7 @@ void PlayerbotAI::ClearStrategies(BotState type) } } -list PlayerbotAI::GetStrategies(BotState type) +std::list PlayerbotAI::GetStrategies(BotState type) { // Can't get all strategies for all engines if (type != BotState::BOT_STATE_ALL) @@ -1966,10 +1965,10 @@ list PlayerbotAI::GetStrategies(BotState type) } } - return list(); + return std::list(); } -bool PlayerbotAI::CanDoSpecificAction(const string& name, bool isUseful, bool isPossible) +bool PlayerbotAI::CanDoSpecificAction(const std::string& name, bool isUseful, bool isPossible) { for (uint8 i = 0; i < (uint8)BotState::BOT_STATE_ALL; i++) { @@ -1986,7 +1985,7 @@ bool PlayerbotAI::CanDoSpecificAction(const string& name, bool isUseful, bool is return false; } -bool PlayerbotAI::DoSpecificAction(const string& name, Event event, bool silent) +bool PlayerbotAI::DoSpecificAction(const std::string& name, Event event, bool silent) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); for (uint8 i = 0 ; i < (uint8)BotState::BOT_STATE_ALL; i++) @@ -2011,7 +2010,7 @@ bool PlayerbotAI::DoSpecificAction(const string& name, Event event, bool silent) { if (!silent) { - ostringstream out; + std::ostringstream out; out << name << ": impossible"; TellError(requester, out.str()); PlaySound(TEXTEMOTE_NO); @@ -2024,7 +2023,7 @@ bool PlayerbotAI::DoSpecificAction(const string& name, Event event, bool silent) { if (!silent) { - ostringstream out; + std::ostringstream out; out << name << ": useless"; TellError(requester, out.str()); PlaySound(TEXTEMOTE_NO); @@ -2037,7 +2036,7 @@ bool PlayerbotAI::DoSpecificAction(const string& name, Event event, bool silent) { if (!silent) { - ostringstream out; + std::ostringstream out; out << name << ": failed"; TellError(requester, out.str()); } @@ -2049,7 +2048,7 @@ bool PlayerbotAI::DoSpecificAction(const string& name, Event event, bool silent) { if (!silent) { - ostringstream out; + std::ostringstream out; out << name << ": unknown action"; TellError(requester, out.str()); } @@ -2062,7 +2061,7 @@ bool PlayerbotAI::DoSpecificAction(const string& name, Event event, bool silent) { if (!silent) { - ostringstream out; + std::ostringstream out; out << name << ": engine not ready"; TellError(requester, out.str()); } @@ -2110,7 +2109,7 @@ bool PlayerbotAI::ContainsStrategy(StrategyType type) return false; } -bool PlayerbotAI::HasStrategy(const string& name, BotState type) +bool PlayerbotAI::HasStrategy(const std::string& name, BotState type) { // Can't check the strategy for all engines at once if(type != BotState::BOT_STATE_ALL) @@ -2325,9 +2324,9 @@ WorldObject* PlayerbotAI::GetWorldObject(ObjectGuid guid) return map->GetWorldObject(guid); } -vector PlayerbotAI::GetPlayersInGroup() +std::vector PlayerbotAI::GetPlayersInGroup() { - vector members; + std::vector members; Group* group = bot->GetGroup(); @@ -2347,7 +2346,7 @@ vector PlayerbotAI::GetPlayersInGroup() return members; } -bool PlayerbotAI::TellPlayerNoFacing(Player* player, string text, PlayerbotSecurityLevel securityLevel, bool isPrivate, bool noRepeat) +bool PlayerbotAI::TellPlayerNoFacing(Player* player, std::string text, PlayerbotSecurityLevel securityLevel, bool isPrivate, bool noRepeat) { if(!player) return false; @@ -2357,7 +2356,7 @@ bool PlayerbotAI::TellPlayerNoFacing(Player* player, string text, PlayerbotSecur { whispers[text] = time(0); - vector recievers; + std::vector recievers; ChatMsg type = CHAT_MSG_SYSTEM; @@ -2412,7 +2411,7 @@ bool PlayerbotAI::TellPlayerNoFacing(Player* player, string text, PlayerbotSecur return true; } -bool PlayerbotAI::TellError(Player* player, string text, PlayerbotSecurityLevel securityLevel) +bool PlayerbotAI::TellError(Player* player, std::string text, PlayerbotSecurityLevel securityLevel) { if (!IsTellAllowed(player, securityLevel) || !IsSafe(player) || player->GetPlayerbotAI()) return false; @@ -2439,7 +2438,7 @@ bool PlayerbotAI::IsTellAllowed(Player* player, PlayerbotSecurityLevel securityL return true; } -bool PlayerbotAI::TellPlayer(Player* player, string text, PlayerbotSecurityLevel securityLevel, bool isPrivate) +bool PlayerbotAI::TellPlayer(Player* player, std::string text, PlayerbotSecurityLevel securityLevel, bool isPrivate) { if (!TellPlayerNoFacing(player, text, securityLevel, isPrivate)) return false; @@ -2473,14 +2472,14 @@ bool IsRealAura(Player* bot, Aura const* aura, Unit* unit) return false; } -bool PlayerbotAI::HasAura(string name, Unit* unit, bool maxStack, bool checkIsOwner, int maxAuraAmount, bool hasMyAura, int minDuration, int auraTypeId) +bool PlayerbotAI::HasAura(std::string name, Unit* unit, bool maxStack, bool checkIsOwner, int maxAuraAmount, bool hasMyAura, int minDuration, int auraTypeId) { if (!unit) return false; - wstring wnamepart; + std::wstring wnamepart; - vector ids = chatHelper.SpellIds(name); + std::vector ids = chatHelper.SpellIds(name); if (ids.empty()) { @@ -2511,7 +2510,7 @@ bool PlayerbotAI::HasAura(string name, Unit* unit, bool maxStack, bool checkIsOw if (ids.empty()) { - const string auraName = aura->GetSpellProto()->SpellName[0]; + const std::string auraName = aura->GetSpellProto()->SpellName[0]; if (auraName.empty() || auraName.length() != wnamepart.length() || !Utf8FitTo(auraName, wnamepart)) continue; } @@ -2613,8 +2612,8 @@ Aura* PlayerbotAI::GetAura(std::string name, Unit* unit, bool checkIsOwner) { if (!name.empty() && unit) { - wstring wnamepart; - vector ids = chatHelper.SpellIds(name); + std::wstring wnamepart; + std::vector ids = chatHelper.SpellIds(name); if (ids.empty()) { @@ -2640,7 +2639,7 @@ Aura* PlayerbotAI::GetAura(std::string name, Unit* unit, bool checkIsOwner) if (ids.empty()) { - const string auraName = aura->GetSpellProto()->SpellName[0]; + const std::string auraName = aura->GetSpellProto()->SpellName[0]; if (auraName.empty() || auraName.length() != wnamepart.length() || !Utf8FitTo(auraName, wnamepart)) continue; } @@ -2716,7 +2715,7 @@ bool PlayerbotAI::HasAnyAuraOf(Unit* player, ...) return false; } -bool PlayerbotAI::GetSpellRange(string name, float* maxRange, float* minRange) +bool PlayerbotAI::GetSpellRange(std::string name, float* maxRange, float* minRange) { // Copied from Spell::GetMinMaxRange const uint32 spellId = aiObjectContext->GetValue("spell id", name)->Get(); @@ -2817,7 +2816,7 @@ uint32 PlayerbotAI::GetSpellCastDuration(Spell* spell) return spellDuration + sPlayerbotAIConfig.reactDelay; } -bool PlayerbotAI::HasSpell(string name) const +bool PlayerbotAI::HasSpell(std::string name) const { return HasSpell(aiObjectContext->GetValue("spell id", name)->Get()); } @@ -2837,7 +2836,7 @@ bool PlayerbotAI::HasSpell(uint32 spellid) const return false; } -bool PlayerbotAI::CanCastSpell(string name, Unit* target, uint8 effectMask, Item* itemTarget, bool ignoreRange, bool ignoreInCombat) +bool PlayerbotAI::CanCastSpell(std::string name, Unit* target, uint8 effectMask, Item* itemTarget, bool ignoreRange, bool ignoreInCombat) { return CanCastSpell(aiObjectContext->GetValue("spell id", name)->Get(), target, 0, true, itemTarget, ignoreRange, ignoreInCombat); } @@ -3130,7 +3129,7 @@ uint8 PlayerbotAI::GetManaPercent() const return GetManaPercent(*bot); } -bool PlayerbotAI::CastSpell(string name, Unit* target, Item* itemTarget, bool waitForSpell, uint32* outSpellDuration, bool canUseReagentCheat) +bool PlayerbotAI::CastSpell(std::string name, Unit* target, Item* itemTarget, bool waitForSpell, uint32* outSpellDuration, bool canUseReagentCheat) { bool result = CastSpell(aiObjectContext->GetValue("spell id", name)->Get(), target, itemTarget, waitForSpell, outSpellDuration, canUseReagentCheat); if (result) @@ -3336,7 +3335,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget, bool if (HasStrategy("debug spell", BotState::BOT_STATE_NON_COMBAT)) { - ostringstream out; + std::ostringstream out; out << "Casting " <GetValue("spell id", spell)->Get(); if (!spellid || !target->IsNonMeleeSpellCasted(true)) @@ -4328,7 +4327,7 @@ ActivePiorityType PlayerbotAI::GetPriorityType() //Returns the lower and upper bracket for bots to be active. //Ie. 10,20 means all bots in this bracket will be inactive below 10% activityMod, all bots in this bracket will be active above 20% activityMod and scale between those values. -pair PlayerbotAI::GetPriorityBracket(ActivePiorityType type) +std::pair PlayerbotAI::GetPriorityBracket(ActivePiorityType type) { switch (type) { @@ -4422,7 +4421,7 @@ bool PlayerbotAI::AllowActive(ActivityType activityType) } } - pair priorityBracket = GetPriorityBracket(type); + std::pair priorityBracket = GetPriorityBracket(type); float activityPercentage = sRandomPlayerbotMgr.getActivityPercentage(); //Activity between 0 and 100. @@ -4674,7 +4673,7 @@ void PlayerbotAI::_fillGearScoreData(Player *player, Item* item, std::vectorGetPositionX() << " " << bot->GetPositionY() << " " << bot->GetPositionZ() << " " << bot->GetMapId() << " " << bot->GetOrientation(); + std::ostringstream out; out << bot->GetPositionX() << " " << bot->GetPositionY() << " " << bot->GetPositionZ() << " " << bot->GetMapId() << " " << bot->GetOrientation(); uint32 area = sServerFacade.GetAreaId(bot); if (const AreaTableEntry* areaEntry = GetAreaEntryByAreaID(area)) { @@ -4720,13 +4719,13 @@ string PlayerbotAI::HandleRemoteCommand(string command) return ""; } - ostringstream out; out << target->GetPositionX() << " " << target->GetPositionY() << " " << target->GetPositionZ() << " " << target->GetMapId() << " " << target->GetOrientation(); + std::ostringstream out; out << target->GetPositionX() << " " << target->GetPositionY() << " " << target->GetPositionZ() << " " << target->GetMapId() << " " << target->GetOrientation(); return out.str(); } else if (command == "movement") { LastMovement& data = *GetAiObjectContext()->GetValue("last movement"); - ostringstream out; out << data.lastMoveShort.getX() << " " << data.lastMoveShort.getY() << " " << data.lastMoveShort.getZ() << " " << data.lastMoveShort.getMapId() << " " << data.lastMoveShort.getO(); + std::ostringstream out; out << data.lastMoveShort.getX() << " " << data.lastMoveShort.getY() << " " << data.lastMoveShort.getZ() << " " << data.lastMoveShort.getMapId() << " " << data.lastMoveShort.getO(); return out.str(); } else if (command == "target") @@ -4741,7 +4740,7 @@ string PlayerbotAI::HandleRemoteCommand(string command) else if (command == "hp") { int pct = (int)((static_cast (bot->GetHealth()) / bot->GetMaxHealth()) * 100); - ostringstream out; out << pct << "%"; + std::ostringstream out; out << pct << "%"; Unit* target = *GetAiObjectContext()->GetValue("current target"); if (!target) { @@ -4766,7 +4765,7 @@ string PlayerbotAI::HandleRemoteCommand(string command) } else if (command == "travel") { - ostringstream out; + std::ostringstream out; TravelTarget* target = GetAiObjectContext()->GetValue("travel target")->Get(); if (target->getDestination()) { @@ -4803,7 +4802,7 @@ string PlayerbotAI::HandleRemoteCommand(string command) } else if (command == "budget") { - ostringstream out; + std::ostringstream out; AiObjectContext* context = GetAiObjectContext(); @@ -4846,7 +4845,7 @@ string PlayerbotAI::HandleRemoteCommand(string command) return out.str(); } - ostringstream out; out << "invalid command: " << command; + std::ostringstream out; out << "invalid command: " << command; return out.str(); } @@ -4870,7 +4869,7 @@ bool ChatHandler::HandleAhBotCommand(char* args) return ahbot::AhBot::HandleAhBotCommand(this, args); } -float PlayerbotAI::GetRange(string type) +float PlayerbotAI::GetRange(std::string type) { float val = 0; @@ -5091,10 +5090,10 @@ bool compare_items_by_level(const Item* item1, const Item* item2) return compare_items(item1->GetProto(), item2->GetProto()); } -void PlayerbotAI::InventoryTellItems(Player* player, map itemMap, map soulbound) +void PlayerbotAI::InventoryTellItems(Player* player, std::map itemMap, std::map soulbound) { - list items; - for (map::iterator i = itemMap.begin(); i != itemMap.end(); i++) + std::list items; + for (std::map::iterator i = itemMap.begin(); i != itemMap.end(); i++) { items.push_back(sObjectMgr.GetItemPrototype(i->first)); } @@ -5102,7 +5101,7 @@ void PlayerbotAI::InventoryTellItems(Player* player, map itemMap, m items.sort(compare_items); uint32 oldClass = -1; - for (list::iterator i = items.begin(); i != items.end(); i++) + for (std::list::iterator i = items.begin(); i != items.end(); i++) { ItemPrototype const* proto = *i; @@ -5156,7 +5155,7 @@ void PlayerbotAI::InventoryTellItems(Player* player, map itemMap, m void PlayerbotAI::InventoryTellItem(Player* player, ItemPrototype const* proto, int count, bool soulbound) { - ostringstream out; + std::ostringstream out; out << GetChatHelper()->formatItem(proto, count); if (soulbound) out << " (soulbound)"; @@ -5172,26 +5171,26 @@ void PlayerbotAI::InventoryTellItem(Player* player, ItemPrototype const* proto, found.insert(visitor.GetResult().begin(), visitor.GetResult().end()) #define RETURN_SORT_FOUND \ - list result; \ - for (set::iterator i = found.begin(); i != found.end(); ++i)\ + std::list result; \ + for (std::set::iterator i = found.begin(); i != found.end(); ++i)\ result.push_back(*i); \ result.sort(compare_items_by_level); \ return result #define RETURN_FOUND \ - list result; \ - for (set::iterator i = found.begin(); i != found.end(); ++i)\ + std::list result; \ + for (std::set::iterator i = found.begin(); i != found.end(); ++i)\ result.push_back(*i); \ return result -list PlayerbotAI::InventoryParseItems(string text, IterateItemsMask mask) +std::list PlayerbotAI::InventoryParseItems(std::string text, IterateItemsMask mask) { AiObjectContext* context = aiObjectContext; - set found; + std::set found; size_t pos = text.find(" "); - int count = pos != string::npos ? atoi(text.substr(pos + 1).c_str()) : 1; + int count = pos != std::string::npos ? atoi(text.substr(pos + 1).c_str()) : 1; if (count < 1) count = 1; ItemIds ids = GetChatHelper()->parseItems(text); @@ -5370,8 +5369,8 @@ uint32 PlayerbotAI::InventoryGetItemCount(FindItemVisitor* visitor, IterateItems { InventoryIterateItems(visitor, mask); uint32 count = 0; - list& items = visitor->GetResult(); - for (list::iterator i = items.begin(); i != items.end(); ++i) + std::list& items = visitor->GetResult(); + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Item* item = *i; count += item->GetCount(); @@ -5379,17 +5378,17 @@ uint32 PlayerbotAI::InventoryGetItemCount(FindItemVisitor* visitor, IterateItems return count; } -ItemIds PlayerbotAI::InventoryFindOutfitItems(string name) +ItemIds PlayerbotAI::InventoryFindOutfitItems(std::string name) { AiObjectContext* context = GetAiObjectContext(); - list& outfits = AI_VALUE(list&, "outfit list"); - for (list::iterator i = outfits.begin(); i != outfits.end(); ++i) + std::list& outfits = AI_VALUE(std::list&, "outfit list"); + for (std::list::iterator i = outfits.begin(); i != outfits.end(); ++i) { - string outfit = *i; + std::string outfit = *i; if (name == InventoryParseOutfitName(outfit)) return InventoryParseOutfitItems(outfit); } - return set(); + return std::set(); } void PlayerbotAI::AccelerateRespawn(Creature* creature, float accelMod) @@ -5409,7 +5408,7 @@ void PlayerbotAI::AccelerateRespawn(Creature* creature, float accelMod) if (!sPlayerbotAIConfig.respawnModHostile && !sPlayerbotAIConfig.respawnModNeutral) return; - uint32 playersNr = AI_VALUE_LAZY(list, "nearest friendly players").size()+1; + uint32 playersNr = AI_VALUE_LAZY(std::list, "nearest friendly players").size()+1; if (playersNr <= sPlayerbotAIConfig.respawnModThreshold) @@ -5513,14 +5512,14 @@ void PlayerbotAI::AccelerateRespawn(Creature* creature, float accelMod) creature->SetCorpseAccelerationDelay(m_corpseAccelerationDecayDelay); } -string PlayerbotAI::InventoryParseOutfitName(string outfit) +std::string PlayerbotAI::InventoryParseOutfitName(std::string outfit) { int pos = outfit.find("="); if (pos == -1) return ""; return outfit.substr(0, pos); } -ItemIds PlayerbotAI::InventoryParseOutfitItems(string text) +ItemIds PlayerbotAI::InventoryParseOutfitItems(std::string text) { ItemIds itemIds; @@ -5531,7 +5530,7 @@ ItemIds PlayerbotAI::InventoryParseOutfitItems(string text) if (endPos == -1) endPos = text.size(); - string idC = text.substr(pos, endPos - pos); + std::string idC = text.substr(pos, endPos - pos); uint32 id = atol(idC.c_str()); pos = endPos + 1; if (id) @@ -5572,7 +5571,7 @@ void PlayerbotAI::Ping(float x, float y) } } -void PlayerbotAI::Poi(float x, float y, string icon_name, Player* player, uint32 flags, uint32 icon, uint32 icon_data) +void PlayerbotAI::Poi(float x, float y, std::string icon_name, Player* player, uint32 flags, uint32 icon, uint32 icon_data) { if (!player) player = master; @@ -5966,7 +5965,7 @@ void PlayerbotAI::EnchantItemT(uint32 spellid, uint8 slot, Item* item) sLog.outDetail("%s: items was enchanted successfully!", bot->GetName()); } -uint32 PlayerbotAI::GetBuffedCount(Player* player, string spellname) +uint32 PlayerbotAI::GetBuffedCount(Player* player, std::string spellname) { Group* group = bot->GetGroup(); uint32 bcount = 0; @@ -6107,7 +6106,7 @@ bool PlayerbotAI::PlayAttackEmote(float chanceMultiplier) if (group) chanceMultiplier /= (group->GetMembersCount() - 1); if ((float)urand(0, 10000) * chanceMultiplier < sPlayerbotAIConfig.attackEmoteChance * 10000.0f && bot->IsInCombat()) { - vector sounds; + std::vector sounds; sounds.push_back(TEXTEMOTE_OPENFIRE); sounds.push_back(305); sounds.push_back(307); diff --git a/playerbot/PlayerbotAI.h b/playerbot/PlayerbotAI.h index 24e880eb..db8c8887 100644 --- a/playerbot/PlayerbotAI.h +++ b/playerbot/PlayerbotAI.h @@ -19,7 +19,6 @@ class Player; class PlayerbotMgr; class ChatHandler; -using namespace std; using namespace ai; bool IsAlliance(uint8 race); @@ -28,9 +27,9 @@ class PlayerbotChatHandler: protected ChatHandler { public: explicit PlayerbotChatHandler(Player* pMasterPlayer) : ChatHandler(pMasterPlayer->GetSession()) {} - void sysmessage(string str) { SendSysMessage(str.c_str()); } - uint32 extractQuestId(string str); - uint32 extractSpellId(string str) + void sysmessage(std::string str) { SendSysMessage(str.c_str()); } + uint32 extractQuestId(std::string str); + uint32 extractSpellId(std::string str) { char* source = (char*)str.c_str(); return ExtractSpellIdFromLink(&source); @@ -252,21 +251,21 @@ enum BotRoles class PacketHandlingHelper { public: - void AddHandler(uint16 opcode, string handler, bool shouldDelay = false); + void AddHandler(uint16 opcode, std::string handler, bool shouldDelay = false); void Handle(ExternalEventHelper &helper); void AddPacket(const WorldPacket& packet); private: - map handlers; - map delay; - stack queue; + std::map handlers; + std::map delay; + std::stack queue; std::mutex m_botPacketMutex; }; class ChatCommandHolder { public: - ChatCommandHolder(string command, Player* owner = NULL, uint32 type = CHAT_MSG_WHISPER, time_t time = 0) : command(command), owner(owner), type(type), time(time) {} + ChatCommandHolder(std::string command, Player* owner = NULL, uint32 type = CHAT_MSG_WHISPER, time_t time = 0) : command(command), owner(owner), type(type), time(time) {} ChatCommandHolder(ChatCommandHolder const& other) { this->command = other.command; @@ -276,13 +275,13 @@ class ChatCommandHolder } public: - string GetCommand() { return command; } + std::string GetCommand() { return command; } Player* GetOwner() { return owner; } uint32 GetType() { return type; } time_t GetTime() { return time; } private: - string command; + std::string command; Player* owner; uint32 type; time_t time; @@ -302,9 +301,9 @@ class PlayerbotAI : public PlayerbotAIBase void UpdateAIInternal(uint32 elapsed, bool minimal = false) override; public: - static string BotStateToString(BotState state); - string HandleRemoteCommand(string command); - void HandleCommand(uint32 type, const string& text, Player& fromPlayer, const uint32 lang = LANG_UNIVERSAL); + static std::string BotStateToString(BotState state); + std::string HandleRemoteCommand(std::string command); + void HandleCommand(uint32 type, const std::string& text, Player& fromPlayer, const uint32 lang = LANG_UNIVERSAL); void QueueChatResponse(uint8 msgtype, ObjectGuid guid1, ObjectGuid guid2, std::string message, std::string chanName, std::string name); void HandleBotOutgoingPacket(const WorldPacket& packet); void HandleMasterIncomingPacket(const WorldPacket& packet); @@ -312,16 +311,16 @@ class PlayerbotAI : public PlayerbotAIBase void HandleTeleportAck(); void ChangeEngine(BotState type); void DoNextAction(bool minimal = false); - bool CanDoSpecificAction(const string& name, bool isUseful = true, bool isPossible = true); - virtual bool DoSpecificAction(const string& name, Event event = Event(), bool silent = false); - void ChangeStrategy(const string& name, BotState type); + bool CanDoSpecificAction(const std::string& name, bool isUseful = true, bool isPossible = true); + virtual bool DoSpecificAction(const std::string& name, Event event = Event(), bool silent = false); + void ChangeStrategy(const std::string& name, BotState type); void PrintStrategies(Player* requester, BotState type); void ClearStrategies(BotState type); - list GetStrategies(BotState type); + std::list GetStrategies(BotState type); bool ContainsStrategy(StrategyType type); - bool HasStrategy(const string& name, BotState type); + bool HasStrategy(const std::string& name, BotState type); template - T* GetStrategy(const string& name, BotState type); + T* GetStrategy(const std::string& name, BotState type); BotState GetState() { return currentState; }; void ResetStrategies(bool autoLoad = true); void ReInitCurrentEngine(); @@ -335,12 +334,12 @@ class PlayerbotAI : public PlayerbotAIBase GameObject* GetGameObject(ObjectGuid guid); static GameObject* GetGameObject(GameObjectDataPair const* gameObjectDataPair); WorldObject* GetWorldObject(ObjectGuid guid); - vector GetPlayersInGroup(); - bool TellPlayer(Player* player, ostringstream &stream, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true) { return TellPlayer(player, stream.str(), securityLevel, isPrivate); } - bool TellPlayer(Player* player, string text, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true); - bool TellPlayerNoFacing(Player* player, ostringstream& stream, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true, bool noRepeat = true) { return TellPlayerNoFacing(player, stream.str(), securityLevel, isPrivate, noRepeat); } - bool TellPlayerNoFacing(Player* player, string text, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true, bool noRepeat = true); - bool TellError(Player* player, string text, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL); + std::vector GetPlayersInGroup(); + bool TellPlayer(Player* player, std::ostringstream &stream, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true) { return TellPlayer(player, stream.str(), securityLevel, isPrivate); } + bool TellPlayer(Player* player, std::string text, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true); + bool TellPlayerNoFacing(Player* player, std::ostringstream& stream, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true, bool noRepeat = true) { return TellPlayerNoFacing(player, stream.str(), securityLevel, isPrivate, noRepeat); } + bool TellPlayerNoFacing(Player* player, std::string text, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, bool isPrivate = true, bool noRepeat = true); + bool TellError(Player* player, std::string text, PlayerbotSecurityLevel securityLevel = PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL); void SpellInterrupted(uint32 spellid); int32 CalculateGlobalCooldown(uint32 spellid); void InterruptSpell(bool withMeleeAndAuto = true); @@ -351,7 +350,7 @@ class PlayerbotAI : public PlayerbotAIBase bool PlayEmote(uint32 emote); bool PlayAttackEmote(float chanceDivider); void Ping(float x, float y); - void Poi(float x, float y, string icon_name = "This way", Player* player = nullptr, uint32 flags = 99, uint32 icon = 6 /* red flag */, uint32 icon_data = 0); + void Poi(float x, float y, std::string icon_name = "This way", Player* player = nullptr, uint32 flags = 99, uint32 icon = 6 /* red flag */, uint32 icon_data = 0); Item * FindPoison() const; Item * FindConsumable(uint32 displayId) const; Item * FindBandage() const; @@ -366,20 +365,20 @@ class PlayerbotAI : public PlayerbotAIBase void ImbueItem(Item* item, Unit* target); void ImbueItem(Item* item); void EnchantItemT(uint32 spellid, uint8 slot, Item* item = nullptr); - uint32 GetBuffedCount(Player* player, string spellname); + uint32 GetBuffedCount(Player* player, std::string spellname); - bool GetSpellRange(string name, float* maxRange, float* minRange = nullptr); + bool GetSpellRange(std::string name, float* maxRange, float* minRange = nullptr); uint32 GetSpellCastDuration(Spell* spell); - virtual bool HasAura(string spellName, Unit* player, bool maxStack = false, bool checkIsOwner = false, int maxAmount = -1, bool hasMyAura = false, int minDuration = 0, int auraTypeId = TOTAL_AURAS); + virtual bool HasAura(std::string spellName, Unit* player, bool maxStack = false, bool checkIsOwner = false, int maxAmount = -1, bool hasMyAura = false, int minDuration = 0, int auraTypeId = TOTAL_AURAS); virtual bool HasAnyAuraOf(Unit* player, ...); - virtual bool HasMyAura(string spellName, Unit* player) { return HasAura(spellName, player, false, false, -1, true); } + virtual bool HasMyAura(std::string spellName, Unit* player) { return HasAura(spellName, player, false, false, -1, true); } uint8 GetHealthPercent(const Unit& target) const; uint8 GetHealthPercent() const; uint8 GetManaPercent(const Unit& target) const; uint8 GetManaPercent() const; - virtual bool IsInterruptableSpellCasting(Unit* player, string spell, uint8 effectMask); + virtual bool IsInterruptableSpellCasting(Unit* player, std::string spell, uint8 effectMask); virtual bool HasAuraToDispel(Unit* player, uint32 dispelType); bool canDispel(const SpellEntry* entry, uint32 dispelType); static bool IsHealSpell(const SpellEntry* entry); @@ -387,20 +386,20 @@ class PlayerbotAI : public PlayerbotAIBase static bool IsMiningNode(const GameObject* go); static bool IsHerb(const GameObject* go); - bool HasSpell(string name) const; + bool HasSpell(std::string name) const; bool HasSpell(uint32 spellid) const; bool HasAura(uint32 spellId, Unit* player, bool checkOwner = false); Aura* GetAura(uint32 spellId, Unit* player, bool checkOwner = false); Aura* GetAura(std::string spellName, Unit* player, bool checkOwner = false); std::vector GetAuras(Unit* player); - virtual bool CanCastSpell(string name, Unit* target, uint8 effectMask, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false); + virtual bool CanCastSpell(std::string name, Unit* target, uint8 effectMask, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false); bool CanCastSpell(uint32 spellid, Unit* target, uint8 effectMask, bool checkHasSpell = true, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false); bool CanCastSpell(uint32 spellid, GameObject* goTarget, uint8 effectMask, bool checkHasSpell = true, bool ignoreRange = false, bool ignoreInCombat = false); bool CanCastSpell(uint32 spellid, float x, float y, float z, uint8 effectMask, bool checkHasSpell = true, Item* itemTarget = NULL, bool ignoreRange = false, bool ignoreInCombat = false); bool CanCastVehicleSpell(uint32 spellid, Unit* target); - virtual bool CastSpell(string name, Unit* target, Item* itemTarget = NULL, bool waitForSpell = true, uint32* outSpellDuration = NULL, bool canUseReagentCheat = true); + virtual bool CastSpell(std::string name, Unit* target, Item* itemTarget = NULL, bool waitForSpell = true, uint32* outSpellDuration = NULL, bool canUseReagentCheat = true); bool CastSpell(uint32 spellId, Unit* target, Item* itemTarget = NULL, bool waitForSpell = true, uint32* outSpellDuration = NULL, bool canUseReagentCheat = true); bool CastSpell(uint32 spellId, float x, float y, float z, Item* itemTarget = NULL, bool waitForSpell = true, uint32* outSpellDuration = NULL, bool canUseReagentCheat = true); bool CastPetSpell(uint32 spellId, Unit* target); @@ -412,8 +411,8 @@ class PlayerbotAI : public PlayerbotAIBase uint32 GetEquipGearScore(Player* player, bool withBags, bool withBank); uint32 GetEquipStatsValue(Player* player); bool HasSkill(SkillType skill); - bool IsAllowedCommand(string text); - float GetRange(string type); + bool IsAllowedCommand(std::string text); + float GetRange(std::string type); static ReputationRank GetFactionReaction(FactionTemplateEntry const* thisTemplate, FactionTemplateEntry const* otherTemplate); static bool friendToAlliance(FactionTemplateEntry const* templateEntry) { return GetFactionReaction(templateEntry, sFactionTemplateStore.LookupEntry(1)) >= REP_NEUTRAL; } @@ -424,13 +423,13 @@ class PlayerbotAI : public PlayerbotAIBase ReputationRank getReaction(FactionTemplateEntry const* factionTemplate) { return GetFactionReaction(bot->GetFactionTemplateEntry(), factionTemplate);} void InventoryIterateItems(IterateItemsVisitor* visitor, IterateItemsMask mask); - void InventoryTellItems(Player* player, map items, map soulbound); + void InventoryTellItems(Player* player, std::map items, std::map soulbound); void InventoryTellItem(Player* player, ItemPrototype const* proto, int count, bool soulbound); - list InventoryParseItems(string text, IterateItemsMask mask); + std::list InventoryParseItems(std::string text, IterateItemsMask mask); uint32 InventoryGetItemCount(FindItemVisitor* visitor, IterateItemsMask mask); - string InventoryParseOutfitName(string outfit); - ItemIds InventoryParseOutfitItems(string outfit); - ItemIds InventoryFindOutfitItems(string name); + std::string InventoryParseOutfitName(std::string outfit); + ItemIds InventoryParseOutfitItems(std::string outfit); + ItemIds InventoryFindOutfitItems(std::string name); void AccelerateRespawn(Creature* creature, float accelMod = 0); void AccelerateRespawn(ObjectGuid guid, float accelMod = 0) { Creature* creature = GetCreature(guid); if (creature) AccelerateRespawn(creature,accelMod); } @@ -476,7 +475,7 @@ class PlayerbotAI : public PlayerbotAIBase bool HasManyPlayersNearby(uint32 trigerrValue = 20, float range = sPlayerbotAIConfig.sightDistance); ActivePiorityType GetPriorityType(); - pair GetPriorityBracket(ActivePiorityType type); + std::pair GetPriorityBracket(ActivePiorityType type); bool AllowActive(ActivityType activityType); bool AllowActivity(ActivityType activityType = ALL_ACTIVITY, bool checkNow = false); @@ -551,16 +550,16 @@ class PlayerbotAI : public PlayerbotAIBase Engine* engines[(uint8)BotState::BOT_STATE_ALL]; BotState currentState; ChatHelper chatHelper; - queue chatCommands; - queue chatReplies; + std::queue chatCommands; + std::queue chatReplies; PacketHandlingHelper botOutgoingPacketHandlers; PacketHandlingHelper masterIncomingPacketHandlers; PacketHandlingHelper masterOutgoingPacketHandlers; CompositeChatFilter chatFilter; PlayerbotSecurity security; - map whispers; - pair currentChat; - static set unsecuredCommands; + std::map whispers; + std::pair currentChat; + static std::set unsecuredCommands; bool allowActive[MAX_ACTIVITY_TYPE]; time_t allowActiveCheckTimer[MAX_ACTIVITY_TYPE]; bool inCombat = false; @@ -577,7 +576,7 @@ class PlayerbotAI : public PlayerbotAIBase }; template -T* PlayerbotAI::GetStrategy(const string& name, BotState type) +T* PlayerbotAI::GetStrategy(const std::string& name, BotState type) { return dynamic_cast(engines[(uint8)type]->GetStrategy(name)); } diff --git a/playerbot/PlayerbotAIAware.h b/playerbot/PlayerbotAIAware.h index 5a1dbf4f..1b0e2acb 100644 --- a/playerbot/PlayerbotAIAware.h +++ b/playerbot/PlayerbotAIAware.h @@ -3,8 +3,6 @@ class PlayerbotAI; -using namespace std; - namespace ai { class PlayerbotAIAware @@ -12,7 +10,7 @@ namespace ai public: PlayerbotAIAware(PlayerbotAI* const ai) : ai(ai) { } virtual ~PlayerbotAIAware() = default; - virtual string getName() { return string(); } + virtual std::string getName() { return std::string(); } protected: PlayerbotAI* ai; }; diff --git a/playerbot/PlayerbotAIBase.cpp b/playerbot/PlayerbotAIBase.cpp index 3cedcea6..fdce1ed4 100644 --- a/playerbot/PlayerbotAIBase.cpp +++ b/playerbot/PlayerbotAIBase.cpp @@ -3,7 +3,6 @@ #include "playerbot/PlayerbotAIConfig.h" using namespace ai; -using namespace std; PlayerbotAIBase::PlayerbotAIBase() : aiInternalUpdateDelay(0) { diff --git a/playerbot/PlayerbotAIBase.h b/playerbot/PlayerbotAIBase.h index b3f6cee6..acdc2659 100644 --- a/playerbot/PlayerbotAIBase.h +++ b/playerbot/PlayerbotAIBase.h @@ -5,8 +5,6 @@ class PlayerbotMgr; class ChatHandler; class PerformanceMonitorOperation; -using namespace std; - class PlayerbotAIBase { public: diff --git a/playerbot/PlayerbotAIConfig.cpp b/playerbot/PlayerbotAIConfig.cpp index b4c5ac3b..b2ccabc0 100644 --- a/playerbot/PlayerbotAIConfig.cpp +++ b/playerbot/PlayerbotAIConfig.cpp @@ -17,14 +17,12 @@ #include #include -using namespace std; - -std::vector ConfigAccess::GetValues(const std::string& name) const +std::vector ConfigAccess::GetValues(const std::string& name) const { - std::vector values; + std::vector values; auto const nameLower = boost::algorithm::to_lower_copy(name); for (auto entry : m_entries) - if (entry.first.find(nameLower) != string::npos) + if (entry.first.find(nameLower) != std::string::npos) values.push_back(entry.first); return values; @@ -40,13 +38,13 @@ PlayerbotAIConfig::PlayerbotAIConfig() } template -void LoadList(string value, T &list) +void LoadList(std::string value, T &list) { list.clear(); - vector ids = split(value, ','); - for (vector::iterator i = ids.begin(); i != ids.end(); i++) + std::vector ids = split(value, ','); + for (std::vector::iterator i = ids.begin(); i != ids.end(); i++) { - string string = *i; + std::string string = *i; if (string.empty()) continue; @@ -57,13 +55,13 @@ void LoadList(string value, T &list) } template -void LoadListString(string value, T& list) +void LoadListString(std::string value, T& list) { list.clear(); - vector strings = split(value, ','); - for (vector::iterator i = strings.begin(); i != strings.end(); i++) + std::vector strings = split(value, ','); + for (std::vector::iterator i = strings.begin(); i != strings.end(); i++) { - string string = *i; + std::string string = *i; if (string.empty()) continue; @@ -134,8 +132,8 @@ bool PlayerbotAIConfig::Initialize() randomGearMaxLevel = config.GetIntDefault("AiPlayerbot.RandomGearMaxLevel", 500); randomGearMaxDiff = config.GetIntDefault("AiPlayerbot.RandomGearMaxDiff", 9); randomGearUpgradeEnabled = config.GetBoolDefault("AiPlayerbot.RandomGearUpgradeEnabled", false); - LoadList >(config.GetStringDefault("AiPlayerbot.RandomGearBlacklist", ""), randomGearBlacklist); - LoadList >(config.GetStringDefault("AiPlayerbot.RandomGearWhitelist", ""), randomGearWhitelist); + LoadList >(config.GetStringDefault("AiPlayerbot.RandomGearBlacklist", ""), randomGearBlacklist); + LoadList >(config.GetStringDefault("AiPlayerbot.RandomGearWhitelist", ""), randomGearWhitelist); randomGearProgression = config.GetBoolDefault("AiPlayerbot.RandomGearProgression", true); randomGearLoweringChance = config.GetFloatDefault("AiPlayerbot.RandomGearLoweringChance", 0.15f); randomBotMaxLevelChance = config.GetFloatDefault("AiPlayerbot.RandomBotMaxLevelChance", 0.15f); @@ -161,10 +159,10 @@ bool PlayerbotAIConfig::Initialize() allowMultiAccountAltBots = config.GetBoolDefault("AiPlayerbot.AllowMultiAccountAltBots", true); randomBotMapsAsString = config.GetStringDefault("AiPlayerbot.RandomBotMaps", "0,1,530,571"); - LoadList >(randomBotMapsAsString, randomBotMaps); - LoadList >(config.GetStringDefault("AiPlayerbot.RandomBotQuestItems", "6948,5175,5176,5177,5178,16309,12382,13704,11000,22754"), randomBotQuestItems); - LoadList >(config.GetStringDefault("AiPlayerbot.RandomBotSpellIds", "54197"), randomBotSpellIds); - LoadList >(config.GetStringDefault("AiPlayerbot.PvpProhibitedZoneIds", "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323"), pvpProhibitedZoneIds); + LoadList >(randomBotMapsAsString, randomBotMaps); + LoadList >(config.GetStringDefault("AiPlayerbot.RandomBotQuestItems", "6948,5175,5176,5177,5178,16309,12382,13704,11000,22754"), randomBotQuestItems); + LoadList >(config.GetStringDefault("AiPlayerbot.RandomBotSpellIds", "54197"), randomBotSpellIds); + LoadList >(config.GetStringDefault("AiPlayerbot.PvpProhibitedZoneIds", "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323"), pvpProhibitedZoneIds); #ifndef MANGOSBOT_ZERO // disable pvp near dark portal if event is active @@ -172,8 +170,8 @@ bool PlayerbotAIConfig::Initialize() pvpProhibitedZoneIds.insert(pvpProhibitedZoneIds.begin(), 72); #endif - LoadList >(config.GetStringDefault("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761,9378"), randomBotQuestIds); - LoadList >(config.GetStringDefault("AiPlayerbot.ImmuneSpellIds", ""), immuneSpellIds); + LoadList >(config.GetStringDefault("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761,9378"), randomBotQuestIds); + LoadList >(config.GetStringDefault("AiPlayerbot.ImmuneSpellIds", ""), immuneSpellIds); botAutologin = config.GetBoolDefault("AiPlayerbot.BotAutologin", false); randomBotAutologin = config.GetBoolDefault("AiPlayerbot.RandomBotAutologin", true); @@ -243,7 +241,7 @@ bool PlayerbotAIConfig::Initialize() //Set race defaults if (race > 0) { - int rProb = config.GetIntDefault("AiPlayerbot.ClassRaceProb.0." + to_string(race), 100); + int rProb = config.GetIntDefault("AiPlayerbot.ClassRaceProb.0." + std::to_string(race), 100); for (uint32 cls = 1; cls < MAX_CLASSES; ++cls) { @@ -255,7 +253,7 @@ bool PlayerbotAIConfig::Initialize() //Class overrides for (uint32 cls = 1; cls < MAX_CLASSES; ++cls) { - int cProb = config.GetIntDefault("AiPlayerbot.ClassRaceProb." + to_string(cls), -1); + int cProb = config.GetIntDefault("AiPlayerbot.ClassRaceProb." + std::to_string(cls), -1); if (cProb >= 0) { @@ -273,7 +271,7 @@ bool PlayerbotAIConfig::Initialize() { for (uint32 cls = 1; cls < MAX_CLASSES; ++cls) { - int rcProb = config.GetIntDefault("AiPlayerbot.ClassRaceProb." + to_string(cls) + "." + to_string(race), -1); + int rcProb = config.GetIntDefault("AiPlayerbot.ClassRaceProb." + std::to_string(cls) + "." + std::to_string(race), -1); if (rcProb >= 0) classRaceProbability[cls][race] = rcProb; @@ -291,25 +289,25 @@ bool PlayerbotAIConfig::Initialize() classSpecs[cls] = ClassSpecs(1 << (cls - 1)); for (uint32 spec = 0; spec < MAX_LEVEL; ++spec) { - ostringstream os; os << "AiPlayerbot.PremadeSpecName." << cls << "." << spec; - string specName = config.GetStringDefault(os.str().c_str(), ""); + std::ostringstream os; os << "AiPlayerbot.PremadeSpecName." << cls << "." << spec; + std::string specName = config.GetStringDefault(os.str().c_str(), ""); if (!specName.empty()) { - ostringstream os; os << "AiPlayerbot.PremadeSpecProb." << cls << "." << spec; + std::ostringstream os; os << "AiPlayerbot.PremadeSpecProb." << cls << "." << spec; int probability = config.GetIntDefault(os.str().c_str(), 100); TalentPath talentPath(spec, specName, probability); for (int level = 10; level <= 100; level++) { - ostringstream os; os << "AiPlayerbot.PremadeSpecLink." << cls << "." << spec << "." << level; - string specLink = config.GetStringDefault(os.str().c_str(), ""); + std::ostringstream os; os << "AiPlayerbot.PremadeSpecLink." << cls << "." << spec << "." << level; + std::string specLink = config.GetStringDefault(os.str().c_str(), ""); specLink = specLink.substr(0, specLink.find("#", 0));; specLink = specLink.substr(0, specLink.find(" ", 0));; if (!specLink.empty()) { - ostringstream out; + std::ostringstream out; //Ignore bad specs. if (!classSpecs[cls].baseSpec.CheckTalentLink(specLink, &out)) @@ -341,7 +339,7 @@ bool PlayerbotAIConfig::Initialize() } botCheats.clear(); - LoadListString>(config.GetStringDefault("AiPlayerbot.BotCheats", "taxi,item,breath"), botCheats); + LoadListString>(config.GetStringDefault("AiPlayerbot.BotCheats", "taxi,item,breath"), botCheats); botCheatMask = 0; @@ -368,13 +366,13 @@ bool PlayerbotAIConfig::Initialize() if (std::find(botCheats.begin(), botCheats.end(), "breath") != botCheats.end()) botCheatMask |= (uint32)BotCheatMask::breath; - LoadListString>(config.GetStringDefault("AiPlayerbot.AllowedLogFiles", ""), allowedLogFiles); - LoadListString>(config.GetStringDefault("AiPlayerbot.DebugFilter", "add gathering loot,check values,emote,check mount state"), debugFilter); + LoadListString>(config.GetStringDefault("AiPlayerbot.AllowedLogFiles", ""), allowedLogFiles); + LoadListString>(config.GetStringDefault("AiPlayerbot.DebugFilter", "add gathering loot,check values,emote,check mount state"), debugFilter); worldBuffs.clear(); //Get all config values starting with AiPlayerbot.WorldBuff - vector values = configA->GetValues("AiPlayerbot.WorldBuff"); + std::vector values = configA->GetValues("AiPlayerbot.WorldBuff"); if (values.size()) { @@ -383,8 +381,8 @@ bool PlayerbotAIConfig::Initialize() for (auto value : values) { - vector ids = split(value, '.'); - vector params = { 0,0,0,0,0 }; + std::vector ids = split(value, '.'); + std::vector params = { 0,0,0,0,0 }; //Extract faction, class, spec, minlevel, maxlevel for (uint8 i = 0; i < 5; i++) @@ -392,8 +390,8 @@ bool PlayerbotAIConfig::Initialize() params[i] = stoi(ids[i + 2]); //Get list of buffs for this combination. - list buffs; - LoadList>(config.GetStringDefault(value, ""), buffs); + std::list buffs; + LoadList>(config.GetStringDefault(value, ""), buffs); //Store buffs for later application. for (auto buff : buffs) @@ -481,7 +479,7 @@ bool PlayerbotAIConfig::Initialize() // Gear progression phase for (uint8 phase = 0; phase < MAX_GEAR_PROGRESSION_LEVEL; phase++) { - ostringstream os; os << "AiPlayerbot.GearProgressionSystem." << std::to_string(phase) << ".MinItemLevel"; + std::ostringstream os; os << "AiPlayerbot.GearProgressionSystem." << std::to_string(phase) << ".MinItemLevel"; gearProgressionSystemItemLevels[phase][0] = config.GetIntDefault(os.str().c_str(), 9999999); os.str(""); os << "AiPlayerbot.GearProgressionSystem." << std::to_string(phase) << ".MaxItemLevel"; gearProgressionSystemItemLevels[phase][1] = config.GetIntDefault(os.str().c_str(), 9999999); @@ -495,7 +493,7 @@ bool PlayerbotAIConfig::Initialize() // Gear progression slot for (uint8 slot = 0; slot < SLOT_EMPTY; slot++) { - ostringstream os; os << "AiPlayerbot.GearProgressionSystem." << std::to_string(phase) << "." << std::to_string(cls) << "." << std::to_string(spec) << "." << std::to_string(slot); + std::ostringstream os; os << "AiPlayerbot.GearProgressionSystem." << std::to_string(phase) << "." << std::to_string(cls) << "." << std::to_string(spec) << "." << std::to_string(slot); gearProgressionSystemItems[phase][cls][spec][slot] = config.GetIntDefault(os.str().c_str(), -1); } } @@ -504,15 +502,15 @@ bool PlayerbotAIConfig::Initialize() sLog.outString("Loading free bots."); selfBotLevel = config.GetIntDefault("AiPlayerbot.SelfBotLevel", 1); - LoadListString>(config.GetStringDefault("AiPlayerbot.ToggleAlwaysOnlineAccounts", ""), toggleAlwaysOnlineAccounts); - LoadListString>(config.GetStringDefault("AiPlayerbot.ToggleAlwaysOnlineChars", ""), toggleAlwaysOnlineChars); + LoadListString>(config.GetStringDefault("AiPlayerbot.ToggleAlwaysOnlineAccounts", ""), toggleAlwaysOnlineAccounts); + LoadListString>(config.GetStringDefault("AiPlayerbot.ToggleAlwaysOnlineChars", ""), toggleAlwaysOnlineChars); - for (string& nm : toggleAlwaysOnlineAccounts) - transform(nm.begin(), nm.end(), nm.begin(), ::toupper); + for (std::string& nm : toggleAlwaysOnlineAccounts) + std::transform(nm.begin(), nm.end(), nm.begin(), toupper); - for (string& nm : toggleAlwaysOnlineChars) + for (std::string& nm : toggleAlwaysOnlineChars) { - transform(nm.begin(), nm.end(), nm.begin(), ::tolower); + std::transform(nm.begin(), nm.end(), nm.begin(), tolower); nm[0] = toupper(nm[0]); } @@ -575,9 +573,9 @@ bool PlayerbotAIConfig::IsInPvpProhibitedZone(uint32 id) return find(pvpProhibitedZoneIds.begin(), pvpProhibitedZoneIds.end(), id) != pvpProhibitedZoneIds.end(); } -string PlayerbotAIConfig::GetValue(string name) +std::string PlayerbotAIConfig::GetValue(std::string name) { - ostringstream out; + std::ostringstream out; if (name == "GlobalCooldown") out << globalCoolDown; @@ -614,9 +612,9 @@ string PlayerbotAIConfig::GetValue(string name) return out.str(); } -void PlayerbotAIConfig::SetValue(string name, string value) +void PlayerbotAIConfig::SetValue(std::string name, std::string value) { - istringstream out(value, istringstream::in); + std::istringstream out(value, std::istringstream::in); if (name == "GlobalCooldown") out >> globalCoolDown; @@ -665,7 +663,7 @@ void PlayerbotAIConfig::loadFreeAltBotAccounts() bool accountAlwaysOnline = allCharsOnline; Field* fields = results->Fetch(); - string accountName = fields[0].GetString(); + std::string accountName = fields[0].GetString(); uint32 accountId = fields[1].GetUInt32(); if (std::find(toggleAlwaysOnlineAccounts.begin(), toggleAlwaysOnlineAccounts.end(), accountName) != toggleAlwaysOnlineAccounts.end()) @@ -680,7 +678,7 @@ void PlayerbotAIConfig::loadFreeAltBotAccounts() bool charAlwaysOnline = allCharsOnline; Field* fields = result->Fetch(); - string charName = fields[0].GetString(); + std::string charName = fields[0].GetString(); uint32 guid = fields[1].GetUInt32(); uint32 always = sRandomPlayerbotMgr.GetValue(guid, "always"); @@ -692,7 +690,7 @@ void PlayerbotAIConfig::loadFreeAltBotAccounts() charAlwaysOnline = !charAlwaysOnline; if(charAlwaysOnline || accountAlwaysOnline || always) - freeAltBots.push_back(make_pair(accountId, guid)); + freeAltBots.push_back(std::make_pair(accountId, guid)); } while (result->NextRow()); @@ -716,7 +714,7 @@ std::string PlayerbotAIConfig::GetTimestampStr() return std::string(buf); } -bool PlayerbotAIConfig::openLog(string fileName, char const* mode) +bool PlayerbotAIConfig::openLog(std::string fileName, char const* mode) { if (!hasLog(fileName)) return false; @@ -724,7 +722,7 @@ bool PlayerbotAIConfig::openLog(string fileName, char const* mode) auto logFileIt = logFiles.find(fileName); if (logFileIt == logFiles.end()) { - logFiles.insert(make_pair(fileName, make_pair(nullptr, false))); + logFiles.insert(make_pair(fileName, std::make_pair(nullptr, false))); logFileIt = logFiles.find(fileName); } @@ -734,7 +732,7 @@ bool PlayerbotAIConfig::openLog(string fileName, char const* mode) if (fileOpen) //close log file fclose(file); - string m_logsDir = sConfig.GetStringDefault("LogsDir"); + std::string m_logsDir = sConfig.GetStringDefault("LogsDir"); if (!m_logsDir.empty()) { if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) @@ -751,7 +749,7 @@ bool PlayerbotAIConfig::openLog(string fileName, char const* mode) return true; } -void PlayerbotAIConfig::log(string fileName, const char* str, ...) +void PlayerbotAIConfig::log(std::string fileName, const char* str, ...) { if (!str) return; @@ -774,21 +772,21 @@ void PlayerbotAIConfig::log(string fileName, const char* str, ...) fflush(stdout); } -void PlayerbotAIConfig::logEvent(PlayerbotAI* ai, string eventName, string info1, string info2) +void PlayerbotAIConfig::logEvent(PlayerbotAI* ai, std::string eventName, std::string info1, std::string info2) { if (hasLog("bot_events.csv")) { Player* bot = ai->GetBot(); - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; out << eventName << ","; out << std::fixed << std::setprecision(2); WorldPosition(bot).printWKT(out); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + (bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP) ? ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP)) : 0)); out << subLevel << ","; @@ -800,9 +798,9 @@ void PlayerbotAIConfig::logEvent(PlayerbotAI* ai, string eventName, string info1 } }; -void PlayerbotAIConfig::logEvent(PlayerbotAI* ai, string eventName, ObjectGuid guid, string info2) +void PlayerbotAIConfig::logEvent(PlayerbotAI* ai, std::string eventName, ObjectGuid guid, std::string info2) { - string info1 = ""; + std::string info1 = ""; Unit* victim; if (guid) @@ -815,7 +813,7 @@ void PlayerbotAIConfig::logEvent(PlayerbotAI* ai, string eventName, ObjectGuid g logEvent(ai, eventName, info1, info2); }; -bool PlayerbotAIConfig::CanLogAction(PlayerbotAI* ai, string actionName, bool isExecute, string lastActionName) +bool PlayerbotAIConfig::CanLogAction(PlayerbotAI* ai, std::string actionName, bool isExecute, std::string lastActionName) { bool forRpg = (actionName.find("rpg") == 0) && ai->HasStrategy("debug rpg", BotState::BOT_STATE_NON_COMBAT); diff --git a/playerbot/PlayerbotAIConfig.h b/playerbot/PlayerbotAIConfig.h index e3cfa1a7..6bd5de07 100644 --- a/playerbot/PlayerbotAIConfig.h +++ b/playerbot/PlayerbotAIConfig.h @@ -4,8 +4,6 @@ #include "Talentspec.h" #include "Globals/SharedDefines.h" -using namespace std; - class Player; class PlayerbotMgr; class ChatHandler; @@ -35,7 +33,7 @@ class ConfigAccess std::string m_filename; std::unordered_map m_entries; // keys are converted to lower case. values cannot be. public: - std::vector GetValues(const std::string& name) const; + std::vector GetValues(const std::string& name) const; std::mutex m_configLock; }; @@ -80,8 +78,8 @@ class PlayerbotAIConfig std::list randomBotQuestIds; std::list immuneSpellIds; std::list> freeAltBots; - std::list toggleAlwaysOnlineAccounts; - std::list toggleAlwaysOnlineChars; + std::list toggleAlwaysOnlineAccounts; + std::list toggleAlwaysOnlineChars; uint32 randomBotTeleportDistance; bool randomBotTeleportNearPlayer; uint32 randomBotTeleportNearPlayerMaxAmount; @@ -122,7 +120,7 @@ class PlayerbotAIConfig uint32 randomBotMinLevel, randomBotMaxLevel; float randomChangeMultiplier; uint32 specProbability[MAX_CLASSES][10]; - string premadeLevelSpec[MAX_CLASSES][10][91]; //lvl 10 - 100 + std::string premadeLevelSpec[MAX_CLASSES][10][91]; //lvl 10 - 100 uint32 classRaceProbabilityTotal; uint32 classRaceProbability[MAX_CLASSES][MAX_RACES]; ClassSpecs classSpecs[MAX_CLASSES]; @@ -208,12 +206,12 @@ class PlayerbotAIConfig std::mutex m_logMtx; - std::list allowedLogFiles; - std::list debugFilter; + std::list allowedLogFiles; + std::list debugFilter; std::unordered_map > logFiles; - std::list botCheats; + std::list botCheats; uint32 botCheatMask = 0; struct worldBuff{ @@ -225,7 +223,7 @@ class PlayerbotAIConfig uint32 maxLevel = 0; }; - vector worldBuffs; + std::vector worldBuffs; int commandServerPort; bool perfMonEnabled; @@ -237,15 +235,15 @@ class PlayerbotAIConfig std::string GetTimestampStr(); - bool hasLog(string fileName) { return std::find(allowedLogFiles.begin(), allowedLogFiles.end(), fileName) != allowedLogFiles.end(); }; - bool openLog(string fileName, char const* mode = "a"); - bool isLogOpen(string fileName) { auto it = logFiles.find(fileName); return it != logFiles.end() && it->second.second;} - void log(string fileName, const char* str, ...); + bool hasLog(std::string fileName) { return std::find(allowedLogFiles.begin(), allowedLogFiles.end(), fileName) != allowedLogFiles.end(); }; + bool openLog(std::string fileName, char const* mode = "a"); + bool isLogOpen(std::string fileName) { auto it = logFiles.find(fileName); return it != logFiles.end() && it->second.second;} + void log(std::string fileName, const char* str, ...); - void logEvent(PlayerbotAI* ai, string eventName, string info1 = "", string info2 = ""); - void logEvent(PlayerbotAI* ai, string eventName, ObjectGuid guid, string info2); + void logEvent(PlayerbotAI* ai, std::string eventName, std::string info1 = "", std::string info2 = ""); + void logEvent(PlayerbotAI* ai, std::string eventName, ObjectGuid guid, std::string info2); - bool CanLogAction(PlayerbotAI* ai, string actionName, bool isExecute, string lastActionName); + bool CanLogAction(PlayerbotAI* ai, std::string actionName, bool isExecute, std::string lastActionName); private: Config config; }; diff --git a/playerbot/PlayerbotCommandServer.cpp b/playerbot/PlayerbotCommandServer.cpp index 753f9b20..aac32dc4 100644 --- a/playerbot/PlayerbotCommandServer.cpp +++ b/playerbot/PlayerbotCommandServer.cpp @@ -8,8 +8,6 @@ INSTANTIATE_SINGLETON_1(PlayerbotCommandServer); -using namespace std; - #ifdef CMANGOS #include @@ -17,14 +15,13 @@ using namespace std; #include #include -using namespace std; using boost::asio::ip::tcp; typedef boost::shared_ptr socket_ptr; -bool ReadLine(socket_ptr sock, string* buffer, string* line) +bool ReadLine(socket_ptr sock, std::string* buffer, std::string* line) { // Do the real reading from fd until buffer has '\n'. - string::iterator pos; + std::string::iterator pos; while ((pos = find(buffer->begin(), buffer->end(), '\n')) == buffer->end()) { char buf[1025]; @@ -39,8 +36,8 @@ bool ReadLine(socket_ptr sock, string* buffer, string* line) *buffer += buf; } - *line = string(buffer->begin(), pos); - *buffer = string(pos + 1, buffer->end()); + *line = std::string(buffer->begin(), pos); + *buffer = std::string(pos + 1, buffer->end()); return true; } @@ -48,9 +45,9 @@ void session(socket_ptr sock) { try { - string buffer, request; + std::string buffer, request; while (ReadLine(sock, &buffer, &request)) { - string response = sRandomPlayerbotMgr.HandleRemoteCommand(request) + "\n"; + std::string response = sRandomPlayerbotMgr.HandleRemoteCommand(request) + "\n"; boost::asio::write(*sock, boost::asio::buffer(response.c_str(), response.size())); request = ""; } @@ -78,7 +75,7 @@ void Run() return; } - ostringstream s; s << "Starting Playerbot Command Server on port " << sPlayerbotAIConfig.commandServerPort; + std::ostringstream s; s << "Starting Playerbot Command Server on port " << sPlayerbotAIConfig.commandServerPort; sLog.outString("%s",s.str().c_str()); try @@ -94,16 +91,16 @@ void Run() void PlayerbotCommandServer::Start() { - thread serverThread(Run); + std::thread serverThread(Run); serverThread.detach(); } #endif #ifdef MANGOS -bool ReadLine(ACE_SOCK_Stream& client_stream, string* buffer, string* line) +bool ReadLine(ACE_SOCK_Stream& client_stream, std::string* buffer, std::string* line) { // Do the real reading from fd until buffer has '\n'. - string::iterator pos; + std::string::iterator pos; while ((pos = find(buffer->begin(), buffer->end(), '\n')) == buffer->end()) { char buf[33]; @@ -115,8 +112,8 @@ bool ReadLine(ACE_SOCK_Stream& client_stream, string* buffer, string* line) *buffer += buf; } - *line = string(buffer->begin(), pos); - *buffer = string(pos + 1, buffer->end()); + *line = std::string(buffer->begin(), pos); + *buffer = std::string(pos + 1, buffer->end()); return true; } @@ -128,7 +125,7 @@ class PlayerbotCommandServerThread: public ACE_Task return 0; } - ostringstream s; s << "Starting Playerbot Command Server on port " << sPlayerbotAIConfig.commandServerPort; + std::ostringstream s; s << "Starting Playerbot Command Server on port " << sPlayerbotAIConfig.commandServerPort; sLog.outString(s.str().c_str()); ACE_INET_Addr server(sPlayerbotAIConfig.commandServerPort); diff --git a/playerbot/PlayerbotCommandServer.h b/playerbot/PlayerbotCommandServer.h index cbf9d234..41db5b0e 100644 --- a/playerbot/PlayerbotCommandServer.h +++ b/playerbot/PlayerbotCommandServer.h @@ -5,8 +5,6 @@ #include "PlayerbotAIBase.h" #include "PlayerbotMgr.h" -using namespace std; - class PlayerbotCommandServer { public: diff --git a/playerbot/PlayerbotDbStore.cpp b/playerbot/PlayerbotDbStore.cpp index 5d7e2dd4..2f88ac9f 100644 --- a/playerbot/PlayerbotDbStore.cpp +++ b/playerbot/PlayerbotDbStore.cpp @@ -11,7 +11,6 @@ #include "strategy/values/PositionValue.h" INSTANTIATE_SINGLETON_1(PlayerbotDbStore); -using namespace std; using namespace ai; void PlayerbotDbStore::Load(PlayerbotAI *ai) @@ -26,12 +25,12 @@ void PlayerbotDbStore::Load(PlayerbotAI *ai) ai->ChangeStrategy("+chat", BotState::BOT_STATE_COMBAT); ai->ChangeStrategy("+chat", BotState::BOT_STATE_NON_COMBAT); - list values; + std::list values; do { Field* fields = results->Fetch(); - string key = fields[0].GetString(); - string value = fields[1].GetString(); + std::string key = fields[0].GetString(); + std::string value = fields[1].GetString(); if (key == "value") values.push_back(value); else if (key == "co") ai->ChangeStrategy(value, BotState::BOT_STATE_COMBAT); else if (key == "nc") ai->ChangeStrategy(value, BotState::BOT_STATE_NON_COMBAT); @@ -49,8 +48,8 @@ void PlayerbotDbStore::Save(PlayerbotAI *ai) Reset(ai); - list data = ai->GetAiObjectContext()->Save(); - for (list::iterator i = data.begin(); i != data.end(); ++i) + std::list data = ai->GetAiObjectContext()->Save(); + for (std::list::iterator i = data.begin(); i != data.end(); ++i) { SaveValue(guid, "value", *i); } @@ -61,13 +60,13 @@ void PlayerbotDbStore::Save(PlayerbotAI *ai) SaveValue(guid, "react", FormatStrategies("react", ai->GetStrategies(BotState::BOT_STATE_REACTION))); } -string PlayerbotDbStore::FormatStrategies(string type, list strategies) +std::string PlayerbotDbStore::FormatStrategies(std::string type, std::list strategies) { - ostringstream out; + std::ostringstream out; for(const auto& strategy : strategies) out << "+" << strategy << ","; - string res = out.str(); + std::string res = out.str(); return res.substr(0, res.size() - 1); } @@ -79,7 +78,7 @@ void PlayerbotDbStore::Reset(PlayerbotAI *ai) CharacterDatabase.PExecute("DELETE FROM `ai_playerbot_db_store` WHERE `guid` = '%lu'", guid); } -void PlayerbotDbStore::SaveValue(uint64 guid, string key, string value) +void PlayerbotDbStore::SaveValue(uint64 guid, std::string key, std::string value) { CharacterDatabase.PExecute("INSERT INTO `ai_playerbot_db_store` (`guid`, `key`, `value`) VALUES ('%lu', '%s', '%s')", guid, key.c_str(), value.c_str()); } diff --git a/playerbot/PlayerbotDbStore.h b/playerbot/PlayerbotDbStore.h index 7f5be3ac..9703a99e 100644 --- a/playerbot/PlayerbotDbStore.h +++ b/playerbot/PlayerbotDbStore.h @@ -5,8 +5,6 @@ #include "PlayerbotAIBase.h" #include "PlayerbotMgr.h" -using namespace std; - class PlayerbotDbStore { public: @@ -23,8 +21,8 @@ class PlayerbotDbStore void Reset(PlayerbotAI *ai); private: - void SaveValue(uint64 guid, string key, string value); - string FormatStrategies(string type, list strategies); + void SaveValue(uint64 guid, std::string key, std::string value); + std::string FormatStrategies(std::string type, std::list strategies); }; #define sPlayerbotDbStore PlayerbotDbStore::instance() diff --git a/playerbot/PlayerbotFactory.cpp b/playerbot/PlayerbotFactory.cpp index 7778b94c..4789be48 100644 --- a/playerbot/PlayerbotFactory.cpp +++ b/playerbot/PlayerbotFactory.cpp @@ -26,7 +26,6 @@ #include "strategy/ItemVisitors.h" using namespace ai; -using namespace std; #define PLAYER_SKILL_INDEX(x) (PLAYER_SKILL_INFO_1_1 + ((x)*3)) @@ -50,8 +49,8 @@ uint32 PlayerbotFactory::tradeSkills[] = #endif }; -list PlayerbotFactory::classQuestIds; -list PlayerbotFactory::specialQuestIds; +std::list PlayerbotFactory::classQuestIds; +std::list PlayerbotFactory::specialQuestIds; TaxiNodeLevelContainer PlayerbotFactory::overworldTaxiNodeLevelsA; TaxiNodeLevelContainer PlayerbotFactory::overworldTaxiNodeLevelsH; @@ -72,7 +71,7 @@ void PlayerbotFactory::Init() classQuestIds.remove(questId); classQuestIds.push_back(questId); } - for (list::iterator i = sPlayerbotAIConfig.randomBotQuestIds.begin(); i != sPlayerbotAIConfig.randomBotQuestIds.end(); ++i) + for (std::list::iterator i = sPlayerbotAIConfig.randomBotQuestIds.begin(); i != sPlayerbotAIConfig.randomBotQuestIds.end(); ++i) { uint32 questId = *i; AddPrevQuests(questId, specialQuestIds); @@ -554,7 +553,7 @@ void PlayerbotFactory::InitPet() if (!map) return; - vector ids; + std::vector ids; for (uint32 id = 0; id < sCreatureStorage.GetMaxEntry(); ++id) { CreatureInfo const* co = sCreatureStorage.LookupEntry(id); @@ -888,7 +887,7 @@ void PlayerbotFactory::ClearSkills() void PlayerbotFactory::ClearSpells() { #ifdef MANGOS - list spells; + std::list spells; for(PlayerSpellMap::iterator itr = bot->GetSpellMap().begin(); itr != bot->GetSpellMap().end(); ++itr) { uint32 spellId = itr->first; @@ -898,7 +897,7 @@ void PlayerbotFactory::ClearSpells() spells.push_back(spellId); } - for (list::iterator i = spells.begin(); i != spells.end(); ++i) + for (std::list::iterator i = spells.begin(); i != spells.end(); ++i) { bot->removeSpell(*i, false, false); } @@ -939,7 +938,7 @@ void PlayerbotFactory::ResetQuests() void PlayerbotFactory::InitReputations() { // list of factions - list factions; + std::list factions; // neutral if (level >= 60) @@ -1075,7 +1074,7 @@ class DestroyItemsVisitor : public IterateItemsVisitor private: Player* bot; - set keep; + std::set keep; }; @@ -1504,9 +1503,9 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool syncWithMaster) //map upgradeSlots; //if (incremental) //{ - // vector emptySlots; - // vector itemIds; - // map itemSlots; + // std::vector emptySlots; + // std::vector itemIds; + // std::map itemSlots; // uint32 maxSlots = urand(1, 4); // for (uint8 slot = 0; slot < EQUIPMENT_SLOT_END; ++slot) // upgradeSlots[slot] = false; @@ -1561,7 +1560,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool syncWithMaster) //} // unavailable legendaries list - vector lockedItems; + std::vector lockedItems; lockedItems.push_back(30311); // Warp Slicer lockedItems.push_back(30312); // Infinity Blade lockedItems.push_back(30313); // Staff of Disentagration @@ -1691,7 +1690,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool syncWithMaster) // pick random shirt if (slot == EQUIPMENT_SLOT_BODY || slot == EQUIPMENT_SLOT_TABARD) { - vector ids = sRandomItemMgr.Query(60, 1, 1, slot, 1); + std::vector ids = sRandomItemMgr.Query(60, 1, 1, slot, 1); sLog.outDetail("Bot #%d %s:%d <%s>: %u possible items for slot %d", bot->GetGUIDLow(), bot->GetTeam() == ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), ids.size(), slot); if (!ids.empty()) ahbot::Shuffle(ids); @@ -1740,14 +1739,14 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool syncWithMaster) } else { - vector ids; + std::vector ids; for (uint32 q = quality; q < ITEM_QUALITY_ARTIFACT; ++q) { uint32 currSearchLevel = searchLevel; bool hasProperLevel = false; while (!hasProperLevel && currSearchLevel > 0) { - vector newItems = sRandomItemMgr.Query(currSearchLevel, bot->getClass(), uint8(specId), slot, q); + std::vector newItems = sRandomItemMgr.Query(currSearchLevel, bot->getClass(), uint8(specId), slot, q); if (newItems.size()) ids.insert(ids.begin(), newItems.begin(), newItems.end()); @@ -1774,7 +1773,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool syncWithMaster) // add one hand weapons for tanks if ((specId == 3 || specId == 5) && slot == EQUIPMENT_SLOT_MAINHAND) { - vector oneHanded = sRandomItemMgr.Query(level, bot->getClass(), uint8(specId), EQUIPMENT_SLOT_OFFHAND, q); + std::vector oneHanded = sRandomItemMgr.Query(level, bot->getClass(), uint8(specId), EQUIPMENT_SLOT_OFFHAND, q); if (oneHanded.size()) ids.insert(ids.begin(), oneHanded.begin(), oneHanded.end()); } @@ -1782,7 +1781,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool syncWithMaster) // add one hand weapons for casters if ((specId == 4 || (bot->getClass() == CLASS_DRUID || bot->getClass() == CLASS_PRIEST || bot->getClass() == CLASS_MAGE || bot->getClass() == CLASS_WARLOCK || (specId == 20 || specId == 22))) && slot == EQUIPMENT_SLOT_MAINHAND) { - vector oneHanded = sRandomItemMgr.Query(level, bot->getClass(), uint8(specId), EQUIPMENT_SLOT_OFFHAND, q); + std::vector oneHanded = sRandomItemMgr.Query(level, bot->getClass(), uint8(specId), EQUIPMENT_SLOT_OFFHAND, q); if (oneHanded.size()) ids.insert(ids.begin(), oneHanded.begin(), oneHanded.end()); } @@ -1790,7 +1789,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool syncWithMaster) // add weapons for dual wield if (slot == EQUIPMENT_SLOT_MAINHAND && (bot->getClass() == CLASS_ROGUE || specId == 2 || specId == 21)) { - vector oneHanded = sRandomItemMgr.Query(level, bot->getClass(), uint8(specId), EQUIPMENT_SLOT_OFFHAND, q); + std::vector oneHanded = sRandomItemMgr.Query(level, bot->getClass(), uint8(specId), EQUIPMENT_SLOT_OFFHAND, q); if (oneHanded.size()) ids.insert(ids.begin(), oneHanded.begin(), oneHanded.end()); } @@ -2075,7 +2074,7 @@ void PlayerbotFactory::InitSecondEquipmentSet() if (bot->getClass() == CLASS_MAGE || bot->getClass() == CLASS_WARLOCK || bot->getClass() == CLASS_PRIEST) return; - map > items; + std::map > items; uint32 desiredQuality = ITEM_QUALITY_NORMAL; if (level < 10) @@ -2167,12 +2166,12 @@ void PlayerbotFactory::InitSecondEquipmentSet() int maxCount = urand(0, 5); int count = 0; - for (map >::iterator i = items.begin(); i != items.end(); ++i) + for (std::map >::iterator i = items.begin(); i != items.end(); ++i) { if (count++ >= maxCount) break; - vector& ids = i->second; + std::vector& ids = i->second; if (ids.empty()) { sLog.outDebug( "%s: no items to make second equipment set for slot %d", bot->GetName(), i->first); @@ -2247,7 +2246,7 @@ void PlayerbotFactory::AddGems(Item* item) if (!hasSockets) return; - vector gems = sRandomItemMgr.GetGemsList(); + std::vector gems = sRandomItemMgr.GetGemsList(); if (gems.empty()) return; @@ -2264,7 +2263,7 @@ void PlayerbotFactory::AddGems(Item* item) break; default: { - for (vector::const_iterator itr = gems.begin(); itr != gems.end(); itr++) + for (std::vector::const_iterator itr = gems.begin(); itr != gems.end(); itr++) { if (ItemPrototype const* gemProto = sObjectMgr.GetItemPrototype(*itr)) { @@ -2361,8 +2360,8 @@ void PlayerbotFactory::InitTradeSkills() uint16 secondSkill = sRandomPlayerbotMgr.GetValue(bot, "secondSkill"); if (!firstSkill || !secondSkill) { - vector firstSkills; - vector secondSkills; + std::vector firstSkills; + std::vector secondSkills; switch (bot->getClass()) { case CLASS_WARRIOR: @@ -2490,7 +2489,7 @@ void PlayerbotFactory::InitTradeSkills() SpellEntry const* spell = sServerFacade.LookupSpellInfo(tSpell->spell); if (spell) { - string SpellName = spell->SpellName[0]; + std::string SpellName = spell->SpellName[0]; if (spell->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_SKILL_STEP) { uint32 skill = spell->EffectMiscValue[EFFECT_INDEX_1]; @@ -2500,7 +2499,7 @@ void PlayerbotFactory::InitTradeSkills() SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (pSkill) { - if (SpellName.find("Apprentice") != string::npos && pSkill->categoryId == SKILL_CATEGORY_PROFESSION || pSkill->categoryId == SKILL_CATEGORY_SECONDARY) + if (SpellName.find("Apprentice") != std::string::npos && pSkill->categoryId == SKILL_CATEGORY_PROFESSION || pSkill->categoryId == SKILL_CATEGORY_SECONDARY) continue; } } @@ -2767,7 +2766,7 @@ void PlayerbotFactory::InitAvailableSpells() // add book spells if (bot->GetLevel() == 60) { - vector bookSpells; + std::vector bookSpells; switch (bot->getClass()) { case CLASS_WARRIOR: @@ -2837,7 +2836,7 @@ void PlayerbotFactory::InitAvailableSpells() void PlayerbotFactory::InitSpecialSpells() { - for (list::iterator i = sPlayerbotAIConfig.randomBotSpellIds.begin(); i != sPlayerbotAIConfig.randomBotSpellIds.end(); ++i) + for (std::list::iterator i = sPlayerbotAIConfig.randomBotSpellIds.begin(); i != sPlayerbotAIConfig.randomBotSpellIds.end(); ++i) { uint32 spellId = *i; @@ -2852,7 +2851,7 @@ void PlayerbotFactory::InitTalents(uint32 specNo) { uint32 classMask = bot->getClassMask(); - map > spells; + std::map > spells; for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); @@ -2870,9 +2869,9 @@ void PlayerbotFactory::InitTalents(uint32 specNo) } uint32 freePoints = bot->GetFreeTalentPoints(); - for (map >::iterator i = spells.begin(); i != spells.end(); ++i) + for (std::map >::iterator i = spells.begin(); i != spells.end(); ++i) { - vector &spells = i->second; + std::vector &spells = i->second; if (spells.empty()) { sLog.outError("%s: No spells for talent row %d", bot->GetName(), i->first); @@ -2902,8 +2901,8 @@ void PlayerbotFactory::InitTalents(uint32 specNo) ObjectGuid PlayerbotFactory::GetRandomBot() { - vector guids; - for (list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); i++) + std::vector guids; + for (std::list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); i++) { uint32 accountId = *i; if (!sAccountMgr.GetCharactersCount(accountId)) @@ -2930,7 +2929,7 @@ ObjectGuid PlayerbotFactory::GetRandomBot() } -void PlayerbotFactory::AddPrevQuests(uint32 questId, list& questIds) +void PlayerbotFactory::AddPrevQuests(uint32 questId, std::list& questIds) { Quest const *quest = sObjectMgr.GetQuestTemplate(questId); for (Quest::PrevQuests::const_iterator iter = quest->prevQuests.begin(); iter != quest->prevQuests.end(); ++iter) @@ -2942,10 +2941,10 @@ void PlayerbotFactory::AddPrevQuests(uint32 questId, list& questIds) } } -void PlayerbotFactory::InitQuests(list& questMap) +void PlayerbotFactory::InitQuests(std::list& questMap) { int count = 0; - for (list::iterator i = questMap.begin(); i != questMap.end(); ++i) + for (std::list::iterator i = questMap.begin(); i != questMap.end(); ++i) { uint32 questId = *i; Quest const *quest = sObjectMgr.GetQuestTemplate(questId); @@ -3089,8 +3088,8 @@ void PlayerbotFactory::InitMounts() if (bot->GetLevel() < firstmount) return; - map > > mounts; - vector slow, fast, fslow, ffast; + std::map > > mounts; + std::vector slow, fast, fslow, ffast; switch (bot->getRace()) { case RACE_HUMAN: @@ -3226,7 +3225,7 @@ void PlayerbotFactory::InitFood() void PlayerbotFactory::InitReagents() { - list items; + std::list items; uint32 regCount = 1; switch (bot->getClass()) { @@ -3293,7 +3292,7 @@ void PlayerbotFactory::InitReagents() break; } - for (list::iterator i = items.begin(); i != items.end(); ++i) + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { ItemPrototype const* proto = sObjectMgr.GetItemPrototype(*i); if (!proto) @@ -3459,7 +3458,7 @@ void PlayerbotFactory::InitInventoryTrade() void PlayerbotFactory::InitInventoryEquip() { - vector ids; + std::vector ids; uint32 desiredQuality = ITEM_QUALITY_NORMAL; if (level < 10) @@ -3539,8 +3538,8 @@ void PlayerbotFactory::InitGuild() if (sPlayerbotAIConfig.randomBotGuilds.size() < sPlayerbotAIConfig.randomBotGuildCount) RandomPlayerbotFactory::CreateRandomGuilds(); - vector guilds; - for (list::iterator i = sPlayerbotAIConfig.randomBotGuilds.begin(); i != sPlayerbotAIConfig.randomBotGuilds.end(); ++i) + std::vector guilds; + for (std::list::iterator i = sPlayerbotAIConfig.randomBotGuilds.begin(); i != sPlayerbotAIConfig.randomBotGuilds.end(); ++i) { Guild* guild = sGuildMgr.GetGuildById(*i); if (!guild) @@ -3584,13 +3583,13 @@ void PlayerbotFactory::InitGuild() void PlayerbotFactory::InitImmersive() { uint32 owner = bot->GetObjectGuid().GetCounter(); - map percentMap; + std::map percentMap; bool initialized = false; for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) { Stats type = (Stats)i; - ostringstream name; name << "immersive_stat_" << i; + std::ostringstream name; name << "immersive_stat_" << i; uint32 value = sRandomPlayerbotMgr.GetValue(owner, name.str()); if (value) initialized = true; percentMap[type] = value; @@ -3660,7 +3659,7 @@ void PlayerbotFactory::InitImmersive() for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) { Stats type = (Stats)i; - ostringstream name; name << "immersive_stat_" << i; + std::ostringstream name; name << "immersive_stat_" << i; sRandomPlayerbotMgr.SetValue(owner, name.str(), percentMap[type]); } } @@ -3794,7 +3793,7 @@ void PlayerbotFactory::LoadEnchantContainer() /*void PlayerbotFactory::InitGems() //WIP { #ifndef MANGOSBOT_ZERO - vector gems = sRandomItemMgr.GetGemsList(); + std::vector gems = sRandomItemMgr.GetGemsList(); if (!gems.empty()) ahbot::Shuffle(gems); for (int slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; slot++) @@ -3833,7 +3832,7 @@ void PlayerbotFactory::LoadEnchantContainer() break; default: { - for (vector::const_iterator itr = gems.begin(); itr != gems.end(); itr++) + for (std::vector::const_iterator itr = gems.begin(); itr != gems.end(); itr++) { if (ItemPrototype const* gemProto = sObjectMgr.GetItemPrototype(*itr)) { @@ -3912,7 +3911,7 @@ void PlayerbotFactory::LoadEnchantContainer() void PlayerbotFactory::InitGems() //WIP { #ifndef MANGOSBOT_ZERO - vector gems = sRandomItemMgr.GetGemsList(); + std::vector gems = sRandomItemMgr.GetGemsList(); for (int slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; slot++) { if (Item* item = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) @@ -3953,7 +3952,7 @@ void PlayerbotFactory::InitGems() //WIP break; default: { - for (vector::const_iterator itr = gems.begin(); itr != gems.end(); itr++) + for (std::vector::const_iterator itr = gems.begin(); itr != gems.end(); itr++) { if (ItemPrototype const* gemProto = sObjectMgr.GetItemPrototype(*itr)) { diff --git a/playerbot/PlayerbotFactory.h b/playerbot/PlayerbotFactory.h index a7f096a9..338b8efb 100644 --- a/playerbot/PlayerbotFactory.h +++ b/playerbot/PlayerbotFactory.h @@ -4,8 +4,6 @@ class Player; class PlayerbotMgr; class ChatHandler; -using namespace std; - struct EnchantTemplate { uint8 ClassId; @@ -53,8 +51,8 @@ class PlayerbotFactory static void Init(); void Refresh(); void Randomize(bool incremental, bool syncWithMaster); - static list classQuestIds; - static list specialQuestIds; + static std::list classQuestIds; + static std::list specialQuestIds; void InitSkills(); void EnchantEquipment(); void EquipGear() { return InitEquipment(false, false); } @@ -86,7 +84,7 @@ class PlayerbotFactory void InitSpecialSpells(); void InitTalentsTree(bool incremental); void InitTalents(uint32 specNo); - void InitQuests(list& questMap); + void InitQuests(std::list& questMap); void InitTaxiNodes(); void ClearInventory(); void ClearAllItems(); @@ -114,7 +112,7 @@ class PlayerbotFactory void InitArenaTeam(); void InitImmersive(); void AddConsumables(); - static void AddPrevQuests(uint32 questId, list& questIds); + static void AddPrevQuests(uint32 questId, std::list& questIds); void LoadEnchantContainer(); void ApplyEnchantTemplate(); void ApplyEnchantTemplate(uint8 spec, Item* item = nullptr); diff --git a/playerbot/PlayerbotHelpMgr.cpp b/playerbot/PlayerbotHelpMgr.cpp index b9b94915..26db4a39 100644 --- a/playerbot/PlayerbotHelpMgr.cpp +++ b/playerbot/PlayerbotHelpMgr.cpp @@ -30,7 +30,7 @@ PlayerbotHelpMgr::~PlayerbotHelpMgr() { } -void PlayerbotHelpMgr::replace(string& text, const string what, const string with) +void PlayerbotHelpMgr::replace(std::string& text, const std::string what, const std::string with) { size_t start_pos = 0; while ((start_pos = text.find(what, start_pos)) != std::string::npos) { @@ -39,10 +39,10 @@ void PlayerbotHelpMgr::replace(string& text, const string what, const string wit } } -string PlayerbotHelpMgr::makeList(vectorconst parts, string partFormat, uint32 maxLength) +std::string PlayerbotHelpMgr::makeList(std::vectorconst parts, std::string partFormat, uint32 maxLength) { - string retString = ""; - string currentLine = ""; + std::string retString = ""; + std::string currentLine = ""; for (auto part : parts) { @@ -52,7 +52,7 @@ string PlayerbotHelpMgr::makeList(vectorconst parts, string partFormat, retString += currentLine + "\n"; currentLine.clear(); } - string subPart = partFormat; + std::string subPart = partFormat; replace(subPart, "", part); @@ -65,7 +65,7 @@ string PlayerbotHelpMgr::makeList(vectorconst parts, string partFormat, #ifdef GenerateBotHelp string PlayerbotHelpMgr::formatFloat(float num) { - ostringstream out; + std::ostringstream out; out << std::fixed << std::setprecision(3); out << num; return out.str().c_str(); @@ -73,8 +73,8 @@ string PlayerbotHelpMgr::formatFloat(float num) bool PlayerbotHelpMgr::IsGenericSupported(PlayerbotAIAware* object) { - set supported; - string name = object->getName(); + std::set supported; + std::string name = object->getName(); if (dynamic_cast(object)) supported = genericContext->GetSupportedStrategies(); else if (dynamic_cast(object)) @@ -90,14 +90,14 @@ bool PlayerbotHelpMgr::IsGenericSupported(PlayerbotAIAware* object) return supported.find(name) != supported.end(); } -string PlayerbotHelpMgr::GetObjectName(PlayerbotAIAware* object, string className) +string PlayerbotHelpMgr::GetObjectName(PlayerbotAIAware* object, std::string className) { return IsGenericSupported(object) ? object->getName() : className + " " + object->getName(); } -string PlayerbotHelpMgr::GetObjectLink(PlayerbotAIAware* object, string className) +string PlayerbotHelpMgr::GetObjectLink(PlayerbotAIAware* object, std::string className) { - string prefix = "unkown"; + std::string prefix = "unkown"; if (dynamic_cast(object)) prefix = "strategy"; if (dynamic_cast(object)) @@ -113,11 +113,11 @@ string PlayerbotHelpMgr::GetObjectLink(PlayerbotAIAware* object, string classNam return "[h:" + prefix + "|" + object->getName() + "]"; } -void PlayerbotHelpMgr::LoadStrategies(string className, AiObjectContext* context) +void PlayerbotHelpMgr::LoadStrategies(std::string className, AiObjectContext* context) { ai->SetAiObjectContext(context); - vector stratLinks; + std::vector stratLinks; for (auto strategyName : context->GetSupportedStrategies()) { if (strategyName == "custom") @@ -155,7 +155,7 @@ void PlayerbotHelpMgr::LoadStrategies(string className, AiObjectContext* context NextAction** nextActions = triggerNode->getHandlers(); - vector nextActionList; + std::vector nextActionList; for (int32 i = 0; i < NextAction::size(nextActions); i++) nextActionList.push_back(nextActions[i]); @@ -181,7 +181,7 @@ void PlayerbotHelpMgr::LoadStrategies(string className, AiObjectContext* context if (strategy->getDefaultActions(state)) { - vector nextActionList; + std::vector nextActionList; for (int32 i = 0; i < NextAction::size(strategy->getDefaultActions(state)); i++) nextActionList.push_back(strategy->getDefaultActions(state)[i]); @@ -235,9 +235,9 @@ void PlayerbotHelpMgr::LoadAllStrategies() } } -string PlayerbotHelpMgr::GetStrategyBehaviour(string className, Strategy* strategy) +string PlayerbotHelpMgr::GetStrategyBehaviour(std::string className, Strategy* strategy) { - string behavior; + std::string behavior; AiObjectContext* context = classContext[className]; @@ -254,7 +254,7 @@ string PlayerbotHelpMgr::GetStrategyBehaviour(string className, Strategy* strate for (auto trig : stat.second) { - string line; + std::string line; Trigger* trigger = trig.first; @@ -280,22 +280,22 @@ void PlayerbotHelpMgr::GenerateStrategyHelp() { for (auto& strategyClass : classMap) { - string className = strategyClass.first; + std::string className = strategyClass.first; - vector stratLinks; + std::vector stratLinks; for (auto& strat : strategyClass.second) { Strategy* strategy = strat.first; - string strategyName = strategy->getName(); - string linkName = GetObjectName(strategy, className); + std::string strategyName = strategy->getName(); + std::string linkName = GetObjectName(strategy, className); stratLinks.push_back(GetObjectLink(strategy, className)); - string helpTemplate = botHelpText["template:strategy"].m_templateText; + std::string helpTemplate = botHelpText["template:strategy"].m_templateText; - string description, related; + std::string description, related; if (strategy->GetHelpName() == strategyName) //Only get description if defined in trigger { description = strategy->GetHelpDescription(); @@ -308,7 +308,7 @@ void PlayerbotHelpMgr::GenerateStrategyHelp() if (!related.empty()) related = "\nRelated strategies:\n" + related; - string behavior = GetStrategyBehaviour(className, strategy); + std::string behavior = GetStrategyBehaviour(className, strategy); replace(helpTemplate, "", strategyName); replace(helpTemplate, "", description); @@ -328,17 +328,17 @@ void PlayerbotHelpMgr::GenerateStrategyHelp() } } -string PlayerbotHelpMgr::GetTriggerBehaviour(string className, Trigger* trigger) +string PlayerbotHelpMgr::GetTriggerBehaviour(std::string className, Trigger* trigger) { - string behavior; + std::string behavior; AiObjectContext* context = classContext[className]; for (auto sstat : states) { BotState state = sstat.first; - string stateName = sstat.second; - string stateBehavior; + std::string stateName = sstat.second; + std::string stateBehavior; for (auto strat : classMap[className]) { @@ -350,7 +350,7 @@ string PlayerbotHelpMgr::GetTriggerBehaviour(string className, Trigger* trigger) if (stateBehavior.empty()) stateBehavior += "\n" + initcap(states[state]) + " behavior:"; - string line; + std::string line; line = "Executes: "; @@ -373,10 +373,10 @@ void PlayerbotHelpMgr::GenerateTriggerHelp() { for (auto& strategyClass : classMap) { - string className = strategyClass.first; + std::string className = strategyClass.first; - vector trigLinks; - vector triggers; + std::vector trigLinks; + std::vector triggers; for (auto& strat : strategyClass.second) { @@ -389,8 +389,8 @@ void PlayerbotHelpMgr::GenerateTriggerHelp() if (!trigger) //Ignore default actions continue; - string triggerName = trigger->getName(); - string linkName = GetObjectName(trigger, className); + std::string triggerName = trigger->getName(); + std::string linkName = GetObjectName(trigger, className); if (std::find(triggers.begin(), triggers.end(), triggerName) != triggers.end()) continue; @@ -399,9 +399,9 @@ void PlayerbotHelpMgr::GenerateTriggerHelp() trigLinks.push_back(GetObjectLink(trigger, className)); - string helpTemplate = botHelpText["template:trigger"].m_templateText; + std::string helpTemplate = botHelpText["template:trigger"].m_templateText; - string description, relatedTrig, relatedVal; + std::string description, relatedTrig, relatedVal; if (trigger->GetHelpName() == triggerName) //Only get description if defined in trigger { description = trigger->GetHelpDescription(); @@ -417,7 +417,7 @@ void PlayerbotHelpMgr::GenerateTriggerHelp() if (!relatedVal.empty()) relatedVal = "\nUsed values:\n" + relatedVal; - string behavior = GetTriggerBehaviour(className, trigger); + std::string behavior = GetTriggerBehaviour(className, trigger); replace(helpTemplate, "", triggerName); replace(helpTemplate, "", description); @@ -441,17 +441,17 @@ void PlayerbotHelpMgr::GenerateTriggerHelp() } } -string PlayerbotHelpMgr::GetActionBehaviour(string className, Action* nextAction) +string PlayerbotHelpMgr::GetActionBehaviour(std::string className, Action* nextAction) { - string behavior; + std::string behavior; AiObjectContext* context = classContext[className]; for (auto sstat : states) { BotState state = sstat.first; - string stateName = sstat.second; - string stateBehavior; + std::string stateName = sstat.second; + std::string stateBehavior; for (auto strat : classMap[className]) { @@ -466,7 +466,7 @@ string PlayerbotHelpMgr::GetActionBehaviour(string className, Action* nextAction if (stateBehavior.empty()) stateBehavior += "\n" + initcap(states[state]) + " behavior:"; - string line; + std::string line; if (trig.first) line = "Triggers from: " + GetObjectLink(trig.first, className); @@ -490,10 +490,10 @@ void PlayerbotHelpMgr::GenerateActionHelp() { for (auto& strategyClass : classMap) { - string className = strategyClass.first; + std::string className = strategyClass.first; - vector actionLinks; - vector actions; + std::vector actionLinks; + std::vector actions; for (auto& strat : strategyClass.second) { @@ -508,10 +508,10 @@ void PlayerbotHelpMgr::GenerateActionHelp() for (auto& act : trig.second) { - string ActionName = act.first->getName(); + std::string ActionName = act.first->getName(); Action* action = act.first; - string linkName = GetObjectName(action, className); + std::string linkName = GetObjectName(action, className); if (std::find(actions.begin(), actions.end(), ActionName) != actions.end()) continue; @@ -520,9 +520,9 @@ void PlayerbotHelpMgr::GenerateActionHelp() actionLinks.push_back(GetObjectLink(action, className)); - string helpTemplate = botHelpText["template:action"].m_templateText; + std::string helpTemplate = botHelpText["template:action"].m_templateText; - string description, relatedAct, relatedVal; + std::string description, relatedAct, relatedVal; if (action->GetHelpName() == ActionName) //Only get description if defined in trigger { description = action->GetHelpDescription(); @@ -538,7 +538,7 @@ void PlayerbotHelpMgr::GenerateActionHelp() if (!relatedVal.empty()) relatedVal = "\nUsed values:\n" + relatedVal; - string behavior = GetActionBehaviour(className, act.first); + std::string behavior = GetActionBehaviour(className, act.first); replace(helpTemplate, "", ActionName); replace(helpTemplate, "", description); @@ -565,19 +565,19 @@ void PlayerbotHelpMgr::GenerateActionHelp() void PlayerbotHelpMgr::GenerateValueHelp() { AiObjectContext* genericContext = classContext["generic"]; - set genericValues = genericContext->GetSupportedValues(); + std::set genericValues = genericContext->GetSupportedValues(); - unordered_map> valueLinks; + std::unordered_map> valueLinks; for (auto& strategyClass : classMap) { - string className = strategyClass.first; + std::string className = strategyClass.first; - vector values; + std::vector values; AiObjectContext* context = classContext[className]; - set allValues = context->GetSupportedValues(); + std::set allValues = context->GetSupportedValues(); for (auto& valueName : allValues) { if (className != "generic" && std::find(genericValues.begin(), genericValues.end(), valueName) != genericValues.end()) @@ -585,21 +585,21 @@ void PlayerbotHelpMgr::GenerateValueHelp() UntypedValue* value = context->GetUntypedValue(valueName); - string linkName = GetObjectName(value, className); + std::string linkName = GetObjectName(value, className); if (std::find(values.begin(), values.end(), valueName) != values.end()) continue; values.push_back(valueName); - string valueType; + std::string valueType; - string helpTemplate = botHelpText["template:value"].m_templateText; + std::string helpTemplate = botHelpText["template:value"].m_templateText; - string description, usedVal, relatedTrig, relatedAct, relatedVal; + std::string description, usedVal, relatedTrig, relatedAct, relatedVal; if (value->GetHelpName() == valueName) //Only get description if defined in trigger { - vector usedInTrigger, usedInAction, usedInValue; + std::vector usedInTrigger, usedInAction, usedInValue; for (auto& strat : strategyClass.second) { for (auto stat : strat.second) @@ -673,7 +673,7 @@ void PlayerbotHelpMgr::GenerateValueHelp() } } - vector valueTypes; + std::vector valueTypes; for (auto valueLinkSet : valueLinks) if (!valueLinkSet.first.empty()) @@ -681,11 +681,11 @@ void PlayerbotHelpMgr::GenerateValueHelp() valueTypes.push_back(""); - vector typeLinks; + std::vector typeLinks; for (auto type : valueTypes) { - vector links = valueLinks[type]; + std::vector links = valueLinks[type]; std::sort(links.begin(), links.end()); if (type.empty()) @@ -695,7 +695,7 @@ void PlayerbotHelpMgr::GenerateValueHelp() typeLinks.push_back("[h:list|" + type + " value]"); } - string valueHelp = botHelpText["object:value"].m_templateText; + std::string valueHelp = botHelpText["object:value"].m_templateText; valueHelp = valueHelp.substr(0, valueHelp.find("Values:")); valueHelp += "Values:" + makeList(typeLinks); @@ -709,18 +709,18 @@ void PlayerbotHelpMgr::GenerateChatFilterHelp() { CompositeChatFilter* filter = new CompositeChatFilter(ai); - vector filterLinks; + std::vector filterLinks; for (auto subFilter : filter->GetFilters()) { - string helpTemplate = botHelpText["template:chatfilter"].m_templateText; + std::string helpTemplate = botHelpText["template:chatfilter"].m_templateText; - string filterName = subFilter->GetHelpName(); - string description = subFilter->GetHelpDescription(); - string examples; + std::string filterName = subFilter->GetHelpName(); + std::string description = subFilter->GetHelpDescription(); + std::string examples; for (auto& example : subFilter->GetFilterExamples()) { - string line = example.first + ": " + example.second; + std::string line = example.first + ": " + example.second; examples += (examples.empty() ? "" : "\n") + line; } @@ -735,7 +735,7 @@ void PlayerbotHelpMgr::GenerateChatFilterHelp() botHelpText["chatfilter:" + filterName].m_templateText = helpTemplate; } - string filterHelp = botHelpText["object:chatfilter"].m_templateText; + std::string filterHelp = botHelpText["object:chatfilter"].m_templateText; filterHelp = filterHelp.substr(0, filterHelp.find("Filters:")); filterHelp += "Filters:" + makeList(filterLinks); @@ -751,7 +751,7 @@ void PlayerbotHelpMgr::PrintCoverage() { for (auto typeCov : coverageMap) { - vector missingNames; + std::vector missingNames; uint32 totalNames = 0, hasNames = 0; for (auto cov : typeCov.second) @@ -787,8 +787,8 @@ void PlayerbotHelpMgr::SaveTemplates() if (!text.second.m_templateChanged) continue; - string name = text.first; - string temp = text.second.m_templateText; + std::string name = text.first; + std::string temp = text.second.m_templateText; replace(name, "'", "''"); replace(temp, "\r\n", "\n"); replace(temp, "\n", "\\r\\n"); @@ -846,7 +846,7 @@ void PlayerbotHelpMgr::GenerateHelp() } #endif -void PlayerbotHelpMgr::FormatHelpTopic(string& text) +void PlayerbotHelpMgr::FormatHelpTopic(std::string& text) { //[h:subject:topic|name] size_t start_pos = 0; @@ -856,18 +856,18 @@ void PlayerbotHelpMgr::FormatHelpTopic(string& text) if (end_pos == std::string::npos) break; - string oldLink = text.substr(start_pos, end_pos - start_pos + 1); + std::string oldLink = text.substr(start_pos, end_pos - start_pos + 1); if (oldLink.find("|") != std::string::npos) { - string topicCode = oldLink.substr(3, oldLink.find("|") - 3); + std::string topicCode = oldLink.substr(3, oldLink.find("|") - 3); std::string topicName = oldLink.substr(oldLink.find("|") + 1); topicName.pop_back(); if (topicCode.find(":") == std::string::npos) topicCode += ":" + topicName; - string newLink = ChatHelper::formatValue("help", topicCode, topicName); + std::string newLink = ChatHelper::formatValue("help", topicCode, topicName); text.replace(start_pos, oldLink.length(), newLink); start_pos += newLink.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx' @@ -884,14 +884,14 @@ void PlayerbotHelpMgr::FormatHelpTopic(string& text) if (end_pos == std::string::npos) break; - string oldLink = text.substr(start_pos, end_pos - start_pos + 1); + std::string oldLink = text.substr(start_pos, end_pos - start_pos + 1); if (oldLink.find("|") != std::string::npos) { - string topicCode = oldLink.substr(3, oldLink.find("|") - 3); + std::string topicCode = oldLink.substr(3, oldLink.find("|") - 3); std::string topicName = oldLink.substr(oldLink.find("|") + 1); topicName.pop_back(); - string newLink = ChatHelper::formatValue("command", topicCode, topicName, "0000FF00"); + std::string newLink = ChatHelper::formatValue("command", topicCode, topicName, "0000FF00"); text.replace(start_pos, oldLink.length(), newLink); start_pos += newLink.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx' @@ -930,7 +930,7 @@ void PlayerbotHelpMgr::LoadBotHelpTexts() std::string text, templateText; std::map text_locale; Field* fields = results->Fetch(); - string name = fields[0].GetString(); + std::string name = fields[0].GetString(); templateText = fields[1].GetString(); text = fields[2].GetString(); @@ -955,7 +955,7 @@ void PlayerbotHelpMgr::LoadBotHelpTexts() // general texts -string PlayerbotHelpMgr::GetBotText(string name) +std::string PlayerbotHelpMgr::GetBotText(std::string name) { if (botHelpText.empty()) { @@ -981,18 +981,18 @@ string PlayerbotHelpMgr::GetBotText(string name) } } -bool PlayerbotHelpMgr::GetBotText(string name, string &text) +bool PlayerbotHelpMgr::GetBotText(std::string name, std::string &text) { text = GetBotText(name); return !text.empty(); } -vector PlayerbotHelpMgr::FindBotText(string name) +std::vector PlayerbotHelpMgr::FindBotText(std::string name) { - vector found; + std::vector found; for (auto text : botHelpText) { - if (text.first.find(name) == string::npos) + if (text.first.find(name) == std::string::npos) continue; found.push_back(text.first); diff --git a/playerbot/PlayerbotHelpMgr.h b/playerbot/PlayerbotHelpMgr.h index 123f7038..76be483e 100644 --- a/playerbot/PlayerbotHelpMgr.h +++ b/playerbot/PlayerbotHelpMgr.h @@ -6,8 +6,6 @@ #define BOT_HELP(name) sPlayerbotHelpMgr.GetBotText(name) -using namespace std; - struct BotHelpEntry { BotHelpEntry() { m_new = true; } @@ -31,42 +29,42 @@ class PlayerbotHelpMgr } public: - static void replace(string& text, const string what, const string with); - static string makeList(vectorconst parts, string partFormat = "", uint32 maxLength = 254); + static void replace(std::string& text, const std::string what, const std::string with); + static std::string makeList(std::vectorconst parts, std::string partFormat = "", uint32 maxLength = 254); #ifdef GenerateBotHelp PlayerbotAI* ai; AiObjectContext* genericContext; - typedef unordered_map actionMap; - typedef unordered_map triggerMap; - typedef unordered_map stateMap; - typedef unordered_map strategyMap; - unordered_map classMap; - unordered_map classContext; + typedef std::unordered_map actionMap; + typedef std::unordered_map triggerMap; + typedef std::unordered_map stateMap; + typedef std::unordered_map strategyMap; + std::unordered_map classMap; + std::unordered_map classContext; - unordered_map states = { {BotState::BOT_STATE_COMBAT, "combat"}, {BotState::BOT_STATE_NON_COMBAT, "non combat"}, {BotState::BOT_STATE_DEAD, "dead state"}, {BotState::BOT_STATE_REACTION, "reaction"}, {BotState::BOT_STATE_ALL, "all"} }; + std::unordered_map states = { {BotState::BOT_STATE_COMBAT, "combat"}, {BotState::BOT_STATE_NON_COMBAT, "non combat"}, {BotState::BOT_STATE_DEAD, "dead state"}, {BotState::BOT_STATE_REACTION, "reaction"}, {BotState::BOT_STATE_ALL, "all"} }; - unordered_map supportedActionName; + std::unordered_map supportedActionName; - typedef unordered_map nameCoverageMap; - unordered_map coverageMap; + typedef std::unordered_map nameCoverageMap; + std::unordered_map coverageMap; - static string initcap(string st) { string s = st; s[0] = toupper(s[0]); return s; } - static string formatFloat(float num); + static std::string initcap(std::string st) { std::string s = st; s[0] = toupper(s[0]); return s; } + static std::string formatFloat(float num); bool IsGenericSupported(PlayerbotAIAware* object); - string GetObjectName(PlayerbotAIAware* object, string className); - string GetObjectLink(PlayerbotAIAware* object, string className); + std::string GetObjectName(PlayerbotAIAware* object, std::string className); + std::string GetObjectLink(PlayerbotAIAware* object, std::string className); - void LoadStrategies(string className, AiObjectContext* context); + void LoadStrategies(std::string className, AiObjectContext* context); void LoadAllStrategies(); - string GetStrategyBehaviour(string className, Strategy* strategy); + std::string GetStrategyBehaviour(std::string className, Strategy* strategy); void GenerateStrategyHelp(); - string GetTriggerBehaviour(string className, Trigger* trigger); + std::string GetTriggerBehaviour(std::string className, Trigger* trigger); void GenerateTriggerHelp(); - string GetActionBehaviour(string className, Action* Action); + std::string GetActionBehaviour(std::string className, Action* Action); void GenerateActionHelp(); void GenerateValueHelp(); @@ -79,15 +77,15 @@ class PlayerbotHelpMgr void GenerateHelp(); #endif - static void FormatHelpTopic(string& text); + static void FormatHelpTopic(std::string& text); void FormatHelpTopics(); void LoadBotHelpTexts(); - string GetBotText(string name); - bool GetBotText(string name, string& text); - vector FindBotText(string name); + std::string GetBotText(std::string name); + bool GetBotText(std::string name, std::string& text); + std::vector FindBotText(std::string name); private: - unordered_map botHelpText; + std::unordered_map botHelpText; }; #define sPlayerbotHelpMgr PlayerbotHelpMgr::instance() diff --git a/playerbot/PlayerbotMgr.cpp b/playerbot/PlayerbotMgr.cpp index 077eb00c..e20a9b44 100644 --- a/playerbot/PlayerbotMgr.cpp +++ b/playerbot/PlayerbotMgr.cpp @@ -295,7 +295,7 @@ void PlayerbotHolder::OnBotLogin(Player * const bot) if (!groupValid) { WorldPacket p; - string member = bot->GetName(); + std::string member = bot->GetName(); p << uint32(PARTY_OP_LEAVE) << member << uint32(0); bot->GetSession()->HandleGroupDisbandOpcode(p); } @@ -410,7 +410,7 @@ void PlayerbotHolder::OnBotLogin(Player * const bot) } } -string PlayerbotHolder::ProcessBotCommand(string cmd, ObjectGuid guid, ObjectGuid masterguid, bool admin, uint32 masterAccountId, uint32 masterGuildId) +std::string PlayerbotHolder::ProcessBotCommand(std::string cmd, ObjectGuid guid, ObjectGuid masterguid, bool admin, uint32 masterAccountId, uint32 masterGuildId) { if (!sPlayerbotAIConfig.enabled || guid.IsEmpty()) return "Bot system is disabled"; @@ -650,11 +650,11 @@ bool PlayerbotMgr::HandlePlayerbotMgrCommand(ChatHandler* handler, char const* a return false; } - list messages = mgr->HandlePlayerbotCommand(args, player); + std::list messages = mgr->HandlePlayerbotCommand(args, player); if (messages.empty()) return true; - for (list::iterator i = messages.begin(); i != messages.end(); ++i) + for (std::list::iterator i = messages.begin(); i != messages.end(); ++i) { handler->PSendSysMessage("%s",i->c_str()); } @@ -662,9 +662,9 @@ bool PlayerbotMgr::HandlePlayerbotMgrCommand(ChatHandler* handler, char const* a return true; } -list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* master) +std::list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* master) { - list messages; + std::list messages; if (!*args) { @@ -672,7 +672,7 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m return messages; } - string command = args; + std::string command = args; char *cmd = strtok ((char*)args, " "); const char *charname = strtok (NULL, " "); @@ -701,7 +701,7 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m if (sPlayerbotAIConfig.tweakValue > 2) sPlayerbotAIConfig.tweakValue = 0; - messages.push_back("Set tweakvalue to " + to_string(sPlayerbotAIConfig.tweakValue)); + messages.push_back("Set tweakvalue to " + std::to_string(sPlayerbotAIConfig.tweakValue)); return messages; } @@ -725,7 +725,7 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m ObjectGuid guid; uint32 accountId; - string alwaysName; + std::string alwaysName; if (!charname) { @@ -759,7 +759,7 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m { sRandomPlayerbotMgr.SetValue(guid.GetCounter(), "always", 1); messages.push_back("Enable offline player ai for " + alwaysName); - sPlayerbotAIConfig.freeAltBots.push_back(make_pair(accountId, guid.GetCounter())); + sPlayerbotAIConfig.freeAltBots.push_back(std::make_pair(accountId, guid.GetCounter())); } else { @@ -874,7 +874,7 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m std::string cmdStr = cmd; std::string charnameStr = charname; - set bots; + std::set bots; if (charnameStr == "*" && master) { Group* group = master->GetGroup(); @@ -892,7 +892,7 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m if (member.GetRawValue() == master->GetObjectGuid().GetRawValue()) continue; - string bot; + std::string bot; if (sObjectMgr.GetPlayerNameByGUID(member, bot)) bots.insert(bot); } @@ -908,10 +908,10 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m } } - vector chars = split(charnameStr, ','); - for (vector::iterator i = chars.begin(); i != chars.end(); i++) + std::vector chars = split(charnameStr, ','); + for (std::vector::iterator i = chars.begin(); i != chars.end(); i++) { - string s = *i; + std::string s = *i; uint32 accountId = GetAccountId(s); if (!accountId) @@ -928,16 +928,16 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m do { Field* fields = results->Fetch(); - string charName = fields[0].GetString(); + std::string charName = fields[0].GetString(); bots.insert(charName); } while (results->NextRow()); } } - for (set::iterator i = bots.begin(); i != bots.end(); ++i) + for (std::set::iterator i = bots.begin(); i != bots.end(); ++i) { - string bot = *i; - ostringstream out; + std::string bot = *i; + std::ostringstream out; out << cmdStr << ": " << bot << " - "; ObjectGuid member = sObjectMgr.GetPlayerGuidByName(bot); @@ -964,7 +964,7 @@ list PlayerbotHolder::HandlePlayerbotCommand(char const* args, Player* m return messages; } -uint32 PlayerbotHolder::GetAccountId(string name) +uint32 PlayerbotHolder::GetAccountId(std::string name) { uint32 accountId = 0; @@ -978,10 +978,10 @@ uint32 PlayerbotHolder::GetAccountId(string name) return accountId; } -string PlayerbotHolder::ListBots(Player* master) +std::string PlayerbotHolder::ListBots(Player* master) { - set bots; - map classNames; + std::set bots; + std::map classNames; classNames[CLASS_DRUID] = "Druid"; classNames[CLASS_HUNTER] = "Hunter"; classNames[CLASS_MAGE] = "Mage"; @@ -995,14 +995,14 @@ string PlayerbotHolder::ListBots(Player* master) classNames[CLASS_DEATH_KNIGHT] = "DeathKnight"; #endif - map online; - list names; - map classes; + std::map online; + std::list names; + std::map classes; for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it) { Player* const bot = it->second; - string name = bot->GetName(); + std::string name = bot->GetName(); bots.insert(name); names.push_back(name); @@ -1020,7 +1020,7 @@ string PlayerbotHolder::ListBots(Player* master) { Field* fields = results->Fetch(); uint8 cls = fields[0].GetUInt8(); - string name = fields[1].GetString(); + std::string name = fields[1].GetString(); if (bots.find(name) == bots.end() && name != master->GetSession()->GetPlayerName()) { names.push_back(name); @@ -1042,7 +1042,7 @@ string PlayerbotHolder::ListBots(Player* master) Player *member = sObjectMgr.GetPlayer(itr->guid); if (member && sRandomPlayerbotMgr.IsFreeBot(member)) { - string name = member->GetName(); + std::string name = member->GetName(); names.push_back(name); online[name] = "+"; @@ -1051,13 +1051,13 @@ string PlayerbotHolder::ListBots(Player* master) } } - ostringstream out; + std::ostringstream out; bool first = true; out << "Bot roster: "; - for (list::iterator i = names.begin(); i != names.end(); ++i) + for (std::list::iterator i = names.begin(); i != names.end(); ++i) { if (first) first = false; else out << ", "; - string name = *i; + std::string name = *i; out << online[name] << name << " " << classes[name]; } @@ -1079,7 +1079,7 @@ void PlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool minimal) CheckTellErrors(elapsed); } -void PlayerbotMgr::HandleCommand(uint32 type, const string& text, uint32 lang) +void PlayerbotMgr::HandleCommand(uint32 type, const std::string& text, uint32 lang) { Player *master = GetMaster(); if (!master) @@ -1088,11 +1088,11 @@ void PlayerbotMgr::HandleCommand(uint32 type, const string& text, uint32 lang) if (!sPlayerbotAIConfig.enabled) return; - if (text.find(sPlayerbotAIConfig.commandSeparator) != string::npos) + if (text.find(sPlayerbotAIConfig.commandSeparator) != std::string::npos) { - vector commands; + std::vector commands; split(commands, text, sPlayerbotAIConfig.commandSeparator.c_str()); - for (vector::iterator i = commands.begin(); i != commands.end(); ++i) + for (std::vector::iterator i = commands.begin(); i != commands.end(); ++i) { HandleCommand(type, *i,lang); } @@ -1233,7 +1233,7 @@ void PlayerbotMgr::OnPlayerLogin(Player* player) accountId); if (results) { - ostringstream out; out << "add "; + std::ostringstream out; out << "add "; bool first = true; do { @@ -1246,9 +1246,9 @@ void PlayerbotMgr::OnPlayerLogin(Player* player) } } -void PlayerbotMgr::TellError(string botName, string text) +void PlayerbotMgr::TellError(std::string botName, std::string text) { - set names = errors[text]; + std::set names = errors[text]; if (names.find(botName) == names.end()) { names.insert(botName); @@ -1266,12 +1266,12 @@ void PlayerbotMgr::CheckTellErrors(uint32 elapsed) for (PlayerBotErrorMap::iterator i = errors.begin(); i != errors.end(); ++i) { - string text = i->first; - set names = i->second; + std::string text = i->first; + std::set names = i->second; - ostringstream out; + std::ostringstream out; bool first = true; - for (set::iterator j = names.begin(); j != names.end(); ++j) + for (std::set::iterator j = names.begin(); j != names.end(); ++j) { if (!first) out << ", "; else first = false; out << *j; diff --git a/playerbot/PlayerbotMgr.h b/playerbot/PlayerbotMgr.h index f29f7265..25a670ee 100644 --- a/playerbot/PlayerbotMgr.h +++ b/playerbot/PlayerbotMgr.h @@ -11,8 +11,8 @@ class Unit; class Object; class Item; -typedef map PlayerBotMap; -typedef map > PlayerBotErrorMap; +typedef std::map PlayerBotMap; +typedef std::map > PlayerBotErrorMap; class PlayerbotHolder : public PlayerbotAIBase { @@ -36,10 +36,10 @@ class PlayerbotHolder : public PlayerbotAIBase void OnBotLogin(Player* bot); void MovePlayerBot(uint32 guid, PlayerbotHolder* newHolder) { auto botptr = playerBots.find(guid); if (botptr == playerBots.end()) return; newHolder->OnBotLogin(botptr->second); playerBots.erase(guid); } - list HandlePlayerbotCommand(char const* args, Player* master = NULL); - string ProcessBotCommand(string cmd, ObjectGuid guid, ObjectGuid masterguid, bool admin, uint32 masterAccountId, uint32 masterGuildId); - uint32 GetAccountId(string name); - string ListBots(Player* master); + std::list HandlePlayerbotCommand(char const* args, Player* master = NULL); + std::string ProcessBotCommand(std::string cmd, ObjectGuid guid, ObjectGuid masterguid, bool admin, uint32 masterAccountId, uint32 masterGuildId); + uint32 GetAccountId(std::string name); + std::string ListBots(Player* master); protected: virtual void OnBotLoginInternal(Player * const bot) = 0; @@ -57,12 +57,12 @@ class PlayerbotMgr : public PlayerbotHolder static bool HandlePlayerbotMgrCommand(ChatHandler* handler, char const* args); void HandleMasterIncomingPacket(const WorldPacket& packet); void HandleMasterOutgoingPacket(const WorldPacket& packet); - void HandleCommand(uint32 type, const string& text, uint32 lang = LANG_UNIVERSAL); + void HandleCommand(uint32 type, const std::string& text, uint32 lang = LANG_UNIVERSAL); void OnPlayerLogin(Player* player); void CancelLogout(); virtual void UpdateAIInternal(uint32 elapsed, bool minimal = false); - void TellError(string botName, string text); + void TellError(std::string botName, std::string text); Player* GetMaster() const { return master; }; diff --git a/playerbot/PlayerbotSecurity.cpp b/playerbot/PlayerbotSecurity.cpp index 53d19ee7..16dc9dec 100644 --- a/playerbot/PlayerbotSecurity.cpp +++ b/playerbot/PlayerbotSecurity.cpp @@ -170,7 +170,7 @@ bool PlayerbotSecurity::CheckLevelFor(PlayerbotSecurityLevel level, bool silent, if (master && bot->GetPlayerbotAI() && bot->GetPlayerbotAI()->IsOpposing(master) && master->GetSession()->GetSecurity() < SEC_GAMEMASTER) return false; - ostringstream out; + std::ostringstream out; switch (realLevel) { case PlayerbotSecurityLevel::PLAYERBOT_SECURITY_DENY_ALL: @@ -255,7 +255,7 @@ bool PlayerbotSecurity::CheckLevelFor(PlayerbotSecurityLevel level, bool silent, break; } - string text = out.str(); + std::string text = out.str(); uint64 guid = from->GetObjectGuid().GetRawValue(); time_t lastSaid = whispers[guid][text]; if (!lastSaid || (time(0) - lastSaid) >= sPlayerbotAIConfig.repeatDelay / 1000) diff --git a/playerbot/PlayerbotSecurity.h b/playerbot/PlayerbotSecurity.h index 2be08500..ddb50cd1 100644 --- a/playerbot/PlayerbotSecurity.h +++ b/playerbot/PlayerbotSecurity.h @@ -1,8 +1,6 @@ #ifndef _PlayerbotSecurity_H #define _PlayerbotSecurity_H -using namespace std; - enum class PlayerbotSecurityLevel : uint8 { PLAYERBOT_SECURITY_DENY_ALL = 0, @@ -41,7 +39,7 @@ class PlayerbotSecurity private: Player* const bot; uint32 account; - map > whispers; + std::map > whispers; }; #endif diff --git a/playerbot/PlayerbotTextMgr.cpp b/playerbot/PlayerbotTextMgr.cpp index b11c4686..9293d774 100644 --- a/playerbot/PlayerbotTextMgr.cpp +++ b/playerbot/PlayerbotTextMgr.cpp @@ -40,7 +40,7 @@ void PlayerbotTextMgr::LoadBotTexts() std::string text; std::map text_locale; Field* fields = results->Fetch(); - string name = fields[0].GetString(); + std::string name = fields[0].GetString(); text = fields[1].GetString(); uint32 sayType = fields[2].GetUInt32(); uint32 replyType = fields[3].GetUInt32(); @@ -65,7 +65,7 @@ void PlayerbotTextMgr::LoadBotTextChance() do { Field* fields = results->Fetch(); - string name = fields[0].GetString(); + std::string name = fields[0].GetString(); uint32 probability = fields[1].GetUInt32(); botTextChance[name] = probability; @@ -76,7 +76,7 @@ void PlayerbotTextMgr::LoadBotTextChance() // general texts -string PlayerbotTextMgr::GetBotText(string name) +std::string PlayerbotTextMgr::GetBotText(std::string name) { if (botTexts.empty()) { @@ -89,7 +89,7 @@ string PlayerbotTextMgr::GetBotText(string name) return ""; } - vector& list = botTexts[name]; + std::vector& list = botTexts[name]; BotTextEntry textEntry = list[urand(0, list.size() - 1)]; int32 localePrio = GetLocalePriority(); if (localePrio == -1) @@ -103,13 +103,13 @@ string PlayerbotTextMgr::GetBotText(string name) } } -string PlayerbotTextMgr::GetBotText(string name, map placeholders) +std::string PlayerbotTextMgr::GetBotText(std::string name, std::map placeholders) { - string botText = GetBotText(name); + std::string botText = GetBotText(name); if (botText.empty()) botText = name; - for (map::iterator i = placeholders.begin(); i != placeholders.end(); ++i) + for (std::map::iterator i = placeholders.begin(); i != placeholders.end(); ++i) replaceAll(botText, i->first, i->second); return botText; @@ -117,7 +117,7 @@ string PlayerbotTextMgr::GetBotText(string name, map placeholder // chat replies -string PlayerbotTextMgr::GetBotText(ChatReplyType replyType, map placeholders) +std::string PlayerbotTextMgr::GetBotText(ChatReplyType replyType, std::map placeholders) { if (botTexts.empty()) { @@ -130,8 +130,8 @@ string PlayerbotTextMgr::GetBotText(ChatReplyType replyType, map return ""; } - vector& list = botTexts["reply"]; - vector proper_list; + std::vector& list = botTexts["reply"]; + std::vector proper_list; for (auto text : list) { if (text.m_replyType == replyType) @@ -151,15 +151,15 @@ string PlayerbotTextMgr::GetBotText(ChatReplyType replyType, map botText = textEntry.m_text; } - for (map::iterator i = placeholders.begin(); i != placeholders.end(); ++i) + for (std::map::iterator i = placeholders.begin(); i != placeholders.end(); ++i) replaceAll(botText, i->first, i->second); return botText; } -string PlayerbotTextMgr::GetBotText(ChatReplyType replyType, string name) +std::string PlayerbotTextMgr::GetBotText(ChatReplyType replyType, std::string name) { - map placeholders; + std::map placeholders; placeholders["%s"] = name; return GetBotText(replyType, placeholders); @@ -167,7 +167,7 @@ string PlayerbotTextMgr::GetBotText(ChatReplyType replyType, string name) // probabilities -bool PlayerbotTextMgr::rollTextChance(string name) +bool PlayerbotTextMgr::rollTextChance(std::string name) { if (!botTextChance[name]) return true; @@ -175,7 +175,7 @@ bool PlayerbotTextMgr::rollTextChance(string name) return urand(0, 100) < botTextChance[name]; } -bool PlayerbotTextMgr::GetBotText(string name, string &text) +bool PlayerbotTextMgr::GetBotText(std::string name, std::string &text) { if (!rollTextChance(name)) return false; @@ -184,7 +184,7 @@ bool PlayerbotTextMgr::GetBotText(string name, string &text) return !text.empty(); } -bool PlayerbotTextMgr::GetBotText(string name, string& text, map placeholders) +bool PlayerbotTextMgr::GetBotText(std::string name, std::string& text, std::map placeholders) { if (!rollTextChance(name)) return false; diff --git a/playerbot/PlayerbotTextMgr.h b/playerbot/PlayerbotTextMgr.h index fdb18141..91aa10fc 100644 --- a/playerbot/PlayerbotTextMgr.h +++ b/playerbot/PlayerbotTextMgr.h @@ -7,8 +7,6 @@ #define BOT_TEXT(name) sPlayerbotTextMgr.GetBotText(name) #define BOT_TEXT2(name, replace) sPlayerbotTextMgr.GetBotText(name, replace) -using namespace std; - struct BotTextEntry { BotTextEntry(std::string name, std::string text, std::map text_locales, uint32 say_type, uint32 reply_type) : m_name(name), m_text(text), m_text_locales(text_locales), m_sayType(say_type), m_replyType(reply_type) {} @@ -61,25 +59,25 @@ class PlayerbotTextMgr } public: - string GetBotText(string name, map placeholders); - string GetBotText(string name); - string GetBotText(ChatReplyType replyType, map placeholders); - string GetBotText(ChatReplyType replyType, string name); - bool GetBotText(string name, string& text); - bool GetBotText(string name, string& text, map placeholders); + std::string GetBotText(std::string name, std::map placeholders); + std::string GetBotText(std::string name); + std::string GetBotText(ChatReplyType replyType, std::map placeholders); + std::string GetBotText(ChatReplyType replyType, std::string name); + bool GetBotText(std::string name, std::string& text); + bool GetBotText(std::string name, std::string& text, std::map placeholders); void LoadBotTexts(); void LoadBotTextChance(); void replaceAll(std::string& str, const std::string& from, const std::string& to); - bool rollTextChance(string text); + bool rollTextChance(std::string text); int32 GetLocalePriority(); void AddLocalePriority(int32 locale); void ResetLocalePriority(); private: - map> botTexts; - map botTextChance; + std::map> botTexts; + std::map botTextChance; uint32 botTextLocalePriority[MAX_LOCALE]; }; diff --git a/playerbot/RandomItemMgr.cpp b/playerbot/RandomItemMgr.cpp index 53949239..f09fb901 100644 --- a/playerbot/RandomItemMgr.cpp +++ b/playerbot/RandomItemMgr.cpp @@ -150,7 +150,7 @@ void RandomItemMgr::InitAfterAhBot() RandomItemMgr::~RandomItemMgr() { - for (map::iterator i = predicates.begin(); i != predicates.end(); ++i) + for (std::map::iterator i = predicates.begin(); i != predicates.end(); ++i) delete i->second; predicates.clear(); @@ -298,7 +298,7 @@ bool RandomItemMgr::CanEquipItem(BotEquipKey key, ItemPrototype const* proto) if (proto->Class == ITEM_CLASS_CONTAINER) return true; - set slots = viableSlots[(EquipmentSlots)key.slot]; + std::set slots = viableSlots[(EquipmentSlots)key.slot]; if (slots.find((InventoryType)proto->InventoryType) == slots.end()) return false; @@ -359,9 +359,9 @@ bool RandomItemMgr::CanEquipItemNew(ItemPrototype const* proto) return false; bool properSlot = false; - for (map >::iterator i = viableSlots.begin(); i != viableSlots.end(); ++i) + for (std::map >::iterator i = viableSlots.begin(); i != viableSlots.end(); ++i) { - set slots = viableSlots[(EquipmentSlots)i->first]; + std::set slots = viableSlots[(EquipmentSlots)i->first]; if (slots.find((InventoryType)proto->InventoryType) != slots.end()) properSlot = true; } @@ -591,9 +591,9 @@ bool RandomItemMgr::ShouldEquipWeaponForSpec(uint8 playerclass, uint8 spec, Item EquipmentSlots slot_mh = EQUIPMENT_SLOT_START; EquipmentSlots slot_oh = EQUIPMENT_SLOT_START; EquipmentSlots slot_rh = EQUIPMENT_SLOT_START; - for (map >::iterator i = viableSlots.begin(); i != viableSlots.end(); ++i) + for (std::map >::iterator i = viableSlots.begin(); i != viableSlots.end(); ++i) { - set slots = viableSlots[(EquipmentSlots)i->first]; + std::set slots = viableSlots[(EquipmentSlots)i->first]; if (slots.find((InventoryType)proto->InventoryType) != slots.end()) { if (i->first == EQUIPMENT_SLOT_MAINHAND) @@ -890,7 +890,7 @@ void RandomItemMgr::BuildItemInfoCache() { Field* fields = results->Fetch(); uint32 id = fields[0].GetUInt32(); - string name = fields[1].GetString(); + std::string name = fields[1].GetString(); uint32 clazz = fields[2].GetUInt32(); WeightScale scale; @@ -911,7 +911,7 @@ void RandomItemMgr::BuildItemInfoCache() { Field* fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); - string field = fields[1].GetString(); + std::string field = fields[1].GetString(); uint32 weight = fields[2].GetUInt32(); WeightScaleStat stat; @@ -981,7 +981,7 @@ void RandomItemMgr::BuildItemInfoCache() if (lTemplateA) for (LootStoreItem const& lItem : lTemplateA->Entries) - dropMap->insert(make_pair(lItem.itemid, sEntry)); + dropMap->insert(std::make_pair(lItem.itemid, sEntry)); } for (uint32 entry = 0; entry < sGOStorage.GetMaxEntry(); entry++) @@ -992,7 +992,7 @@ void RandomItemMgr::BuildItemInfoCache() if (lTemplateA) for (LootStoreItem const& lItem : lTemplateA->Entries) - dropMap->insert(make_pair(lItem.itemid, -sEntry)); + dropMap->insert(std::make_pair(lItem.itemid, -sEntry)); } sLog.outString("Loaded %d loot templates...", dropMap->size()); @@ -1067,9 +1067,9 @@ void RandomItemMgr::BuildItemInfoCache() // check possible equip slots EquipmentSlots slot = EQUIPMENT_SLOT_END; - for (map >::iterator i = viableSlots.begin(); i != viableSlots.end(); ++i) + for (std::map >::iterator i = viableSlots.begin(); i != viableSlots.end(); ++i) { - set slots = viableSlots[(EquipmentSlots)i->first]; + std::set slots = viableSlots[(EquipmentSlots)i->first]; if (slots.find((InventoryType)proto->InventoryType) != slots.end()) slot = i->first; } @@ -1151,12 +1151,12 @@ void RandomItemMgr::BuildItemInfoCache() // check quests if (cacheInfo->source == ITEM_SOURCE_NONE || cacheInfo->source == ITEM_SOURCE_PVP) { - vector questIds = GetQuestIdsForItem(proto->ItemId); + std::vector questIds = GetQuestIdsForItem(proto->ItemId); if (questIds.size()) { bool isAlly = false; bool isHorde = false; - for (vector::iterator i = questIds.begin(); i != questIds.end(); ++i) + for (std::vector::iterator i = questIds.begin(); i != questIds.end(); ++i) { Quest const* quest = sObjectMgr.GetQuestTemplate(*i); if (quest) @@ -1224,7 +1224,7 @@ void RandomItemMgr::BuildItemInfoCache() // check vendors if (cacheInfo->source == ITEM_SOURCE_NONE) { - for (vector::iterator i = vendorItems.begin(); i != vendorItems.end(); ++i) + for (std::vector::iterator i = vendorItems.begin(); i != vendorItems.end(); ++i) { if (proto->ItemId == *i) { @@ -1236,8 +1236,8 @@ void RandomItemMgr::BuildItemInfoCache() } // check drops - list creatures; - list gameobjects; + std::list creatures; + std::list gameobjects; auto range = dropMap->equal_range(itemId); @@ -1510,7 +1510,7 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemPro { uint32 statType = 0; int32 val = 0; - string weightName = ""; + std::string weightName = ""; //if (j >= proto->StatsCount) // continue; @@ -1521,7 +1521,7 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemPro if (val == 0) continue; - for (map::iterator i = weightStatLink.begin(); i != weightStatLink.end(); ++i) + for (std::map::iterator i = weightStatLink.begin(); i != weightStatLink.end(); ++i) { uint32 modd = i->second; if (modd == statType) @@ -1756,8 +1756,8 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemPro { hasAP = true; isAttackItem = true; - string SpellName = spellproto->SpellName[0]; - if (SpellName.find("Attack Power - Feral") != string::npos) + std::string SpellName = spellproto->SpellName[0]; + if (SpellName.find("Attack Power - Feral") != std::string::npos) isFeral = true; #ifdef MANGOSBOT_ZERO if (!isWhitelist && isFeral && (playerclass != CLASS_DRUID && playerclass != CLASS_WARRIOR && playerclass != CLASS_PALADIN && proto->IsWeapon())) @@ -1855,9 +1855,9 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemPro if (spellproto->EffectMiscValue[0] & (1 << rating)) { int32 val = spellproto->EffectBasePoints[j] + 1; - string weightName; + std::string weightName; - for (map::iterator i = weightRatingLink.begin(); i != weightRatingLink.end(); ++i) + for (std::map::iterator i = weightRatingLink.begin(); i != weightRatingLink.end(); ++i) { uint32 modd = i->second; if (modd == rating) @@ -2053,7 +2053,7 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemPro return 0; bool playerCaster = false; - for (vector::iterator i = m_weightScales[spec].stats.begin(); i != m_weightScales[spec].stats.end(); ++i) + for (std::vector::iterator i = m_weightScales[spec].stats.begin(); i != m_weightScales[spec].stats.end(); ++i) { if (i->stat == "splpwr" || i->stat == "int" || i->stat == "manargn" || i->stat == "splheal" || i->stat == "spellcritstrkrtng" || i->stat == "spellhitrtng") { @@ -2072,7 +2072,7 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemPro return 0; bool playerAttacker = false; - for (vector::iterator i = m_weightScales[spec].stats.begin(); i != m_weightScales[spec].stats.end(); ++i) + for (std::vector::iterator i = m_weightScales[spec].stats.begin(); i != m_weightScales[spec].stats.end(); ++i) { if (i->stat == "str" || i->stat == "agi" || i->stat == "atkpwr" || i->stat == "mledps" || i->stat == "rgddps" || i->stat == "hitrtng" || i->stat == "critstrkrtng") { @@ -2306,7 +2306,7 @@ uint32 RandomItemMgr::CalculateSocketWeight(uint8 playerclass, ItemQualifier& qu return 0; #else - vector gems = { qualifier.GetGem1() , qualifier.GetGem2(), qualifier.GetGem3(), qualifier.GetGem4() }; + std::vector gems = { qualifier.GetGem1() , qualifier.GetGem2(), qualifier.GetGem3(), qualifier.GetGem4() }; ItemPrototype const* proto = qualifier.GetProto(); @@ -2390,7 +2390,7 @@ uint32 RandomItemMgr::ItemStatWeight(Player* player, Item* item) uint32 RandomItemMgr::CalculateSingleStatWeight(uint8 playerclass, uint8 spec, std::string stat, uint32 value) { uint32 statWeight = 0; - for (vector::iterator i = m_weightScales[spec].stats.begin(); i != m_weightScales[spec].stats.end(); ++i) + for (std::vector::iterator i = m_weightScales[spec].stats.begin(); i != m_weightScales[spec].stats.end(); ++i) { if (stat == i->stat) { @@ -2451,9 +2451,9 @@ uint32 RandomItemMgr::GetQuestIdForItem(uint32 itemId) return questId; } -vector RandomItemMgr::GetQuestIdsForItem(uint32 itemId) +std::vector RandomItemMgr::GetQuestIdsForItem(uint32 itemId) { - vector questIds; + std::vector questIds; ObjectMgr::QuestMap const& questTemplates = sObjectMgr.GetQuestTemplates(); for (ObjectMgr::QuestMap::const_iterator i = questTemplates.begin(); i != questTemplates.end(); ++i) { @@ -2614,7 +2614,7 @@ uint32 RandomItemMgr::GetUpgrade(Player* player, std::string spec, uint8 slot, u uint32 specId = 0; uint32 closestUpgrade = 0; uint32 closestUpgradeWeight = 0; - vector classspecs; + std::vector classspecs; for (uint32 specNum = 1; specNum < 5; ++specNum) { @@ -2639,7 +2639,7 @@ uint32 RandomItemMgr::GetUpgrade(Player* player, std::string spec, uint8 slot, u sLog.outString("Old item has no stat weight"); } - for (map::iterator i = itemInfoCache.begin(); i != itemInfoCache.end(); ++i) + for (std::map::iterator i = itemInfoCache.begin(); i != itemInfoCache.end(); ++i) { ItemInfoEntry* info = i->second; if (!info) @@ -2696,7 +2696,7 @@ uint32 RandomItemMgr::GetUpgrade(Player* player, std::string spec, uint8 slot, u // check if item stat score is the best among class specs uint32 bestSpecId = 0; uint32 bestSpecScore = 0; - for (vector::iterator i = classspecs.begin(); i != classspecs.end(); ++i) + for (std::vector::iterator i = classspecs.begin(); i != classspecs.end(); ++i) { if (info->weights[*i] > bestSpecScore) { @@ -2728,9 +2728,9 @@ uint32 RandomItemMgr::GetUpgrade(Player* player, std::string spec, uint8 slot, u return closestUpgrade; } -vector RandomItemMgr::GetUpgradeList(Player* player, uint32 specId, uint8 slot, uint32 quality, uint32 itemId, uint32 amount) +std::vector RandomItemMgr::GetUpgradeList(Player* player, uint32 specId, uint8 slot, uint32 quality, uint32 itemId, uint32 amount) { - vector listItems; + std::vector listItems; if (!player) return listItems; @@ -2738,7 +2738,7 @@ vector RandomItemMgr::GetUpgradeList(Player* player, uint32 specId, uint uint32 oldStatWeight = 0; uint32 closestUpgrade = 0; uint32 closestUpgradeWeight = 0; - vector classspecs; + std::vector classspecs; if (itemId && itemInfoCache[itemId]) { @@ -2750,7 +2750,7 @@ vector RandomItemMgr::GetUpgradeList(Player* player, uint32 specId, uint sLog.outString("Old item has no stat weight"); } - for (map::iterator i = itemInfoCache.begin(); i != itemInfoCache.end(); ++i) + for (std::map::iterator i = itemInfoCache.begin(); i != itemInfoCache.end(); ++i) { ItemInfoEntry* info = i->second; if (!info) @@ -2821,7 +2821,7 @@ vector RandomItemMgr::GetUpgradeList(Player* player, uint32 specId, uint // // check if item stat score is the best among class specs // uint32 bestSpecId = 0; // uint32 bestSpecScore = 0; - // for (vector::iterator i = classspecs.begin(); i != classspecs.end(); ++i) + // for (std::vector::iterator i = classspecs.begin(); i != classspecs.end(); ++i) // { // if (info->weights[*i] > bestSpecScore) // { @@ -2849,7 +2849,7 @@ vector RandomItemMgr::GetUpgradeList(Player* player, uint32 specId, uint sLog.outString("New Items: %d, Old item:%d, New items max: %d", listItems.size(), oldStatWeight, closestUpgradeWeight); // sort by stat weight - sort(listItems.begin(), listItems.end(), [specId](int a, int b) { return sRandomItemMgr.GetStatWeight(a, specId) <= sRandomItemMgr.GetStatWeight(b, specId); }); + std::sort(listItems.begin(), listItems.end(), [specId](int a, int b) { return sRandomItemMgr.GetStatWeight(a, specId) <= sRandomItemMgr.GetStatWeight(b, specId); }); return listItems; } @@ -2878,7 +2878,7 @@ uint32 RandomItemMgr::GetStatWeight(Player* player, uint32 itemId) uint32 statWeight = 0; uint32 specId = GetPlayerSpecId(player); - vector classspecs; + std::vector classspecs; if (specId == 0) return 0; @@ -2886,7 +2886,7 @@ uint32 RandomItemMgr::GetStatWeight(Player* player, uint32 itemId) if (!m_weightScales[specId].info.id) return 0; - map::iterator itr = itemInfoCache.find(itemId); + std::map::iterator itr = itemInfoCache.find(itemId); if (itr != itemInfoCache.end()) { statWeight = itr->second->weights[specId]; @@ -2904,12 +2904,12 @@ uint32 RandomItemMgr::GetStatWeight(uint32 itemId, uint32 specId) return 0; uint32 statWeight = 0; - vector classspecs; + std::vector classspecs; if (!m_weightScales[specId].info.id) return 0; - map::iterator itr = itemInfoCache.find(itemId); + std::map::iterator itr = itemInfoCache.find(itemId); if (itr != itemInfoCache.end()) { statWeight = itr->second->weights[specId]; @@ -3150,7 +3150,7 @@ void RandomItemMgr::BuildEquipCache() if ((slot == EQUIPMENT_SLOT_BODY || slot == EQUIPMENT_SLOT_TABARD)) { - set slots = viableSlots[(EquipmentSlots)key.slot]; + std::set slots = viableSlots[(EquipmentSlots)key.slot]; if (slots.find((InventoryType)proto->InventoryType) == slots.end()) continue; @@ -3425,14 +3425,14 @@ void RandomItemMgr::BuildFoodCache() uint32 RandomItemMgr::GetRandomPotion(uint32 level, uint32 effect) { - vector potions = potionCache[(level - 1) / 10][effect]; + std::vector potions = potionCache[(level - 1) / 10][effect]; if (potions.empty()) return 0; return potions[urand(0, potions.size() - 1)]; } uint32 RandomItemMgr::GetFood(uint32 level, uint32 category) { - vector items; + std::vector items; if (category == 11) { if (level < 5) @@ -3507,7 +3507,7 @@ uint32 RandomItemMgr::GetFood(uint32 level, uint32 category) uint32 RandomItemMgr::GetRandomFood(uint32 level, uint32 category) { - vector food = foodCache[(level - 1) / 10][category]; + std::vector food = foodCache[(level - 1) / 10][category]; if (food.empty()) return 0; return food[urand(0, food.size() - 1)]; } @@ -3555,14 +3555,14 @@ void RandomItemMgr::BuildTradeCache() uint32 RandomItemMgr::GetRandomTrade(uint32 level) { - vector trade = tradeCache[(level - 1) / 10]; + std::vector trade = tradeCache[(level - 1) / 10]; if (trade.empty()) return 0; return trade[urand(0, trade.size() - 1)]; } -vector RandomItemMgr::GetGemsList() +std::vector RandomItemMgr::GetGemsList() { - vector_gems; + std::vector_gems; #ifndef MANGOSBOT_ZERO if (_gems.empty()) diff --git a/playerbot/RandomItemMgr.h b/playerbot/RandomItemMgr.h index b01cb3ef..3a9d0b3a 100644 --- a/playerbot/RandomItemMgr.h +++ b/playerbot/RandomItemMgr.h @@ -12,8 +12,6 @@ #endif #include "strategy/values/ItemUsageValue.h" -using namespace std; - enum RandomItemType { RANDOM_ITEM_GUILD_TASK, @@ -48,13 +46,13 @@ enum ItemSpecType struct WeightScaleInfo { uint32 id; - string name; + std::string name; uint8 classId; }; struct WeightScaleStat { - string stat; + std::string stat; uint32 weight; }; @@ -69,7 +67,7 @@ struct ItemInfoEntry itemSpec = ITEM_SPEC_NONE; } - map weights; + std::map weights; uint32 minLevel; uint32 itemLevel; uint32 source; @@ -86,8 +84,8 @@ struct ItemInfoEntry ItemSpecType itemSpec; }; -typedef vector WeightScaleStats; -//typedef map WeightScaleList; +typedef std::vector WeightScaleStats; +//typedef std::map WeightScaleList; struct WeightScale { @@ -95,7 +93,7 @@ struct WeightScale WeightScaleStats stats; }; -//typedef map WeightScales; +//typedef std::map WeightScales; class RandomItemPredicate { @@ -104,8 +102,8 @@ class RandomItemPredicate virtual bool Apply(ItemPrototype const* proto) = 0; }; -typedef vector RandomItemList; -typedef map RandomItemCache; +typedef std::vector RandomItemList; +typedef std::map RandomItemCache; class BotEquipKey { @@ -132,7 +130,7 @@ class BotEquipKey } }; -typedef map BotEquipCache; +typedef std::map BotEquipCache; class RandomItemMgr { @@ -152,7 +150,7 @@ class RandomItemMgr RandomItemList Query(uint32 level, RandomItemType type, RandomItemPredicate* predicate); RandomItemList Query(uint32 level, uint8 clazz, uint8 specId, uint8 slot, uint32 quality); uint32 GetUpgrade(Player* player, std::string spec, uint8 slot, uint32 quality, uint32 itemId); - vector GetUpgradeList(Player* player, uint32 specId, uint8 slot, uint32 quality, uint32 itemId, uint32 amount = 1); + std::vector GetUpgradeList(Player* player, uint32 specId, uint8 slot, uint32 quality, uint32 itemId, uint32 amount = 1); bool HasStatWeight(uint32 itemId); uint32 GetMinLevelFromCache(uint32 itemId); uint32 GetStatWeight(Player* player, uint32 itemId); @@ -164,7 +162,7 @@ class RandomItemMgr uint32 GetRandomFood(uint32 level, uint32 category); uint32 GetFood(uint32 level, uint32 category); uint32 GetRandomTrade(uint32 level); - vector GetGemsList(); + std::vector GetGemsList(); uint32 CalculateEnchantWeight(uint8 playerclass, uint8 spec, uint32 enchantId); uint32 CalculateRandomPropertyWeight(uint8 playerclass, uint8 spec, int32 randomPropertyId); @@ -183,7 +181,7 @@ class RandomItemMgr bool CheckItemSpec(uint8 spec, ItemSpecType itSpec); float GetItemRarity(uint32 itemId); uint32 GetQuestIdForItem(uint32 itemId); - vector GetQuestIdsForItem(uint32 itemId); + std::vector GetQuestIdsForItem(uint32 itemId); std::string GetPlayerSpecName(Player* player); uint32 GetPlayerSpecId(Player* player); @@ -202,20 +200,20 @@ class RandomItemMgr bool CheckItemStats(uint8 clazz, uint8 sp, uint8 ap, uint8 tank); private: - map randomItemCache; - map predicates; + std::map randomItemCache; + std::map predicates; BotEquipCache equipCache; - map > viableSlots; - map > ammoCache; - map > > potionCache; - map > > foodCache; - map > tradeCache; - map rarityCache; - map m_weightScales; - map weightStatLink; - map ItemStatLink; - map weightRatingLink; - map itemInfoCache; + std::map > viableSlots; + std::map > ammoCache; + std::map > > potionCache; + std::map > > foodCache; + std::map > tradeCache; + std::map rarityCache; + std::map m_weightScales; + std::map weightStatLink; + std::map ItemStatLink; + std::map weightRatingLink; + std::map itemInfoCache; }; #define sRandomItemMgr RandomItemMgr::instance() diff --git a/playerbot/RandomPlayerbotFactory.cpp b/playerbot/RandomPlayerbotFactory.cpp index 7136a7c9..268f3d7b 100644 --- a/playerbot/RandomPlayerbotFactory.cpp +++ b/playerbot/RandomPlayerbotFactory.cpp @@ -22,7 +22,7 @@ #endif -map > RandomPlayerbotFactory::availableRaces; +std::map > RandomPlayerbotFactory::availableRaces; RandomPlayerbotFactory::RandomPlayerbotFactory(uint32 accountId) : accountId(accountId) { @@ -182,7 +182,7 @@ uint8 RandomPlayerbotFactory::GetRandomRace(uint8 cls) return availableRaces[cls].front(); } -bool RandomPlayerbotFactory::CreateRandomBot(uint8 cls, unordered_map>& names) +bool RandomPlayerbotFactory::CreateRandomBot(uint8 cls, std::unordered_map>& names) { sLog.outDebug( "Creating new random bot for class %d", cls); @@ -190,7 +190,7 @@ bool RandomPlayerbotFactory::CreateRandomBot(uint8 cls, unordered_map skinColors, facialHairTypes; - vector> faces, hairs; + std::vector skinColors, facialHairTypes; + std::vector> faces, hairs; for (CharSectionsMap::const_iterator itr = sCharSectionMap.begin(); itr != sCharSectionMap.end(); ++itr) { CharSectionsEntry const* entry = itr->second; @@ -220,13 +220,13 @@ bool RandomPlayerbotFactory::CreateRandomBot(uint8 cls, unordered_mapColorIndex); break; case SECTION_TYPE_FACE: - faces.push_back(pair(entry->VariationIndex, entry->ColorIndex)); + faces.push_back(std::pair(entry->VariationIndex, entry->ColorIndex)); break; case SECTION_TYPE_FACIAL_HAIR: facialHairTypes.push_back(entry->ColorIndex); break; case SECTION_TYPE_HAIR: - hairs.push_back(pair(entry->VariationIndex, entry->ColorIndex)); + hairs.push_back(std::pair(entry->VariationIndex, entry->ColorIndex)); break; } #else @@ -236,21 +236,21 @@ bool RandomPlayerbotFactory::CreateRandomBot(uint8 cls, unordered_mapColor); break; case SECTION_TYPE_FACE: - faces.push_back(pair(entry->VariationIndex, entry->Color)); + faces.push_back(std::pair(entry->VariationIndex, entry->Color)); break; case SECTION_TYPE_FACIAL_HAIR: facialHairTypes.push_back(entry->Color); break; case SECTION_TYPE_HAIR: - hairs.push_back(pair(entry->VariationIndex, entry->Color)); + hairs.push_back(std::pair(entry->VariationIndex, entry->Color)); break; } #endif } uint8 skinColor = skinColors[urand(0, skinColors.size() - 1)]; - pair face = faces[urand(0, faces.size() - 1)]; - pair hair = hairs[urand(0, hairs.size() - 1)]; + std::pair face = faces[urand(0, faces.size() - 1)]; + std::pair hair = hairs[urand(0, hairs.size() - 1)]; bool excludeCheck = (race == RACE_TAUREN) || (gender == GENDER_FEMALE && race != RACE_NIGHTELF && race != RACE_UNDEAD); #ifndef MANGOSBOT_TWO @@ -309,7 +309,7 @@ bool RandomPlayerbotFactory::CreateRandomBot(uint8 cls, unordered_mapFetch(); - string bname = fields[0].GetString(); + std::string bname = fields[0].GetString(); return bname; } -inline string GetNamePostFix(int32 nr) +inline std::string GetNamePostFix(int32 nr) { - string ret; + std::string ret; - string str("abcdefghijklmnopqrstuvwxyz"); + std::string str("abcdefghijklmnopqrstuvwxyz"); while (nr >= 0) { @@ -377,8 +377,8 @@ void RandomPlayerbotFactory::CreateRandomBots() for (uint32 accountNumber = 0; accountNumber < sPlayerbotAIConfig.randomBotAccountCount; ++accountNumber) { - ostringstream out; out << sPlayerbotAIConfig.randomBotAccountPrefix << accountNumber; - string accountName = out.str(); + std::ostringstream out; out << sPlayerbotAIConfig.randomBotAccountPrefix << accountNumber; + std::string accountName = out.str(); auto result = LoginDatabase.PQuery("SELECT id FROM account where username = '%s'", accountName.c_str()); if (!result) @@ -471,20 +471,20 @@ void RandomPlayerbotFactory::CreateRandomBots() int totalAccCount = sPlayerbotAIConfig.randomBotAccountCount; sLog.outString("Creating random bot accounts..."); - vector> account_creations; + std::vector> account_creations; BarGoLink bar(totalAccCount); for (uint32 accountNumber = 0; accountNumber < sPlayerbotAIConfig.randomBotAccountCount; ++accountNumber) { - ostringstream out; out << sPlayerbotAIConfig.randomBotAccountPrefix << accountNumber; - string accountName = out.str(); + std::ostringstream out; out << sPlayerbotAIConfig.randomBotAccountPrefix << accountNumber; + std::string accountName = out.str(); auto results = LoginDatabase.PQuery("SELECT id FROM account where username = '%s'", accountName.c_str()); if (results) { continue; } - string password = ""; + std::string password = ""; if (sPlayerbotAIConfig.randomBotRandomPassword) { for (int i = 0; i < 10; i++) @@ -525,8 +525,8 @@ void RandomPlayerbotFactory::CreateRandomBots() sLog.outString("Loading available names..."); - unordered_map> freeNames, allNames; - unordered_map used; + std::unordered_map> freeNames, allNames; + std::unordered_map used; auto result = CharacterDatabase.PQuery("SELECT n.gender, n.name, e.guid FROM ai_playerbot_names n LEFT OUTER JOIN characters e ON e.name = n.name"); if (!result) @@ -539,7 +539,7 @@ void RandomPlayerbotFactory::CreateRandomBots() { Field* fields = result->Fetch(); uint8 gender = fields[0].GetUInt8(); - string bname = fields[1].GetString(); + std::string bname = fields[1].GetString(); uint32 guidlo = fields[2].GetUInt32(); if(!guidlo) freeNames[gender].push_back(bname); @@ -551,7 +551,7 @@ void RandomPlayerbotFactory::CreateRandomBots() { int32 postItt = 0; - vector newNames; + std::vector newNames; if (totalCharCount < freeNames[gender].size()) continue; @@ -562,14 +562,14 @@ void RandomPlayerbotFactory::CreateRandomBots() while(namesNeeded) { - string post = GetNamePostFix(postItt); + std::string post = GetNamePostFix(postItt); for (auto name : allNames[gender]) { if (name.size() + post.size() > 12) continue; - string newName = name + post; + std::string newName = name + post; if (used.find(newName) != used.end()) continue; @@ -591,8 +591,8 @@ void RandomPlayerbotFactory::CreateRandomBots() BarGoLink bar1(totalCharCount); for (uint32 accountNumber = 0; accountNumber < sPlayerbotAIConfig.randomBotAccountCount; ++accountNumber) { - ostringstream out; out << sPlayerbotAIConfig.randomBotAccountPrefix << accountNumber; - string accountName = out.str(); + std::ostringstream out; out << sPlayerbotAIConfig.randomBotAccountPrefix << accountNumber; + std::string accountName = out.str(); auto results = LoginDatabase.PQuery("SELECT id FROM account where username = '%s'", accountName.c_str()); if (!results) @@ -636,7 +636,7 @@ void RandomPlayerbotFactory::CreateRandomBots() totalRandomBotChars += sAccountMgr.GetCharactersCount(accountId); } - vector> bot_creations; + std::vector> bot_creations; BarGoLink bar2(sObjectAccessor.GetPlayers().size()); for (auto pl : sObjectAccessor.GetPlayers()) @@ -657,8 +657,8 @@ void RandomPlayerbotFactory::CreateRandomBots() void RandomPlayerbotFactory::CreateRandomGuilds() { - vector randomBots; - map> charAccGuids; + std::vector randomBots; + std::map> charAccGuids; auto charAccounts = CharacterDatabase.PQuery( "select `account`, `guid` from `characters`"); @@ -691,7 +691,7 @@ void RandomPlayerbotFactory::CreateRandomGuilds() { sLog.outString("Deleting random bot guilds..."); uint32 counter = 0; - for (vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) + for (std::vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) { ObjectGuid leader(HIGHGUID_PLAYER, *i); Guild* guild = sGuildMgr.GetGuildByLeader(leader); @@ -710,8 +710,8 @@ void RandomPlayerbotFactory::CreateRandomGuilds() return; uint32 guildNumber = 0; - vector availableLeaders; - for (vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) + std::vector availableLeaders; + for (std::vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) { ObjectGuid leader(HIGHGUID_PLAYER, *i); Guild* guild = sGuildMgr.GetGuildByLeader(leader); @@ -748,7 +748,7 @@ void RandomPlayerbotFactory::CreateRandomGuilds() if (sPlayerbotAIConfig.randomBotGuilds.size() >= sPlayerbotAIConfig.randomBotGuildCount) break; - string guildName = CreateRandomGuildName(); + std::string guildName = CreateRandomGuildName(); if (guildName.empty()) continue; @@ -786,7 +786,7 @@ void RandomPlayerbotFactory::CreateRandomGuilds() sLog.outString("Total Random Guilds: %d", sPlayerbotAIConfig.randomBotGuilds.size()); } -string RandomPlayerbotFactory::CreateRandomGuildName() +std::string RandomPlayerbotFactory::CreateRandomGuildName() { auto result = CharacterDatabase.Query("SELECT MAX(name_id) FROM ai_playerbot_guild_names"); if (!result) @@ -809,14 +809,14 @@ string RandomPlayerbotFactory::CreateRandomGuildName() } fields = result->Fetch(); - string gname = fields[0].GetString(); + std::string gname = fields[0].GetString(); return gname; } #ifndef MANGOSBOT_ZERO void RandomPlayerbotFactory::CreateRandomArenaTeams() { - vector randomBots; + std::vector randomBots; auto results = CharacterDatabase.PQuery( "select `bot` from ai_playerbot_random_bots where event = 'add'"); @@ -834,7 +834,7 @@ void RandomPlayerbotFactory::CreateRandomArenaTeams() if (sPlayerbotAIConfig.deleteRandomBotArenaTeams && !sRandomPlayerbotMgr.arenaTeamsDeleted) { sLog.outString("Deleting random bot arena teams..."); - for (vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) + for (std::vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) { ObjectGuid captain(HIGHGUID_PLAYER, *i); ArenaTeam* arenateam = sObjectMgr.GetArenaTeamByCaptain(captain); @@ -853,8 +853,8 @@ void RandomPlayerbotFactory::CreateRandomArenaTeams() maxTeamsNumber[ARENA_TYPE_2v2] = (uint32)(sPlayerbotAIConfig.randomBotArenaTeamCount * 0.4f); maxTeamsNumber[ARENA_TYPE_3v3] = (uint32)(sPlayerbotAIConfig.randomBotArenaTeamCount * 0.3f); maxTeamsNumber[ARENA_TYPE_5v5] = (uint32)(sPlayerbotAIConfig.randomBotArenaTeamCount * 0.3f); - vector availableCaptains; - for (vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) + std::vector availableCaptains; + for (std::vector::iterator i = randomBots.begin(); i != randomBots.end(); ++i) { ObjectGuid captain(HIGHGUID_PLAYER, *i); ArenaTeam* arenateam = sObjectMgr.GetArenaTeamByCaptain(captain); @@ -906,7 +906,7 @@ void RandomPlayerbotFactory::CreateRandomArenaTeams() break; } - string arenaTeamName = CreateRandomArenaTeamName(); + std::string arenaTeamName = CreateRandomArenaTeamName(); if (arenaTeamName.empty()) continue; @@ -1055,7 +1055,7 @@ string RandomPlayerbotFactory::CreateRandomArenaTeamName() } fields = result->Fetch(); - string aname = fields[0].GetString(); + std::string aname = fields[0].GetString(); return aname; } #endif diff --git a/playerbot/RandomPlayerbotFactory.h b/playerbot/RandomPlayerbotFactory.h index 59f2444b..4ca680f4 100644 --- a/playerbot/RandomPlayerbotFactory.h +++ b/playerbot/RandomPlayerbotFactory.h @@ -10,8 +10,6 @@ class Unit; class Object; class Item; -using namespace std; - class RandomPlayerbotFactory { public: @@ -19,21 +17,21 @@ class RandomPlayerbotFactory virtual ~RandomPlayerbotFactory() {} public: - bool CreateRandomBot(uint8 cls, unordered_map>& names); + bool CreateRandomBot(uint8 cls, std::unordered_map>& names); static void CreateRandomBots(); static void CreateRandomGuilds(); static void CreateRandomArenaTeams(); - static string CreateRandomGuildName(); + static std::string CreateRandomGuildName(); static bool isAvailableRace(uint8 cls, uint8 race); private: - string CreateRandomBotName(uint8 gender); - static string CreateRandomArenaTeamName(); + std::string CreateRandomBotName(uint8 gender); + static std::string CreateRandomArenaTeamName(); uint8 GetRandomClass(); uint8 GetRandomRace(uint8 cls); private: uint32 accountId; - static map > availableRaces; + static std::map > availableRaces; }; #endif diff --git a/playerbot/RandomPlayerbotMgr.cpp b/playerbot/RandomPlayerbotMgr.cpp index 93f2b391..383ee36b 100644 --- a/playerbot/RandomPlayerbotMgr.cpp +++ b/playerbot/RandomPlayerbotMgr.cpp @@ -294,7 +294,7 @@ RandomPlayerbotMgr::RandomPlayerbotMgr() guildsDeleted = false; arenaTeamsDeleted = false; - list availableBots = GetBots(); + std::list availableBots = GetBots(); for (auto& bot : availableBots) { @@ -341,8 +341,8 @@ int RandomPlayerbotMgr::GetMaxAllowedBotCount() return GetEventValue(0, "bot_count"); } -inline ostringstream print_path(Unit* bot, vector>& log, bool is_sqDist_greater_200 = false) { - ostringstream out; +inline std::ostringstream print_path(Unit* bot, std::vector>& log, bool is_sqDist_greater_200 = false) { + std::ostringstream out; out << bot->GetName() << ","; out << std::fixed << std::setprecision(1); out << "\"LINESTRING("; @@ -357,8 +357,8 @@ inline ostringstream print_path(Unit* bot, vector>& log, bool is_ } out << ")\","; out << bot->GetOrientation() << ","; - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; out << (is_sqDist_greater_200 ? "1" : "0"); return out; } @@ -378,15 +378,15 @@ void RandomPlayerbotMgr::LogPlayerLocation() Player* bot = i.second; if (!bot) continue; - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << "RND" << ","; out << bot->GetName() << ","; out << std::fixed << std::setprecision(2); WorldPosition(bot).printWKT(out); out << bot->GetOrientation() << ","; - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; out << bot->GetMapId() << ","; out << bot->GetLevel() << ","; out << bot->GetHealth() << ","; @@ -395,8 +395,8 @@ void RandomPlayerbotMgr::LogPlayerLocation() if (bot->GetPlayerbotAI()) { - out << to_string(uint8(bot->GetPlayerbotAI()->GetGrouperType())) << ","; - out << to_string(uint8(bot->GetPlayerbotAI()->GetGuilderType())) << ","; + out << std::to_string(uint8(bot->GetPlayerbotAI()->GetGrouperType())) << ","; + out << std::to_string(uint8(bot->GetPlayerbotAI()->GetGuilderType())) << ","; out << (bot->GetPlayerbotAI()->AllowActivity(ALL_ACTIVITY) ? "active" : "inactive") << ","; out << (bot->GetPlayerbotAI()->IsActive() ? "active" : "delay") << ","; out << bot->GetPlayerbotAI()->HandleRemoteCommand("state") << ","; @@ -419,7 +419,7 @@ void RandomPlayerbotMgr::LogPlayerLocation() { float sqDist = (playerBotMoveLog[i.first].empty() ? 1 : (pow(playerBotMoveLog[i.first].back().first - int32(WorldPosition(bot).getDisplayX()), 2) + pow(playerBotMoveLog[i.first].back().second - int32(WorldPosition(bot).getDisplayY()), 2))); if (sqDist <= 200 * 200) { - playerBotMoveLog[i.first].push_back(make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); + playerBotMoveLog[i.first].push_back(std::make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); if (playerBotMoveLog[i.first].size() > 100) { sPlayerbotAIConfig.log("player_paths.csv", print_path(bot, playerBotMoveLog[i.first]).str().c_str()); playerBotMoveLog[i.first].clear(); @@ -430,7 +430,7 @@ void RandomPlayerbotMgr::LogPlayerLocation() sPlayerbotAIConfig.log("player_paths.csv", print_path(bot, playerBotMoveLog[i.first]).str().c_str()); sPlayerbotAIConfig.log("player_paths.csv", print_path(bot, playerBotMoveLog[i.first], true).str().c_str()); playerBotMoveLog[i.first].clear(); - playerBotMoveLog[i.first].push_back(make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); + playerBotMoveLog[i.first].push_back(std::make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); } } } @@ -439,15 +439,15 @@ void RandomPlayerbotMgr::LogPlayerLocation() Player* bot = i.second; if (!bot) continue; - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << "PLR" << ","; out << bot->GetName() << ","; out << std::fixed << std::setprecision(2); WorldPosition(bot).printWKT(out); out << bot->GetOrientation() << ","; - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; out << bot->GetMapId() << ","; out << bot->GetLevel() << ","; out << bot->GetHealth() << ","; @@ -455,8 +455,8 @@ void RandomPlayerbotMgr::LogPlayerLocation() out << bot->GetMoney() << ","; if (bot->GetPlayerbotAI()) { - out << to_string(uint8(bot->GetPlayerbotAI()->GetGrouperType())) << ","; - out << to_string(uint8(bot->GetPlayerbotAI()->GetGuilderType())) << ","; + out << std::to_string(uint8(bot->GetPlayerbotAI()->GetGrouperType())) << ","; + out << std::to_string(uint8(bot->GetPlayerbotAI()->GetGuilderType())) << ","; out << (bot->GetPlayerbotAI()->AllowActivity(ALL_ACTIVITY) ? "active" : "inactive") << ","; out << (bot->GetPlayerbotAI()->IsActive() ? "active" : "delay") << ","; out << bot->GetPlayerbotAI()->HandleRemoteCommand("state") << ","; @@ -478,7 +478,7 @@ void RandomPlayerbotMgr::LogPlayerLocation() { float sqDist = (playerBotMoveLog[i.first].empty() ? 1 : (pow(playerBotMoveLog[i.first].back().first - int32(WorldPosition(bot).getDisplayX()), 2) + pow(playerBotMoveLog[i.first].back().second - int32(WorldPosition(bot).getDisplayY()), 2))); if (sqDist <= 200 * 200) { - playerBotMoveLog[i.first].push_back(make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); + playerBotMoveLog[i.first].push_back(std::make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); if (playerBotMoveLog[i.first].size() > 100) { sPlayerbotAIConfig.log("player_paths.csv", print_path(bot, playerBotMoveLog[i.first]).str().c_str()); playerBotMoveLog[i.first].clear(); @@ -489,7 +489,7 @@ void RandomPlayerbotMgr::LogPlayerLocation() sPlayerbotAIConfig.log("player_paths.csv", print_path(bot, playerBotMoveLog[i.first]).str().c_str()); sPlayerbotAIConfig.log("player_paths.csv", print_path(bot, playerBotMoveLog[i.first], true).str().c_str()); playerBotMoveLog[i.first].clear(); - playerBotMoveLog[i.first].push_back(make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); + playerBotMoveLog[i.first].push_back(std::make_pair(WorldPosition(bot).getDisplayX(), WorldPosition(bot).getDisplayY())); } } } @@ -545,7 +545,7 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool minimal) urand(sPlayerbotAIConfig.randomBotCountChangeMinInterval, sPlayerbotAIConfig.randomBotCountChangeMaxInterval)); } - list availableBots = GetBots(); + std::list availableBots = GetBots(); uint32 availableBotCount = availableBots.size(); uint32 onlineBotCount = playerBots.size(); @@ -649,7 +649,7 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool minimal) DelayedFacingFix(); //Ping character database. - //CharacterDatabase.AsyncPQuery(&RandomPlayerbotMgr::DatabasePing, sWorld.GetCurrentMSTime(), string("CharacterDatabase"), "select 1 from dual"); + //CharacterDatabase.AsyncPQuery(&RandomPlayerbotMgr::DatabasePing, sWorld.GetCurrentMSTime(), std::string("CharacterDatabase"), "select 1 from dual"); } void RandomPlayerbotMgr::ScaleBotActivity() @@ -677,7 +677,7 @@ void RandomPlayerbotMgr::ScaleBotActivity() virtualMemUsedByMe = pmc.PrivateUsage; #endif - ostringstream out; + std::ostringstream out; out << sWorld.GetCurrentMSTime() << ", "; out << sWorld.GetCurrentDiff() << ","; @@ -701,7 +701,7 @@ void RandomPlayerbotMgr::ScaleBotActivity() if (!bot->GetPlayerbotAI()->AllowActivity()) continue; - string bracket = "level:" + to_string(bot->GetLevel() / 10); + std::string bracket = "level:" + std::to_string(bot->GetLevel() / 10); float level = ((float)bot->GetLevel() + (bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP) ? ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP)) : 0)); float gold = bot->GetMoney() / 10000; @@ -715,7 +715,7 @@ void RandomPlayerbotMgr::ScaleBotActivity() out << std::fixed << std::setprecision(4); for (uint8 i = 0; i < (DEFAULT_MAX_LEVEL / 10) + 1; i++) - out << GetMetricDelta(botPerformanceMetrics["level:" + to_string(i)]) * 12 * 60 << ","; + out << GetMetricDelta(botPerformanceMetrics["level:" + std::to_string(i)]) * 12 * 60 << ","; out << GetMetricDelta(botPerformanceMetrics["gold"]) * 12 * 60 << ","; out << GetMetricDelta(botPerformanceMetrics["gearscore"]) * 12 * 60 << ","; @@ -779,7 +779,7 @@ void RandomPlayerbotMgr::DelayedFacingFix() } } -void RandomPlayerbotMgr::DatabasePing(std::unique_ptr result, uint32 pingStart, string db) +void RandomPlayerbotMgr::DatabasePing(std::unique_ptr result, uint32 pingStart, std::string db) { sRandomPlayerbotMgr.SetDatabaseDelay(db, sWorld.GetCurrentMSTime() - pingStart); } @@ -799,7 +799,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots() { if (sPlayerbotAIConfig.syncLevelWithPlayers) { - maxLevel = max(sPlayerbotAIConfig.randomBotMinLevel, min(playersLevel + sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))); + maxLevel = std::max(sPlayerbotAIConfig.randomBotMinLevel, std::min(playersLevel + sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))); wantedAvgLevel = maxLevel / 2; for (auto bot : playerBots) @@ -808,7 +808,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots() if(currentAvgLevel) currentAvgLevel = currentAvgLevel / playerBots.size(); - randomAvgLevel = (sPlayerbotAIConfig.randomBotMinLevel + max(sPlayerbotAIConfig.randomBotMinLevel, min(playersLevel+ sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)))) / 2; + randomAvgLevel = (sPlayerbotAIConfig.randomBotMinLevel + std::max(sPlayerbotAIConfig.randomBotMinLevel, std::min(playersLevel+ sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL)))) / 2; } currentAllowedBotCount -= currentBots.size(); @@ -835,7 +835,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots() } } - for (list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); i++) + for (std::list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); i++) { uint32 accountId = *i; @@ -852,8 +852,8 @@ uint32 RandomPlayerbotMgr::AddRandomBots() bool rndCanIncrease = !sPlayerbotAIConfig.disableRandomLevels && randomAvgLevel > currentAvgLevel; bool rndCanLower = !sPlayerbotAIConfig.disableRandomLevels && randomAvgLevel < currentAvgLevel; - string query = "SELECT guid, level, totaltime, race, class FROM characters WHERE account = '%u' and level <= %u"; - string wasRand = sPlayerbotAIConfig.instantRandomize ? "totaltime" : "(level > 1)"; + std::string query = "SELECT guid, level, totaltime, race, class FROM characters WHERE account = '%u' and level <= %u"; + std::string wasRand = sPlayerbotAIConfig.instantRandomize ? "totaltime" : "(level > 1)"; if (needToIncrease) //We need more higher level bots. { @@ -1329,7 +1329,7 @@ void RandomPlayerbotMgr::CheckBgQueue() } #endif BattleGroundTypeId bgTypeId = sServerFacade.BgTemplateId(queueTypeId); - string _bgType; + std::string _bgType; switch (bgTypeId) { case BATTLEGROUND_AV: @@ -1565,7 +1565,7 @@ void RandomPlayerbotMgr::AddOfflineGroupBots() Group* group = player->GetGroup(); if (group && group->IsLeader(player->GetObjectGuid())) { - vector botsToAdd; + std::vector botsToAdd; Group::MemberSlotList const& slots = group->GetMemberSlots(); for (Group::MemberSlotList::const_iterator i = slots.begin(); i != slots.end(); ++i) { @@ -1949,7 +1949,7 @@ void RandomPlayerbotMgr::Revive(Player* player) } } -void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector &locs, bool hearth, bool activeOnly) +void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector &locs, bool hearth, bool activeOnly) { if (bot->IsBeingTeleported()) return; @@ -1978,7 +1978,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector &locs return; } - vector tlocs; + std::vector tlocs; for (auto& loc : locs) { @@ -1986,7 +1986,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector &locs } //Do not teleport to maps disabled in config - tlocs.erase(std::remove_if(tlocs.begin(), tlocs.end(), [](const WorldPosition& l) {vector::iterator i = find(sPlayerbotAIConfig.randomBotMaps.begin(), sPlayerbotAIConfig.randomBotMaps.end(), l.getMapId()); return i == sPlayerbotAIConfig.randomBotMaps.end(); }), tlocs.end()); + tlocs.erase(std::remove_if(tlocs.begin(), tlocs.end(), [](const WorldPosition& l) {std::vector::iterator i = find(sPlayerbotAIConfig.randomBotMaps.begin(), sPlayerbotAIConfig.randomBotMaps.end(), l.getMapId()); return i == sPlayerbotAIConfig.randomBotMaps.end(); }), tlocs.end()); //Random shuffle based on distance. Closer distances are more likely (but not exclusively) to be at the begin of the list. tlocs = sTravelMgr.getNextPoint(WorldPosition(bot), tlocs, 0); @@ -2244,16 +2244,16 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector &locs std::vector> RandomPlayerbotMgr::RpgLocationsNear(WorldLocation pos, uint32 areaId, uint32 radius) { - vector> results; + std::vector> results; float minDist = FLT_MAX; - string hasZone = "-", wantZone = WorldPosition(pos).getAreaName(true, true); + std::string hasZone = "-", wantZone = WorldPosition(pos).getAreaName(true, true); for (uint32 level = 1; level < sPlayerbotAIConfig.randomBotMaxLevel + 1; level++) { for (uint32 r = 1; r < MAX_RACES; r++) { for (auto p : rpgLocsCacheLevel[r][level]) { - string currentZone = WorldPosition(p).getAreaName(true, true); + std::string currentZone = WorldPosition(p).getAreaName(true, true); if (currentZone != wantZone && hasZone == wantZone) //If we already have the right id but this location isn't in the right id. Skip it. continue; @@ -2269,7 +2269,7 @@ std::vector> RandomPlayerbotMgr::RpgLocationsNear(Worl if (dist < minDist) results.clear(); - results.push_back(make_pair(r, level)); + results.push_back(std::make_pair(r, level)); hasZone = currentZone; @@ -2423,7 +2423,7 @@ void RandomPlayerbotMgr::PrepareTeleportCache() std::vector> ranges = RpgLocationsNear(WorldPosition(pos)); for (auto& range : ranges) - newPoints.push_back(make_pair(make_pair(range.first, range.second), pos)); + newPoints.push_back(std::make_pair(std::make_pair(range.first, range.second), pos)); } //Creatures. @@ -2437,7 +2437,7 @@ void RandomPlayerbotMgr::PrepareTeleportCache() if (cInfo->ExtraFlags & CREATURE_EXTRA_FLAG_INVISIBLE) continue; - vector allowedNpcFlags; + std::vector allowedNpcFlags; allowedNpcFlags.push_back(UNIT_NPC_FLAG_BATTLEMASTER); allowedNpcFlags.push_back(UNIT_NPC_FLAG_BANKER); @@ -2453,7 +2453,7 @@ void RandomPlayerbotMgr::PrepareTeleportCache() std::vector> ranges = RpgLocationsNear(WorldPosition(creatureData)); for (auto& range : ranges) - newPoints.push_back(make_pair(make_pair(range.first, range.second), creatureData)); + newPoints.push_back(std::make_pair(std::make_pair(range.first, range.second), creatureData)); break; } } @@ -2472,7 +2472,7 @@ void RandomPlayerbotMgr::PrintTeleportCache() uint32 level = l.first; for (auto& p : l.second) { - ostringstream out; + std::ostringstream out; out << level << ","; WorldPosition(p).printWKT(out); out << "LEVEL" << ",0," << WorldPosition(p).getAreaName(true, true); @@ -2488,7 +2488,7 @@ void RandomPlayerbotMgr::PrintTeleportCache() uint32 level = l.first; for (auto& p : l.second) { - ostringstream out; + std::ostringstream out; out << level << ","; WorldPosition(p).printWKT(out); out << "RPG" << "," << race << "," << WorldPosition(p).getAreaName(true, true); @@ -2514,9 +2514,9 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot) return; PerformanceMonitorOperation *pmo = sPerformanceMonitor.start(PERF_MON_RNDBOT, "RandomTeleport"); - vector locs; + std::vector locs; - list targets; + std::list targets; float range = sPlayerbotAIConfig.randomBotTeleportDistance; MaNGOS::AnyUnitInObjectRangeCheck u_check(bot, range); MaNGOS::UnitListSearcher searcher(targets, u_check); @@ -2524,7 +2524,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot) if (!targets.empty()) { - for (list::iterator i = targets.begin(); i != targets.end(); ++i) + for (std::list::iterator i = targets.begin(); i != targets.end(); ++i) { Unit* unit = *i; bot->SetPosition(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 0); @@ -2571,7 +2571,7 @@ void RandomPlayerbotMgr::Randomize(Player* bot) // give bot random level if is above or below level sync if (!initialRandom && players.size() && sPlayerbotAIConfig.syncLevelWithPlayers) { - uint32 maxLevel = max(sPlayerbotAIConfig.randomBotMinLevel, min(playersLevel + sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))); + uint32 maxLevel = std::max(sPlayerbotAIConfig.randomBotMinLevel, std::min(playersLevel + sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))); if (bot->GetLevel() > maxLevel || (bot->GetLevel() + sPlayerbotAIConfig.syncLevelMaxAbove) < playersLevel) initialRandom = true; } @@ -2627,14 +2627,14 @@ void RandomPlayerbotMgr::RandomizeFirst(Player* bot) // if lvl sync is enabled, max level is limited by online players lvl if (sPlayerbotAIConfig.syncLevelWithPlayers) - maxLevel = max(sPlayerbotAIConfig.randomBotMinLevel, min(playersLevel+ sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))); + maxLevel = std::max(sPlayerbotAIConfig.randomBotMinLevel, std::min(playersLevel+ sPlayerbotAIConfig.syncLevelMaxAbove, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))); PerformanceMonitorOperation *pmo = sPerformanceMonitor.start(PERF_MON_RNDBOT, "RandomizeFirst"); uint32 level = urand(std::max(uint32(sWorld.getConfig(CONFIG_UINT32_START_PLAYER_LEVEL)), sPlayerbotAIConfig.randomBotMinLevel), maxLevel); #ifdef MANGOSBOT_TWO if (bot->getClass() == CLASS_DEATH_KNIGHT) - level = urand(max(bot->GetLevel(), sWorld.getConfig(CONFIG_UINT32_START_HEROIC_PLAYER_LEVEL)), max(sWorld.getConfig(CONFIG_UINT32_START_HEROIC_PLAYER_LEVEL), maxLevel)); + level = urand(std::max(bot->GetLevel(), sWorld.getConfig(CONFIG_UINT32_START_HEROIC_PLAYER_LEVEL)), std::max(sWorld.getConfig(CONFIG_UINT32_START_HEROIC_PLAYER_LEVEL), maxLevel)); #endif if (urand(0, 100) < 100 * sPlayerbotAIConfig.randomBotMaxLevelChance && level < maxLevel) @@ -2775,7 +2775,7 @@ bool RandomPlayerbotMgr::IsRandomBot(uint32 bot) return GetEventValue(bot, "add"); } -list RandomPlayerbotMgr::GetBots() +std::list RandomPlayerbotMgr::GetBots() { if (!currentBots.empty()) return currentBots; @@ -2795,13 +2795,13 @@ list RandomPlayerbotMgr::GetBots() return currentBots; } -list RandomPlayerbotMgr::GetBgBots(uint32 bracket) +std::list RandomPlayerbotMgr::GetBgBots(uint32 bracket) { //if (!currentBgBots.empty()) return currentBgBots; auto results = CharacterDatabase.PQuery( "select bot from ai_playerbot_random_bots where event = 'bg' AND value = '%d'", bracket); - list BgBots; + std::list BgBots; if (results) { do @@ -2815,7 +2815,7 @@ list RandomPlayerbotMgr::GetBgBots(uint32 bracket) return BgBots; } -uint32 RandomPlayerbotMgr::GetEventValue(uint32 bot, string event) +uint32 RandomPlayerbotMgr::GetEventValue(uint32 bot, std::string event) { // load all events at once on first event load if (eventCache[bot].empty()) @@ -2826,7 +2826,7 @@ uint32 RandomPlayerbotMgr::GetEventValue(uint32 bot, string event) do { Field* fields = results->Fetch(); - string eventName = fields[0].GetString(); + std::string eventName = fields[0].GetString(); CachedEvent e; e.value = fields[1].GetUInt32(); e.lastChangeTime = fields[2].GetUInt32(); @@ -2844,7 +2844,7 @@ uint32 RandomPlayerbotMgr::GetEventValue(uint32 bot, string event) return e.value; } -int32 RandomPlayerbotMgr::GetValueValidTime(uint32 bot, string event) +int32 RandomPlayerbotMgr::GetValueValidTime(uint32 bot, std::string event) { if (eventCache.find(bot) == eventCache.end()) return 0; @@ -2857,9 +2857,9 @@ int32 RandomPlayerbotMgr::GetValueValidTime(uint32 bot, string event) return e.validIn-(time(0) - e.lastChangeTime); } -string RandomPlayerbotMgr::GetEventData(uint32 bot, string event) +std::string RandomPlayerbotMgr::GetEventData(uint32 bot, std::string event) { - string data = ""; + std::string data = ""; if (GetEventValue(bot, event)) { CachedEvent e = eventCache[bot][event]; @@ -2868,7 +2868,7 @@ string RandomPlayerbotMgr::GetEventData(uint32 bot, string event) return data; } -uint32 RandomPlayerbotMgr::SetEventValue(uint32 bot, string event, uint32 value, uint32 validIn, string data) +uint32 RandomPlayerbotMgr::SetEventValue(uint32 bot, std::string event, uint32 value, uint32 validIn, std::string data) { CharacterDatabase.PExecute("delete from ai_playerbot_random_bots where owner = 0 and bot = '%u' and event = '%s'", bot, event.c_str()); @@ -2893,27 +2893,27 @@ uint32 RandomPlayerbotMgr::SetEventValue(uint32 bot, string event, uint32 value, return value; } -uint32 RandomPlayerbotMgr::GetValue(uint32 bot, string type) +uint32 RandomPlayerbotMgr::GetValue(uint32 bot, std::string type) { return GetEventValue(bot, type); } -uint32 RandomPlayerbotMgr::GetValue(Player* bot, string type) +uint32 RandomPlayerbotMgr::GetValue(Player* bot, std::string type) { return GetValue(bot->GetObjectGuid().GetCounter(), type); } -string RandomPlayerbotMgr::GetData(uint32 bot, string type) +std::string RandomPlayerbotMgr::GetData(uint32 bot, std::string type) { return GetEventData(bot, type); } -void RandomPlayerbotMgr::SetValue(uint32 bot, string type, uint32 value, string data) +void RandomPlayerbotMgr::SetValue(uint32 bot, std::string type, uint32 value, std::string data) { SetEventValue(bot, type, value, 15*24*3600, data); } -void RandomPlayerbotMgr::SetValue(Player* bot, string type, uint32 value, string data) +void RandomPlayerbotMgr::SetValue(Player* bot, std::string type, uint32 value, std::string data) { SetValue(bot->GetObjectGuid().GetCounter(), type, value, data); } @@ -2932,7 +2932,7 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha return false; } - string cmd = args; + std::string cmd = args; if (cmd == "reset") { @@ -2962,8 +2962,8 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha if (cmd.find("pid ") != std::string::npos) { - string pids = cmd.substr(4); - vector pid = Qualified::getMultiQualifiers(pids, " "); + std::string pids = cmd.substr(4); + std::vector pid = Qualified::getMultiQualifiers(pids, " "); if (pid.size() == 0) pid.push_back("0"); @@ -2981,8 +2981,8 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha if (cmd.find("diff ") != std::string::npos) { - string diffs = cmd.substr(5); - vector diff = Qualified::getMultiQualifiers(diffs, " "); + std::string diffs = cmd.substr(5); + std::vector diff = Qualified::getMultiQualifiers(diffs, " "); if (diff.size() == 0) diff.push_back("100"); if (diff.size() == 1) @@ -3011,7 +3011,7 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha - map handlers; + std::map handlers; handlers["init"] = &RandomPlayerbotMgr::RandomizeFirst; handlers["upgrade"] = &RandomPlayerbotMgr::UpdateGearSpells; handlers["refresh"] = &RandomPlayerbotMgr::Refresh; @@ -3021,14 +3021,14 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha handlers["grind"] = &RandomPlayerbotMgr::RandomTeleport; handlers["change_strategy"] = &RandomPlayerbotMgr::ChangeStrategy; - for (map::iterator j = handlers.begin(); j != handlers.end(); ++j) + for (std::map::iterator j = handlers.begin(); j != handlers.end(); ++j) { - string prefix = j->first; + std::string prefix = j->first; if (cmd.find(prefix) != 0) continue; - string name = cmd.size() > prefix.size() + 1 ? cmd.substr(1 + prefix.size()) : "%"; + std::string name = cmd.size() > prefix.size() + 1 ? cmd.substr(1 + prefix.size()) : "%"; - list botIds; - for (list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); ++i) + std::list botIds; + for (std::list::iterator i = sPlayerbotAIConfig.randomBotAccounts.begin(); i != sPlayerbotAIConfig.randomBotAccounts.end(); ++i) { uint32 account = *i; if (auto results = CharacterDatabase.PQuery("SELECT guid FROM characters where account = '%u' and name like '%s'", @@ -3056,7 +3056,7 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha } int processed = 0; - for (list::iterator i = botIds.begin(); i != botIds.end(); ++i) + for (std::list::iterator i = botIds.begin(); i != botIds.end(); ++i) { ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, *i); Player* bot = sObjectMgr.GetPlayer(guid); @@ -3072,15 +3072,15 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha return true; } - list messages = sRandomPlayerbotMgr.HandlePlayerbotCommand(args, NULL); - for (list::iterator i = messages.begin(); i != messages.end(); ++i) + std::list messages = sRandomPlayerbotMgr.HandlePlayerbotCommand(args, NULL); + for (std::list::iterator i = messages.begin(); i != messages.end(); ++i) { sLog.outString("%s",i->c_str()); } return true; } -void RandomPlayerbotMgr::HandleCommand(uint32 type, const string& text, Player& fromPlayer, string channelName, Team team, uint32 lang) +void RandomPlayerbotMgr::HandleCommand(uint32 type, const std::string& text, Player& fromPlayer, std::string channelName, Team team, uint32 lang) { for (PlayerBotMap::const_iterator it = GetPlayerBotsBegin(); it != GetPlayerBotsEnd(); ++it) { @@ -3201,7 +3201,7 @@ void RandomPlayerbotMgr::OnPlayerLogin(Player* player) } else { - vector dests = sTravelMgr.getRpgTravelDestinations(player, true, true, 200000.0f); + std::vector dests = sTravelMgr.getRpgTravelDestinations(player, true, true, 200000.0f); do { @@ -3267,14 +3267,14 @@ void RandomPlayerbotMgr::PrintStats() { sLog.outString("%lu Random Bots online", playerBots.size()); - map alliance, horde; + std::map alliance, horde; for (uint32 i = 0; i < 10; ++i) { alliance[i] = 0; horde[i] = 0; } - map perRace, perClass; + std::map perRace, perClass; for (uint8 race = RACE_HUMAN; race < MAX_RACES; ++race) { perRace[race] = 0; @@ -3286,7 +3286,7 @@ void RandomPlayerbotMgr::PrintStats() int dps = 0, heal = 0, tank = 0, active = 0, update = 0, randomize = 0, teleport = 0, changeStrategy = 0, dead = 0, combat = 0, revive = 0, taxi = 0, moving = 0, mounted = 0, afk = 0; int stateCount[(uint8)TravelState::MAX_TRAVEL_STATE + 1] = { 0 }; - vector> questCount; + std::vector> questCount; for (PlayerBotMap::iterator i = playerBots.begin(); i != playerBots.end(); ++i) { Player* bot = i->second; @@ -3412,7 +3412,7 @@ void RandomPlayerbotMgr::PrintStats() if (!found) { - questCount.push_back(make_pair(quest, 1)); + questCount.push_back(std::make_pair(quest, 1)); } } } @@ -3426,7 +3426,7 @@ void RandomPlayerbotMgr::PrintStats() continue; uint32 from = i*10; - uint32 to = min(from + 9, maxLevel); + uint32 to = std::min(from + 9, maxLevel); if (!from) from = 1; sLog.outString(" %d..%d: %d alliance, %d horde", from, to, alliance[i], horde[i]); } @@ -3468,7 +3468,7 @@ void RandomPlayerbotMgr::PrintStats() sLog.outString(" Completing quests: %d", stateCount[(uint8)TravelState::TRAVEL_STATE_TRAVEL_HAND_IN_QUEST] + stateCount[(uint8)TravelState::TRAVEL_STATE_WORK_HAND_IN_QUEST]); sLog.outString(" Idling: %d", stateCount[(uint8)TravelState::TRAVEL_STATE_IDLE]); - /*sort(questCount.begin(), questCount.end(), [](pair i, pair j) {return i.second > j.second; }); + /*sort(questCount.begin(), questCount.end(), [](std::pair i, std::pair j) {return i.second > j.second; }); sLog.outString("Bots top quests:"); @@ -3525,7 +3525,7 @@ void RandomPlayerbotMgr::SetTradeDiscount(Player* bot, Player* master, uint32 va if (!master) return; uint32 botId = bot->GetGUIDLow(); uint32 masterId = master->GetGUIDLow(); - ostringstream name; name << "trade_discount_" << masterId; + std::ostringstream name; name << "trade_discount_" << masterId; SetEventValue(botId, name.str(), value, sPlayerbotAIConfig.maxRandomBotInWorldTime); } @@ -3534,21 +3534,21 @@ uint32 RandomPlayerbotMgr::GetTradeDiscount(Player* bot, Player* master) if (!master) return 0; uint32 botId = bot->GetGUIDLow(); uint32 masterId = master->GetGUIDLow(); - ostringstream name; name << "trade_discount_" << masterId; + std::ostringstream name; name << "trade_discount_" << masterId; return GetEventValue(botId, name.str()); } -string RandomPlayerbotMgr::HandleRemoteCommand(string request) +std::string RandomPlayerbotMgr::HandleRemoteCommand(std::string request) { - string::iterator pos = find(request.begin(), request.end(), ','); + std::string::iterator pos = find(request.begin(), request.end(), ','); if (pos == request.end()) { - ostringstream out; out << "invalid request: " << request; + std::ostringstream out; out << "invalid request: " << request; return out.str(); } - string command = string(request.begin(), pos); - uint32 guid = atoi(string(pos + 1, request.end()).c_str()); + std::string command = std::string(request.begin(), pos); + uint32 guid = std::atoi(std::string(pos + 1, request.end()).c_str()); Player* bot = GetPlayerBot(guid); if (!bot) return "invalid guid"; @@ -3651,7 +3651,7 @@ uint32 RandomPlayerbotMgr::GetBattleMasterEntry(Player* bot, BattleGroundTypeId { Team team = bot->GetTeam(); uint32 entry = 0; - vector Bms; + std::vector Bms; for (auto i = begin(BattleMastersCache[team][bgTypeId]); i != end(BattleMastersCache[team][bgTypeId]); ++i) { @@ -3732,7 +3732,7 @@ void RandomPlayerbotMgr::Hotfix(Player* bot, uint32 version) break; } - for (list::iterator i = factory.classQuestIds.begin(); i != factory.classQuestIds.end(); ++i) + for (std::list::iterator i = factory.classQuestIds.begin(); i != factory.classQuestIds.end(); ++i) { uint32 questId = *i; Quest const *quest = sObjectMgr.GetQuestTemplate(questId); @@ -3778,8 +3778,8 @@ void RandomPlayerbotMgr::Hotfix(Player* bot, uint32 version) bot->GetGUIDLow(), MANGOSBOT_VERSION); } -typedef std::unordered_map > botPerformanceMetric; -std::unordered_map botPerformanceMetrics; +typedef std::unordered_map > botPerformanceMetric; +std::unordered_map botPerformanceMetrics; void RandomPlayerbotMgr::PushMetric(botPerformanceMetric& metric, const uint32 bot, const float value, uint32 maxNum) const { diff --git a/playerbot/RandomPlayerbotMgr.h b/playerbot/RandomPlayerbotMgr.h index c02fa93a..59b6168b 100644 --- a/playerbot/RandomPlayerbotMgr.h +++ b/playerbot/RandomPlayerbotMgr.h @@ -5,6 +5,8 @@ #include "PlayerbotAIBase.h" #include "PlayerbotMgr.h" #include "playerbot/PlayerbotAIConfig.h" +#include +#include class WorldPacket; class Player; @@ -12,21 +14,19 @@ class Unit; class Object; class Item; -using namespace std; - class CachedEvent { public: CachedEvent() : value(0), lastChangeTime(0), validIn(0), data("") {} CachedEvent(const CachedEvent& other) : value(other.value), lastChangeTime(other.lastChangeTime), validIn(other.validIn), data(other.data) {} - CachedEvent(uint32 value, uint32 lastChangeTime, uint32 validIn, string data = "") : value(value), lastChangeTime(lastChangeTime), validIn(validIn), data(data) {} + CachedEvent(uint32 value, uint32 lastChangeTime, uint32 validIn, std::string data = "") : value(value), lastChangeTime(lastChangeTime), validIn(validIn), data(data) {} public: bool IsEmpty() { return !lastChangeTime; } public: uint32 value, lastChangeTime, validIn; - string data; + std::string data; }; class PerformanceMonitorOperation; @@ -72,9 +72,9 @@ class RandomPlayerbotMgr : public PlayerbotHolder void DelayedFacingFix(); void LoginFreeBots(); public: - static void DatabasePing(std::unique_ptr result, uint32 pingStart, string db); - void SetDatabaseDelay(string db, uint32 delay) {databaseDelay[db] = delay;} - uint32 GetDatabaseDelay(string db) {if(databaseDelay.find(db) == databaseDelay.end()) return 0; return databaseDelay[db];} + static void DatabasePing(std::unique_ptr result, uint32 pingStart, std::string db); + void SetDatabaseDelay(std::string db, uint32 delay) {databaseDelay[db] = delay;} + uint32 GetDatabaseDelay(std::string db) {if(databaseDelay.find(db) == databaseDelay.end()) return 0; return databaseDelay[db];} static bool HandlePlayerbotConsoleCommand(ChatHandler* handler, char const* args); bool IsRandomBot(Player* bot); @@ -87,8 +87,8 @@ class RandomPlayerbotMgr : public PlayerbotHolder void UpdateGearSpells(Player* bot); void ScheduleTeleport(uint32 bot, uint32 time = 0); void ScheduleChangeStrategy(uint32 bot, uint32 time = 0); - void HandleCommand(uint32 type, const string& text, Player& fromPlayer, string channelName = "", Team team = TEAM_BOTH_ALLOWED, uint32 lang = LANG_UNIVERSAL); - string HandleRemoteCommand(string request); + void HandleCommand(uint32 type, const std::string& text, Player& fromPlayer, std::string channelName = "", Team team = TEAM_BOTH_ALLOWED, uint32 lang = LANG_UNIVERSAL); + std::string HandleRemoteCommand(std::string request); void OnPlayerLogout(Player* player); void OnPlayerLogin(Player* player); void OnPlayerLoginError(uint32 bot); @@ -112,26 +112,26 @@ class RandomPlayerbotMgr : public PlayerbotHolder void Revive(Player* player); void ChangeStrategy(Player* player); void ChangeStrategyOnce(Player* player); - uint32 GetValue(Player* bot, string type); - uint32 GetValue(uint32 bot, string type); - int32 GetValueValidTime(uint32 bot, string event); - string GetData(uint32 bot, string type); - void SetValue(uint32 bot, string type, uint32 value, string data = ""); - void SetValue(Player* bot, string type, uint32 value, string data = ""); + uint32 GetValue(Player* bot, std::string type); + uint32 GetValue(uint32 bot, std::string type); + int32 GetValueValidTime(uint32 bot, std::string event); + std::string GetData(uint32 bot, std::string type); + void SetValue(uint32 bot, std::string type, uint32 value, std::string data = ""); + void SetValue(Player* bot, std::string type, uint32 value, std::string data = ""); void Remove(Player* bot); void Hotfix(Player* player, uint32 version); uint32 GetBattleMasterEntry(Player* bot, BattleGroundTypeId bgTypeId, bool fake = false); const CreatureDataPair* GetCreatureDataByEntry(uint32 entry); uint32 GetCreatureGuidByEntry(uint32 entry); void LoadBattleMastersCache(); - map > > NeedBots; - map > > BgBots; - map > > VisualBots; - map > > BgPlayers; - map > > > ArenaBots; - map > > Rating; - map > > Supporters; - map> LfgDungeons; + std::map > > NeedBots; + std::map > > BgBots; + std::map > > VisualBots; + std::map > > BgPlayers; + std::map > > > ArenaBots; + std::map > > Rating; + std::map > > Supporters; + std::map> LfgDungeons; void CheckBgQueue(); void CheckLfgQueue(); void CheckPlayers(); @@ -142,7 +142,7 @@ class RandomPlayerbotMgr : public PlayerbotHolder bool AddRandomBot(uint32 bot); - map > > getBattleMastersCache() { return BattleMastersCache; } + std::map > > getBattleMastersCache() { return BattleMastersCache; } float getActivityMod() { return activityMod; } float getActivityPercentage() { return activityMod * 100.0f; } @@ -150,7 +150,7 @@ class RandomPlayerbotMgr : public PlayerbotHolder void PrintTeleportCache(); - void AddFacingFix(uint32 mapId, ObjectGuid guid) { facingFix[mapId].push_back(make_pair(guid,time(0))); } + void AddFacingFix(uint32 mapId, ObjectGuid guid) { facingFix[mapId].push_back(std::make_pair(guid,time(0))); } bool arenaTeamsDeleted, guildsDeleted = false; @@ -162,12 +162,12 @@ class RandomPlayerbotMgr : public PlayerbotHolder //pid values are set in constructor botPID pid = botPID(1, 50, -50, 0, 0, 0); float activityMod = 0.25; - map databaseDelay; - uint32 GetEventValue(uint32 bot, string event); - string GetEventData(uint32 bot, string event); - uint32 SetEventValue(uint32 bot, string event, uint32 value, uint32 validIn, string data = ""); - list GetBots(); - list GetBgBots(uint32 bracket); + std::map databaseDelay; + uint32 GetEventValue(uint32 bot, std::string event); + std::string GetEventData(uint32 bot, std::string event); + uint32 SetEventValue(uint32 bot, std::string event, uint32 value, uint32 validIn, std::string data = ""); + std::list GetBots(); + std::list GetBgBots(uint32 bracket); time_t BgCheckTimer; time_t LfgCheckTimer; time_t PlayersCheckTimer; @@ -177,35 +177,35 @@ class RandomPlayerbotMgr : public PlayerbotHolder bool ProcessBot(uint32 bot); void ScheduleRandomize(uint32 bot, uint32 time); void RandomTeleport(Player* bot); - void RandomTeleport(Player* bot, vector &locs, bool hearth = false, bool activeOnly = false); + void RandomTeleport(Player* bot, std::vector &locs, bool hearth = false, bool activeOnly = false); uint32 GetZoneLevel(uint16 mapId, float teleX, float teleY, float teleZ); void PrepareTeleportCache(); typedef void (RandomPlayerbotMgr::*ConsoleCommandHandler) (Player*); private: PlayerBotMap players; int processTicks; - map > locsPerLevelCache; - map > rpgLocsCache; - map > > rpgLocsCacheLevel; - map > > BattleMastersCache; - map > eventCache; + std::map > locsPerLevelCache; + std::map > rpgLocsCache; + std::map > > rpgLocsCacheLevel; + std::map > > BattleMastersCache; + std::map > eventCache; BarGoLink* loginProgressBar; - list currentBots; - list arenaTeamMembers; + std::list currentBots; + std::list arenaTeamMembers; uint32 bgBotsCount; uint32 playersLevel = 0; uint32 activeBots = 0; std::unordered_map>> playerBotMoveLog; - typedef std::unordered_map > botPerformanceMetric; - std::unordered_map botPerformanceMetrics; + typedef std::unordered_map > botPerformanceMetric; + std::unordered_map botPerformanceMetrics; std::vector> RpgLocationsNear(WorldLocation pos, uint32 areaId = 0, uint32 radius = 2000); void PushMetric(botPerformanceMetric& metric, const uint32 bot, const float value, const uint32 maxNum = 60) const; float GetMetricDelta(botPerformanceMetric& metric) const; bool showLoginWarning; - std::unordered_map>> facingFix; + std::unordered_map>> facingFix; }; #define sRandomPlayerbotMgr RandomPlayerbotMgr::instance() diff --git a/playerbot/ServerFacade.h b/playerbot/ServerFacade.h index 6e707f9a..18a158a9 100644 --- a/playerbot/ServerFacade.h +++ b/playerbot/ServerFacade.h @@ -14,8 +14,6 @@ #include "PlayerbotAIBase.h" #include "playerbot/PlayerbotAIConfig.h" -using namespace std; - class ServerFacade { public: diff --git a/playerbot/Talentspec.cpp b/playerbot/Talentspec.cpp index 6c539a31..92609cf7 100644 --- a/playerbot/Talentspec.cpp +++ b/playerbot/Talentspec.cpp @@ -6,19 +6,19 @@ using namespace std::placeholders; //Checks a talent link on basic validity. -bool TalentSpec::CheckTalentLink(string link, ostringstream* out) { +bool TalentSpec::CheckTalentLink(std::string link, std::ostringstream* out) { - string validChar = "-"; - string validNums = "012345"; + std::string validChar = "-"; + std::string validNums = "012345"; int nums = 0; for (char& c : link) { - if (validChar.find(c) == string::npos && validNums.find(c) == string::npos) + if (validChar.find(c) == std::string::npos && validNums.find(c) == std::string::npos) { *out << "talent link is invalid. Must be in format 0-0-0 (see end of wowhead talent calculator url) or a part of a predefined spec as shown with command 'talents list'"; return false; } - if (validNums.find(c) != string::npos) + if (validNums.find(c) != std::string::npos) nums++; } @@ -42,7 +42,7 @@ uint32 TalentSpec::PointstoLevel(int points) const } //Check the talentspec for errors. -bool TalentSpec::CheckTalents(int level, ostringstream* out) +bool TalentSpec::CheckTalents(int level, std::ostringstream* out) { for (auto& entry : talents) { @@ -105,7 +105,7 @@ bool TalentSpec::CheckTalents(int level, ostringstream* out) } //Set the talents for the bots to the current spec. -void TalentSpec::ApplyTalents(Player* bot, ostringstream* out) +void TalentSpec::ApplyTalents(Player* bot, std::ostringstream* out) { for (auto& entry : talents) for (int rank = 0; rank < MAX_TALENT_RANK; ++rank) @@ -133,7 +133,7 @@ void TalentSpec::ApplyTalents(Player* bot, ostringstream* out) Guild* guild = sGuildMgr.GetGuildById(bot->GetGuildId()); MemberSlot* member = guild->GetMemberSlot(bot->GetObjectGuid()); if(guild->HasRankRight(member->RankId, GR_RIGHT_EPNOTE)) - member->SetPNOTE(ChatHelper::specName(bot) + " (" + to_string(GetTalentPoints(0)) + "/" + to_string(GetTalentPoints(1)) + "/" + to_string(GetTalentPoints(2)) + ")"); + member->SetPNOTE(ChatHelper::specName(bot) + " (" + std::to_string(GetTalentPoints(0)) + "/" + std::to_string(GetTalentPoints(1)) + "/" + std::to_string(GetTalentPoints(2)) + ")"); } } @@ -235,7 +235,7 @@ void TalentSpec::ReadTalents(Player* bot) { } //Set the talent ranks to the ranks of the link. -void TalentSpec::ReadTalents(string link) { +void TalentSpec::ReadTalents(std::string link) { int rank = 0; int pos = 0; int tab = 0; @@ -310,10 +310,10 @@ int TalentSpec::GetTalentPoints(std::vector& talents, int tabpa } //Generates a wow-head link from a talent list. -string TalentSpec::GetTalentLink() +std::string TalentSpec::GetTalentLink() { - string link = ""; - string treeLink[3]; + std::string link = ""; + std::string treeLink[3]; int points[3]; int curPoints = 0; @@ -322,7 +322,7 @@ string TalentSpec::GetTalentLink() for (auto& entry : GetTalentTree(i)) { curPoints += entry.rank; - treeLink[i] += to_string(entry.rank); + treeLink[i] += std::to_string(entry.rank); if (curPoints >= points[i]) { curPoints = 0; @@ -362,11 +362,11 @@ int TalentSpec::highestTree() return 0; } -string TalentSpec::formatSpec(Player* bot) +std::string TalentSpec::formatSpec(Player* bot) { uint8 cls = bot->getClass(); - ostringstream out; + std::ostringstream out; //out << chathelper:: specs[cls][highestTree()] << " ("; int c0 = GetTalentPoints(0); @@ -393,7 +393,7 @@ void TalentSpec::CropTalents(uint32 level) for (auto& entry : talents) { if (points + entry.rank > (int)LeveltoPoints(level)) - entry.rank = max(0, (int)(LeveltoPoints(level) - points)); + entry.rank = std::max(0, (int)(LeveltoPoints(level) - points)); points += entry.rank; } @@ -410,7 +410,7 @@ std::vector TalentSpec::SubTalentList(std::vector LeveltoPoints(level)) //Running out of points. Only apply what we have left. - entry.rank = max(0, int(LeveltoPoints(level) - points)); + entry.rank = std::max(0, int(LeveltoPoints(level) - points)); for (auto& subentry : talents) if (entry.entry == subentry.entry) diff --git a/playerbot/Talentspec.h b/playerbot/Talentspec.h index e04e7255..d3ae95fa 100644 --- a/playerbot/Talentspec.h +++ b/playerbot/Talentspec.h @@ -5,8 +5,6 @@ struct TalentEntry; struct TalentTabEntry; -using namespace std; - class TalentSpec { public: #define SORT_BY_DEFAULT 0 @@ -34,22 +32,22 @@ class TalentSpec { TalentSpec() {}; TalentSpec(uint32 classMask) { GetTalents(classMask); } TalentSpec(Player* bot) { GetTalents(bot->getClassMask()); ReadTalents(bot); } - TalentSpec(TalentSpec* base, string link) { talents = base->talents; ReadTalents(link); } - TalentSpec(Player* bot, string link) { GetTalents(bot->getClassMask()); ReadTalents(link); } + TalentSpec(TalentSpec* base, std::string link) { talents = base->talents; ReadTalents(link); } + TalentSpec(Player* bot, std::string link) { GetTalents(bot->getClassMask()); ReadTalents(link); } - bool CheckTalentLink(string link, ostringstream* out); - virtual bool CheckTalents(int maxPoints, ostringstream* out); + bool CheckTalentLink(std::string link, std::ostringstream* out); + virtual bool CheckTalents(int maxPoints, std::ostringstream* out); void CropTalents(uint32 level); void ShiftTalents(TalentSpec* oldTalents, uint32 level); - void ApplyTalents(Player* bot, ostringstream* out); + void ApplyTalents(Player* bot, std::ostringstream* out); int GetTalentPoints(std::vector& talents, int tabpage = -1); int GetTalentPoints(int tabpage = -1) { return GetTalentPoints(talents, tabpage); }; bool isEarlierVersionOf(TalentSpec& newSpec); - string GetTalentLink(); + std::string GetTalentLink(); int highestTree(); - string formatSpec(Player* bot); + std::string formatSpec(Player* bot); protected: uint32 LeveltoPoints(uint32 level) const; uint32 PointstoLevel(int points) const; @@ -58,7 +56,7 @@ class TalentSpec { void SortTalents(int sortBy) { SortTalents(talents, sortBy); } void ReadTalents(Player* bot); - void ReadTalents(string link); + void ReadTalents(std::string link); std::vector GetTalentTree(int tabpage); std::vector SubTalentList(std::vector& oldList, std::vector& newList, int reverse); @@ -66,9 +64,9 @@ class TalentSpec { class TalentPath { public: - TalentPath(int pathId, string pathName, int pathProbability) { id = pathId; name = pathName; probability = pathProbability; }; + TalentPath(int pathId, std::string pathName, int pathProbability) { id = pathId; name = pathName; probability = pathProbability; }; int id =0; - string name = ""; + std::string name = ""; int probability = 100; std::vector talentSpec; }; diff --git a/playerbot/TravelMgr.cpp b/playerbot/TravelMgr.cpp index 175da7fe..1f9ac34d 100644 --- a/playerbot/TravelMgr.cpp +++ b/playerbot/TravelMgr.cpp @@ -11,7 +11,7 @@ using namespace ai; using namespace MaNGOS; -vector TravelDestination::getPoints(bool ignoreFull) +std::vector TravelDestination::getPoints(bool ignoreFull) { return points; } @@ -20,8 +20,8 @@ WorldPosition* TravelDestination::nearestPoint(WorldPosition pos) { return *std::min_element(points.begin(), points.end(), [pos](WorldPosition* i, WorldPosition* j) {return i->distance(pos) < j->distance(pos); }); } -vector TravelDestination::touchingPoints(WorldPosition* pos) { - vector ret_points; +std::vector TravelDestination::touchingPoints(WorldPosition* pos) { + std::vector ret_points; for (auto& point : points) { float dist = pos->distance(*point); @@ -37,19 +37,19 @@ vector TravelDestination::touchingPoints(WorldPosition* pos) { return ret_points; }; -vector TravelDestination::sortedPoints(WorldPosition* pos) { - vector ret_points = points; +std::vector TravelDestination::sortedPoints(WorldPosition* pos) { + std::vector ret_points = points; std::sort(ret_points.begin(), ret_points.end(), [pos](WorldPosition* i, WorldPosition* j) {return i->distance(*pos) < j->distance(*pos); }); return ret_points; }; -vector TravelDestination::nextPoint(WorldPosition* pos, bool ignoreFull) { +std::vector TravelDestination::nextPoint(WorldPosition* pos, bool ignoreFull) { return sTravelMgr.getNextPoint(pos, ignoreFull ? points : getPoints()); } -string QuestTravelDestination::getTitle() { +std::string QuestTravelDestination::getTitle() { return ChatHelper::formatQuest(questTemplate); } @@ -78,13 +78,13 @@ bool QuestRelationTravelDestination::isActive(Player* bot) { if (AI_VALUE(uint8, "free quest log slots") < 5) return false; - if (!AI_VALUE2(bool, "group or", "following party,near leader,can accept quest npc::" + to_string(entry))) //Noone has yellow exclamation mark. - if (!AI_VALUE2(bool, "group or", "following party,near leader,can accept quest low level npc::" + to_string(entry) + "need quest objective::" + to_string(questId))) //Noone can do this quest for a usefull reward. + if (!AI_VALUE2(bool, "group or", "following party,near leader,can accept quest npc::" + std::to_string(entry))) //Noone has yellow exclamation mark. + if (!AI_VALUE2(bool, "group or", "following party,near leader,can accept quest low level npc::" + std::to_string(entry) + "need quest objective::" + std::to_string(questId))) //Noone can do this quest for a usefull reward. return false; } else { - if (!AI_VALUE2(bool, "group or", "following party,near leader,can accept quest low level npc::" + to_string(entry))) //Noone can pick up this quest for money. + if (!AI_VALUE2(bool, "group or", "following party,near leader,can accept quest low level npc::" + std::to_string(entry))) //Noone can pick up this quest for money. return false; if (AI_VALUE(uint8, "free quest log slots") < 10) @@ -97,7 +97,7 @@ bool QuestRelationTravelDestination::isActive(Player* bot) { } else { - if (!AI_VALUE2(bool, "group or", "following party,near leader,can turn in quest npc::" + to_string(entry))) + if (!AI_VALUE2(bool, "group or", "following party,near leader,can turn in quest npc::" + std::to_string(entry))) return false; //Do not try to hand-in dungeon/elite quests in instances without a group. @@ -117,8 +117,8 @@ bool QuestRelationTravelDestination::isActive(Player* bot) { return true; } -string QuestRelationTravelDestination::getTitle() { - ostringstream out; +std::string QuestRelationTravelDestination::getTitle() { + std::ostringstream out; if (relation == 0) out << "questgiver"; @@ -182,7 +182,7 @@ bool QuestObjectiveTravelDestination::isActive(Player* bot) { return false; } - vector qualifier = { to_string(questTemplate->GetQuestId()), to_string(objective) }; + std::vector qualifier = { std::to_string(questTemplate->GetQuestId()), std::to_string(objective) }; if (!AI_VALUE2(bool, "group or", "following party,near leader,need quest objective::" + Qualified::MultiQualify(qualifier,","))) //Noone needs the quest objective. return false; @@ -199,7 +199,7 @@ bool QuestObjectiveTravelDestination::isActive(Player* bot) { //Only look for the target if it is unique or if we are currently working on it. if (points.size() == 1 || (target->getStatus() == TravelStatus::TRAVEL_STATUS_WORK && target->getEntry() == getEntry())) { - list targets = AI_VALUE(list, "possible targets"); + std::list targets = AI_VALUE(std::list, "possible targets"); for (auto& target : targets) if (target.GetEntry() == getEntry() && target.IsCreature() && ai->GetCreature(target) && ai->GetCreature(target)->IsAlive()) @@ -211,8 +211,8 @@ bool QuestObjectiveTravelDestination::isActive(Player* bot) { return true; } -string QuestObjectiveTravelDestination::getTitle() { - ostringstream out; +std::string QuestObjectiveTravelDestination::getTitle() { + std::ostringstream out; out << "objective " << objective; @@ -271,7 +271,7 @@ bool RpgTravelDestination::isActive(Player* bot) return false; //Once the target rpged with it is added to the ignore list. We can now move on. - set& ignoreList = bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue&>("ignore rpg target")->Get(); + std::set& ignoreList = bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue&>("ignore rpg target")->Get(); for (auto& i : ignoreList) { @@ -284,8 +284,8 @@ bool RpgTravelDestination::isActive(Player* bot) return !GuidPosition(HIGHGUID_UNIT, entry).IsHostileTo(bot); } -string RpgTravelDestination::getTitle() { - ostringstream out; +std::string RpgTravelDestination::getTitle() { + std::ostringstream out; if(entry > 0) @@ -353,8 +353,8 @@ bool GrindTravelDestination::isActive(Player* bot) return GuidPosition(bot).IsHostileTo(GuidPosition(HIGHGUID_UNIT, entry)); } -string GrindTravelDestination::getTitle() { - ostringstream out; +std::string GrindTravelDestination::getTitle() { + std::ostringstream out; out << "grind mob "; @@ -415,7 +415,7 @@ bool BossTravelDestination::isActive(Player* bot) if (!isOut(botPos)) { - list targets = AI_VALUE(list, "possible targets"); + std::list targets = AI_VALUE(std::list, "possible targets"); for (auto& target : targets) if (target.GetEntry() == getEntry() && target.IsCreature() && ai->GetCreature(target) && ai->GetCreature(target)->IsAlive()) @@ -430,8 +430,8 @@ bool BossTravelDestination::isActive(Player* bot) return true; } -string BossTravelDestination::getTitle() { - ostringstream out; +std::string BossTravelDestination::getTitle() { + std::ostringstream out; out << "boss mob "; @@ -756,12 +756,12 @@ void TravelMgr::loadAreaLevels() WorldDatabase.PExecute("CREATE TABLE IF NOT EXISTS `ai_playerbot_zone_level` (`id` bigint(20) NOT NULL ,`level` bigint(20) NOT NULL,PRIMARY KEY(`id`))"); - string query = "SELECT id, level FROM ai_playerbot_zone_level"; + std::string query = "SELECT id, level FROM ai_playerbot_zone_level"; { auto result = WorldDatabase.PQuery(query.c_str()); - vector loadedAreas; + std::vector loadedAreas; if (result) { @@ -808,7 +808,7 @@ void TravelMgr::logQuestError(uint32 errorNr, Quest* quest, uint32 objective, ui if (errorNr == 1) { - string unitName = ""; + std::string unitName = ""; CreatureInfo const* cInfo = NULL; GameObjectInfo const* gInfo = NULL; @@ -826,7 +826,7 @@ void TravelMgr::logQuestError(uint32 errorNr, Quest* quest, uint32 objective, ui } else if (errorNr == 2) { - string unitName = ""; + std::string unitName = ""; CreatureInfo const* cInfo = NULL; GameObjectInfo const* gInfo = NULL; @@ -850,7 +850,7 @@ void TravelMgr::logQuestError(uint32 errorNr, Quest* quest, uint32 objective, ui { ItemPrototype const* proto = sObjectMgr.GetItemPrototype(itemId); - string unitName = ""; + std::string unitName = ""; CreatureInfo const* cInfo = NULL; GameObjectInfo const* gInfo = NULL; @@ -890,7 +890,7 @@ void TravelMgr::SetMobAvoidArea() { sLog.outString("start mob avoidance maps"); - vector> calculations; + std::vector> calculations; BarGoLink bar(sMapStore.GetNumRows()); @@ -920,7 +920,7 @@ void TravelMgr::SetMobAvoidAreaMap(uint32 mapId) FactionTemplateEntry const* humanFaction = sFactionTemplateStore.LookupEntry(1); FactionTemplateEntry const* orcFaction = sFactionTemplateStore.LookupEntry(2); - vector creatures = WorldPosition(mapId, 1,1).getCreaturesNear(); + std::vector creatures = WorldPosition(mapId, 1,1).getCreaturesNear(); for (auto& creaturePair : creatures) { @@ -962,7 +962,7 @@ void TravelMgr::LoadQuestTravelTable() Clear(); struct unit { uint64 guid; uint32 type; uint32 entry; uint32 map; float x; float y; float z; float o; uint32 c; } t_unit; - vector units; + std::vector units; sLog.outString("Loading trainable spells."); if (GAI_VALUE(trainableSpellMap*, "trainable spell map")->empty()) @@ -971,9 +971,9 @@ void TravelMgr::LoadQuestTravelTable() } ObjectMgr::QuestMap const& questMap = sObjectMgr.GetQuestTemplates(); - vector questIds; + std::vector questIds; - unordered_map entryCount; + std::unordered_map entryCount; for (auto& quest : questMap) questIds.push_back(quest.first); @@ -1041,7 +1041,7 @@ void TravelMgr::LoadQuestTravelTable() int32 entry = e.first; QuestTravelDestination* loc; - vector locs; + std::vector locs; if (flag & (uint32)QuestRelationFlag::questGiver) { @@ -1077,7 +1077,7 @@ void TravelMgr::LoadQuestTravelTable() for (auto& guidP : e.second) { - pointsMap.insert(make_pair(guidP.GetRawValue(), guidP)); + pointsMap.insert(std::make_pair(guidP.GetRawValue(), guidP)); for (auto tLoc : locs) { @@ -1089,7 +1089,7 @@ void TravelMgr::LoadQuestTravelTable() if (!container->questTakers.empty()) { - quests.insert(make_pair(questId, container)); + quests.insert(std::make_pair(questId, container)); for (auto loc : container->questGivers) questGivers.push_back(loc); @@ -1118,7 +1118,7 @@ void TravelMgr::LoadQuestTravelTable() if (cInfo->ExtraFlags & CREATURE_EXTRA_FLAG_INVISIBLE) continue; - vector allowedNpcFlags; + std::vector allowedNpcFlags; allowedNpcFlags.push_back(UNIT_NPC_FLAG_INNKEEPER); allowedNpcFlags.push_back(UNIT_NPC_FLAG_GOSSIP); @@ -1163,7 +1163,7 @@ void TravelMgr::LoadQuestTravelTable() if (cInfo->Rank == 3 || (cInfo->Rank == 1 && !point.isOverworld() && u.c == 1)) { - string nodeName = cInfo->Name; + std::string nodeName = cInfo->Name; bLoc = new BossTravelDestination(u.entry, sPlayerbotAIConfig.tooCloseDistance, sPlayerbotAIConfig.sightDistance); bLoc->setExpireDelay(5 * 60 * 1000); @@ -1183,7 +1183,7 @@ void TravelMgr::LoadQuestTravelTable() if (gInfo->ExtraFlags & CREATURE_EXTRA_FLAG_INVISIBLE) continue; - vector allowedGoTypes; + std::vector allowedGoTypes; allowedGoTypes.push_back(GAMEOBJECT_TYPE_MAILBOX); @@ -1273,7 +1273,7 @@ void TravelMgr::LoadQuestTravelTable() if (sPlayerbotAIConfig.hasLog("activity_pid.csv")) { - ostringstream out; + std::ostringstream out; out << "Timestamp,"; out << "sWorld.GetCurrentDiff(),"; @@ -1339,11 +1339,11 @@ void TravelMgr::LoadQuestTravelTable() WorldPosition point = WorldPosition(cData.mapid, cData.posX, cData.posY, cData.posZ, cData.orientation); - string name = cInfo->Name; + std::string name = cInfo->Name; name.erase(remove(name.begin(), name.end(), ','), name.end()); name.erase(remove(name.begin(), name.end(), '\"'), name.end()); - ostringstream out; + std::ostringstream out; out << name << ","; point.printWKT(out); out << cInfo->MaxLevel << ","; @@ -1361,7 +1361,7 @@ void TravelMgr::LoadQuestTravelTable() { uint32 mapId = 0; - vector pos; + std::vector pos; static float const topNorthSouthLimit[] = { 2032.048340f, -6927.750000f, @@ -1395,7 +1395,7 @@ void TravelMgr::LoadQuestTravelTable() pos.push_back(WorldPosition(mapId, topNorthSouthLimit[i], topNorthSouthLimit[i + 1], 0)); } - ostringstream out; + std::ostringstream out; out << "topNorthSouthLimit" << ","; WorldPosition().printWKT(pos,out,1); out << std::fixed; @@ -1900,11 +1900,11 @@ void TravelMgr::LoadQuestTravelTable() WorldPosition point = WorldPosition(gData.mapid, gData.posX, gData.posY, gData.posZ, gData.orientation); - string name = data->name; + std::string name = data->name; name.erase(remove(name.begin(), name.end(), ','), name.end()); name.erase(remove(name.begin(), name.end(), '\"'), name.end()); - ostringstream out; + std::ostringstream out; out << name << ","; point.printWKT(out); out << data->type << ","; @@ -1917,14 +1917,14 @@ void TravelMgr::LoadQuestTravelTable() if (sPlayerbotAIConfig.hasLog("zones.csv")) { - std::unordered_map> zoneLocs; + std::unordered_map> zoneLocs; - vector Locs = {}; + std::vector Locs = {}; for (auto& u : units) { WorldPosition point = WorldPosition(u.map, u.x, u.y, u.z, u.o); - string name = to_string(u.map) + point.getAreaName(); + std::string name = std::to_string(u.map) + point.getAreaName(); if (zoneLocs.find(name) == zoneLocs.end()) zoneLocs.insert_or_assign(name, Locs); @@ -1940,9 +1940,9 @@ void TravelMgr::LoadQuestTravelTable() if (!sTravelNodeMap.getMapOffset(loc.second.front().getMapId()) && loc.second.front().getMapId() != 0) continue; - vector points = loc.second;; + std::vector points = loc.second;; - ostringstream out; + std::ostringstream out; WorldPosition pos = WorldPosition(points, WP_MEAN_CENTROID); @@ -1954,9 +1954,9 @@ void TravelMgr::LoadQuestTravelTable() pos.printWKT(out); if(points.begin()->getArea()) - out << to_string(points.begin()->getAreaLevel()); + out << std::to_string(points.begin()->getAreaLevel()); else - out << to_string(-1); + out << std::to_string(-1); out << "\n"; @@ -1968,9 +1968,9 @@ void TravelMgr::LoadQuestTravelTable() point.printWKT(points, out, 0); if (points.begin()->getArea()) - out << to_string(points.begin()->getAreaLevel()); + out << std::to_string(points.begin()->getAreaLevel()); else - out << to_string(-1); + out << std::to_string(-1); sPlayerbotAIConfig.log("zones.csv", out.str().c_str()); } @@ -1980,43 +1980,43 @@ void TravelMgr::LoadQuestTravelTable() { for (auto container : quests) { - vector> printQuestMap; + std::vector> printQuestMap; for (auto dest : container.second->questGivers) - printQuestMap.push_back(make_pair(0, dest)); + printQuestMap.push_back(std::make_pair(0, dest)); for (auto dest : container.second->questObjectives) - printQuestMap.push_back(make_pair(1, dest)); + printQuestMap.push_back(std::make_pair(1, dest)); for (auto dest : container.second->questTakers) - printQuestMap.push_back(make_pair(2, dest)); + printQuestMap.push_back(std::make_pair(2, dest)); for (auto dest : printQuestMap) { - ostringstream out; + std::ostringstream out; out << std::fixed << std::setprecision(2); - out << to_string(dest.first) << ","; - out << to_string(dest.second->GetQuestTemplate()->GetQuestId()) << ","; + out << std::to_string(dest.first) << ","; + out << std::to_string(dest.second->GetQuestTemplate()->GetQuestId()) << ","; out << "\"" << dest.second->GetQuestTemplate()->GetTitle() << "\"" << ","; if (dest.second->getName() == "QuestObjectiveTravelDestination") - out << to_string(((QuestObjectiveTravelDestination*)dest.second)->getObjective()) << ","; + out << std::to_string(((QuestObjectiveTravelDestination*)dest.second)->getObjective()) << ","; else - out << to_string(0) << ","; + out << std::to_string(0) << ","; - out << to_string(dest.second->getEntry()) << ","; + out << std::to_string(dest.second->getEntry()) << ","; - vector points; + std::vector points; for (auto p : dest.second->getPoints()) points.push_back(*p); WorldPosition().printWKT(points, out, 0); - out << to_string(dest.second->GetQuestTemplate()->GetQuestLevel()) << ","; - out << to_string(dest.second->GetQuestTemplate()->GetMinLevel()) << ","; - out << to_string(dest.second->GetQuestTemplate()->GetMaxLevel()) << ","; - out << to_string((uint32(ceilf(dest.second->GetQuestTemplate()->GetRewMoneyMaxLevel() / 0.6)))); + out << std::to_string(dest.second->GetQuestTemplate()->GetQuestLevel()) << ","; + out << std::to_string(dest.second->GetQuestTemplate()->GetMinLevel()) << ","; + out << std::to_string(dest.second->GetQuestTemplate()->GetMaxLevel()) << ","; + out << std::to_string((uint32(ceilf(dest.second->GetQuestTemplate()->GetRewMoneyMaxLevel() / 0.6)))); sPlayerbotAIConfig.log("quest_map.csv", out.str().c_str()); } @@ -2049,8 +2049,8 @@ void TravelMgr::LoadQuestTravelTable() bool printStrategyMap = false; if (printStrategyMap && sPlayerbotAIConfig.hasLog("strategy.csv")) { - static map classes; - static map > specs; + static std::map classes; + static std::map > specs; classes[CLASS_DRUID] = "druid"; specs[CLASS_DRUID][0] = "balance"; specs[CLASS_DRUID][1] = "feral combat"; @@ -2104,8 +2104,8 @@ void TravelMgr::LoadQuestTravelTable() #endif //Use randombot 0. - ostringstream cout; cout << sPlayerbotAIConfig.randomBotAccountPrefix << 0; - string accountName = cout.str(); + std::ostringstream cout; cout << sPlayerbotAIConfig.randomBotAccountPrefix << 0; + std::string accountName = cout.str(); auto results = LoginDatabase.PQuery("SELECT id FROM account where username = '%s'", accountName.c_str()); if (results) @@ -2121,11 +2121,11 @@ void TravelMgr::LoadQuestTravelTable() 0, LOCALE_enUS, accountName.c_str(), 0); #endif - vector , uint32>> classSpecLevel; + std::vector, uint32>> classSpecLevel; - std::unordered_map, uint32>>> actions; + std::unordered_map, uint32>>> actions; - ostringstream out; + std::ostringstream out; for (uint8 race = RACE_HUMAN; race < MAX_RACES; race++) { @@ -2164,7 +2164,7 @@ void TravelMgr::LoadQuestTravelTable() { player->SetLevel(lvl); - ostringstream tout; + std::ostringstream tout; newSpec.ApplyTalents(player, &tout); PlayerbotAI* ai = new PlayerbotAI(player); @@ -2173,8 +2173,8 @@ void TravelMgr::LoadQuestTravelTable() AiObjectContext* con = ai->GetAiObjectContext(); - list tstrats; - set strategies, sstrats; + std::list tstrats; + std::set strategies, sstrats; tstrats = ai->GetStrategies(BotState::BOT_STATE_COMBAT); sstrats = con->GetSupportedStrategies(); @@ -2202,7 +2202,7 @@ void TravelMgr::LoadQuestTravelTable() { NextAction* nextAction = strat->getDefaultActions()[i]; - ostringstream aout; + std::ostringstream aout; aout << nextAction->getRelevance() << "," << nextAction->getName() << ",,S:" << stratName; @@ -2236,7 +2236,7 @@ void TravelMgr::LoadQuestTravelTable() NextAction* nextAction = nextActions[i]; //out << " A:" << nextAction->getName() << "(" << nextAction->getRelevance() << ")"; - ostringstream aout; + std::ostringstream aout; aout << nextAction->getRelevance() << "," << nextAction->getName() << "," << triggerNode->getName() << "," << stratName; @@ -2262,13 +2262,13 @@ void TravelMgr::LoadQuestTravelTable() } } - vector< string> actionKeys; + std::vector< std::string> actionKeys; for (auto& action : actions) actionKeys.push_back(action.first); - std::sort(actionKeys.begin(), actionKeys.end(), [](string i, string j) - {stringstream is(i); stringstream js(j); float iref, jref; string iact, jact, itrig, jtrig, istrat, jstrat; + std::sort(actionKeys.begin(), actionKeys.end(), [](std::string i, std::string j) + {stringstream is(i); std::stringstream js(j); float iref, jref; std::string iact, jact, itrig, jtrig, istrat, jstrat; is >> iref >> iact >> itrig >> istrat; js >> jref >> jact >> jtrig >> jstrat; if (iref > jref) @@ -2290,7 +2290,7 @@ void TravelMgr::LoadQuestTravelTable() { classSpecLevel = actions.find(actionkey)->second; - vector,pair>> classs; + std::vector,std::pair>> classs; for (auto cl : classSpecLevel) { @@ -2299,7 +2299,7 @@ void TravelMgr::LoadQuestTravelTable() uint32 cls = cl.first.first; uint32 tb = cl.first.second; - if (std::find_if(classs.begin(), classs.end(), [cls,tb](pair, pair> i){return i.first.first ==cls && i.first.second == tb;}) == classs.end()) + if (std::find_if(classs.begin(), classs.end(), [cls,tb](std::pair, std::pair> i){return i.first.first ==cls && i.first.second == tb;}) == classs.end()) { for (auto cll : classSpecLevel) { @@ -2326,12 +2326,12 @@ void TravelMgr::LoadQuestTravelTable() uint32 min[3] = { 0,0,0 }; uint32 max[3] = { 0,0,0 }; - if (std::find_if(classs.begin(), classs.end(), [cls](pair, pair> i) {return i.first.first == cls; }) == classs.end()) + if (std::find_if(classs.begin(), classs.end(), [cls](std::pair, std::pair> i) {return i.first.first == cls; }) == classs.end()) continue; for (uint32 tb = 0; tb < 3; tb++) { - auto tcl = std::find_if(classs.begin(), classs.end(), [cls, tb](pair, pair> i) {return i.first.first == cls && i.first.second == tb; }); + auto tcl = std::find_if(classs.begin(), classs.end(), [cls, tb](std::pair, std::pair> i) {return i.first.first == cls && i.first.second == tb; }); if (tcl == classs.end()) continue; @@ -2410,7 +2410,7 @@ void TravelMgr::LoadQuestTravelTable() WorldPosition npos = WorldPosition(pos->getMapId(), nx, ny, nz, 0.0); uint32 area = path.getArea(npos.getMapId(), npos.getX(), npos.getY(), npos.getZ()); - ostringstream out; + std::ostringstream out; out << std::fixed << area << "," << npos.getDisplayX() << "," << npos.getDisplayY(); sPlayerbotAIConfig.log(7, out.str().c_str()); } @@ -2428,8 +2428,8 @@ void TravelMgr::LoadQuestTravelTable() { for (auto j : i.second->getPoints()) { - ostringstream out; - string name = i.second->getTitle(); + std::ostringstream out; + std::string name = i.second->getTitle(); name.erase(remove(name.begin(), name.end(), '\"'), name.end()); out << std::fixed << std::setprecision(2) << name.c_str() << "," << i.first << "," << j->getDisplayX() << "," << j->getDisplayY() << "," << j->getX() << "," << j->getY() << "," << j->getZ(); sPlayerbotAIConfig.log(5, out.str().c_str()); @@ -2553,8 +2553,8 @@ uint32 TravelMgr::getDialogStatus(Player* pPlayer, int32 questgiver, Quest const } //Selects a random WorldPosition from a list. Use a distance weighted distribution. -vector TravelMgr::getNextPoint(WorldPosition* center, vector points, uint32 amount) { - vector retVec; +std::vector TravelMgr::getNextPoint(WorldPosition* center, std::vector points, uint32 amount) { + std::vector retVec; if (points.size() < 2) { @@ -2564,7 +2564,7 @@ vector TravelMgr::getNextPoint(WorldPosition* center, vector weights; + std::vector weights; std::transform(retVec.begin(), retVec.end(), std::back_inserter(weights), [center](WorldPosition* point) { return 200000 / (1 + point->distance(*center)); }); @@ -2586,8 +2586,8 @@ vector TravelMgr::getNextPoint(WorldPosition* center, vector TravelMgr::getNextPoint(WorldPosition center, vector points, uint32 amount) { - vector retVec; +std::vector TravelMgr::getNextPoint(WorldPosition center, std::vector points, uint32 amount) { + std::vector retVec; if (points.size() < 2) { @@ -2599,7 +2599,7 @@ vector TravelMgr::getNextPoint(WorldPosition center, vector weights; + std::vector weights; //List of weights based on distance (Gausian curve that starts at 100 and lower to 1 at 1000 distance) //std::transform(retVec.begin(), retVec.end(), std::back_inserter(weights), [center](WorldPosition point) { return 1 + 1000 * exp(-1 * pow(point.distance(center) / 400.0, 2)); }); @@ -2645,11 +2645,11 @@ bool TravelMgr::getObjectiveStatus(Player* bot, Quest const* pQuest, uint32 obje return false; } -vector TravelMgr::getQuestTravelDestinations(Player* bot, int32 questId, bool ignoreFull, bool ignoreInactive, float maxDistance, bool ignoreObjectives) +std::vector TravelMgr::getQuestTravelDestinations(Player* bot, int32 questId, bool ignoreFull, bool ignoreInactive, float maxDistance, bool ignoreObjectives) { WorldPosition botLocation(bot); - vector retTravelLocations; + std::vector retTravelLocations; if (!questId) { @@ -2746,11 +2746,11 @@ vector TravelMgr::getQuestTravelDestinations(Player* bot, in return retTravelLocations; } -vector TravelMgr::getRpgTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance) +std::vector TravelMgr::getRpgTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance) { WorldPosition botLocation(bot); - vector retTravelLocations; + std::vector retTravelLocations; for (auto& dest : rpgNpcs) { @@ -2771,11 +2771,11 @@ vector TravelMgr::getRpgTravelDestinations(Player* bot, bool return retTravelLocations; } -vector TravelMgr::getExploreTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive) +std::vector TravelMgr::getExploreTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive) { WorldPosition botLocation(bot); - vector retTravelLocations; + std::vector retTravelLocations; for (auto& dest : exploreLocs) { @@ -2793,11 +2793,11 @@ vector TravelMgr::getExploreTravelDestinations(Player* bot, return retTravelLocations; } -vector TravelMgr::getGrindTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance, uint32 maxCheck) +std::vector TravelMgr::getGrindTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance, uint32 maxCheck) { WorldPosition botLocation(bot); - vector retTravelLocations; + std::vector retTravelLocations; uint32 checked = 0; @@ -2823,11 +2823,11 @@ vector TravelMgr::getGrindTravelDestinations(Player* bot, bo return retTravelLocations; } -vector TravelMgr::getBossTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance) +std::vector TravelMgr::getBossTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance) { WorldPosition botLocation(bot); - vector retTravelLocations; + std::vector retTravelLocations; for (auto& dest : bossMobs) { @@ -2891,7 +2891,7 @@ void TravelMgr::addMapTransfer(WorldPosition start, WorldPosition end, float por } //Add actual transfer. - auto mapTransfers = mapTransfersMap.find(make_pair(start.getMapId(), end.getMapId())); + auto mapTransfers = mapTransfersMap.find(std::make_pair(start.getMapId(), end.getMapId())); if (mapTransfers == mapTransfersMap.end()) mapTransfersMap.insert({ { sMap, eMap }, {mapTransfer(start, end, portalDistance)} }); @@ -2966,13 +2966,13 @@ float TravelMgr::fastMapTransDistance(WorldPosition start, WorldPosition end, bo return minDist; } -void TravelMgr::printGrid(uint32 mapId, int x, int y, string type) +void TravelMgr::printGrid(uint32 mapId, int x, int y, std::string type) { - string fileName = "unload_grid.csv"; + std::string fileName = "unload_grid.csv"; if (sPlayerbotAIConfig.hasLog(fileName)) { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr(); out << "+00, " << 0 << 0 << x << "," << y << ", " << type << ","; WorldPosition::printWKT(WorldPosition::fromGridPair(GridPair(x, y), mapId), out, 1, true); @@ -2980,9 +2980,9 @@ void TravelMgr::printGrid(uint32 mapId, int x, int y, string type) } } -void TravelMgr::printObj(WorldObject* obj, string type) +void TravelMgr::printObj(WorldObject* obj, std::string type) { - string fileName = "unload_grid.csv"; + std::string fileName = "unload_grid.csv"; if (sPlayerbotAIConfig.hasLog(fileName)) { @@ -2990,12 +2990,12 @@ void TravelMgr::printObj(WorldObject* obj, string type) Cell const& cell = obj->GetCurrentCell(); - vector vcell, vgrid; + std::vector vcell, vgrid; vcell = p.fromCellPair(p.getCellPair()); vgrid = p.gridFromCellPair(p.getCellPair()); { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr(); out << "+00, " << obj->GetObjectGuid().GetEntry() << "," << obj->GetObjectGuid().GetCounter() << "," << cell.GridX() << "," << cell.GridY() << ", " << type << ","; @@ -3004,7 +3004,7 @@ void TravelMgr::printObj(WorldObject* obj, string type) } { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr(); out << "+00, " << obj->GetObjectGuid().GetEntry() << "," << obj->GetObjectGuid().GetCounter() << "," << cell.GridX() << "," << cell.GridY() << ", " << type << ","; @@ -3022,7 +3022,7 @@ void TravelMgr::printObj(WorldObject* obj, string type) Cell const& cell = obj->GetCurrentCell(); { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr(); out << "+00, " << obj->GetObjectGuid().GetEntry() << "," << obj->GetObjectGuid().GetCounter() << "," << cell.GridX() << "," << cell.GridY() << ", " << type << ","; diff --git a/playerbot/TravelMgr.h b/playerbot/TravelMgr.h index 5ec90019..714ae88f 100644 --- a/playerbot/TravelMgr.h +++ b/playerbot/TravelMgr.h @@ -37,14 +37,14 @@ namespace ai public: TravelDestination() {} TravelDestination(float radiusMin1, float radiusMax1) { radiusMin = radiusMin1; radiusMax = radiusMax1; } - TravelDestination(vector points1, float radiusMin1, float radiusMax1) { points = points1; radiusMin = radiusMin1; radiusMax = radiusMax1; } + TravelDestination(std::vector points1, float radiusMin1, float radiusMax1) { points = points1; radiusMin = radiusMin1; radiusMax = radiusMax1; } void addPoint(WorldPosition* pos) { points.push_back(pos); } bool hasPoint(WorldPosition* pos) { return std::find(points.begin(), points.end(), pos) != points.end(); } void setExpireDelay(uint32 delay) { expireDelay = delay; } void setCooldownDelay(uint32 delay) { cooldownDelay = delay; } - vector getPoints(bool ignoreFull = false); + std::vector getPoints(bool ignoreFull = false); uint32 getExpireDelay() { return expireDelay; } uint32 getCooldownDelay() { return cooldownDelay; } @@ -52,9 +52,9 @@ namespace ai virtual bool isActive(Player* bot) { return false; } - virtual string getName() { return "TravelDestination"; } + virtual std::string getName() { return "TravelDestination"; } virtual int32 getEntry() { return 0; } - virtual string getTitle() { return "generic travel destination"; } + virtual std::string getTitle() { return "generic travel destination"; } WorldPosition* nearestPoint(WorldPosition* pos) {return nearestPoint(*pos);}; WorldPosition* nearestPoint(WorldPosition pos); @@ -65,11 +65,11 @@ namespace ai virtual bool isOut(WorldPosition pos, float radius = 0) { return !onMap(pos) || distanceTo(pos) > (radius? radius : radiusMax); } float getRadiusMin() { return radiusMin; } - vector touchingPoints(WorldPosition* pos); - vector sortedPoints(WorldPosition* pos); - vector nextPoint(WorldPosition* pos, bool ignoreFull = true); + std::vector touchingPoints(WorldPosition* pos); + std::vector sortedPoints(WorldPosition* pos); + std::vector nextPoint(WorldPosition* pos, bool ignoreFull = true); protected: - vector points; + std::vector points; float radiusMin = 0; float radiusMax = 0; @@ -87,8 +87,8 @@ namespace ai virtual bool isActive(Player* bot) { return false; } - virtual string getName() { return "NullTravelDestination"; } - virtual string getTitle() { return "no destination"; } + virtual std::string getName() { return "NullTravelDestination"; } + virtual std::string getTitle() { return "no destination"; } virtual bool isIn(WorldPosition* pos) { return true; } virtual bool isOut(WorldPosition* pos) { return false; } @@ -107,9 +107,9 @@ namespace ai virtual bool isActive(Player* bot) { return bot->IsActiveQuest(questId); } - virtual string getName() { return "QuestTravelDestination"; } + virtual std::string getName() { return "QuestTravelDestination"; } virtual int32 getEntry() { return 0; } - virtual string getTitle(); + virtual std::string getTitle(); protected: uint32 questId; Quest const* questTemplate; @@ -125,9 +125,9 @@ namespace ai virtual CreatureInfo const* getCreatureInfo() { return entry > 0 ? ObjectMgr::GetCreatureTemplate(entry) : nullptr; } - virtual string getName() { return "QuestRelationTravelDestination"; } + virtual std::string getName() { return "QuestRelationTravelDestination"; } virtual int32 getEntry() { return entry; } - virtual string getTitle(); + virtual std::string getTitle(); virtual uint32 getRelation() { return relation; } private: uint32 relation; @@ -154,11 +154,11 @@ namespace ai virtual bool isActive(Player* bot); - virtual string getName() { return "QuestObjectiveTravelDestination"; } + virtual std::string getName() { return "QuestObjectiveTravelDestination"; } virtual int32 getEntry() { return entry; } - virtual string getTitle(); + virtual std::string getTitle(); virtual uint32 getObjective() { return objective; } private: @@ -178,9 +178,9 @@ namespace ai virtual CreatureInfo const* getCreatureInfo() { return ObjectMgr::GetCreatureTemplate(entry); } virtual GameObjectInfo const* getGoInfo() { return ObjectMgr::GetGameObjectInfo(-1*entry); } - virtual string getName() { return "RpgTravelDestination"; } + virtual std::string getName() { return "RpgTravelDestination"; } virtual int32 getEntry() { return entry; } - virtual string getTitle(); + virtual std::string getTitle(); protected: int32 entry; }; @@ -195,9 +195,9 @@ namespace ai virtual bool isActive(Player* bot); - virtual string getName() { return "ExploreTravelDestination"; } + virtual std::string getName() { return "ExploreTravelDestination"; } virtual int32 getEntry() { return 0; } - virtual string getTitle() { return title; } + virtual std::string getTitle() { return title; } virtual void setTitle(std::string newTitle) { title = newTitle; } virtual uint32 getAreaId() { return areaId; } protected: @@ -215,9 +215,9 @@ namespace ai virtual bool isActive(Player* bot); virtual CreatureInfo const* getCreatureInfo() { return ObjectMgr::GetCreatureTemplate(entry); } - virtual string getName() { return "GrindTravelDestination"; } + virtual std::string getName() { return "GrindTravelDestination"; } virtual int32 getEntry() { return entry; } - virtual string getTitle(); + virtual std::string getTitle(); protected: int32 entry; }; @@ -232,9 +232,9 @@ namespace ai virtual bool isActive(Player* bot); virtual CreatureInfo const* getCreatureInfo() { return ObjectMgr::GetCreatureTemplate(entry); } - virtual string getName() { return "BossTravelDestination"; } + virtual std::string getName() { return "BossTravelDestination"; } virtual int32 getEntry() { return entry; } - virtual string getTitle(); + virtual std::string getTitle(); protected: int32 entry; }; @@ -242,9 +242,9 @@ namespace ai //A quest destination container for quick lookup of all destinations related to a quest. struct QuestContainer { - vector questGivers; - vector questTakers; - vector questObjectives; + std::vector questGivers; + std::vector questTakers; + std::vector questObjectives; }; // @@ -301,7 +301,7 @@ namespace ai float distance(Player* bot) { WorldPosition pos(bot); return wPosition->distance(pos); }; WorldPosition* getPosition() { return wPosition; }; - string GetPosStr() { return wPosition->to_string(); } + std::string GetPosStr() { return wPosition->to_string(); } TravelDestination* getDestination() { return tDestination; }; int32 getEntry() { if (!tDestination) return 0; return tDestination->getEntry(); } PlayerbotAI* getAi() { return ai; } @@ -365,24 +365,24 @@ namespace ai if (i) { - swap(*first, *std::next(first, i)); - swap(*first_weight, *std::next(first_weight, i)); + std::swap(*first, *std::next(first, i)); + std::swap(*first_weight, *std::next(first_weight, i)); } ++first; ++first_weight; } } - vector getNextPoint(WorldPosition* center, vector points, uint32 amount = 1); - vector getNextPoint(WorldPosition center, vector points, uint32 amount = 1); + std::vector getNextPoint(WorldPosition* center, std::vector points, uint32 amount = 1); + std::vector getNextPoint(WorldPosition center, std::vector points, uint32 amount = 1); QuestStatusData* getQuestStatus(Player* bot, uint32 questId); bool getObjectiveStatus(Player* bot, Quest const* pQuest, uint32 objective); uint32 getDialogStatus(Player* pPlayer, int32 questgiver, Quest const* pQuest); - vector getQuestTravelDestinations(Player* bot, int32 questId = -1, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 5000, bool ignoreObjectives = false); - vector getRpgTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 5000); - vector getExploreTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false); - vector getGrindTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 5000, uint32 maxCheck = 50); - vector getBossTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 25000); + std::vector getQuestTravelDestinations(Player* bot, int32 questId = -1, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 5000, bool ignoreObjectives = false); + std::vector getRpgTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 5000); + std::vector getExploreTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false); + std::vector getGrindTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 5000, uint32 maxCheck = 50); + std::vector getBossTravelDestinations(Player* bot, bool ignoreFull = false, bool ignoreInactive = false, float maxDistance = 25000); void setNullTravelTarget(Player* player); @@ -395,14 +395,14 @@ namespace ai NullTravelDestination* nullTravelDestination = new NullTravelDestination(); WorldPosition* nullWorldPosition = new WorldPosition(); - void addBadVmap(uint32 mapId, int x, int y) { badVmap.push_back(make_tuple(mapId, x, y)); } - void addBadMmap(uint32 mapId, int x, int y) { badMmap.push_back(make_tuple(mapId, x, y)); } - bool isBadVmap(uint32 mapId, int x, int y) { return std::find(badVmap.begin(), badVmap.end(), make_tuple(mapId, x, y)) != badVmap.end(); } - bool isBadMmap(uint32 mapId, int x, int y) { return std::find(badMmap.begin(), badMmap.end(), make_tuple(mapId, x, y)) != badMmap.end(); } + void addBadVmap(uint32 mapId, int x, int y) { badVmap.push_back(std::make_tuple(mapId, x, y)); } + void addBadMmap(uint32 mapId, int x, int y) { badMmap.push_back(std::make_tuple(mapId, x, y)); } + bool isBadVmap(uint32 mapId, int x, int y) { return std::find(badVmap.begin(), badVmap.end(), std::make_tuple(mapId, x, y)) != badVmap.end(); } + bool isBadMmap(uint32 mapId, int x, int y) { return std::find(badMmap.begin(), badMmap.end(), std::make_tuple(mapId, x, y)) != badMmap.end(); } - void printGrid(uint32 mapId, int x, int y, string type); - void printObj(WorldObject* obj, string type); + void printGrid(uint32 mapId, int x, int y, std::string type); + void printObj(WorldObject* obj, std::string type); int32 getAreaLevel(uint32 area_id); void loadAreaLevels(); @@ -411,21 +411,21 @@ namespace ai protected: void logQuestError(uint32 errorNr, Quest* quest, uint32 objective = 0, uint32 unitId = 0, uint32 itemId = 0); - vector avoidLoaded; + std::vector avoidLoaded; - vector questGivers; - vector rpgNpcs; - vector grindMobs; - vector bossMobs; + std::vector questGivers; + std::vector rpgNpcs; + std::vector grindMobs; + std::vector bossMobs; std::unordered_map exploreLocs; std::unordered_map quests; std::unordered_map pointsMap; std::unordered_map areaLevels; - vector> badVmap, badMmap; + std::vector> badVmap, badMmap; - std::unordered_map, vector, boost::hash>> mapTransfersMap; + std::unordered_map, std::vector, boost::hash>> mapTransfersMap; }; } diff --git a/playerbot/TravelNode.cpp b/playerbot/TravelNode.cpp index 2e053376..3cfc356b 100644 --- a/playerbot/TravelNode.cpp +++ b/playerbot/TravelNode.cpp @@ -15,17 +15,17 @@ using namespace ai; using namespace MaNGOS; -//TravelNodePath(float distance = 0.1f, float extraCost = 0, TravelNodePathType pathType = TravelNodePathType::walk, uint64 pathObject = 0, bool calculated = false, vector maxLevelCreature = { 0,0,0 }, float swimDistance = 0) -string TravelNodePath::print() +//TravelNodePath(float distance = 0.1f, float extraCost = 0, TravelNodePathType pathType = TravelNodePathType::walk, uint64 pathObject = 0, bool calculated = false, std::vector maxLevelCreature = { 0,0,0 }, float swimDistance = 0) +std::string TravelNodePath::print() { - ostringstream out; + std::ostringstream out; out << std::fixed << std::setprecision(1); out << distance << "f,"; out << extraCost << "f,"; - out << to_string(uint8(pathType)) << ","; + out << std::to_string(uint8(pathType)) << ","; out << pathObject << ","; out << (calculated ? "true" : "false") << ","; - out << to_string(maxLevelCreature[0]) << "," << to_string(maxLevelCreature[1]) << "," << to_string(maxLevelCreature[2]) << ","; + out << std::to_string(maxLevelCreature[0]) << "," << std::to_string(maxLevelCreature[1]) << "," << std::to_string(maxLevelCreature[2]) << ","; out << swimDistance << "f"; return out.str().c_str(); @@ -62,11 +62,11 @@ void TravelNodePath::calculateCost(bool distanceOnly) FactionTemplateEntry const* factionEntry = sFactionTemplateStore.LookupEntry(cInfo->Faction); if (aReact.find(factionEntry) == aReact.end()) - aReact.insert(make_pair(factionEntry, PlayerbotAI::friendToAlliance(factionEntry))); + aReact.insert(std::make_pair(factionEntry, PlayerbotAI::friendToAlliance(factionEntry))); aFriend = aReact.find(factionEntry)->second; if (hReact.find(factionEntry) == hReact.end()) - hReact.insert(make_pair(factionEntry, PlayerbotAI::friendToHorde(factionEntry))); + hReact.insert(std::make_pair(factionEntry, PlayerbotAI::friendToHorde(factionEntry))); hFriend = hReact.find(factionEntry)->second; if (maxLevelCreature[0] < cInfo->MaxLevel && !aFriend && !hFriend) @@ -230,7 +230,7 @@ TravelNodePath* TravelNode::buildPath(TravelNode* endNode, Unit* bot, bool postP if (returnNodePath->getComplete()) //Path is already complete. Return it. return returnNodePath; - vector path = returnNodePath->getPath(); + std::vector path = returnNodePath->getPath(); if (path.empty()) path = { *getPosition() }; //Start the path from the current Node. @@ -247,7 +247,7 @@ TravelNodePath* TravelNode::buildPath(TravelNode* endNode, Unit* bot, bool postP if (backNodePath.getPathType() == TravelNodePathType::walk) { - vector bPath = backNodePath.getPath(); + std::vector bPath = backNodePath.getPath(); if (!backNodePath.getComplete()) //Build it if it's not already complete. { @@ -284,7 +284,7 @@ TravelNodePath* TravelNode::buildPath(TravelNode* endNode, Unit* bot, bool postP if (!endNode->hasPathTo(this) || !endNode->getPathTo(this)->getComplete()) { - vector reversePath = path; + std::vector reversePath = path; reverse(reversePath.begin(), reversePath.end()); TravelNodePath* backNodePath = endNode->setPathTo(this, TravelNodePath(), false); @@ -323,7 +323,7 @@ TravelNodePath* TravelNode::buildPath(TravelNode* endNode, Unit* bot, bool postP { TravelNodePath* backNodePath = endNode->getPathTo(this); - vector reversePath = path; + std::vector reversePath = path; reverse(reversePath.begin(), reversePath.end()); backNodePath->setPath(reversePath); endNode->setLinkTo(this, true); @@ -361,10 +361,10 @@ void TravelNode::removeLinkTo(TravelNode* node, bool removePaths) { } } -vector TravelNode::getNodeMap(bool importantOnly, vector ignoreNodes, bool mapOnly) +std::vector TravelNode::getNodeMap(bool importantOnly, std::vector ignoreNodes, bool mapOnly) { - vector openList; - vector closeList; + std::vector openList; + std::vector closeList; openList.push_back(this); @@ -479,7 +479,7 @@ bool TravelNode::cropUselessLinks() if (sPlayerbotAIConfig.hasLog("crop.csv")) { - ostringstream out; + std::ostringstream out; out << getName() << ","; out << farNode->getName() << ","; WorldPosition().printWKT({ *getPosition(),*farNode->getPosition() },out,1); @@ -495,7 +495,7 @@ bool TravelNode::cropUselessLinks() if (sPlayerbotAIConfig.hasLog("crop.csv")) { - ostringstream out; + std::ostringstream out; out << getName() << ","; out << farNode->getName() << ","; WorldPosition().printWKT({ *getPosition(),*farNode->getPosition() }, out,1); @@ -510,7 +510,7 @@ bool TravelNode::cropUselessLinks() /* - //vector> toRemove; + //vector> toRemove; for (auto& firstLink : getLinks()) { @@ -525,7 +525,7 @@ bool TravelNode::cropUselessLinks() if (firstNode == secondNode) continue; - if (std::find(toRemove.begin(), toRemove.end(), [firstNode, secondNode](pair pair) {return pair.first == firstNode || pair.first == secondNode;}) != toRemove.end()) + if (std::find(toRemove.begin(), toRemove.end(), [firstNode, secondNode](std::pair pair) {return pair.first == firstNode || pair.first == secondNode;}) != toRemove.end()) continue; if (firstNode->hasLinkTo(secondNode)) @@ -573,7 +573,7 @@ bool TravelNode::cropUselessLinks() if (this == secondNode) continue; - if (std::find(toRemove.begin(), toRemove.end(), [firstNode, secondNode](pair pair) {return pair.first == firstNode || pair.first == secondNode; }) != toRemove.end()) + if (std::find(toRemove.begin(), toRemove.end(), [firstNode, secondNode](std::pair pair) {return pair.first == firstNode || pair.first == secondNode; }) != toRemove.end()) continue; if (firstNode->hasLinkTo(secondNode)) @@ -645,8 +645,8 @@ void TravelNode::print(bool printFailed) uint32 mapSize = getNodeMap(true).size(); - ostringstream out; - string name = getName(); + std::ostringstream out; + std::string name = getName(); name.erase(remove(name.begin(), name.end(), '\"'), name.end()); out << name.c_str() << ","; out << std::fixed << std::setprecision(2); @@ -658,7 +658,7 @@ void TravelNode::print(bool printFailed) sPlayerbotAIConfig.log("travelNodes.csv", out.str().c_str()); - vector ppath; + std::vector ppath; for (auto& endNode : sTravelNodeMap.getNodes()) { @@ -683,7 +683,7 @@ void TravelNode::print(bool printFailed) if (ppath.size() > 1) { - ostringstream out; + std::ostringstream out; uint32 pathType = 1; if (!hasLinkTo(endNode)) @@ -708,9 +708,9 @@ void TravelNode::print(bool printFailed) out << path->getDistance() << ","; out << path->getCost() << ","; out << (path->getComplete() ? 0 : 1) << ","; - out << to_string(path->getMaxLevelCreature()[0])<< ","; - out << to_string(path->getMaxLevelCreature()[1]) << ","; - out << to_string(path->getMaxLevelCreature()[2]); + out << std::to_string(path->getMaxLevelCreature()[0])<< ","; + out << std::to_string(path->getMaxLevelCreature()[1]) << ","; + out << std::to_string(path->getMaxLevelCreature()[2]); sPlayerbotAIConfig.log("travelPaths.csv", out.str().c_str()); } @@ -725,7 +725,7 @@ bool TravelPath::makeShortCut(WorldPosition startPos, float maxDist, Unit* bot) float maxDistSq = maxDist * maxDist; float minDist = -1; float totalDist = fullPath.begin()->point.sqDistance(startPos); - vector newPath; + std::vector newPath; WorldPosition firstNode; for (auto& p : fullPath) //cycle over the full path @@ -783,7 +783,7 @@ bool TravelPath::makeShortCut(WorldPosition startPos, float maxDist, Unit* bot) return true; } - vector toPath = startPos.getPathTo(beginPos, bot); + std::vector toPath = startPos.getPathTo(beginPos, bot); //We can not reach the new begin position. Follow the complete path. if (!beginPos.isPathTo(toPath)) @@ -797,7 +797,7 @@ bool TravelPath::makeShortCut(WorldPosition startPos, float maxDist, Unit* bot) return true; } -bool TravelPath::shouldMoveToNextPoint(WorldPosition startPos, vector::iterator beg, vector::iterator ed, vector::iterator p, float& moveDist, float maxDist) +bool TravelPath::shouldMoveToNextPoint(WorldPosition startPos, std::vector::iterator beg, std::vector::iterator ed, std::vector::iterator p, float& moveDist, float maxDist) { if (p == ed) //We are the end. Stop now. return false; @@ -1012,9 +1012,9 @@ WorldPosition TravelPath::getNextPoint(WorldPosition startPos, float maxDist, Tr return startP->point; } -ostringstream TravelPath::print() +std::ostringstream TravelPath::print() { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr(); out << "+00," << "1,"; @@ -1036,7 +1036,7 @@ float TravelNodeRoute::getTotalDistance() return totalLength; } -TravelPath TravelNodeRoute::buildPath(vector pathToStart, vector pathToEnd, Unit* bot) +TravelPath TravelNodeRoute::buildPath(std::vector pathToStart, std::vector pathToEnd, Unit* bot) { TravelPath travelPath; @@ -1070,7 +1070,7 @@ TravelPath TravelNodeRoute::buildPath(vector pathToStart, vector< if (!nodePath || !nodePath->getComplete()) //It looks like we can't properly path to our node. Make a temporary reverse path and see if that works instead. { returnNodePath = *node->buildPath(prevNode, botForPath); //Build reverse path and save it to a temporary variable. - vector path = returnNodePath.getPath(); + std::vector path = returnNodePath.getPath(); reverse(path.begin(), path.end()); //Reverse the path returnNodePath.setPath(path); nodePath = &returnNodePath; @@ -1107,7 +1107,7 @@ TravelPath TravelNodeRoute::buildPath(vector pathToStart, vector< } else { - vector path = nodePath->getPath(); + std::vector path = nodePath->getPath(); if (path.size() > 1 && node != nodes.back()) //Remove the last point since that will also be the start of the next path. path.pop_back(); @@ -1130,9 +1130,9 @@ TravelPath TravelNodeRoute::buildPath(vector pathToStart, vector< return travelPath; } -ostringstream TravelNodeRoute::print() +std::ostringstream TravelNodeRoute::print() { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr(); out << "+00" << ",0," << "\"LINESTRING("; @@ -1175,7 +1175,7 @@ TravelNodeMap::TravelNodeMap(TravelNodeMap* baseMap) baseMap->m_nMapMtx.unlock_shared(); } -TravelNode* TravelNodeMap::addNode(WorldPosition pos, string preferedName, bool isImportant, bool checkDuplicate, bool transport, uint32 transportId) +TravelNode* TravelNodeMap::addNode(WorldPosition pos, std::string preferedName, bool isImportant, bool checkDuplicate, bool transport, uint32 transportId) { TravelNode* newNode; @@ -1186,7 +1186,7 @@ TravelNode* TravelNodeMap::addNode(WorldPosition pos, string preferedName, bool return newNode; } - string finalName = preferedName; + std::string finalName = preferedName; if (!isImportant) { @@ -1196,12 +1196,12 @@ TravelNode* TravelNodeMap::addNode(WorldPosition pos, string preferedName, bool for (auto& node : getNodes()) { - if (node->getName().find(preferedName + to_string(nameCount)) != std::string::npos) + if (node->getName().find(preferedName + std::to_string(nameCount)) != std::string::npos) nameCount++; } if(nameCount) - finalName += to_string(nameCount); + finalName += std::to_string(nameCount); } newNode = new TravelNode(pos, finalName, isImportant); @@ -1230,7 +1230,7 @@ void TravelNodeMap::removeNode(TravelNode* node) void TravelNodeMap::fullLinkNode(TravelNode* startNode, Unit* bot) { WorldPosition* startPosition = startNode->getPosition(); - vector linkNodes = getNodes(*startPosition); + std::vector linkNodes = getNodes(*startPosition); for (auto& endNode : linkNodes) { @@ -1247,9 +1247,9 @@ void TravelNodeMap::fullLinkNode(TravelNode* startNode, Unit* bot) startNode->setLinked(true); } -vector TravelNodeMap::getNodes(WorldPosition pos, float range) +std::vector TravelNodeMap::getNodes(WorldPosition pos, float range) { - vector retVec; + std::vector retVec; for (auto& node : m_nodes) { if (node->getMapId() == pos.getMapId()) @@ -1262,7 +1262,7 @@ vector TravelNodeMap::getNodes(WorldPosition pos, float range) } -TravelNode* TravelNodeMap::getNode(WorldPosition pos, vector& ppath, Unit* bot, float range) +TravelNode* TravelNodeMap::getNode(WorldPosition pos, std::vector& ppath, Unit* bot, float range) { float x = pos.getX(); float y = pos.getY(); @@ -1273,7 +1273,7 @@ TravelNode* TravelNodeMap::getNode(WorldPosition pos, vector& ppa uint32 c = 0; - vector nodes = sTravelNodeMap.getNodes(pos, range); + std::vector nodes = sTravelNodeMap.getNodes(pos, range); for (auto& node : nodes) { if (!bot || pos.canPathTo(*node->getPosition(), bot)) @@ -1298,7 +1298,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni //Basic A* algoritm std::unordered_map m_stubs; - TravelNodeStub* startStub = &m_stubs.insert(make_pair(start, TravelNodeStub(start))).first->second; + TravelNodeStub* startStub = &m_stubs.insert(std::make_pair(start, TravelNodeStub(start))).first->second; TravelNodeStub* currentNode, * childNode; @@ -1331,7 +1331,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni PortalNode* portNode = new PortalNode(start); portNode->SetPortal(start, homeNode, 8690); - childNode = &m_stubs.insert(make_pair(portNode, TravelNodeStub(portNode))).first->second; + childNode = &m_stubs.insert(std::make_pair(portNode, TravelNodeStub(portNode))).first->second; childNode->m_g = std::max((uint32)2, (10 - AI_VALUE(uint32, "death count")) * MINUTE); //If we can walk there in 10 minutes, walk instead. childNode->m_h = childNode->dataNode->fDist(goal) / unitSpeed; @@ -1347,7 +1347,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni else startStub->currentGold = bot->GetMoney(); - vector teleSpells = { 3561,3562,3563,3565,3566,3567,18960 }; + std::vector teleSpells = { 3561,3562,3563,3565,3566,3567,18960 }; for (auto spellId : teleSpells) { @@ -1373,7 +1373,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni PortalNode* portNode = new PortalNode(start); portNode->SetPortal(start, homeNode, spellId); - childNode = &m_stubs.insert(make_pair(portNode, TravelNodeStub(portNode))).first->second; + childNode = &m_stubs.insert(std::make_pair(portNode, TravelNodeStub(portNode))).first->second; childNode->m_g = MINUTE; //If we can walk there in a minute. Walk instead. childNode->m_h = childNode->dataNode->fDist(goal) / unitSpeed; @@ -1415,7 +1415,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni { TravelNodeStub* parent = currentNode->parent; - vector path; + std::vector path; path.push_back(currentNode->dataNode); @@ -1425,7 +1425,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni parent = parent->parent; } - reverse(path.begin(), path.end()); + std::reverse(path.begin(), path.end()); return TravelNodeRoute(path, portNodes); } @@ -1439,7 +1439,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni if (linkCost <= 0) continue; - childNode = &m_stubs.insert(make_pair(linkNode, TravelNodeStub(linkNode))).first->second; + childNode = &m_stubs.insert(std::make_pair(linkNode, TravelNodeStub(linkNode))).first->second; g = currentNode->m_g + linkCost; // stance from start + distance between the two nodes if ((childNode->open || childNode->close) && childNode->m_g <= g) // n' is already in opend or closed with a lower cost g(n') @@ -1471,13 +1471,13 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Uni return TravelNodeRoute(); } -TravelNodeRoute TravelNodeMap::getRoute(WorldPosition startPos, WorldPosition endPos, vector& startPath, Unit* unit) +TravelNodeRoute TravelNodeMap::getRoute(WorldPosition startPos, WorldPosition endPos, std::vector& startPath, Unit* unit) { if (m_nodes.empty()) return TravelNodeRoute(); - vector newStartPath; - vector startNodes = m_nodes, endNodes = m_nodes; + std::vector newStartPath; + std::vector startNodes = m_nodes, endNodes = m_nodes; //Partial sort to get the closest 5 nodes at the begin of the array. std::partial_sort(startNodes.begin(), startNodes.begin() + 5, startNodes.end(), [startPos](TravelNode* i, TravelNode* j) {return i->fDist(startPos) < j->fDist(startPos); }); std::partial_sort(endNodes.begin(), endNodes.begin() + 5, endNodes.end(), [endPos](TravelNode* i, TravelNode* j) {return i->fDist(endPos) < j->fDist(endPos); }); @@ -1549,7 +1549,7 @@ TravelNodeRoute TravelNodeMap::getRoute(WorldPosition startPos, WorldPosition en TravelPath TravelNodeMap::getFullPath(WorldPosition startPos, WorldPosition endPos, Unit* unit) { TravelPath movePath; - vector beginPath, endPath; + std::vector beginPath, endPath; beginPath = endPos.getPathFromPath({ startPos }, unit, 40); @@ -1621,7 +1621,7 @@ bool TravelNodeMap::cropUselessNode(TravelNode* startNode) if (!startNode->isLinked() || startNode->isImportant()) return false; - vector ignore = { startNode }; + std::vector ignore = { startNode }; for (auto& node : getNodes(*startNode->getPosition(), 5000)) { @@ -1645,15 +1645,15 @@ TravelNode* TravelNodeMap::addZoneLinkNode(TravelNode* startNode) TravelNode* endNode = path.first; - string zoneName = startNode->getPosition()->getAreaName(true, true); + std::string zoneName = startNode->getPosition()->getAreaName(true, true); for (auto& pos : path.second.getPath()) { - string newZoneName = pos.getAreaName(true, true); + std::string newZoneName = pos.getAreaName(true, true); if (zoneName != newZoneName) { if (!getNode(pos, NULL, 100.0f)) { - string nodeName = zoneName + " to " + newZoneName; + std::string nodeName = zoneName + " to " + newZoneName; return sTravelNodeMap.addNode(pos, nodeName, false, true); } zoneName = newZoneName; @@ -1677,7 +1677,7 @@ TravelNode* TravelNodeMap::addRandomExtNode(TravelNode* startNode) auto random_it = std::next(std::begin(paths), urand(0, paths.size() - 1)); TravelNode* endNode = random_it->first; - vector path = random_it->second.getPath(); + std::vector path = random_it->second.getPath(); if (path.empty()) continue; @@ -1720,7 +1720,7 @@ void TravelNodeMap::manageNodes(Unit* bot, bool mapFull) //Pick random Node for (uint32 i = 0; i < (mapFull ? (uint32)20 : (uint32)1); i++) { - vector rnodes = getNodes(WorldPosition(bot)); + std::vector rnodes = getNodes(WorldPosition(bot)); if (!rnodes.empty()) { @@ -1762,7 +1762,7 @@ void TravelNodeMap::manageNodes(Unit* bot, bool mapFull) void TravelNodeMap::generateNpcNodes() { - unordered_map bossMap; + std::unordered_map bossMap; for (auto& creaturePair : WorldPosition().getCreaturesNear()) { @@ -1776,7 +1776,7 @@ void TravelNodeMap::generateNpcNodes() if (cInfo->NpcFlags & flagMask) { - string nodeName = guidP.getAreaName(false); + std::string nodeName = guidP.getAreaName(false); if (cInfo->NpcFlags & UNIT_NPC_FLAG_INNKEEPER) nodeName += " innkeeper"; @@ -1791,7 +1791,7 @@ void TravelNodeMap::generateNpcNodes() } else if (cInfo->Rank == 3) { - string nodeName = cInfo->Name; + std::string nodeName = cInfo->Name; sTravelNodeMap.addNode(guidP, nodeName, true, true); } @@ -1816,7 +1816,7 @@ void TravelNodeMap::generateNpcNodes() if (!cInfo) continue; - string nodeName = cInfo->Name; + std::string nodeName = cInfo->Name; sTravelNodeMap.addNode(guidP, nodeName, true, true); } @@ -1824,7 +1824,7 @@ void TravelNodeMap::generateNpcNodes() void TravelNodeMap::generateStartNodes() { - map startNames; + std::map startNames; startNames[RACE_HUMAN] = "Human"; startNames[RACE_ORC] = "Orc and Troll"; startNames[RACE_DWARF] = "Dwarf and Gnome"; @@ -1846,7 +1846,7 @@ void TravelNodeMap::generateStartNodes() WorldPosition pos(info->mapId, info->positionX, info->positionY, info->positionZ, info->orientation); - string nodeName = startNames[i] + " start"; + std::string nodeName = startNames[i] + " start"; sTravelNodeMap.addNode(pos, nodeName, true, true); @@ -1873,7 +1873,7 @@ void TravelNodeMap::generateAreaTriggerNodes() WorldPosition outPos = WorldPosition(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation); - string nodeName; + std::string nodeName; if (!outPos.isOverworld()) nodeName = outPos.getAreaName(false) + " entrance"; @@ -1901,7 +1901,7 @@ void TravelNodeMap::generateAreaTriggerNodes() WorldPosition outPos = WorldPosition(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation); - string nodeName; + std::string nodeName; if (!outPos.isOverworld()) nodeName = outPos.getAreaName(false) + " entrance"; @@ -2009,7 +2009,7 @@ void TravelNodeMap::generateTransportNodes() TaxiPathNodeList const& path = sTaxiPathNodesByPath[pathId]; - vector ppath; + std::vector ppath; TravelNode* prevNode = nullptr; //Elevators/Trams @@ -2142,7 +2142,7 @@ void TravelNodeMap::generateTransportNodes() if (exitPos.ClosestCorrectPoint(20.0f, 10.0f)) { - TravelNode* exitNode = sTravelNodeMap.addNode(exitPos, data->name + string(" dock"), true, true); + TravelNode* exitNode = sTravelNodeMap.addNode(exitPos, data->name + std::string(" dock"), true, true); TravelNodePath travelPath(exitPos.distance(pos), 0.0f, (uint8)TravelNodePathType::walk,0, true); travelPath.setPath({ exitPos, pos }); @@ -2206,7 +2206,7 @@ void TravelNodeMap::generateZoneMeanNodes() //Zone means for (auto& loc : sTravelMgr.getExploreLocs()) { - vector points; + std::vector points; for (auto p : loc.second->getPoints(true)) if (!p->isUnderWater()) @@ -2265,16 +2265,16 @@ void TravelNodeMap::generateWalkPathMap(uint32 mapId) void TravelNodeMap::generateWalkPaths() { //Pathfinder - vector ppath; + std::vector ppath; - map nodeMaps; + std::map nodeMaps; for (auto& startNode : sTravelNodeMap.getNodes()) { nodeMaps[startNode->getMapId()] = true; } - vector> calculations; + std::vector> calculations; BarGoLink bar(nodeMaps.size()); for (auto& map : nodeMaps) @@ -2296,9 +2296,9 @@ void TravelNodeMap::generateWalkPaths() void TravelNodeMap::generateHelperNodes(uint32 mapId) { - vector startNodes = getNodes(WorldPosition(mapId, 1, 1)); + std::vector startNodes = getNodes(WorldPosition(mapId, 1, 1)); - vector> places_to_reach; + std::vector> places_to_reach; //Find all places we might want to reach. for (auto& node : startNodes) @@ -2345,7 +2345,7 @@ void TravelNodeMap::generateHelperNodes(uint32 mapId) if (!ppoint.canPathTo(pos.first, nullptr)) continue; - string name = node->getName() + " to " + pos.second; + std::string name = node->getName() + " to " + pos.second; sTravelNodeMap.addNode(ppoint, name, false, true); found = true; @@ -2364,7 +2364,7 @@ void TravelNodeMap::generateHelperNodes(uint32 mapId) } if (!found) { - string name = pos.second; + std::string name = pos.second; sTravelNodeMap.addNode(pos.first, name, false, true); } @@ -2390,9 +2390,9 @@ void TravelNodeMap::generateHelperNodes(uint32 mapId) void TravelNodeMap::generateHelperNodes() { //Pathfinder - vector ppath; + std::vector ppath; - map nodeMaps; + std::map nodeMaps; uint32 old = sTravelNodeMap.getNodes().size(); @@ -2401,7 +2401,7 @@ void TravelNodeMap::generateHelperNodes() nodeMaps[startNode->getMapId()] = true; } - vector> calculations; + std::vector> calculations; BarGoLink bar(nodeMaps.size()); for (auto& map : nodeMaps) @@ -2452,7 +2452,7 @@ void TravelNodeMap::generateTaxiPaths() if (!startNode || !endNode) continue; - vector ppath; + std::vector ppath; for (auto& n : nodes) ppath.push_back(WorldPosition(n->mapid, n->x, n->y, n->z, 0.0)); @@ -2468,8 +2468,8 @@ void TravelNodeMap::generateTaxiPaths() void TravelNodeMap::removeLowNodes() { - vector goodNodes; - vector remNodes; + std::vector goodNodes; + std::vector remNodes; for (auto& node : sTravelNodeMap.getNodes()) { if (!node->getPosition()->isOverworld()) @@ -2481,7 +2481,7 @@ void TravelNodeMap::removeLowNodes() if (std::find(remNodes.begin(), remNodes.end(), node) != remNodes.end()) continue; - vector nodes = node->getNodeMap(true); + std::vector nodes = node->getNodeMap(true); if (nodes.size() < 5) remNodes.insert(remNodes.end(), nodes.begin(), nodes.end()); @@ -2532,16 +2532,16 @@ void TravelNodeMap::removeUselessPathMap(uint32 mapId) void TravelNodeMap::removeUselessPaths() { //Pathfinder - vector ppath; + std::vector ppath; - map nodeMaps; + std::map nodeMaps; for (auto& startNode : sTravelNodeMap.getNodes()) { nodeMaps[startNode->getMapId()] = true; } - vector> calculations; + std::vector> calculations; BarGoLink bar(nodeMaps.size()); for (auto& map : nodeMaps) @@ -2563,7 +2563,7 @@ void TravelNodeMap::calculatePathCosts() { BarGoLink bar(sTravelNodeMap.getNodes().size()); - vector> calculations; + std::vector> calculations; for (auto& startNode : sTravelNodeMap.getNodes()) { @@ -2655,7 +2655,7 @@ void TravelNodeMap::printMap() sPlayerbotAIConfig.openLog("travelNodes.csv", "w"); sPlayerbotAIConfig.openLog("travelPaths.csv", "w"); - vector anodes = getNodes(); + std::vector anodes = getNodes(); uint32 nr = 0; @@ -2667,7 +2667,7 @@ void TravelNodeMap::printMap() void TravelNodeMap::printNodeStore() { - string nodeStore = "TravelNodeStore.h"; + std::string nodeStore = "TravelNodeStore.h"; if (!sPlayerbotAIConfig.hasLog(nodeStore)) return; @@ -2679,7 +2679,7 @@ void TravelNodeMap::printNodeStore() std::unordered_map saveNodes; - vector anodes = getNodes(); + std::vector anodes = getNodes(); sPlayerbotAIConfig.log(nodeStore, "#pragma once"); sPlayerbotAIConfig.log(nodeStore, "#include \"TravelMgr.h\""); @@ -2696,12 +2696,12 @@ void TravelNodeMap::printNodeStore() { TravelNode* node = anodes[i]; - ostringstream out; + std::ostringstream out; - string name = node->getName(); + std::string name = node->getName(); name.erase(remove(name.begin(), name.end(), '\"'), name.end()); - // struct addNode {uint32 node; WorldPosition point; string name; bool isPortal; bool isTransport; uint32 transportId; }; + // struct addNode {uint32 node; WorldPosition point; std::string name; bool isPortal; bool isTransport; uint32 transportId; }; out << std::fixed << std::setprecision(2) << " addNodes.push_back(addNode{" << i << ","; out << "WorldPosition(" << node->getMapId() << ", " << node->getX() << "f, " << node->getY() << "f, " << node->getZ() << "f, " << node->getO() << "f),"; out << "\"" << name << "\""; @@ -2719,7 +2719,7 @@ void TravelNodeMap::printNodeStore() */ sPlayerbotAIConfig.log(nodeStore, out.str().c_str()); - saveNodes.insert(make_pair(node, i)); + saveNodes.insert(std::make_pair(node, i)); } for (uint32 i = 0; i < anodes.size(); i++) @@ -2728,7 +2728,7 @@ void TravelNodeMap::printNodeStore() for (auto& Link : *node->getLinks()) { - ostringstream out; + std::ostringstream out; // struct linkNode { uint32 node1; uint32 node2; float distance; float extraCost; bool isPortal; bool isTransport; uint32 maxLevelMob; uint32 maxLevelAlliance; uint32 maxLevelHorde; float swimDistance; }; @@ -2761,20 +2761,20 @@ void TravelNodeMap::saveNodeStore(bool force) WorldDatabase.PExecute("DELETE FROM ai_playerbot_travelnode_path"); std::unordered_map saveNodes; - vector anodes = sTravelNodeMap.getNodes(); + std::vector anodes = sTravelNodeMap.getNodes(); BarGoLink bar(anodes.size()); for (uint32 i = 0; i < anodes.size(); i++) { TravelNode* node = anodes[i]; - string name = node->getName(); + std::string name = node->getName(); name.erase(remove(name.begin(), name.end(), '\''), name.end()); WorldDatabase.PExecute("INSERT INTO `ai_playerbot_travelnode` (`id`, `name`, `map_id`, `x`, `y`, `z`, `linked`) VALUES ('%lu', '%s', '%d', '%f', '%f', '%f', '%d%')" , i, name.c_str(), node->getMapId(), node->getX(), node->getY(), node->getZ(), (node->isLinked() ? 1 : 0)); - saveNodes.insert(make_pair(node, i)); + saveNodes.insert(std::make_pair(node, i)); bar.step(); } @@ -2807,7 +2807,7 @@ void TravelNodeMap::saveNodeStore(bool force) paths++; - vector ppath = path->getPath(); + std::vector ppath = path->getPath(); for (uint32 j = 0; j < ppath.size(); j++) { @@ -2834,7 +2834,7 @@ void TravelNodeMap::saveNodeStore(bool force) void TravelNodeMap::loadNodeStore() { - string query = "SELECT id, name, map_id, x, y, z, linked FROM ai_playerbot_travelnode"; + std::string query = "SELECT id, name, map_id, x, y, z, linked FROM ai_playerbot_travelnode"; std::unordered_map saveNodes; @@ -2856,7 +2856,7 @@ void TravelNodeMap::loadNodeStore() else hasToGen = true; - saveNodes.insert(make_pair(fields[0].GetUInt32(), node)); + saveNodes.insert(std::make_pair(fields[0].GetUInt32(), node)); } while (result->NextRow()); @@ -2873,7 +2873,7 @@ void TravelNodeMap::loadNodeStore() { // 0 1 2 3 4 5 6 7 8 9 10 - string query = "SELECT node_id, to_node_id,type,object,distance,swim_distance, extra_cost,calculated, max_creature_0,max_creature_1,max_creature_2 FROM ai_playerbot_travelnode_link"; + std::string query = "SELECT node_id, to_node_id,type,object,distance,swim_distance, extra_cost,calculated, max_creature_0,max_creature_1,max_creature_2 FROM ai_playerbot_travelnode_link"; auto result = WorldDatabase.PQuery(query.c_str()); @@ -2909,7 +2909,7 @@ void TravelNodeMap::loadNodeStore() { // 0 1 2 3 4 5 6 - string query = "SELECT node_id, to_node_id, nr, map_id, x, y, z FROM ai_playerbot_travelnode_path order by node_id, to_node_id, nr"; + std::string query = "SELECT node_id, to_node_id, nr, map_id, x, y, z FROM ai_playerbot_travelnode_path order by node_id, to_node_id, nr"; auto result = WorldDatabase.PQuery(query.c_str()); @@ -2929,7 +2929,7 @@ void TravelNodeMap::loadNodeStore() TravelNodePath* path = startNode->getPathTo(endNode); - vector ppath = path->getPath(); + std::vector ppath = path->getPath(); ppath.push_back(WorldPosition(fields[3].GetUInt32(), fields[4].GetFloat(), fields[5].GetFloat(), fields[6].GetFloat())); path->setPath(ppath); @@ -2951,12 +2951,12 @@ void TravelNodeMap::loadNodeStore() void TravelNodeMap::calcMapOffset() { - mapOffsets.push_back(make_pair(0, WorldPosition(0, 0, 0, 0, 0))); - mapOffsets.push_back(make_pair(1, WorldPosition(1, -3680.0, 13670.0, 0, 0))); - mapOffsets.push_back(make_pair(530, WorldPosition(530, 15000.0, -20000.0, 0, 0))); - mapOffsets.push_back(make_pair(571, WorldPosition(571, 10000.0, 5000.0, 0, 0))); + mapOffsets.push_back(std::make_pair(0, WorldPosition(0, 0, 0, 0, 0))); + mapOffsets.push_back(std::make_pair(1, WorldPosition(1, -3680.0, 13670.0, 0, 0))); + mapOffsets.push_back(std::make_pair(530, WorldPosition(530, 15000.0, -20000.0, 0, 0))); + mapOffsets.push_back(std::make_pair(571, WorldPosition(571, 10000.0, 5000.0, 0, 0))); - vector mapIds; + std::vector mapIds; for (auto& node : m_nodes) { @@ -2967,7 +2967,7 @@ void TravelNodeMap::calcMapOffset() std::sort(mapIds.begin(), mapIds.end()); - vector min, max; + std::vector min, max; for (auto& mapId : mapIds) { @@ -3001,7 +3001,7 @@ void TravelNodeMap::calcMapOffset() //+X -> -Y for (auto& mapId : mapIds) { - mapOffsets.push_back(make_pair(mapId, WorldPosition(mapId, curPos.getX() - min[i].getX(), curPos.getY() - max[i].getY(), 0, 0))); + mapOffsets.push_back(std::make_pair(mapId, WorldPosition(mapId, curPos.getX() - min[i].getX(), curPos.getY() - max[i].getY(), 0, 0))); maxY = std::max(maxY, (max[i].getY() - min[i].getY() + 500)); curPos.setX(curPos.getX() + (max[i].getX() - min[i].getX() + 500)); diff --git a/playerbot/TravelNode.h b/playerbot/TravelNode.h index ef9979f6..be2b88d6 100644 --- a/playerbot/TravelNode.h +++ b/playerbot/TravelNode.h @@ -52,7 +52,7 @@ namespace ai //TravelNodePath(float distance1, float extraCost1, bool portal1 = false, uint32 portalId1 = 0, bool transport1 = false, bool calculated = false, uint8 maxLevelMob1 = 0, uint8 maxLevelAlliance1 = 0, uint8 maxLevelHorde1 = 0, float swimDistance1 = 0, bool flightPath1 = false); //Constructor - TravelNodePath(float distance = 0.1f, float extraCost = 0, uint8 pathType = (uint8)TravelNodePathType::walk, uint64 pathObject = 0, bool calculated = false, vector maxLevelCreature = { 0,0,0 }, float swimDistance = 0) + TravelNodePath(float distance = 0.1f, float extraCost = 0, uint8 pathType = (uint8)TravelNodePathType::walk, uint64 pathObject = 0, bool calculated = false, std::vector maxLevelCreature = { 0,0,0 }, float swimDistance = 0) : distance(distance), extraCost(extraCost), pathType(TravelNodePathType(pathType)), pathObject(pathObject), calculated(calculated), maxLevelCreature(maxLevelCreature), swimDistance(swimDistance) { if (pathType != (uint8)TravelNodePathType::walk) complete = true; }; @@ -63,7 +63,7 @@ namespace ai //Getters bool getComplete() { return complete || pathType != TravelNodePathType::walk; } - vector getPath() { return path; } + std::vector getPath() { return path; } TravelNodePathType getPathType() { return pathType; } uint64 getPathObject() { return pathObject; } @@ -71,17 +71,17 @@ namespace ai float getDistance() { return distance; } float getSwimDistance() { return swimDistance; } float getExtraCost() { return extraCost; } - vector getMaxLevelCreature() { return maxLevelCreature; } + std::vector getMaxLevelCreature() { return maxLevelCreature; } void setCalculated(bool calculated1 = true) { calculated = calculated1; } bool getCalculated() { return calculated; } - string print(); + std::string print(); //Setters void setComplete(bool complete1) { complete = complete1; } - void setPath(vector path1) { path = path1; } - void setPathAndCost(vector path1, float speed) { setPath(path1); calculateCost(true); extraCost = distance / speed; } + void setPath(std::vector path1) { path = path1; } + void setPathAndCost(std::vector path1, float speed) { setPath(path1); calculateCost(true); extraCost = distance / speed; } //void setPortal(bool portal1, uint32 portalId1 = 0) { portal = portal1; portalId = portalId1; } //void setTransport(bool transport1) { transport = transport1; } void setPathType(TravelNodePathType pathType1) { pathType = pathType1; } @@ -96,7 +96,7 @@ namespace ai bool complete = false; //List of WorldPositions to get to the destination. - vector path = {}; + std::vector path = {}; //The extra (loading/transport) time it takes to take this path. float extraCost = 0; @@ -107,7 +107,7 @@ namespace ai float distance = 0.1f; //Calculated mobs level along the way. - vector maxLevelCreature = { 0,0,0 }; //mobs, horde, alliance + std::vector maxLevelCreature = { 0,0,0 }; //mobs, horde, alliance //Calculated swiming distances along the way. float swimDistance = 0; @@ -136,7 +136,7 @@ namespace ai public: //Constructors TravelNode() {}; - TravelNode(WorldPosition point1, string nodeName1 = "Travel Node", bool important1 = false) { nodeName = nodeName1; point = point1; important = important1; } + TravelNode(WorldPosition point1, std::string nodeName1 = "Travel Node", bool important1 = false) { nodeName = nodeName1; point = point1; important = important1; } TravelNode(TravelNode* baseNode) { nodeName = baseNode->nodeName; point = baseNode->point; important = baseNode->important; } //Setters @@ -144,7 +144,7 @@ namespace ai void setPoint(WorldPosition point1) { point = point1; } //Getters - string getName() { return nodeName; }; + std::string getName() { return nodeName; }; WorldPosition* getPosition() { return &point; }; std::unordered_map* getPaths() { return &paths; } std::unordered_map* getLinks() { return &links; } @@ -194,7 +194,7 @@ namespace ai bool cropUselessLinks(); //Returns all nodes that can be reached from this node. - vector getNodeMap(bool importantOnly = false, vector ignoreNodes = {}, bool mapOnly = false); + std::vector getNodeMap(bool importantOnly = false, std::vector ignoreNodes = {}, bool mapOnly = false); //Checks if it is even possible to route to this node. bool hasRouteTo(TravelNode* node, bool mapOnly = false) { if (routes.empty()) for (auto mNode : getNodeMap(mapOnly)) routes[mNode] = true; return routes.find(node) != routes.end(); }; @@ -203,7 +203,7 @@ namespace ai void print(bool printFailed = true); protected: //Logical name of the node - string nodeName; + std::string nodeName; //WorldPosition of the node. WorldPosition point; @@ -268,29 +268,29 @@ namespace ai { public: TravelPath() {}; - TravelPath(vector fullPath1) { fullPath = fullPath1; } - TravelPath(vector path, PathNodeType type = PathNodeType::NODE_PATH, uint32 entry = 0) { addPath(path, type, entry); } + TravelPath(std::vector fullPath1) { fullPath = fullPath1; } + TravelPath(std::vector path, PathNodeType type = PathNodeType::NODE_PATH, uint32 entry = 0) { addPath(path, type, entry); } void addPoint(PathNodePoint point) { fullPath.push_back(point); } void addPoint(WorldPosition point, PathNodeType type = PathNodeType::NODE_PATH, uint32 entry = 0) { fullPath.push_back(PathNodePoint{ point, type, entry }); } - void addPath(vector path, PathNodeType type = PathNodeType::NODE_PATH, uint32 entry = 0) { for (auto& p : path) { fullPath.push_back(PathNodePoint{ p, type, entry }); }; } - void addPath(vector newPath) { fullPath.insert(fullPath.end(), newPath.begin(), newPath.end()); } + void addPath(std::vector path, PathNodeType type = PathNodeType::NODE_PATH, uint32 entry = 0) { for (auto& p : path) { fullPath.push_back(PathNodePoint{ p, type, entry }); }; } + void addPath(std::vector newPath) { fullPath.insert(fullPath.end(), newPath.begin(), newPath.end()); } void clear() { fullPath.clear(); } bool empty() { return fullPath.empty(); } - vector getPath() { return fullPath; } + std::vector getPath() { return fullPath; } WorldPosition getFront() { return fullPath.front().point; } WorldPosition getBack() { return fullPath.back().point; } - vector getPointPath() { vector retVec; for (const auto& p : fullPath) retVec.push_back(p.point); return retVec; }; + std::vector getPointPath() { std::vector retVec; for (const auto& p : fullPath) retVec.push_back(p.point); return retVec; }; bool makeShortCut(WorldPosition startPos, float maxDist, Unit* bot); - bool shouldMoveToNextPoint(WorldPosition startPos, vector::iterator beg, vector::iterator ed, vector::iterator p, float& moveDist, float maxDist); + bool shouldMoveToNextPoint(WorldPosition startPos, std::vector::iterator beg, std::vector::iterator ed, std::vector::iterator p, float& moveDist, float maxDist); WorldPosition getNextPoint(WorldPosition startPos, float maxDist, TravelNodePathType& pathType, uint32& entry, bool onTransport, WorldPosition& telePosition); - ostringstream print(); + std::ostringstream print(); private: - vector fullPath; + std::vector fullPath; }; //An stored A* search that gives a complete route from one node to another. @@ -298,26 +298,26 @@ namespace ai { public: TravelNodeRoute() {} - TravelNodeRoute(vector nodes1, vector tempNodes) { nodes = nodes1; if (tempNodes.size()) addTempNodes(tempNodes); } + TravelNodeRoute(std::vector nodes1, std::vector tempNodes) { nodes = nodes1; if (tempNodes.size()) addTempNodes(tempNodes); } bool isEmpty() { return nodes.empty(); } bool hasNode(TravelNode* node) { return findNode(node) != nodes.end(); } float getTotalDistance(); - void setNodes(vector nodes1) { nodes = nodes1; } - vector getNodes() { return nodes; } + void setNodes(std::vector nodes1) { nodes = nodes1; } + std::vector getNodes() { return nodes; } - void addTempNodes(vector nodes) { tempNodes.insert(tempNodes.end(), nodes.begin(), nodes.end()); } + void addTempNodes(std::vector nodes) { tempNodes.insert(tempNodes.end(), nodes.begin(), nodes.end()); } void cleanTempNodes() { for (auto node : tempNodes) delete node; } - TravelPath buildPath(vector pathToStart = {}, vector pathToEnd = {}, Unit* bot = nullptr); + TravelPath buildPath(std::vector pathToStart = {}, std::vector pathToEnd = {}, Unit* bot = nullptr); - ostringstream print(); + std::ostringstream print(); private: - vector::iterator findNode(TravelNode* node) { return std::find(nodes.begin(), nodes.end(), node); } - vector nodes; - vector tempNodes; + std::vector::iterator findNode(TravelNode* node) { return std::find(nodes.begin(), nodes.end(), node); } + std::vector nodes; + std::vector tempNodes; }; //A node container to aid A* calculations with nodes. @@ -340,28 +340,28 @@ namespace ai TravelNodeMap() {}; TravelNodeMap(TravelNodeMap* baseMap); - TravelNode* addNode(WorldPosition pos, string preferedName = "Travel Node", bool isImportant = false, bool checkDuplicate = true, bool transport = false, uint32 transportId = 0); + TravelNode* addNode(WorldPosition pos, std::string preferedName = "Travel Node", bool isImportant = false, bool checkDuplicate = true, bool transport = false, uint32 transportId = 0); void removeNode(TravelNode* node); bool removeNodes() { if (m_nMapMtx.try_lock_for(std::chrono::seconds(10))) { for (auto& node : m_nodes) removeNode(node); m_nMapMtx.unlock(); return true; } return false; }; void fullLinkNode(TravelNode* startNode, Unit* bot); //Get all nodes - vector getNodes() { return m_nodes; } - vector getNodes(WorldPosition pos, float range = -1); + std::vector getNodes() { return m_nodes; } + std::vector getNodes(WorldPosition pos, float range = -1); //Find nearest node. TravelNode* getNode(TravelNode* sameNode) { for (auto& node : m_nodes) { if (node->getName() == sameNode->getName() && node->getPosition() == sameNode->getPosition()) return node; } return nullptr; } - TravelNode* getNode(WorldPosition pos, vector& ppath, Unit* bot = nullptr, float range = -1); - TravelNode* getNode(WorldPosition pos, Unit* bot = nullptr, float range = -1) { vector ppath; return getNode(pos, ppath, bot, range); } + TravelNode* getNode(WorldPosition pos, std::vector& ppath, Unit* bot = nullptr, float range = -1); + TravelNode* getNode(WorldPosition pos, Unit* bot = nullptr, float range = -1) { std::vector ppath; return getNode(pos, ppath, bot, range); } //Get Random Node - TravelNode* getRandomNode(WorldPosition pos) { vector rNodes = getNodes(pos); if (rNodes.empty()) return nullptr; return rNodes[urand(0, rNodes.size() - 1)]; } + TravelNode* getRandomNode(WorldPosition pos) { std::vector rNodes = getNodes(pos); if (rNodes.empty()) return nullptr; return rNodes[urand(0, rNodes.size() - 1)]; } //Finds the best nodePath between two nodes TravelNodeRoute getRoute(TravelNode* start, TravelNode* goal, Unit* unit = nullptr); //Find the best node between two positions - TravelNodeRoute getRoute(WorldPosition startPos, WorldPosition endPos, vector& startPath, Unit* unit = nullptr); + TravelNodeRoute getRoute(WorldPosition startPos, WorldPosition endPos, std::vector& startPath, Unit* unit = nullptr); //Find the full path between those locations static TravelPath getFullPath(WorldPosition startPos, WorldPosition endPos, Unit* unit = nullptr); @@ -414,9 +414,9 @@ namespace ai std::shared_timed_mutex m_nMapMtx; private: - vector m_nodes; + std::vector m_nodes; - vector> mapOffsets; + std::vector> mapOffsets; bool hasToSave = false; bool hasToGen = false; diff --git a/playerbot/WorldPosition.cpp b/playerbot/WorldPosition.cpp index f4b4760c..968778eb 100644 --- a/playerbot/WorldPosition.cpp +++ b/playerbot/WorldPosition.cpp @@ -237,7 +237,7 @@ void WorldPosition::set(const ObjectGuid& guid, const uint32 mapId) } } -WorldPosition::WorldPosition(const vector& list, const WorldPositionConst conType) +WorldPosition::WorldPosition(const std::vector& list, const WorldPositionConst conType) { uint32 size = list.size(); if (size == 0) @@ -257,7 +257,7 @@ WorldPosition::WorldPosition(const vector& list, const WorldPosi add(); } -WorldPosition::WorldPosition(const vector& list, const WorldPositionConst conType) +WorldPosition::WorldPosition(const std::vector& list, const WorldPositionConst conType) { uint32 size = list.size(); if (size == 0) @@ -297,7 +297,7 @@ float WorldPosition::fDist(const WorldPosition& to) const //When moving from this along list return last point that falls within range. //Distance is move distance along path. -WorldPosition WorldPosition::lastInRange(const vector& list, const float minDist, const float maxDist) const +WorldPosition WorldPosition::lastInRange(const std::vector& list, const float minDist, const float maxDist) const { WorldPosition rPoint; @@ -338,7 +338,7 @@ WorldPosition WorldPosition::lastInRange(const vector& list, cons }; //Todo: remove or adjust to above standard. -WorldPosition WorldPosition::firstOutRange(const vector& list, const float minDist, const float maxDist) const +WorldPosition WorldPosition::firstOutRange(const std::vector& list, const float minDist, const float maxDist) const { WorldPosition rPoint; @@ -375,7 +375,7 @@ bool WorldPosition::isInside(const WorldPosition* p1, const WorldPosition* p2, c return !(has_neg && has_pos); } -void WorldPosition::distancePartition(const vector& distanceLimits, WorldPosition* to, vector>& partitions) const +void WorldPosition::distancePartition(const std::vector& distanceLimits, WorldPosition* to, std::vector>& partitions) const { float dist = distance(*to); @@ -384,9 +384,9 @@ void WorldPosition::distancePartition(const vector& distanceLimits, World partitions[l].push_back(to); } -vector> WorldPosition::distancePartition(const vector& distanceLimits, vector points) const +std::vector> WorldPosition::distancePartition(const std::vector& distanceLimits, std::vector points) const { - vector> partitions; + std::vector> partitions; for (auto lim : distanceLimits) partitions.push_back({}); @@ -438,9 +438,9 @@ G3D::Vector3 WorldPosition::getVector3() const return G3D::Vector3(coord_x, coord_y, coord_z); } -string WorldPosition::print() const +std::string WorldPosition::print() const { - ostringstream out; + std::ostringstream out; out << mapid << std::fixed << std::setprecision(2); out << ';'<< coord_x; out << ';' << coord_y; @@ -450,7 +450,7 @@ string WorldPosition::print() const return out.str(); } -void WorldPosition::printWKT(const vector& points, ostringstream& out, const uint32 dim, const bool loop) +void WorldPosition::printWKT(const std::vector& points, std::ostringstream& out, const uint32 dim, const bool loop) { switch (dim) { case 0: @@ -490,7 +490,7 @@ AreaTableEntry const* WorldPosition::getArea() const return GetAreaEntryByAreaFlagAndMap(areaFlag, getMapId()); } -string WorldPosition::getAreaName(const bool fullName, const bool zoneName) const +std::string WorldPosition::getAreaName(const bool fullName, const bool zoneName) const { if (!isOverworld()) { @@ -504,7 +504,7 @@ string WorldPosition::getAreaName(const bool fullName, const bool zoneName) cons if (!area) return ""; - string areaName = area->area_name[0]; + std::string areaName = area->area_name[0]; if (fullName) { @@ -517,7 +517,7 @@ string WorldPosition::getAreaName(const bool fullName, const bool zoneName) cons if (!parentArea) break; - string subAreaName = parentArea->area_name[0]; + std::string subAreaName = parentArea->area_name[0]; if (zoneName) areaName = subAreaName; @@ -615,9 +615,9 @@ std::vector WorldPosition::getGridPairs(const WorldPosition& secondPos return retVec; } -vector WorldPosition::fromGridPair(const GridPair& gridPair, uint32 mapId) +std::vector WorldPosition::fromGridPair(const GridPair& gridPair, uint32 mapId) { - vector retVec; + std::vector retVec; GridPair g; for (uint32 d = 0; d < 4; d++) @@ -635,9 +635,9 @@ vector WorldPosition::fromGridPair(const GridPair& gridPair, uint return retVec; } -vector WorldPosition::fromCellPair(const CellPair& cellPair) const +std::vector WorldPosition::fromCellPair(const CellPair& cellPair) const { - vector retVec; + std::vector retVec; CellPair p; for (uint32 d = 0; d < 4; d++) @@ -654,14 +654,14 @@ vector WorldPosition::fromCellPair(const CellPair& cellPair) cons return retVec; } -vector WorldPosition::gridFromCellPair(const CellPair& cellPair) const +std::vector WorldPosition::gridFromCellPair(const CellPair& cellPair) const { Cell c(cellPair); return fromGridPair(GridPair(c.GridX(), c.GridY()), getMapId()); } -vector> WorldPosition::getmGridPairs(const WorldPosition& secondPos) const +std::vector> WorldPosition::getmGridPairs(const WorldPosition& secondPos) const { std::vector retVec; @@ -680,16 +680,16 @@ vector> WorldPosition::getmGridPairs(const WorldPosition& secondPo { for (int y = ly - border; y <= uy + border; y++) { - retVec.push_back(make_pair(x, y)); + retVec.push_back(std::make_pair(x, y)); } } return retVec; } -vector WorldPosition::frommGridPair(const mGridPair& gridPair, uint32 mapId) +std::vector WorldPosition::frommGridPair(const mGridPair& gridPair, uint32 mapId) { - vector retVec; + std::vector retVec; mGridPair g; for (uint32 d = 0; d < 4; d++) @@ -709,7 +709,7 @@ vector WorldPosition::frommGridPair(const mGridPair& gridPair, ui bool WorldPosition::loadMapAndVMap(uint32 mapId, uint32 instanceId, int x, int y) { - string logName = "load_map_grid.csv"; + std::string logName = "load_map_grid.csv"; #ifndef MANGOSBOT_TWO if (MMAP::MMapFactory::createOrGetMMapManager()->IsMMapIsLoaded(mapId, x, y)) @@ -751,7 +751,7 @@ bool WorldPosition::loadMapAndVMap(uint32 mapId, uint32 instanceId, int x, int y if (sPlayerbotAIConfig.hasLog(logName)) { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr(); out << "+00,\"mmap\", " << x << "," << y << "," << (sTravelMgr.isBadMmap(mapId, x, y) ? "0" : "1") << ","; printWKT(frommGridPair(mGridPair(x, y), mapId), out, 1, true); @@ -777,9 +777,9 @@ void WorldPosition::unloadMapAndVMaps(uint32 mapId) #endif } -vector WorldPosition::fromPointsArray(const std::vector& path) const +std::vector WorldPosition::fromPointsArray(const std::vector& path) const { - vector retVec; + std::vector retVec; for (auto p : path) retVec.push_back(WorldPosition(getMapId(), p.x, p.y, p.z, getO())); @@ -787,7 +787,7 @@ vector WorldPosition::fromPointsArray(const std::vector WorldPosition::getPathStepFrom(const WorldPosition& startPos, const Unit* bot, bool forceNormalPath) const +std::vector WorldPosition::getPathStepFrom(const WorldPosition& startPos, const Unit* bot, bool forceNormalPath) const { std::hash hasher; uint32 instanceId; @@ -848,7 +848,7 @@ vector WorldPosition::getPathStepFrom(const WorldPosition& startP if (sPlayerbotAIConfig.hasLog("pathfind_attempt_point.csv")) { - ostringstream out; + std::ostringstream out; out << std::fixed << std::setprecision(1); printWKT({ startPos, *this }, out); sPlayerbotAIConfig.log("pathfind_attempt_point.csv", out.str().c_str()); @@ -856,7 +856,7 @@ vector WorldPosition::getPathStepFrom(const WorldPosition& startP if (sPlayerbotAIConfig.hasLog("pathfind_attempt.csv") && (type == PATHFIND_INCOMPLETE || type == PATHFIND_NORMAL)) { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << std::fixed << std::setprecision(1) << type << ","; printWKT(fromPointsArray(points), out, 1); @@ -870,7 +870,7 @@ vector WorldPosition::getPathStepFrom(const WorldPosition& startP } -bool WorldPosition::cropPathTo(vector& path, const float maxDistance) const +bool WorldPosition::cropPathTo(std::vector& path, const float maxDistance) const { if (path.empty()) return false; @@ -888,7 +888,7 @@ bool WorldPosition::cropPathTo(vector& path, const float maxDista } //A sequential series of pathfinding attempts. Returns the complete path and if the patfinder eventually found a way to the destination. -vector WorldPosition::getPathFromPath(const vector& startPath, const Unit* bot, uint8 maxAttempt) const +std::vector WorldPosition::getPathFromPath(const std::vector& startPath, const Unit* bot, uint8 maxAttempt) const { //We start at the end of the last path. WorldPosition currentPos = startPath.back(); @@ -897,7 +897,7 @@ vector WorldPosition::getPathFromPath(const vector if (getMapId() != currentPos.getMapId()) return { }; - vector subPath, fullPath = startPath; + std::vector subPath, fullPath = startPath; //Limit the pathfinding attempts for (uint32 i = 0; i < maxAttempt; i++) @@ -963,7 +963,7 @@ bool WorldPosition::GetReachableRandomPointOnGround(const Player* bot, const flo #endif } -vector WorldPosition::ComputePathToRandomPoint(const Player* bot, const float radius, const bool randomRange) +std::vector WorldPosition::ComputePathToRandomPoint(const Player* bot, const float radius, const bool randomRange) { WorldPosition start = *this; @@ -976,7 +976,7 @@ vector WorldPosition::ComputePathToRandomPoint(const Player* bot, coord_x += range * cos(angle); coord_y += range * sin(angle); - vector path = getPathStepFrom(start, bot); + std::vector path = getPathStepFrom(start, bot); if (path.size()) set(path.back()); @@ -986,7 +986,7 @@ vector WorldPosition::ComputePathToRandomPoint(const Player* bot, return path; } -uint32 WorldPosition::getUnitsAggro(const list& units, const Player* bot) const +uint32 WorldPosition::getUnitsAggro(const std::list& units, const Player* bot) const { uint32 count = 0; for (auto guid : units) @@ -1028,14 +1028,14 @@ bool FindPointGameObjectData::operator()(GameObjectDataPair const& dataPair) return false; } -vector WorldPosition::getCreaturesNear(const float radius, const uint32 entry) const +std::vector WorldPosition::getCreaturesNear(const float radius, const uint32 entry) const { FindPointCreatureData worker(*this, radius, entry); sObjectMgr.DoCreatureData(worker); return worker.GetResult(); } -vector WorldPosition::getGameObjectsNear(const float radius, const uint32 entry) const +std::vector WorldPosition::getGameObjectsNear(const float radius, const uint32 entry) const { FindPointGameObjectData worker(*this, radius, entry); sObjectMgr.DoGOData(worker); diff --git a/playerbot/WorldPosition.h b/playerbot/WorldPosition.h index 63a445ec..ac0a4751 100644 --- a/playerbot/WorldPosition.h +++ b/playerbot/WorldPosition.h @@ -15,8 +15,6 @@ namespace G3D class Vector4; } -using namespace std; - namespace ai { //Constructor types for WorldPosition @@ -30,7 +28,7 @@ namespace ai class GuidPosition; - typedef pair mGridPair; + typedef std::pair mGridPair; //Extension of WorldLocation with distance functions. class WorldPosition : public WorldLocation @@ -42,15 +40,15 @@ namespace ai WorldPosition() : WorldLocation() { add(); }; WorldPosition(const WorldLocation& loc) : WorldLocation(loc) { add(); } WorldPosition(const WorldPosition& pos) : WorldLocation(pos) { add(); } - WorldPosition(const string str) {char p; stringstream out(str); out >> mapid >> p >> coord_x >> p >> coord_y >> p >> coord_z >> p >> orientation; add();} + WorldPosition(const std::string str) {char p; std::stringstream out(str); out >> mapid >> p >> coord_x >> p >> coord_y >> p >> coord_z >> p >> orientation; add();} WorldPosition(const uint32 mapid, const float x, const float y, const float z = 0, float orientation = 0) : WorldLocation(mapid, x, y, z, orientation) { add(); } WorldPosition(const uint32 mapId, const Position& pos) : WorldLocation(mapId, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetPositionO()) { add(); } WorldPosition(const WorldObject* wo) { if (wo) { set(WorldLocation(wo->GetMapId(), wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ(), wo->GetOrientation())); } add();} WorldPosition(const CreatureDataPair* cdPair) { if (cdPair) { set(WorldLocation(cdPair->second.mapid, cdPair->second.posX, cdPair->second.posY, cdPair->second.posZ, cdPair->second.orientation)); } add();} WorldPosition(const GameObjectDataPair* cdPair) { if (cdPair) { set(WorldLocation(cdPair->second.mapid, cdPair->second.posX, cdPair->second.posY, cdPair->second.posZ, cdPair->second.orientation)); } add();} WorldPosition(const uint32 mapId, const GuidPosition& guidP); - WorldPosition(const vector& list, const WorldPositionConst conType); - WorldPosition(const vector& list, const WorldPositionConst conType); + WorldPosition(const std::vector& list, const WorldPositionConst conType); + WorldPosition(const std::vector& list, const WorldPositionConst conType); WorldPosition(const uint32 mapid, const GridPair grid) : WorldLocation(mapid, (int32(grid.x_coord) - CENTER_GRID_ID - 0.5)* SIZE_OF_GRIDS + CENTER_GRID_OFFSET, (int32(grid.y_coord) - CENTER_GRID_ID - 0.5)* SIZE_OF_GRIDS + CENTER_GRID_OFFSET, 0, 0) { add(); } WorldPosition(const uint32 mapid, const CellPair cell) : WorldLocation(mapid, (int32(cell.x_coord) - CENTER_GRID_CELL_ID - 0.5)* SIZE_OF_GRID_CELL + CENTER_GRID_CELL_OFFSET, (int32(cell.y_coord) - CENTER_GRID_CELL_ID - 0.5)* SIZE_OF_GRID_CELL + CENTER_GRID_CELL_OFFSET, 0, 0) { add(); } WorldPosition(const uint32 mapid, const mGridPair grid) : WorldLocation(mapid, (32 - grid.first)* SIZE_OF_GRIDS, (32 - grid.second)* SIZE_OF_GRIDS, 0, 0) { add(); } @@ -101,11 +99,11 @@ namespace ai float getZ() const { return coord_z; } float getO() const { return orientation; } G3D::Vector3 getVector3() const; - virtual string print() const; - virtual string to_string() const { char p = '|'; stringstream out; out << mapid << p << coord_x << p << coord_y << p << coord_z << p << orientation; return out.str(); }; + virtual std::string print() const; + virtual std::string to_string() const { char p = '|'; std::stringstream out; out << mapid << p << coord_x << p << coord_y << p << coord_z << p << orientation; return out.str(); }; - static void printWKT(const vector& points, ostringstream& out, const uint32 dim = 0, const bool loop = false); - void printWKT(ostringstream& out) const { printWKT({ *this }, out); } + static void printWKT(const std::vector& points, std::ostringstream& out, const uint32 dim = 0, const bool loop = false); + void printWKT(std::ostringstream& out) const { printWKT({ *this }, out); } bool isOverworld() const { return mapid == 0 || mapid == 1 || mapid == 530 || mapid == 571; } bool isInWater() const { return getTerrain() ? getTerrain()->IsInWater(coord_x, coord_y, coord_z) : false; }; @@ -121,21 +119,21 @@ namespace ai float fDist(const WorldPosition& to) const; //Returns the closest point from the list. - WorldPosition* closest(const vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition* i, WorldPosition* j) {return this->distance(*i) < this->distance(*j); }); } - WorldPosition closest(const vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition i, WorldPosition j) {return this->distance(i) < this->distance(j); }); } + WorldPosition* closest(const std::vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition* i, WorldPosition* j) {return this->distance(*i) < this->distance(*j); }); } + WorldPosition closest(const std::vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition i, WorldPosition j) {return this->distance(i) < this->distance(j); }); } - WorldPosition* furtest(const vector& list) const { return *std::max_element(list.begin(), list.end(), [this](WorldPosition* i, WorldPosition* j) {return this->distance(*i) < this->distance(*j); }); } - WorldPosition furtest(const vector& list) const { return *std::max_element(list.begin(), list.end(), [this](WorldPosition i, WorldPosition j) {return this->distance(i) < this->distance(j); }); } + WorldPosition* furtest(const std::vector& list) const { return *std::max_element(list.begin(), list.end(), [this](WorldPosition* i, WorldPosition* j) {return this->distance(*i) < this->distance(*j); }); } + WorldPosition furtest(const std::vector& list) const { return *std::max_element(list.begin(), list.end(), [this](WorldPosition i, WorldPosition j) {return this->distance(i) < this->distance(j); }); } template - pair closest(const list>& list) const { return *std::min_element(list.begin(), list.end(), [this](pair i, pair j) {return this->distance(i.second) < this->distance(j.second); }); } + std::pair closest(const std::list>& list) const { return *std::min_element(list.begin(), list.end(), [this](std::pair i, std::pair j) {return this->distance(i.second) < this->distance(j.second); }); } template - pair closest(const list& list) const { return closest(GetPosList(list)); } + std::pair closest(const std::list& list) const { return closest(GetPosList(list)); } template - pair closest(const vector>& list) const { return *std::min_element(list.begin(), list.end(), [this](pair i, pair j) {return this->distance(i.second) < this->distance(j.second); }); } + std::pair closest(const std::vector>& list) const { return *std::min_element(list.begin(), list.end(), [this](std::pair i, std::pair j) {return this->distance(i.second) < this->distance(j.second); }); } template - pair closest(const vector& list) const { return closest(GetPosVector(list)); } + std::pair closest(const std::vector& list) const { return closest(GetPosVector(list)); } //Quick square distance in 2d plane. @@ -145,8 +143,8 @@ namespace ai float sqDistance(const WorldPosition& to) const { return (coord_x - to.coord_x) * (coord_x - to.coord_x) + (coord_y - to.coord_y) * (coord_y - to.coord_y) + (coord_z - to.coord_z) * (coord_z - to.coord_z); }; //Returns the closest point of the list. Fast but only works for the same map. - WorldPosition* closestSq(const vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition* i, WorldPosition* j) {return sqDistance(*i) < sqDistance(*j); }); } - WorldPosition closestSq(const vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition i, WorldPosition j) {return sqDistance(i) < sqDistance(j); }); } + WorldPosition* closestSq(const std::vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition* i, WorldPosition* j) {return sqDistance(*i) < sqDistance(*j); }); } + WorldPosition closestSq(const std::vector& list) const { return *std::min_element(list.begin(), list.end(), [this](WorldPosition i, WorldPosition j) {return sqDistance(i) < sqDistance(j); }); } float getAngleTo(const WorldPosition& endPos) const { float ang = atan2(endPos.coord_y - coord_y, endPos.coord_x - coord_x); return (ang >= 0) ? ang : 2 * M_PI_F + ang; }; float getAngleBetween(const WorldPosition& dir1, const WorldPosition& dir2) const { return abs(getAngleTo(dir1) - getAngleTo(dir2)); }; @@ -155,14 +153,14 @@ namespace ai WorldPosition limit(const WorldPosition& center, const float maxDistance) { WorldPosition pos(*this); pos -= center; float size = pos.size(); if (size > maxDistance) { pos /= pos.size(); pos *= maxDistance; pos += center; } return pos; } - WorldPosition lastInRange(const vector& list, const float minDist = -1, const float maxDist = -1) const; - WorldPosition firstOutRange(const vector& list, const float minDist = -1, const float maxDist = -1) const; + WorldPosition lastInRange(const std::vector& list, const float minDist = -1, const float maxDist = -1) const; + WorldPosition firstOutRange(const std::vector& list, const float minDist = -1, const float maxDist = -1) const; float mSign(const WorldPosition* p1, const WorldPosition* p2) const { return(coord_x - p2->coord_x) * (p1->coord_y - p2->coord_y) - (p1->coord_x - p2->coord_x) * (coord_y - p2->coord_y); } bool isInside(const WorldPosition* p1, const WorldPosition* p2, const WorldPosition* p3) const; - void distancePartition(const vector& distanceLimits, WorldPosition* to, vector>& partition) const; - vector> distancePartition(const vector& distanceLimits, vector points) const; + void distancePartition(const std::vector& distanceLimits, WorldPosition* to, std::vector>& partition) const; + std::vector> distancePartition(const std::vector& distanceLimits, std::vector points) const; //Map functions. Player independent. const MapEntry* getMapEntry() const { return sMapStore.LookupEntry(mapid); } @@ -202,17 +200,17 @@ namespace ai GridPair getGridPair() const { return MaNGOS::ComputeGridPair(coord_x, coord_y); }; std::vector getGridPairs(const WorldPosition& secondPos) const; - static vector fromGridPair(const GridPair& gridPair, uint32 mapId); + static std::vector fromGridPair(const GridPair& gridPair, uint32 mapId); CellPair getCellPair() const { return MaNGOS::ComputeCellPair(coord_x, coord_y); } - vector fromCellPair(const CellPair& cellPair) const; - vector gridFromCellPair(const CellPair& cellPair) const; + std::vector fromCellPair(const CellPair& cellPair) const; + std::vector gridFromCellPair(const CellPair& cellPair) const; mGridPair getmGridPair() const { - return make_pair((int)(32 - coord_x / SIZE_OF_GRIDS), (int)(32 - coord_y / SIZE_OF_GRIDS)); } + return std::make_pair((int)(32 - coord_x / SIZE_OF_GRIDS), (int)(32 - coord_y / SIZE_OF_GRIDS)); } - vector getmGridPairs(const WorldPosition& secondPos) const; - static vector frommGridPair(const mGridPair& gridPair, uint32 mapId); + std::vector getmGridPairs(const WorldPosition& secondPos) const; + static std::vector frommGridPair(const mGridPair& gridPair, uint32 mapId); static bool loadMapAndVMap(uint32 mapId, uint32 instanceId, int x, int y); @@ -228,33 +226,33 @@ namespace ai bool isValid() const { return MaNGOS::IsValidMapCoord(coord_x, coord_y, coord_z, orientation); }; uint16 getAreaFlag() const { return isValid() ? sTerrainMgr.GetAreaFlag(getMapId(), coord_x, coord_y, coord_z) : 0; }; AreaTableEntry const* getArea() const; - string getAreaName(const bool fullName = true, const bool zoneName = false) const; + std::string getAreaName(const bool fullName = true, const bool zoneName = false) const; int32 getAreaLevel() const; - vector fromPointsArray(const std::vector& path) const; + std::vector fromPointsArray(const std::vector& path) const; //Pathfinding - vector getPathStepFrom(const WorldPosition& startPos, const Unit* bot, bool forceNormalPath = false) const; - vector getPathFromPath(const vector& startPath, const Unit* bot, const uint8 maxAttempt = 40) const; - vector getPathFrom(const WorldPosition& startPos, const Unit* bot) { return getPathFromPath({ startPos }, bot); }; - vector getPathTo(WorldPosition endPos, const Unit* bot) const { return endPos.getPathFrom(*this, bot); } - bool isPathTo(const vector& path, float const maxDistance = sPlayerbotAIConfig.targetPosRecalcDistance) const { return !path.empty() && distance(path.back()) < maxDistance; }; - bool cropPathTo(vector& path, const float maxDistance = sPlayerbotAIConfig.targetPosRecalcDistance) const; - bool canPathStepTo(WorldPosition& endPos, const Unit* bot) const { vector path = endPos.getPathStepFrom(*this, bot); bool canPath = endPos.isPathTo(path); if (!path.empty()) endPos = path.back(); return canPath; } + std::vector getPathStepFrom(const WorldPosition& startPos, const Unit* bot, bool forceNormalPath = false) const; + std::vector getPathFromPath(const std::vector& startPath, const Unit* bot, const uint8 maxAttempt = 40) const; + std::vector getPathFrom(const WorldPosition& startPos, const Unit* bot) { return getPathFromPath({ startPos }, bot); }; + std::vector getPathTo(WorldPosition endPos, const Unit* bot) const { return endPos.getPathFrom(*this, bot); } + bool isPathTo(const std::vector& path, float const maxDistance = sPlayerbotAIConfig.targetPosRecalcDistance) const { return !path.empty() && distance(path.back()) < maxDistance; }; + bool cropPathTo(std::vector& path, const float maxDistance = sPlayerbotAIConfig.targetPosRecalcDistance) const; + bool canPathStepTo(WorldPosition& endPos, const Unit* bot) const { std::vector path = endPos.getPathStepFrom(*this, bot); bool canPath = endPos.isPathTo(path); if (!path.empty()) endPos = path.back(); return canPath; } bool canPathTo(const WorldPosition& endPos, const Unit* bot) const { return endPos.isPathTo(getPathTo(endPos, bot)); } - float getPathLength(const vector& points) const { float dist = 0.0f; for (auto& p : points) if (&p == &points.front()) dist = 0; else dist += std::prev(&p, 1)->distance(p); return dist; } + float getPathLength(const std::vector& points) const { float dist = 0.0f; for (auto& p : points) if (&p == &points.front()) dist = 0; else dist += std::prev(&p, 1)->distance(p); return dist; } bool ClosestCorrectPoint(float maxRange, float maxHeight = 5.0f); bool GetReachableRandomPointOnGround(const Player* bot, const float radius, const bool randomRange = true); //Generic terrain. - vector ComputePathToRandomPoint(const Player* bot, const float radius, const bool randomRange = true); //For use with transports. + std::vector ComputePathToRandomPoint(const Player* bot, const float radius, const bool randomRange = true); //For use with transports. - uint32 getUnitsAggro(const list& units, const Player* bot) const; + uint32 getUnitsAggro(const std::list& units, const Player* bot) const; //Creatures - vector getCreaturesNear(const float radius = 0, const uint32 entry = 0) const; + std::vector getCreaturesNear(const float radius = 0, const uint32 entry = 0) const; //GameObjects - vector getGameObjectsNear(const float radius = 0, const uint32 entry = 0) const; + std::vector getGameObjectsNear(const float radius = 0, const uint32 entry = 0) const; }; inline ByteBuffer& operator<<(ByteBuffer& b, WorldPosition& guidP) @@ -290,13 +288,13 @@ namespace ai FindPointCreatureData(WorldPosition point1 = WorldPosition(), float radius1 = 0, uint32 entry1 = 0) { point = point1; radius = radius1; entry = entry1; } bool operator()(CreatureDataPair const& dataPair); - vector GetResult() const { return data; }; + std::vector GetResult() const { return data; }; private: WorldPosition point; float radius; uint32 entry; - vector data; + std::vector data; }; //Generic gameObject finder @@ -306,12 +304,12 @@ namespace ai FindPointGameObjectData(WorldPosition point1 = WorldPosition(), float radius1 = 0, uint32 entry1 = 0) { point = point1; radius = radius1; entry = entry1; } bool operator()(GameObjectDataPair const& dataPair); - vector GetResult() const { return data; }; + std::vector GetResult() const { return data; }; private: WorldPosition point; float radius; uint32 entry; - vector data; + std::vector data; }; } diff --git a/playerbot/strategy/Action.h b/playerbot/strategy/Action.h index fded6781..27679de5 100644 --- a/playerbot/strategy/Action.h +++ b/playerbot/strategy/Action.h @@ -18,7 +18,7 @@ namespace ai class NextAction { public: - NextAction(string name, float relevance = 0.0f) + NextAction(std::string name, float relevance = 0.0f) { this->name = name; this->relevance = relevance; @@ -30,7 +30,7 @@ namespace ai } public: - string getName() const { return name; } + std::string getName() const { return name; } float getRelevance() const { return relevance; } public: @@ -59,7 +59,7 @@ namespace ai class Action : public AiNamedObject { public: - Action(PlayerbotAI* ai, string name = "action", uint32 duration = sPlayerbotAIConfig.reactDelay) : AiNamedObject(ai, name), verbose(false), duration(duration) {} + Action(PlayerbotAI* ai, std::string name = "action", uint32 duration = sPlayerbotAIConfig.reactDelay) : AiNamedObject(ai, name), verbose(false), duration(duration) {} virtual ~Action(void) {} public: @@ -75,7 +75,7 @@ namespace ai void Reset() {} virtual Unit* GetTarget(); virtual Value* GetTargetValue(); - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } void MakeVerbose() { verbose = true; } void setRelevance(float relevance1) { relevance = relevance1; }; @@ -89,10 +89,10 @@ namespace ai virtual bool ShouldReactionInterruptMovement() const { return false; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dummy"; } //Must equal internal name - virtual string GetHelpDescription() { return "This is an action."; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return {}; } + virtual std::string GetHelpName() { return "dummy"; } //Must equal internal name + virtual std::string GetHelpDescription() { return "This is an action."; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return {}; } #endif uint32 GetDuration() const { return duration; } @@ -114,7 +114,7 @@ namespace ai class ActionNode { public: - ActionNode(string name, NextAction** prerequisites = NULL, NextAction** alternatives = NULL, NextAction** continuers = NULL) + ActionNode(std::string name, NextAction** prerequisites = NULL, NextAction** alternatives = NULL, NextAction** continuers = NULL) { this->action = NULL; this->name = name; @@ -133,7 +133,7 @@ namespace ai public: Action* getAction() { return action; } void setAction(Action* action) { this->action = action; } - string getName() { return name; } + std::string getName() { return name; } public: NextAction** getContinuers() { return NextAction::merge(NextAction::clone(continuers), action->getContinuers()); } @@ -141,7 +141,7 @@ namespace ai NextAction** getPrerequisites() { return NextAction::merge(NextAction::clone(prerequisites), action->getPrerequisites()); } private: - string name; + std::string name; Action* action; NextAction** continuers; NextAction** alternatives; diff --git a/playerbot/strategy/AiObject.h b/playerbot/strategy/AiObject.h index fbb0a298..423f3b62 100644 --- a/playerbot/strategy/AiObject.h +++ b/playerbot/strategy/AiObject.h @@ -24,13 +24,13 @@ namespace ai class AiNamedObject : public AiObject { public: - AiNamedObject(PlayerbotAI* ai, string name) : AiObject(ai), name(name) {} + AiNamedObject(PlayerbotAI* ai, std::string name) : AiObject(ai), name(name) {} public: - virtual string getName() { return name; } + virtual std::string getName() { return name; } protected: - string name; + std::string name; }; } @@ -569,30 +569,30 @@ class clazz : public BuffOnPartyAction \ // node_name , action, prerequisite #define ACTION_NODE_P(name, spell, pre) \ -static ActionNode* name(PlayerbotAI* ai) \ - { \ - return new ActionNode(spell, \ - /*P*/ NextAction::array(0, new NextAction(pre), NULL), \ - /*A*/ NULL, \ - /*C*/ NULL); \ +static ActionNode* name(PlayerbotAI* ai) \ + { \ + return new ActionNode(spell, \ + /*P*/ NextAction::array(0, new NextAction(pre), NULL), \ + /*A*/ NULL, \ + /*C*/ NULL); \ } // node_name , action, alternative #define ACTION_NODE_A(name, spell, alt) \ -static ActionNode* name(PlayerbotAI* ai) \ - { \ - return new ActionNode(spell, \ - /*P*/ NULL, \ - /*A*/ NextAction::array(0, new NextAction(alt), NULL), \ - /*C*/ NULL); \ +static ActionNode* name(PlayerbotAI* ai) \ + { \ + return new ActionNode(spell, \ + /*P*/ NULL, \ + /*A*/ NextAction::array(0, new NextAction(alt), NULL), \ + /*C*/ NULL); \ } // node_name , action, continuer #define ACTION_NODE_C(name, spell, con) \ -static ActionNode* name(PlayerbotAI* ai) \ - { \ - return new ActionNode(spell, \ - /*P*/ NULL, \ - /*A*/ NULL, \ - /*C*/ NextAction::array(0, new NextAction(con), NULL)); \ +static ActionNode* name(PlayerbotAI* ai) \ + { \ + return new ActionNode(spell, \ + /*P*/ NULL, \ + /*A*/ NULL, \ + /*C*/ NextAction::array(0, new NextAction(con), NULL)); \ } diff --git a/playerbot/strategy/AiObjectContext.cpp b/playerbot/strategy/AiObjectContext.cpp index 56f0e090..e32c58f1 100644 --- a/playerbot/strategy/AiObjectContext.cpp +++ b/playerbot/strategy/AiObjectContext.cpp @@ -36,26 +36,26 @@ AiObjectContext::AiObjectContext(PlayerbotAI* ai) : PlayerbotAIAware(ai) //valueContexts.Add(&sSharedValueContext); } -void AiObjectContext::ClearValues(string findName) +void AiObjectContext::ClearValues(std::string findName) { - set names = valueContexts.GetCreated(); - for (set::iterator i = names.begin(); i != names.end(); ++i) + std::set names = valueContexts.GetCreated(); + for (std::set::iterator i = names.begin(); i != names.end(); ++i) { UntypedValue* value = GetUntypedValue(*i); if (!value) continue; - if (!findName.empty() && i->find(findName) == string::npos) + if (!findName.empty() && i->find(findName) == std::string::npos) continue; valueContexts.Erase(*i); } } -void AiObjectContext::ClearExpiredValues(string findName, uint32 interval) +void AiObjectContext::ClearExpiredValues(std::string findName, uint32 interval) { - set names = valueContexts.GetCreated(); - for (set::iterator i = names.begin(); i != names.end(); ++i) + std::set names = valueContexts.GetCreated(); + for (std::set::iterator i = names.begin(); i != names.end(); ++i) { UntypedValue* value = GetUntypedValue(*i); if (!value) @@ -64,7 +64,7 @@ void AiObjectContext::ClearExpiredValues(string findName, uint32 interval) if (value->Protected()) continue; - if (!findName.empty() && i->find(findName) == string::npos) + if (!findName.empty() && i->find(findName) == std::string::npos) continue; if (!interval && !value->Expired()) @@ -78,20 +78,20 @@ void AiObjectContext::ClearExpiredValues(string findName, uint32 interval) } -string AiObjectContext::FormatValues(string findName) +std::string AiObjectContext::FormatValues(std::string findName) { - ostringstream out; - set names = valueContexts.GetCreated(); - for (set::iterator i = names.begin(); i != names.end(); ++i) + std::ostringstream out; + std::set names = valueContexts.GetCreated(); + for (std::set::iterator i = names.begin(); i != names.end(); ++i) { UntypedValue* value = GetUntypedValue(*i); if (!value) continue; - if (!findName.empty() && i->find(findName) == string::npos) + if (!findName.empty() && i->find(findName) == std::string::npos) continue; - string text = value->Format(); + std::string text = value->Format(); if (text == "?") continue; @@ -119,23 +119,23 @@ void AiObjectContext::Reset() valueContexts.Reset(); } -list AiObjectContext::Save() +std::list AiObjectContext::Save() { - list result; + std::list result; - set names = valueContexts.GetCreated(); - for (set::iterator i = names.begin(); i != names.end(); ++i) + std::set names = valueContexts.GetCreated(); + for (std::set::iterator i = names.begin(); i != names.end(); ++i) { UntypedValue* value = GetUntypedValue(*i); if (!value) continue; - string data = value->Save(); + std::string data = value->Save(); if (data == "?") continue; - string name = *i; - ostringstream out; + std::string name = *i; + std::ostringstream out; out << name; out << ">" << data; @@ -144,16 +144,16 @@ list AiObjectContext::Save() return result; } -void AiObjectContext::Load(list data) +void AiObjectContext::Load(std::list data) { - for (list::iterator i = data.begin(); i != data.end(); ++i) + for (std::list::iterator i = data.begin(); i != data.end(); ++i) { - string row = *i; - vector parts = split(row, '>'); + std::string row = *i; + std::vector parts = split(row, '>'); if (parts.size() != 2) continue; - string name = parts[0]; - string text = parts[1]; + std::string name = parts[0]; + std::string text = parts[1]; UntypedValue* value = GetUntypedValue(name); if (!value) continue; diff --git a/playerbot/strategy/AiObjectContext.h b/playerbot/strategy/AiObjectContext.h index d943baa8..74f7cc17 100644 --- a/playerbot/strategy/AiObjectContext.h +++ b/playerbot/strategy/AiObjectContext.h @@ -5,6 +5,7 @@ #include "Value.h" #include "NamedObjectContext.h" #include "Strategy.h" +#include namespace ai { @@ -21,78 +22,78 @@ namespace ai virtual ~AiObjectContext() {} public: - virtual Strategy* GetStrategy(const string& name) { return strategyContexts.GetObject(name, ai); } - virtual set GetSiblingStrategy(const string& name) { return strategyContexts.GetSiblings(name); } - virtual Trigger* GetTrigger(const string& name) { return triggerContexts.GetObject(name, ai); } - virtual Action* GetAction(const string& name) { return actionContexts.GetObject(name, ai); } - virtual UntypedValue* GetUntypedValue(const string& name) { return valueContexts.GetObject(name, ai); } + virtual Strategy* GetStrategy(const std::string& name) { return strategyContexts.GetObject(name, ai); } + virtual std::set GetSiblingStrategy(const std::string& name) { return strategyContexts.GetSiblings(name); } + virtual Trigger* GetTrigger(const std::string& name) { return triggerContexts.GetObject(name, ai); } + virtual Action* GetAction(const std::string& name) { return actionContexts.GetObject(name, ai); } + virtual UntypedValue* GetUntypedValue(const std::string& name) { return valueContexts.GetObject(name, ai); } template - Value* GetValue(const string& name) + Value* GetValue(const std::string& name) { return dynamic_cast*>(GetUntypedValue(name)); } template - Value* GetValue(const string& name, const string& param) + Value* GetValue(const std::string& name, const std::string& param) { - return GetValue((string(name) + "::" + param)); + return GetValue((std::string(name) + "::" + param)); } template - Value* GetValue(const string& name, int32 param) + Value* GetValue(const std::string& name, int32 param) { - ostringstream out; out << param; + std::ostringstream out; out << param; return GetValue(name, out.str()); } - bool HasValue(const string& name) + bool HasValue(const std::string& name) { return valueContexts.IsCreated(name); } - bool HasValue(const string& name, const string& param) + bool HasValue(const std::string& name, const std::string& param) { - return HasValue((string(name) + "::" + param)); + return HasValue((std::string(name) + "::" + param)); } - bool HasValue(const string& name, int32 param) + bool HasValue(const std::string& name, int32 param) { - ostringstream out; out << param; + std::ostringstream out; out << param; return HasValue(name, out.str()); } - set GetValues() + std::set GetValues() { return valueContexts.GetCreated(); } - set GetSupportedStrategies() + std::set GetSupportedStrategies() { return strategyContexts.supports(); } - set GetSupportedTriggers() + std::set GetSupportedTriggers() { return triggerContexts.supports(); } - set GetSupportedActions() + std::set GetSupportedActions() { return actionContexts.supports(); } - set GetSupportedValues () + std::set GetSupportedValues () { return valueContexts.supports(); } - void ClearValues(string findName = ""); + void ClearValues(std::string findName = ""); - void ClearExpiredValues(string findName = "", uint32 interval = 0); + void ClearExpiredValues(std::string findName = "", uint32 interval = 0); - string FormatValues(string findName = ""); + std::string FormatValues(std::string findName = ""); public: virtual void Update(); @@ -101,10 +102,10 @@ namespace ai { valueContexts.Add(sharedValues); } - list Save(); - void Load(list data); + std::list Save(); + void Load(std::list data); - vector performanceStack; + std::vector performanceStack; protected: NamedObjectContextList strategyContexts; NamedObjectContextList actionContexts; diff --git a/playerbot/strategy/CustomStrategy.cpp b/playerbot/strategy/CustomStrategy.cpp index 23676b26..970e586d 100644 --- a/playerbot/strategy/CustomStrategy.cpp +++ b/playerbot/strategy/CustomStrategy.cpp @@ -5,11 +5,11 @@ using namespace ai; -map CustomStrategy::actionLinesCache; +std::map CustomStrategy::actionLinesCache; -NextAction* toNextAction(string action) +NextAction* toNextAction(std::string action) { - vector tokens = split(action, '!'); + std::vector tokens = split(action, '!'); if (tokens.size() == 2 && !tokens[0].empty()) return new NextAction(tokens[0], atof(tokens[1].c_str())); else if (tokens.size() == 1 && !tokens[0].empty()) @@ -19,12 +19,12 @@ NextAction* toNextAction(string action) return NULL; } -NextAction** toNextActionArray(string actions) +NextAction** toNextActionArray(std::string actions) { - vector tokens = split(actions, ','); + std::vector tokens = split(actions, ','); NextAction** res = new NextAction*[tokens.size() + 1]; int index = 0; - for (vector::iterator i = tokens.begin(); i != tokens.end(); ++i) + for (std::vector::iterator i = tokens.begin(); i != tokens.end(); ++i) { NextAction* na = toNextAction(*i); if (na) @@ -34,9 +34,9 @@ NextAction** toNextActionArray(string actions) return res; } -TriggerNode* toTriggerNode(string actionLine) +TriggerNode* toTriggerNode(std::string actionLine) { - vector tokens = split(actionLine, '>'); + std::vector tokens = split(actionLine, '>'); if (tokens.size() == 2) return new TriggerNode(tokens[0], toNextActionArray(tokens[1])); @@ -56,15 +56,15 @@ void CustomStrategy::InitNonCombatTriggers(std::list &triggers) } else { - vector tokens = split(actionLinesCache[qualifier], '\n'); - regex tpl("\\(NULL,\\s*'.+',\\s*'(.+)'\\)(,|;)"); - for (vector::iterator i = tokens.begin(); i != tokens.end(); ++i) + std::vector tokens = split(actionLinesCache[qualifier], '\n'); + std::regex tpl("\\(NULL,\\s*'.+',\\s*'(.+)'\\)(,|;)"); + for (std::vector::iterator i = tokens.begin(); i != tokens.end(); ++i) { - string line = *i; - for (sregex_iterator j = sregex_iterator(line.begin(), line.end(), tpl); j != sregex_iterator(); ++j) + std::string line = *i; + for (std::sregex_iterator j = std::sregex_iterator(line.begin(), line.end(), tpl); j != std::sregex_iterator(); ++j) { - smatch match = *j; - string actionLine = match[1].str(); + std::smatch match = *j; + std::string actionLine = match[1].str(); if (!actionLine.empty()) this->actionLines.push_back(actionLine); } @@ -72,7 +72,7 @@ void CustomStrategy::InitNonCombatTriggers(std::list &triggers) } } - for (list::iterator i = actionLines.begin(); i != actionLines.end(); ++i) + for (std::list::iterator i = actionLines.begin(); i != actionLines.end(); ++i) { TriggerNode* tn = toTriggerNode(*i); if (tn) @@ -94,7 +94,7 @@ void CustomStrategy::LoadActionLines(uint32 owner) do { Field* fields = results->Fetch(); - string action = fields[0].GetString(); + std::string action = fields[0].GetString(); this->actionLines.push_back(action); } while (results->NextRow()); } diff --git a/playerbot/strategy/CustomStrategy.h b/playerbot/strategy/CustomStrategy.h index a6eb2737..bbc92012 100644 --- a/playerbot/strategy/CustomStrategy.h +++ b/playerbot/strategy/CustomStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: CustomStrategy(PlayerbotAI* ai) : Strategy(ai), Qualified() {} - string getName() override { return "custom::" + qualifier; } + std::string getName() override { return "custom::" + qualifier; } void Reset(); private: @@ -17,9 +17,9 @@ namespace ai void LoadActionLines(uint32 owner); private: - list actionLines; + std::list actionLines; public: - static map actionLinesCache; + static std::map actionLinesCache; }; } diff --git a/playerbot/strategy/Engine.cpp b/playerbot/strategy/Engine.cpp index ae2c80c1..e9e96cc0 100644 --- a/playerbot/strategy/Engine.cpp +++ b/playerbot/strategy/Engine.cpp @@ -12,7 +12,6 @@ #endif using namespace ai; -using namespace std; Engine::Engine(PlayerbotAI* ai, AiObjectContext *factory, BotState state) : PlayerbotAIAware(ai), aiObjectContext(factory), state(state) { @@ -24,7 +23,7 @@ Engine::Engine(PlayerbotAI* ai, AiObjectContext *factory, BotState state) : Play bool ActionExecutionListeners::Before(Action* action, const Event& event) { bool result = true; - for (list::iterator i = listeners.begin(); i!=listeners.end(); i++) + for (std::list::iterator i = listeners.begin(); i!=listeners.end(); i++) { result &= (*i)->Before(action, event); } @@ -33,7 +32,7 @@ bool ActionExecutionListeners::Before(Action* action, const Event& event) void ActionExecutionListeners::After(Action* action, bool executed, const Event& event) { - for (list::iterator i = listeners.begin(); i!=listeners.end(); i++) + for (std::list::iterator i = listeners.begin(); i!=listeners.end(); i++) { (*i)->After(action, executed, event); } @@ -42,7 +41,7 @@ void ActionExecutionListeners::After(Action* action, bool executed, const Event& bool ActionExecutionListeners::OverrideResult(Action* action, bool executed, const Event& event) { bool result = executed; - for (list::iterator i = listeners.begin(); i!=listeners.end(); i++) + for (std::list::iterator i = listeners.begin(); i!=listeners.end(); i++) { result = (*i)->OverrideResult(action, result, event); } @@ -52,7 +51,7 @@ bool ActionExecutionListeners::OverrideResult(Action* action, bool executed, con bool ActionExecutionListeners::AllowExecution(Action* action, const Event& event) { bool result = true; - for (list::iterator i = listeners.begin(); i!=listeners.end(); i++) + for (std::list::iterator i = listeners.begin(); i!=listeners.end(); i++) { result &= (*i)->AllowExecution(action, event); } @@ -61,7 +60,7 @@ bool ActionExecutionListeners::AllowExecution(Action* action, const Event& event ActionExecutionListeners::~ActionExecutionListeners() { - for (list::iterator i = listeners.begin(); i!=listeners.end(); i++) + for (std::list::iterator i = listeners.begin(); i!=listeners.end(); i++) { delete *i; } @@ -86,14 +85,14 @@ void Engine::Reset() delete action; } while (true); - for (list::iterator i = triggers.begin(); i != triggers.end(); i++) + for (std::list::iterator i = triggers.begin(); i != triggers.end(); i++) { TriggerNode* trigger = *i; delete trigger; } triggers.clear(); - for (list::iterator i = multipliers.begin(); i != multipliers.end(); i++) + for (std::list::iterator i = multipliers.begin(); i != multipliers.end(); i++) { Multiplier* multiplier = *i; delete multiplier; @@ -105,7 +104,7 @@ void Engine::Init() { Reset(); - for (map::iterator i = strategies.begin(); i != strategies.end(); i++) + for (std::map::iterator i = strategies.begin(); i != strategies.end(); i++) { Strategy* strategy = i->second; strategy->InitMultipliers(multipliers, state); @@ -151,7 +150,7 @@ bool Engine::DoNextAction(Unit* unit, int depth, bool minimal, bool isStunned) ActionNode* actionNode = queue.Pop(); Action* action = InitializeAction(actionNode); - string actionName = (action ? action->getName() : "unknown"); + std::string actionName = (action ? action->getName() : "unknown"); if (!event.getSource().empty()) actionName += " <" + event.getSource() + ">"; @@ -164,7 +163,7 @@ bool Engine::DoNextAction(Unit* unit, int depth, bool minimal, bool isStunned) { if (sPlayerbotAIConfig.CanLogAction(ai, actionNode->getName(), false, "")) { - ostringstream out; + std::ostringstream out; out << "try: "; out << actionNode->getName(); out << " unknown ("; @@ -187,7 +186,7 @@ bool Engine::DoNextAction(Unit* unit, int depth, bool minimal, bool isStunned) if (isUseful && (!isStunned || action->isUsefulWhenStunned())) { - for (list::iterator i = multipliers.begin(); i != multipliers.end(); i++) + for (std::list::iterator i = multipliers.begin(); i != multipliers.end(); i++) { Multiplier* multiplier = *i; relevance *= multiplier->GetValue(action); @@ -254,7 +253,7 @@ bool Engine::DoNextAction(Unit* unit, int depth, bool minimal, bool isStunned) { if (sPlayerbotAIConfig.CanLogAction(ai,actionNode->getName(), false, "")) { - ostringstream out; + std::ostringstream out; out << "try: "; out << action->getName(); out << " impossible ("; @@ -275,7 +274,7 @@ bool Engine::DoNextAction(Unit* unit, int depth, bool minimal, bool isStunned) { if (sPlayerbotAIConfig.CanLogAction(ai,actionNode->getName(), false, "")) { - ostringstream out; + std::ostringstream out; out << "try: "; out << action->getName(); out << " useless ("; @@ -329,10 +328,10 @@ bool Engine::DoNextAction(Unit* unit, int depth, bool minimal, bool isStunned) return actionExecuted; } -ActionNode* Engine::CreateActionNode(const string& name) +ActionNode* Engine::CreateActionNode(const std::string& name) { ActionNode* actionNode = nullptr; - for (map::iterator i = strategies.begin(); i != strategies.end(); i++) + for (std::map::iterator i = strategies.begin(); i != strategies.end(); i++) { Strategy* strategy = i->second; actionNode = strategy->GetAction(name); @@ -406,7 +405,7 @@ bool Engine::MultiplyAndPush(NextAction** actions, float forceRelevance, bool sk return pushed; } -ActionResult Engine::ExecuteAction(const string& name, Event& event) +ActionResult Engine::ExecuteAction(const std::string& name, Event& event) { ActionResult actionResult = ACTION_RESULT_UNKNOWN; ActionNode* actionNode = CreateActionNode(name); @@ -441,7 +440,7 @@ ActionResult Engine::ExecuteAction(const string& name, Event& event) return actionResult; } -bool Engine::CanExecuteAction(const string& name, bool isUseful, bool isPossible) +bool Engine::CanExecuteAction(const std::string& name, bool isUseful, bool isPossible) { bool result = true; ActionNode* actionNode = CreateActionNode(name); @@ -467,15 +466,15 @@ bool Engine::CanExecuteAction(const string& name, bool isUseful, bool isPossible return result; } -void Engine::addStrategy(const string& name) +void Engine::addStrategy(const std::string& name) { removeStrategy(name, initMode); Strategy* strategy = aiObjectContext->GetStrategy(name); if (strategy) { - set siblings = aiObjectContext->GetSiblingStrategy(name); - for (set::iterator i = siblings.begin(); i != siblings.end(); i++) + std::set siblings = aiObjectContext->GetSiblingStrategy(name); + for (std::set::iterator i = siblings.begin(); i != siblings.end(); i++) { removeStrategy(*i, initMode); } @@ -491,7 +490,7 @@ void Engine::addStrategy(const string& name) } } -void Engine::addStrategies(string first, ...) +void Engine::addStrategies(std::string first, ...) { addStrategy(first); @@ -510,9 +509,9 @@ void Engine::addStrategies(string first, ...) va_end(vl); } -bool Engine::removeStrategy(const string& name, bool init) +bool Engine::removeStrategy(const std::string& name, bool init) { - map::iterator i = strategies.find(name); + std::map::iterator i = strategies.find(name); if (i == strategies.end()) return false; @@ -534,18 +533,18 @@ void Engine::removeAllStrategies() Init(); } -void Engine::toggleStrategy(const string& name) +void Engine::toggleStrategy(const std::string& name) { if (!removeStrategy(name)) addStrategy(name); } -bool Engine::HasStrategy(const string& name) +bool Engine::HasStrategy(const std::string& name) { return strategies.find(name) != strategies.end(); } -Strategy* Engine::GetStrategy(const string& name) const +Strategy* Engine::GetStrategy(const std::string& name) const { auto i = strategies.find(name); if (i != strategies.end()) @@ -558,8 +557,8 @@ Strategy* Engine::GetStrategy(const string& name) const void Engine::ProcessTriggers(bool minimal) { - map fires; - for (list::iterator i = triggers.begin(); i != triggers.end(); i++) + std::map fires; + for (std::list::iterator i = triggers.begin(); i != triggers.end(); i++) { TriggerNode* node = *i; if (!node) @@ -596,7 +595,7 @@ void Engine::ProcessTriggers(bool minimal) } } - for (list::iterator i = triggers.begin(); i != triggers.end(); i++) + for (std::list::iterator i = triggers.begin(); i != triggers.end(); i++) { TriggerNode* node = *i; Trigger* trigger = node->getTrigger(); @@ -607,7 +606,7 @@ void Engine::ProcessTriggers(bool minimal) MultiplyAndPush(node->getHandlers(), 0.0f, false, event, "trigger"); } - for (list::iterator i = triggers.begin(); i != triggers.end(); i++) + for (std::list::iterator i = triggers.begin(); i != triggers.end(); i++) { Trigger* trigger = (*i)->getTrigger(); if (trigger) trigger->Reset(); @@ -616,20 +615,20 @@ void Engine::ProcessTriggers(bool minimal) void Engine::PushDefaultActions() { - for (map::iterator i = strategies.begin(); i != strategies.end(); i++) + for (std::map::iterator i = strategies.begin(); i != strategies.end(); i++) { Strategy* strategy = i->second; MultiplyAndPush(strategy->getDefaultActions(state), 0.0f, false, Event(), "default"); } } -string Engine::ListStrategies() +std::string Engine::ListStrategies() { - string s; + std::string s; if (strategies.empty()) return s; - for (map::iterator i = strategies.begin(); i != strategies.end(); i++) + for (std::map::iterator i = strategies.begin(); i != strategies.end(); i++) { s.append(i->first); s.append(", "); @@ -637,9 +636,9 @@ string Engine::ListStrategies() return s.substr(0, s.length() - 2); } -list Engine::GetStrategies() +std::list Engine::GetStrategies() { - list result; + std::list result; for (const auto& strategy : strategies) { result.push_back(strategy.first); @@ -658,7 +657,7 @@ void Engine::PushAgain(ActionNode* actionNode, float relevance, const Event& eve bool Engine::ContainsStrategy(StrategyType type) { - for (map::iterator i = strategies.begin(); i != strategies.end(); i++) + for (std::map::iterator i = strategies.begin(); i != strategies.end(); i++) { Strategy* strategy = i->second; if (strategy->GetType() & type) @@ -698,10 +697,10 @@ bool Engine::ListenAndExecute(Action* action, Event& event) } } - string lastActionName = prevExecutedAction ? prevExecutedAction->getName() : ""; + std::string lastActionName = prevExecutedAction ? prevExecutedAction->getName() : ""; if (sPlayerbotAIConfig.CanLogAction(ai, action->getName(), true, lastActionName)) { - ostringstream out; + std::ostringstream out; out << "do: "; out << action->getName(); if (actionExecuted) @@ -736,7 +735,7 @@ bool Engine::ListenAndExecute(Action* action, Event& event) if (ai->HasStrategy("debug threat", BotState::BOT_STATE_NON_COMBAT)) { - ostringstream out; + std::ostringstream out; AiObjectContext* context = ai->GetAiObjectContext(); float deltaThreat = LOG_AI_VALUE(float, "my threat::current target")->GetDelta(5.0f); @@ -769,7 +768,7 @@ void Engine::LogAction(const char* format, ...) { lastAction = lastAction.substr(512); size_t pos = lastAction.find("|"); - lastAction = (pos == string::npos ? "" : lastAction.substr(pos)); + lastAction = (pos == std::string::npos ? "" : lastAction.substr(pos)); } if (testMode) @@ -789,10 +788,10 @@ void Engine::LogAction(const char* format, ...) } } -void Engine::ChangeStrategy(const string& names) +void Engine::ChangeStrategy(const std::string& names) { - vector splitted = split(names, ','); - for (vector::iterator i = splitted.begin(); i != splitted.end(); i++) + std::vector splitted = split(names, ','); + for (std::vector::iterator i = splitted.begin(); i != splitted.end(); i++) { const char* name = i->c_str(); switch (name[0]) @@ -816,9 +815,9 @@ void Engine::ChangeStrategy(const string& names) } } -void Engine::PrintStrategies(Player* requester, const string& engineType) +void Engine::PrintStrategies(Player* requester, const std::string& engineType) { - string engineStrategies = engineType; + std::string engineStrategies = engineType; engineStrategies.append(" Strategies: "); engineStrategies.append(ListStrategies()); ai->TellPlayer(requester, engineStrategies); @@ -833,6 +832,6 @@ void Engine::LogValues() if (sPlayerbotAIConfig.logInGroupOnly && !bot->GetGroup()) return; - string text = ai->GetAiObjectContext()->FormatValues(); + std::string text = ai->GetAiObjectContext()->FormatValues(); sLog.outDebug( "Values for %s: %s", bot->GetName(), text.c_str()); } \ No newline at end of file diff --git a/playerbot/strategy/Engine.h b/playerbot/strategy/Engine.h index 6e0652da..2b13552f 100644 --- a/playerbot/strategy/Engine.h +++ b/playerbot/strategy/Engine.h @@ -65,25 +65,25 @@ namespace ai Engine(PlayerbotAI* ai, AiObjectContext *factory, BotState state); void Init(); - void addStrategy(const string& name); - void addStrategies(string first, ...); - bool removeStrategy(const string& name, bool init = true); - bool HasStrategy(const string& name); - Strategy* GetStrategy(const string& name) const; + void addStrategy(const std::string& name); + void addStrategies(std::string first, ...); + bool removeStrategy(const std::string& name, bool init = true); + bool HasStrategy(const std::string& name); + Strategy* GetStrategy(const std::string& name) const; void removeAllStrategies(); - void toggleStrategy(const string& name); + void toggleStrategy(const std::string& name); std::string ListStrategies(); - list GetStrategies(); + std::list GetStrategies(); bool ContainsStrategy(StrategyType type); - void ChangeStrategy(const string& names); - void PrintStrategies(Player* requester, const string& engineType); - string GetLastAction() { return lastAction; } + void ChangeStrategy(const std::string& names); + void PrintStrategies(Player* requester, const std::string& engineType); + std::string GetLastAction() { return lastAction; } const Action* GetLastExecutedAction() const { return lastExecutedAction; } public: virtual bool DoNextAction(Unit*, int depth, bool minimal, bool isStunned); - ActionResult ExecuteAction(const string& name, Event& event); - bool CanExecuteAction(const string& name, bool isUseful = true, bool isPossible = true); + ActionResult ExecuteAction(const std::string& name, Event& event); + bool CanExecuteAction(const std::string& name, bool isUseful = true, bool isPossible = true); public: void AddActionExecutionListener(ActionExecutionListener* listener) @@ -104,7 +104,7 @@ namespace ai void ProcessTriggers(bool minimal); void PushDefaultActions(); void PushAgain(ActionNode* actionNode, float relevance, const Event& event); - ActionNode* CreateActionNode(const string& name); + ActionNode* CreateActionNode(const std::string& name); virtual Action* InitializeAction(ActionNode* actionNode); virtual bool ListenAndExecute(Action* action, Event& event); @@ -117,7 +117,7 @@ namespace ai std::list triggers; std::list multipliers; AiObjectContext* aiObjectContext; - std::map strategies; + std::map strategies; float lastRelevance; std::string lastAction; ActionExecutionListeners actionExecutionListeners; diff --git a/playerbot/strategy/Event.h b/playerbot/strategy/Event.h index adc9149b..042d4835 100644 --- a/playerbot/strategy/Event.h +++ b/playerbot/strategy/Event.h @@ -5,8 +5,6 @@ class Player; -using namespace std; - namespace ai { class Event @@ -20,23 +18,23 @@ namespace ai owner = other.owner; } Event() {} - Event(string source) : source(source) {} - Event(string source, string param, Player* owner = NULL) : source(source), param(param), owner(owner) {} - Event(string source, WorldPacket &packet, Player* owner = NULL) : source(source), packet(packet), owner(owner) {} - Event(string source, ObjectGuid object, Player* owner = NULL) : source(source), owner(owner) { packet << object; } + Event(std::string source) : source(source) {} + Event(std::string source, std::string param, Player* owner = NULL) : source(source), param(param), owner(owner) {} + Event(std::string source, WorldPacket &packet, Player* owner = NULL) : source(source), packet(packet), owner(owner) {} + Event(std::string source, ObjectGuid object, Player* owner = NULL) : source(source), owner(owner) { packet << object; } virtual ~Event() {} public: - string getSource() const { return source; } - string getParam() { return param; } + std::string getSource() const { return source; } + std::string getParam() { return param; } WorldPacket& getPacket() { return packet; } ObjectGuid getObject(); Player* getOwner() { return owner; } bool operator! () const { return source.empty(); } protected: - string source; - string param; + std::string source; + std::string param; WorldPacket packet; Player* owner = nullptr; }; diff --git a/playerbot/strategy/ExternalEventHelper.h b/playerbot/strategy/ExternalEventHelper.h index 80973ad5..365448d3 100644 --- a/playerbot/strategy/ExternalEventHelper.h +++ b/playerbot/strategy/ExternalEventHelper.h @@ -10,9 +10,9 @@ namespace ai public: ExternalEventHelper(AiObjectContext* aiObjectContext) : aiObjectContext(aiObjectContext) {} - bool ParseChatCommand(string command, Player* owner = NULL) + bool ParseChatCommand(std::string command, Player* owner = NULL) { - string linkCommand = ChatHelper::parseValue("command", command); + std::string linkCommand = ChatHelper::parseValue("command", command); bool forceCommand = false; if (!linkCommand.empty()) @@ -24,15 +24,15 @@ namespace ai if (HandleCommand(command, "", owner, forceCommand)) return true; - size_t i = string::npos; + size_t i = std::string::npos; while (true) { size_t found = command.rfind(" ", i); - if (found == string::npos || !found) + if (found == std::string::npos || !found) break; - string name = command.substr(0, found); - string param = command.substr(found + 1); + std::string name = command.substr(0, found); + std::string param = command.substr(found + 1); i = found - 1; @@ -43,7 +43,7 @@ namespace ai if (!ChatHelper::parseable(command)) return false; - if (command.find("Hvalue:help") != string::npos || command.find("[h:") != string::npos) + if (command.find("Hvalue:help") != std::string::npos || command.find("[h:") != std::string::npos) { HandleCommand("help", command, owner); return true; @@ -54,10 +54,10 @@ namespace ai return true; } - bool HandlePacket(map &handlers, const WorldPacket &packet, Player* owner = NULL) + bool HandlePacket(std::map &handlers, const WorldPacket &packet, Player* owner = NULL) { uint16 opcode = packet.GetOpcode(); - string name = handlers[opcode]; + std::string name = handlers[opcode]; if (name.empty()) return true; @@ -75,7 +75,7 @@ namespace ai return true; } - bool HandleCommand(string name, string param, Player* owner = NULL, bool forceCommand = false) + bool HandleCommand(std::string name, std::string param, Player* owner = NULL, bool forceCommand = false) { Trigger* trigger = aiObjectContext->GetTrigger(name); if (!trigger) diff --git a/playerbot/strategy/ItemVisitors.h b/playerbot/strategy/ItemVisitors.h index eeb552f5..5e1b3948 100644 --- a/playerbot/strategy/ItemVisitors.h +++ b/playerbot/strategy/ItemVisitors.h @@ -27,14 +27,14 @@ namespace ai return true; } - list& GetResult() { return result; } + std::list& GetResult() { return result; } protected: virtual bool Accept(const ItemPrototype* proto) = 0; virtual bool Accept(Item* item) { return false; }; private: - list result; + std::list result; }; class FindAllItemVisitor : public FindItemVisitor { @@ -85,7 +85,7 @@ namespace ai return true; } - list& GetResult() + std::list& GetResult() { return result; } @@ -93,7 +93,7 @@ namespace ai private: uint32 quality; int count; - list result; + std::list result; }; class FindItemsToTradeByQualityVisitor : public FindItemsByQualityVisitor @@ -125,7 +125,7 @@ namespace ai return true; } - list& GetResult() + std::list& GetResult() { return result; } @@ -133,7 +133,7 @@ namespace ai private: uint32 itemClass; uint32 itemSubClass; - list result; + std::list result; }; class FindItemsToTradeByClassVisitor : public IterateItemsVisitor @@ -157,7 +157,7 @@ namespace ai return true; } - list& GetResult() + std::list& GetResult() { return result; } @@ -166,7 +166,7 @@ namespace ai uint32 itemClass; uint32 itemSubClass; int count; - list result; + std::list result; }; class QueryItemCountVisitor : public IterateItemsVisitor @@ -197,7 +197,7 @@ namespace ai class QueryNamedItemCountVisitor : public QueryItemCountVisitor { public: - QueryNamedItemCountVisitor(string name) : QueryItemCountVisitor(0) + QueryNamedItemCountVisitor(std::string name) : QueryItemCountVisitor(0) { this->name = name; } @@ -212,12 +212,12 @@ namespace ai } private: - string name; + std::string name; }; class FindNamedItemVisitor : public FindItemVisitor { public: - FindNamedItemVisitor(Player* bot, string name) : FindItemVisitor() + FindNamedItemVisitor(Player* bot, std::string name) : FindItemVisitor() { this->name = name; } @@ -228,7 +228,7 @@ namespace ai } private: - string name; + std::string name; }; class FindItemByIdVisitor : public FindItemVisitor { @@ -287,8 +287,8 @@ namespace ai public: ListItemsVisitor() : IterateItemsVisitor() {} - map items; - map soulbound; + std::map items; + std::map soulbound; virtual bool Visit(Item* item) { @@ -319,7 +319,7 @@ namespace ai } public: - map count; + std::map count; }; diff --git a/playerbot/strategy/Multiplier.h b/playerbot/strategy/Multiplier.h index 071f15c9..bf88299a 100644 --- a/playerbot/strategy/Multiplier.h +++ b/playerbot/strategy/Multiplier.h @@ -14,7 +14,7 @@ namespace ai class Multiplier : public AiNamedObject { public: - Multiplier(PlayerbotAI* ai, string name) : AiNamedObject(ai, name) {} + Multiplier(PlayerbotAI* ai, std::string name) : AiNamedObject(ai, name) {} virtual ~Multiplier() {} public: diff --git a/playerbot/strategy/NamedObjectContext.h b/playerbot/strategy/NamedObjectContext.h index facb5b9a..1a5605f0 100644 --- a/playerbot/strategy/NamedObjectContext.h +++ b/playerbot/strategy/NamedObjectContext.h @@ -2,30 +2,32 @@ #include #include #include +#include +#include +#include +#include namespace ai { - using namespace std; - class Qualified { public: Qualified() {}; - Qualified(const string& qualifier) : qualifier(qualifier) {} + Qualified(const std::string& qualifier) : qualifier(qualifier) {} Qualified(int32 qualifier1) { Qualify(qualifier1); } public: - virtual void Qualify(int32 qualifier) { ostringstream out; out << qualifier; this->qualifier = out.str(); } - virtual void Qualify(const string& qualifier) { this->qualifier = qualifier; } - string getQualifier() { return qualifier; } + virtual void Qualify(int32 qualifier) { std::ostringstream out; out << qualifier; this->qualifier = out.str(); } + virtual void Qualify(const std::string& qualifier) { this->qualifier = qualifier; } + std::string getQualifier() { return qualifier; } void Reset() { qualifier.clear(); } - static string MultiQualify(const vector& qualifiers, const string& separator, const string_view brackets = "{}") + static std::string MultiQualify(const std::vector& qualifiers, const std::string& separator, const std::string_view brackets = "{}") { - stringstream out; + std::stringstream out; for (uint8 i = 0; i < qualifiers.size(); i++) { - const string& qualifier = qualifiers[i]; + const std::string& qualifier = qualifiers[i]; if (i == qualifiers.size() - 1) { out << qualifier; @@ -46,11 +48,11 @@ namespace ai } } - static vector getMultiQualifiers(const string& qualifier1, const string& separator, const string_view brackets = "{}") + static std::vector getMultiQualifiers(const std::string& qualifier1, const std::string& separator, const std::string_view brackets = "{}") { - vector result; + std::vector result; - string view = qualifier1; + std::string view = qualifier1; if(view.find(brackets[0]) == 0) view = qualifier1.substr(1, qualifier1.size()-2); @@ -58,12 +60,12 @@ namespace ai size_t last = 0; size_t next = 0; - if (view.find(brackets[0]) == string::npos) + if (view.find(brackets[0]) == std::string::npos) { - while ((next = view.find(separator, last)) != string::npos) + while ((next = view.find(separator, last)) != std::string::npos) { - result.push_back((string)view.substr(last, next - last)); + result.push_back((std::string)view.substr(last, next - last)); last = next + separator.length(); } @@ -72,7 +74,7 @@ namespace ai else { int8 level = 0; - string sub; + std::string sub; while (next < view.size() || level < 0) { if (view[next] == brackets[0]) @@ -98,7 +100,7 @@ namespace ai return result; } - static bool isValidNumberString(const string& str) + static bool isValidNumberString(const std::string& str) { bool valid = !str.empty(); if (valid) @@ -125,9 +127,9 @@ namespace ai return valid; } - static int32 getMultiQualifierInt(const string& qualifier1, uint32 pos, const string& separator) + static int32 getMultiQualifierInt(const std::string& qualifier1, uint32 pos, const std::string& separator) { - vector qualifiers = getMultiQualifiers(qualifier1, separator); + std::vector qualifiers = getMultiQualifiers(qualifier1, separator); if (qualifiers.size() > pos && isValidNumberString(qualifiers[pos])) { return stoi(qualifiers[pos]); @@ -136,29 +138,29 @@ namespace ai return 0; } - static string getMultiQualifierStr(const string& qualifier1, uint32 pos, const string& separator) + static std::string getMultiQualifierStr(const std::string& qualifier1, uint32 pos, const std::string& separator) { - vector qualifiers = getMultiQualifiers(qualifier1, separator); + std::vector qualifiers = getMultiQualifiers(qualifier1, separator); return (qualifiers.size() > pos) ? qualifiers[pos] : ""; } protected: - string qualifier; + std::string qualifier; }; template class NamedObjectFactory { protected: typedef T* (*ActionCreator) (PlayerbotAI* ai); - map creators; + std::map creators; public: - T* create(const string& inName, PlayerbotAI* ai) + T* create(const std::string& inName, PlayerbotAI* ai) { - string name = inName; + std::string name = inName; size_t found = name.find("::"); - string qualifier; - if (found != string::npos) + std::string qualifier; + if (found != std::string::npos) { qualifier = name.substr(found + 2); name = name.substr(0, found); @@ -177,7 +179,7 @@ namespace ai T *object = (*creator)(ai); Qualified *q = dynamic_cast(object); - if (q && found != string::npos) + if (q && found != std::string::npos) { q->Qualify(qualifier); } @@ -185,10 +187,10 @@ namespace ai return object; } - set supports() + std::set supports() { - set keys; - for (typename map::iterator it = creators.begin(); it != creators.end(); it++) + std::set keys; + for (typename std::map::iterator it = creators.begin(); it != creators.end(); it++) { keys.insert(it->first); } @@ -204,7 +206,7 @@ namespace ai NamedObjectContext(bool shared = false, bool supportsSiblings = false) : NamedObjectFactory(), shared(shared), supportsSiblings(supportsSiblings) {} - T* create(string name, PlayerbotAI* ai) + T* create(std::string name, PlayerbotAI* ai) { if (created.find(name) == created.end()) return created[name] = NamedObjectFactory::create(name, ai); @@ -219,7 +221,7 @@ namespace ai void Clear() { - for (typename map::iterator i = created.begin(); i != created.end(); i++) + for (typename std::map::iterator i = created.begin(); i != created.end(); i++) { if (i->second) delete i->second; @@ -228,7 +230,7 @@ namespace ai created.clear(); } - void Erase(const string& name) + void Erase(const std::string& name) { if (created.find(name) != created.end()) { @@ -239,7 +241,7 @@ namespace ai void Update() { - for (typename map::iterator i = created.begin(); i != created.end(); i++) + for (typename std::map::iterator i = created.begin(); i != created.end(); i++) { if (i->second) i->second->Update(); @@ -248,7 +250,7 @@ namespace ai void Reset() { - for (typename map::iterator i = created.begin(); i != created.end(); i++) + for (typename std::map::iterator i = created.begin(); i != created.end(); i++) { if (i->second) i->second->Reset(); @@ -258,18 +260,18 @@ namespace ai bool IsShared() { return shared; } bool IsSupportsSiblings() { return supportsSiblings; } - bool IsCreated(const string& name) { return created.find(name) != created.end(); } + bool IsCreated(const std::string& name) { return created.find(name) != created.end(); } - set GetCreated() + std::set GetCreated() { - set keys; - for (typename map::iterator it = created.begin(); it != created.end(); it++) + std::set keys; + for (typename std::map::iterator it = created.begin(); it != created.end(); it++) keys.insert(it->first); return keys; } protected: - map created; + std::map created; bool shared; bool supportsSiblings; }; @@ -279,7 +281,7 @@ namespace ai public: virtual ~NamedObjectContextList() { - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { NamedObjectContext* context = *i; if (!context->IsShared()) @@ -292,9 +294,9 @@ namespace ai contexts.push_back(context); } - T* GetObject(const string& name, PlayerbotAI* ai) + T* GetObject(const std::string& name, PlayerbotAI* ai) { - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { T* object = (*i)->create(name, ai); if (object) return object; @@ -304,7 +306,7 @@ namespace ai void Update() { - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { if (!(*i)->IsShared()) (*i)->Update(); @@ -313,21 +315,21 @@ namespace ai void Reset() { - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { (*i)->Reset(); } } - set GetSiblings(const string& name) + std::set GetSiblings(const std::string& name) { - set siblings; - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + std::set siblings; + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { if ((*i)->IsSupportsSiblings()) { - set supported = (*i)->supports(); - set::iterator found = supported.find(name); + std::set supported = (*i)->supports(); + std::set::iterator found = supported.find(name); if (found != supported.end()) { supported.erase(found); @@ -339,23 +341,23 @@ namespace ai return siblings; } - set supports() + std::set supports() { - set result; + std::set result; - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { - set supported = (*i)->supports(); + std::set supported = (*i)->supports(); - for (set::iterator j = supported.begin(); j != supported.end(); j++) + for (std::set::iterator j = supported.begin(); j != supported.end(); j++) result.insert(*j); } return result; } - bool IsCreated(const string& name) + bool IsCreated(const std::string& name) { - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { if ((*i)->IsCreated(name)) return true; @@ -363,30 +365,30 @@ namespace ai return false; } - set GetCreated() + std::set GetCreated() { - set result; + std::set result; - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { - set createdKeys = (*i)->GetCreated(); + std::set createdKeys = (*i)->GetCreated(); - for (set::iterator j = createdKeys.begin(); j != createdKeys.end(); j++) + for (std::set::iterator j = createdKeys.begin(); j != createdKeys.end(); j++) result.insert(*j); } return result; } - void Erase(const string& name) + void Erase(const std::string& name) { - for (typename list*>::iterator i = contexts.begin(); i != contexts.end(); i++) + for (typename std::list*>::iterator i = contexts.begin(); i != contexts.end(); i++) { (*i)->Erase(name); } } private: - list*> contexts; + std::list*> contexts; }; template class NamedObjectFactoryList @@ -394,7 +396,7 @@ namespace ai public: virtual ~NamedObjectFactoryList() { - for (typename list*>::iterator i = factories.begin(); i != factories.end(); i++) + for (typename std::list*>::iterator i = factories.begin(); i != factories.end(); i++) delete *i; } @@ -403,9 +405,9 @@ namespace ai factories.push_front(context); } - T* GetObject(const string& name, PlayerbotAI* ai) + T* GetObject(const std::string& name, PlayerbotAI* ai) { - for (typename list*>::iterator i = factories.begin(); i != factories.end(); i++) + for (typename std::list*>::iterator i = factories.begin(); i != factories.end(); i++) { T* object = (*i)->create(name, ai); if (object) return object; @@ -414,6 +416,6 @@ namespace ai } private: - list*> factories; + std::list*> factories; }; }; diff --git a/playerbot/strategy/PassiveMultiplier.cpp b/playerbot/strategy/PassiveMultiplier.cpp index 269f4b50..e1e8872f 100644 --- a/playerbot/strategy/PassiveMultiplier.cpp +++ b/playerbot/strategy/PassiveMultiplier.cpp @@ -4,8 +4,8 @@ using namespace ai; -list PassiveMultiplier::allowedActions; -list PassiveMultiplier::allowedParts; +std::list PassiveMultiplier::allowedActions; +std::list PassiveMultiplier::allowedParts; PassiveMultiplier::PassiveMultiplier(PlayerbotAI* ai) : Multiplier(ai, "passive") { @@ -35,17 +35,17 @@ float PassiveMultiplier::GetValue(Action* action) if (!action) return 1.0f; - string name = action->getName(); + std::string name = action->getName(); - for (list::iterator i = allowedActions.begin(); i != allowedActions.end(); i++) + for (std::list::iterator i = allowedActions.begin(); i != allowedActions.end(); i++) { if (name == *i) return 1.0f; } - for (list::iterator i = allowedParts.begin(); i != allowedParts.end(); i++) + for (std::list::iterator i = allowedParts.begin(); i != allowedParts.end(); i++) { - if (name.find(*i) != string::npos) + if (name.find(*i) != std::string::npos) return 1.0f; } diff --git a/playerbot/strategy/PassiveMultiplier.h b/playerbot/strategy/PassiveMultiplier.h index ddb259bd..4e0a5f28 100644 --- a/playerbot/strategy/PassiveMultiplier.h +++ b/playerbot/strategy/PassiveMultiplier.h @@ -13,7 +13,7 @@ namespace ai virtual float GetValue(Action* action); private: - static list allowedActions; - static list allowedParts; + static std::list allowedActions; + static std::list allowedParts; }; } diff --git a/playerbot/strategy/Queue.cpp b/playerbot/strategy/Queue.cpp index eeb5d22d..a664e690 100644 --- a/playerbot/strategy/Queue.cpp +++ b/playerbot/strategy/Queue.cpp @@ -80,7 +80,7 @@ int Queue::Size() void Queue::RemoveExpired() { - list expired; + std::list expired; for (std::list::iterator iter = actions.begin(); iter != actions.end(); iter++) { ActionBasket* basket = *iter; diff --git a/playerbot/strategy/ReactionEngine.cpp b/playerbot/strategy/ReactionEngine.cpp index 28af269e..fa6a526e 100644 --- a/playerbot/strategy/ReactionEngine.cpp +++ b/playerbot/strategy/ReactionEngine.cpp @@ -5,7 +5,6 @@ #include using namespace ai; -using namespace std; void Reaction::SetAction(Action* inAction) { @@ -76,7 +75,7 @@ bool ReactionEngine::FindReaction(bool isStunned) if (reaction->isUseful() && (!isStunned || reaction->isUsefulWhenStunned())) { // Process the multipliers - for (list::iterator i = multipliers.begin(); i != multipliers.end(); i++) + for (std::list::iterator i = multipliers.begin(); i != multipliers.end(); i++) { reactionRelevance *= (*i)->GetValue(reaction); reaction->setRelevance(reactionRelevance); @@ -227,7 +226,7 @@ bool ReactionEngine::ListenAndExecute(Action* action, Event& event) if (ai->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT)) { - ostringstream out; + std::ostringstream out; out << "do: "; out << action->getName(); if (actionExecuted) diff --git a/playerbot/strategy/Strategy.cpp b/playerbot/strategy/Strategy.cpp index 7680cf17..2241b042 100644 --- a/playerbot/strategy/Strategy.cpp +++ b/playerbot/strategy/Strategy.cpp @@ -5,8 +5,6 @@ #include "Action.h" using namespace ai; -using namespace std; - class ActionNodeFactoryInternal : public NamedObjectFactory { @@ -111,7 +109,7 @@ Strategy::Strategy(PlayerbotAI* ai) : PlayerbotAIAware(ai) actionNodeFactories.Add(new ActionNodeFactoryInternal()); } -ActionNode* Strategy::GetAction(string name) +ActionNode* Strategy::GetAction(std::string name) { return actionNodeFactories.GetObject(name, ai); } diff --git a/playerbot/strategy/Strategy.h b/playerbot/strategy/Strategy.h index 88ca9015..33a31ec4 100644 --- a/playerbot/strategy/Strategy.h +++ b/playerbot/strategy/Strategy.h @@ -50,17 +50,17 @@ namespace ai virtual NextAction** getDefaultActions(BotState state); virtual int GetType() { return STRATEGY_TYPE_GENERIC; } - virtual ActionNode* GetAction(string name); - virtual string getName() = 0; + virtual ActionNode* GetAction(std::string name); + virtual std::string getName() = 0; void Update() {} //Nonfunctional see AiObjectContext::Update() to enable. void Reset() {} virtual void OnStrategyAdded(BotState state) {} virtual void OnStrategyRemoved(BotState state) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dummy"; } //Must equal iternal name - virtual string GetHelpDescription() { return "This is a strategy."; } - virtual vector GetRelatedStrategies() { return {}; } + virtual std::string GetHelpName() { return "dummy"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This is a strategy."; } + virtual std::vector GetRelatedStrategies() { return {}; } #endif protected: virtual NextAction** GetDefaultCombatActions() { return nullptr; } diff --git a/playerbot/strategy/Trigger.h b/playerbot/strategy/Trigger.h index 9a86cd65..43189cd2 100644 --- a/playerbot/strategy/Trigger.h +++ b/playerbot/strategy/Trigger.h @@ -16,7 +16,7 @@ namespace ai class Trigger : public AiNamedObject { public: - Trigger(PlayerbotAI* ai, string name = "trigger", int checkInterval = 1) : AiNamedObject(ai, name) { + Trigger(PlayerbotAI* ai, std::string name = "trigger", int checkInterval = 1) : AiNamedObject(ai, name) { this->triggered = false; this->checkInterval = checkInterval; this->lastCheckTime = time(0) - rand() % checkInterval; @@ -25,9 +25,9 @@ namespace ai public: virtual Event Check(); - virtual void ExternalEvent(string param, Player* owner = NULL) {} + virtual void ExternalEvent(std::string param, Player* owner = NULL) {} virtual void ExternalEvent(WorldPacket &packet, Player* owner = NULL) {} - virtual void ExternalEventForce(string param, Player* owner = NULL) + virtual void ExternalEventForce(std::string param, Player* owner = NULL) { this->param = param; this->owner = owner; @@ -39,7 +39,7 @@ namespace ai virtual void Reset() { triggered = false; } virtual Unit* GetTarget(); virtual Value* GetTargetValue(); - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } bool needCheck() { if (checkInterval < 2) return true; @@ -53,16 +53,16 @@ namespace ai } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dummy"; } //Must equal iternal name - virtual string GetHelpDescription() { return "This is a trigger."; } - virtual vector GetUsedTriggers() { return {}; } - virtual vector GetUsedValues() { return {}; } + virtual std::string GetHelpName() { return "dummy"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This is a trigger."; } + virtual std::vector GetUsedTriggers() { return {}; } + virtual std::vector GetUsedValues() { return {}; } #endif protected: int checkInterval; time_t lastCheckTime; - string param; + std::string param; bool triggered; Player* owner; }; @@ -71,7 +71,7 @@ namespace ai class TriggerNode { public: - TriggerNode(string name, NextAction** handlers = NULL) + TriggerNode(std::string name, NextAction** handlers = NULL) { this->name = name; this->handlers = handlers; @@ -82,7 +82,7 @@ namespace ai public: Trigger* getTrigger() { return trigger; } void setTrigger(Trigger* trigger) { this->trigger = trigger; } - string getName() { return name; } + std::string getName() { return name; } public: NextAction** getHandlers(); diff --git a/playerbot/strategy/Value.cpp b/playerbot/strategy/Value.cpp index 75acc6db..6e0f9b16 100644 --- a/playerbot/strategy/Value.cpp +++ b/playerbot/strategy/Value.cpp @@ -14,9 +14,9 @@ std::string ObjectGuidCalculatedValue::Format() std::string ObjectGuidListCalculatedValue::Format() { - ostringstream out; out << "{"; - list guids = this->Calculate(); - for (list::iterator i = guids.begin(); i != guids.end(); ++i) + std::ostringstream out; out << "{"; + std::list guids = this->Calculate(); + for (std::list::iterator i = guids.begin(); i != guids.end(); ++i) { GuidPosition guid = GuidPosition(*i, bot->GetMapId()); out << chat->formatGuidPosition(guid) << ","; @@ -27,16 +27,16 @@ std::string ObjectGuidListCalculatedValue::Format() std::string GuidPositionCalculatedValue::Format() { - ostringstream out; + std::ostringstream out; GuidPosition guidP = this->Calculate(); return chat->formatGuidPosition(guidP); } std::string GuidPositionListCalculatedValue::Format() { - ostringstream out; out << "{"; - list guids = this->Calculate(); - for (list::iterator i = guids.begin(); i != guids.end(); ++i) + std::ostringstream out; out << "{"; + std::list guids = this->Calculate(); + for (std::list::iterator i = guids.begin(); i != guids.end(); ++i) { GuidPosition guidP = *i; out << chat->formatGuidPosition(guidP) << ","; diff --git a/playerbot/strategy/Value.h b/playerbot/strategy/Value.h index 064d742e..7ac564f2 100644 --- a/playerbot/strategy/Value.h +++ b/playerbot/strategy/Value.h @@ -12,21 +12,21 @@ namespace ai class UntypedValue : public AiNamedObject { public: - UntypedValue(PlayerbotAI* ai, string name) : AiNamedObject(ai, name) {} + UntypedValue(PlayerbotAI* ai, std::string name) : AiNamedObject(ai, name) {} virtual void Update() {} //Nonfunctional see AiObjectContext::Update() to enable. virtual void Reset() {} - virtual string Format() { return "?"; } - virtual string Save() { return "?"; } - virtual bool Load(string value) { return false; } + virtual std::string Format() { return "?"; } + virtual std::string Save() { return "?"; } + virtual bool Load(std::string value) { return false; } virtual bool Expired() { return false; } virtual bool Expired(uint32 interval) { return false; } virtual bool Protected() { return false; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dummy"; } //Must equal iternal name - virtual string GetHelpTypeName() { return ""; } - virtual string GetHelpDescription() { return "This is a value."; } - virtual vector GetUsedValues() { return {}; } + virtual std::string GetHelpName() { return "dummy"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return ""; } + virtual std::string GetHelpDescription() { return "This is a value."; } + virtual std::vector GetUsedValues() { return {}; } #endif }; @@ -45,7 +45,7 @@ namespace ai class CalculatedValue : public UntypedValue, public Value { public: - CalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : UntypedValue(ai, name), + CalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : UntypedValue(ai, name), checkInterval(checkInterval) { lastCheckTime = 0; @@ -89,7 +89,7 @@ namespace ai template class SingleCalculatedValue : public CalculatedValue { public: - SingleCalculatedValue(PlayerbotAI* ai, string name = "value") : CalculatedValue(ai, name) { this->Reset(); } + SingleCalculatedValue(PlayerbotAI* ai, std::string name = "value") : CalculatedValue(ai, name) { this->Reset(); } virtual T Get() { @@ -109,7 +109,7 @@ namespace ai template class MemoryCalculatedValue : public CalculatedValue { public: - MemoryCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : CalculatedValue(ai, name,checkInterval) { lastChangeTime = 0; } + MemoryCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name,checkInterval) { lastChangeTime = 0; } virtual bool EqualToLast(T value) = 0; virtual bool CanCheckChange() { return !lastChangeTime || (time(0) - lastChangeTime > minChangeInterval && !EqualToLast(this->value)); } virtual bool UpdateChange() { if (!CanCheckChange()) return false; lastChangeTime = time(0); lastValue = this->value; return true; } @@ -135,34 +135,34 @@ namespace ai template class LogCalculatedValue : public MemoryCalculatedValue { public: - LogCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : MemoryCalculatedValue(ai, name, checkInterval) {}; - virtual bool UpdateChange() { if (MemoryCalculatedValue::UpdateChange()) return false; valueLog.push_back(make_pair(this->value, time(0))); if (valueLog.size() > logLength) valueLog.pop_front(); return true; } + LogCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : MemoryCalculatedValue(ai, name, checkInterval) {}; + virtual bool UpdateChange() { if (MemoryCalculatedValue::UpdateChange()) return false; valueLog.push_back(std::make_pair(this->value, time(0))); if (valueLog.size() > logLength) valueLog.pop_front(); return true; } virtual T Get() { return MemoryCalculatedValue::Get(); } - list> ValueLog() { return valueLog; } + std::list> ValueLog() { return valueLog; } - pair GetLogOn(time_t t) { auto log = std::find_if(valueLog.rbegin(), valueLog.rend(), [t](std::pair p) {return p.second < t; }); if (log == valueLog.rend()) return valueLog.front(); return *log; } + std::pair GetLogOn(time_t t) { auto log = std::find_if(valueLog.rbegin(), valueLog.rend(), [t](std::pair p) {return p.second < t; }); if (log == valueLog.rend()) return valueLog.front(); return *log; } T GetValueOn(time_t t) { return GetLogOn(t)->first; } T GetTimeOn(time_t t) { return GetTimeOn(t)->second; } - virtual T GetDelta(uint32 window) { pair log = GetLogOn(time(0) - window); if (log.second == time(0)) return Get() - Get(); return (Get() - log.first) / float(time(0) - log.second);} + virtual T GetDelta(uint32 window) { std::pair log = GetLogOn(time(0) - window); if (log.second == time(0)) return Get() - Get(); return (Get() - log.first) / float(time(0) - log.second);} virtual void Reset() { MemoryCalculatedValue::Reset(); valueLog.clear(); } protected: - list> valueLog; + std::list> valueLog; uint8 logLength = 10; //Maxium number of values recorded. }; class Uint8CalculatedValue : public CalculatedValue { public: - Uint8CalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + Uint8CalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) {} - virtual string Format() + virtual std::string Format() { - ostringstream out; out << (int)this->Calculate(); + std::ostringstream out; out << (int)this->Calculate(); return out.str(); } }; @@ -170,12 +170,12 @@ namespace ai class Uint32CalculatedValue : public CalculatedValue { public: - Uint32CalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + Uint32CalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) {} - virtual string Format() + virtual std::string Format() { - ostringstream out; out << (int)this->Calculate(); + std::ostringstream out; out << (int)this->Calculate(); return out.str(); } }; @@ -183,12 +183,12 @@ namespace ai class FloatCalculatedValue : public CalculatedValue { public: - FloatCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + FloatCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) {} - virtual string Format() + virtual std::string Format() { - ostringstream out; out << this->Calculate(); + std::ostringstream out; out << this->Calculate(); return out.str(); } }; @@ -196,22 +196,22 @@ namespace ai class BoolCalculatedValue : public CalculatedValue { public: - BoolCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + BoolCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) {} - virtual string Format() + virtual std::string Format() { return this->Calculate() ? "true" : "false"; } }; - class StringCalculatedValue : public CalculatedValue + class StringCalculatedValue : public CalculatedValue { public: - StringCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : - CalculatedValue(ai, name, checkInterval) {} + StringCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : + CalculatedValue(ai, name, checkInterval) {} - virtual string Format() + virtual std::string Format() { return this->Calculate(); } @@ -220,10 +220,10 @@ namespace ai class UnitCalculatedValue : public CalculatedValue { public: - UnitCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + UnitCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } - virtual string Format() + virtual std::string Format() { Unit* unit = this->Calculate(); return unit ? unit->GetName() : ""; @@ -233,10 +233,10 @@ namespace ai class CDPairCalculatedValue : public CalculatedValue { public: - CDPairCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + CDPairCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } - virtual string Format() + virtual std::string Format() { CreatureDataPair const* creatureDataPair = this->Calculate(); CreatureInfo const* bmTemplate = ObjectMgr::GetCreatureTemplate(creatureDataPair->second.id); @@ -244,17 +244,17 @@ namespace ai } }; - class CDPairListCalculatedValue : public CalculatedValue> + class CDPairListCalculatedValue : public CalculatedValue> { public: - CDPairListCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : - CalculatedValue>(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } + CDPairListCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : + CalculatedValue>(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } - virtual string Format() + virtual std::string Format() { - ostringstream out; out << "{"; - list cdPairs = this->Calculate(); - for (list::iterator i = cdPairs.begin(); i != cdPairs.end(); ++i) + std::ostringstream out; out << "{"; + std::list cdPairs = this->Calculate(); + for (std::list::iterator i = cdPairs.begin(); i != cdPairs.end(); ++i) { CreatureDataPair const* cdPair = *i; out << cdPair->first << ","; @@ -267,44 +267,44 @@ namespace ai class ObjectGuidCalculatedValue : public CalculatedValue { public: - ObjectGuidCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + ObjectGuidCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } - virtual string Format(); + virtual std::string Format(); }; - class ObjectGuidListCalculatedValue : public CalculatedValue > + class ObjectGuidListCalculatedValue : public CalculatedValue > { public: - ObjectGuidListCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : - CalculatedValue >(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval/2; } + ObjectGuidListCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : + CalculatedValue >(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval/2; } - virtual string Format(); + virtual std::string Format(); }; class GuidPositionCalculatedValue : public CalculatedValue { public: - GuidPositionCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : + GuidPositionCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : CalculatedValue(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } - virtual string Format(); + virtual std::string Format(); }; - class GuidPositionListCalculatedValue : public CalculatedValue > + class GuidPositionListCalculatedValue : public CalculatedValue > { public: - GuidPositionListCalculatedValue(PlayerbotAI* ai, string name = "value", int checkInterval = 1) : - CalculatedValue >(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } + GuidPositionListCalculatedValue(PlayerbotAI* ai, std::string name = "value", int checkInterval = 1) : + CalculatedValue >(ai, name, checkInterval) { this->lastCheckTime = time(0) - checkInterval / 2; } - virtual string Format(); + virtual std::string Format(); }; template class ManualSetValue : public UntypedValue, public Value { public: - ManualSetValue(PlayerbotAI* ai, T defaultValue, string name = "value") : + ManualSetValue(PlayerbotAI* ai, T defaultValue, std::string name = "value") : UntypedValue(ai, name), value(defaultValue), defaultValue(defaultValue) {} virtual ~ManualSetValue() {} @@ -323,10 +323,10 @@ namespace ai class UnitManualSetValue : public ManualSetValue { public: - UnitManualSetValue(PlayerbotAI* ai, Unit* defaultValue, string name = "value") : + UnitManualSetValue(PlayerbotAI* ai, Unit* defaultValue, std::string name = "value") : ManualSetValue(ai, defaultValue, name) {} - virtual string Format() + virtual std::string Format() { Unit* unit = Get(); return unit ? unit->GetName() : ""; @@ -336,9 +336,9 @@ namespace ai class GuidPositionManualSetValue : public ManualSetValue { public: - GuidPositionManualSetValue(PlayerbotAI* ai, GuidPosition defaultValue, string name = "value") : + GuidPositionManualSetValue(PlayerbotAI* ai, GuidPosition defaultValue, std::string name = "value") : ManualSetValue(ai, defaultValue, name) {} - virtual string Format() override; + virtual std::string Format() override; }; } diff --git a/playerbot/strategy/actions/AcceptInvitationAction.h b/playerbot/strategy/actions/AcceptInvitationAction.h index 75e596de..6a83d86e 100644 --- a/playerbot/strategy/actions/AcceptInvitationAction.h +++ b/playerbot/strategy/actions/AcceptInvitationAction.h @@ -51,7 +51,7 @@ namespace ai ai->ChangeStrategy("-lfg,-bg", BotState::BOT_STATE_NON_COMBAT); ai->Reset(); - sPlayerbotAIConfig.logEvent(ai, "AcceptInvitationAction", grp->GetLeaderName(), to_string(grp->GetMembersCount())); + sPlayerbotAIConfig.logEvent(ai, "AcceptInvitationAction", grp->GetLeaderName(), std::to_string(grp->GetMembersCount())); Player* master = inviter; @@ -59,9 +59,9 @@ namespace ai { if (sPlayerbotAIConfig.inviteChat && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%name"] = master->GetName(); - string reply; + std::string reply; if (urand(0, 3)) reply = BOT_TEXT2("Send me an invite %name!", placeholders); else diff --git a/playerbot/strategy/actions/AcceptQuestAction.cpp b/playerbot/strategy/actions/AcceptQuestAction.cpp index 2c6f2a24..8e0102a9 100644 --- a/playerbot/strategy/actions/AcceptQuestAction.cpp +++ b/playerbot/strategy/actions/AcceptQuestAction.cpp @@ -26,7 +26,7 @@ bool AcceptQuestAction::Execute(Event& event) uint64 guid = 0; uint32 quest = 0; - string text = event.getParam(); + std::string text = event.getParam(); PlayerbotChatHandler ch(requester); quest = ch.extractQuestId(text); @@ -34,8 +34,8 @@ bool AcceptQuestAction::Execute(Event& event) if (event.getPacket().empty()) { - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* unit = ai->GetUnit(*i); if (unit && quest && unit->HasQuest(quest)) @@ -46,8 +46,8 @@ bool AcceptQuestAction::Execute(Event& event) if (unit && text == "*" && sqrt(bot->GetDistance(unit)) <= INTERACTION_DISTANCE) hasAccept |= QuestAction::ProcessQuests(unit); } - list gos = AI_VALUE(list, "nearest game objects"); - for (list::iterator i = gos.begin(); i != gos.end(); i++) + std::list gos = AI_VALUE(std::list, "nearest game objects"); + for (std::list::iterator i = gos.begin(); i != gos.end(); i++) { GameObject* go = ai->GetGameObject(*i); if (go && quest && go->HasQuest(quest)) @@ -76,7 +76,7 @@ bool AcceptQuestAction::Execute(Event& event) hasAccept |= AcceptQuest(requester, qInfo, guid); if (hasAccept) - sPlayerbotAIConfig.logEvent(ai, "AcceptQuestAction", qInfo->GetTitle(), to_string(qInfo->GetQuestId())); + sPlayerbotAIConfig.logEvent(ai, "AcceptQuestAction", qInfo->GetTitle(), std::to_string(qInfo->GetQuestId())); return hasAccept; } @@ -119,7 +119,7 @@ bool AcceptQuestShareAction::Execute(Event& event) { bot->AddQuest( qInfo, requester); - sPlayerbotAIConfig.logEvent(ai, "AcceptQuestShareAction", qInfo->GetTitle(), to_string(qInfo->GetQuestId())); + sPlayerbotAIConfig.logEvent(ai, "AcceptQuestShareAction", qInfo->GetTitle(), std::to_string(qInfo->GetQuestId())); if( bot->CanCompleteQuest( quest ) ) bot->CompleteQuest( quest ); diff --git a/playerbot/strategy/actions/AcceptQuestAction.h b/playerbot/strategy/actions/AcceptQuestAction.h index 8402fa1e..a2ce2960 100644 --- a/playerbot/strategy/actions/AcceptQuestAction.h +++ b/playerbot/strategy/actions/AcceptQuestAction.h @@ -8,7 +8,7 @@ namespace ai class AcceptAllQuestsAction : public QuestAction { public: - AcceptAllQuestsAction(PlayerbotAI* ai, string name = "accept all quests") : QuestAction(ai, name) {} + AcceptAllQuestsAction(PlayerbotAI* ai, std::string name = "accept all quests") : QuestAction(ai, name) {} protected: virtual bool ProcessQuest(Player* requester, Quest const* quest, WorldObject* questGiver) override; diff --git a/playerbot/strategy/actions/AddLootAction.cpp b/playerbot/strategy/actions/AddLootAction.cpp index 73d0a268..d5a9ef75 100644 --- a/playerbot/strategy/actions/AddLootAction.cpp +++ b/playerbot/strategy/actions/AddLootAction.cpp @@ -29,12 +29,12 @@ bool AddAllLootAction::Execute(Event& event) Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bool added = false; - list gos = context->GetValue >("nearest game objects")->Get(); - for (list::iterator i = gos.begin(); i != gos.end(); i++) + std::list gos = context->GetValue >("nearest game objects")->Get(); + for (std::list::iterator i = gos.begin(); i != gos.end(); i++) added |= AddLoot(requester, *i); - list corpses = context->GetValue >("nearest corpses")->Get(); - for (list::iterator i = corpses.begin(); i != corpses.end(); i++) + std::list corpses = context->GetValue >("nearest corpses")->Get(); + for (std::list::iterator i = corpses.begin(); i != corpses.end(); i++) added |= AddLoot(requester, *i); return added; @@ -101,13 +101,13 @@ bool AddGatheringLootAction::AddLoot(Player* requester, ObjectGuid guid) if (sServerFacade.IsDistanceGreaterThan(sServerFacade.GetDistance2d(bot, wo), INTERACTION_DISTANCE)) { - list targets; + std::list targets; MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(bot, sPlayerbotAIConfig.lootDistance); MaNGOS::UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(wo, searcher, sPlayerbotAIConfig.spellDistance * 1.5); if (!targets.empty()) { - ostringstream out; + std::ostringstream out; out << "Kill that " << targets.front()->GetName() << " so I can loot freely"; ai->TellError(requester, out.str()); return false; diff --git a/playerbot/strategy/actions/AddLootAction.h b/playerbot/strategy/actions/AddLootAction.h index d019c3a7..13fc82a3 100644 --- a/playerbot/strategy/actions/AddLootAction.h +++ b/playerbot/strategy/actions/AddLootAction.h @@ -16,7 +16,7 @@ namespace ai class AddAllLootAction : public ChatCommandAction { public: - AddAllLootAction(PlayerbotAI* ai, string name = "add all loot") : ChatCommandAction(ai, name) {} + AddAllLootAction(PlayerbotAI* ai, std::string name = "add all loot") : ChatCommandAction(ai, name) {} virtual bool isUseful(); protected: diff --git a/playerbot/strategy/actions/AhAction.cpp b/playerbot/strategy/actions/AhAction.cpp index 95098ff9..dcfdd9cd 100644 --- a/playerbot/strategy/actions/AhAction.cpp +++ b/playerbot/strategy/actions/AhAction.cpp @@ -1,22 +1,21 @@ #include "playerbot/playerbot.h" #include "AhAction.h" -#include "../../../ahbot/AhBot.h" +#include "ahbot/AhBot.h" #include "playerbot/strategy/values/ItemCountValue.h" -#include "../../RandomItemMgr.h" +#include "playerbot/RandomItemMgr.h" #include "playerbot/strategy/values/BudgetValues.h" #include -using namespace std; using namespace ai; bool AhAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* npc = bot->GetNPCIfCanInteractWith(*i, UNIT_NPC_FLAG_AUCTIONEER); if (!npc) @@ -36,7 +35,7 @@ bool AhAction::Execute(Event& event) return false; } -bool AhAction::ExecuteCommand(Player* requester, string text, Unit* auctioneer) +bool AhAction::ExecuteCommand(Player* requester, std::string text, Unit* auctioneer) { uint32 time; #ifdef MANGOSBOT_ZERO @@ -51,7 +50,7 @@ bool AhAction::ExecuteCommand(Player* requester, string text, Unit* auctioneer) if (!auctionHouseEntry) return false; - list items = AI_VALUE2(list, "inventory items", "usage " + to_string((uint8)ItemUsage::ITEM_USAGE_AH)); + std::list items = AI_VALUE2(std::list, "inventory items", "usage " + std::to_string((uint8)ItemUsage::ITEM_USAGE_AH)); bool postedItem = false; @@ -83,12 +82,12 @@ bool AhAction::ExecuteCommand(Player* requester, string text, Unit* auctioneer) } int pos = text.find(" "); - if (pos == string::npos) return false; + if (pos == std::string::npos) return false; - string priceStr = text.substr(0, pos); + std::string priceStr = text.substr(0, pos); uint32 price = ChatHelper::parseMoney(priceStr); - list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); + std::list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); if (found.empty()) return false; @@ -124,9 +123,9 @@ bool AhAction::PostItem(Player* requester, Item* item, uint32 price, Unit* aucti if (bot->GetItemByGuid(itemGuid)) return false; - sPlayerbotAIConfig.logEvent(ai, "AhAction", proto->Name1, to_string(proto->ItemId)); + sPlayerbotAIConfig.logEvent(ai, "AhAction", proto->Name1, std::to_string(proto->ItemId)); - ostringstream out; + std::ostringstream out; out << "Posting " << ChatHelper::formatItem(itemQualifier, cnt) << " for " << ChatHelper::formatMoney(price) << " to the AH"; ai->TellPlayerNoFacing(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); return true; @@ -145,7 +144,7 @@ uint32 AhAction::GetSellPrice(ItemPrototype const* proto) return price; } -bool AhBidAction::ExecuteCommand(Player* requester, string text, Unit* auctioneer) +bool AhBidAction::ExecuteCommand(Player* requester, std::string text, Unit* auctioneer) { AuctionHouseEntry const* auctionHouseEntry = bot->GetSession()->GetCheckedAuctionHouseForAuctioneer(auctioneer->GetObjectGuid()); if (!auctionHouseEntry) @@ -164,7 +163,7 @@ bool AhBidAction::ExecuteCommand(Player* requester, string text, Unit* auctionee AuctionEntry* auction = nullptr; - vector> auctionPowers; + std::vector> auctionPowers; if (text == "vendor") { @@ -175,7 +174,7 @@ bool AhBidAction::ExecuteCommand(Player* requester, string text, Unit* auctionee if (totalcount > 10) //Already have 10 bids, stop. return false; - unordered_map freeMoney; + std::unordered_map freeMoney; freeMoney[ItemUsage::ITEM_USAGE_EQUIP] = freeMoney[ItemUsage::ITEM_USAGE_BAD_EQUIP] = (uint32)NeedMoneyFor::gear; freeMoney[ItemUsage::ITEM_USAGE_USE] = (uint32)NeedMoneyFor::consumables; @@ -236,7 +235,7 @@ bool AhBidAction::ExecuteCommand(Player* requester, string text, Unit* auctionee power *= 1000; power /= (cost+1); - auctionPowers.push_back(make_pair(auction, power)); + auctionPowers.push_back(std::make_pair(auction, power)); } std::sort(auctionPowers.begin(), auctionPowers.end(), [](std::pair i, std::pair j) {return i > j; }); @@ -282,9 +281,9 @@ bool AhBidAction::ExecuteCommand(Player* requester, string text, Unit* auctionee } int pos = text.find(" "); - if (pos == string::npos) return false; + if (pos == std::string::npos) return false; - string priceStr = text.substr(0, pos); + std::string priceStr = text.substr(0, pos); uint32 price = ChatHelper::parseMoney(priceStr); for (auto curAuction : map) @@ -314,7 +313,7 @@ bool AhBidAction::ExecuteCommand(Player* requester, string text, Unit* auctionee power *= 1000; power /= cost; - auctionPowers.push_back(make_pair(auction, power)); + auctionPowers.push_back(std::make_pair(auction, power)); } if (auctionPowers.empty()) @@ -361,8 +360,8 @@ bool AhBidAction::BidItem(Player* requester, AuctionEntry* auction, uint32 price if (bot->GetMoney() < oldMoney) { - sPlayerbotAIConfig.logEvent(ai, "AhBidAction", proto->Name1, to_string(proto->ItemId)); - ostringstream out; + sPlayerbotAIConfig.logEvent(ai, "AhBidAction", proto->Name1, std::to_string(proto->ItemId)); + std::ostringstream out; out << "Bidding " << ChatHelper::formatMoney(price) << " on " << ChatHelper::formatItem(itemQualifier, count) << " on the AH"; ai->TellPlayerNoFacing(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); return true; diff --git a/playerbot/strategy/actions/AhAction.h b/playerbot/strategy/actions/AhAction.h index 14acbc30..2541a2f8 100644 --- a/playerbot/strategy/actions/AhAction.h +++ b/playerbot/strategy/actions/AhAction.h @@ -6,24 +6,24 @@ namespace ai class AhAction : public ChatCommandAction { public: - AhAction(PlayerbotAI* ai, string name = "ah") : ChatCommandAction(ai, name) {} + AhAction(PlayerbotAI* ai, std::string name = "ah") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; private: - virtual bool ExecuteCommand(Player* requester, string text, Unit* auctioneer); + virtual bool ExecuteCommand(Player* requester, std::string text, Unit* auctioneer); bool PostItem(Player* requester, Item* item, uint32 price, Unit* auctioneer, uint32 time); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "ah"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "ah"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will make bots auction items to a nearby auction houses.\n" "Usage: ah [itemlink] \n" "Example: ah vendor (post items based on item use)\n" "Example: ah [itemlink] 5g\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "nearest npcs", "inventory items", "item usage", "free money for" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "nearest npcs", "inventory items", "item usage", "free money for" }; } #endif protected: uint32 GetSellPrice(ItemPrototype const* proto); @@ -35,8 +35,8 @@ namespace ai AhBidAction(PlayerbotAI* ai) : AhAction(ai, "ah bid") {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "ah bid"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "ah bid"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will make bots bid on a specific item with a specific budget on a nearby auctionhouse.\n" "The highest item/gold auction will be used that falls below the given budget.\n" @@ -44,11 +44,11 @@ namespace ai "Example: ah bid vendor (bid on items based on item use)\n" "Example: ah bid [itemlink] 5g\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "nearest npcs", "item usage", "free money for" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "nearest npcs", "item usage", "free money for" }; } #endif private: - virtual bool ExecuteCommand(Player* requester, string text, Unit* auctioneer); + virtual bool ExecuteCommand(Player* requester, std::string text, Unit* auctioneer); bool BidItem(Player* requester, AuctionEntry* auction, uint32 price, Unit* auctioneer); }; } diff --git a/playerbot/strategy/actions/ArenaTeamActions.cpp b/playerbot/strategy/actions/ArenaTeamActions.cpp index ff0c8536..856fd858 100644 --- a/playerbot/strategy/actions/ArenaTeamActions.cpp +++ b/playerbot/strategy/actions/ArenaTeamActions.cpp @@ -10,7 +10,6 @@ #endif #endif -using namespace std; using namespace ai; bool ArenaTeamAcceptAction::Execute(Event& event) diff --git a/playerbot/strategy/actions/AttackAction.cpp b/playerbot/strategy/actions/AttackAction.cpp index 2b5d6011..b520b447 100644 --- a/playerbot/strategy/actions/AttackAction.cpp +++ b/playerbot/strategy/actions/AttackAction.cpp @@ -172,7 +172,7 @@ bool AttackAction::Attack(Player* requester, Unit* target) bool AttackAction::IsTargetValid(Player* requester, Unit* target) { - ostringstream msg; + std::ostringstream msg; if (!target) { if (verbose) ai->TellError(requester, "I have no target"); diff --git a/playerbot/strategy/actions/AttackAction.h b/playerbot/strategy/actions/AttackAction.h index 20e57214..4fcc8d48 100644 --- a/playerbot/strategy/actions/AttackAction.h +++ b/playerbot/strategy/actions/AttackAction.h @@ -8,7 +8,7 @@ namespace ai class AttackAction : public MovementAction { public: - AttackAction(PlayerbotAI* ai, string name) : MovementAction(ai, name) {} + AttackAction(PlayerbotAI* ai, std::string name) : MovementAction(ai, name) {} public: virtual bool Execute(Event& event); @@ -22,7 +22,7 @@ namespace ai class AttackMyTargetAction : public AttackAction { public: - AttackMyTargetAction(PlayerbotAI* ai, string name = "attack my target") : AttackAction(ai, name) {} + AttackMyTargetAction(PlayerbotAI* ai, std::string name = "attack my target") : AttackAction(ai, name) {} public: virtual bool Execute(Event& event); @@ -32,7 +32,7 @@ namespace ai class AttackRTITargetAction : public AttackAction { public: - AttackRTITargetAction(PlayerbotAI* ai, string name = "attack rti target") : AttackAction(ai, name) {} + AttackRTITargetAction(PlayerbotAI* ai, std::string name = "attack rti target") : AttackAction(ai, name) {} public: virtual bool Execute(Event& event); @@ -42,7 +42,7 @@ namespace ai class AttackDuelOpponentAction : public AttackAction { public: - AttackDuelOpponentAction(PlayerbotAI* ai, string name = "attack duel opponent") : AttackAction(ai, name) {} + AttackDuelOpponentAction(PlayerbotAI* ai, std::string name = "attack duel opponent") : AttackAction(ai, name) {} public: virtual bool Execute(Event& event); diff --git a/playerbot/strategy/actions/AutoLearnSpellAction.cpp b/playerbot/strategy/actions/AutoLearnSpellAction.cpp index 7a07ba64..0ce8ff2b 100644 --- a/playerbot/strategy/actions/AutoLearnSpellAction.cpp +++ b/playerbot/strategy/actions/AutoLearnSpellAction.cpp @@ -8,9 +8,9 @@ using namespace ai; bool AutoLearnSpellAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string param = event.getParam(); + std::string param = event.getParam(); - ostringstream out; + std::ostringstream out; LearnSpells(&out); @@ -22,7 +22,7 @@ bool AutoLearnSpellAction::Execute(Event& event) out.seekp(-2, out.cur); out << "."; - map args; + std::map args; args["%spells"] = out.str(); ai->TellPlayer(requester, BOT_TEXT2("auto_learn_spell", args), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } @@ -30,7 +30,7 @@ bool AutoLearnSpellAction::Execute(Event& event) return true; } -void AutoLearnSpellAction::LearnSpells(ostringstream* out) +void AutoLearnSpellAction::LearnSpells(std::ostringstream* out) { if (sPlayerbotAIConfig.guildFeedbackRate && frand(0, 100) <= sPlayerbotAIConfig.guildFeedbackRate && bot->GetGuildId() && sRandomPlayerbotMgr.IsFreeBot(bot)) { @@ -38,8 +38,8 @@ void AutoLearnSpellAction::LearnSpells(ostringstream* out) if (guild) { - map placeholders; - placeholders["%level"] = to_string(bot->GetLevel()); + std::map placeholders; + placeholders["%level"] = std::to_string(bot->GetLevel()); if (urand(0, 3)) guild->BroadcastToGuild(bot->GetSession(), BOT_TEXT2("Ding!", placeholders), LANG_UNIVERSAL); @@ -67,7 +67,7 @@ void AutoLearnSpellAction::LearnSpells(ostringstream* out) } } -void AutoLearnSpellAction::LearnTrainerSpells(ostringstream* out) +void AutoLearnSpellAction::LearnTrainerSpells(std::ostringstream* out) { bot->learnDefaultSpells(); @@ -113,7 +113,7 @@ void AutoLearnSpellAction::LearnTrainerSpells(ostringstream* out) SpellEntry const* spell = sServerFacade.LookupSpellInfo(tSpell->spell); if (spell) { - string SpellName = spell->SpellName[0]; + std::string SpellName = spell->SpellName[0]; if (spell->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_SKILL_STEP) { uint32 skill = spell->EffectMiscValue[EFFECT_INDEX_1]; @@ -123,7 +123,7 @@ void AutoLearnSpellAction::LearnTrainerSpells(ostringstream* out) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (pSkill) { - if (SpellName.find("Apprentice") != string::npos && pSkill->categoryId == SKILL_CATEGORY_PROFESSION || pSkill->categoryId == SKILL_CATEGORY_SECONDARY) + if (SpellName.find("Apprentice") != std::string::npos && pSkill->categoryId == SKILL_CATEGORY_PROFESSION || pSkill->categoryId == SKILL_CATEGORY_SECONDARY) continue; } } @@ -137,7 +137,7 @@ void AutoLearnSpellAction::LearnTrainerSpells(ostringstream* out) } } -void AutoLearnSpellAction::LearnQuestSpells(ostringstream* out) +void AutoLearnSpellAction::LearnQuestSpells(std::ostringstream* out) { //CreatureInfo const* co = sCreatureStorage.LookupEntry(id); ObjectMgr::QuestMap const& questTemplates = sObjectMgr.GetQuestTemplates(); @@ -165,10 +165,10 @@ void AutoLearnSpellAction::LearnQuestSpells(ostringstream* out) } } -string formatSpell(SpellEntry const* sInfo) +std::string formatSpell(SpellEntry const* sInfo) { - ostringstream out; - string rank = sInfo->Rank[0]; + std::ostringstream out; + std::string rank = sInfo->Rank[0]; if(rank.empty()) out << "|cffffffff|Hspell:" << sInfo->Id << "|h[" << sInfo->SpellName[LOCALE_enUS] << "]|h|r"; @@ -177,7 +177,7 @@ string formatSpell(SpellEntry const* sInfo) return out.str(); } -void AutoLearnSpellAction::LearnSpell(uint32 spellId, ostringstream* out) +void AutoLearnSpellAction::LearnSpell(uint32 spellId, std::ostringstream* out) { SpellEntry const* proto = sServerFacade.LookupSpellInfo(spellId); diff --git a/playerbot/strategy/actions/AutoLearnSpellAction.h b/playerbot/strategy/actions/AutoLearnSpellAction.h index 18db8c21..8e6e3f05 100644 --- a/playerbot/strategy/actions/AutoLearnSpellAction.h +++ b/playerbot/strategy/actions/AutoLearnSpellAction.h @@ -8,15 +8,15 @@ namespace ai { class AutoLearnSpellAction : public Action { public: - AutoLearnSpellAction(PlayerbotAI* ai, string name = "auto learn spell") : Action(ai, name) {} + AutoLearnSpellAction(PlayerbotAI* ai, std::string name = "auto learn spell") : Action(ai, name) {} public: virtual bool Execute(Event& event); private: - void LearnSpells(ostringstream* out); - void LearnTrainerSpells(ostringstream* out); - void LearnQuestSpells(ostringstream* out); - void LearnSpell(uint32 spellId, ostringstream* out); + void LearnSpells(std::ostringstream* out); + void LearnTrainerSpells(std::ostringstream* out); + void LearnQuestSpells(std::ostringstream* out); + void LearnSpell(uint32 spellId, std::ostringstream* out); }; } diff --git a/playerbot/strategy/actions/BankAction.cpp b/playerbot/strategy/actions/BankAction.cpp index f0be8633..c07dfde8 100644 --- a/playerbot/strategy/actions/BankAction.cpp +++ b/playerbot/strategy/actions/BankAction.cpp @@ -3,16 +3,15 @@ #include "BankAction.h" #include "playerbot/strategy/values/ItemCountValue.h" -using namespace std; using namespace ai; bool BankAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); - list npcs = AI_VALUE(list, "nearest npcs no los"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs no los"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* npc = ai->GetUnit(*i); if (!npc || !npc->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER)) @@ -25,7 +24,7 @@ bool BankAction::Execute(Event& event) return false; } -bool BankAction::ExecuteCommand(Player* requester, const string& text, Unit* bank) +bool BankAction::ExecuteCommand(Player* requester, const std::string& text, Unit* bank) { if (text.empty() || text == "?") { @@ -36,8 +35,8 @@ bool BankAction::ExecuteCommand(Player* requester, const string& text, Unit* ban bool result = false; if (text[0] == '-') { - list found = ai->InventoryParseItems(text.substr(1), IterateItemsMask::ITERATE_ITEMS_IN_BANK); - for (list::iterator i = found.begin(); i != found.end(); i++) + std::list found = ai->InventoryParseItems(text.substr(1), IterateItemsMask::ITERATE_ITEMS_IN_BANK); + for (std::list::iterator i = found.begin(); i != found.end(); i++) { Item* item = *i; result &= Withdraw(requester, item->GetProto()->ItemId); @@ -45,11 +44,11 @@ bool BankAction::ExecuteCommand(Player* requester, const string& text, Unit* ban } else { - list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); + std::list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); if (found.empty()) return false; - for (list::iterator i = found.begin(); i != found.end(); i++) + for (std::list::iterator i = found.begin(); i != found.end(); i++) { Item* item = *i; if (!item) @@ -109,8 +108,8 @@ void BankAction::ListItems(Player* requester) { ai->TellPlayer(requester, "=== Bank ==="); - map items; - map soulbound; + std::map items; + std::map soulbound; for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) { if (Item* pItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, i)) diff --git a/playerbot/strategy/actions/BankAction.h b/playerbot/strategy/actions/BankAction.h index 63c63c79..4cccc0a9 100644 --- a/playerbot/strategy/actions/BankAction.h +++ b/playerbot/strategy/actions/BankAction.h @@ -10,7 +10,7 @@ namespace ai virtual bool Execute(Event& event) override; private: - bool ExecuteCommand(Player* requester, const string& text, Unit* bank); + bool ExecuteCommand(Player* requester, const std::string& text, Unit* bank); void ListItems(Player* requester); bool Withdraw(Player* requester, const uint32 itemid); bool Deposit(Player* requester, Item* pItem); diff --git a/playerbot/strategy/actions/BattleGroundJoinAction.cpp b/playerbot/strategy/actions/BattleGroundJoinAction.cpp index 6ecd8583..3ff75712 100644 --- a/playerbot/strategy/actions/BattleGroundJoinAction.cpp +++ b/playerbot/strategy/actions/BattleGroundJoinAction.cpp @@ -81,7 +81,7 @@ bool BGJoinAction::Execute(Event& event) { isArena = true; - vector::iterator i = find(ratedList.begin(), ratedList.end(), queueTypeId); + std::vector::iterator i = find(ratedList.begin(), ratedList.end(), queueTypeId); if (i != ratedList.end()) isRated = true; @@ -98,7 +98,7 @@ bool BGJoinAction::Execute(Event& event) // set bg type and bm guid //ai->GetAiObjectContext()->GetValue("bg master")->Set(BmGuid); - string _bgType; + std::string _bgType; switch (bgTypeId) { @@ -133,7 +133,7 @@ bool BGJoinAction::Execute(Event& event) ai->GetAiObjectContext()->GetValue("bg type")->Set(queueTypeId); queueType = queueTypeId; - sPlayerbotAIConfig.logEvent(ai, "BGJoinAction", _bgType, to_string(queueTypeId)); + sPlayerbotAIConfig.logEvent(ai, "BGJoinAction", _bgType, std::to_string(queueTypeId)); } return JoinQueue(queueType); @@ -171,7 +171,7 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type) return false; } - vector members; + std::vector members; // search for arena team members and make them online for (ArenaTeam::MemberList::iterator itr = arenateam->GetMembers().begin(); itr != arenateam->GetMembers().end(); ++itr) @@ -678,7 +678,7 @@ bool BGJoinAction::JoinQueue(uint32 type) bool isRated = false; uint8 arenaslot = 0; uint8 asGroup = false; - string _bgType; + std::string _bgType; // check if arena #ifndef MANGOSBOT_ZERO @@ -1050,7 +1050,7 @@ bool BGStatusAction::Execute(Event& event) uint32 statusid; uint32 Time1; uint32 Time2; - string _bgType; + std::string _bgType; uint8 isRated = 0; #ifndef MANGOSBOT_ZERO diff --git a/playerbot/strategy/actions/BattleGroundJoinAction.h b/playerbot/strategy/actions/BattleGroundJoinAction.h index 2cd09092..a60e1526 100644 --- a/playerbot/strategy/actions/BattleGroundJoinAction.h +++ b/playerbot/strategy/actions/BattleGroundJoinAction.h @@ -18,7 +18,7 @@ using namespace ai; class BGJoinAction : public Action { public: - BGJoinAction(PlayerbotAI* ai, string name = "bg join") : Action(ai, name) {} + BGJoinAction(PlayerbotAI* ai, std::string name = "bg join") : Action(ai, name) {} virtual bool Execute(Event& event); virtual bool isUseful(); virtual bool canJoinBg(BattleGroundQueueTypeId queueTypeId, BattleGroundBracketId bracketId); @@ -28,21 +28,21 @@ class BGJoinAction : public Action #endif protected: bool JoinQueue(uint32 type); - vector bgList; - vector ratedList; + std::vector bgList; + std::vector ratedList; }; class FreeBGJoinAction : public BGJoinAction { public: - FreeBGJoinAction(PlayerbotAI* ai, string name = "free bg join") : BGJoinAction(ai, name) {} + FreeBGJoinAction(PlayerbotAI* ai, std::string name = "free bg join") : BGJoinAction(ai, name) {} virtual bool shouldJoinBg(BattleGroundQueueTypeId queueTypeId, BattleGroundBracketId bracketId); }; class BGLeaveAction : public Action { public: - BGLeaveAction(PlayerbotAI* ai, string name = "bg leave") : Action(ai) {} + BGLeaveAction(PlayerbotAI* ai, std::string name = "bg leave") : Action(ai) {} virtual bool Execute(Event& event); }; @@ -57,7 +57,7 @@ class BGStatusAction : public Action class BGStatusCheckAction : public Action { public: - BGStatusCheckAction(PlayerbotAI* ai, string name = "bg status check") : Action(ai, name) {} + BGStatusCheckAction(PlayerbotAI* ai, std::string name = "bg status check") : Action(ai, name) {} virtual bool Execute(Event& event); virtual bool isUseful(); }; \ No newline at end of file diff --git a/playerbot/strategy/actions/BattleGroundTactics.cpp b/playerbot/strategy/actions/BattleGroundTactics.cpp index 125e5ad8..9cf991ac 100644 --- a/playerbot/strategy/actions/BattleGroundTactics.cpp +++ b/playerbot/strategy/actions/BattleGroundTactics.cpp @@ -3049,7 +3049,7 @@ bool BGTactics::selectObjective(bool reset) { BgObjective = pVanndar; endBoss = true; - ostringstream out; out << "Attacking Vanndar!"; + std::ostringstream out; out << "Attacking Vanndar!"; //bot->Say(out.str(), LANG_UNIVERSAL); } } @@ -3064,7 +3064,7 @@ bool BGTactics::selectObjective(bool reset) if (bot->IsWithinDist(pGO, VISIBILITY_DISTANCE_LARGE)) { BgObjective = pGO; - ostringstream out; out << "Attacking Snowfall GY!"; + std::ostringstream out; out << "Attacking Snowfall GY!"; //bot->Say(out.str(), LANG_UNIVERSAL); } } @@ -3084,12 +3084,12 @@ bool BGTactics::selectObjective(bool reset) // get in position to attack Captain pos.Set(AV_STONEHEARTH_WAITING_HORDE.x, AV_STONEHEARTH_WAITING_HORDE.y, AV_STONEHEARTH_WAITING_HORDE.z, bg->GetMapId()); - ostringstream out; out << "Taking position at Stonehearth!"; + std::ostringstream out; out << "Taking position at Stonehearth!"; //bot->Say(out.str(), LANG_UNIVERSAL); } else { - ostringstream out; out << "Attacking Balinda!"; + std::ostringstream out; out << "Attacking Balinda!"; //bot->Say(out.str(), LANG_UNIVERSAL); } BgObjective = pBalinda; @@ -3191,7 +3191,7 @@ bool BGTactics::selectObjective(bool reset) { BgObjective = pDrek; endBoss = true; - ostringstream out; out << "Attacking DrekThar!"; + std::ostringstream out; out << "Attacking DrekThar!"; //bot->Say(out.str(), LANG_UNIVERSAL); } } @@ -3206,7 +3206,7 @@ bool BGTactics::selectObjective(bool reset) if (bot->IsWithinDist(pGO, VISIBILITY_DISTANCE_LARGE)) { BgObjective = pGO; - ostringstream out; out << "Attacking Snowfall GY!"; + std::ostringstream out; out << "Attacking Snowfall GY!"; //bot->Say(out.str(), LANG_UNIVERSAL); } } @@ -3226,12 +3226,12 @@ bool BGTactics::selectObjective(bool reset) // get in position to attack Captain pos.Set(AV_ICEBLOOD_GARRISON_WAITING_ALLIANCE.x, AV_ICEBLOOD_GARRISON_WAITING_ALLIANCE.y, AV_ICEBLOOD_GARRISON_WAITING_ALLIANCE.z, bg->GetMapId()); - ostringstream out; out << "Taking position at Stonehearth!"; + std::ostringstream out; out << "Taking position at Stonehearth!"; //bot->Say(out.str(), LANG_UNIVERSAL); } else { - ostringstream out; out << "Attacking Balinda!"; + std::ostringstream out; out << "Attacking Balinda!"; //bot->Say(out.str(), LANG_UNIVERSAL); } BgObjective = pGalvangar; @@ -3554,7 +3554,7 @@ bool BGTactics::selectObjective(bool reset) { pos.Set(BgObjective->GetPositionX(), BgObjective->GetPositionY(), BgObjective->GetPositionZ(), BgObjective->GetMapId()); posMap["bg objective"] = pos; - string ObjVerbose = ""; + std::string ObjVerbose = ""; if (std::abs(pos.x - 977.016) <= 10.0) ObjVerbose = "Blacksmith"; else if (std::abs(pos.x - 806.182) <= 10.0) ObjVerbose = "Farm"; @@ -4577,7 +4577,7 @@ bool BGTactics::moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 curr else currPoint++; - uint32 nPoint = reverse ? max((int)(currPoint - urand(1, 5)), 0) : min((uint32)(currPoint + urand(1, 5)), lastPointInPath); + uint32 nPoint = reverse ? std::max((int)(currPoint - urand(1, 5)), 0) : std::min((uint32)(currPoint + urand(1, 5)), lastPointInPath); if (reverse && nPoint < 0) nPoint = 0; @@ -4712,8 +4712,8 @@ bool BGTactics::atFlag(std::vector const& vPaths, std::vectorGetTypeId(true); #endif - list closeObjects; - list closePlayers; + std::list closeObjects; + std::list closePlayers; float flagRange; switch (bgType) @@ -4724,8 +4724,8 @@ bool BGTactics::atFlag(std::vector const& vPaths, std::vectorGetValue >("closest game objects"); - closePlayers = *context->GetValue >("closest friendly players"); + closeObjects = *context->GetValue >("closest game objects"); + closePlayers = *context->GetValue >("closest friendly players"); flagRange = INTERACTION_DISTANCE; break; } @@ -4734,8 +4734,8 @@ bool BGTactics::atFlag(std::vector const& vPaths, std::vectorGetValue >("nearest game objects no los"); - closePlayers = *context->GetValue >("closest friendly players"); + closeObjects = *context->GetValue >("nearest game objects no los"); + closePlayers = *context->GetValue >("closest friendly players"); flagRange = VISIBILITY_DISTANCE_TINY; break; } @@ -4761,13 +4761,13 @@ bool BGTactics::atFlag(std::vector const& vPaths, std::vectorSay(out.str(), LANG_UNIVERSAL); - for (list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) + for (std::list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) { GameObject* go = ai->GetGameObject(*i); if (!go) continue; - vector::const_iterator f = find(vFlagIds.begin(), vFlagIds.end(), go->GetEntry()); + std::vector::const_iterator f = find(vFlagIds.begin(), vFlagIds.end(), go->GetEntry()); if (f == vFlagIds.end()) continue; @@ -4966,7 +4966,7 @@ bool BGTactics::useBuff() bgType = bg->GetTypeId(true); #endif - list closeObjects = AI_VALUE(list, "nearest game objects no los"); + std::list closeObjects = AI_VALUE(std::list, "nearest game objects no los"); if (closeObjects.empty()) return false; @@ -4979,7 +4979,7 @@ bool BGTactics::useBuff() #endif bool foundBuff = false; - for (list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) + for (std::list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) { GameObject* go = ai->GetGameObject(*i); if (!go) @@ -5071,8 +5071,8 @@ bool BGTactics::IsLockedInsideKeep() if (!isInside) return false; - list closeObjects; - closeObjects = *context->GetValue >("nearest game objects no los"); + std::list closeObjects; + closeObjects = *context->GetValue >("nearest game objects no los"); if (closeObjects.empty()) return moveToStart(true); @@ -5112,7 +5112,7 @@ bool BGTactics::IsLockedInsideKeep() } } - for (list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) + for (std::list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) { GameObject* go = ai->GetGameObject(*i); if (!go) diff --git a/playerbot/strategy/actions/BattleGroundTactics.h b/playerbot/strategy/actions/BattleGroundTactics.h index e1c0dd15..9c3efcf1 100644 --- a/playerbot/strategy/actions/BattleGroundTactics.h +++ b/playerbot/strategy/actions/BattleGroundTactics.h @@ -43,7 +43,7 @@ extern std::vector const vPaths_IC; class BGTactics : public MovementAction { public: - BGTactics(PlayerbotAI* ai, string name = "bg tactics") : MovementAction(ai, name) {} + BGTactics(PlayerbotAI* ai, std::string name = "bg tactics") : MovementAction(ai, name) {} virtual bool Execute(Event& event); private: bool moveToStart(bool force = false); @@ -69,7 +69,7 @@ class BGTactics : public MovementAction class ArenaTactics : public MovementAction { public: - ArenaTactics(PlayerbotAI* ai, string name = "arena tactics") : MovementAction(ai, name) {} + ArenaTactics(PlayerbotAI* ai, std::string name = "arena tactics") : MovementAction(ai, name) {} virtual bool Execute(Event& event); private: bool moveToCenter(BattleGround *bg); diff --git a/playerbot/strategy/actions/BotStateActions.h b/playerbot/strategy/actions/BotStateActions.h index 5f9dace6..33ee6d27 100644 --- a/playerbot/strategy/actions/BotStateActions.h +++ b/playerbot/strategy/actions/BotStateActions.h @@ -7,21 +7,21 @@ namespace ai class SetCombatStateAction : public Action { public: - SetCombatStateAction(PlayerbotAI* ai, string name = "set combat state") : Action(ai, name) {} + SetCombatStateAction(PlayerbotAI* ai, std::string name = "set combat state") : Action(ai, name) {} bool Execute(Event& event) override; }; class SetNonCombatStateAction : public Action { public: - SetNonCombatStateAction(PlayerbotAI* ai, string name = "set non combat state") : Action(ai, name) {} + SetNonCombatStateAction(PlayerbotAI* ai, std::string name = "set non combat state") : Action(ai, name) {} bool Execute(Event& event) override; }; class SetDeadStateAction : public Action { public: - SetDeadStateAction(PlayerbotAI* ai, string name = "set dead state") : Action(ai, name) {} + SetDeadStateAction(PlayerbotAI* ai, std::string name = "set dead state") : Action(ai, name) {} bool Execute(Event& event) override; }; } diff --git a/playerbot/strategy/actions/BuffAction.cpp b/playerbot/strategy/actions/BuffAction.cpp index 371e6407..142cd372 100644 --- a/playerbot/strategy/actions/BuffAction.cpp +++ b/playerbot/strategy/actions/BuffAction.cpp @@ -44,7 +44,7 @@ class FindBuffVisitor : public IterateItemsVisitor { return true; if (items.find(proto->SubClass) == items.end()) - items[proto->SubClass] = list(); + items[proto->SubClass] = std::list(); items[proto->SubClass].push_back(item); break; @@ -54,7 +54,7 @@ class FindBuffVisitor : public IterateItemsVisitor { } public: - map > items; + std::map > items; private: Player* bot; @@ -84,16 +84,16 @@ void BuffAction::TellHeader(uint32 subClass, Player* requester) bool BuffAction::Execute(Event& event) { - string text = event.getParam(); + std::string text = event.getParam(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); FindBuffVisitor visitor(bot); ai->InventoryIterateItems(&visitor, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); uint32 oldSubClass = -1; - for (map >::iterator i = visitor.items.begin(); i != visitor.items.end(); ++i) + for (std::map >::iterator i = visitor.items.begin(); i != visitor.items.end(); ++i) { - list items = i->second; + std::list items = i->second; uint32 subClass = i->first; if (oldSubClass != subClass) @@ -105,10 +105,10 @@ bool BuffAction::Execute(Event& event) oldSubClass = subClass; } - for (list::iterator j = items.begin(); j != items.end(); ++j) + for (std::list::iterator j = items.begin(); j != items.end(); ++j) { Item* item = *j; - ostringstream out; + std::ostringstream out; out << chat->formatItem(item, item->GetCount()); ai->TellPlayer(requester, out); } diff --git a/playerbot/strategy/actions/BuyAction.cpp b/playerbot/strategy/actions/BuyAction.cpp index 6e01e9a1..74ff8bb3 100644 --- a/playerbot/strategy/actions/BuyAction.cpp +++ b/playerbot/strategy/actions/BuyAction.cpp @@ -15,7 +15,7 @@ bool BuyAction::Execute(Event& event) Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bool buyUseful = false; ItemIds itemIds; - string link = event.getParam(); + std::string link = event.getParam(); if (link == "vendor") buyUseful = true; @@ -24,9 +24,9 @@ bool BuyAction::Execute(Event& event) itemIds = chat->parseItems(link); } - list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); + std::list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); bool vendored = false, result = false; - for (list::iterator i = vendors.begin(); i != vendors.end(); ++i) + for (std::list::iterator i = vendors.begin(); i != vendors.end(); ++i) { ObjectGuid vendorguid = *i; Creature *pCreature = bot->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); @@ -78,7 +78,7 @@ bool BuyAction::Execute(Event& event) NeedMoneyFor needMoneyFor = NeedMoneyFor::none; - unordered_map freeMoney; + std::unordered_map freeMoney; freeMoney[ItemUsage::ITEM_USAGE_EQUIP] = (uint32)NeedMoneyFor::gear; freeMoney[ItemUsage::ITEM_USAGE_USE] = (uint32)NeedMoneyFor::consumables; @@ -111,7 +111,7 @@ bool BuyAction::Execute(Event& event) break; RESET_AI_VALUE2(ItemUsage, "item usage", tItem->item); - RESET_AI_VALUE(vector, "mount list"); + RESET_AI_VALUE(std::vector, "mount list"); if (usage == ItemUsage::ITEM_USAGE_EQUIP || usage == ItemUsage::ITEM_USAGE_BAD_EQUIP) //Equip upgrades and stop buying this time. { @@ -141,7 +141,7 @@ bool BuyAction::Execute(Event& event) if (!result) { - ostringstream out; out << "Nobody sells " << ChatHelper::formatItem(proto) << " nearby"; + std::ostringstream out; out << "Nobody sells " << ChatHelper::formatItem(proto) << " nearby"; ai->TellPlayer(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } } @@ -187,9 +187,9 @@ bool BuyAction::BuyItem(Player* requester, VendorItemData const* tItems, ObjectG if (oldCount < AI_VALUE2(uint32, "item count", proto->Name1)) //BuyItem Always returns false (unless unique) so we have to check the item counts. { - sPlayerbotAIConfig.logEvent(ai, "BuyAction", proto->Name1, to_string(proto->ItemId)); + sPlayerbotAIConfig.logEvent(ai, "BuyAction", proto->Name1, std::to_string(proto->ItemId)); - ostringstream out; out << "Buying " << ChatHelper::formatItem(proto); + std::ostringstream out; out << "Buying " << ChatHelper::formatItem(proto); ai->TellPlayer(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); return true; } @@ -204,9 +204,9 @@ bool BuyAction::BuyItem(Player* requester, VendorItemData const* tItems, ObjectG bool BuyBackAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); - list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BUYBACK); + std::list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BUYBACK); //Sort items on itemLevel descending. found.sort([](Item* i, Item* j) {return i->GetProto()->ItemLevel > j->GetProto()->ItemLevel; }); @@ -221,8 +221,8 @@ bool BuyBackAction::Execute(Event& event) //Find vendor to interact with. ObjectGuid vendorguid; - list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); - for (list::iterator i = vendors.begin(); i != vendors.end(); ++i) + std::list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); + for (std::list::iterator i = vendors.begin(); i != vendors.end(); ++i) { vendorguid = *i; Creature* pCreature = bot->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); diff --git a/playerbot/strategy/actions/BuyAction.h b/playerbot/strategy/actions/BuyAction.h index 07cd393b..8dba3ab8 100644 --- a/playerbot/strategy/actions/BuyAction.h +++ b/playerbot/strategy/actions/BuyAction.h @@ -6,43 +6,43 @@ namespace ai class BuyAction : public ChatCommandAction { public: - BuyAction(PlayerbotAI* ai, string name = "buy") : ChatCommandAction(ai, name) {} + BuyAction(PlayerbotAI* ai, std::string name = "buy") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; private: bool BuyItem(Player* requester, VendorItemData const* tItems, ObjectGuid vendorguid, const ItemPrototype* proto); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "buy"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "buy"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will make bots buy items from a nearby vendor.\n" "Usage: buy [itemlink]\n" "Example: buy usefull (buy based on item use)\n" "Example: buy [itemlink]\n"; } - virtual vector GetUsedActions() { return { "equip upgrades" }; } - virtual vector GetUsedValues() { return { "nearest npcs", "item count", "item usage", "free money for"}; } + virtual std::vector GetUsedActions() { return { "equip upgrades" }; } + virtual std::vector GetUsedValues() { return { "nearest npcs", "item count", "item usage", "free money for"}; } #endif }; class BuyBackAction : public BuyAction { public: - BuyBackAction(PlayerbotAI* ai, string name = "buyback") : BuyAction(ai, name) {} + BuyBackAction(PlayerbotAI* ai, std::string name = "buyback") : BuyAction(ai, name) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "buyback"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "buyback"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will make bots retrieve items after being sold.\n" "Usage: buyback [itemlink]\n" "Example: buyback all (try to get all items back)\n" "Example: buyback [itemlink] (get a specific item back)\n"; } - virtual vector GetUsedActions() { return { "" }; } - virtual vector GetUsedValues() { return { "nearest npcs", "item count", "bag space"}; } + virtual std::vector GetUsedActions() { return { "" }; } + virtual std::vector GetUsedValues() { return { "nearest npcs", "item count", "bag space"}; } #endif }; } diff --git a/playerbot/strategy/actions/CastCustomSpellAction.cpp b/playerbot/strategy/actions/CastCustomSpellAction.cpp index 9cc3028d..cf5e4213 100644 --- a/playerbot/strategy/actions/CastCustomSpellAction.cpp +++ b/playerbot/strategy/actions/CastCustomSpellAction.cpp @@ -8,10 +8,10 @@ using namespace ai; -int FindLastSeparator(string text, string sep) +int FindLastSeparator(std::string text, std::string sep) { int pos = text.rfind(sep); - if (pos == string::npos) return pos; + if (pos == std::string::npos) return pos; int lastLinkBegin = text.rfind("|H"); int lastLinkEnd = text.find("|h|r", lastLinkBegin + 1); @@ -36,7 +36,7 @@ bool CastCustomSpellAction::Execute(Event& event) return false; Unit* target = NULL; - string text = getQualifier(); + std::string text = getQualifier(); if(text.empty()) text = event.getParam(); @@ -49,7 +49,7 @@ bool CastCustomSpellAction::Execute(Event& event) return true; } - list gos = chat->parseGameobjects(text); + std::list gos = chat->parseGameobjects(text); if (!gos.empty()) { @@ -86,10 +86,10 @@ bool CastCustomSpellAction::Execute(Event& event) int pos = FindLastSeparator(text, " "); int castCount = 1; - if (pos != string::npos) + if (pos != std::string::npos) { - string param = text.substr(pos + 1); - list items = ai->InventoryParseItems(param, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); + std::string param = text.substr(pos + 1); + std::list items = ai->InventoryParseItems(param, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); if (!items.empty()) itemTarget = *items.begin(); else { @@ -103,7 +103,7 @@ bool CastCustomSpellAction::Execute(Event& event) if (!spell) { - map args; + std::map args; args["%spell"] = text; ai->TellPlayerNoFacing(requester, BOT_TEXT2("cast_spell_command_error_unknown_spell", args)); return false; @@ -112,7 +112,7 @@ bool CastCustomSpellAction::Execute(Event& event) SpellEntry const* pSpellInfo = sServerFacade.LookupSpellInfo(spell); if (!pSpellInfo) { - map args; + std::map args; args["%spell"] = text; ai->TellPlayerNoFacing(requester, BOT_TEXT2("cast_spell_command_error_unknown_spell", args)); return false; @@ -137,7 +137,7 @@ bool CastCustomSpellAction::Execute(Event& event) { sServerFacade.SetFacingTo(bot, target); SetDuration(sPlayerbotAIConfig.globalCoolDown); - ostringstream msg; + std::ostringstream msg; msg << "cast " << text; ai->HandleCommand(CHAT_MSG_WHISPER, msg.str(), *requester); return true; @@ -167,8 +167,8 @@ bool CastCustomSpellAction::Execute(Event& event) ai->RemoveShapeshift(); - ostringstream replyStr; - map replyArgs; + std::ostringstream replyStr; + std::map replyArgs; if (!pSpellInfo->EffectItemType[0]) { replyStr << BOT_TEXT("cast_spell_command_spell"); @@ -205,7 +205,7 @@ bool CastCustomSpellAction::Execute(Event& event) if (!bot->GetTrader() && !ai->CanCastSpell(spell, target, 0, true, itemTarget, false)) { - map args; + std::map args; args["%spell"] = replyArgs["%spell"]; ai->TellPlayerNoFacing(requester, BOT_TEXT2("cast_spell_command_error", args)); return false; @@ -221,7 +221,7 @@ bool CastCustomSpellAction::Execute(Event& event) if (castCount > 1) { - ostringstream cmd; + std::ostringstream cmd; cmd << castString(target) << " " << text << " " << (castCount - 1); ai->HandleCommand(CHAT_MSG_WHISPER, cmd.str(), *requester); @@ -233,7 +233,7 @@ bool CastCustomSpellAction::Execute(Event& event) } else { - map args; + std::map args; args["%spell"] = replyArgs["%spell"]; ai->TellPlayerNoFacing(requester, BOT_TEXT2("cast_spell_command_error_failed", args)); } @@ -245,16 +245,16 @@ bool CastCustomSpellAction::CastSummonPlayer(Player* requester, std::string comm { if (bot->getClass() == CLASS_WARLOCK) { - if (command.find("summon") != string::npos) + if (command.find("summon") != std::string::npos) { // Don't summon player when trying to summon warlock pet - if (command.find("imp") != string::npos || - command.find("voidwalker") != string::npos || - command.find("succubus") != string::npos || - command.find("felhunter") != string::npos || - command.find("felguard") != string::npos || - command.find("felsteed") != string::npos || - command.find("dreadsteed") != string::npos) + if (command.find("imp") != std::string::npos || + command.find("voidwalker") != std::string::npos || + command.find("succubus") != std::string::npos || + command.find("felhunter") != std::string::npos || + command.find("felguard") != std::string::npos || + command.find("felsteed") != std::string::npos || + command.find("dreadsteed") != std::string::npos) { return false; } @@ -347,10 +347,10 @@ bool CastCustomSpellAction::CastSummonPlayer(Player* requester, std::string comm target->TeleportTo(bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), bot->GetOrientation()); } - ostringstream msg; + std::ostringstream msg; msg << "Summoning " << target->GetName(); - map args; + std::map args; args["%target"] = target->GetName(); ai->TellPlayerNoFacing(requester, BOT_TEXT2("cast_spell_command_summon", args), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); SetDuration(sPlayerbotAIConfig.globalCoolDown); @@ -379,18 +379,18 @@ bool CastCustomSpellAction::CastSummonPlayer(Player* requester, std::string comm bool CastRandomSpellAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - list> spellMap = GetSpellList(); + std::list> spellMap = GetSpellList(); Unit* target = nullptr; GameObject* got = nullptr; - string name = event.getParam(); + std::string name = event.getParam(); if (name.empty()) { name = getName(); } - list wos = chat->parseGameobjects(name); + std::list wos = chat->parseGameobjects(name); for (auto wo : wos) { @@ -422,7 +422,7 @@ bool CastRandomSpellAction::Execute(Event& event) target = bot; } - vector>> spellList; + std::vector>> spellList; for (auto & spell : spellMap) { uint32 spellId = spell.first; @@ -449,22 +449,22 @@ bool CastRandomSpellAction::Execute(Event& event) if (target && ai->CanCastSpell(spellId, target, true)) { - spellList.push_back(make_pair(spellId,make_pair(spellPriority, target))); + spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, target))); } if (target && ai->CanCastSpell(spellId, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), true)) { - spellList.push_back(make_pair(spellId, make_pair(spellPriority, target))); + spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, target))); } if (got && ai->CanCastSpell(spellId, got->GetPositionX(), got->GetPositionY(), got->GetPositionZ(), true)) { - spellList.push_back(make_pair(spellId, make_pair(spellPriority, got))); + spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, got))); } if (ai->CanCastSpell(spellId, bot, true)) { - spellList.push_back(make_pair(spellId, make_pair(spellPriority, bot))); + spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, bot))); } } } @@ -476,7 +476,7 @@ bool CastRandomSpellAction::Execute(Event& event) bool isCast = false; - std::sort(spellList.begin(), spellList.end(), [](pair> i, pair> j) {return i.first > j.first; }); + std::sort(spellList.begin(), spellList.end(), [](std::pair> i, std::pair> j) {return i.first > j.first; }); uint32 rndBound = spellList.size() / 4; @@ -556,10 +556,10 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo, Player* r bool CraftRandomItemAction::Execute(Event& event) { - vector spellIds = AI_VALUE(vector, "craft spells"); + std::vector spellIds = AI_VALUE(std::vector, "craft spells"); std::shuffle(spellIds.begin(), spellIds.end(),*GetRandomGenerator()); - list wos = chat->parseGameobjects(name); + std::list wos = chat->parseGameobjects(name); WorldObject* wot = nullptr; for (auto wo : wos) @@ -605,7 +605,7 @@ bool CraftRandomItemAction::Execute(Event& event) if (!proto) continue; - ostringstream cmd; + std::ostringstream cmd; cmd << "castnc "; @@ -627,7 +627,7 @@ bool CraftRandomItemAction::Execute(Event& event) bool DisenchantRandomItemAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - list items = AI_VALUE2(list, "inventory item ids", "usage " + to_string((uint8)ItemUsage::ITEM_USAGE_DISENCHANT)); + std::list items = AI_VALUE2(std::list, "inventory item ids", "usage " + std::to_string((uint8)ItemUsage::ITEM_USAGE_DISENCHANT)); items.reverse(); diff --git a/playerbot/strategy/actions/CastCustomSpellAction.h b/playerbot/strategy/actions/CastCustomSpellAction.h index 4a2dc4d0..c1c1e53f 100644 --- a/playerbot/strategy/actions/CastCustomSpellAction.h +++ b/playerbot/strategy/actions/CastCustomSpellAction.h @@ -3,18 +3,18 @@ #include "playerbot/strategy/values/CraftValues.h" #include "playerbot/strategy/values/ItemUsageValue.h" #include "GenericActions.h" -#include "../../RandomItemMgr.h" +#include "playerbot/RandomItemMgr.h" namespace ai { class CastCustomSpellAction : public ChatCommandAction, public Qualified { public: - CastCustomSpellAction(PlayerbotAI* ai, string name = "cast") : ChatCommandAction(ai, name), Qualified() {} + CastCustomSpellAction(PlayerbotAI* ai, std::string name = "cast") : ChatCommandAction(ai, name), Qualified() {} virtual bool Execute(Event& event) override; - virtual string castString(WorldObject* target) { return "cast"; } + virtual std::string castString(WorldObject* target) { return "cast"; } virtual uint32 getDuration() const { return 3000U; } - virtual string GetTargetName() override { return "current target"; } + virtual std::string GetTargetName() override { return "current target"; } private: bool CastSummonPlayer(Player* requester, std::string command); @@ -26,15 +26,15 @@ namespace ai class CastCustomNcSpellAction : public CastCustomSpellAction { public: - CastCustomNcSpellAction(PlayerbotAI* ai, string name = "cast custom nc spell") : CastCustomSpellAction(ai, name) {} + CastCustomNcSpellAction(PlayerbotAI* ai, std::string name = "cast custom nc spell") : CastCustomSpellAction(ai, name) {} virtual bool isUseful() { return !bot->IsMoving(); } - virtual string castString(WorldObject* target) { return "castnc" +(target ? " "+ chat->formatWorldobject(target):""); } + virtual std::string castString(WorldObject* target) { return "castnc" +(target ? " "+ chat->formatWorldobject(target):""); } }; class CastRandomSpellAction : public ListSpellsAction { public: - CastRandomSpellAction(PlayerbotAI* ai, string name = "cast random spell") : ListSpellsAction(ai, name) {} + CastRandomSpellAction(PlayerbotAI* ai, std::string name = "cast random spell") : ListSpellsAction(ai, name) {} virtual bool AcceptSpell(const SpellEntry* pSpellInfo) { @@ -66,7 +66,7 @@ namespace ai { public: DisenchantRandomItemAction(PlayerbotAI* ai) : CastCustomSpellAction(ai, "disenchant random item") {} - virtual bool isUseful() { return ai->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat() && AI_VALUE2(uint32, "item count", "usage " + to_string((uint8)ItemUsage::ITEM_USAGE_DISENCHANT)) > 0; } + virtual bool isUseful() { return ai->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat() && AI_VALUE2(uint32, "item count", "usage " + std::to_string((uint8)ItemUsage::ITEM_USAGE_DISENCHANT)) > 0; } virtual bool Execute(Event& event) override; }; diff --git a/playerbot/strategy/actions/ChangeChatAction.cpp b/playerbot/strategy/actions/ChangeChatAction.cpp index 9e782716..09df8fb6 100644 --- a/playerbot/strategy/actions/ChangeChatAction.cpp +++ b/playerbot/strategy/actions/ChangeChatAction.cpp @@ -7,17 +7,17 @@ using namespace ai; bool ChangeChatAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); ChatMsg parsed = chat->parseChat(text); if (parsed == CHAT_MSG_SYSTEM) { - ostringstream out; out << "Current chat is " << chat->formatChat(*context->GetValue("chat")); + std::ostringstream out; out << "Current chat is " << chat->formatChat(*context->GetValue("chat")); ai->TellPlayer(requester, out); } else { context->GetValue("chat")->Set(parsed); - ostringstream out; out << "Chat set to " << chat->formatChat(parsed); + std::ostringstream out; out << "Chat set to " << chat->formatChat(parsed); ai->TellPlayer(requester, out); } diff --git a/playerbot/strategy/actions/ChangeStrategyAction.cpp b/playerbot/strategy/actions/ChangeStrategyAction.cpp index d6cce8ba..c6f16671 100644 --- a/playerbot/strategy/actions/ChangeStrategyAction.cpp +++ b/playerbot/strategy/actions/ChangeStrategyAction.cpp @@ -8,14 +8,14 @@ using namespace ai; bool ChangeCombatStrategyAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); text = text.empty() ? getName() : text; ai->ChangeStrategy(text, BotState::BOT_STATE_COMBAT); if (event.getSource() == "co") { - vector splitted = split(text, ','); - for (vector::iterator i = splitted.begin(); i != splitted.end(); i++) + std::vector splitted = split(text, ','); + for (std::vector::iterator i = splitted.begin(); i != splitted.end(); i++) { const char* name = i->c_str(); switch (name[0]) @@ -40,14 +40,14 @@ bool ChangeCombatStrategyAction::Execute(Event& event) bool ChangeNonCombatStrategyAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); text = text.empty() ? getName() : text; ai->ChangeStrategy(text, BotState::BOT_STATE_NON_COMBAT); if (event.getSource() == "nc") { - vector splitted = split(text, ','); - for (vector::iterator i = splitted.begin(); i != splitted.end(); i++) + std::vector splitted = split(text, ','); + for (std::vector::iterator i = splitted.begin(); i != splitted.end(); i++) { const char* name = i->c_str(); switch (name[0]) @@ -72,7 +72,7 @@ bool ChangeNonCombatStrategyAction::Execute(Event& event) bool ChangeDeadStrategyAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); text = text.empty() ? getName() : text; ai->ChangeStrategy(text, BotState::BOT_STATE_DEAD); @@ -88,7 +88,7 @@ bool ChangeDeadStrategyAction::Execute(Event& event) bool ChangeReactionStrategyAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); text = text.empty() ? getName() : text; ai->ChangeStrategy(text, BotState::BOT_STATE_REACTION); @@ -104,15 +104,15 @@ bool ChangeReactionStrategyAction::Execute(Event& event) bool ChangeAllStrategyAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); - string strategyName = text.empty() ? strategy : text; + std::string text = event.getParam(); + std::string strategyName = text.empty() ? strategy : text; ai->ChangeStrategy(strategyName, BotState::BOT_STATE_ALL); if (event.getSource() == "nc" || event.getSource() == "co") { - vector splitted = split(text, ','); - for (vector::iterator i = splitted.begin(); i != splitted.end(); i++) + std::vector splitted = split(text, ','); + for (std::vector::iterator i = splitted.begin(); i != splitted.end(); i++) { const char* name = i->c_str(); switch (name[0]) diff --git a/playerbot/strategy/actions/ChangeStrategyAction.h b/playerbot/strategy/actions/ChangeStrategyAction.h index 49cce96e..12cfb1bb 100644 --- a/playerbot/strategy/actions/ChangeStrategyAction.h +++ b/playerbot/strategy/actions/ChangeStrategyAction.h @@ -6,38 +6,38 @@ namespace ai class ChangeCombatStrategyAction : public ChatCommandAction { public: - ChangeCombatStrategyAction(PlayerbotAI* ai, string name = "co") : ChatCommandAction(ai, name) {} + ChangeCombatStrategyAction(PlayerbotAI* ai, std::string name = "co") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; }; class ChangeNonCombatStrategyAction : public ChatCommandAction { public: - ChangeNonCombatStrategyAction(PlayerbotAI* ai, string name = "nc") : ChatCommandAction(ai, name) {} + ChangeNonCombatStrategyAction(PlayerbotAI* ai, std::string name = "nc") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; }; class ChangeDeadStrategyAction : public ChatCommandAction { public: - ChangeDeadStrategyAction(PlayerbotAI* ai, string name = "de") : ChatCommandAction(ai, name) {} + ChangeDeadStrategyAction(PlayerbotAI* ai, std::string name = "de") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; }; class ChangeReactionStrategyAction : public ChatCommandAction { public: - ChangeReactionStrategyAction(PlayerbotAI* ai, string name = "react") : ChatCommandAction(ai, name) {} + ChangeReactionStrategyAction(PlayerbotAI* ai, std::string name = "react") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; }; class ChangeAllStrategyAction : public ChatCommandAction { public: - ChangeAllStrategyAction(PlayerbotAI* ai, string name = "change strategy from all", string strategy = "") : ChatCommandAction(ai, name), strategy(strategy) {} + ChangeAllStrategyAction(PlayerbotAI* ai, std::string name = "change strategy from all", std::string strategy = "") : ChatCommandAction(ai, name), strategy(strategy) {} virtual bool Execute(Event& event) override; private: - string strategy; + std::string strategy; }; } diff --git a/playerbot/strategy/actions/ChangeTalentsAction.cpp b/playerbot/strategy/actions/ChangeTalentsAction.cpp index 0c6b3513..04d37e90 100644 --- a/playerbot/strategy/actions/ChangeTalentsAction.cpp +++ b/playerbot/strategy/actions/ChangeTalentsAction.cpp @@ -1,6 +1,6 @@ #include "playerbot/playerbot.h" -#include "../../Talentspec.h" +#include "playerbot/Talentspec.h" #include "ChangeTalentsAction.h" using namespace ai; @@ -8,25 +8,25 @@ using namespace ai; bool ChangeTalentsAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - ostringstream out; + std::ostringstream out; TalentSpec botSpec(bot); - string param = event.getParam(); + std::string param = event.getParam(); if (!param.empty()) { - if (param.find("auto") != string::npos) + if (param.find("auto") != std::string::npos) { AutoSelectTalents(&out); } - else if (param.find("list ") != string::npos) + else if (param.find("list ") != std::string::npos) { listPremadePaths(getPremadePaths(param.substr(5)), &out); } - else if (param.find("list") != string::npos) + else if (param.find("list") != std::string::npos) { listPremadePaths(getPremadePaths(""), &out); } - else if (param.find("reset") != string::npos) + else if (param.find("reset") != std::string::npos) { out << "Reset talents and spec"; TalentSpec newSpec(bot, "0-0-0"); @@ -38,12 +38,12 @@ bool ChangeTalentsAction::Execute(Event& event) { bool crop = false; bool shift = false; - if (param.find("do ") != string::npos) + if (param.find("do ") != std::string::npos) { crop = true; param = param.substr(3); } - else if (param.find("shift ") != string::npos) + else if (param.find("shift ") != std::string::npos) { shift = true; param = param.substr(6); @@ -53,7 +53,7 @@ bool ChangeTalentsAction::Execute(Event& event) if (botSpec.CheckTalentLink(param, &out)) { TalentSpec newSpec(bot, param); - string specLink = newSpec.GetTalentLink(); + std::string specLink = newSpec.GetTalentLink(); if (crop) { @@ -97,7 +97,7 @@ bool ChangeTalentsAction::Execute(Event& event) TalentPath* path = PickPremadePath(paths, sRandomPlayerbotMgr.IsRandomBot(bot)); TalentSpec newSpec = *GetBestPremadeSpec(path->id); - string specLink = newSpec.GetTalentLink(); + std::string specLink = newSpec.GetTalentLink(); newSpec.CropTalents(bot->GetLevel()); newSpec.ApplyTalents(bot, &out); @@ -124,7 +124,7 @@ bool ChangeTalentsAction::Execute(Event& event) out.clear(); uint32 specId = sRandomPlayerbotMgr.GetValue(bot->GetGUIDLow(), "specNo") - 1; - string specName = ""; + std::string specName = ""; TalentPath* specPath; if (specId) { @@ -149,12 +149,12 @@ bool ChangeTalentsAction::Execute(Event& event) return true; } -std::vector ChangeTalentsAction::getPremadePaths(string findName) +std::vector ChangeTalentsAction::getPremadePaths(std::string findName) { std::vector ret; for (auto& path : sPlayerbotAIConfig.classSpecs[bot->getClass()].talentPath) { - if (findName.empty() || path.name.find(findName) != string::npos) + if (findName.empty() || path.name.find(findName) != std::string::npos) { ret.push_back(&path); } @@ -193,7 +193,7 @@ TalentPath* ChangeTalentsAction::getPremadePath(int id) return &sPlayerbotAIConfig.classSpecs[bot->getClass()].talentPath[0]; } -void ChangeTalentsAction::listPremadePaths(std::vector paths, ostringstream* out) +void ChangeTalentsAction::listPremadePaths(std::vector paths, std::ostringstream* out) { if (paths.size() == 0) { @@ -236,7 +236,7 @@ TalentPath* ChangeTalentsAction::PickPremadePath(std::vector paths, return paths[0]; } -bool ChangeTalentsAction::AutoSelectTalents(ostringstream* out) +bool ChangeTalentsAction::AutoSelectTalents(std::ostringstream* out) { //Does the bot have talentpoints? if (bot->GetLevel() < 10) @@ -247,7 +247,7 @@ bool ChangeTalentsAction::AutoSelectTalents(ostringstream* out) uint32 specNo = sRandomPlayerbotMgr.GetValue(bot->GetGUIDLow(), "specNo"); uint32 specId = specNo ? specNo - 1 : 0; - string specLink = sRandomPlayerbotMgr.GetData(bot->GetGUIDLow(), "specLink"); + std::string specLink = sRandomPlayerbotMgr.GetData(bot->GetGUIDLow(), "specLink"); //Continue the current spec if (specNo > 0) @@ -372,9 +372,9 @@ TalentSpec* ChangeTalentsAction::GetBestPremadeSpec(int specId) bool AutoSetTalentsAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - sPlayerbotAIConfig.logEvent(ai, "AutoSetTalentsAction", to_string(bot->m_Played_time[PLAYED_TIME_LEVEL]), to_string(bot->m_Played_time[PLAYED_TIME_TOTAL])); + sPlayerbotAIConfig.logEvent(ai, "AutoSetTalentsAction", std::to_string(bot->m_Played_time[PLAYED_TIME_LEVEL]), std::to_string(bot->m_Played_time[PLAYED_TIME_TOTAL])); - ostringstream out; + std::ostringstream out; if (sPlayerbotAIConfig.autoPickTalents == "no" && !sRandomPlayerbotMgr.IsRandomBot(bot)) { diff --git a/playerbot/strategy/actions/ChangeTalentsAction.h b/playerbot/strategy/actions/ChangeTalentsAction.h index 23231443..928fd8a6 100644 --- a/playerbot/strategy/actions/ChangeTalentsAction.h +++ b/playerbot/strategy/actions/ChangeTalentsAction.h @@ -1,7 +1,7 @@ #pragma once #include "playerbot/playerbot.h" -#include "../../Talentspec.h" +#include "playerbot/Talentspec.h" #include "GenericActions.h" namespace ai @@ -9,16 +9,16 @@ namespace ai class ChangeTalentsAction : public ChatCommandAction { public: - ChangeTalentsAction(PlayerbotAI* ai, string name = "talents") : ChatCommandAction(ai, name) {} + ChangeTalentsAction(PlayerbotAI* ai, std::string name = "talents") : ChatCommandAction(ai, name) {} public: virtual bool Execute(Event& event) override; - virtual bool AutoSelectTalents(ostringstream* out); + virtual bool AutoSelectTalents(std::ostringstream* out); private: - std::vector getPremadePaths(string findName); + std::vector getPremadePaths(std::string findName); std::vector getPremadePaths(TalentSpec* oldSpec); TalentPath* getPremadePath(int id); - void listPremadePaths(std::vector paths, ostringstream* out); + void listPremadePaths(std::vector paths, std::ostringstream* out); TalentPath* PickPremadePath(std::vector paths, bool useProbability); TalentSpec* GetBestPremadeSpec(int spec); }; diff --git a/playerbot/strategy/actions/ChatShortcutActions.cpp b/playerbot/strategy/actions/ChatShortcutActions.cpp index 188433ea..ef617776 100644 --- a/playerbot/strategy/actions/ChatShortcutActions.cpp +++ b/playerbot/strategy/actions/ChatShortcutActions.cpp @@ -7,7 +7,7 @@ using namespace ai; -void ReturnPositionResetAction::ResetPosition(string posName) +void ReturnPositionResetAction::ResetPosition(std::string posName) { ai::PositionMap& posMap = context->GetValue("position")->Get(); ai::PositionEntry pos = posMap[posName]; @@ -15,7 +15,7 @@ void ReturnPositionResetAction::ResetPosition(string posName) posMap[posName] = pos; } -void ReturnPositionResetAction::SetPosition(WorldPosition wPos, string posName) +void ReturnPositionResetAction::SetPosition(WorldPosition wPos, std::string posName) { ai::PositionMap& posMap = context->GetValue("position")->Get(); ai::PositionEntry pos = posMap[posName]; diff --git a/playerbot/strategy/actions/ChatShortcutActions.h b/playerbot/strategy/actions/ChatShortcutActions.h index e4aa2f8b..c6bf50a7 100644 --- a/playerbot/strategy/actions/ChatShortcutActions.h +++ b/playerbot/strategy/actions/ChatShortcutActions.h @@ -7,9 +7,9 @@ namespace ai class ReturnPositionResetAction : public ChatCommandAction { public: - ReturnPositionResetAction(PlayerbotAI* ai, string name) : ChatCommandAction(ai, name) {} - void ResetPosition(string posName = "return"); - void SetPosition(WorldPosition pos, string posName = "return"); + ReturnPositionResetAction(PlayerbotAI* ai, std::string name) : ChatCommandAction(ai, name) {} + void ResetPosition(std::string posName = "return"); + void SetPosition(WorldPosition pos, std::string posName = "return"); static void PrintStrategies(PlayerbotAI* ai, Event& event); }; diff --git a/playerbot/strategy/actions/CheatAction.cpp b/playerbot/strategy/actions/CheatAction.cpp index ab20fcd1..6c12b3da 100644 --- a/playerbot/strategy/actions/CheatAction.cpp +++ b/playerbot/strategy/actions/CheatAction.cpp @@ -7,12 +7,12 @@ using namespace ai; bool CheatAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string param = event.getParam(); + std::string param = event.getParam(); uint32 cheatMask = (uint32)ai->GetCheat(); - vector splitted = split(param, ','); - for (vector::iterator i = splitted.begin(); i != splitted.end(); i++) + std::vector splitted = split(param, ','); + for (std::vector::iterator i = splitted.begin(); i != splitted.end(); i++) { const char* name = i->c_str(); BotCheatMask newCheat = GetCheatMask(name + 1); @@ -46,9 +46,9 @@ bool CheatAction::Execute(Event& event) return true; } -BotCheatMask CheatAction::GetCheatMask(string cheat) +BotCheatMask CheatAction::GetCheatMask(std::string cheat) { - vector cheatName = { "taxi", "gold", "health", "mana", "power", "item", "cooldown", "repair", "movespeed", "attackspeed", "breath", "maxMask"}; + std::vector cheatName = { "taxi", "gold", "health", "mana", "power", "item", "cooldown", "repair", "movespeed", "attackspeed", "breath", "maxMask"}; for (int i = 0; i < log2((uint32)BotCheatMask::maxMask); i++) { if (cheatName[i] == cheat) @@ -58,15 +58,15 @@ BotCheatMask CheatAction::GetCheatMask(string cheat) return BotCheatMask::none; } -string CheatAction::GetCheatName(BotCheatMask cheatMask) +std::string CheatAction::GetCheatName(BotCheatMask cheatMask) { - vector cheatName = { "taxi", "gold", "health", "mana", "power", "item", "cooldown", "repair", "movespeed", "attackspeed", "breath", "maxMask" }; + std::vector cheatName = { "taxi", "gold", "health", "mana", "power", "item", "cooldown", "repair", "movespeed", "attackspeed", "breath", "maxMask" }; return cheatName[log2(((uint32)cheatMask))]; } void CheatAction::ListCheats(Player* requester) { - ostringstream out; + std::ostringstream out; for (int i = 0; i < log2((uint32)BotCheatMask::maxMask); i++) { BotCheatMask cheatMask = BotCheatMask(1 << i); diff --git a/playerbot/strategy/actions/CheatAction.h b/playerbot/strategy/actions/CheatAction.h index 714115ce..5cc736d6 100644 --- a/playerbot/strategy/actions/CheatAction.h +++ b/playerbot/strategy/actions/CheatAction.h @@ -9,8 +9,8 @@ namespace ai CheatAction(PlayerbotAI* ai) : ChatCommandAction(ai, "cheat") {} virtual bool Execute(Event& event) override; private: - static BotCheatMask GetCheatMask(string cheat); - static string GetCheatName(BotCheatMask cheatMask); + static BotCheatMask GetCheatMask(std::string cheat); + static std::string GetCheatName(BotCheatMask cheatMask); void ListCheats(Player* requester); void AddCheat(BotCheatMask cheatMask); void RemCheat(BotCheatMask cheatMask); diff --git a/playerbot/strategy/actions/CheckMailAction.cpp b/playerbot/strategy/actions/CheckMailAction.cpp index 71db3f81..b7cf2901 100644 --- a/playerbot/strategy/actions/CheckMailAction.cpp +++ b/playerbot/strategy/actions/CheckMailAction.cpp @@ -11,7 +11,7 @@ bool CheckMailAction::Execute(Event& event) WorldPacket p; bot->GetSession()->HandleQueryNextMailTime(p); - list ids; + std::list ids; PlayerMails mails; @@ -39,7 +39,7 @@ bool CheckMailAction::Execute(Event& event) mail->state = MAIL_STATE_DELETED; } - for (list::iterator i = ids.begin(); i != ids.end(); ++i) + for (std::list::iterator i = ids.begin(); i != ids.end(); ++i) { uint32 id = *i; bot->SendMailResult(id, MAIL_DELETED, MAIL_OK); @@ -67,7 +67,7 @@ void CheckMailAction::ProcessMail(Mail* mail, Player* owner) return; } - if (mail->subject.find("Item(s) you asked for") != string::npos) + if (mail->subject.find("Item(s) you asked for") != std::string::npos) return; for (MailItemInfoVec::iterator i = mail->items.begin(); i != mail->items.end(); ++i) @@ -76,7 +76,7 @@ void CheckMailAction::ProcessMail(Mail* mail, Player* owner) if (!item) continue; - ostringstream body; + std::ostringstream body; body << "Hello, " << owner->GetName() << ",\n"; body << "\n"; body << "Here are the item(s) you've sent me by mistake"; diff --git a/playerbot/strategy/actions/CheckMountStateAction.cpp b/playerbot/strategy/actions/CheckMountStateAction.cpp index 3880cea4..3fef6f11 100644 --- a/playerbot/strategy/actions/CheckMountStateAction.cpp +++ b/playerbot/strategy/actions/CheckMountStateAction.cpp @@ -185,7 +185,7 @@ bool CheckMountStateAction::Execute(Event& event) } //Mounting in safe place. - if (!ai->HasStrategy("guard", ai->GetState()) && !ai->HasStrategy("stay", ai->GetState()) && !AI_VALUE(list, "possible rpg targets").empty() && urand(0, 100) > 50) + if (!ai->HasStrategy("guard", ai->GetState()) && !ai->HasStrategy("stay", ai->GetState()) && !AI_VALUE(std::list, "possible rpg targets").empty() && urand(0, 100) > 50) { if (ai->HasStrategy("debug mount", BotState::BOT_STATE_NON_COMBAT) && !IsMounted) ai->TellPlayerNoFacing(requester, "Mount. Near rpg targets."); @@ -299,7 +299,7 @@ bool CheckMountStateAction::isUseful() if (!bot->GetMap()->IsMountAllowed() && bot->GetMapId() != 531) return false; - if (AI_VALUE(vector, "mount list").empty()) + if (AI_VALUE(std::vector, "mount list").empty()) return false; return true; @@ -325,7 +325,7 @@ bool CheckMountStateAction::CanFly() const return false; #endif - for (auto& mount : AI_VALUE(vector, "mount list")) + for (auto& mount : AI_VALUE(std::vector, "mount list")) if (mount.GetSpeed(true)) return true; @@ -389,7 +389,7 @@ bool CheckMountStateAction::Mount(Player* requester) uint32 currentSpeed = AI_VALUE2(uint32, "current mount speed", "self target"); - vector mountList = AI_VALUE(vector, "mount list"); + std::vector mountList = AI_VALUE(std::vector, "mount list"); std::shuffle(mountList.begin(), mountList.end(), *GetRandomGenerator()); std::sort(mountList.begin(), mountList.end(), [canFly](MountValue i, MountValue j) {return i.GetSpeed(canFly) > j.GetSpeed(canFly); }); @@ -461,7 +461,7 @@ bool CheckMountStateAction::Mount(Player* requester) if (ai->CastSpell(mount.GetSpellId(), bot)) { - sPlayerbotAIConfig.logEvent(ai, "CheckMountStateAction", sServerFacade.LookupSpellInfo(mount.GetSpellId())->SpellName[0], to_string(mount.GetSpeed(canFly))); + sPlayerbotAIConfig.logEvent(ai, "CheckMountStateAction", sServerFacade.LookupSpellInfo(mount.GetSpellId())->SpellName[0], std::to_string(mount.GetSpeed(canFly))); SetDuration(GetSpellRecoveryTime(sServerFacade.LookupSpellInfo(mount.GetSpellId()))); didMount = true; } diff --git a/playerbot/strategy/actions/CheckValuesAction.cpp b/playerbot/strategy/actions/CheckValuesAction.cpp index 2e9be876..e43ad1ae 100644 --- a/playerbot/strategy/actions/CheckValuesAction.cpp +++ b/playerbot/strategy/actions/CheckValuesAction.cpp @@ -6,7 +6,7 @@ #include "playerbot/ServerFacade.h" #include "playerbot/TravelMgr.h" -#include "../../TravelNode.h" +#include "playerbot/TravelNode.h" #include "playerbot/strategy/values/LastMovementValue.h" using namespace ai; @@ -31,12 +31,12 @@ bool CheckValuesAction::Execute(Event& event) sTravelNodeMap.manageNodes(bot, ai->HasStrategy("map full", BotState::BOT_STATE_NON_COMBAT)); } - list possible_targets = AI_VALUE(list, "possible targets"); - list all_targets = AI_VALUE(list, "all targets"); - list npcs = AI_VALUE(list, "nearest npcs"); - list corpses = AI_VALUE(list, "nearest corpses"); - list gos = AI_VALUE(list, "nearest game objects"); - list nfp = AI_VALUE(list, "nearest friendly players"); + std::list possible_targets = AI_VALUE(std::list, "possible targets"); + std::list all_targets = AI_VALUE(std::list, "all targets"); + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + std::list corpses = AI_VALUE(std::list, "nearest corpses"); + std::list gos = AI_VALUE(std::list, "nearest game objects"); + std::list nfp = AI_VALUE(std::list, "nearest friendly players"); //if (!ai->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT)) // context->ClearExpiredValues(); return true; diff --git a/playerbot/strategy/actions/ChooseRpgTargetAction.cpp b/playerbot/strategy/actions/ChooseRpgTargetAction.cpp index 8a93af25..3ee1b2b3 100644 --- a/playerbot/strategy/actions/ChooseRpgTargetAction.cpp +++ b/playerbot/strategy/actions/ChooseRpgTargetAction.cpp @@ -12,7 +12,7 @@ using namespace ai; -bool ChooseRpgTargetAction::HasSameTarget(ObjectGuid guid, uint32 max, list& nearGuids) +bool ChooseRpgTargetAction::HasSameTarget(ObjectGuid guid, uint32 max, std::list& nearGuids) { if (ai->HasRealPlayerMaster()) return 0; @@ -53,7 +53,7 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP) Strategy* rpgStrategy; - list triggerNodes; + std::list triggerNodes; float maxRelevance = 0.0f; @@ -108,7 +108,7 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP) } } - for (list::iterator i = triggerNodes.begin(); i != triggerNodes.end(); i++) + for (std::list::iterator i = triggerNodes.begin(); i != triggerNodes.end(); i++) { TriggerNode* trigger = *i; delete trigger; @@ -140,13 +140,13 @@ bool ChooseRpgTargetAction::Execute(Event& event) requester = nullptr; } - unordered_map targets; - vector targetList; + std::unordered_map targets; + std::vector targetList; - list possibleTargets = AI_VALUE(list, "possible rpg targets"); - list possibleObjects = bot->GetMap()->IsDungeon() ? AI_VALUE(list, "nearest game objects") : AI_VALUE(list, "nearest game objects no los"); // skip not in LOS objects in dungeons - list possiblePlayers = AI_VALUE(list, "nearest friendly players"); - set& ignoreList = AI_VALUE(set&, "ignore rpg target"); + std::list possibleTargets = AI_VALUE(std::list, "possible rpg targets"); + std::list possibleObjects = bot->GetMap()->IsDungeon() ? AI_VALUE(std::list, "nearest game objects") : AI_VALUE(std::list, "nearest game objects no los"); // skip not in LOS objects in dungeons + std::list possiblePlayers = AI_VALUE(std::list, "nearest friendly players"); + std::set& ignoreList = AI_VALUE(std::set&, "ignore rpg target"); for (auto target : possibleTargets) targets[target] = 0.0f; @@ -176,7 +176,7 @@ bool ChooseRpgTargetAction::Execute(Event& event) targets.erase(target); } - SET_AI_VALUE(string, "next rpg action", this->getName()); + SET_AI_VALUE(std::string, "next rpg action", this->getName()); bool hasGoodRelevance = false; @@ -190,7 +190,7 @@ bool ChooseRpgTargetAction::Execute(Event& event) //Update tradeskill items so we can use lazy in trigger check. if(ai->HasStrategy("rpg craft", BotState::BOT_STATE_NON_COMBAT)) { - AI_VALUE2(list, "inventory item ids", "usage " + to_string((uint8)ItemUsage::ITEM_USAGE_SKILL)); + AI_VALUE2(std::list, "inventory item ids", "usage " + std::to_string((uint8)ItemUsage::ITEM_USAGE_SKILL)); } context->ClearExpiredValues("can free move",10); //Clean up old free move to. @@ -273,7 +273,7 @@ bool ChooseRpgTargetAction::Execute(Event& event) break; } - SET_AI_VALUE(string, "next rpg action", ""); + SET_AI_VALUE(std::string, "next rpg action", ""); for (auto it = begin(targets); it != end(targets);) { @@ -291,23 +291,23 @@ bool ChooseRpgTargetAction::Execute(Event& event) { if (ai->HasStrategy("debug rpg", BotState::BOT_STATE_NON_COMBAT)) { - ostringstream out; + std::ostringstream out; out << "found: no targets, " << checked << " checked."; ai->TellPlayerNoFacing(requester, out); } sLog.outDetail("%s can't choose RPG target: all %zu are not available", bot->GetName(), possibleTargets.size()); - RESET_AI_VALUE(set&,"ignore rpg target"); + RESET_AI_VALUE(std::set&,"ignore rpg target"); RESET_AI_VALUE(GuidPosition, "rpg target"); return false; } if (ai->HasStrategy("debug rpg", BotState::BOT_STATE_NON_COMBAT)) { - vector> sortedTargets(targets.begin(), targets.end()); + std::vector> sortedTargets(targets.begin(), targets.end()); - std::sort(sortedTargets.begin(), sortedTargets.end(), [](pairi, pair j) {return i.second > j.second; }); + std::sort(sortedTargets.begin(), sortedTargets.end(), [](std::pairi, std::pair j) {return i.second > j.second; }); - ai->TellPlayerNoFacing(requester, "------" + to_string(targets.size()) + "------"); + ai->TellPlayerNoFacing(requester, "------" + std::to_string(targets.size()) + "------"); uint32 checked = 0; @@ -318,7 +318,7 @@ bool ChooseRpgTargetAction::Execute(Event& event) if (!guidP.GetWorldObject()) continue; - ostringstream out; + std::ostringstream out; out << chat->formatWorldobject(guidP.GetWorldObject()); out << " " << rgpActionReason[guidP] << " " << target.second; @@ -329,7 +329,7 @@ bool ChooseRpgTargetAction::Execute(Event& event) if (checked >= 10) { - ostringstream out; + std::ostringstream out; out << "and " << (sortedTargets.size()-checked) << " more..."; ai->TellPlayerNoFacing(requester, out); break; @@ -337,8 +337,8 @@ bool ChooseRpgTargetAction::Execute(Event& event) } } - vector guidps; - vector relevances; + std::vector guidps; + std::vector relevances; for (auto& target : targets) { @@ -357,14 +357,14 @@ bool ChooseRpgTargetAction::Execute(Event& event) if (!guidP) { - RESET_AI_VALUE(set&, "ignore rpg target"); + RESET_AI_VALUE(std::set&, "ignore rpg target"); RESET_AI_VALUE(GuidPosition, "rpg target"); return false; } if ((ai->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT) || ai->HasStrategy("debug rpg", BotState::BOT_STATE_NON_COMBAT)) && guidP.GetWorldObject()) { - ostringstream out; + std::ostringstream out; out << "found: "; out << chat->formatWorldobject(guidP.GetWorldObject()); @@ -374,7 +374,7 @@ bool ChooseRpgTargetAction::Execute(Event& event) } SET_AI_VALUE(GuidPosition, "rpg target", guidP); - SET_AI_VALUE(set&, "ignore rpg target", ignoreList); + SET_AI_VALUE(std::set&, "ignore rpg target", ignoreList); return true; } @@ -394,7 +394,7 @@ bool ChooseRpgTargetAction::isUseful() if (travelTarget->isTraveling() && AI_VALUE2(bool, "can free move to", *travelTarget->getPosition())) return false; - if (AI_VALUE(list, "possible rpg targets").empty()) + if (AI_VALUE(std::list, "possible rpg targets").empty()) return false; //Not stay, not guard, not combat, not trading and group ready. diff --git a/playerbot/strategy/actions/ChooseRpgTargetAction.h b/playerbot/strategy/actions/ChooseRpgTargetAction.h index 18d9e6d0..18581e46 100644 --- a/playerbot/strategy/actions/ChooseRpgTargetAction.h +++ b/playerbot/strategy/actions/ChooseRpgTargetAction.h @@ -8,7 +8,7 @@ namespace ai { class ChooseRpgTargetAction : public Action { public: - ChooseRpgTargetAction(PlayerbotAI* ai, string name = "choose rpg target") : Action(ai, name) {} + ChooseRpgTargetAction(PlayerbotAI* ai, std::string name = "choose rpg target") : Action(ai, name) {} virtual bool Execute(Event& event); virtual bool isUseful(); @@ -17,9 +17,9 @@ namespace ai //static bool isFollowValid(Player* bot, WorldPosition pos); private: float getMaxRelevance(GuidPosition guidP); - bool HasSameTarget(ObjectGuid guid, uint32 max, list& nearGuids); + bool HasSameTarget(ObjectGuid guid, uint32 max, std::list& nearGuids); - unordered_map rgpActionReason; + std::unordered_map rgpActionReason; }; class ClearRpgTargetAction : public ChooseRpgTargetAction { diff --git a/playerbot/strategy/actions/ChooseTargetActions.cpp b/playerbot/strategy/actions/ChooseTargetActions.cpp index 895187e5..886e89e6 100644 --- a/playerbot/strategy/actions/ChooseTargetActions.cpp +++ b/playerbot/strategy/actions/ChooseTargetActions.cpp @@ -53,10 +53,10 @@ bool ai::AttackAnythingAction::Execute(Event& event) { context->ClearExpiredValues("can free target", 10); //Clean up old free targets. - string grindName = grindTarget->GetName(); + std::string grindName = grindTarget->GetName(); if (!grindName.empty()) { - sPlayerbotAIConfig.logEvent(ai, "AttackAnythingAction", grindName, to_string(grindTarget->GetEntry())); + sPlayerbotAIConfig.logEvent(ai, "AttackAnythingAction", grindName, std::to_string(grindTarget->GetEntry())); if (ai->HasStrategy("pull", BotState::BOT_STATE_COMBAT)) { @@ -104,7 +104,7 @@ bool SelectNewTargetAction::Execute(Event& event) // Clear the target variables ObjectGuid attackTarget = AI_VALUE(ObjectGuid, "attack target"); - list possible = AI_VALUE(list, "possible targets no los"); + std::list possible = AI_VALUE(std::list, "possible targets no los"); if (attackTarget && find(possible.begin(), possible.end(), attackTarget) == possible.end()) { SET_AI_VALUE(ObjectGuid, "attack target", ObjectGuid()); diff --git a/playerbot/strategy/actions/ChooseTargetActions.h b/playerbot/strategy/actions/ChooseTargetActions.h index eff8c58e..24074c14 100644 --- a/playerbot/strategy/actions/ChooseTargetActions.h +++ b/playerbot/strategy/actions/ChooseTargetActions.h @@ -13,14 +13,14 @@ namespace ai { public: DpsAoeAction(PlayerbotAI* ai) : AttackAction(ai, "dps aoe") {} - string GetTargetName() override { return "dps aoe target"; } + std::string GetTargetName() override { return "dps aoe target"; } }; class DpsAssistAction : public AttackAction { public: DpsAssistAction(PlayerbotAI* ai) : AttackAction(ai, "dps assist") {} - string GetTargetName() override { return "dps target"; } + std::string GetTargetName() override { return "dps target"; } bool isUseful() override; }; @@ -28,7 +28,7 @@ namespace ai { public: TankAssistAction(PlayerbotAI* ai) : AttackAction(ai, "tank assist") {} - string GetTargetName() override { return "tank target"; } + std::string GetTargetName() override { return "tank target"; } }; class AttackAnythingAction : public AttackAction @@ -36,7 +36,7 @@ namespace ai private: public: AttackAnythingAction(PlayerbotAI* ai) : AttackAction(ai, "attack anything") {} - string GetTargetName() override { return "grind target"; } + std::string GetTargetName() override { return "grind target"; } bool isUseful() override; bool isPossible() override; @@ -47,14 +47,14 @@ namespace ai { public: AttackLeastHpTargetAction(PlayerbotAI* ai) : AttackAction(ai, "attack least hp target") {} - string GetTargetName() override { return "least hp target"; } + std::string GetTargetName() override { return "least hp target"; } }; class AttackEnemyPlayerAction : public AttackAction { public: AttackEnemyPlayerAction(PlayerbotAI* ai) : AttackAction(ai, "attack enemy player") {} - string GetTargetName() override { return "enemy player target"; } + std::string GetTargetName() override { return "enemy player target"; } bool isUseful() override; }; @@ -62,7 +62,7 @@ namespace ai { public: AttackEnemyFlagCarrierAction(PlayerbotAI* ai) : AttackAction(ai, "attack enemy flag carrier") {} - string GetTargetName() override { return "enemy flag carrier"; } + std::string GetTargetName() override { return "enemy flag carrier"; } bool isUseful() override; }; diff --git a/playerbot/strategy/actions/ChooseTravelTargetAction.cpp b/playerbot/strategy/actions/ChooseTravelTargetAction.cpp index e3f11efb..c4f6872f 100644 --- a/playerbot/strategy/actions/ChooseTravelTargetAction.cpp +++ b/playerbot/strategy/actions/ChooseTravelTargetAction.cpp @@ -74,14 +74,14 @@ void ChooseTravelTargetAction::getNewTarget(Player* requester, TravelTarget* new TravelDestination* dest = ChooseTravelTargetAction::FindDestination(bot, "Tarren Mill"); if (dest) { - vector points = dest->nextPoint(botPos, true); + std::vector points = dest->nextPoint(botPos, true); if (!points.empty()) { target->setTarget(dest, points.front()); target->setForced(true); - ostringstream out; out << "Traveling to " << dest->getTitle(); + std::ostringstream out; out << "Traveling to " << dest->getTitle(); ai->TellPlayerNoFacing(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); foundTarget = true; } @@ -208,7 +208,7 @@ void ChooseTravelTargetAction::setNewTarget(Player* requester, TravelTarget* new //If we are heading to a creature/npc clear it from the ignore list. if (oldTarget && oldTarget == newTarget && newTarget->getEntry()) { - set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); + std::set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); for (auto& i : ignoreList) { @@ -218,7 +218,7 @@ void ChooseTravelTargetAction::setNewTarget(Player* requester, TravelTarget* new } } - context->GetValue&>("ignore rpg target")->Set(ignoreList); + context->GetValue&>("ignore rpg target")->Set(ignoreList); } //Actually apply the new target to the travel target used by the bot. @@ -243,7 +243,7 @@ void ChooseTravelTargetAction::ReportTravelTarget(Player* requester, TravelTarge TravelDestination* oldDestination = oldTarget->getDestination(); - ostringstream out; + std::ostringstream out; if (newTarget->isForced()) out << "(Forced) "; @@ -261,7 +261,7 @@ void ChooseTravelTargetAction::ReportTravelTarget(Player* requester, TravelTarge else gInfo = ObjectMgr::GetGameObjectInfo(destination->getEntry() * -1); - string Sub; + std::string Sub; if (newTarget->isGroupCopy()) out << "Following group "; @@ -399,20 +399,20 @@ void ChooseTravelTargetAction::ReportTravelTarget(Player* requester, TravelTarge ai->TellPlayerNoFacing(requester, out,PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); - string message = out.str().c_str(); + std::string message = out.str().c_str(); if (sPlayerbotAIConfig.hasLog("travel_map.csv")) { WorldPosition botPos(bot); WorldPosition destPos = *newTarget->getPosition(); - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; out << std::fixed << std::setprecision(2); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP))); out << subLevel << ","; @@ -435,13 +435,13 @@ void ChooseTravelTargetAction::ReportTravelTarget(Player* requester, TravelTarge if (lastPos) { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; out << std::fixed << std::setprecision(2); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP))); out << subLevel << ","; @@ -465,14 +465,14 @@ void ChooseTravelTargetAction::ReportTravelTarget(Player* requester, TravelTarge } //Select only those points that are in sight distance or failing that a multiplication of the sight distance. -vector ChooseTravelTargetAction::getLogicalPoints(Player* requester, vector& travelPoints) +std::vector ChooseTravelTargetAction::getLogicalPoints(Player* requester, std::vector& travelPoints) { PerformanceMonitorOperation* pmo = sPerformanceMonitor.start(PERF_MON_VALUE, "getLogicalPoints", &context->performanceStack); - vector retvec; + std::vector retvec; - static vector distanceLimits = { sPlayerbotAIConfig.sightDistance, 4 * sPlayerbotAIConfig.sightDistance, 10 * sPlayerbotAIConfig.sightDistance, 20 * sPlayerbotAIConfig.sightDistance, 50 * sPlayerbotAIConfig.sightDistance, 100 * sPlayerbotAIConfig.sightDistance, 10000 * sPlayerbotAIConfig.sightDistance }; + static std::vector distanceLimits = { sPlayerbotAIConfig.sightDistance, 4 * sPlayerbotAIConfig.sightDistance, 10 * sPlayerbotAIConfig.sightDistance, 20 * sPlayerbotAIConfig.sightDistance, 50 * sPlayerbotAIConfig.sightDistance, 100 * sPlayerbotAIConfig.sightDistance, 10000 * sPlayerbotAIConfig.sightDistance }; - vector> partitions; + std::vector> partitions; for (uint8 l = 0; l < distanceLimits.size(); l++) partitions.push_back({}); @@ -553,19 +553,19 @@ vector ChooseTravelTargetAction::getLogicalPoints(Player* reques } //Sets the target to the best destination. -bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* target, vector& TravelDestinations) +bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* target, std::vector& TravelDestinations) { if (TravelDestinations.empty()) return false; WorldPosition botLocation(bot); - vector travelPoints; + std::vector travelPoints; //Select all points from the selected destinations for (auto& activeTarget : TravelDestinations) { - vector points = activeTarget->getPoints(true); + std::vector points = activeTarget->getPoints(true); for (WorldPosition* point : points) { if (point && point->isValid()) @@ -576,7 +576,7 @@ bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* ta } if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(travelPoints.size()) + " points total."); + ai->TellPlayerNoFacing(requester, std::to_string(travelPoints.size()) + " points total."); if (travelPoints.empty()) //No targets or no points. return false; @@ -593,7 +593,7 @@ bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* ta return false; if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(travelPoints.size()) + " points in reasonable range."); + ai->TellPlayerNoFacing(requester, std::to_string(travelPoints.size()) + " points in reasonable range."); travelPoints = sTravelMgr.getNextPoint(&botLocation, travelPoints); //Pick a good point. @@ -609,17 +609,17 @@ bool ChooseTravelTargetAction::SetBestTarget(Player* requester, TravelTarget* ta target->setTarget(TravelDestinations.front(), travelPoints.front()); if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, "Point at " + to_string(uint32(target->distance(bot))) + "y selected."); + ai->TellPlayerNoFacing(requester, "Point at " + std::to_string(uint32(target->distance(bot))) + "y selected."); return target->isActive(); } bool ChooseTravelTargetAction::SetGroupTarget(Player* requester, TravelTarget* target) { - vector activeDestinations; - vector activePoints; + std::vector activeDestinations; + std::vector activePoints; - list groupPlayers; + std::list groupPlayers; Group* group = bot->GetGroup(); if (!group) @@ -670,7 +670,7 @@ bool ChooseTravelTargetAction::SetGroupTarget(Player* requester, TravelTarget* t } if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(activeDestinations.size()) + " group targets found."); + ai->TellPlayerNoFacing(requester, std::to_string(activeDestinations.size()) + " group targets found."); bool hasTarget = SetBestTarget(requester, target, activeDestinations); @@ -693,7 +693,7 @@ bool ChooseTravelTargetAction::SetCurrentTarget(Player* requester, TravelTarget* if (!oldDestination->isActive(bot)) //Is the destination still valid? return false; - vector TravelDestinations = { oldDestination }; + std::vector TravelDestinations = { oldDestination }; if (!SetBestTarget(requester, target, TravelDestinations)) return false; @@ -706,7 +706,7 @@ bool ChooseTravelTargetAction::SetCurrentTarget(Player* requester, TravelTarget* bool ChooseTravelTargetAction::SetQuestTarget(Player* requester, TravelTarget* target, bool newQuests, bool activeQuests, bool completedQuests) { - vector TravelDestinations; + std::vector TravelDestinations; bool onlyClassQuest = !urand(0, 10); @@ -718,7 +718,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(Player* requester, TravelTarget* t } if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " new quest destinations found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " new quest destinations found."); if (activeQuests || completedQuests) { @@ -743,7 +743,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(Player* requester, TravelTarget* t //Find quest takers or objectives PerformanceMonitorOperation* pmo = sPerformanceMonitor.start(PERF_MON_VALUE, "getQuestTravelDestinations2", &context->performanceStack); - vector questDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, false,0); + std::vector questDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, false,0); if(pmo) pmo->finish(); if (onlyClassQuest && TravelDestinations.size() && questDestinations.size()) //Only do class quests if we have any. @@ -767,7 +767,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(Player* requester, TravelTarget* t } if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " quest destinations found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " quest destinations found."); return SetBestTarget(requester, target, TravelDestinations); } @@ -775,10 +775,10 @@ bool ChooseTravelTargetAction::SetQuestTarget(Player* requester, TravelTarget* t bool ChooseTravelTargetAction::SetRpgTarget(Player* requester, TravelTarget* target) { //Find rpg npcs - vector TravelDestinations = sTravelMgr.getRpgTravelDestinations(bot, true, false); + std::vector TravelDestinations = sTravelMgr.getRpgTravelDestinations(bot, true, false); if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " rpg destinations found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " rpg destinations found."); return SetBestTarget(requester, target, TravelDestinations); } @@ -786,10 +786,10 @@ bool ChooseTravelTargetAction::SetRpgTarget(Player* requester, TravelTarget* tar bool ChooseTravelTargetAction::SetGrindTarget(Player* requester, TravelTarget* target) { //Find grind mobs. - vector TravelDestinations = sTravelMgr.getGrindTravelDestinations(bot, true, false, 600+bot->GetLevel()*400); + std::vector TravelDestinations = sTravelMgr.getGrindTravelDestinations(bot, true, false, 600+bot->GetLevel()*400); if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " grind destinations found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " grind destinations found."); return SetBestTarget(requester, target, TravelDestinations); } @@ -797,10 +797,10 @@ bool ChooseTravelTargetAction::SetGrindTarget(Player* requester, TravelTarget* t bool ChooseTravelTargetAction::SetBossTarget(Player* requester, TravelTarget* target) { //Find boss mobs. - vector TravelDestinations = sTravelMgr.getBossTravelDestinations(bot, true); + std::vector TravelDestinations = sTravelMgr.getBossTravelDestinations(bot, true); if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " boss destinations found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " boss destinations found."); return SetBestTarget(requester, target, TravelDestinations); } @@ -808,22 +808,22 @@ bool ChooseTravelTargetAction::SetBossTarget(Player* requester, TravelTarget* ta bool ChooseTravelTargetAction::SetExploreTarget(Player* requester, TravelTarget* target) { //Find exploration locations (middle of a sub-zone). - vector TravelDestinations = sTravelMgr.getExploreTravelDestinations(bot, true, false); + std::vector TravelDestinations = sTravelMgr.getExploreTravelDestinations(bot, true, false); if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " explore destinations found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " explore destinations found."); return SetBestTarget(requester, target, TravelDestinations); } char* strstri(const char* haystack, const char* needle); -bool ChooseTravelTargetAction::SetNpcFlagTarget(Player* requester, TravelTarget* target, vector flags, string name, vector items, bool force) +bool ChooseTravelTargetAction::SetNpcFlagTarget(Player* requester, TravelTarget* target, std::vector flags, std::string name, std::vector items, bool force) { WorldPosition pos = WorldPosition(bot); WorldPosition* botPos = &pos; - vector TravelDestinations; + std::vector TravelDestinations; //Loop over all npcs. for (auto& d : sTravelMgr.getRpgTravelDestinations(bot, true, true)) @@ -900,7 +900,7 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(Player* requester, TravelTarget* } if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " npc flag targets found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " npc flag targets found."); bool isActive = SetBestTarget(requester, target, TravelDestinations); @@ -916,12 +916,12 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(Player* requester, TravelTarget* return isActive; } -bool ChooseTravelTargetAction::SetGOTypeTarget(Player* requester, TravelTarget* target, GameobjectTypes type, string name, bool force) +bool ChooseTravelTargetAction::SetGOTypeTarget(Player* requester, TravelTarget* target, GameobjectTypes type, std::string name, bool force) { WorldPosition pos = WorldPosition(bot); WorldPosition* botPos = &pos; - vector TravelDestinations; + std::vector TravelDestinations; //Loop over all npcs. for (auto& d : sTravelMgr.getRpgTravelDestinations(bot, true, true)) @@ -946,7 +946,7 @@ bool ChooseTravelTargetAction::SetGOTypeTarget(Player* requester, TravelTarget* } if (ai->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(requester, to_string(TravelDestinations.size()) + " go type targets found."); + ai->TellPlayerNoFacing(requester, std::to_string(TravelDestinations.size()) + " go type targets found."); bool isActive = SetBestTarget(requester, target, TravelDestinations); @@ -970,17 +970,17 @@ bool ChooseTravelTargetAction::SetNullTarget(TravelTarget* target) return true; } -vector split(const string& s, char delim); +std::vector split(const std::string& s, char delim); char* strstri(const char* haystack, const char* needle); //Find a destination based on (part of) it's name. Includes zones, ncps and mobs. Picks the closest one that matches. -TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, string name, bool zones, bool npcs, bool quests, bool mobs, bool bosses) +TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::string name, bool zones, bool npcs, bool quests, bool mobs, bool bosses) { PlayerbotAI* ai = bot->GetPlayerbotAI(); AiObjectContext* context = ai->GetAiObjectContext(); - vector dests; + std::vector dests; //Quests if (quests) diff --git a/playerbot/strategy/actions/ChooseTravelTargetAction.h b/playerbot/strategy/actions/ChooseTravelTargetAction.h index ebebfa31..c4dcff66 100644 --- a/playerbot/strategy/actions/ChooseTravelTargetAction.h +++ b/playerbot/strategy/actions/ChooseTravelTargetAction.h @@ -10,7 +10,7 @@ namespace ai class ChooseTravelTargetAction : public MovementAction { public: - ChooseTravelTargetAction(PlayerbotAI* ai, string name = "choose travel target") : MovementAction(ai, name) {} + ChooseTravelTargetAction(PlayerbotAI* ai, std::string name = "choose travel target") : MovementAction(ai, name) {} virtual bool Execute(Event& event); virtual bool isUseful(); @@ -21,8 +21,8 @@ namespace ai void setNewTarget(Player* requester, TravelTarget* newTarget, TravelTarget* oldTarget); void ReportTravelTarget(Player* requester, TravelTarget* newTarget, TravelTarget* oldTarget); - vector getLogicalPoints(Player* requester, vector& travelPoints); - bool SetBestTarget(Player* requester, TravelTarget* target, vector& activeDestinations); + std::vector getLogicalPoints(Player* requester, std::vector& travelPoints); + bool SetBestTarget(Player* requester, TravelTarget* target, std::vector& activeDestinations); bool SetGroupTarget(Player* requester, TravelTarget* target); bool SetCurrentTarget(Player* requester, TravelTarget* target, TravelTarget* oldTarget); @@ -31,27 +31,27 @@ namespace ai bool SetGrindTarget(Player* requester, TravelTarget* target); bool SetBossTarget(Player* requester, TravelTarget* target); bool SetExploreTarget(Player* requester, TravelTarget* target); - bool SetNpcFlagTarget(Player* requester, TravelTarget* target, vector flags, string name = "", vector items = {}, bool force = true); - bool SetGOTypeTarget(Player* requester, TravelTarget* target, GameobjectTypes type, string name = "", bool force = true); + bool SetNpcFlagTarget(Player* requester, TravelTarget* target, std::vector flags, std::string name = "", std::vector items = {}, bool force = true); + bool SetGOTypeTarget(Player* requester, TravelTarget* target, GameobjectTypes type, std::string name = "", bool force = true); bool SetNullTarget(TravelTarget* target); public: - static TravelDestination* FindDestination(Player* bot, string name, bool zones = true, bool npcs = true, bool quests = true, bool mobs = true, bool bosses = true); + static TravelDestination* FindDestination(Player* bot, std::string name, bool zones = true, bool npcs = true, bool quests = true, bool mobs = true, bool bosses = true); private: virtual bool needForQuest(Unit* target); virtual bool needItemForQuest(uint32 itemId, const Quest* questTemplate, const QuestStatusData* questStatus); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "move to rpg target"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "move to rpg target"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This action is used to select a target for the bots to travel to.\n" "Bots will travel to specific places for specific reasons.\n" "For example bots will travel to a vendor if they need to sell stuff\n" "The current destination or those of group members are also options."; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "travel target", "group or", "should sell","can sell","can ah sell","should repair","can repair","following party","near leader","should get money","can fight equal","can fight elite","can fight boss","can free move to","rpg target","attack target",}; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "travel target", "group or", "should sell","can sell","can ah sell","should repair","can repair","following party","near leader","should get money","can fight equal","can fight elite","can fight boss","can free move to","rpg target","attack target",}; } #endif }; } diff --git a/playerbot/strategy/actions/CustomStrategyEditAction.cpp b/playerbot/strategy/actions/CustomStrategyEditAction.cpp index 31e0e66b..7c0b6981 100644 --- a/playerbot/strategy/actions/CustomStrategyEditAction.cpp +++ b/playerbot/strategy/actions/CustomStrategyEditAction.cpp @@ -1,22 +1,22 @@ #include "playerbot/playerbot.h" #include "CustomStrategyEditAction.h" -#include "../CustomStrategy.h" +#include "playerbot/strategy/CustomStrategy.h" using namespace ai; bool CustomStrategyEditAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); int pos = text.find(" "); - if (pos == string::npos) return PrintHelp(requester); - string name = text.substr(0, pos); + if (pos == std::string::npos) return PrintHelp(requester); + std::string name = text.substr(0, pos); text = text.substr(pos + 1); pos = text.find(" "); - if (pos == string::npos) pos = text.size(); - string idx = text.substr(0, pos); + if (pos == std::string::npos) pos = text.size(); + std::string idx = text.substr(0, pos); text = pos >= text.size() ? "" : text.substr(pos + 1); return idx == "?" ? Print(name, requester) : Edit(name, atoi(idx.c_str()), text, requester); @@ -32,7 +32,7 @@ bool CustomStrategyEditAction::PrintHelp(Player* requester) do { Field* fields = results->Fetch(); - string name = fields[0].GetString(); + std::string name = fields[0].GetString(); ai->TellPlayer(requester, name); } while (results->NextRow()); @@ -42,9 +42,9 @@ bool CustomStrategyEditAction::PrintHelp(Player* requester) return false; } -bool CustomStrategyEditAction::Print(string name, Player* requester) +bool CustomStrategyEditAction::Print(std::string name, Player* requester) { - ostringstream out; out << "=== " << name << " ==="; + std::ostringstream out; out << "=== " << name << " ==="; ai->TellPlayer(requester, out.str()); uint32 owner = (uint32)ai->GetBot()->GetGUIDLow(); @@ -55,7 +55,7 @@ bool CustomStrategyEditAction::Print(string name, Player* requester) { Field* fields = results->Fetch(); uint32 idx = fields[0].GetUInt32(); - string action = fields[1].GetString(); + std::string action = fields[1].GetString(); PrintActionLine(idx, action, requester); } while (results->NextRow()); @@ -64,7 +64,7 @@ bool CustomStrategyEditAction::Print(string name, Player* requester) return true; } -bool CustomStrategyEditAction::Edit(string name, uint32 idx, string command, Player* requester) +bool CustomStrategyEditAction::Edit(std::string name, uint32 idx, std::string command, Player* requester) { uint32 owner = (uint32)ai->GetBot()->GetGUIDLow(); auto results = CharacterDatabase.PQuery("SELECT action_line FROM ai_playerbot_custom_strategy WHERE name = '%s' and owner = '%u' and idx = '%u'", name.c_str(), owner, idx); @@ -86,7 +86,7 @@ bool CustomStrategyEditAction::Edit(string name, uint32 idx, string command, Pla PrintActionLine(idx, command, requester); - ostringstream ss; ss << "custom::" << name; + std::ostringstream ss; ss << "custom::" << name; Strategy* strategy = ai->GetAiObjectContext()->GetStrategy(ss.str()); if (strategy) { @@ -100,9 +100,9 @@ bool CustomStrategyEditAction::Edit(string name, uint32 idx, string command, Pla return true; } -bool CustomStrategyEditAction::PrintActionLine(uint32 idx, string command, Player* requester) +bool CustomStrategyEditAction::PrintActionLine(uint32 idx, std::string command, Player* requester) { - ostringstream out; out << "#" << idx << " " << command; + std::ostringstream out; out << "#" << idx << " " << command; ai->TellPlayer(requester, out.str()); return true; } diff --git a/playerbot/strategy/actions/CustomStrategyEditAction.h b/playerbot/strategy/actions/CustomStrategyEditAction.h index 791f346d..2842ba2f 100644 --- a/playerbot/strategy/actions/CustomStrategyEditAction.h +++ b/playerbot/strategy/actions/CustomStrategyEditAction.h @@ -11,8 +11,8 @@ namespace ai private: bool PrintHelp(Player* requester); - bool PrintActionLine(uint32 idx, string command, Player* requester); - bool Print(string name, Player* requester); - bool Edit(string name, uint32 idx, string command, Player* requester); + bool PrintActionLine(uint32 idx, std::string command, Player* requester); + bool Print(std::string name, Player* requester); + bool Edit(std::string name, uint32 idx, std::string command, Player* requester); }; } diff --git a/playerbot/strategy/actions/DebugAction.cpp b/playerbot/strategy/actions/DebugAction.cpp index a18e79d3..561838b7 100644 --- a/playerbot/strategy/actions/DebugAction.cpp +++ b/playerbot/strategy/actions/DebugAction.cpp @@ -30,7 +30,7 @@ bool DebugAction::Execute(Event& event) requesterTarget = ai->GetUnit(requester->GetSelectionGuid()); } - string text = event.getParam(); + std::string text = event.getParam(); if (text == "scan" && isMod) { sPlayerbotAIConfig.openLog("scan.csv", "w"); @@ -43,7 +43,7 @@ bool DebugAction::Execute(Event& event) const uint32 zoneId = sTerrainMgr.GetZoneId(pos.getMapId(), pos.getX(), pos.getY(), pos.getZ()); const uint32 areaId = sTerrainMgr.GetAreaId(pos.getMapId(), pos.getX(), pos.getY(), pos.getZ()); - ostringstream out; + std::ostringstream out; out << zoneId << "," << areaId << "," << pos.getAreaFlag() << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ","; pos.printWKT(out); @@ -119,9 +119,9 @@ bool DebugAction::Execute(Event& event) else if (text == "grid" && isMod) { WorldPosition botPos = bot; - string loaded = botPos.getMap()->IsLoaded(botPos.getX(), botPos.getY()) ? "loaded" : "unloaded"; + std::string loaded = botPos.getMap()->IsLoaded(botPos.getX(), botPos.getY()) ? "loaded" : "unloaded"; - ostringstream out; + std::ostringstream out; out << "Map: " << botPos.getMapId() << " " << botPos.getAreaName() << " Grid: " << botPos.getGridPair().x_coord << "," << botPos.getGridPair().y_coord << " [" << loaded << "] Cell: " << botPos.getCellPair().x_coord << "," << botPos.getCellPair().y_coord; @@ -131,7 +131,7 @@ bool DebugAction::Execute(Event& event) } else if (text.find("test" ) == 0 && isMod) { - string param = ""; + std::string param = ""; if (text.length() > 4) { param = text.substr(5); @@ -142,14 +142,14 @@ bool DebugAction::Execute(Event& event) } else if (text.find("values") == 0) { - string param = ""; + std::string param = ""; if (text.length() > 6) { param = text.substr(7); } - set names = context->GetValues(); - vector values; + std::set names = context->GetValues(); + std::vector values; for (auto name : names) { UntypedValue* value = context->GetUntypedValue(name); @@ -158,12 +158,12 @@ bool DebugAction::Execute(Event& event) continue; } - if (!param.empty() && name.find(param) == string::npos) + if (!param.empty() && name.find(param) == std::string::npos) { continue; } - string text = value->Format(); + std::string text = value->Format(); if (text == "?") { continue; @@ -172,9 +172,9 @@ bool DebugAction::Execute(Event& event) values.push_back(name + "=" + text); } - string valuestring = sPlayerbotHelpMgr.makeList(values, "[]"); + std::string valuestring = sPlayerbotHelpMgr.makeList(values, "[]"); - vector lines = Qualified::getMultiQualifiers(valuestring, "\n"); + std::vector lines = Qualified::getMultiQualifiers(valuestring, "\n"); for (auto& line : lines) { ai->TellPlayerNoFacing(requester, line, PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, true, false); @@ -191,14 +191,14 @@ bool DebugAction::Execute(Event& event) WorldPosition botPos = WorldPosition(bot); WorldPosition poiPoint = botPos; - string name = "bot"; + std::string name = "bot"; - vector args = Qualified::getMultiQualifiers(text.substr(4), " "); + std::vector args = Qualified::getMultiQualifiers(text.substr(4), " "); TravelDestination* dest = ChooseTravelTargetAction::FindDestination(bot, args[0]); if (dest) { - vector points = dest->nextPoint(&botPos, true); + std::vector points = dest->nextPoint(&botPos, true); if (!points.empty()) { poiPoint = *points.front(); @@ -246,16 +246,16 @@ bool DebugAction::Execute(Event& event) MovementGeneratorType type = mm->GetCurrentMovementGeneratorType(); - string sType = "TODO"; // GetMoveTypeStr(type); + std::string sType = "TODO"; // GetMoveTypeStr(type); Unit* cTarget = sServerFacade.GetChaseTarget(motionBot); float cAngle = sServerFacade.GetChaseAngle(motionBot); float cOffset = sServerFacade.GetChaseOffset(motionBot); - string cTargetName = cTarget ? cTarget->GetName() : "none"; + std::string cTargetName = cTarget ? cTarget->GetName() : "none"; - string motionName = motionBot->GetName(); + std::string motionName = motionBot->GetName(); - ai->TellPlayer(requester, motionName + " :" + sType + " (" + cTargetName + " a:" + to_string(cAngle) + " o:" + to_string(cOffset) + ")"); + ai->TellPlayer(requester, motionName + " :" + sType + " (" + cTargetName + " a:" + std::to_string(cAngle) + " o:" + std::to_string(cOffset) + ")"); if (!requesterTarget) { @@ -264,7 +264,7 @@ bool DebugAction::Execute(Event& event) if (text.size() > 7) { - string cmd = text.substr(7); + std::string cmd = text.substr(7); if (cmd == "clear") mm->Clear(); @@ -290,11 +290,11 @@ bool DebugAction::Execute(Event& event) mm->MoveFall(); else if (cmd == "formation") { - FormationSlotDataSPtr form = make_shared(0, bot->GetObjectGuid(), nullptr, SpawnGroupFormationSlotType::SPAWN_GROUP_FORMATION_SLOT_TYPE_STATIC); + FormationSlotDataSPtr form = std::make_shared(0, bot->GetObjectGuid(), nullptr, SpawnGroupFormationSlotType::SPAWN_GROUP_FORMATION_SLOT_TYPE_STATIC); mm->MoveInFormation(form); } - string sType = "TODO"; // GetMoveTypeStr(type); + std::string sType = "TODO"; // GetMoveTypeStr(type); ai->TellPlayer(requester, "new:" + sType); } return true; @@ -306,11 +306,11 @@ bool DebugAction::Execute(Event& event) GameObjectInfo const* data = sGOStorage.LookupEntry(trans->GetEntry()); if (WorldPosition(bot).isOnTransport(trans)) { - ai->TellPlayer(requester, "On transport " + string(data->name)); + ai->TellPlayer(requester, "On transport " + std::string(data->name)); } else { - ai->TellPlayer(requester, "Not on transport " + string(data->name)); + ai->TellPlayer(requester, "Not on transport " + std::string(data->name)); } } } @@ -323,9 +323,9 @@ bool DebugAction::Execute(Event& event) uint32 radius = 10; - if (text.length() > string("ontrans").size()) + if (text.length() > std::string("ontrans").size()) { - radius = stoi(text.substr(string("ontrans").size() + 1)); + radius = stoi(text.substr(std::string("ontrans").size() + 1)); } WorldPosition botPos(bot); @@ -353,7 +353,7 @@ bool DebugAction::Execute(Event& event) // pos += WorldPosition(0, cos(pos.getAngleTo(botPos)) * 3.0f, sin(pos.getAngleTo(botPos)) * 3.0f); bot->SetTransport(trans); - vector path = pos.getPathFrom(botPos, bot); //Use full pathstep to get proper paths on to transports. + std::vector path = pos.getPathFrom(botPos, bot); //Use full pathstep to get proper paths on to transports. if (path.empty()) { @@ -428,9 +428,9 @@ bool DebugAction::Execute(Event& event) { uint32 radius = 10; - if (text.length() > string("offtrans").size()) + if (text.length() > std::string("offtrans").size()) { - radius = stoi(text.substr(string("offtrans").size() + 1)); + radius = stoi(text.substr(std::string("offtrans").size() + 1)); } if (!bot->GetTransport()) @@ -448,7 +448,7 @@ bool DebugAction::Execute(Event& event) WorldPosition destPos = botPos + WorldPosition(0,cos(bot->GetOrientation()) * radius, sin(bot->GetOrientation()) * radius); - vector path = destPos.getPathFrom(botPos, nullptr); + std::vector path = destPos.getPathFrom(botPos, nullptr); if (path.empty()) { @@ -483,8 +483,8 @@ bool DebugAction::Execute(Event& event) else if (text.find("pathable") == 0 && isMod) { uint32 radius = 10; - if (text.length() > string("pathable").size()) - radius = stoi(text.substr(string("pathable").size() + 1)); + if (text.length() > std::string("pathable").size()) + radius = stoi(text.substr(std::string("pathable").size() + 1)); GenericTransport* transport = nullptr; for (auto trans : WorldPosition(bot).getTransports()) @@ -510,7 +510,7 @@ bool DebugAction::Execute(Event& event) else bot->SetTransport(trans); - vector path = pos.getPathFrom(botPos, pathBot); //Use full pathstep to get proper paths on to transports. + std::vector path = pos.getPathFrom(botPos, pathBot); //Use full pathstep to get proper paths on to transports. if (path.empty()) continue; @@ -541,8 +541,8 @@ bool DebugAction::Execute(Event& event) } else if (text.find("randomspot") == 0 && isMod) { uint32 radius = 10; - if(text.length() > string("randomspot").size()) - radius = stoi(text.substr(string("randomspot").size()+1)); + if(text.length() > std::string("randomspot").size()) + radius = stoi(text.substr(std::string("randomspot").size()+1)); WorldPosition botPos(bot); @@ -553,7 +553,7 @@ bool DebugAction::Execute(Event& event) pathfinder.ComputePathToRandomPoint(botPos.getVector3(), radius); PointsArray points = pathfinder.getPath(); - vector path = botPos.fromPointsArray(points); + std::vector path = botPos.fromPointsArray(points); if (path.empty()) return false; @@ -592,7 +592,7 @@ bool DebugAction::Execute(Event& event) } - ostringstream out; + std::ostringstream out; if(corpse->GetType() == CORPSE_BONES) out << "CORPSE_BONES"; @@ -627,7 +627,7 @@ bool DebugAction::Execute(Event& event) time = time % 60; } - ostringstream out; + std::ostringstream out; out << "Logout in: " << hr << ":" << min << ":" << time; @@ -637,17 +637,17 @@ bool DebugAction::Execute(Event& event) } else if (text.find("npc") == 0) { - ostringstream out; + std::ostringstream out; GuidPosition guidP = GuidPosition(requester->GetSelectionGuid(), requester->GetMapId()); if (text.size() > 4) { - string link = text.substr(4); + std::string link = text.substr(4); if (!link.empty()) { - list entries = chat->parseWorldEntries(link); + std::list entries = chat->parseWorldEntries(link); if (!entries.empty()) { @@ -737,7 +737,7 @@ bool DebugAction::Execute(Event& event) ai->TellPlayerNoFacing(requester, "UNIT_NPC_FLAG_OUTDOORPVP"); #endif - unordered_map reaction; + std::unordered_map reaction; reaction[REP_HATED] = "REP_HATED"; reaction[REP_HOSTILE] = "REP_HOSTILE"; @@ -750,7 +750,7 @@ bool DebugAction::Execute(Event& event) if (guidP.GetUnit()) { - ostringstream out; + std::ostringstream out; out << "unit to bot:" << reaction[guidP.GetUnit()->GetReactionTo(bot)]; Unit* ubot = bot; @@ -771,18 +771,18 @@ bool DebugAction::Execute(Event& event) } else if (text.find("go ") == 0) { - ostringstream out; + std::ostringstream out; if (text.size() < 4) return false; GuidPosition guidP; - string link = text.substr(3); + std::string link = text.substr(3); if (!link.empty()) { - list gos = chat->parseGameobjects(link); + std::list gos = chat->parseGameobjects(link); if (!gos.empty()) { for (auto go : gos) @@ -813,7 +813,7 @@ bool DebugAction::Execute(Event& event) ai->TellPlayerNoFacing(requester, out); - unordered_map types; + std::unordered_map types; types[GAMEOBJECT_TYPE_DOOR] = "GAMEOBJECT_TYPE_DOOR"; types[GAMEOBJECT_TYPE_BUTTON] = "GAMEOBJECT_TYPE_BUTTON"; types[GAMEOBJECT_TYPE_QUESTGIVER] = "GAMEOBJECT_TYPE_QUESTGIVER"; @@ -865,7 +865,7 @@ bool DebugAction::Execute(Event& event) GOState state = object->GetGoState(); - ostringstream out; + std::ostringstream out; out << "state:"; @@ -900,20 +900,20 @@ bool DebugAction::Execute(Event& event) { WorldPosition botPos = WorldPosition(bot); - string destination = text.substr(7); + std::string destination = text.substr(7); TravelDestination* dest = ChooseTravelTargetAction::FindDestination(bot, destination); if (dest) { - vector points = dest->nextPoint(&botPos, true); + std::vector points = dest->nextPoint(&botPos, true); if (points.empty()) return false; - vector beginPath, endPath; + std::vector beginPath, endPath; TravelNodeRoute route = sTravelNodeMap.getRoute(botPos, *points.front(), beginPath, bot); - ostringstream out; out << "Traveling to " << dest->getTitle() << ": "; + std::ostringstream out; out << "Traveling to " << dest->getTitle() << ": "; for (auto node : route.getNodes()) { @@ -943,7 +943,7 @@ bool DebugAction::Execute(Event& event) return false; } - ostringstream out; + std::ostringstream out; out << quest->GetTitle() << ": "; @@ -953,14 +953,14 @@ bool DebugAction::Execute(Event& event) uint32 i = 0; - vector dests = cont->questGivers; + std::vector dests = cont->questGivers; std::sort(dests.begin(), dests.end(), [botPos](QuestTravelDestination* i, QuestTravelDestination* j) {return i->distanceTo(botPos) < j->distanceTo(botPos); }); for (auto g : dests) { - ostringstream out; + std::ostringstream out; if (g->isActive(bot)) out << "(ACTIVE)"; @@ -994,7 +994,7 @@ bool DebugAction::Execute(Event& event) for (auto g : dests) { - ostringstream out; + std::ostringstream out; if (g->isActive(bot)) out << "(ACTIVE)"; @@ -1026,7 +1026,7 @@ bool DebugAction::Execute(Event& event) for (auto g : dests) { - ostringstream out; + std::ostringstream out; if (g->isActive(bot)) out << "(ACTIVE)"; @@ -1047,7 +1047,7 @@ bool DebugAction::Execute(Event& event) } else if (text.find("quest") == 0) { - ostringstream out; + std::ostringstream out; out << sTravelMgr.getQuests().size() << " quests "; uint32 noT = 0, noG = 0, noO = 0; @@ -1072,7 +1072,7 @@ bool DebugAction::Execute(Event& event) } else if (text.find("bquest") == 0) { - ostringstream out; + std::ostringstream out; out << "bad quests:"; uint32 noT = 0, noG = 0, noO = 0; @@ -1114,26 +1114,26 @@ bool DebugAction::Execute(Event& event) std::ostringstream out; for (auto itemId : chat->parseItems(textSubstr = text.substr(5))) { - list entries = GAI_VALUE2(list, "item drop list", itemId); + std::list entries = GAI_VALUE2(std::list, "item drop list", itemId); if (entries.empty()) out << chat->formatItem(sObjectMgr.GetItemPrototype(itemId), 0, 0) << " no sources found."; else - out << chat->formatItem(sObjectMgr.GetItemPrototype(itemId), 0, 0) << " " << to_string(entries.size()) << " sources found:"; + out << chat->formatItem(sObjectMgr.GetItemPrototype(itemId), 0, 0) << " " << std::to_string(entries.size()) << " sources found:"; ai->TellPlayerNoFacing(requester, out); out.str(""); out.clear(); - vector> chances; + std::vector> chances; for (auto entry : entries) { - std::vector qualifiers = { to_string(entry), to_string(itemId) }; + std::vector qualifiers = { std::to_string(entry), std::to_string(itemId) }; std::string qualifier = Qualified::MultiQualify(qualifiers, " "); float chance = GAI_VALUE2(float, "loot chance", qualifier); if(chance > 0) - chances.push_back(make_pair(entry, chance)); + chances.push_back(std::make_pair(entry, chance)); } std::sort(chances.begin(), chances.end(), [](std::pair i, std::pair j) {return i.second > j.second; }); @@ -1173,16 +1173,16 @@ bool DebugAction::Execute(Event& event) if (wo) ai->TellPlayerNoFacing(requester, chat->formatWorldobject(wo) + " " + (loot.IsLootPossible(bot) ? "can loot" : "can not loot")); else - ai->TellPlayerNoFacing(requester, to_string(loot.guid) + " " + (loot.IsLootPossible(bot) ? "can loot" : "can not loot") + " " + to_string(loot.guid.GetEntry())); + ai->TellPlayerNoFacing(requester, std::to_string(loot.guid) + " " + (loot.IsLootPossible(bot) ? "can loot" : "can not loot") + " " + std::to_string(loot.guid.GetEntry())); if (loot.guid.IsGameObject()) { GameObject* go = ai->GetGameObject(loot.guid); if (go->ActivateToQuest(bot)) - ai->TellPlayerNoFacing(requester, to_string(go->GetGoType()) + " for quest"); + ai->TellPlayerNoFacing(requester, std::to_string(go->GetGoType()) + " for quest"); else - ai->TellPlayerNoFacing(requester, to_string(go->GetGoType())); + ai->TellPlayerNoFacing(requester, std::to_string(go->GetGoType())); } loots->Remove(loot.guid); @@ -1198,27 +1198,27 @@ bool DebugAction::Execute(Event& event) std::ostringstream out; for (auto entry : chat->parseWorldEntries(textSubstr = text.substr(6))) { - list itemIds = GAI_VALUE2(list, "entry loot list", entry); + std::list itemIds = GAI_VALUE2(std::list, "entry loot list", entry); if (itemIds.empty()) out << chat->formatWorldEntry(entry) << " no drops found."; else - out << chat->formatWorldEntry(entry) << " " << to_string(itemIds.size()) << " drops found:"; + out << chat->formatWorldEntry(entry) << " " << std::to_string(itemIds.size()) << " drops found:"; ai->TellPlayerNoFacing(requester, out); out.str(""); out.clear(); - vector> chances; + std::vector> chances; for (auto itemId : itemIds) { - std::vector qualifiers = { to_string(entry) , to_string(itemId) }; + std::vector qualifiers = { std::to_string(entry) , std::to_string(itemId) }; std::string qualifier = Qualified::MultiQualify(qualifiers, " "); float chance = GAI_VALUE2(float, "loot chance", qualifier); if (chance > 0 && sObjectMgr.GetItemPrototype(itemId)) { - chances.push_back(make_pair(itemId, chance)); + chances.push_back(std::make_pair(itemId, chance)); } } @@ -1245,7 +1245,7 @@ bool DebugAction::Execute(Event& event) TaxiNodesEntry const* taxiNode = sTaxiNodesStore.LookupEntry(i); - ostringstream out; + std::ostringstream out; out << taxiNode->name[0]; @@ -1257,7 +1257,7 @@ bool DebugAction::Execute(Event& event) { WorldPosition pos(bot); - string name = "USER:" + text.substr(9); + std::string name = "USER:" + text.substr(9); TravelNode* startNode = sTravelNodeMap.addNode(pos, name, false, false); @@ -1338,18 +1338,18 @@ bool DebugAction::Execute(Event& event) { WorldPosition pos(bot); - vector nodes = sTravelNodeMap.getNodes(pos, 500); + std::vector nodes = sTravelNodeMap.getNodes(pos, 500); for (auto& node : nodes) { for (auto& l : *node->getLinks()) { Unit* start = nullptr; - list units; + std::list units; uint32 time = 60 * IN_MILLISECONDS; - vector ppath = l.second->getPath(); + std::vector ppath = l.second->getPath(); for (auto p : ppath) { @@ -1454,7 +1454,7 @@ bool DebugAction::Execute(Event& event) { uint32 spellEffect = stoi(text.substr(7)); - list units; + std::list units; for (float i = 0; i < 60; i++) { @@ -1537,7 +1537,7 @@ bool DebugAction::Execute(Event& event) if (wpCreature) { - ostringstream out; + std::ostringstream out; out << "effect "; out << effect; @@ -1589,7 +1589,7 @@ bool DebugAction::Execute(Event& event) } else if (text.find("vspellmap" ) == 0 && isMod) { - vector datMap; + std::vector datMap; for (int32 dx = 0; dx < 10; dx++) { for (int32 dy = 0; dy < 10; dy++) @@ -1634,7 +1634,7 @@ bool DebugAction::Execute(Event& event) } else if (text.find("ispellmap" ) == 0 && isMod) { - vector datMap; + std::vector datMap; for (int32 dx = 0; dx < 10; dx++) { for (int32 dy = 0; dy < 10; dy++) @@ -1731,10 +1731,10 @@ bool DebugAction::Execute(Event& event) } else if (text.find("gspellmap" ) == 0 && isMod) { - vector all_targets;// = { bot->GetObjectGuid(), master->GetObjectGuid() }; + std::vector all_targets;// = { bot->GetObjectGuid(), master->GetObjectGuid() }; //vector all_dummies = { bot->GetObjectGuid(), master->GetObjectGuid() }; - /*list a_targets = *context->GetValue >("all targets"); + /*list a_targets = *context->GetValue >("all targets"); for (auto t : a_targets) { all_targets.push_back(t); @@ -1772,7 +1772,7 @@ bool DebugAction::Execute(Event& event) uint32 effect = dx + dy * 10 + spellEffect * 100; uint32 i = dx + dy * 10; - list hits, miss; + std::list hits, miss; SpellEntry const* spellInfo = sServerFacade.LookupSpellInfo(effect); @@ -1817,7 +1817,7 @@ bool DebugAction::Execute(Event& event) } else if (text.find("mspellmap" ) == 0 && isMod) { - vector all_targets; + std::vector all_targets; for (int32 dx = 0; dx < 10; dx++) { @@ -1849,7 +1849,7 @@ bool DebugAction::Execute(Event& event) uint32 effect = dx + dy * 10 + spellEffect * 100; uint32 i = dx + dy * 10; - list hits, miss; + std::list hits, miss; SpellEntry const* spellInfo = sServerFacade.LookupSpellInfo(effect); @@ -1919,7 +1919,7 @@ bool DebugAction::Execute(Event& event) for (uint32 i = 0; i < 100; i++) { bot->PlayDistanceSound(i + soundEffects * 100); - bot->Say(to_string(i + soundEffects * 100), 0); + bot->Say(std::to_string(i + soundEffects * 100), 0); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); } return true; @@ -1943,12 +1943,12 @@ bool DebugAction::Execute(Event& event) return true; } - string response = ai->HandleRemoteCommand(text); + std::string response = ai->HandleRemoteCommand(text); ai->TellPlayer(requester, response); return true; } -void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, list otherTargets, list missTargets, WorldPosition source, WorldPosition dest, bool forceDest) +void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, std::list otherTargets, std::list missTargets, WorldPosition source, WorldPosition dest, bool forceDest) { SpellEntry const* spellInfo = sServerFacade.LookupSpellInfo(spellId); { diff --git a/playerbot/strategy/actions/DebugAction.h b/playerbot/strategy/actions/DebugAction.h index c53a8ba3..9563647d 100644 --- a/playerbot/strategy/actions/DebugAction.h +++ b/playerbot/strategy/actions/DebugAction.h @@ -8,7 +8,7 @@ namespace ai public: DebugAction(PlayerbotAI* ai) : ChatCommandAction(ai, "debug") {} virtual bool Execute(Event& event) override; - void FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target = ObjectGuid(), list otherTargets = {}, list missTargets = {}, WorldPosition source = WorldPosition(), WorldPosition dest = WorldPosition(), bool forceDest = false); + void FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target = ObjectGuid(), std::list otherTargets = {}, std::list missTargets = {}, WorldPosition source = WorldPosition(), WorldPosition dest = WorldPosition(), bool forceDest = false); void addAura(uint32 spellId, Unit* target); }; } diff --git a/playerbot/strategy/actions/DestroyItemAction.cpp b/playerbot/strategy/actions/DestroyItemAction.cpp index 7335bdaa..73cdc08c 100644 --- a/playerbot/strategy/actions/DestroyItemAction.cpp +++ b/playerbot/strategy/actions/DestroyItemAction.cpp @@ -8,7 +8,7 @@ using namespace ai; bool DestroyItemAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); ItemIds ids = chat->parseItems(text); for (ItemIds::iterator i =ids.begin(); i != ids.end(); i++) @@ -23,11 +23,11 @@ bool DestroyItemAction::Execute(Event& event) void DestroyItemAction::DestroyItem(FindItemVisitor* visitor, Player* requester) { ai->InventoryIterateItems(visitor, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list items = visitor->GetResult(); - for (list::iterator i = items.begin(); i != items.end(); ++i) + std::list items = visitor->GetResult(); + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Item* item = *i; - ostringstream out; out << chat->formatItem(item) << " destroyed"; + std::ostringstream out; out << chat->formatItem(item) << " destroyed"; bot->DestroyItem(item->GetBagSlot(),item->GetSlot(), true); ai->TellPlayer(requester, out, PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } @@ -44,7 +44,7 @@ bool SmartDestroyItemAction::Execute(Event& event) // only destroy grey items if with real player/guild if (ai->HasRealPlayerMaster() || ai->IsInRealGuild()) { - set items; + std::set items; FindItemsToTradeByQualityVisitor visitor(ITEM_QUALITY_POOR, 5); ai->InventoryIterateItems(&visitor, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); items.insert(visitor.GetResult().begin(), visitor.GetResult().end()); @@ -66,7 +66,7 @@ bool SmartDestroyItemAction::Execute(Event& event) return true; } - vector bestToDestroy = { ItemUsage::ITEM_USAGE_NONE }; //First destroy anything useless. + std::vector bestToDestroy = { ItemUsage::ITEM_USAGE_NONE }; //First destroy anything useless. if (!AI_VALUE(bool, "can sell") && AI_VALUE(bool, "should get money")) //We need money so quest items are less important since they can't directly be sold. { @@ -84,7 +84,7 @@ bool SmartDestroyItemAction::Execute(Event& event) for (auto& usage : bestToDestroy) { - list items = AI_VALUE2(list, "inventory item ids", "usage " + to_string((uint8)usage)); + std::list items = AI_VALUE2(std::list, "inventory item ids", "usage " + std::to_string((uint8)usage)); items.reverse(); diff --git a/playerbot/strategy/actions/DestroyItemAction.h b/playerbot/strategy/actions/DestroyItemAction.h index a6cd57ae..69796d90 100644 --- a/playerbot/strategy/actions/DestroyItemAction.h +++ b/playerbot/strategy/actions/DestroyItemAction.h @@ -6,18 +6,18 @@ namespace ai class DestroyItemAction : public ChatCommandAction { public: - DestroyItemAction(PlayerbotAI* ai, string name = "destroy") : ChatCommandAction(ai, name) {} + DestroyItemAction(PlayerbotAI* ai, std::string name = "destroy") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "destroy"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "destroy"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will make the bot destroy a certain item.\n" "Usage: destroy [itemlink]\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "force item usage" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "force item usage" }; } #endif protected: @@ -32,14 +32,14 @@ namespace ai virtual bool isUseful() { return !ai->HasActivePlayerMaster(); } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "smart destroy"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "smart destroy"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will make the bot destroy a certain item.\n" "Usage: destroy [itemlink]\n"; } - virtual vector GetUsedActions() { return {"destroy"}; } - virtual vector GetUsedValues() { return { "bag space", "force item usage" }; } + virtual std::vector GetUsedActions() { return {"destroy"}; } + virtual std::vector GetUsedValues() { return { "bag space", "force item usage" }; } #endif }; } diff --git a/playerbot/strategy/actions/DropQuestAction.cpp b/playerbot/strategy/actions/DropQuestAction.cpp index 37f858ef..ce0d58ce 100644 --- a/playerbot/strategy/actions/DropQuestAction.cpp +++ b/playerbot/strategy/actions/DropQuestAction.cpp @@ -7,7 +7,7 @@ using namespace ai; bool DropQuestAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string link = event.getParam(); + std::string link = event.getParam(); if (!GetMaster()) return false; @@ -22,7 +22,7 @@ bool DropQuestAction::Execute(Event& event) if (!quest) continue; - if (logQuest == entry || link.find(quest->GetTitle()) != string::npos) + if (logQuest == entry || link.find(quest->GetTitle()) != std::string::npos) { bot->SetQuestSlot(slot, 0); @@ -46,7 +46,7 @@ bool DropQuestAction::Execute(Event& event) bool CleanQuestLogAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string link = event.getParam(); + std::string link = event.getParam(); if (ai->HasActivePlayerMaster()) return false; @@ -90,7 +90,7 @@ bool CleanQuestLogAction::Execute(Event& event) void CleanQuestLogAction::DropQuestType(Player* requester, uint8 &numQuest, uint8 wantNum, bool isGreen, bool hasProgress, bool isComplete) { - vector slots; + std::vector slots; for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) slots.push_back(slot); diff --git a/playerbot/strategy/actions/DungeonActions.cpp b/playerbot/strategy/actions/DungeonActions.cpp index 45e63e6d..421db838 100644 --- a/playerbot/strategy/actions/DungeonActions.cpp +++ b/playerbot/strategy/actions/DungeonActions.cpp @@ -1,6 +1,6 @@ #include "DungeonActions.h" #include "playerbot/strategy/values/PositionValue.h" -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" #include "playerbot/PlayerbotAI.h" #include "Grids/GridNotifiers.h" #include "Grids/GridNotifiersImpl.h" @@ -10,7 +10,7 @@ using namespace ai; bool MoveAwayFromHazard::Execute(Event& event) { - const list& hazards = AI_VALUE(list, "hazards"); + const std::list& hazards = AI_VALUE(std::list, "hazards"); // Get the closest hazard to move away from const HazardPosition* closestHazard = nullptr; @@ -101,7 +101,7 @@ bool MoveAwayFromHazard::isPossible() return false; } -bool MoveAwayFromHazard::IsHazardNearby(const WorldPosition& point, const list& hazards) const +bool MoveAwayFromHazard::IsHazardNearby(const WorldPosition& point, const std::list& hazards) const { for (const HazardPosition& hazard : hazards) { @@ -120,12 +120,12 @@ bool MoveAwayFromHazard::IsHazardNearby(const WorldPosition& point, const list creatures; + std::list creatures; size_t closestCreatureIdx = 0; float closestCreatureDistance = 9999.0f; // Iterate through the near creatures - list units; + std::list units; MaNGOS::AllCreaturesOfEntryInRangeCheck u_check(bot, creatureID, range); MaNGOS::UnitListSearcher searcher(units, u_check); Cell::VisitAllObjects(bot, searcher, range); @@ -151,7 +151,7 @@ bool MoveAwayFromCreature::Execute(Event& event) return false; } - const list& hazards = AI_VALUE(list, "hazards"); + const std::list& hazards = AI_VALUE(std::list, "hazards"); // Get the closest creature reference auto it = creatures.begin(); @@ -233,7 +233,7 @@ bool MoveAwayFromCreature::isPossible() return false; } -bool MoveAwayFromCreature::IsValidPoint(const WorldPosition& point, const list& creatures, const list& hazards) +bool MoveAwayFromCreature::IsValidPoint(const WorldPosition& point, const std::list& creatures, const std::list& hazards) { // Check if the point is not near other game objects if (!HasCreaturesNearby(point, creatures) && !IsHazardNearby(point, hazards)) @@ -248,7 +248,7 @@ bool MoveAwayFromCreature::IsValidPoint(const WorldPosition& point, const list& creatures) const +bool MoveAwayFromCreature::HasCreaturesNearby(const WorldPosition& point, const std::list& creatures) const { for (const Creature* creature : creatures) { @@ -262,7 +262,7 @@ bool MoveAwayFromCreature::HasCreaturesNearby(const WorldPosition& point, const return false; } -bool MoveAwayFromCreature::IsHazardNearby(const WorldPosition& point, const list& hazards) const +bool MoveAwayFromCreature::IsHazardNearby(const WorldPosition& point, const std::list& hazards) const { for (const HazardPosition& hazard : hazards) { diff --git a/playerbot/strategy/actions/DungeonActions.h b/playerbot/strategy/actions/DungeonActions.h index 61f930cb..752a48be 100644 --- a/playerbot/strategy/actions/DungeonActions.h +++ b/playerbot/strategy/actions/DungeonActions.h @@ -7,25 +7,25 @@ namespace ai class MoveAwayFromHazard : public MovementAction { public: - MoveAwayFromHazard(PlayerbotAI* ai, string name = "move away from hazard") : MovementAction(ai, name) {} + MoveAwayFromHazard(PlayerbotAI* ai, std::string name = "move away from hazard") : MovementAction(ai, name) {} bool Execute(Event& event) override; bool isPossible() override; private: - bool IsHazardNearby(const WorldPosition& point, const list& hazards) const; + bool IsHazardNearby(const WorldPosition& point, const std::list& hazards) const; }; class MoveAwayFromCreature : public MovementAction { public: - MoveAwayFromCreature(PlayerbotAI* ai, string name, uint32 creatureID, float range) : MovementAction(ai, name), creatureID(creatureID), range(range) {} + MoveAwayFromCreature(PlayerbotAI* ai, std::string name, uint32 creatureID, float range) : MovementAction(ai, name), creatureID(creatureID), range(range) {} bool Execute(Event& event) override; bool isPossible() override; private: - bool IsValidPoint(const WorldPosition& point, const list& creatures, const list& hazards); - bool HasCreaturesNearby(const WorldPosition& point, const list& creatures) const; - bool IsHazardNearby(const WorldPosition& point, const list& hazards) const; + bool IsValidPoint(const WorldPosition& point, const std::list& creatures, const std::list& hazards); + bool HasCreaturesNearby(const WorldPosition& point, const std::list& creatures) const; + bool IsHazardNearby(const WorldPosition& point, const std::list& hazards) const; private: uint32 creatureID; diff --git a/playerbot/strategy/actions/EmoteAction.cpp b/playerbot/strategy/actions/EmoteAction.cpp index a534b508..720e0173 100644 --- a/playerbot/strategy/actions/EmoteAction.cpp +++ b/playerbot/strategy/actions/EmoteAction.cpp @@ -7,11 +7,11 @@ #include "playerbot/ServerFacade.h" using namespace ai; -map EmoteActionBase::emotes; -map EmoteActionBase::textEmotes; +std::map EmoteActionBase::emotes; +std::map EmoteActionBase::textEmotes; char *strstri(const char *haystack, const char *needle); -EmoteActionBase::EmoteActionBase(PlayerbotAI* ai, string name) : Action(ai, name) +EmoteActionBase::EmoteActionBase(PlayerbotAI* ai, std::string name) : Action(ai, name) { if (emotes.empty()) InitEmotes(); } @@ -133,9 +133,9 @@ Unit* EmoteActionBase::GetTarget() { Unit* target = NULL; - list nfp = *context->GetValue >("nearest friendly players"); - vector targets; - for (list::iterator i = nfp.begin(); i != nfp.end(); ++i) + std::list nfp = *context->GetValue >("nearest friendly players"); + std::vector targets; + for (std::list::iterator i = nfp.begin(); i != nfp.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (unit && sServerFacade.GetDistance2d(bot, unit) < sPlayerbotAIConfig.tooCloseDistance) targets.push_back(unit); @@ -151,8 +151,8 @@ bool EmoteActionBase::ReceiveEmote(Player* requester, Player* source, uint32 emo { uint32 emoteId = 0; uint32 textEmote = 0; - string emoteText; - string emoteYell; + std::string emoteText; + std::string emoteYell; switch (emote) { case TEXTEMOTE_BONK: @@ -665,7 +665,7 @@ bool EmoteAction::Execute(Event& event) uint32 text_emote; uint32 emote_num; uint32 namlen; - string nam; + std::string nam; p.rpos(0); p >> source >> text_emote >> emote_num >> namlen; if (namlen > 1) @@ -710,7 +710,7 @@ bool EmoteAction::Execute(Event& event) if ((pSource->GetObjectGuid() != bot->GetObjectGuid()) && (pSource->GetSelectionGuid() == bot->GetObjectGuid() || (urand(0, 1) && sServerFacade.IsInFront(pSource, bot, 10.0f, M_PI_F)))) { sLog.outDetail("Bot #%d %s:%d <%s> received SMSG_EMOTE %d from player #%d <%s>", bot->GetGUIDLow(), bot->GetTeam() == ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), emoteId, pSource->GetGUIDLow(), pSource->GetName()); - vector types; + std::vector types; for (int32 i = sEmotesTextStore.GetNumRows(); i >= 0; --i) { EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(uint32(i)); @@ -773,7 +773,7 @@ bool EmoteAction::Execute(Event& event) return false; } - string param = event.getParam(); + std::string param = event.getParam(); if ((!isReact && param.empty()) || emote) { time_t lastEmote = AI_VALUE2(time_t, "last emote", qualifier); @@ -806,7 +806,7 @@ bool EmoteAction::Execute(Event& event) if (param.empty() || emotes.find(param) == emotes.end()) { int index = rand() % emotes.size(); - for (map::iterator i = emotes.begin(); i != emotes.end() && index; ++i, --index) + for (std::map::iterator i = emotes.begin(); i != emotes.end() && index; ++i, --index) emote = i->second; } else @@ -867,7 +867,7 @@ bool TalkAction::Execute(Event& event) uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote) { - vector types; + std::vector types; if (textEmote) { if (!urand(0, 20)) diff --git a/playerbot/strategy/actions/EmoteAction.h b/playerbot/strategy/actions/EmoteAction.h index 008cc3c2..bcadf0ee 100644 --- a/playerbot/strategy/actions/EmoteAction.h +++ b/playerbot/strategy/actions/EmoteAction.h @@ -7,7 +7,7 @@ namespace ai class EmoteActionBase : public Action { public: - EmoteActionBase(PlayerbotAI* ai, string name); + EmoteActionBase(PlayerbotAI* ai, std::string name); static uint32 GetNumberOfEmoteVariants(TextEmotes emote, uint8 race, uint8 gender); protected: @@ -15,8 +15,8 @@ namespace ai bool ReceiveEmote(Player* requester, Player* source, uint32 emote, bool verbal = false); Unit* GetTarget(); void InitEmotes(); - static map emotes; - static map textEmotes; + static std::map emotes; + static std::map textEmotes; }; @@ -40,7 +40,7 @@ namespace ai class MountAnimAction : public Action { public: - MountAnimAction(PlayerbotAI* ai, string name = "mount anim") : Action(ai, name) {} + MountAnimAction(PlayerbotAI* ai, std::string name = "mount anim") : Action(ai, name) {} virtual bool isUseful(); virtual bool Execute(Event& event); diff --git a/playerbot/strategy/actions/EquipAction.cpp b/playerbot/strategy/actions/EquipAction.cpp index 7d27ebac..61f02eb5 100644 --- a/playerbot/strategy/actions/EquipAction.cpp +++ b/playerbot/strategy/actions/EquipAction.cpp @@ -10,7 +10,7 @@ using namespace ai; bool EquipAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); if (text == "?") { ListItems(requester); @@ -21,12 +21,12 @@ bool EquipAction::Execute(Event& event) if (ids.empty()) { //Get items based on text. - list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); + std::list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); //Sort items on itemLevel descending. found.sort([](Item* i, Item* j) {return i->GetProto()->ItemLevel > j->GetProto()->ItemLevel; }); - vector< uint16> dests; + std::vector< uint16> dests; for (auto& item : found) { uint32 itemId = item->GetProto()->ItemId; @@ -61,8 +61,8 @@ void EquipAction::ListItems(Player* requester) { ai->TellPlayer(requester, "=== Equip ==="); - map items; - map soulbound; + std::map items; + std::map soulbound; for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) { if (Item* pItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, i)) @@ -89,7 +89,7 @@ void EquipAction::EquipItems(Player* requester, ItemIds ids) void EquipAction::EquipItem(Player* requester, FindItemVisitor* visitor) { ai->InventoryIterateItems(visitor, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list items = visitor->GetResult(); + std::list items = visitor->GetResult(); if (!items.empty()) { EquipItem(requester, *items.begin()); @@ -165,9 +165,9 @@ void EquipAction::EquipItem(Player* requester, Item* item) } } - sPlayerbotAIConfig.logEvent(ai, "EquipAction", item->GetProto()->Name1, to_string(item->GetProto()->ItemId)); + sPlayerbotAIConfig.logEvent(ai, "EquipAction", item->GetProto()->Name1, std::to_string(item->GetProto()->ItemId)); - map args; + std::map args; args["%item"] = chat->formatItem(item); ai->TellPlayer(requester, BOT_TEXT2("equip_command", args), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } @@ -239,7 +239,7 @@ bool EquipUpgradesAction::Execute(Event& event) context->ClearExpiredValues("item usage", 10); //Clear old item usage. - list items; + std::list items; FindItemUsageVisitor visitor(bot, ItemUsage::ITEM_USAGE_EQUIP); ai->InventoryIterateItems(&visitor, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); diff --git a/playerbot/strategy/actions/EquipAction.h b/playerbot/strategy/actions/EquipAction.h index b2bafc45..45aed836 100644 --- a/playerbot/strategy/actions/EquipAction.h +++ b/playerbot/strategy/actions/EquipAction.h @@ -6,7 +6,7 @@ namespace ai class EquipAction : public ChatCommandAction { public: - EquipAction(PlayerbotAI* ai, string name = "equip") : ChatCommandAction(ai, name) {} + EquipAction(PlayerbotAI* ai, std::string name = "equip") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; void EquipItems(Player* requester, ItemIds ids); void EquipItem(Player* requester, Item* item); @@ -20,7 +20,7 @@ namespace ai class EquipUpgradesAction : public EquipAction { public: - EquipUpgradesAction(PlayerbotAI* ai, string name = "equip upgrades") : EquipAction(ai, name) {} + EquipUpgradesAction(PlayerbotAI* ai, std::string name = "equip upgrades") : EquipAction(ai, name) {} virtual bool Execute(Event& event) override; }; } diff --git a/playerbot/strategy/actions/FlagAction.cpp b/playerbot/strategy/actions/FlagAction.cpp index 28fd349c..21c37c33 100644 --- a/playerbot/strategy/actions/FlagAction.cpp +++ b/playerbot/strategy/actions/FlagAction.cpp @@ -9,8 +9,8 @@ using namespace ai; bool FlagAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string cmd = event.getParam(); - vector ss = split(cmd, ' '); + std::string cmd = event.getParam(); + std::vector ss = split(cmd, ' '); if (ss.size() != 2) { ai->TellError(requester, "Usage: flag cloak/helm/pvp on/set/off/clear/toggle/?"); @@ -25,7 +25,7 @@ bool FlagAction::Execute(Event& event) if (setFlag) bot->SetPvP(true); else if (clearFlag) bot->SetPvP(false); else if (toggleFlag) bot->SetPvP(!bot->IsPvP()); - ostringstream out; out << ss[0] << " flag is " << chat->formatBoolean(bot->IsPvP()); + std::ostringstream out; out << ss[0] << " flag is " << chat->formatBoolean(bot->IsPvP()); ai->TellPlayer(requester, out.str()); return true; } @@ -38,7 +38,7 @@ bool FlagAction::Execute(Event& event) else if (setFlag) bot->RemoveFlag(PLAYER_FLAGS, playerFlags); else if (toggleFlag && bot->HasFlag(PLAYER_FLAGS, playerFlags)) bot->RemoveFlag(PLAYER_FLAGS, playerFlags); else if (toggleFlag && !bot->HasFlag(PLAYER_FLAGS, playerFlags)) bot->SetFlag(PLAYER_FLAGS, playerFlags); - ostringstream out; out << ss[0] << " flag is " << chat->formatBoolean(!bot->HasFlag(PLAYER_FLAGS, playerFlags)); + std::ostringstream out; out << ss[0] << " flag is " << chat->formatBoolean(!bot->HasFlag(PLAYER_FLAGS, playerFlags)); ai->TellPlayer(requester, out.str()); return true; } diff --git a/playerbot/strategy/actions/FollowActions.h b/playerbot/strategy/actions/FollowActions.h index 2c623e23..4b32cb3d 100644 --- a/playerbot/strategy/actions/FollowActions.h +++ b/playerbot/strategy/actions/FollowActions.h @@ -7,7 +7,7 @@ namespace ai { class FollowAction : public MovementAction { public: - FollowAction(PlayerbotAI* ai, string name = "follow") : MovementAction(ai, name) {} + FollowAction(PlayerbotAI* ai, std::string name = "follow") : MovementAction(ai, name) {} virtual bool Execute(Event& event); virtual bool isUseful(); virtual bool CanDeadFollow(Unit* target); @@ -15,7 +15,7 @@ namespace ai class StopFollowAction : public MovementAction { public: - StopFollowAction(PlayerbotAI* ai, string name = "stop follow") : MovementAction(ai, name) {} + StopFollowAction(PlayerbotAI* ai, std::string name = "stop follow") : MovementAction(ai, name) {} virtual bool Execute(Event& event) { ai->StopMoving(); return true; }; }; diff --git a/playerbot/strategy/actions/GenericActions.cpp b/playerbot/strategy/actions/GenericActions.cpp index ea8a7543..092541dd 100644 --- a/playerbot/strategy/actions/GenericActions.cpp +++ b/playerbot/strategy/actions/GenericActions.cpp @@ -379,7 +379,7 @@ bool SetPetAction::Execute(Event& event) const bool autocastActive = IsAutocastActive(); pet->ToggleAutocast(spellId, !autocastActive); - ostringstream out; + std::ostringstream out; out << (autocastActive ? "Disabling" : "Enabling") << " pet autocast for "; out << ChatHelper::formatSpell(sServerFacade.LookupSpellInfo(spellId)); ai->TellPlayer(GetMaster(), out); diff --git a/playerbot/strategy/actions/GenericActions.h b/playerbot/strategy/actions/GenericActions.h index 1b591f3d..24d58558 100644 --- a/playerbot/strategy/actions/GenericActions.h +++ b/playerbot/strategy/actions/GenericActions.h @@ -11,7 +11,7 @@ namespace ai { public: MeleeAction(PlayerbotAI* ai) : AttackAction(ai, "melee") {} - virtual string GetTargetName() { return "current target"; } + virtual std::string GetTargetName() { return "current target"; } virtual bool isUseful(); }; @@ -33,11 +33,11 @@ namespace ai bool isPossible() override { - list closeObjects = AI_VALUE(list, "nearest game objects no los"); + std::list closeObjects = AI_VALUE(std::list, "nearest game objects no los"); if (closeObjects.empty()) return false; - for (list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) + for (std::list::iterator i = closeObjects.begin(); i != closeObjects.end(); ++i) { GameObject* go = ai->GetGameObject(*i); if (!go) @@ -97,7 +97,7 @@ namespace ai class ChatCommandAction : public Action { public: - ChatCommandAction(PlayerbotAI* ai, string name, uint32 duration = sPlayerbotAIConfig.reactDelay) : Action(ai, name, duration) {} + ChatCommandAction(PlayerbotAI* ai, std::string name, uint32 duration = sPlayerbotAIConfig.reactDelay) : Action(ai, name, duration) {} public: virtual bool Execute(Event& event) override { return true; } }; diff --git a/playerbot/strategy/actions/GenericSpellActions.cpp b/playerbot/strategy/actions/GenericSpellActions.cpp index 11c36b07..244a0c7e 100644 --- a/playerbot/strategy/actions/GenericSpellActions.cpp +++ b/playerbot/strategy/actions/GenericSpellActions.cpp @@ -4,7 +4,7 @@ using namespace ai; -CastSpellAction::CastSpellAction(PlayerbotAI* ai, string spell) +CastSpellAction::CastSpellAction(PlayerbotAI* ai, std::string spell) : Action(ai, spell) , range(ai->GetRange("spell")) { @@ -32,10 +32,10 @@ bool CastSpellAction::Execute(Event& event) if (!pSpellInfo) continue; - string namepart = pSpellInfo->SpellName[0]; + std::string namepart = pSpellInfo->SpellName[0]; strToLower(namepart); - if (namepart.find(spellName) == string::npos) + if (namepart.find(spellName) == std::string::npos) continue; if (pSpellInfo->Effect[0] != SPELL_EFFECT_CREATE_ITEM) @@ -200,25 +200,25 @@ bool CastSpellAction::isUseful() NextAction** CastSpellAction::getPrerequisites() { // Set the reach action as the cast spell prerequisite when needed - const string reachAction = GetReachActionName(); + const std::string reachAction = GetReachActionName(); if (!reachAction.empty()) { - const string targetName = GetTargetName(); + const std::string targetName = GetTargetName(); // No need for a reach action when target is self if (targetName != "self target") { - const string spellName = GetSpellName(); - const string targetQualifier = GetTargetQualifier(); + const std::string spellName = GetSpellName(); + const std::string targetQualifier = GetTargetQualifier(); // Generate the reach action with qualifiers - vector qualifiers = { spellName, targetName }; + std::vector qualifiers = { spellName, targetName }; if (!targetQualifier.empty()) { qualifiers.push_back(targetQualifier); } - const string qualifiersStr = Qualified::MultiQualify(qualifiers, "::"); + const std::string qualifiersStr = Qualified::MultiQualify(qualifiers, "::"); return NextAction::merge(NextAction::array(0, new NextAction(reachAction + "::" + qualifiersStr), NULL), Action::getPrerequisites()); } } @@ -226,7 +226,7 @@ NextAction** CastSpellAction::getPrerequisites() return Action::getPrerequisites(); } -void CastSpellAction::SetSpellName(const string& name, string spellIDContextName /*= "spell id"*/) +void CastSpellAction::SetSpellName(const std::string& name, std::string spellIDContextName /*= "spell id"*/) { if (spellName != name) { @@ -243,8 +243,8 @@ void CastSpellAction::SetSpellName(const string& name, string spellIDContextName Unit* CastSpellAction::GetTarget() { - string targetName = GetTargetName(); - string targetNameQualifier = GetTargetQualifier(); + std::string targetName = GetTargetName(); + std::string targetNameQualifier = GetTargetQualifier(); return targetNameQualifier.empty() ? AI_VALUE(Unit*, targetName) : AI_VALUE2(Unit*, targetName, targetNameQualifier); } @@ -386,7 +386,7 @@ void CastShootAction::UpdateWeaponInfo() { if (equippedWeapon != rangedWeapon) { - string spellName = "shoot"; + std::string spellName = "shoot"; bool isRangedWeapon = false; #ifdef MANGOSBOT_ZERO diff --git a/playerbot/strategy/actions/GenericSpellActions.h b/playerbot/strategy/actions/GenericSpellActions.h index 981f1dac..72096b67 100644 --- a/playerbot/strategy/actions/GenericSpellActions.h +++ b/playerbot/strategy/actions/GenericSpellActions.h @@ -7,7 +7,7 @@ namespace ai class CastSpellAction : public Action { public: - CastSpellAction(PlayerbotAI* ai, string spell); + CastSpellAction(PlayerbotAI* ai, std::string spell); virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_SINGLE; } virtual bool Execute(Event& event) override; virtual bool isPossible() override; @@ -20,13 +20,13 @@ namespace ai protected: const uint32& GetSpellID() const { return spellId; } - const string& GetSpellName() const { return spellName; } - void SetSpellName(const string& name, string spellIDContextName = "spell id"); + const std::string& GetSpellName() const { return spellName; } + void SetSpellName(const std::string& name, std::string spellIDContextName = "spell id"); Unit* GetTarget() override; - virtual string GetTargetName() override { return "current target"; } - virtual string GetTargetQualifier() { return ""; } - virtual string GetReachActionName() { return "reach spell"; } + virtual std::string GetTargetName() override { return "current target"; } + virtual std::string GetTargetQualifier() { return ""; } + virtual std::string GetReachActionName() { return "reach spell"; } virtual NextAction** getPrerequisites() override; @@ -34,31 +34,31 @@ namespace ai float range; private: - string spellName; + std::string spellName; uint32 spellId; }; class CastPetSpellAction : public CastSpellAction { public: - CastPetSpellAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) {} + CastPetSpellAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) {} virtual bool isPossible() override; protected: - virtual string GetTargetName() override { return "current target"; } - string GetReachActionName() override { return ""; } + virtual std::string GetTargetName() override { return "current target"; } + std::string GetReachActionName() override { return ""; } }; //--------------------------------------------------------------------------------------------------------------------- class CastAuraSpellAction : public CastSpellAction { public: - CastAuraSpellAction(PlayerbotAI* ai, string spell, bool isOwner = false) : CastSpellAction(ai, spell), isOwner(isOwner) {} + CastAuraSpellAction(PlayerbotAI* ai, std::string spell, bool isOwner = false) : CastSpellAction(ai, spell), isOwner(isOwner) {} virtual bool isUseful() override; protected: - virtual string GetReachActionName() override { return "reach spell"; } + virtual std::string GetReachActionName() override { return "reach spell"; } protected: bool isOwner; @@ -68,20 +68,20 @@ namespace ai class CastMeleeSpellAction : public CastSpellAction { public: - CastMeleeSpellAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) + CastMeleeSpellAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) { range = ATTACK_DISTANCE; } protected: - virtual string GetReachActionName() override { return "reach melee"; } + virtual std::string GetReachActionName() override { return "reach melee"; } }; //--------------------------------------------------------------------------------------------------------------------- class CastMeleeAoeSpellAction : public CastSpellAction { public: - CastMeleeAoeSpellAction(PlayerbotAI* ai, string spell, float radius) : CastSpellAction(ai, spell), radius(radius) + CastMeleeAoeSpellAction(PlayerbotAI* ai, std::string spell, float radius) : CastSpellAction(ai, spell), radius(radius) { range = ATTACK_DISTANCE; } @@ -89,7 +89,7 @@ namespace ai virtual bool isUseful() override; protected: - virtual string GetReachActionName() override { return ""; } + virtual std::string GetReachActionName() override { return ""; } protected: float radius; @@ -99,65 +99,65 @@ namespace ai class CastMeleeDebuffSpellAction : public CastAuraSpellAction { public: - CastMeleeDebuffSpellAction(PlayerbotAI* ai, string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) + CastMeleeDebuffSpellAction(PlayerbotAI* ai, std::string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) { range = ATTACK_DISTANCE; } protected: - virtual string GetReachActionName() override { return "reach melee"; } + virtual std::string GetReachActionName() override { return "reach melee"; } }; class CastRangedDebuffSpellAction : public CastAuraSpellAction { public: - CastRangedDebuffSpellAction(PlayerbotAI* ai, string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) {} + CastRangedDebuffSpellAction(PlayerbotAI* ai, std::string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) {} protected: - virtual string GetReachActionName() override { return "reach spell"; } + virtual std::string GetReachActionName() override { return "reach spell"; } }; class CastMeleeDebuffSpellOnAttackerAction : public CastAuraSpellAction { public: - CastMeleeDebuffSpellOnAttackerAction(PlayerbotAI* ai, string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) + CastMeleeDebuffSpellOnAttackerAction(PlayerbotAI* ai, std::string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) { range = ATTACK_DISTANCE; } protected: - string GetReachActionName() override { return "reach melee"; } - string GetTargetName() override { return "attacker without aura"; } - string GetTargetQualifier() override { return GetSpellName(); } - virtual string getName() override { return GetSpellName() + " on attacker"; } + std::string GetReachActionName() override { return "reach melee"; } + std::string GetTargetName() override { return "attacker without aura"; } + std::string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string getName() override { return GetSpellName() + " on attacker"; } virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_AOE; } }; class CastRangedDebuffSpellOnAttackerAction : public CastAuraSpellAction { public: - CastRangedDebuffSpellOnAttackerAction(PlayerbotAI* ai, string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) {} + CastRangedDebuffSpellOnAttackerAction(PlayerbotAI* ai, std::string spell, bool isOwner = true) : CastAuraSpellAction(ai, spell, isOwner) {} protected: - virtual string GetReachActionName() override { return "reach spell"; } - virtual string GetTargetName() override { return "attacker without aura"; } - virtual string GetTargetQualifier() override { return GetSpellName(); } - virtual string getName() override { return GetSpellName() + " on attacker"; } + virtual std::string GetReachActionName() override { return "reach spell"; } + virtual std::string GetTargetName() override { return "attacker without aura"; } + virtual std::string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string getName() override { return GetSpellName() + " on attacker"; } virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_AOE; } }; class CastBuffSpellAction : public CastAuraSpellAction { public: - CastBuffSpellAction(PlayerbotAI* ai, string spell) : CastAuraSpellAction(ai, spell) { } - virtual string GetTargetName() override { return "self target"; } + CastBuffSpellAction(PlayerbotAI* ai, std::string spell) : CastAuraSpellAction(ai, spell) { } + virtual std::string GetTargetName() override { return "self target"; } }; class CastEnchantItemAction : public CastSpellAction { public: - CastEnchantItemAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) { } - virtual string GetTargetName() override { return "self target"; } + CastEnchantItemAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) { } + virtual std::string GetTargetName() override { return "self target"; } virtual bool isPossible() override; }; @@ -166,12 +166,12 @@ namespace ai class CastHealingSpellAction : public CastAuraSpellAction { public: - CastHealingSpellAction(PlayerbotAI* ai, string spell, uint8 estAmount = 15.0f) : CastAuraSpellAction(ai, spell, true), estAmount(estAmount) {} + CastHealingSpellAction(PlayerbotAI* ai, std::string spell, uint8 estAmount = 15.0f) : CastAuraSpellAction(ai, spell, true), estAmount(estAmount) {} protected: virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_AOE; } - virtual string GetTargetName() override { return "self target"; } - virtual string GetReachActionName() override { return "reach party member to heal"; } + virtual std::string GetTargetName() override { return "self target"; } + virtual std::string GetReachActionName() override { return "reach party member to heal"; } protected: uint8 estAmount; @@ -180,64 +180,64 @@ namespace ai class CastAoeHealSpellAction : public CastHealingSpellAction { public: - CastAoeHealSpellAction(PlayerbotAI* ai, string spell, uint8 estAmount = 15.0f) : CastHealingSpellAction(ai, spell, estAmount) {} - virtual string GetTargetName() override { return "party member to heal"; } + CastAoeHealSpellAction(PlayerbotAI* ai, std::string spell, uint8 estAmount = 15.0f) : CastHealingSpellAction(ai, spell, estAmount) {} + virtual std::string GetTargetName() override { return "party member to heal"; } virtual bool isUseful() override; }; class CastCureSpellAction : public CastSpellAction { public: - CastCureSpellAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) {} - virtual string GetTargetName() override { return "self target"; } + CastCureSpellAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) {} + virtual std::string GetTargetName() override { return "self target"; } }; class PartyMemberActionNameSupport { public: - PartyMemberActionNameSupport(string spell) : name(spell + " on party") {} - string getName() { return name; } + PartyMemberActionNameSupport(std::string spell) : name(spell + " on party") {} + std::string getName() { return name; } private: - string name; + std::string name; }; class HealPartyMemberAction : public CastHealingSpellAction, public PartyMemberActionNameSupport { public: - HealPartyMemberAction(PlayerbotAI* ai, string spell, uint8 estAmount = 15.0f) : CastHealingSpellAction(ai, spell, estAmount), PartyMemberActionNameSupport(spell) {} - virtual string getName() override { return PartyMemberActionNameSupport::getName(); } - virtual string GetTargetName() override { return "party member to heal"; } + HealPartyMemberAction(PlayerbotAI* ai, std::string spell, uint8 estAmount = 15.0f) : CastHealingSpellAction(ai, spell, estAmount), PartyMemberActionNameSupport(spell) {} + virtual std::string getName() override { return PartyMemberActionNameSupport::getName(); } + virtual std::string GetTargetName() override { return "party member to heal"; } }; class HealHotPartyMemberAction : public HealPartyMemberAction { public: - HealHotPartyMemberAction(PlayerbotAI* ai, string spell) : HealPartyMemberAction(ai, spell) {} + HealHotPartyMemberAction(PlayerbotAI* ai, std::string spell) : HealPartyMemberAction(ai, spell) {} virtual bool isUseful() override; }; class ResurrectPartyMemberAction : public CastSpellAction { public: - ResurrectPartyMemberAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) {} + ResurrectPartyMemberAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) {} protected: - virtual string GetTargetName() override { return "party member to resurrect"; } - virtual string GetReachActionName() override { return "reach party member to heal"; } + virtual std::string GetTargetName() override { return "party member to resurrect"; } + virtual std::string GetReachActionName() override { return "reach party member to heal"; } }; //--------------------------------------------------------------------------------------------------------------------- class CurePartyMemberAction : public CastSpellAction, public PartyMemberActionNameSupport { public: - CurePartyMemberAction(PlayerbotAI* ai, string spell, uint32 dispelType) : CastSpellAction(ai, spell), PartyMemberActionNameSupport(spell), dispelType(dispelType) {} + CurePartyMemberAction(PlayerbotAI* ai, std::string spell, uint32 dispelType) : CastSpellAction(ai, spell), PartyMemberActionNameSupport(spell), dispelType(dispelType) {} protected: - virtual string GetReachActionName() override { return "reach party member to heal"; } - virtual string getName() override { return PartyMemberActionNameSupport::getName(); } - virtual string GetTargetName() override { return "party member to dispel"; } - virtual string GetTargetQualifier() override { return std::to_string(dispelType); } + virtual std::string GetReachActionName() override { return "reach party member to heal"; } + virtual std::string getName() override { return PartyMemberActionNameSupport::getName(); } + virtual std::string GetTargetName() override { return "party member to dispel"; } + virtual std::string GetTargetQualifier() override { return std::to_string(dispelType); } protected: uint32 dispelType; @@ -248,12 +248,12 @@ namespace ai class BuffOnPartyAction : public CastBuffSpellAction, public PartyMemberActionNameSupport { public: - BuffOnPartyAction(PlayerbotAI* ai, string spell, bool ignoreTanks = false) : CastBuffSpellAction(ai, spell), PartyMemberActionNameSupport(spell), ignoreTanks(ignoreTanks) {} + BuffOnPartyAction(PlayerbotAI* ai, std::string spell, bool ignoreTanks = false) : CastBuffSpellAction(ai, spell), PartyMemberActionNameSupport(spell), ignoreTanks(ignoreTanks) {} protected: - virtual string getName() override { return PartyMemberActionNameSupport::getName(); } - virtual string GetTargetName() override { return "friendly unit without aura"; } - virtual string GetTargetQualifier() override { return GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + virtual std::string getName() override { return PartyMemberActionNameSupport::getName(); } + virtual std::string GetTargetName() override { return "friendly unit without aura"; } + virtual std::string GetTargetQualifier() override { return GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } protected: bool ignoreTanks; @@ -264,12 +264,12 @@ namespace ai class GreaterBuffOnPartyAction : public CastBuffSpellAction, public PartyMemberActionNameSupport { public: - GreaterBuffOnPartyAction(PlayerbotAI* ai, string spell, bool ignoreTanks = false) : CastBuffSpellAction(ai, spell), PartyMemberActionNameSupport(spell), ignoreTanks(ignoreTanks) {} + GreaterBuffOnPartyAction(PlayerbotAI* ai, std::string spell, bool ignoreTanks = false) : CastBuffSpellAction(ai, spell), PartyMemberActionNameSupport(spell), ignoreTanks(ignoreTanks) {} protected: - virtual string getName() override { return PartyMemberActionNameSupport::getName(); } - virtual string GetTargetName() override { return "party member without aura"; } - virtual string GetTargetQualifier() override { return GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + virtual std::string getName() override { return PartyMemberActionNameSupport::getName(); } + virtual std::string GetTargetName() override { return "party member without aura"; } + virtual std::string GetTargetQualifier() override { return GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } private: bool ignoreTanks; @@ -280,22 +280,22 @@ namespace ai class PartyTankActionNameSupport { public: - PartyTankActionNameSupport(string spell) : name(spell + " on tank") {} - string getName() { return name; } + PartyTankActionNameSupport(std::string spell) : name(spell + " on tank") {} + std::string getName() { return name; } private: - string name; + std::string name; }; class BuffOnTankAction : public CastBuffSpellAction, public PartyMemberActionNameSupport { public: - BuffOnTankAction(PlayerbotAI* ai, string spell) : CastBuffSpellAction(ai, spell), PartyMemberActionNameSupport(spell) {} + BuffOnTankAction(PlayerbotAI* ai, std::string spell) : CastBuffSpellAction(ai, spell), PartyMemberActionNameSupport(spell) {} protected: - virtual string getName() override { return PartyMemberActionNameSupport::getName(); } - virtual string GetTargetName() override { return "party tank without aura"; } - virtual string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string getName() override { return PartyMemberActionNameSupport::getName(); } + virtual std::string GetTargetName() override { return "party tank without aura"; } + virtual std::string GetTargetQualifier() override { return GetSpellName(); } }; class CastShootAction : public CastSpellAction @@ -307,7 +307,7 @@ namespace ai bool isPossible() override; protected: - virtual string GetReachActionName() override { return "reach spell"; } + virtual std::string GetReachActionName() override { return "reach spell"; } private: void UpdateWeaponInfo(); @@ -321,13 +321,13 @@ namespace ai class RemoveBuffAction : public Action { public: - RemoveBuffAction(PlayerbotAI* ai, string spell) : Action(ai, "remove aura"), name(spell) {} - virtual string getName() override { return "remove " + name; } + RemoveBuffAction(PlayerbotAI* ai, std::string spell) : Action(ai, "remove aura"), name(spell) {} + virtual std::string getName() override { return "remove " + name; } virtual bool isUseful() override; virtual bool Execute(Event& event) override; private: - string name; + std::string name; }; // racials @@ -370,49 +370,49 @@ namespace ai class CastSpellOnEnemyHealerAction : public CastSpellAction { public: - CastSpellOnEnemyHealerAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) {} + CastSpellOnEnemyHealerAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) {} protected: - virtual string GetReachActionName() override { return "reach spell"; } - virtual string GetTargetName() override { return "enemy healer target"; } - virtual string GetTargetQualifier() override { return GetSpellName(); } - virtual string getName() override { return GetSpellName() + " on enemy healer"; } + virtual std::string GetReachActionName() override { return "reach spell"; } + virtual std::string GetTargetName() override { return "enemy healer target"; } + virtual std::string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string getName() override { return GetSpellName() + " on enemy healer"; } }; class CastSnareSpellAction : public CastRangedDebuffSpellAction { public: - CastSnareSpellAction(PlayerbotAI* ai, string spell) : CastRangedDebuffSpellAction(ai, spell) {} + CastSnareSpellAction(PlayerbotAI* ai, std::string spell) : CastRangedDebuffSpellAction(ai, spell) {} protected: - virtual string GetReachActionName() override { return "reach spell"; } - virtual string GetTargetName() override { return "snare target"; } - virtual string GetTargetQualifier() override { return GetSpellName(); } - virtual string getName() override { return GetSpellName() + " on snare target"; } + virtual std::string GetReachActionName() override { return "reach spell"; } + virtual std::string GetTargetName() override { return "snare target"; } + virtual std::string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string getName() override { return GetSpellName() + " on snare target"; } virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_NONE; } }; class CastCrowdControlSpellAction : public CastRangedDebuffSpellAction { public: - CastCrowdControlSpellAction(PlayerbotAI* ai, string spell) : CastRangedDebuffSpellAction(ai, spell) {} + CastCrowdControlSpellAction(PlayerbotAI* ai, std::string spell) : CastRangedDebuffSpellAction(ai, spell) {} private: - virtual string GetReachActionName() override { return "reach spell"; } - virtual string GetTargetName() override { return "cc target"; } - virtual string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string GetReachActionName() override { return "reach spell"; } + virtual std::string GetTargetName() override { return "cc target"; } + virtual std::string GetTargetQualifier() override { return GetSpellName(); } virtual ActionThreatType getThreatType() { return ActionThreatType::ACTION_THREAT_NONE; } }; class CastProtectSpellAction : public CastSpellAction { public: - CastProtectSpellAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) {} + CastProtectSpellAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) {} virtual bool isUseful() override { return CastSpellAction::isUseful() && !ai->HasAura(GetSpellName(), GetTarget()); } protected: - virtual string GetReachActionName() override { return "reach spell"; } - virtual string GetTargetName() override { return "party member to protect"; } + virtual std::string GetReachActionName() override { return "reach spell"; } + virtual std::string GetTargetName() override { return "party member to protect"; } virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_NONE; } }; @@ -431,7 +431,7 @@ namespace ai class CastVehicleSpellAction : public CastSpellAction { public: - CastVehicleSpellAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) + CastVehicleSpellAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) { range = 120.0f; SetSpellName(spell, "vehicle spell id"); @@ -443,8 +443,8 @@ namespace ai protected: virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_NONE; } - virtual string GetTargetName() override { return "current target"; } - virtual string GetReachActionName() override { return ""; } + virtual std::string GetTargetName() override { return "current target"; } + virtual std::string GetReachActionName() override { return ""; } }; class CastHurlBoulderAction : public CastVehicleSpellAction diff --git a/playerbot/strategy/actions/GiveItemAction.cpp b/playerbot/strategy/actions/GiveItemAction.cpp index 6eaf6c3f..43a60644 100644 --- a/playerbot/strategy/actions/GiveItemAction.cpp +++ b/playerbot/strategy/actions/GiveItemAction.cpp @@ -6,7 +6,7 @@ using namespace ai; -vector split(const string &s, char delim); +std::vector split(const std::string &s, char delim); bool GiveItemAction::Execute(Event& event) { @@ -25,8 +25,8 @@ bool GiveItemAction::Execute(Event& event) return true; bool moved = false; - list items = ai->InventoryParseItems(item, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - for (list::iterator j = items.begin(); j != items.end(); j++) + std::list items = ai->InventoryParseItems(item, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); + for (std::list::iterator j = items.begin(); j != items.end(); j++) { Item* item = *j; @@ -42,13 +42,13 @@ bool GiveItemAction::Execute(Event& event) receiver->MoveItemToInventory(dest, item, true); moved = true; - ostringstream out; + std::ostringstream out; out << "Got " << chat->formatItem(item, item->GetCount()) << " from " << bot->GetName(); receiverAi->TellPlayerNoFacing(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } else { - ostringstream out; + std::ostringstream out; out << "Cannot get " << chat->formatItem(item, item->GetCount()) << " from " << bot->GetName() << "- my bags are full"; receiverAi->TellPlayerNoFacing(requester, out.str()); } diff --git a/playerbot/strategy/actions/GiveItemAction.h b/playerbot/strategy/actions/GiveItemAction.h index 6b37f361..cc9db3ac 100644 --- a/playerbot/strategy/actions/GiveItemAction.h +++ b/playerbot/strategy/actions/GiveItemAction.h @@ -6,13 +6,13 @@ namespace ai class GiveItemAction : public Action { public: - GiveItemAction(PlayerbotAI* ai, string name, string item) : Action(ai, name), item(item) {} + GiveItemAction(PlayerbotAI* ai, std::string name, std::string item) : Action(ai, name), item(item) {} virtual bool Execute(Event& event) override; virtual bool isUseful() { return GetTarget() && AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig.lowMana; } virtual Unit* GetTarget(); protected: - string item; + std::string item; }; class GiveFoodAction : public GiveItemAction diff --git a/playerbot/strategy/actions/GoAction.cpp b/playerbot/strategy/actions/GoAction.cpp index 0bfc1b26..f748efe3 100644 --- a/playerbot/strategy/actions/GoAction.cpp +++ b/playerbot/strategy/actions/GoAction.cpp @@ -12,7 +12,7 @@ using namespace ai; -vector split(const string& s, char delim); +std::vector split(const std::string& s, char delim); char* strstri(const char* haystack, const char* needle); bool GoAction::Execute(Event& event) @@ -21,25 +21,25 @@ bool GoAction::Execute(Event& event) if (!requester) return false; - string param = event.getParam(); + std::string param = event.getParam(); if (param == "?") { float x = bot->GetPositionX(); float y = bot->GetPositionY(); Map2ZoneCoordinates(x, y, bot->GetZoneId()); - ostringstream out; + std::ostringstream out; out << "I am at " << x << "," << y; ai->TellPlayer(requester, out.str()); return true; } - if (param.find("where") != string::npos) + if (param.find("where") != std::string::npos) { return TellWhereToGo(param, requester); } - if (param.find("how") != string::npos && param.size() > 4) + if (param.find("how") != std::string::npos && param.size() > 4) { - string destination = param.substr(4); + std::string destination = param.substr(4); TravelDestination* dest = ChooseTravelTargetAction::FindDestination(bot, destination); if (!dest) { @@ -48,7 +48,7 @@ bool GoAction::Execute(Event& event) } return TellHowToGo(dest, requester); } - map goTos; + std::map goTos; goTos.emplace(std::pair("zone", 5)); goTos.emplace(std::pair("quest", 6)); goTos.emplace(std::pair("npc", 4)); @@ -59,7 +59,7 @@ bool GoAction::Execute(Event& event) { if (param.find(option.first) == 0 && param.size() > option.second) { - string destination = param.substr(option.second); + std::string destination = param.substr(option.second); TravelDestination* dest = nullptr; if (option.first == "to") { @@ -86,9 +86,9 @@ bool GoAction::Execute(Event& event) } } - if (param.find("travel") != string::npos && param.size()> 7) + if (param.find("travel") != std::string::npos && param.size()> 7) { - string destination = param.substr(7); + std::string destination = param.substr(7); TravelDestination* dest = ChooseTravelTargetAction::FindDestination(bot, destination); @@ -114,9 +114,9 @@ bool GoAction::Execute(Event& event) return false; } -bool GoAction::TellWhereToGo(string& param, Player* requester) const +bool GoAction::TellWhereToGo(std::string& param, Player* requester) const { - string text; + std::string text; if (param.size() > 6) text = param.substr(6); @@ -135,9 +135,9 @@ bool GoAction::TellWhereToGo(string& param, Player* requester) const return false; } - string title = target->getDestination()->getTitle(); + std::string title = target->getDestination()->getTitle(); - if (title.find('[') != string::npos) + if (title.find('[') != std::string::npos) title = title.substr(title.find("[") + 1, title.find("]") - title.find("[") - 1); @@ -152,7 +152,7 @@ bool GoAction::TellWhereToGo(string& param, Player* requester) const return false; } - string link = ChatHelper::formatValue("command", "go to " + title, title, "FF00FFFF"); + std::string link = ChatHelper::formatValue("command", "go to " + title, title, "FF00FFFF"); ai->TellPlayerNoFacing(requester, "I would like to travel to " + link + "(" + target->getDestination()->getTitle() + ")"); @@ -188,7 +188,7 @@ bool GoAction::TellHowToGo(TravelDestination* dest, Player* requester) const WorldPosition botPos = WorldPosition(bot); WorldPosition* point = dest->nearestPoint(botPos); - vector beginPath, endPath; + std::vector beginPath, endPath; TravelNodeRoute route = sTravelNodeMap.getRoute(botPos, *point, beginPath, bot); if (route.isEmpty()) @@ -215,7 +215,7 @@ bool GoAction::TellHowToGo(TravelDestination* dest, Player* requester) const TravelNodePath* travelPath = nextNode->getPathTo(node); - vector path = travelPath->getPath(); + std::vector path = travelPath->getPath(); for (auto& p : path) { @@ -244,7 +244,7 @@ bool GoAction::TellHowToGo(TravelDestination* dest, Player* requester) const else ai->TellPlayerNoFacing(requester, "We are near " + dest->getTitle()); - ai->TellPlayer(requester, "it is " + to_string(uint32(round(poi.distance(botPos)))) + " yards to the " + ChatHelper::formatAngle(pointAngle)); + ai->TellPlayer(requester, "it is " + std::to_string(uint32(round(poi.distance(botPos)))) + " yards to the " + ChatHelper::formatAngle(pointAngle)); sServerFacade.SetFacingTo(bot, pointAngle, true); bot->HandleEmoteCommand(EMOTE_ONESHOT_POINT); ai->Poi(poi.getX(), poi.getY()); @@ -266,7 +266,7 @@ bool GoAction::TravelTo(TravelDestination* dest, Player* requester) const target->setTarget(dest, point); target->setForced(true); - ostringstream out; out << "Traveling to " << dest->getTitle(); + std::ostringstream out; out << "Traveling to " << dest->getTitle(); ai->TellPlayerNoFacing(requester, out.str()); if (!ai->HasStrategy("travel", BotState::BOT_STATE_NON_COMBAT)) @@ -282,13 +282,13 @@ bool GoAction::TravelTo(TravelDestination* dest, Player* requester) const } } -bool GoAction::MoveToGo(string& param, Player* requester) +bool GoAction::MoveToGo(std::string& param, Player* requester) { - list gos = ChatHelper::parseGameobjects(param); + std::list gos = ChatHelper::parseGameobjects(param); if (gos.empty()) return false; - for (list::iterator i = gos.begin(); i != gos.end(); ++i) + for (std::list::iterator i = gos.begin(); i != gos.end(); ++i) { GameObject* go = ai->GetGameObject(*i); if (go && sServerFacade.isSpawned(go)) @@ -299,7 +299,7 @@ bool GoAction::MoveToGo(string& param, Player* requester) return false; } - ostringstream out; out << "Moving to " << ChatHelper::formatGameobject(go); + std::ostringstream out; out << "Moving to " << ChatHelper::formatGameobject(go); ai->TellPlayerNoFacing(requester, out.str()); return MoveNear(bot->GetMapId(), go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 0.5f, ai->GetRange("follow")); } @@ -307,19 +307,19 @@ bool GoAction::MoveToGo(string& param, Player* requester) return false; } -bool GoAction::MoveToUnit(string& param, Player* requester) +bool GoAction::MoveToUnit(std::string& param, Player* requester) { - list units; - list npcs = AI_VALUE(list, "nearest npcs"); + std::list units; + std::list npcs = AI_VALUE(std::list, "nearest npcs"); units.insert(units.end(), npcs.begin(), npcs.end()); - list players = AI_VALUE(list, "nearest friendly players"); + std::list players = AI_VALUE(std::list, "nearest friendly players"); units.insert(units.end(), players.begin(), players.end()); - for (list::iterator i = units.begin(); i != units.end(); i++) + for (std::list::iterator i = units.begin(); i != units.end(); i++) { Unit* unit = ai->GetUnit(*i); if (unit && strstri(unit->GetName(), param.c_str())) { - ostringstream out; out << "Moving to " << unit->GetName(); + std::ostringstream out; out << "Moving to " << unit->GetName(); ai->TellPlayerNoFacing(requester, out.str()); return MoveNear(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ() + 0.5f, ai->GetRange("follow")); } @@ -328,11 +328,11 @@ bool GoAction::MoveToUnit(string& param, Player* requester) return false; } -bool GoAction::MoveToGps(string& param, Player* requester) +bool GoAction::MoveToGps(std::string& param, Player* requester) { - if (param.find(";") != string::npos) + if (param.find(";") != std::string::npos) { - vector coords = split(param, ';'); + std::vector coords = split(param, ';'); float x = atof(coords[0].c_str()); float y = atof(coords[1].c_str()); float z; @@ -353,7 +353,7 @@ bool GoAction::MoveToGps(string& param, Player* requester) PointsArray& points = path.getPath(); PathType type = path.getPathType(); - ostringstream out; + std::ostringstream out; out << x << ";" << y << ";" << z << " ="; @@ -386,11 +386,11 @@ bool GoAction::MoveToGps(string& param, Player* requester) return false; } -bool GoAction::MoveToMapGps(string& param, Player* requester) +bool GoAction::MoveToMapGps(std::string& param, Player* requester) { - if (param.find(",") != string::npos) + if (param.find(",") != std::string::npos) { - vector coords = split(param, ','); + std::vector coords = split(param, ','); float x = atof(coords[0].c_str()); float y = atof(coords[1].c_str()); @@ -430,14 +430,14 @@ bool GoAction::MoveToMapGps(string& param, Player* requester) float x1 = x, y1 = y; Map2ZoneCoordinates(x1, y1, bot->GetZoneId()); - ostringstream out; out << "Moving to " << x1 << "," << y1; + std::ostringstream out; out << "Moving to " << x1 << "," << y1; ai->TellPlayerNoFacing(requester, out.str()); return MoveNear(bot->GetMapId(), x, y, z + 0.5f, ai->GetRange("follow")); } return false; } -bool GoAction::MoveToPosition(string& param, Player* requester) +bool GoAction::MoveToPosition(std::string& param, Player* requester) { PositionEntry pos = context->GetValue("position")->Get()[param]; if (pos.isSet()) @@ -448,7 +448,7 @@ bool GoAction::MoveToPosition(string& param, Player* requester) return false; } - ostringstream out; out << "Moving to position " << param; + std::ostringstream out; out << "Moving to position " << param; ai->TellPlayerNoFacing(requester, out.str()); return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z + 0.5f, ai->GetRange("follow")); } diff --git a/playerbot/strategy/actions/GoAction.h b/playerbot/strategy/actions/GoAction.h index d55a7b2b..f69d123a 100644 --- a/playerbot/strategy/actions/GoAction.h +++ b/playerbot/strategy/actions/GoAction.h @@ -13,8 +13,8 @@ namespace ai virtual bool isPossible() override { return true; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "go"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "go"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This will make the bot move to a specific location.\n" "Examples:\n" @@ -25,19 +25,19 @@ namespace ai "go to : Travel up to specified object\n or while following explain how to get there.\n" "go travel : Set the bots current travel destination\n to specified object and travel (up to) that location.\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "travel target" , "nearest npcs" , "nearest friendly players" , "position" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "travel target" , "nearest npcs" , "nearest friendly players" , "position" }; } #endif private: - bool TellWhereToGo(string& param, Player* requester) const; + bool TellWhereToGo(std::string& param, Player* requester) const; bool LeaderAlreadyTraveling(TravelDestination* dest) const; bool TellHowToGo(TravelDestination* dest, Player* requester) const; bool TravelTo(TravelDestination* dest, Player* requester) const; - bool MoveToGo(string& param, Player* requester); - bool MoveToUnit(string& param, Player* requester); - bool MoveToGps(string& param, Player* requester); - bool MoveToMapGps(string& param, Player* requester); + bool MoveToGo(std::string& param, Player* requester); + bool MoveToUnit(std::string& param, Player* requester); + bool MoveToGps(std::string& param, Player* requester); + bool MoveToMapGps(std::string& param, Player* requester); bool MoveToPosition(std::string& param, Player* requester); }; } diff --git a/playerbot/strategy/actions/GossipHelloAction.cpp b/playerbot/strategy/actions/GossipHelloAction.cpp index b2911803..55f83a86 100644 --- a/playerbot/strategy/actions/GossipHelloAction.cpp +++ b/playerbot/strategy/actions/GossipHelloAction.cpp @@ -37,7 +37,7 @@ bool GossipHelloAction::Execute(Event& event) if (pMenuItemBounds.first == pMenuItemBounds.second) return false; - string text = event.getParam(); + std::string text = event.getParam(); int menuToSelect = -1; if (text.empty()) { @@ -46,7 +46,7 @@ bool GossipHelloAction::Execute(Event& event) bot->GetSession()->HandleGossipHelloOpcode(p1); sServerFacade.SetFacingTo(bot, pCreature); - ostringstream out; out << "--- " << pCreature->GetName() << " ---"; + std::ostringstream out; out << "--- " << pCreature->GetName() << " ---"; ai->TellPlayerNoFacing(requester, out.str()); TellGossipMenus(requester); @@ -77,9 +77,9 @@ void GossipHelloAction::TellGossipText(Player* requester, uint32 textId) { for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; i++) { - string text0 = text->Options[i].Text_0; + std::string text0 = text->Options[i].Text_0; if (!text0.empty()) ai->TellPlayerNoFacing(requester, text0); - string text1 = text->Options[i].Text_1; + std::string text1 = text->Options[i].Text_1; if (!text1.empty()) ai->TellPlayerNoFacing(requester, text1); } } @@ -106,7 +106,7 @@ void GossipHelloAction::TellGossipMenus(Player* requester) for (unsigned int i = 0; i < menu.MenuItemCount(); i++) { GossipMenuItem const& item = menu.GetItem(i); - ostringstream out; out << "[" << (i+1) << "] " << item.m_gMessage; + std::ostringstream out; out << "[" << (i+1) << "] " << item.m_gMessage; ai->TellPlayerNoFacing(requester, out.str()); } } diff --git a/playerbot/strategy/actions/GreetAction.cpp b/playerbot/strategy/actions/GreetAction.cpp index c00f53bb..3b89c822 100644 --- a/playerbot/strategy/actions/GreetAction.cpp +++ b/playerbot/strategy/actions/GreetAction.cpp @@ -27,11 +27,11 @@ bool GreetAction::Execute(Event& event) ai->PlayEmote(TEXTEMOTE_HELLO); bot->SetSelectionGuid(oldSel); - set& alreadySeenPlayers = ai->GetAiObjectContext()->GetValue& >("already seen players")->Get(); + std::set& alreadySeenPlayers = ai->GetAiObjectContext()->GetValue& >("already seen players")->Get(); alreadySeenPlayers.insert(guid); - list nearestPlayers = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); - for (list::iterator i = nearestPlayers.begin(); i != nearestPlayers.end(); ++i) { + std::list nearestPlayers = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); + for (std::list::iterator i = nearestPlayers.begin(); i != nearestPlayers.end(); ++i) { alreadySeenPlayers.insert(*i); } return true; diff --git a/playerbot/strategy/actions/GuildAcceptAction.cpp b/playerbot/strategy/actions/GuildAcceptAction.cpp index d3e12761..ee7961d6 100644 --- a/playerbot/strategy/actions/GuildAcceptAction.cpp +++ b/playerbot/strategy/actions/GuildAcceptAction.cpp @@ -3,7 +3,6 @@ #include "GuildAcceptAction.h" #include "playerbot/ServerFacade.h" -using namespace std; using namespace ai; bool GuildAcceptAction::Execute(Event& event) @@ -49,7 +48,7 @@ bool GuildAcceptAction::Execute(Event& event) if (sPlayerbotAIConfig.inviteChat && sServerFacade.GetDistance2d(bot, inviter) < sPlayerbotAIConfig.spellDistance * 1.5 && inviter->GetPlayerbotAI() && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%name"] = inviter->GetName(); if (urand(0, 3)) @@ -63,7 +62,7 @@ bool GuildAcceptAction::Execute(Event& event) { bot->GetSession()->HandleGuildAcceptOpcode(packet); - sPlayerbotAIConfig.logEvent(ai, "GuildAcceptAction", guild->GetName(), to_string(guild->GetMemberSize())); + sPlayerbotAIConfig.logEvent(ai, "GuildAcceptAction", guild->GetName(), std::to_string(guild->GetMemberSize())); } else { diff --git a/playerbot/strategy/actions/GuildBankAction.cpp b/playerbot/strategy/actions/GuildBankAction.cpp index 619f4d33..e7fbf454 100644 --- a/playerbot/strategy/actions/GuildBankAction.cpp +++ b/playerbot/strategy/actions/GuildBankAction.cpp @@ -6,14 +6,13 @@ #include "Guilds/Guild.h" #include "Guilds/GuildMgr.h" -using namespace std; using namespace ai; bool GuildBankAction::Execute(Event& event) { #ifndef MANGOSBOT_ZERO Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); if (text.empty()) return false; @@ -23,8 +22,8 @@ bool GuildBankAction::Execute(Event& event) return false; } - list gos = *ai->GetAiObjectContext()->GetValue >("nearest game objects"); - for (list::iterator i = gos.begin(); i != gos.end(); ++i) + std::list gos = *ai->GetAiObjectContext()->GetValue >("nearest game objects"); + for (std::list::iterator i = gos.begin(); i != gos.end(); ++i) { GameObject* go = ai->GetGameObject(*i); if (!go || !bot->GetGameObjectIfCanInteractWith(go->GetObjectGuid(), GAMEOBJECT_TYPE_GUILD_BANK)) @@ -40,17 +39,17 @@ bool GuildBankAction::Execute(Event& event) #endif } -bool GuildBankAction::Execute(string text, GameObject* bank, Player* requester) +bool GuildBankAction::Execute(std::string text, GameObject* bank, Player* requester) { bool result = true; IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list found = ai->InventoryParseItems(text, mask); + std::list found = ai->InventoryParseItems(text, mask); if (found.empty()) return false; - for (list::iterator i = found.begin(); i != found.end(); i++) + for (std::list::iterator i = found.begin(); i != found.end(); i++) { Item* item = *i; if (item) @@ -65,7 +64,7 @@ bool GuildBankAction::MoveFromCharToBank(Item* item, GameObject* bank, Player* r #ifndef MANGOSBOT_ZERO uint32 playerSlot = item->GetSlot(); uint32 playerBag = item->GetBagSlot(); - ostringstream out; + std::ostringstream out; Guild* guild = sGuildMgr.GetGuildById(bot->GetGuildId()); //guild->SwapItems(bot, 0, playerSlot, 0, INVENTORY_SLOT_BAG_0, 0); diff --git a/playerbot/strategy/actions/GuildBankAction.h b/playerbot/strategy/actions/GuildBankAction.h index 9462378a..cf2062de 100644 --- a/playerbot/strategy/actions/GuildBankAction.h +++ b/playerbot/strategy/actions/GuildBankAction.h @@ -10,7 +10,7 @@ namespace ai virtual bool Execute(Event& event) override; private: - bool Execute(string text, GameObject* bank, Player* requester); + bool Execute(std::string text, GameObject* bank, Player* requester); bool MoveFromCharToBank(Item* item, GameObject* bank, Player* requester); }; } diff --git a/playerbot/strategy/actions/GuildCreateActions.cpp b/playerbot/strategy/actions/GuildCreateActions.cpp index fc739087..8a78cac6 100644 --- a/playerbot/strategy/actions/GuildCreateActions.cpp +++ b/playerbot/strategy/actions/GuildCreateActions.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "GuildCreateActions.h" -#include "../../RandomPlayerbotFactory.h" +#include "playerbot/RandomPlayerbotFactory.h" #ifndef MANGOSBOT_ZERO #ifdef CMANGOS #include "Arena/ArenaTeam.h" @@ -13,21 +13,20 @@ #include "playerbot/ServerFacade.h" #include "playerbot/TravelMgr.h" -using namespace std; using namespace ai; bool BuyPetitionAction::Execute(Event& event) { - list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); + std::list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); bool vendored = false, result = false; - for (list::iterator i = vendors.begin(); i != vendors.end(); ++i) + for (std::list::iterator i = vendors.begin(); i != vendors.end(); ++i) { ObjectGuid vendorguid = *i; Creature* pCreature = bot->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_PETITIONER); if (!pCreature) continue; - string guildName = RandomPlayerbotFactory::CreateRandomGuildName(); + std::string guildName = RandomPlayerbotFactory::CreateRandomGuildName(); if (guildName.empty()) continue; @@ -113,7 +112,7 @@ bool BuyPetitionAction::canBuyPetition(Player* bot) bool PetitionOfferAction::Execute(Event& event) { uint32 petitionEntry = 5863; //GUILD_CHARTER - list petitions = AI_VALUE2(list, "inventory items", chat->formatQItem(5863)); + std::list petitions = AI_VALUE2(std::list, "inventory items", chat->formatQItem(5863)); if (petitions.empty()) return false; @@ -168,7 +167,7 @@ bool PetitionOfferNearbyAction::Execute(Event& event) { uint32 found = 0; - list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); + std::list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); for (auto& i : nearGuids) { Player* player = sObjectMgr.GetPlayer(i); @@ -198,7 +197,7 @@ bool PetitionOfferNearbyAction::Execute(Event& event) if (sPlayerbotAIConfig.inviteChat && sServerFacade.GetDistance2d(bot, player) < sPlayerbotAIConfig.spellDistance && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%name"] = player->GetName(); if(urand(0,3)) @@ -223,15 +222,15 @@ bool PetitionOfferNearbyAction::Execute(Event& event) bool PetitionTurnInAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); + std::list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); bool vendored = false, result = false; - list petitions = AI_VALUE2(list, "inventory items", chat->formatQItem(5863)); + std::list petitions = AI_VALUE2(std::list, "inventory items", chat->formatQItem(5863)); if (petitions.empty()) return false; - for (list::iterator i = vendors.begin(); i != vendors.end(); ++i) + for (std::list::iterator i = vendors.begin(); i != vendors.end(); ++i) { ObjectGuid vendorguid = *i; Creature* pCreature = bot->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_PETITIONER); diff --git a/playerbot/strategy/actions/GuildCreateActions.h b/playerbot/strategy/actions/GuildCreateActions.h index 63cd6131..61f240c3 100644 --- a/playerbot/strategy/actions/GuildCreateActions.h +++ b/playerbot/strategy/actions/GuildCreateActions.h @@ -19,7 +19,7 @@ namespace ai class PetitionOfferAction : public Action { public: - PetitionOfferAction(PlayerbotAI* ai, string name = "petition offer") : Action(ai, name) {} + PetitionOfferAction(PlayerbotAI* ai, std::string name = "petition offer") : Action(ai, name) {} virtual bool Execute(Event& event); virtual bool isUseful() { return sPlayerbotAIConfig.randomBotFormGuild && !bot->GetGuildId(); }; }; diff --git a/playerbot/strategy/actions/GuildManagementActions.cpp b/playerbot/strategy/actions/GuildManagementActions.cpp index dd94a3ad..298eadd6 100644 --- a/playerbot/strategy/actions/GuildManagementActions.cpp +++ b/playerbot/strategy/actions/GuildManagementActions.cpp @@ -3,7 +3,6 @@ #include "GuildManagementActions.h" #include "playerbot/ServerFacade.h" -using namespace std; using namespace ai; Player* GuidManageAction::GetPlayer(Event event) @@ -19,7 +18,7 @@ Player* GuidManageAction::GetPlayer(Event event) return player; } - string text = event.getParam(); + std::string text = event.getParam(); if (!text.empty()) { @@ -72,7 +71,7 @@ bool GuildManageNearbyAction::Execute(Event& event) Guild* guild = sGuildMgr.GetGuildById(bot->GetGuildId()); MemberSlot* botMember = guild->GetMemberSlot(bot->GetObjectGuid()); - list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); + std::list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); for (auto& guid : nearGuids) { Player* player = sObjectMgr.GetPlayer(guid); @@ -93,7 +92,7 @@ bool GuildManageNearbyAction::Execute(Event& event) { if (sPlayerbotAIConfig.guildFeedbackRate && frand(0, 100) <= sPlayerbotAIConfig.guildFeedbackRate && bot->GetGuildId() && !urand(0, 10) && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%name"] = player->GetName(); guild->BroadcastToGuild(bot->GetSession(), BOT_TEXT2("Good job %name. You deserver this.", placeholders), LANG_UNIVERSAL); @@ -107,7 +106,7 @@ bool GuildManageNearbyAction::Execute(Event& event) { if (sPlayerbotAIConfig.guildFeedbackRate && frand(0, 100) <= sPlayerbotAIConfig.guildFeedbackRate && bot->GetGuildId() && !urand(0, 10) && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%name"] = player->GetName(); guild->BroadcastToGuild(bot->GetSession(), BOT_TEXT2("That was awefull %name. I hate to do this but...", placeholders), LANG_UNIVERSAL); @@ -153,13 +152,13 @@ bool GuildManageNearbyAction::Execute(Event& event) if (sPlayerbotAIConfig.inviteChat && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%name"] = player->GetName(); placeholders["%members"] = guild->GetMemberSize(); placeholders["%guildname"] = guild->GetName(); placeholders["%place"] = WorldPosition(player).getAreaName(false, false); - vector lines; + std::vector lines; switch ((urand(0, 10)* urand(0, 10))/10) { @@ -256,7 +255,7 @@ bool GuildLeaveAction::Execute(Event& event) guild->BroadcastToGuild(bot->GetSession(), "I am leaving this guild to prevent it from reaching the 1064 member limit.", LANG_UNIVERSAL); } - sPlayerbotAIConfig.logEvent(ai, "GuildLeaveAction", guild->GetName(), to_string(guild->GetMemberSize())); + sPlayerbotAIConfig.logEvent(ai, "GuildLeaveAction", guild->GetName(), std::to_string(guild->GetMemberSize())); WorldPacket packet; bot->GetSession()->HandleGuildLeaveOpcode(packet); diff --git a/playerbot/strategy/actions/GuildManagementActions.h b/playerbot/strategy/actions/GuildManagementActions.h index 7245e278..0592c79a 100644 --- a/playerbot/strategy/actions/GuildManagementActions.h +++ b/playerbot/strategy/actions/GuildManagementActions.h @@ -6,7 +6,7 @@ namespace ai class GuidManageAction : public ChatCommandAction { public: - GuidManageAction(PlayerbotAI* ai, string name = "guild manage", uint16 opcode = CMSG_GUILD_INVITE) : ChatCommandAction(ai, name), opcode(opcode) {} + GuidManageAction(PlayerbotAI* ai, std::string name = "guild manage", uint16 opcode = CMSG_GUILD_INVITE) : ChatCommandAction(ai, name), opcode(opcode) {} virtual bool Execute(Event& event) override; virtual bool isUseful() override { return false; } @@ -25,7 +25,7 @@ namespace ai class GuildInviteAction : public GuidManageAction { public: - GuildInviteAction(PlayerbotAI* ai, string name = "guild invite", uint16 opcode = CMSG_GUILD_INVITE) : GuidManageAction(ai, name, opcode) {} + GuildInviteAction(PlayerbotAI* ai, std::string name = "guild invite", uint16 opcode = CMSG_GUILD_INVITE) : GuidManageAction(ai, name, opcode) {} virtual bool isUseful() override { return bot->GetGuildId() && sGuildMgr.GetGuildById(bot->GetGuildId())->HasRankRight(bot->GetRank(), GR_RIGHT_INVITE) && !GuildIsFull(bot->GetGuildId()); } protected: @@ -36,7 +36,7 @@ namespace ai class GuildJoinAction : public GuidManageAction { public: - GuildJoinAction(PlayerbotAI* ai, string name = "guild join", uint16 opcode = CMSG_GUILD_INVITE) : GuidManageAction(ai, name, opcode) {} + GuildJoinAction(PlayerbotAI* ai, std::string name = "guild join", uint16 opcode = CMSG_GUILD_INVITE) : GuidManageAction(ai, name, opcode) {} virtual bool isUseful() override { return !bot->GetGuildId(); } protected: @@ -48,7 +48,7 @@ namespace ai class GuildPromoteAction : public GuidManageAction { public: - GuildPromoteAction(PlayerbotAI* ai, string name = "guild promote", uint16 opcode = CMSG_GUILD_PROMOTE) : GuidManageAction(ai, name, opcode) {} + GuildPromoteAction(PlayerbotAI* ai, std::string name = "guild promote", uint16 opcode = CMSG_GUILD_PROMOTE) : GuidManageAction(ai, name, opcode) {} virtual bool isUseful() override { return bot->GetGuildId() && sGuildMgr.GetGuildById(bot->GetGuildId())->HasRankRight(bot->GetRank(), GR_RIGHT_PROMOTE); } protected: @@ -59,7 +59,7 @@ namespace ai class GuildDemoteAction : public GuidManageAction { public: - GuildDemoteAction(PlayerbotAI* ai, string name = "guild demote", uint16 opcode = CMSG_GUILD_DEMOTE) : GuidManageAction(ai, name, opcode) {} + GuildDemoteAction(PlayerbotAI* ai, std::string name = "guild demote", uint16 opcode = CMSG_GUILD_DEMOTE) : GuidManageAction(ai, name, opcode) {} virtual bool isUseful() override { return bot->GetGuildId() && sGuildMgr.GetGuildById(bot->GetGuildId())->HasRankRight(bot->GetRank(), GR_RIGHT_DEMOTE); } protected: @@ -70,7 +70,7 @@ namespace ai class GuildLeaderAction : public GuidManageAction { public: - GuildLeaderAction(PlayerbotAI* ai, string name = "guild leader", uint16 opcode = CMSG_GUILD_LEADER) : GuidManageAction(ai, name, opcode) {} + GuildLeaderAction(PlayerbotAI* ai, std::string name = "guild leader", uint16 opcode = CMSG_GUILD_LEADER) : GuidManageAction(ai, name, opcode) {} virtual bool isUseful() override { return bot->GetGuildId() && sGuildMgr.GetGuildById(bot->GetGuildId())->GetLeaderGuid() == bot->GetObjectGuid(); } protected: @@ -81,7 +81,7 @@ namespace ai class GuildRemoveAction : public GuidManageAction { public: - GuildRemoveAction(PlayerbotAI* ai, string name = "guild remove", uint16 opcode = CMSG_GUILD_REMOVE) : GuidManageAction(ai, name, opcode) {} + GuildRemoveAction(PlayerbotAI* ai, std::string name = "guild remove", uint16 opcode = CMSG_GUILD_REMOVE) : GuidManageAction(ai, name, opcode) {} virtual bool isUseful() override { return bot->GetGuildId() && sGuildMgr.GetGuildById(bot->GetGuildId())->HasRankRight(bot->GetRank(), GR_RIGHT_REMOVE); } protected: diff --git a/playerbot/strategy/actions/HelpAction.cpp b/playerbot/strategy/actions/HelpAction.cpp index 21f47f09..76a6f33c 100644 --- a/playerbot/strategy/actions/HelpAction.cpp +++ b/playerbot/strategy/actions/HelpAction.cpp @@ -19,14 +19,14 @@ HelpAction::~HelpAction() bool HelpAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string param = event.getParam(); - string helpTopic; + std::string param = event.getParam(); + std::string helpTopic; - if(param.find("Hvalue:help") != string::npos) + if(param.find("Hvalue:help") != std::string::npos) { helpTopic = ChatHelper::parseValue("help",param); } - else if (param.find("[h:") != string::npos) + else if (param.find("[h:") != std::string::npos) { helpTopic = param.substr(3,param.size()-4); } @@ -36,12 +36,12 @@ bool HelpAction::Execute(Event& event) helpTopic = "help:main"; } - ostringstream out; - string helpTekst = sPlayerbotHelpMgr.GetBotText(helpTopic); + std::ostringstream out; + std::string helpTekst = sPlayerbotHelpMgr.GetBotText(helpTopic); if (helpTopic.empty() && !param.empty()) { - vector list = sPlayerbotHelpMgr.FindBotText(param); + std::vector list = sPlayerbotHelpMgr.FindBotText(param); if(list.size() == 1) helpTekst = sPlayerbotHelpMgr.GetBotText(list.front()); @@ -50,7 +50,7 @@ bool HelpAction::Execute(Event& event) std::sort(list.begin(), list.end()); helpTekst = sPlayerbotHelpMgr.GetBotText("help:search"); - string topics = sPlayerbotHelpMgr.makeList(list, "[h:|]"); + std::string topics = sPlayerbotHelpMgr.makeList(list, "[h:|]"); if (!helpTekst.empty()) sPlayerbotHelpMgr.replace(helpTekst, "", topics); @@ -63,7 +63,7 @@ bool HelpAction::Execute(Event& event) if (!helpTekst.empty()) { - vector lines = Qualified::getMultiQualifiers(helpTekst, "\n"); + std::vector lines = Qualified::getMultiQualifiers(helpTekst, "\n"); for (auto& line : lines) { @@ -81,7 +81,7 @@ bool HelpAction::Execute(Event& event) void HelpAction::TellChatCommands(Player* requester) { - ostringstream out; + std::ostringstream out; out << "Whisper any of: "; out << CombineSupported(chatContext->supports()); out << ", [item], [quest] or [object] link"; @@ -90,17 +90,17 @@ void HelpAction::TellChatCommands(Player* requester) void HelpAction::TellStrategies(Player* requester) { - ostringstream out; + std::ostringstream out; out << "Possible strategies (co/nc/dead commands): "; out << CombineSupported(ai->GetAiObjectContext()->GetSupportedStrategies()); ai->TellPlayer(requester, out.str()); } -string HelpAction::CombineSupported(set commands) +std::string HelpAction::CombineSupported(std::set commands) { - ostringstream out; + std::ostringstream out; - for (set::iterator i = commands.begin(); i != commands.end(); ) + for (std::set::iterator i = commands.begin(); i != commands.end(); ) { out << *i; if (++i != commands.end()) diff --git a/playerbot/strategy/actions/HelpAction.h b/playerbot/strategy/actions/HelpAction.h index 11433a9f..8416ddb3 100644 --- a/playerbot/strategy/actions/HelpAction.h +++ b/playerbot/strategy/actions/HelpAction.h @@ -13,11 +13,11 @@ namespace ai private: void TellChatCommands(Player* requester); void TellStrategies(Player* requester); - string CombineSupported(set commands); + std::string CombineSupported(std::set commands); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "help"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "help"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This chat command will make the bot give you help on various topics.\n" "Each help topic will provide various chat-links which can be linked in chat.\n" @@ -25,8 +25,8 @@ namespace ai "It is possible to search for help topics by adding part of the topic name after the command.\n" "Example commands: 'help' and 'help rpg'."; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return {}; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return {}; } #endif private: NamedObjectContext* chatContext; diff --git a/playerbot/strategy/actions/HireAction.cpp b/playerbot/strategy/actions/HireAction.cpp index 5e0539e4..dab59948 100644 --- a/playerbot/strategy/actions/HireAction.cpp +++ b/playerbot/strategy/actions/HireAction.cpp @@ -40,7 +40,7 @@ bool HireAction::Execute(Event& event) uint32 moneyReq = m * 5000 * bot->GetLevel(); if ((int)discount < (int)moneyReq) { - ostringstream out; + std::ostringstream out; out << "You cannot hire me - I barely know you. Make sure you have at least " << chat->formatMoney(moneyReq) << " as a trade discount"; ai->TellPlayer(requester, out.str()); return false; diff --git a/playerbot/strategy/actions/InventoryChangeFailureAction.cpp b/playerbot/strategy/actions/InventoryChangeFailureAction.cpp index 719a6304..f70638ff 100644 --- a/playerbot/strategy/actions/InventoryChangeFailureAction.cpp +++ b/playerbot/strategy/actions/InventoryChangeFailureAction.cpp @@ -5,7 +5,7 @@ using namespace ai; -map InventoryChangeFailureAction::messages; +std::map InventoryChangeFailureAction::messages; bool InventoryChangeFailureAction::Execute(Event& event) { @@ -89,7 +89,7 @@ bool InventoryChangeFailureAction::Execute(Event& event) if (err == EQUIP_ERR_OK) return false; - string msg = messages[(InventoryResult)err]; + std::string msg = messages[(InventoryResult)err]; if (!msg.empty()) { ai->TellError(requester, msg); diff --git a/playerbot/strategy/actions/InventoryChangeFailureAction.h b/playerbot/strategy/actions/InventoryChangeFailureAction.h index 68fa15a3..876dba38 100644 --- a/playerbot/strategy/actions/InventoryChangeFailureAction.h +++ b/playerbot/strategy/actions/InventoryChangeFailureAction.h @@ -10,6 +10,6 @@ namespace ai virtual bool Execute(Event& event); private: - static map messages; + static std::map messages; }; } \ No newline at end of file diff --git a/playerbot/strategy/actions/InviteToGroupAction.cpp b/playerbot/strategy/actions/InviteToGroupAction.cpp index 63766f60..0e2a76cc 100644 --- a/playerbot/strategy/actions/InviteToGroupAction.cpp +++ b/playerbot/strategy/actions/InviteToGroupAction.cpp @@ -84,7 +84,7 @@ namespace ai if (requester->GetLevel() > bot->GetLevel() + 4 || bot->GetLevel() > requester->GetLevel() + 4) return false; - string param = event.getParam(); + std::string param = event.getParam(); if (!param.empty() && param != "40" && param != "25" && param != "20" && param != "10" && param != "5") { @@ -94,8 +94,8 @@ namespace ai Group* group = requester->GetGroup(); - unordered_map> allowedClassNr; - unordered_map allowedRoles; + std::unordered_map> allowedClassNr; + std::unordered_map allowedRoles; allowedRoles[BOT_ROLE_TANK] = 1; allowedRoles[BOT_ROLE_HEALER] = 1; @@ -220,9 +220,9 @@ namespace ai if (!ai->DoSpecificAction("accept invitation", event, true)) return false; - map placeholders; + std::map placeholders; placeholders["%role"] = (role == BOT_ROLE_TANK ? "tank" : (role == BOT_ROLE_HEALER ? "healer" : "dps")); - placeholders["%spotsleft"] = to_string(allowedRoles[role] - 1); + placeholders["%spotsleft"] = std::to_string(allowedRoles[role] - 1); if(allowedRoles[role] > 1) ai->TellPlayer(requester, BOT_TEXT2("Joining as %role, %spotsleft %role spots left.", placeholders)); @@ -239,13 +239,13 @@ namespace ai { if (!bot->GetGroup()) //Select a random formation to copy. { - vector formations = { "melee","queue","chaos","circle","line","shield","arrow","near","far"}; + std::vector formations = { "melee","queue","chaos","circle","line","shield","arrow","near","far"}; FormationValue* value = (FormationValue*)context->GetValue("formation"); - string newFormation = formations[urand(0, formations.size() - 1)]; + std::string newFormation = formations[urand(0, formations.size() - 1)]; value->Load(newFormation); } - list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); + std::list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); for (auto& i : nearGuids) { Player* player = sObjectMgr.GetPlayer(i); @@ -296,7 +296,7 @@ namespace ai if (sPlayerbotAIConfig.inviteChat && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%player"] = player->GetName(); if(group && group->IsRaidGroup()) @@ -349,7 +349,7 @@ namespace ai return true; } - vector InviteGuildToGroupAction::getGuildMembers() + std::vector InviteGuildToGroupAction::getGuildMembers() { Guild* guild = sGuildMgr.GetGuildById(bot->GetGuildId()); @@ -423,7 +423,7 @@ namespace ai if (sPlayerbotAIConfig.inviteChat && sRandomPlayerbotMgr.IsFreeBot(bot)) { - map placeholders; + std::map placeholders; placeholders["%name"] = player->GetName(); placeholders["%place"] = WorldPosition(player).getAreaName(false, false); diff --git a/playerbot/strategy/actions/InviteToGroupAction.h b/playerbot/strategy/actions/InviteToGroupAction.h index 84738682..87008bf0 100644 --- a/playerbot/strategy/actions/InviteToGroupAction.h +++ b/playerbot/strategy/actions/InviteToGroupAction.h @@ -6,7 +6,7 @@ namespace ai class InviteToGroupAction : public ChatCommandAction { public: - InviteToGroupAction(PlayerbotAI* ai, string name = "invite") : ChatCommandAction(ai, name) {} + InviteToGroupAction(PlayerbotAI* ai, std::string name = "invite") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override { @@ -20,21 +20,21 @@ namespace ai class JoinGroupAction : public InviteToGroupAction { public: - JoinGroupAction(PlayerbotAI* ai, string name = "join") : InviteToGroupAction(ai, name) {} + JoinGroupAction(PlayerbotAI* ai, std::string name = "join") : InviteToGroupAction(ai, name) {} virtual bool Execute(Event& event) override; }; class LfgAction : public InviteToGroupAction { public: - LfgAction(PlayerbotAI* ai, string name = "lfg") : InviteToGroupAction(ai, name) {} + LfgAction(PlayerbotAI* ai, std::string name = "lfg") : InviteToGroupAction(ai, name) {} virtual bool Execute(Event& event) override; }; class InviteNearbyToGroupAction : public InviteToGroupAction { public: - InviteNearbyToGroupAction(PlayerbotAI* ai, string name = "invite nearby") : InviteToGroupAction(ai, name) {} + InviteNearbyToGroupAction(PlayerbotAI* ai, std::string name = "invite nearby") : InviteToGroupAction(ai, name) {} virtual bool Execute(Event& event) override; virtual bool isUseful(); }; @@ -46,19 +46,19 @@ namespace ai FindGuildMembers() {}; void operator()(Player* player) { data.push_back(player); }; - vector const GetResult() { return data; }; + std::vector const GetResult() { return data; }; private: - vector data; + std::vector data; }; class InviteGuildToGroupAction : public InviteNearbyToGroupAction { public: - InviteGuildToGroupAction(PlayerbotAI* ai, string name = "invite guild") : InviteNearbyToGroupAction(ai, name) {} + InviteGuildToGroupAction(PlayerbotAI* ai, std::string name = "invite guild") : InviteNearbyToGroupAction(ai, name) {} virtual bool Execute(Event& event) override; virtual bool isUseful() { return bot->GetGuildId() && InviteNearbyToGroupAction::isUseful(); }; private: - vector getGuildMembers(); + std::vector getGuildMembers(); }; } diff --git a/playerbot/strategy/actions/KeepItemAction.cpp b/playerbot/strategy/actions/KeepItemAction.cpp index 74b1a0dd..b0ea3450 100644 --- a/playerbot/strategy/actions/KeepItemAction.cpp +++ b/playerbot/strategy/actions/KeepItemAction.cpp @@ -10,20 +10,20 @@ using namespace ai; bool KeepItemAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); - string type = text.substr(0, text.find(" ")); + std::string type = text.substr(0, text.find(" ")); if (text.empty()) //No param = help feedback { - ostringstream out; + std::ostringstream out; out << "Please specify the items that should be kept. See " << ChatHelper::formatValue("help", "action:keep", "keep help") << " for more information."; ai->TellPlayer(requester, out.str()); return false; } - else if (string("none,keep,equip,greed,need,?,").find(type + ",") == string::npos) //Non type = using keep. + else if (std::string("none,keep,equip,greed,need,?,").find(type + ",") == std::string::npos) //Non type = using keep. type = "keep"; - else if(text.find(" ") != string::npos) //Remove type from param. + else if(text.find(" ") != std::string::npos) //Remove type from param. text = text.substr(text.find(" ") + 1); ItemIds ids = chat->parseItems(text); @@ -33,7 +33,7 @@ bool KeepItemAction::Execute(Event& event) IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BANK); - list found = ai->InventoryParseItems(text, mask); + std::list found = ai->InventoryParseItems(text, mask); for (auto& item : found) ids.insert(item->GetProto()->ItemId); @@ -41,7 +41,7 @@ bool KeepItemAction::Execute(Event& event) if (ids.empty()) { - ostringstream out; + std::ostringstream out; if (type == "keep") out << "Please specify the items that should be kept. See " << ChatHelper::formatValue("help", "action:keep", "keep help") << " for more information."; @@ -56,7 +56,7 @@ bool KeepItemAction::Execute(Event& event) { for (auto& id : ids) { - ostringstream out; + std::ostringstream out; ItemQualifier qualifier(id); out << chat->formatItem(qualifier); out << ": " << keepName[AI_VALUE2_EXISTS(ForceItemUsage, "force item usage", id, ForceItemUsage::FORCE_USAGE_NONE)] << " the item."; @@ -87,7 +87,7 @@ bool KeepItemAction::Execute(Event& event) } } - ostringstream out; + std::ostringstream out; out << changed; out << " items changed to: " << keepName[usage] << " the item."; ai->TellPlayer(requester, out.str()); diff --git a/playerbot/strategy/actions/KeepItemAction.h b/playerbot/strategy/actions/KeepItemAction.h index 1b3996ec..330c5732 100644 --- a/playerbot/strategy/actions/KeepItemAction.h +++ b/playerbot/strategy/actions/KeepItemAction.h @@ -7,10 +7,10 @@ namespace ai class KeepItemAction : public ChatCommandAction { public: - KeepItemAction(PlayerbotAI* ai, string name = "keep") : ChatCommandAction(ai, name) {} + KeepItemAction(PlayerbotAI* ai, std::string name = "keep") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; - unordered_map keepName = + std::unordered_map keepName = { {ForceItemUsage::FORCE_USAGE_NONE, "do not keep"}, {ForceItemUsage::FORCE_USAGE_KEEP, "keep"}, @@ -20,8 +20,8 @@ namespace ai }; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "keep"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "keep"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will force bots to keep an item in their inventory.\n" "The command has an optional parameter to specify what the bot should do with the items\n" @@ -37,8 +37,8 @@ namespace ai "greed: the bot will try to get more of this item and roll greed.\n" "need: the bot will try to get more of this item and roll need.\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "force item usage" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "force item usage" }; } #endif }; } diff --git a/playerbot/strategy/actions/LeaveGroupAction.cpp b/playerbot/strategy/actions/LeaveGroupAction.cpp index ddcf5cea..aa79abd4 100644 --- a/playerbot/strategy/actions/LeaveGroupAction.cpp +++ b/playerbot/strategy/actions/LeaveGroupAction.cpp @@ -25,10 +25,10 @@ namespace ai if (!shouldStay) { if (group) - sPlayerbotAIConfig.logEvent(ai, "LeaveGroupAction", group->GetLeaderName(), to_string(group->GetMembersCount()-1)); + sPlayerbotAIConfig.logEvent(ai, "LeaveGroupAction", group->GetLeaderName(), std::to_string(group->GetMembersCount()-1)); WorldPacket p; - string member = bot->GetName(); + std::string member = bot->GetName(); p << uint32(PARTY_OP_LEAVE) << member << uint32(0); bot->GetSession()->HandleGroupDisbandOpcode(p); if (ai->HasRealPlayerMaster() && ai->GetMaster()->GetObjectGuid() != player->GetObjectGuid()) diff --git a/playerbot/strategy/actions/LeaveGroupAction.h b/playerbot/strategy/actions/LeaveGroupAction.h index 55dc2952..76866ba3 100644 --- a/playerbot/strategy/actions/LeaveGroupAction.h +++ b/playerbot/strategy/actions/LeaveGroupAction.h @@ -7,7 +7,7 @@ namespace ai class LeaveGroupAction : public ChatCommandAction { public: - LeaveGroupAction(PlayerbotAI* ai, string name = "leave") : ChatCommandAction(ai, name) {} + LeaveGroupAction(PlayerbotAI* ai, std::string name = "leave") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override { @@ -31,7 +31,7 @@ namespace ai WorldPacket& p = event.getPacket(); p.rpos(0); uint32 operation; - string member; + std::string member; p >> operation >> member; diff --git a/playerbot/strategy/actions/LfgActions.cpp b/playerbot/strategy/actions/LfgActions.cpp index 2d269a24..2230c435 100644 --- a/playerbot/strategy/actions/LfgActions.cpp +++ b/playerbot/strategy/actions/LfgActions.cpp @@ -98,12 +98,12 @@ bool LfgJoinAction::JoinLFG() if (!stones.size()) return false; - vector dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; + std::vector dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; if (!dungeons.size()) return false; - vector selected; - for (vector::iterator i = dungeons.begin(); i != dungeons.end(); ++i) + std::vector selected; + for (std::vector::iterator i = dungeons.begin(); i != dungeons.end(); ++i) { uint32 zoneId = 0; uint32 dungeonId = (*i & 0xFFFF); @@ -148,7 +148,7 @@ bool LfgJoinAction::JoinLFG() uint32 dungeon = urand(0, selected.size() - 1); MeetingStoneInfo stoneInfo = selected[dungeon]; BotRoles botRoles = AiFactory::GetPlayerRoles(bot); - string _botRoles; + std::string _botRoles; switch (botRoles) { case BOT_ROLE_TANK: @@ -183,9 +183,9 @@ bool LfgJoinAction::JoinLFG() uint32 zoneLFG = 0; uint32 questLFG = 0; uint32 questZoneLFG = 0; - string questName; - string zoneName; - string lfgName; + std::string questName; + std::string zoneName; + std::string lfgName; uint32 needMembers = 0; LfgType lfgType = LFG_TYPE_NONE; TravelState state = TravelState::TRAVEL_STATE_IDLE; @@ -343,7 +343,7 @@ bool LfgJoinAction::JoinLFG() // lfm for random dungeon if nothing else to do else if (status >= TravelStatus::TRAVEL_STATUS_COOLDOWN || state >= TravelState::TRAVEL_STATE_TRAVEL_HAND_IN_QUEST || (state == TravelState::TRAVEL_STATE_IDLE && !urand(0, 4))) { - vector dungeons; + std::vector dungeons; for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i)) @@ -431,10 +431,10 @@ bool LfgJoinAction::JoinLFG() bot->GetSession()->HandleLfmSetAutoFillOpcode(p); // set auto invite if real player in queue - vector player_dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; + std::vector player_dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; if (!player_dungeons.empty()) { - for (vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) + for (std::vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) { uint32 zoneId = 0; uint32 entry = (*i & 0xFFFF); @@ -492,10 +492,10 @@ bool LfgJoinAction::JoinLFG() } // set auto invite if real player in queue - vector player_dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; + std::vector player_dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; if (!player_dungeons.empty() && !group) { - for (vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) + for (std::vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) { uint32 zoneId = 0; uint32 entry = (*i & 0xFFFF) & 0xFF; @@ -614,10 +614,10 @@ bool LfgJoinAction::JoinLFG() } } // lfg for dungeon if real player used LFM with auto invite - vector player_dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; + std::vector player_dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; if (!player_dungeons.empty()) { - for (vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) + for (std::vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) { uint32 zoneId = 0; uint32 entry = (*i & 0xFFFF) & 0xFF; @@ -688,7 +688,7 @@ bool LfgJoinAction::JoinLFG() // lfg slot 3 for random dungeon if not very busy else if (status >= TravelStatus::TRAVEL_STATUS_COOLDOWN || state >= TravelState::TRAVEL_STATE_TRAVEL_HAND_IN_QUEST || (state == TravelState::TRAVEL_STATE_IDLE && !urand(0, 4))) { - vector dungeons; + std::vector dungeons; for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i)) @@ -729,7 +729,7 @@ bool LfgJoinAction::JoinLFG() /*vector player_dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; if (!player_dungeons.empty()) { - for (vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) + for (std::vector::iterator i = player_dungeons.begin(); i != player_dungeons.end(); ++i) { uint32 zoneId = 0; uint32 entry = (*i & 0xFFFF) & 0xFF; @@ -762,7 +762,7 @@ bool LfgJoinAction::JoinLFG() // set comment BotRoles botRoles = AiFactory::GetPlayerRoles(bot); - string _botRoles; + std::string _botRoles; switch (botRoles) { case BOT_ROLE_TANK: @@ -781,13 +781,13 @@ bool LfgJoinAction::JoinLFG() _botRoles = "Tank or Dps"; WorldPacket p; - string lfgComment; + std::string lfgComment; if (isLFM) { if (!group) lfgComment += _botRoles + ", "; - lfgComment = "LF " + to_string(needMembers) + " more"; + lfgComment = "LF " + std::to_string(needMembers) + " more"; if (questLFG) lfgComment += ", doing " + questName; } @@ -801,14 +801,14 @@ bool LfgJoinAction::JoinLFG() } if (lfgType == LFG_TYPE_DUNGEON) { - string _gs = to_string(bot->GetPlayerbotAI()->GetEquipGearScore(bot, false, false)); + std::string _gs = std::to_string(bot->GetPlayerbotAI()->GetEquipGearScore(bot, false, false)); lfgComment += ", GS " + _gs; } p << lfgComment;// +", GS - " + _gs; bot->GetSession()->HandleSetLfgCommentOpcode(p); - string lfgGroup = isLFG ? "LFG" : "LFM"; - string lfgOption = lfgType == LFG_TYPE_QUEST ? "Quest" : (lfgType == LFG_TYPE_ZONE ? "Zone" : "Dungeon"); + std::string lfgGroup = isLFG ? "LFG" : "LFM"; + std::string lfgOption = lfgType == LFG_TYPE_QUEST ? "Quest" : (lfgType == LFG_TYPE_ZONE ? "Zone" : "Dungeon"); if (realLFG) sLog.outBasic("Bot #%d %s:%d <%s>: uses %s, %s - %s (%s)", bot->GetGUIDLow(), bot->GetTeam() == ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), lfgGroup.c_str(), lfgOption.c_str(), lfgName.c_str(), _botRoles.c_str()); @@ -829,13 +829,13 @@ bool LfgJoinAction::JoinLFG() bool raid = !heroic && (urand(0, 100) < 50 && visitor.count[ITEM_QUALITY_EPIC] >= 5 && (bot->GetLevel() == 60 || bot->GetLevel() == 70 || bot->GetLevel() == 80));*/ LfgDungeonSet list; - vector selected; + std::vector selected; - vector dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; + std::vector dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeam()]; if (!dungeons.size()) return false; - for (vector::iterator i = dungeons.begin(); i != dungeons.end(); ++i) + for (std::vector::iterator i = dungeons.begin(); i != dungeons.end(); ++i) { LFGDungeonData const* dungeon = sLFGMgr.GetLFGDungeon(*i); if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM_DUNGEON && dungeon->type != LFG_TYPE_DUNGEON && dungeon->type != LFG_TYPE_HEROIC_DUNGEON && @@ -855,7 +855,7 @@ bool LfgJoinAction::JoinLFG() if (!selected.size()) return false; - if (list.empty()) + if (std::list.empty()) return false; bool many = list.size() > 1; @@ -891,11 +891,11 @@ bool LfgJoinAction::JoinLFG() list.insert(dungeon); } - if (list.empty() && !random) + if (std::list.empty() && !random) return false;*/ // check role for console msg - string _roles = "multiple roles"; + std::string _roles = "multiple roles"; if ((pState.GetPlayerRoles() & PLAYER_ROLE_TANK) != 0) _roles = "TANK"; @@ -964,8 +964,8 @@ bool LfgJoinAction::JoinLFG() }*/ // Set Raid Browser comment - string _gs = to_string(bot->GetEquipGearScore()); - string comment = "Bot " + _roles + " GS:" + _gs + " for LFG"; + std::string _gs = std::to_string(bot->GetEquipGearScore()); + std::string comment = "Bot " + _roles + " GS:" + _gs + " for LFG"; sLFGMgr.JoinLfg(bot, GetRoles(), list, comment); #endif return true; @@ -1093,7 +1093,7 @@ bool LfgLeaveAction::Execute(Event& event) bot->GetSession()->HandleLfmClearOpcode(p); // clear comment - string empty; + std::string empty; p << empty; bot->GetSession()->HandleSetLfgCommentOpcode(p); } diff --git a/playerbot/strategy/actions/LfgActions.h b/playerbot/strategy/actions/LfgActions.h index 0680a804..d212f949 100644 --- a/playerbot/strategy/actions/LfgActions.h +++ b/playerbot/strategy/actions/LfgActions.h @@ -25,7 +25,7 @@ namespace ai class LfgJoinAction : public Action { public: - LfgJoinAction(PlayerbotAI* ai, string name = "lfg join") : Action(ai, name) {} + LfgJoinAction(PlayerbotAI* ai, std::string name = "lfg join") : Action(ai, name) {} virtual bool Execute(Event& event) override; virtual bool isUseful(); diff --git a/playerbot/strategy/actions/ListQuestsActions.cpp b/playerbot/strategy/actions/ListQuestsActions.cpp index 68cd7b1f..8956d799 100644 --- a/playerbot/strategy/actions/ListQuestsActions.cpp +++ b/playerbot/strategy/actions/ListQuestsActions.cpp @@ -89,7 +89,7 @@ int ListQuestsAction::ListQuests(Player* requester, bool completed, bool silent, if (QuestDestination->GetQuestTemplate()->GetQuestId() == questId) { - ostringstream out; + std::ostringstream out; out << "[Active] traveling " << target->getPosition()->distance(botPos); @@ -102,8 +102,8 @@ int ListQuestsAction::ListQuests(Player* requester, bool completed, bool silent, if (travelDetail == QUEST_TRAVEL_DETAIL_SUMMARY) { - vector allDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, true, -1); - vector availDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, ai->GetMaster(), false, -1); + std::vector allDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, true, -1); + std::vector availDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, ai->GetMaster(), false, -1); uint32 desTot = allDestinations.size(); uint32 desAvail = availDestinations.size(); @@ -119,7 +119,7 @@ int ListQuestsAction::ListQuests(Player* requester, bool completed, bool silent, for (auto dest : availDestinations) apoints += dest->getPoints().size(); - ostringstream out; + std::ostringstream out; out << desAvail << "/" << desTot << " destinations " << apoints << "/" << tpoints << " points. "; if (desFull > 0) @@ -132,7 +132,7 @@ int ListQuestsAction::ListQuests(Player* requester, bool completed, bool silent, else if (travelDetail == QUEST_TRAVEL_DETAIL_FULL) { uint32 limit = 0; - vector allDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, true, -1); + std::vector allDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, true, -1); std::sort(allDestinations.begin(), allDestinations.end(), [botPos](TravelDestination* i, TravelDestination* j) {return i->distanceTo(botPos) < j->distanceTo(botPos); }); @@ -141,7 +141,7 @@ int ListQuestsAction::ListQuests(Player* requester, bool completed, bool silent, if (limit > 5) continue; - ostringstream out; + std::ostringstream out; uint32 tpoints = dest->getPoints(true).size(); uint32 apoints = dest->getPoints().size(); diff --git a/playerbot/strategy/actions/ListSpellsAction.cpp b/playerbot/strategy/actions/ListSpellsAction.cpp index ceb01c9f..a12d21b0 100644 --- a/playerbot/strategy/actions/ListSpellsAction.cpp +++ b/playerbot/strategy/actions/ListSpellsAction.cpp @@ -6,10 +6,10 @@ using namespace ai; -map ListSpellsAction::skillSpells; -set ListSpellsAction::vendorItems; +std::map ListSpellsAction::skillSpells; +std::set ListSpellsAction::vendorItems; -bool CompareSpells(pair& s1, pair& s2) +bool CompareSpells(std::pair& s1, std::pair& s2) { const SpellEntry* const si1 = sServerFacade.LookupSpellInfo(s1.first); const SpellEntry* const si2 = sServerFacade.LookupSpellInfo(s2.first); @@ -53,7 +53,7 @@ bool CompareSpells(pair& s1, pair& s2) return p1 > p2; } -list > ListSpellsAction::GetSpellList(string filter) +std::list > ListSpellsAction::GetSpellList(std::string filter) { if (skillSpells.empty()) { @@ -83,7 +83,7 @@ list > ListSpellsAction::GetSpellList(string filter) uint32 skill = 0; - vector ss = split(filter, ' '); + std::vector ss = split(filter, ' '); if (!ss.empty()) { skill = chat->parseSkill(ss[0]); @@ -104,16 +104,16 @@ list > ListSpellsAction::GetSpellList(string filter) std::string alreadySeenList = ","; int minLevel = 0, maxLevel = 0; - if (filter.find("-") != string::npos) + if (filter.find("-") != std::string::npos) { - vector ff = split(filter, '-'); + std::vector ff = split(filter, '-'); minLevel = atoi(ff[0].c_str()); maxLevel = atoi(ff[1].c_str()); filter = ""; } bool craftableOnly = false; - if (filter.find("+") != string::npos) + if (filter.find("+") != std::string::npos) { craftableOnly = true; filter.erase(remove(filter.begin(), filter.end(), '+'), filter.end()); @@ -123,7 +123,7 @@ list > ListSpellsAction::GetSpellList(string filter) if (slot != EQUIPMENT_SLOT_END) filter = ""; - list > spells; + std::list > spells; for (PlayerSpellMap::iterator itr = bot->GetSpellMap().begin(); itr != bot->GetSpellMap().end(); ++itr) { const uint32 spellId = itr->first; @@ -138,7 +138,7 @@ list > ListSpellsAction::GetSpellList(string filter) if (skill != SKILL_NONE && (!skillLine || skillLine->skillId != skill)) continue; - string comp = pSpellInfo->SpellName[0]; + std::string comp = pSpellInfo->SpellName[0]; if (!(ignoreList.find(comp) == std::string::npos && alreadySeenList.find(comp) == std::string::npos)) continue; @@ -147,7 +147,7 @@ list > ListSpellsAction::GetSpellList(string filter) bool first = true; int craftCount = -1; - ostringstream materials; + std::ostringstream materials; for (uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x) { if (pSpellInfo->Reagent[x] <= 0) @@ -186,7 +186,7 @@ list > ListSpellsAction::GetSpellList(string filter) if (craftCount < 0) craftCount = 0; - ostringstream out; + std::ostringstream out; bool filtered = false; if (skillLine) { @@ -250,7 +250,7 @@ list > ListSpellsAction::GetSpellList(string filter) if (out.str().empty()) continue; - spells.push_back(pair(spellId, out.str())); + spells.push_back(std::pair(spellId, out.str())); alreadySeenList += pSpellInfo->SpellName[0]; alreadySeenList += ","; } @@ -264,20 +264,20 @@ bool ListSpellsAction::Execute(Event& event) if (!requester) return false; - string filter = event.getParam(); + std::string filter = event.getParam(); - list > spells = GetSpellList(filter); + std::list > spells = GetSpellList(filter); ai->TellPlayer(requester, "=== Spells ==="); spells.sort(CompareSpells); int count = 0; - for (list >::iterator i = spells.begin(); i != spells.end(); ++i) + for (std::list >::iterator i = spells.begin(); i != spells.end(); ++i) { ai->TellPlayerNoFacing(requester, i->second); if (++count >= 50) { - ostringstream msg; msg << (spells.size() - 50) << " more..."; + std::ostringstream msg; msg << (spells.size() - 50) << " more..."; ai->TellPlayerNoFacing(requester, msg.str()); break; } diff --git a/playerbot/strategy/actions/ListSpellsAction.h b/playerbot/strategy/actions/ListSpellsAction.h index e3902ad9..e9e32bd3 100644 --- a/playerbot/strategy/actions/ListSpellsAction.h +++ b/playerbot/strategy/actions/ListSpellsAction.h @@ -6,12 +6,12 @@ namespace ai class ListSpellsAction : public ChatCommandAction { public: - ListSpellsAction(PlayerbotAI* ai, string name = "spells") : ChatCommandAction(ai, name) {} + ListSpellsAction(PlayerbotAI* ai, std::string name = "spells") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; - virtual list > GetSpellList(string filter = ""); + virtual std::list > GetSpellList(std::string filter = ""); private: - static map skillSpells; - static set vendorItems; + static std::map skillSpells; + static std::set vendorItems; }; } diff --git a/playerbot/strategy/actions/LogLevelAction.cpp b/playerbot/strategy/actions/LogLevelAction.cpp index c2609cad..21a0a29d 100644 --- a/playerbot/strategy/actions/LogLevelAction.cpp +++ b/playerbot/strategy/actions/LogLevelAction.cpp @@ -6,11 +6,11 @@ using namespace ai; bool LogLevelAction::Execute(Event& event) { - string param = event.getParam(); + std::string param = event.getParam(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); Value *value = ai->GetAiObjectContext()->GetValue("log level"); - ostringstream out; + std::ostringstream out; if (param != "?") { value->Set(string2logLevel(param)); @@ -24,7 +24,7 @@ bool LogLevelAction::Execute(Event& event) return true; } -string LogLevelAction::logLevel2string(LogLevel level) +std::string LogLevelAction::logLevel2string(LogLevel level) { switch (level) { @@ -38,7 +38,7 @@ string LogLevelAction::logLevel2string(LogLevel level) return "debug"; } } -LogLevel LogLevelAction::string2logLevel(string level) +LogLevel LogLevelAction::string2logLevel(std::string level) { if (level == "debug") return LOG_LVL_DEBUG; diff --git a/playerbot/strategy/actions/LogLevelAction.h b/playerbot/strategy/actions/LogLevelAction.h index 46ca9b85..6ab9ba6d 100644 --- a/playerbot/strategy/actions/LogLevelAction.h +++ b/playerbot/strategy/actions/LogLevelAction.h @@ -10,7 +10,7 @@ namespace ai virtual bool Execute(Event& event) override; public: - static string logLevel2string(LogLevel level); - static LogLevel string2logLevel(string level); + static std::string logLevel2string(LogLevel level); + static LogLevel string2logLevel(std::string level); }; } \ No newline at end of file diff --git a/playerbot/strategy/actions/LootAction.cpp b/playerbot/strategy/actions/LootAction.cpp index acf37619..e7f663a3 100644 --- a/playerbot/strategy/actions/LootAction.cpp +++ b/playerbot/strategy/actions/LootAction.cpp @@ -320,7 +320,7 @@ bool StoreLootAction::Execute(Event& event) if (requester && (ai->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT) || (requester->GetMapId() != bot->GetMapId() || WorldPosition(requester).sqDistance2d(bot) > (sPlayerbotAIConfig.sightDistance * sPlayerbotAIConfig.sightDistance)))) { - map args; + std::map args; args["%item"] = chat->formatItem(itemQualifier); ai->TellPlayerNoFacing(requester, BOT_TEXT2("loot_command", args), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } @@ -331,7 +331,7 @@ bool StoreLootAction::Execute(Event& event) if (guild) { - map placeholders; + std::map placeholders; placeholders["%name"] = chat->formatItem(itemQualifier); if (urand(0, 3)) @@ -341,12 +341,12 @@ bool StoreLootAction::Execute(Event& event) } } - sPlayerbotAIConfig.logEvent(ai, "StoreLootAction", proto->Name1, to_string(proto->ItemId)); + sPlayerbotAIConfig.logEvent(ai, "StoreLootAction", proto->Name1, std::to_string(proto->ItemId)); } AI_VALUE(LootObjectStack*, "available loot")->Remove(guid); RESET_AI_VALUE(LootObject, "loot target"); - RESET_AI_VALUE2(bool, "should loot object", to_string(guid.GetRawValue())); + RESET_AI_VALUE2(bool, "should loot object", std::to_string(guid.GetRawValue())); // release loot WorldPacket packet(CMSG_LOOT_RELEASE, 8); @@ -366,11 +366,11 @@ bool StoreLootAction::IsLootAllowed(ItemQualifier& itemQualifier, PlayerbotAI *a if (!proto) return false; - set& lootItems = AI_VALUE(set&, "always loot list"); + std::set& lootItems = AI_VALUE(std::set&, "always loot list"); if (lootItems.find(itemQualifier.GetId()) != lootItems.end()) return true; - set& skipItems = AI_VALUE(set&, "skip loot list"); + std::set& skipItems = AI_VALUE(std::set&, "skip loot list"); if (skipItems.find(itemQualifier.GetId()) != skipItems.end()) return false; @@ -421,16 +421,16 @@ bool StoreLootAction::IsLootAllowed(ItemQualifier& itemQualifier, PlayerbotAI *a bool ReleaseLootAction::Execute(Event& event) { - list gos = context->GetValue >("nearest game objects")->Get(); - for (list::iterator i = gos.begin(); i != gos.end(); i++) + std::list gos = context->GetValue >("nearest game objects")->Get(); + for (std::list::iterator i = gos.begin(); i != gos.end(); i++) { WorldPacket packet(CMSG_LOOT_RELEASE, 8); packet << *i; bot->GetSession()->HandleLootReleaseOpcode(packet); } - list corpses = context->GetValue >("nearest corpses")->Get(); - for (list::iterator i = corpses.begin(); i != corpses.end(); i++) + std::list corpses = context->GetValue >("nearest corpses")->Get(); + for (std::list::iterator i = corpses.begin(); i != corpses.end(); i++) { WorldPacket packet(CMSG_LOOT_RELEASE, 8); packet << *i; diff --git a/playerbot/strategy/actions/LootRollAction.cpp b/playerbot/strategy/actions/LootRollAction.cpp index 6055a552..c9ccd757 100644 --- a/playerbot/strategy/actions/LootRollAction.cpp +++ b/playerbot/strategy/actions/LootRollAction.cpp @@ -57,7 +57,7 @@ bool LootStartRollAction::Execute(Event& event) bool RollAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); if (text.empty()) { @@ -67,7 +67,7 @@ bool RollAction::Execute(Event& event) ItemIds ids = ChatHelper::parseItems(text); - string type = "auto"; + std::string type = "auto"; if (ids.empty()) type = text; else diff --git a/playerbot/strategy/actions/LootRollAction.h b/playerbot/strategy/actions/LootRollAction.h index 0d8bb46d..4318b8ab 100644 --- a/playerbot/strategy/actions/LootRollAction.h +++ b/playerbot/strategy/actions/LootRollAction.h @@ -8,30 +8,30 @@ namespace ai class LootStartRollAction : public ChatCommandAction { public: - LootStartRollAction(PlayerbotAI* ai, string name = "loot start roll") : ChatCommandAction(ai, name) {} + LootStartRollAction(PlayerbotAI* ai, std::string name = "loot start roll") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "loot start roll"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "loot start roll"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This is a WorldPacket action which will stores rollable item to be rolled on later.\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "active rolls" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "active rolls" }; } #endif }; class RollAction : public QueryItemUsageAction { public: - RollAction(PlayerbotAI* ai, string name = "roll") : QueryItemUsageAction(ai, name) {} + RollAction(PlayerbotAI* ai, std::string name = "roll") : QueryItemUsageAction(ai, name) {} virtual bool Execute(Event& event) override; virtual bool isPossible(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "roll"; } //Must equal internal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "roll"; } //Must equal internal name + virtual std::string GetHelpDescription() { return "This will make the bot roll a certain way on a specific item.\n" "Usage: roll [itemlink].\n" @@ -42,8 +42,8 @@ namespace ai "roll auto\n" "See also strategies [h:strategy|roll] and [h:strategy|delayed roll].\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "item usage", "force item usage"}; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "item usage", "force item usage"}; } #endif protected: @@ -55,36 +55,36 @@ namespace ai class LootRollAction : public RollAction { public: - LootRollAction(PlayerbotAI* ai, string name = "loot roll") : RollAction(ai, name) {} + LootRollAction(PlayerbotAI* ai, std::string name = "loot roll") : RollAction(ai, name) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "loot roll"; } //Must equal internal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "loot roll"; } //Must equal internal name + virtual std::string GetHelpDescription() { return "This action will make the bot roll on an item the master just rolled on.\n" "The type of roll will be automatically determined based on if the bot finds the item useful."; } - virtual vector GetUsedActions() { return { "roll" }; } - virtual vector GetUsedValues() { return { "item usage", "force item usage" }; } + virtual std::vector GetUsedActions() { return { "roll" }; } + virtual std::vector GetUsedValues() { return { "item usage", "force item usage" }; } #endif }; class AutoLootRollAction : public RollAction { public: - AutoLootRollAction(PlayerbotAI* ai, string name = "auto loot roll") : RollAction(ai, name) {} + AutoLootRollAction(PlayerbotAI* ai, std::string name = "auto loot roll") : RollAction(ai, name) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "auto loot roll"; } //Must equal internal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "auto loot roll"; } //Must equal internal name + virtual std::string GetHelpDescription() { return "This action will make the bot roll on one item that it hasn't rolled for yet.\n" "The type of roll will be automatically determined based on if the bot finds the item useful."; } - virtual vector GetUsedActions() { return { "roll" }; } - virtual vector GetUsedValues() { return { "item usage", "force item usage" }; } + virtual std::vector GetUsedActions() { return { "roll" }; } + virtual std::vector GetUsedValues() { return { "item usage", "force item usage" }; } #endif }; } diff --git a/playerbot/strategy/actions/LootStrategyAction.cpp b/playerbot/strategy/actions/LootStrategyAction.cpp index 01e1ab3c..67366a99 100644 --- a/playerbot/strategy/actions/LootStrategyAction.cpp +++ b/playerbot/strategy/actions/LootStrategyAction.cpp @@ -10,20 +10,20 @@ using namespace ai; bool LootStrategyAction::Execute(Event& event) { - string strategy = event.getParam(); + std::string strategy = event.getParam(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); LootObjectStack* lootItems = AI_VALUE(LootObjectStack*, "available loot"); - set& alwaysLootItems = AI_VALUE(set&, "always loot list"); - set& skipLootItems = AI_VALUE(set&, "skip loot list"); - set& skipGoLootList = AI_VALUE(set&, "skip go loot list"); + std::set& alwaysLootItems = AI_VALUE(std::set&, "always loot list"); + std::set& skipLootItems = AI_VALUE(std::set&, "skip loot list"); + std::set& skipGoLootList = AI_VALUE(std::set&, "skip go loot list"); if (strategy == "?") { { - ostringstream out; + std::ostringstream out; out << "Loot strategy: "; - out << AI_VALUE(string, "loot strategy"); + out << AI_VALUE(std::string, "loot strategy"); ai->TellPlayer(requester, out); } @@ -40,16 +40,16 @@ bool LootStrategyAction::Execute(Event& event) } else { - set itemQualifiers = chat->parseItemQualifiers(strategy); - list gos = chat->parseGameobjects(strategy); + std::set itemQualifiers = chat->parseItemQualifiers(strategy); + std::list gos = chat->parseGameobjects(strategy); if (itemQualifiers.size() == 0 && gos.size() == 0) { - SET_AI_VALUE(string, "loot strategy", strategy); + SET_AI_VALUE(std::string, "loot strategy", strategy); - string lootStrategy = AI_VALUE(string, "loot strategy"); + std::string lootStrategy = AI_VALUE(std::string, "loot strategy"); - ostringstream out; + std::ostringstream out; out << "Loot strategy set to " << lootStrategy; ai->TellPlayer(requester, out); return true; @@ -68,7 +68,7 @@ bool LootStrategyAction::Execute(Event& event) { if (itemQualifier.GetProto()) { - ostringstream out; + std::ostringstream out; out << (StoreLootAction::IsLootAllowed(itemQualifier, ai) ? "|cFF000000Will loot " : "|c00FF0000Won't loot ") << ChatHelper::formatItem(itemQualifier); ai->TellPlayer(requester, out.str()); } @@ -76,14 +76,14 @@ bool LootStrategyAction::Execute(Event& event) if (remove || add) { - set::iterator j = skipLootItems.find(itemid); + std::set::iterator j = skipLootItems.find(itemid); if (j != skipLootItems.end()) skipLootItems.erase(j); changes = true; } if (remove || ignore) { - set::iterator j = alwaysLootItems.find(itemid); + std::set::iterator j = alwaysLootItems.find(itemid); if (j != alwaysLootItems.end()) alwaysLootItems.erase(j); changes = true; } @@ -101,7 +101,7 @@ bool LootStrategyAction::Execute(Event& event) } } - for (list::iterator i = gos.begin(); i != gos.end(); ++i) + for (std::list::iterator i = gos.begin(); i != gos.end(); ++i) { GameObject *go = ai->GetGameObject(*i); if (!go) continue; @@ -109,7 +109,7 @@ bool LootStrategyAction::Execute(Event& event) if (remove || add) { - set::iterator j = skipGoLootList.find(goId); + std::set::iterator j = skipGoLootList.find(goId); if (j != skipGoLootList.end()) skipGoLootList.erase(j); changes = true; } @@ -133,13 +133,13 @@ bool LootStrategyAction::Execute(Event& event) return true; } -void LootStrategyAction::TellLootList(Player* requester, const string& name) +void LootStrategyAction::TellLootList(Player* requester, const std::string& name) { - set& alwaysLootItems = AI_VALUE(set&, name); - ostringstream out; + std::set& alwaysLootItems = AI_VALUE(std::set&, name); + std::ostringstream out; out << "My " << name << ":"; - for (set::iterator i = alwaysLootItems.begin(); i != alwaysLootItems.end(); i++) + for (std::set::iterator i = alwaysLootItems.begin(); i != alwaysLootItems.end(); i++) { ItemPrototype const *proto = sItemStorage.LookupEntry(*i); if (!proto) @@ -153,13 +153,13 @@ void LootStrategyAction::TellLootList(Player* requester, const string& name) ai->TellPlayer(requester, out); } -void LootStrategyAction::TellGoList(Player* requester, const string& name) +void LootStrategyAction::TellGoList(Player* requester, const std::string& name) { - set& skipGoItems = AI_VALUE(set&, name); - ostringstream out; + std::set& skipGoItems = AI_VALUE(std::set&, name); + std::ostringstream out; out << "My " << name << ":"; - for (set::iterator i = skipGoItems.begin(); i != skipGoItems.end(); i++) + for (std::set::iterator i = skipGoItems.begin(); i != skipGoItems.end(); i++) { uint32 id = *i; GameObjectInfo const *proto = sGOStorage.LookupEntry(id); diff --git a/playerbot/strategy/actions/LootStrategyAction.h b/playerbot/strategy/actions/LootStrategyAction.h index 51115228..92cda462 100644 --- a/playerbot/strategy/actions/LootStrategyAction.h +++ b/playerbot/strategy/actions/LootStrategyAction.h @@ -11,7 +11,7 @@ namespace ai virtual bool Execute(Event& event) override; private: - void TellLootList(Player* requester, const string& name); - void TellGoList(Player* requester, const string& name); + void TellLootList(Player* requester, const std::string& name); + void TellGoList(Player* requester, const std::string& name); }; } diff --git a/playerbot/strategy/actions/MailAction.cpp b/playerbot/strategy/actions/MailAction.cpp index 8af4a1b4..744e616a 100644 --- a/playerbot/strategy/actions/MailAction.cpp +++ b/playerbot/strategy/actions/MailAction.cpp @@ -3,11 +3,11 @@ #include "playerbot/playerbot.h" #include "MailAction.h" #include "playerbot/PlayerbotAIConfig.h" -#include "../../Helpers.h" +#include "playerbot/Helpers.h" using namespace ai; -map MailAction::processors; +std::map MailAction::processors; class TellMailProcessor : public MailProcessor { @@ -24,7 +24,7 @@ class TellMailProcessor : public MailProcessor Player* bot = ai->GetBot(); time_t cur_time = time(0); int days = (cur_time - mail->deliver_time) / 3600 / 24; - ostringstream out; + std::ostringstream out; out << "#" << (index+1) << " "; if (!mail->money && !mail->has_items) out << "|cffffffff" << mail->subject; @@ -44,7 +44,7 @@ class TellMailProcessor : public MailProcessor ItemPrototype const *proto = sObjectMgr.GetItemPrototype(i->item_template); if (proto) { - sPlayerbotAIConfig.logEvent(ai, "MailAction", proto->Name1, to_string(proto->ItemId)); + sPlayerbotAIConfig.logEvent(ai, "MailAction", proto->Name1, std::to_string(proto->ItemId)); out << ChatHelper::formatItem(item, count); if (!mail->subject.empty()) out << " |cffa0a0a0(" << mail->subject << ")"; } @@ -58,7 +58,7 @@ class TellMailProcessor : public MailProcessor bool After(Player* requester, PlayerbotAI* ai) override { - for (list::iterator i = tells.begin(); i != tells.end(); ++i) + for (std::list::iterator i = tells.begin(); i != tells.end(); ++i) { ai->TellPlayer(requester, *i, PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } @@ -69,7 +69,7 @@ class TellMailProcessor : public MailProcessor static TellMailProcessor instance; private: - list tells; + std::list tells; }; class TakeMailProcessor : public MailProcessor @@ -87,7 +87,7 @@ class TakeMailProcessor : public MailProcessor ObjectGuid mailbox = FindMailbox(ai); if (mail->money) { - ostringstream out; + std::ostringstream out; out << mail->subject << ", |cffffff00" << ChatHelper::formatMoney(mail->money) << "|cff00ff00 processed"; ai->TellPlayer(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); @@ -99,7 +99,7 @@ class TakeMailProcessor : public MailProcessor } else if (!mail->items.empty()) { - list guids; + std::list guids; for (MailItemInfoVec::iterator i = mail->items.begin(); i != mail->items.end(); ++i) { ItemPrototype const *proto = sObjectMgr.GetItemPrototype(i->item_template); @@ -107,7 +107,7 @@ class TakeMailProcessor : public MailProcessor guids.push_back(i->item_guid); } - for (list::iterator i = guids.begin(); i != guids.end(); ++i) + for (std::list::iterator i = guids.begin(); i != guids.end(); ++i) { WorldPacket packet; packet << mailbox; @@ -116,7 +116,7 @@ class TakeMailProcessor : public MailProcessor packet << *i; #endif Item* item = bot->GetMItem(*i); - ostringstream out; + std::ostringstream out; out << mail->subject << ", " << ChatHelper::formatItem(item) << "|cff00ff00 processed"; bot->GetSession()->HandleMailTakeItem(packet); @@ -160,7 +160,7 @@ class DeleteMailProcessor : public MailProcessor public: bool Process(Player* requester, int index, Mail* mail, PlayerbotAI* ai) override { - ostringstream out; + std::ostringstream out; out << "|cffffffff" << mail->subject << "|cffff0000 deleted"; RemoveMail(ai->GetBot(), mail->messageID, FindMailbox(ai)); ai->TellPlayer(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); @@ -175,7 +175,7 @@ class ReadMailProcessor : public MailProcessor public: bool Process(Player* requester, int index, Mail* mail, PlayerbotAI* ai) override { - ostringstream out, body; + std::ostringstream out, body; out << "|cffffffff" << mail->subject; ai->TellPlayer(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); #ifdef MANGOSBOT_TWO @@ -218,20 +218,20 @@ bool MailAction::Execute(Event& event) processors["read"] = &ReadMailProcessor::instance; } - string text = event.getParam(); + std::string text = event.getParam(); if (text.empty()) { ai->TellPlayer(requester, "whisper 'mail ?' to query mailbox, 'mail take/delete/read filter' to take/delete/read mails by filter"); return false; } - vector ss = split(text, ' '); - string action = ss[0]; - string filter = ss.size() > 1 ? ss[1] : ""; + std::vector ss = split(text, ' '); + std::string action = ss[0]; + std::string filter = ss.size() > 1 ? ss[1] : ""; MailProcessor* processor = processors[action]; if (!processor) { - ostringstream out; out << action << ": I don't know how to do that"; + std::ostringstream out; out << action << ": I don't know how to do that"; ai->TellPlayer(requester, out.str()); return false; } @@ -239,7 +239,7 @@ bool MailAction::Execute(Event& event) if (!processor->Before(requester, ai)) return false; - vector mailList; + std::vector mailList; time_t cur_time = time(0); for (PlayerMails::iterator itr = bot->GetMailBegin(); itr != bot->GetMailEnd(); ++itr) { @@ -253,8 +253,8 @@ bool MailAction::Execute(Event& event) if (mailList.empty()) return false; - map filtered = filterList(mailList, filter); - for (map::iterator i = filtered.begin(); i != filtered.end(); ++i) + std::map filtered = filterList(mailList, filter); + for (std::map::iterator i = filtered.begin(); i != filtered.end(); ++i) { if (!processor->Process(requester, i->first, i->second, ai)) break; @@ -276,9 +276,9 @@ void MailProcessor::RemoveMail(Player* bot, uint32 id, ObjectGuid mailbox) ObjectGuid MailProcessor::FindMailbox(PlayerbotAI* ai) { - list gos = *ai->GetAiObjectContext()->GetValue >("nearest game objects"); + std::list gos = *ai->GetAiObjectContext()->GetValue >("nearest game objects"); ObjectGuid mailbox; - for (list::iterator i = gos.begin(); i != gos.end(); ++i) + for (std::list::iterator i = gos.begin(); i != gos.end(); ++i) { GameObject* go = ai->GetGameObject(*i); if (go && go->GetGoType() == GAMEOBJECT_TYPE_MAILBOX) diff --git a/playerbot/strategy/actions/MailAction.h b/playerbot/strategy/actions/MailAction.h index 7f16ecd1..a5767263 100644 --- a/playerbot/strategy/actions/MailAction.h +++ b/playerbot/strategy/actions/MailAction.h @@ -28,7 +28,7 @@ namespace ai bool CheckMailbox(); private: - static map processors; + static std::map processors; }; } diff --git a/playerbot/strategy/actions/MoveStyleAction.cpp b/playerbot/strategy/actions/MoveStyleAction.cpp index d39ee73a..c0e8ed18 100644 --- a/playerbot/strategy/actions/MoveStyleAction.cpp +++ b/playerbot/strategy/actions/MoveStyleAction.cpp @@ -9,15 +9,15 @@ using namespace ai; bool MoveStyleAction::Execute(Event& event) { - string strategy = event.getParam(); + std::string strategy = event.getParam(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - MoveStyleValue* value = (MoveStyleValue*)context->GetValue("move style"); + MoveStyleValue* value = (MoveStyleValue*)context->GetValue("move style"); if (strategy == "?") { { - ostringstream out; + std::ostringstream out; out << "Move style: " << value->Get(); ai->TellPlayer(requester, out); } @@ -27,7 +27,7 @@ bool MoveStyleAction::Execute(Event& event) value->Set(strategy); { - ostringstream out; + std::ostringstream out; out << "Move style set to: " << value->Get(); ai->TellPlayer(requester, out); } diff --git a/playerbot/strategy/actions/MoveToRpgTargetAction.cpp b/playerbot/strategy/actions/MoveToRpgTargetAction.cpp index 7f922e70..9a1401b4 100644 --- a/playerbot/strategy/actions/MoveToRpgTargetAction.cpp +++ b/playerbot/strategy/actions/MoveToRpgTargetAction.cpp @@ -36,7 +36,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (guidPP.IsPlayer()) { - AI_VALUE(set&,"ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); + AI_VALUE(std::set&,"ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); @@ -51,7 +51,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (unit && unit->IsMoving() && !urand(0, 20) && guidP.sqDistance2d(bot) < INTERACTION_DISTANCE * INTERACTION_DISTANCE * 2) { - AI_VALUE(set&,"ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); + AI_VALUE(std::set&,"ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition,"rpg target"); @@ -64,7 +64,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (!AI_VALUE2(bool, "can free move to", GuidPosition(wo).to_string())) { - AI_VALUE(set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); + AI_VALUE(std::set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); @@ -77,7 +77,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (guidP.distance(bot) > sPlayerbotAIConfig.reactDistance * 2) { - AI_VALUE(set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); + AI_VALUE(std::set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); @@ -90,7 +90,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (guidP.IsGameObject() && guidP.sqDistance2d(bot) < INTERACTION_DISTANCE * INTERACTION_DISTANCE && guidP.distance(bot) > INTERACTION_DISTANCE * 1.5 && !urand(0, 5)) { - AI_VALUE(set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); + AI_VALUE(std::set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); @@ -103,7 +103,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (!urand(0, 50)) { - AI_VALUE(set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); + AI_VALUE(std::set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); @@ -121,7 +121,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) { - string name = chat->formatWorldobject(wo); + std::string name = chat->formatWorldobject(wo); ai->Poi(x, y, name); } @@ -166,7 +166,7 @@ bool MoveToRpgTargetAction::Execute(Event& event) if (!couldMove && WorldPosition(mapId,x,y,z).distance(bot) > INTERACTION_DISTANCE) { - AI_VALUE(set&,"ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); + AI_VALUE(std::set&,"ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); @@ -182,14 +182,14 @@ bool MoveToRpgTargetAction::Execute(Event& event) { if (couldMove) { - ostringstream out; + std::ostringstream out; out << "Heading to: "; out << chat->formatWorldobject(guidP.GetWorldObject()); ai->TellPlayerNoFacing(GetMaster(), out); } else { - ostringstream out; + std::ostringstream out; out << "Near: "; out << chat->formatWorldobject(guidP.GetWorldObject()); ai->TellPlayerNoFacing(GetMaster(), out); diff --git a/playerbot/strategy/actions/MoveToRpgTargetAction.h b/playerbot/strategy/actions/MoveToRpgTargetAction.h index 2955e12a..d4f72bd2 100644 --- a/playerbot/strategy/actions/MoveToRpgTargetAction.h +++ b/playerbot/strategy/actions/MoveToRpgTargetAction.h @@ -14,16 +14,16 @@ namespace ai virtual bool isUseful(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "move to rpg target"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "move to rpg target"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This will make the bot move towards the current rpg target.\n" "When near the target the bot will move to a spot around the target\n" "45 degrees closest to the bot or 45 infront if the target is moving.\n" "This action will only execute if the bot is not moving or traveling."; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "rpg target" , "ignore rpg target" , "travel target" , "can move around" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "rpg target" , "ignore rpg target" , "travel target" , "can move around" }; } #endif }; diff --git a/playerbot/strategy/actions/MoveToTravelTargetAction.cpp b/playerbot/strategy/actions/MoveToTravelTargetAction.cpp index d4e56dae..715f353e 100644 --- a/playerbot/strategy/actions/MoveToTravelTargetAction.cpp +++ b/playerbot/strategy/actions/MoveToTravelTargetAction.cpp @@ -51,7 +51,7 @@ bool MoveToTravelTargetAction::Execute(Event& event) if (!urand(0, 5)) { - ostringstream out; + std::ostringstream out; if (ai->GetMaster() && !bot->GetGroup()->IsMember(ai->GetMaster()->GetObjectGuid())) out << "Waiting a bit for "; else @@ -85,7 +85,7 @@ bool MoveToTravelTargetAction::Execute(Event& event) WorldPosition* pos = target->getPosition(); GuidPosition* guidP = dynamic_cast(pos); - string name = (guidP && guidP->GetWorldObject()) ? chat->formatWorldobject(guidP->GetWorldObject()) : "travel target"; + std::string name = (guidP && guidP->GetWorldObject()) ? chat->formatWorldobject(guidP->GetWorldObject()) : "travel target"; ai->Poi(x, y, name); } diff --git a/playerbot/strategy/actions/MovementActions.cpp b/playerbot/strategy/actions/MovementActions.cpp index 2f0c23af..07c28bb7 100644 --- a/playerbot/strategy/actions/MovementActions.cpp +++ b/playerbot/strategy/actions/MovementActions.cpp @@ -16,7 +16,7 @@ #ifdef MANGOSBOT_TWO #include "Entities/Vehicle.h" #endif -#include "../generic/CombatStrategy.h" +#include "playerbot/strategy/generic/CombatStrategy.h" using namespace ai; @@ -68,7 +68,7 @@ bool MovementAction::MoveNear(WorldObject* target, float distance) { #ifdef CMANGOS float dist = distance + target->GetObjectBoundingRadius(); - target->GetNearPoint(bot, x, y, z, bot->GetObjectBoundingRadius(), min(dist, ai->GetRange("follow")), angle); + target->GetNearPoint(bot, x, y, z, bot->GetObjectBoundingRadius(), std::min(dist, ai->GetRange("follow")), angle); #endif #ifdef MANGOS float x = target->GetPositionX() + cos(angle) * distance, @@ -109,7 +109,7 @@ bool MovementAction::FlyDirect(WorldPosition &startPosition, WorldPosition &endP if (movePosition.getMapId() != startPosition.getMapId() || !movePosition.isOutside() || !movePosition.canFly()) //We can not fly to the end directly. { - vector path; + std::vector path; if (movePath.empty()) //Make a path starting at the end backwards to see if we can walk to some better place. { path = endPosition.getPathTo(startPosition, bot); @@ -214,12 +214,12 @@ bool MovementAction::FlyDirect(WorldPosition &startPosition, WorldPosition &endP LastMovement& lastMove = AI_VALUE(LastMovement&,"last movement"); if (sPlayerbotAIConfig.hasLog("bot_movement.csv") && lastMove.lastMoveShort != movePosition) { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; startPosition.printWKT({ startPosition, movePosition }, out, 1); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP))); out << subLevel << ","; out << "1"; @@ -388,11 +388,11 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, } else if (ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) { - vector beginPath = endPosition.getPathFromPath({ startPosition }, bot, 40); + std::vector beginPath = endPosition.getPathFromPath({ startPosition }, bot, 40); sTravelNodeMap.m_nMapMtx.lock_shared(); TravelNodeRoute route = sTravelNodeMap.getRoute(startPosition, endPosition, beginPath, bot); - string routeList; + std::string routeList; for (auto node : route.getNodes()) { @@ -437,7 +437,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, oldDist = WorldPosition().getPathLength(movePath.getPointPath()); if (!bot->GetTransport() && movePath.makeShortCut(startPosition, sPlayerbotAIConfig.reactDistance, bot)) if (ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(GetMaster(), "Found a shortcut: old=" + to_string(uint32(oldDist)) + "y new=" + to_string(uint32(WorldPosition().getPathLength(movePath.getPointPath())))); + ai->TellPlayerNoFacing(GetMaster(), "Found a shortcut: old=" + std::to_string(uint32(oldDist)) + "y new=" + std::to_string(uint32(WorldPosition().getPathLength(movePath.getPointPath())))); if (movePath.empty()) { @@ -469,7 +469,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, else telePos = movePosition; - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; if (telePos && telePos != movePosition) @@ -477,8 +477,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, else startPosition.printWKT({ startPosition, movePosition }, out, 1); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP))); out << subLevel << ","; out << (entry ? entry : -1); @@ -542,7 +542,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, else telePos = movePosition; - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; if (telePos && telePos != movePosition) @@ -550,8 +550,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, else startPosition.printWKT({ startPosition, movePosition }, out, 1); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP))); out << subLevel << ","; out << (entry ? entry : -1); @@ -585,12 +585,12 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, else { if (ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayer(GetMaster(), "transport at " + to_string(uint32(telePosition.distance(transport))) + "yards of entry"); + ai->TellPlayer(GetMaster(), "transport at " + std::to_string(uint32(telePosition.distance(transport))) + "yards of entry"); if (telePosition.distance(transport) < INTERACTION_DISTANCE) //Transport has arrived Move on. { if (ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(GetMaster(), "Moving on to transport " + string(transport->GetName())); + ai->TellPlayerNoFacing(GetMaster(), "Moving on to transport " + std::string(transport->GetName())); movePosition = WorldPosition(transport); movePosition.setZ(bot->GetPositionZ()); @@ -606,7 +606,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, WorldPosition onBoatPos(movePosition); if(bot->GetTransport()->IsTransport()) onBoatPos += WorldPosition(0, cos(angle / 4 * M_PI_F) * 5.0f, sin(angle / 4 * M_PI_F) * 10.0f); - vector step = onBoatPos.getPathStepFrom(bot, bot); + std::vector step = onBoatPos.getPathStepFrom(bot, bot); if (!step.empty() && abs(step.back().getZ() - movePosition.getZ()) < 2.0f) { if (ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) @@ -644,13 +644,13 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, if (ai->GetMoveToTransport() && startPosition.isOnTransport(bot->GetTransport())) { if (ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayerNoFacing(GetMaster(), "I'm on " + string(bot->GetTransport()->GetName())); + ai->TellPlayerNoFacing(GetMaster(), "I'm on " + std::string(bot->GetTransport()->GetName())); ai->SetMoveToTransport(false); entry = 0; } if (movePosition.getMapId() == bot->GetMapId() && ai->HasStrategy("debug move", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayer(GetMaster(), "transport at " + to_string(uint32(telePosition.distance(bot->GetTransport()))) + "yards of exit"); + ai->TellPlayer(GetMaster(), "transport at " + std::to_string(uint32(telePosition.distance(bot->GetTransport()))) + "yards of exit"); if (movePosition.getMapId() == bot->GetMapId() && telePosition.distance(bot->GetTransport()) < INTERACTION_DISTANCE) //We have arived move off. { @@ -695,8 +695,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, if (!bot->m_taxi.IsTaximaskNodeKnown(tEntry->from)) { - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Creature* unit = bot->GetNPCIfCanInteractWith(*i, UNIT_NPC_FLAG_FLIGHTMASTER); if (!unit) @@ -744,7 +744,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, else { if (sServerFacade.IsSpellReady(bot, entry) && (!bot->IsFlying() || WorldPosition(bot).currentHeight() < 10.0f)) - if (ai->DoSpecificAction("cast", Event("rpg action", to_string(entry)), true)) + if (ai->DoSpecificAction("cast", Event("rpg action", std::to_string(entry)), true)) return true; movePath.clear(); @@ -794,7 +794,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, //Stop the path when we might get aggro. if (!ai->IsStateActive(BotState::BOT_STATE_COMBAT) && !bot->IsDead() && !ignoreEnemyTargets) { - list targets = AI_VALUE_LAZY(list, "possible attack targets"); + std::list targets = AI_VALUE_LAZY(std::list, "possible attack targets"); if (!targets.empty() && movePosition) { @@ -874,12 +874,12 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle, //Log bot movement if (sPlayerbotAIConfig.hasLog("bot_movement.csv") && lastMove.lastMoveShort != movePosition) { - ostringstream out; + std::ostringstream out; out << sPlayerbotAIConfig.GetTimestampStr() << "+00,"; out << bot->GetName() << ","; startPosition.printWKT({ startPosition, movePosition }, out, 1); - out << to_string(bot->getRace()) << ","; - out << to_string(bot->getClass()) << ","; + out << std::to_string(bot->getRace()) << ","; + out << std::to_string(bot->getClass()) << ","; float subLevel = ((float)bot->GetLevel() + ((float)bot->GetUInt32Value(PLAYER_XP) / (float)bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP))); out << subLevel << ","; out << 0; @@ -1634,7 +1634,7 @@ bool MovementAction::Flee(Unit *target) if (group) { Unit* spareTarget = nullptr; - vector possibleTargets; + std::vector possibleTargets; const float minFleeDistance = 5.0f; const float maxFleeDistance = isTarget ? 40.0f : ai->GetRange("spell") * 1.5; const float minRangedTargetDistance = ai->GetRange("spell") / 2 + ai->GetRange("follow"); @@ -1791,7 +1791,7 @@ bool MovementAction::Flee(Unit *target) if (!urand(0, 50) && ai->HasStrategy("emote", BotState::BOT_STATE_NON_COMBAT)) { - vector sounds; + std::vector sounds; sounds.push_back(304); // guard sounds.push_back(306); // flee ai->PlayEmote(sounds[urand(0, sounds.size() - 1)]); @@ -1832,7 +1832,7 @@ bool MovementAction::IsValidPosition(const WorldPosition& position, const WorldP bool MovementAction::IsHazardNearPosition(const WorldPosition& position, HazardPosition* outHazard) { AiObjectContext* context = bot->GetPlayerbotAI()->GetAiObjectContext(); - list hazards = AI_VALUE(list, "hazards"); + std::list hazards = AI_VALUE(std::list, "hazards"); if (!hazards.empty()) { for (const HazardPosition& hazard : hazards) @@ -1859,7 +1859,7 @@ bool MovementAction::GeneratePathAvoidingHazards(const WorldPosition& endPositio { if (generatePath) { - list hazards = AI_VALUE(list, "hazards"); + std::list hazards = AI_VALUE(std::list, "hazards"); if (!hazards.empty()) { PathFinder path(bot); @@ -2177,8 +2177,8 @@ bool MoveOutOfCollisionAction::isUseful() return false; #endif - return AI_VALUE2(bool, "collision", "self target") && ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get().size() < 15 && - ai->GetAiObjectContext()->GetValue >("nearest non bot players")->Get().size() > 0; + return AI_VALUE2(bool, "collision", "self target") && ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get().size() < 15 && + ai->GetAiObjectContext()->GetValue >("nearest non bot players")->Get().size() > 0; } bool MoveRandomAction::Execute(Event& event) @@ -2198,12 +2198,12 @@ bool MoveRandomAction::Execute(Event& event) bool MoveRandomAction::isUseful() { - return !ai->HasRealPlayerMaster() && ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get().size() > urand(25, 100); + return !ai->HasRealPlayerMaster() && ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get().size() > urand(25, 100); } bool MoveToAction::Execute(Event& event) { - list guidList = AI_VALUE(list, getQualifier()); + std::list guidList = AI_VALUE(std::list, getQualifier()); if (guidList.empty()) return false; @@ -2224,16 +2224,16 @@ bool JumpAction::Execute(ai::Event &event) if (!event.getOwner() && bot->IsNonMeleeSpellCasted(false, false, true)) return false; - string param = event.getParam(); - string qualify = getQualifier(); - string options = !param.empty() ? param : !qualify.empty() ? qualify : ""; + std::string param = event.getParam(); + std::string qualify = getQualifier(); + std::string options = !param.empty() ? param : !qualify.empty() ? qualify : ""; bool jumpInPlace = false; bool jumpBackward = false; bool showLanding = false; bool isRtsc = false; // only show landing - if (options.find("show") != string::npos && options.size() > 5) + if (options.find("show") != std::string::npos && options.size() > 5) { options = param.substr(5); showLanding = true; @@ -2712,7 +2712,7 @@ bool JumpAction::CanWalkTo(const WorldPosition &src, const WorldPosition &dest, if (src.fDist(dest) > sPlayerbotAIConfig.sightDistance) return false; - vector path = dest.getPathStepFrom(src, jumper, true); + std::vector path = dest.getPathStepFrom(src, jumper, true); if (path.empty()) { sLog.outDetail("%s: Jump CanWalkTo Fail! No Path!", jumper->GetName()); @@ -2939,7 +2939,7 @@ WorldPosition JumpAction::GetPossibleJumpStartFor(const WorldPosition& src, cons } // try find a closer point - vector path = dest.getPathStepFrom(src, jumper); + std::vector path = dest.getPathStepFrom(src, jumper); // no path found closer to it... if (path.empty() || path.size() == 2) diff --git a/playerbot/strategy/actions/MovementActions.h b/playerbot/strategy/actions/MovementActions.h index d873b039..e3e67a4d 100644 --- a/playerbot/strategy/actions/MovementActions.h +++ b/playerbot/strategy/actions/MovementActions.h @@ -12,7 +12,7 @@ namespace ai class MovementAction : public Action { public: - MovementAction(PlayerbotAI* ai, string name) : Action(ai, name) {} + MovementAction(PlayerbotAI* ai, std::string name) : Action(ai, name) {} protected: bool ChaseTo(WorldObject *obj, float distance = 0.0f, float angle = 0.0f); @@ -129,7 +129,7 @@ namespace ai class MoveToAction : public MovementAction, public Qualified { public: - MoveToAction(PlayerbotAI* ai, string name = "move to") : MovementAction(ai, "name"), Qualified() {} + MoveToAction(PlayerbotAI* ai, std::string name = "move to") : MovementAction(ai, "name"), Qualified() {} virtual bool Execute(Event& event); }; diff --git a/playerbot/strategy/actions/OutfitAction.cpp b/playerbot/strategy/actions/OutfitAction.cpp index 08ad664c..95ffb349 100644 --- a/playerbot/strategy/actions/OutfitAction.cpp +++ b/playerbot/strategy/actions/OutfitAction.cpp @@ -9,7 +9,7 @@ using namespace ai; bool OutfitAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string param = event.getParam(); + std::string param = event.getParam(); if (param == "?") { @@ -20,12 +20,12 @@ bool OutfitAction::Execute(Event& event) } else { - string name = ai->InventoryParseOutfitName(param); + std::string name = ai->InventoryParseOutfitName(param); ItemIds items = ai->InventoryParseOutfitItems(param); if (!name.empty()) { Save(name, items); - ostringstream out; + std::ostringstream out; out << "Setting outfit " << name << " as " << param; ai->TellPlayer(requester, out); return true; @@ -39,10 +39,10 @@ bool OutfitAction::Execute(Event& event) name = param.substr(0, space); ItemIds outfit = ai->InventoryFindOutfitItems(name); - string command = param.substr(space + 1); + std::string command = param.substr(space + 1); if (command == "equip") { - ostringstream out; + std::ostringstream out; out << "Equipping outfit " << name; ai->TellPlayer(requester, out); EquipItems(requester, outfit); @@ -50,7 +50,7 @@ bool OutfitAction::Execute(Event& event) } else if (command == "replace") { - ostringstream out; + std::ostringstream out; out << "Replacing current equip with outfit " << name; ai->TellPlayer(requester, out); for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; slot++) @@ -71,7 +71,7 @@ bool OutfitAction::Execute(Event& event) } else if (command == "reset") { - ostringstream out; + std::ostringstream out; out << "Resetting outfit " << name; ai->TellPlayer(requester, out); Save(name, ItemIds()); @@ -79,7 +79,7 @@ bool OutfitAction::Execute(Event& event) } else if (command == "update") { - ostringstream out; + std::ostringstream out; out << "Updating with current items outfit " << name; ai->TellPlayer(requester, out); Update(name); @@ -91,11 +91,11 @@ bool OutfitAction::Execute(Event& event) { uint32 itemid = *i; ItemPrototype const *proto = sItemStorage.LookupEntry(*i); - ostringstream out; + std::ostringstream out; out << chat->formatItem(proto); if (remove) { - set::iterator j = outfit.find(itemid); + std::set::iterator j = outfit.find(itemid); if (j != outfit.end()) outfit.erase(j); @@ -115,12 +115,12 @@ bool OutfitAction::Execute(Event& event) return true; } -void OutfitAction::Save(string name, ItemIds items) +void OutfitAction::Save(std::string name, ItemIds items) { - list& outfits = AI_VALUE(list&, "outfit list"); - for (list::iterator i = outfits.begin(); i != outfits.end(); ++i) + std::list& outfits = AI_VALUE(std::list&, "outfit list"); + for (std::list::iterator i = outfits.begin(); i != outfits.end(); ++i) { - string outfit = *i; + std::string outfit = *i; if (name == ai->InventoryParseOutfitName(outfit)) { outfits.erase(i); @@ -130,7 +130,7 @@ void OutfitAction::Save(string name, ItemIds items) if (items.empty()) return; - ostringstream out; + std::ostringstream out; out << name << "="; bool first = true; for (ItemIds::iterator i = items.begin(); i != items.end(); i++) @@ -143,14 +143,14 @@ void OutfitAction::Save(string name, ItemIds items) void OutfitAction::List(Player* requester) { - list& outfits = AI_VALUE(list&, "outfit list"); - for (list::iterator i = outfits.begin(); i != outfits.end(); ++i) + std::list& outfits = AI_VALUE(std::list&, "outfit list"); + for (std::list::iterator i = outfits.begin(); i != outfits.end(); ++i) { - string outfit = *i; - string name = ai->InventoryParseOutfitName(outfit); + std::string outfit = *i; + std::string name = ai->InventoryParseOutfitName(outfit); ItemIds items = ai->InventoryParseOutfitItems(outfit); - ostringstream out; + std::ostringstream out; out << name << ": "; for (ItemIds::iterator j = items.begin(); j != items.end(); ++j) { @@ -164,13 +164,13 @@ void OutfitAction::List(Player* requester) } } -void OutfitAction::Update(string name) +void OutfitAction::Update(std::string name) { ListItemsVisitor visitor; ai->InventoryIterateItems(&visitor, IterateItemsMask::ITERATE_ITEMS_IN_EQUIP); ItemIds items; - for (map::iterator i = visitor.items.begin(); i != visitor.items.end(); ++i) + for (std::map::iterator i = visitor.items.begin(); i != visitor.items.end(); ++i) items.insert(i->first); Save(name, items); diff --git a/playerbot/strategy/actions/OutfitAction.h b/playerbot/strategy/actions/OutfitAction.h index 8284bf9f..9fd22526 100644 --- a/playerbot/strategy/actions/OutfitAction.h +++ b/playerbot/strategy/actions/OutfitAction.h @@ -12,7 +12,7 @@ namespace ai private: void List(Player* requester); - void Save(string name, ItemIds outfit); - void Update(string name); + void Save(std::string name, ItemIds outfit); + void Update(std::string name); }; } diff --git a/playerbot/strategy/actions/PassLeadershipToMasterAction.h b/playerbot/strategy/actions/PassLeadershipToMasterAction.h index 276aeafb..d3e13977 100644 --- a/playerbot/strategy/actions/PassLeadershipToMasterAction.h +++ b/playerbot/strategy/actions/PassLeadershipToMasterAction.h @@ -6,7 +6,7 @@ namespace ai class PassLeadershipToMasterAction : public ChatCommandAction { public: - PassLeadershipToMasterAction(PlayerbotAI* ai, string name = "leader", string message = "Passing leader to you!") : ChatCommandAction(ai, name), message(message) {} + PassLeadershipToMasterAction(PlayerbotAI* ai, std::string name = "leader", std::string message = "Passing leader to you!") : ChatCommandAction(ai, name), message(message) {} virtual bool Execute(Event& event) override { @@ -40,13 +40,13 @@ namespace ai bool isUsefulWhenStunned() override { return true; } protected: - string message; + std::string message; }; class GiveLeaderAction : public PassLeadershipToMasterAction { public: - GiveLeaderAction(PlayerbotAI* ai, string message = "Lead the way!") : PassLeadershipToMasterAction(ai, "give leader", message) {} + GiveLeaderAction(PlayerbotAI* ai, std::string message = "Lead the way!") : PassLeadershipToMasterAction(ai, "give leader", message) {} virtual bool isUseful() { diff --git a/playerbot/strategy/actions/PetitionSignAction.cpp b/playerbot/strategy/actions/PetitionSignAction.cpp index c5c8aa42..931c94c7 100644 --- a/playerbot/strategy/actions/PetitionSignAction.cpp +++ b/playerbot/strategy/actions/PetitionSignAction.cpp @@ -10,7 +10,6 @@ #endif #endif -using namespace std; using namespace ai; bool PetitionSignAction::Execute(Event& event) diff --git a/playerbot/strategy/actions/PositionAction.cpp b/playerbot/strategy/actions/PositionAction.cpp index 34b345b5..cd0d5bd6 100644 --- a/playerbot/strategy/actions/PositionAction.cpp +++ b/playerbot/strategy/actions/PositionAction.cpp @@ -5,9 +5,9 @@ using namespace ai; -void TellPosition(PlayerbotAI* ai, Player* requester, string name, ai::PositionEntry pos) +void TellPosition(PlayerbotAI* ai, Player* requester, std::string name, ai::PositionEntry pos) { - ostringstream out; out << "Position " << name; + std::ostringstream out; out << "Position " << name; if (pos.isSet()) { float x = pos.x, y = pos.y; @@ -22,7 +22,7 @@ void TellPosition(PlayerbotAI* ai, Player* requester, string name, ai::PositionE bool PositionAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string param = event.getParam(); + std::string param = event.getParam(); if (param.empty()) return false; @@ -40,15 +40,15 @@ bool PositionAction::Execute(Event& event) return true; } - vector params = split(param, ' '); + std::vector params = split(param, ' '); if (params.size() != 2) { ai->TellPlayer(requester, "Whisper position ?/set/reset"); return false; } - string name = params[0]; - string action = params[1]; + std::string name = params[0]; + std::string action = params[1]; ai::PositionEntry pos = posMap[name]; if (action == "?") { @@ -56,13 +56,13 @@ bool PositionAction::Execute(Event& event) return true; } - vector coords = split(action, ','); + std::vector coords = split(action, ','); if (coords.size() == 3) { pos.Set(atoi(coords[0].c_str()), atoi(coords[1].c_str()), atoi(coords[2].c_str()), ai->GetBot()->GetMapId()); posMap[name] = pos; - ostringstream out; out << "Position " << name << " is set"; + std::ostringstream out; out << "Position " << name << " is set"; ai->TellPlayer(requester, out); return true; } @@ -72,7 +72,7 @@ bool PositionAction::Execute(Event& event) pos.Set(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), ai->GetBot()->GetMapId()); posMap[name] = pos; - ostringstream out; out << "Position " << name << " is set"; + std::ostringstream out; out << "Position " << name << " is set"; ai->TellPlayer(requester, out); return true; } @@ -82,7 +82,7 @@ bool PositionAction::Execute(Event& event) pos.Reset(); posMap[name] = pos; - ostringstream out; out << "Position " << name << " is reset"; + std::ostringstream out; out << "Position " << name << " is reset"; ai->TellPlayer(requester, out); return true; } @@ -96,7 +96,7 @@ bool MoveToPositionAction::Execute(Event& event) ai::PositionEntry pos = context->GetValue("position")->Get()[qualifier]; if (!pos.isSet()) { - ostringstream out; out << "Position " << qualifier << " is not set"; + std::ostringstream out; out << "Position " << qualifier << " is not set"; ai->TellPlayer(requester, out); return false; } @@ -107,7 +107,7 @@ bool MoveToPositionAction::Execute(Event& event) bool MoveToPositionAction::isUseful() { ai::PositionEntry pos = context->GetValue("position")->Get()[qualifier]; - float distance = AI_VALUE2(float, "distance", string("position_") + qualifier); + float distance = AI_VALUE2(float, "distance", std::string("position_") + qualifier); return pos.isSet() && distance > ai->GetRange("follow") && IsMovingAllowed(); } diff --git a/playerbot/strategy/actions/PositionAction.h b/playerbot/strategy/actions/PositionAction.h index d796031a..9263747b 100644 --- a/playerbot/strategy/actions/PositionAction.h +++ b/playerbot/strategy/actions/PositionAction.h @@ -14,12 +14,12 @@ namespace ai class MoveToPositionAction : public MovementAction { public: - MoveToPositionAction(PlayerbotAI* ai, string name, string qualifier, bool idle = false) : MovementAction(ai, name), qualifier(qualifier), idle(idle) {} + MoveToPositionAction(PlayerbotAI* ai, std::string name, std::string qualifier, bool idle = false) : MovementAction(ai, name), qualifier(qualifier), idle(idle) {} virtual bool Execute(Event& event); virtual bool isUseful(); protected: - string qualifier; + std::string qualifier; bool idle; }; diff --git a/playerbot/strategy/actions/PullActions.cpp b/playerbot/strategy/actions/PullActions.cpp index c14e87ce..1bec7226 100644 --- a/playerbot/strategy/actions/PullActions.cpp +++ b/playerbot/strategy/actions/PullActions.cpp @@ -1,6 +1,6 @@ #include "playerbot/playerbot.h" -#include "../generic/PullStrategy.h" +#include "playerbot/strategy/generic/PullStrategy.h" #include "playerbot/strategy/values/AttackersValue.h" #include "PullActions.h" #include "playerbot/strategy/values/PositionValue.h" @@ -40,7 +40,7 @@ bool PullRequestAction::Execute(Event& event) if (!strategy->CanDoPullAction(target)) { - ostringstream out; out << "Can't perform pull action '" << strategy->GetPullActionName() << "'"; + std::ostringstream out; out << "Can't perform pull action '" << strategy->GetPullActionName() << "'"; ai->TellPlayerNoFacing(requester, out.str()); return false; } @@ -117,7 +117,7 @@ bool PullStartAction::Execute(Event& event) } -PullAction::PullAction(PlayerbotAI* ai, string name) : CastSpellAction(ai, name) +PullAction::PullAction(PlayerbotAI* ai, std::string name) : CastSpellAction(ai, name) { InitPullAction(); } @@ -144,7 +144,7 @@ bool PullAction::Execute(Event& event) return false; } - string actionName = strategy->GetPullActionName(); + std::string actionName = strategy->GetPullActionName(); // Execute the pull action SET_AI_VALUE(Unit*, "current target", GetTarget()); @@ -174,7 +174,7 @@ bool PullAction::isPossible() PullStrategy* strategy = PullStrategy::Get(ai); if (strategy) { - string spellName = strategy->GetSpellName(); + std::string spellName = strategy->GetSpellName(); Unit* target = strategy->GetTarget(); if (!spellName.empty() && target) { @@ -194,7 +194,7 @@ void PullAction::InitPullAction() PullStrategy* strategy = PullStrategy::Get(ai); if (strategy) { - string spellName = strategy->GetSpellName(); + std::string spellName = strategy->GetSpellName(); if (!spellName.empty()) { SetSpellName(spellName); diff --git a/playerbot/strategy/actions/PullActions.h b/playerbot/strategy/actions/PullActions.h index 4193f2d2..28f76747 100644 --- a/playerbot/strategy/actions/PullActions.h +++ b/playerbot/strategy/actions/PullActions.h @@ -7,7 +7,7 @@ namespace ai class PullRequestAction : public ChatCommandAction { public: - PullRequestAction(PlayerbotAI* ai, string name) : ChatCommandAction(ai, name) {} + PullRequestAction(PlayerbotAI* ai, std::string name) : ChatCommandAction(ai, name) {} protected: virtual bool Execute(Event& event) override; @@ -35,26 +35,26 @@ namespace ai class PullStartAction : public Action { public: - PullStartAction(PlayerbotAI* ai, string name = "pull start") : Action(ai, name) {} + PullStartAction(PlayerbotAI* ai, std::string name = "pull start") : Action(ai, name) {} bool Execute(Event& event) override; }; class PullAction : public CastSpellAction { public: - PullAction(PlayerbotAI* ai, string name = "pull action"); + PullAction(PlayerbotAI* ai, std::string name = "pull action"); bool Execute(Event& event) override; bool isPossible() override; private: void InitPullAction(); - string GetTargetName() override { return "pull target"; } - string GetReachActionName() override { return "reach pull"; } + std::string GetTargetName() override { return "pull target"; } + std::string GetReachActionName() override { return "reach pull"; } }; class PullEndAction : public Action { public: - PullEndAction(PlayerbotAI* ai, string name = "pull end") : Action(ai, name) {} + PullEndAction(PlayerbotAI* ai, std::string name = "pull end") : Action(ai, name) {} bool Execute(Event& event) override; }; } diff --git a/playerbot/strategy/actions/QueryItemUsageAction.cpp b/playerbot/strategy/actions/QueryItemUsageAction.cpp index 7d158a7c..797048f1 100644 --- a/playerbot/strategy/actions/QueryItemUsageAction.cpp +++ b/playerbot/strategy/actions/QueryItemUsageAction.cpp @@ -1,10 +1,10 @@ #include "playerbot/playerbot.h" #include "QueryItemUsageAction.h" -#include "../../../ahbot/AhBot.h" +#include "ahbot/AhBot.h" #include "playerbot/strategy/values/ItemUsageValue.h" #include "playerbot/RandomPlayerbotMgr.h" -#include "../../RandomItemMgr.h" +#include "playerbot/RandomItemMgr.h" using namespace ai; @@ -76,7 +76,7 @@ bool QueryItemUsageAction::Execute(Event& event) if (!required) continue; - sPlayerbotAIConfig.logEvent(ai, "QueryItemUsageAction", questTemplate->GetTitle(), to_string((float)available / (float)required)); + sPlayerbotAIConfig.logEvent(ai, "QueryItemUsageAction", questTemplate->GetTitle(), std::to_string((float)available / (float)required)); } } } @@ -86,8 +86,8 @@ bool QueryItemUsageAction::Execute(Event& event) return true; } - string text = event.getParam(); - set qualifiers = chat->parseItemQualifiers(text); + std::string text = event.getParam(); + std::set qualifiers = chat->parseItemQualifiers(text); for (auto qualifier : qualifiers) { ItemQualifier itemQualifier(qualifier); @@ -103,10 +103,10 @@ uint32 QueryItemUsageAction::GetCount(ItemQualifier& qualifier) IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS); uint32 total = 0; - list items = ai->InventoryParseItems(qualifier.GetProto()->Name1, mask); + std::list items = ai->InventoryParseItems(qualifier.GetProto()->Name1, mask); if (!items.empty()) { - for (list::iterator i = items.begin(); i != items.end(); ++i) + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { total += (*i)->GetCount(); } @@ -114,18 +114,18 @@ uint32 QueryItemUsageAction::GetCount(ItemQualifier& qualifier) return total; } -string QueryItemUsageAction::QueryItem(ItemQualifier& qualifier, uint32 count, uint32 total) +std::string QueryItemUsageAction::QueryItem(ItemQualifier& qualifier, uint32 count, uint32 total) { - ostringstream out; + std::ostringstream out; #ifdef CMANGOS - string usage = QueryItemUsage(qualifier); + std::string usage = QueryItemUsage(qualifier); #endif #ifdef MANGOS bool usage = QueryItemUsage(item); #endif - string quest = QueryQuestItem(qualifier.GetId()); - string price = QueryItemPrice(qualifier); - string power = QueryItemPower(qualifier); + std::string quest = QueryQuestItem(qualifier.GetId()); + std::string price = QueryItemPrice(qualifier); + std::string power = QueryItemPower(qualifier); #ifdef CMANGOS if (usage.empty()) #endif @@ -144,7 +144,7 @@ string QueryItemUsageAction::QueryItem(ItemQualifier& qualifier, uint32 count, u return out.str(); } -string QueryItemUsageAction::QueryItemUsage(ItemQualifier& qualifier) +std::string QueryItemUsageAction::QueryItemUsage(ItemQualifier& qualifier) { ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", qualifier.GetQualifier()); switch (usage) @@ -182,7 +182,7 @@ string QueryItemUsageAction::QueryItemUsage(ItemQualifier& qualifier) return ""; } -string QueryItemUsageAction::QueryItemPrice(ItemQualifier& qualifier) +std::string QueryItemUsageAction::QueryItemPrice(ItemQualifier& qualifier) { if (!sRandomPlayerbotMgr.IsRandomBot(bot)) return ""; @@ -190,15 +190,15 @@ string QueryItemUsageAction::QueryItemPrice(ItemQualifier& qualifier) if (qualifier.GetProto()->Bonding == BIND_WHEN_PICKED_UP) return ""; - ostringstream msg; + std::ostringstream msg; IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list items = ai->InventoryParseItems(qualifier.GetProto()->Name1, mask); + std::list items = ai->InventoryParseItems(qualifier.GetProto()->Name1, mask); int32 sellPrice = 0; if (!items.empty()) { - for (list::iterator i = items.begin(); i != items.end(); ++i) + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Item* sell = *i; sellPrice += sell->GetCount() * auctionbot.GetSellPrice(sell->GetProto()) * sRandomPlayerbotMgr.GetSellMultiplier(bot); @@ -222,7 +222,7 @@ string QueryItemUsageAction::QueryItemPrice(ItemQualifier& qualifier) return msg.str(); } -string QueryItemUsageAction::QueryQuestItem(uint32 itemId) +std::string QueryItemUsageAction::QueryQuestItem(uint32 itemId) { Player *bot = ai->GetBot(); QuestStatusMap& questMap = bot->getQuestStatusMap(); @@ -237,7 +237,7 @@ string QueryItemUsageAction::QueryQuestItem(uint32 itemId) if (status == QUEST_STATUS_INCOMPLETE || (status == QUEST_STATUS_COMPLETE && !bot->GetQuestRewardStatus(questId))) { QuestStatusData const& questStatus = i->second; - string usage = QueryQuestItem(itemId, questTemplate, &questStatus); + std::string usage = QueryQuestItem(itemId, questTemplate, &questStatus); if (!usage.empty()) return usage; } } @@ -246,7 +246,7 @@ string QueryItemUsageAction::QueryQuestItem(uint32 itemId) } -string QueryItemUsageAction::QueryQuestItem(uint32 itemId, const Quest *questTemplate, const QuestStatusData *questStatus) +std::string QueryItemUsageAction::QueryQuestItem(uint32 itemId, const Quest *questTemplate, const QuestStatusData *questStatus) { for (int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { @@ -265,7 +265,7 @@ string QueryItemUsageAction::QueryQuestItem(uint32 itemId, const Quest *questTem return ""; } -string QueryItemUsageAction::QueryItemPower(ItemQualifier& qualifier) +std::string QueryItemUsageAction::QueryItemPower(ItemQualifier& qualifier) { uint32 power = sRandomItemMgr.ItemStatWeight(bot, qualifier); @@ -273,10 +273,10 @@ string QueryItemUsageAction::QueryItemPower(ItemQualifier& qualifier) if (power) { - ostringstream out; + std::ostringstream out; char color[32]; sprintf(color, "%x", ItemQualityColors[qualifier.GetProto()->Quality]); - out << "power: |h|c" << color << "|h" << to_string(power) << "|h|cffffffff"; + out << "power: |h|c" << color << "|h" << std::to_string(power) << "|h|cffffffff"; return out.str().c_str(); } diff --git a/playerbot/strategy/actions/QueryItemUsageAction.h b/playerbot/strategy/actions/QueryItemUsageAction.h index d5cb645a..0fc11dce 100644 --- a/playerbot/strategy/actions/QueryItemUsageAction.h +++ b/playerbot/strategy/actions/QueryItemUsageAction.h @@ -8,19 +8,19 @@ namespace ai class QueryItemUsageAction : public ChatCommandAction { public: - QueryItemUsageAction(PlayerbotAI* ai, string name = "query item usage") : ChatCommandAction(ai, name) {} + QueryItemUsageAction(PlayerbotAI* ai, std::string name = "query item usage") : ChatCommandAction(ai, name) {} protected: virtual bool Execute(Event& event) override; uint32 GetCount(ItemQualifier& qualifier); - string QueryItem(ItemQualifier& qualifier, uint32 count, uint32 total); - string QueryItemUsage(ItemQualifier& qualifier); - string QueryItemPrice(ItemQualifier& qualifier); - string QueryQuestItem(uint32 itemId, const Quest *questTemplate, const QuestStatusData *questStatus); - string QueryQuestItem(uint32 itemId); - string QueryItemPower(ItemQualifier& qualifier); + std::string QueryItem(ItemQualifier& qualifier, uint32 count, uint32 total); + std::string QueryItemUsage(ItemQualifier& qualifier); + std::string QueryItemPrice(ItemQualifier& qualifier); + std::string QueryQuestItem(uint32 itemId, const Quest *questTemplate, const QuestStatusData *questStatus); + std::string QueryQuestItem(uint32 itemId); + std::string QueryItemPower(ItemQualifier& qualifier); private: - ostringstream out; + std::ostringstream out; }; } diff --git a/playerbot/strategy/actions/QueryQuestAction.cpp b/playerbot/strategy/actions/QueryQuestAction.cpp index 2d0c2011..c7961208 100644 --- a/playerbot/strategy/actions/QueryQuestAction.cpp +++ b/playerbot/strategy/actions/QueryQuestAction.cpp @@ -31,7 +31,7 @@ bool QueryQuestAction::Execute(Event& event) if (!quest) continue; - if (text.find(quest->GetTitle()) != string::npos) + if (text.find(quest->GetTitle()) != std::string::npos) { questId = quest->GetQuestId(); break; @@ -47,7 +47,7 @@ bool QueryQuestAction::Execute(Event& event) if(questId != bot->GetQuestSlotQuestId(slot)) continue; - ostringstream out; + std::ostringstream out; out << "--- " << chat->formatQuest(sObjectMgr.GetQuestTemplate(questId)) << " "; if (bot->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE) { @@ -64,7 +64,7 @@ bool QueryQuestAction::Execute(Event& event) if (travel) { uint32 limit = 0; - vector allDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, true, -1); + std::vector allDestinations = sTravelMgr.getQuestTravelDestinations(bot, questId, true, true, -1); std::sort(allDestinations.begin(), allDestinations.end(), [botPos](TravelDestination* i, TravelDestination* j) {return i->distanceTo(botPos) < j->distanceTo(botPos); }); @@ -73,7 +73,7 @@ bool QueryQuestAction::Execute(Event& event) if (limit > 50) continue; - ostringstream out; + std::ostringstream out; uint32 tpoints = dest->getPoints(true).size(); uint32 apoints = dest->getPoints().size(); @@ -142,7 +142,7 @@ void QueryQuestAction::TellObjectives(Player* requester, uint32 questId) } } -void QueryQuestAction::TellObjective(Player* requester, const string& name, int available, int required) +void QueryQuestAction::TellObjective(Player* requester, const std::string& name, int available, int required) { ai->TellPlayer(requester, chat->formatQuestObjective(name, available, required), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } \ No newline at end of file diff --git a/playerbot/strategy/actions/QueryQuestAction.h b/playerbot/strategy/actions/QueryQuestAction.h index d9f5e340..8e218381 100644 --- a/playerbot/strategy/actions/QueryQuestAction.h +++ b/playerbot/strategy/actions/QueryQuestAction.h @@ -11,6 +11,6 @@ namespace ai private: bool Execute(Event& event) override; void TellObjectives(Player* requester, uint32 questId); - void TellObjective(Player* requester, const string& name, int available, int required); + void TellObjective(Player* requester, const std::string& name, int available, int required); }; } \ No newline at end of file diff --git a/playerbot/strategy/actions/QuestAction.cpp b/playerbot/strategy/actions/QuestAction.cpp index 99da394e..45ef8ac7 100644 --- a/playerbot/strategy/actions/QuestAction.cpp +++ b/playerbot/strategy/actions/QuestAction.cpp @@ -30,15 +30,15 @@ bool QuestAction::Execute(Event& event) } bool result = false; - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* unit = ai->GetUnit(*i); if (unit && bot->GetDistance(unit) <= INTERACTION_DISTANCE) result |= ProcessQuests(unit); } - list gos = AI_VALUE(list, "nearest game objects"); - for (list::iterator i = gos.begin(); i != gos.end(); i++) + std::list gos = AI_VALUE(std::list, "nearest game objects"); + for (std::list::iterator i = gos.begin(); i != gos.end(); i++) { GameObject* go = ai->GetGameObject(*i); if (go && bot->GetDistance(go) <= INTERACTION_DISTANCE) @@ -199,8 +199,8 @@ bool QuestAction::AcceptQuest(Player* requester, Quest const* quest, uint64 ques bool success = false; const uint32 questId = quest->GetQuestId(); - string outputMessage; - map args; + std::string outputMessage; + std::map args; args["%quest"] = chat->formatQuest(quest); if (bot->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE) @@ -242,7 +242,7 @@ bool QuestAction::AcceptQuest(Player* requester, Quest const* quest, uint64 ques if (bot->GetQuestStatus(questId) != QUEST_STATUS_NONE && bot->GetQuestStatus(questId) != QUEST_STATUS_AVAILABLE) { - sPlayerbotAIConfig.logEvent(ai, "AcceptQuestAction", quest->GetTitle(), to_string(quest->GetQuestId())); + sPlayerbotAIConfig.logEvent(ai, "AcceptQuestAction", quest->GetTitle(), std::to_string(quest->GetQuestId())); outputMessage = BOT_TEXT2("quest_accepted", args); success = true; } @@ -283,6 +283,6 @@ bool QuestObjectiveCompletedAction::Execute(Event& event) } Quest const* qInfo = sObjectMgr.GetQuestTemplate(questId); - sPlayerbotAIConfig.logEvent(ai, "QuestObjectiveCompletedAction", qInfo->GetTitle(), to_string((float)available / (float)required)); + sPlayerbotAIConfig.logEvent(ai, "QuestObjectiveCompletedAction", qInfo->GetTitle(), std::to_string((float)available / (float)required)); return false; } diff --git a/playerbot/strategy/actions/QuestAction.h b/playerbot/strategy/actions/QuestAction.h index 658d1d04..25044511 100644 --- a/playerbot/strategy/actions/QuestAction.h +++ b/playerbot/strategy/actions/QuestAction.h @@ -8,7 +8,7 @@ namespace ai class QuestAction : public Action { public: - QuestAction(PlayerbotAI* ai, string name) : Action(ai, name) {} + QuestAction(PlayerbotAI* ai, std::string name) : Action(ai, name) {} public: virtual bool Execute(Event& event); diff --git a/playerbot/strategy/actions/QuestRewardActions.cpp b/playerbot/strategy/actions/QuestRewardActions.cpp index 423fb8a3..d21f3e56 100644 --- a/playerbot/strategy/actions/QuestRewardActions.cpp +++ b/playerbot/strategy/actions/QuestRewardActions.cpp @@ -21,7 +21,7 @@ bool QuestRewardAction::Execute(Event& event) } else if (event.getParam() == "?") { auto currentQuestRewardOption = static_cast(AI_VALUE(uint8, "quest reward")); - ostringstream out; + std::ostringstream out; out << "Current: |cff00ff00"; switch (currentQuestRewardOption) { case QuestRewardOptionType::QUEST_REWARD_OPTION_AUTO: diff --git a/playerbot/strategy/actions/RangeAction.cpp b/playerbot/strategy/actions/RangeAction.cpp index cf7cecef..a5b4af4c 100644 --- a/playerbot/strategy/actions/RangeAction.cpp +++ b/playerbot/strategy/actions/RangeAction.cpp @@ -8,7 +8,7 @@ using namespace ai; bool RangeAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string param = event.getParam(); + std::string param = event.getParam(); if (param == "?") { PrintRange("spell", requester); @@ -20,15 +20,15 @@ bool RangeAction::Execute(Event& event) PrintRange("attack", requester); } int pos = param.find(" "); - if (pos == string::npos) return false; + if (pos == std::string::npos) return false; - string qualifier = param.substr(0, pos); - string value = param.substr(pos + 1); + std::string qualifier = param.substr(0, pos); + std::string value = param.substr(pos + 1); if (value == "?") { float curVal = AI_VALUE2(float, "range", qualifier); - ostringstream out; + std::ostringstream out; out << qualifier << " range: "; if (abs(curVal) >= 0.1f) out << curVal; else out << ai->GetRange(qualifier) << " (default)"; @@ -39,17 +39,17 @@ bool RangeAction::Execute(Event& event) float newVal = (float) atof(value.c_str()); context->GetValue("range", qualifier)->Set(newVal); - ostringstream out; + std::ostringstream out; out << qualifier << " range set to: " << newVal; ai->TellPlayer(requester, out.str()); return true; } -void RangeAction::PrintRange(string type, Player* requester) +void RangeAction::PrintRange(std::string type, Player* requester) { float curVal = AI_VALUE2(float, "range", type); - ostringstream out; + std::ostringstream out; out << type << " range: "; if (abs(curVal) >= 0.1f) out << curVal; else out << ai->GetRange(type) << " (default)"; diff --git a/playerbot/strategy/actions/RangeAction.h b/playerbot/strategy/actions/RangeAction.h index 8fa1fe38..246ae825 100644 --- a/playerbot/strategy/actions/RangeAction.h +++ b/playerbot/strategy/actions/RangeAction.h @@ -10,6 +10,6 @@ namespace ai virtual bool Execute(Event& event) override; private: - void PrintRange(string type, Player* requester); + void PrintRange(std::string type, Player* requester); }; } diff --git a/playerbot/strategy/actions/ReachTargetActions.h b/playerbot/strategy/actions/ReachTargetActions.h index 7c9feb90..61e63846 100644 --- a/playerbot/strategy/actions/ReachTargetActions.h +++ b/playerbot/strategy/actions/ReachTargetActions.h @@ -4,8 +4,8 @@ #include "MovementActions.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/ServerFacade.h" -#include "../generic/PullStrategy.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/generic/PullStrategy.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "playerbot/strategy/values/MoveStyleValue.h" #include "GenericSpellActions.h" @@ -14,9 +14,9 @@ namespace ai class ReachTargetAction : public MovementAction, public Qualified { public: - ReachTargetAction(PlayerbotAI* ai, string name, float range = 0.0f) : MovementAction(ai, name), Qualified(), range(range), spellName("") {} + ReachTargetAction(PlayerbotAI* ai, std::string name, float range = 0.0f) : MovementAction(ai, name), Qualified(), range(range), spellName("") {} - virtual void Qualify(const string& qualifier) override + virtual void Qualify(const std::string& qualifier) override { Qualified::Qualify(qualifier); @@ -104,16 +104,16 @@ namespace ai return false; } - virtual string GetTargetName() override { return "current target"; } - string GetSpellName() const { return spellName; } + virtual std::string GetTargetName() override { return "current target"; } + std::string GetSpellName() const { return spellName; } virtual Unit* GetTarget() override { // Get the target from the qualifiers if (!qualifier.empty()) { - string targetQualifier; - const string targetName = Qualified::getMultiQualifierStr(qualifier, 1, "::"); + std::string targetQualifier; + const std::string targetName = Qualified::getMultiQualifierStr(qualifier, 1, "::"); if (targetName != "current target") { targetQualifier = Qualified::getMultiQualifierStr(qualifier, 2, "::"); @@ -129,13 +129,13 @@ namespace ai protected: float range; - string spellName; + std::string spellName; }; class CastReachTargetSpellAction : public CastSpellAction { public: - CastReachTargetSpellAction(PlayerbotAI* ai, string spell, float distance) : CastSpellAction(ai, spell), distance(distance) {} + CastReachTargetSpellAction(PlayerbotAI* ai, std::string spell, float distance) : CastSpellAction(ai, spell), distance(distance) {} virtual bool isUseful() override { @@ -174,7 +174,7 @@ namespace ai } } - void Qualify(const string& qualifier) override + void Qualify(const std::string& qualifier) override { ReachTargetAction::Qualify(qualifier); @@ -183,13 +183,13 @@ namespace ai range = range > threshold ? range - threshold : range; } - string GetTargetName() override { return "pull target"; } + std::string GetTargetName() override { return "pull target"; } }; class ReachPartyMemberToHealAction : public ReachTargetAction { public: ReachPartyMemberToHealAction(PlayerbotAI* ai) : ReachTargetAction(ai, "reach party member to heal", ai->GetRange("heal")) {} - virtual string GetTargetName() override { return "party member to heal"; } + virtual std::string GetTargetName() override { return "party member to heal"; } }; } diff --git a/playerbot/strategy/actions/ReadyCheckAction.cpp b/playerbot/strategy/actions/ReadyCheckAction.cpp index 8125a2cf..4eec230a 100644 --- a/playerbot/strategy/actions/ReadyCheckAction.cpp +++ b/playerbot/strategy/actions/ReadyCheckAction.cpp @@ -6,11 +6,11 @@ using namespace ai; -string formatPercent(string name, uint8 value, float percent) +std::string formatPercent(std::string name, uint8 value, float percent) { - ostringstream out; + std::ostringstream out; - string color; + std::string color; if (percent > 75) color = "|cff00ff00"; else if (percent > 50) @@ -26,13 +26,13 @@ class ReadyChecker { public: virtual bool Check(Player* requester, PlayerbotAI *ai, AiObjectContext* context) = 0; - virtual string GetName() = 0; + virtual std::string GetName() = 0; virtual bool PrintAlways() { return true; } - static list checkers; + static std::list checkers; }; -list ReadyChecker::checkers; +std::list ReadyChecker::checkers; class HealthChecker : public ReadyChecker { @@ -42,7 +42,7 @@ class HealthChecker : public ReadyChecker return AI_VALUE2(uint8, "health", "self target") > sPlayerbotAIConfig.almostFullHealth; } - virtual string GetName() { return "HP"; } + virtual std::string GetName() { return "HP"; } }; class ManaChecker : public ReadyChecker @@ -52,7 +52,7 @@ class ManaChecker : public ReadyChecker { return !AI_VALUE2(bool, "has mana", "self target") || AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig.mediumHealth; } - virtual string GetName() { return "MP"; } + virtual std::string GetName() { return "MP"; } }; class DistanceChecker : public ReadyChecker @@ -74,7 +74,7 @@ class DistanceChecker : public ReadyChecker } virtual bool PrintAlways() { return false; } - virtual string GetName() { return "Far away"; } + virtual std::string GetName() { return "Far away"; } }; class HunterChecker : public ReadyChecker @@ -108,30 +108,30 @@ class HunterChecker : public ReadyChecker } virtual bool PrintAlways() { return false; } - virtual string GetName() { return "Far away"; } + virtual std::string GetName() { return "Far away"; } }; class ItemCountChecker : public ReadyChecker { public: - ItemCountChecker(string item, string name) { this->item = item; this->name = name; } + ItemCountChecker(std::string item, std::string name) { this->item = item; this->name = name; } bool Check(Player* requester, PlayerbotAI *ai, AiObjectContext* context) override { return AI_VALUE2(uint32, "item count", item) > 0; } - virtual string GetName() { return name; } + virtual std::string GetName() { return name; } private: - string item, name; + std::string item, name; }; class ManaPotionChecker : public ItemCountChecker { public: - ManaPotionChecker(string item, string name) : ItemCountChecker(item, name) {} + ManaPotionChecker(std::string item, std::string name) : ItemCountChecker(item, name) {} bool Check(Player* requester, PlayerbotAI *ai, AiObjectContext* context) override { @@ -171,14 +171,14 @@ bool ReadyCheckAction::ReadyCheck(Player* requester) } bool result = true; - for (list::iterator i = ReadyChecker::checkers.begin(); i != ReadyChecker::checkers.end(); ++i) + for (std::list::iterator i = ReadyChecker::checkers.begin(); i != ReadyChecker::checkers.end(); ++i) { ReadyChecker* checker = *i; bool ok = checker->Check(requester, ai, context); result = result && ok; } - ostringstream out; + std::ostringstream out; uint32 hp = AI_VALUE2(uint32, "item count", "healing potion"); out << formatPercent("Hp", hp, 100.0 * hp / 5); diff --git a/playerbot/strategy/actions/ReadyCheckAction.h b/playerbot/strategy/actions/ReadyCheckAction.h index 83264f4e..06736916 100644 --- a/playerbot/strategy/actions/ReadyCheckAction.h +++ b/playerbot/strategy/actions/ReadyCheckAction.h @@ -6,7 +6,7 @@ namespace ai class ReadyCheckAction : public Action { public: - ReadyCheckAction(PlayerbotAI* ai, string name = "ready check") : Action(ai, name) {} + ReadyCheckAction(PlayerbotAI* ai, std::string name = "ready check") : Action(ai, name) {} virtual bool Execute(Event& event) override; protected: diff --git a/playerbot/strategy/actions/ReleaseSpiritAction.h b/playerbot/strategy/actions/ReleaseSpiritAction.h index c5590856..ff7f6e48 100644 --- a/playerbot/strategy/actions/ReleaseSpiritAction.h +++ b/playerbot/strategy/actions/ReleaseSpiritAction.h @@ -11,7 +11,7 @@ namespace ai class ReleaseSpiritAction : public ChatCommandAction { public: - ReleaseSpiritAction(PlayerbotAI* ai, string name = "release") : ChatCommandAction(ai, name) {} + ReleaseSpiritAction(PlayerbotAI* ai, std::string name = "release") : ChatCommandAction(ai, name) {} public: virtual bool Execute(Event& event) override @@ -52,7 +52,7 @@ namespace ai class AutoReleaseSpiritAction : public ReleaseSpiritAction { public: - AutoReleaseSpiritAction(PlayerbotAI* ai, string name = "auto release") : ReleaseSpiritAction(ai, name) {} + AutoReleaseSpiritAction(PlayerbotAI* ai, std::string name = "auto release") : ReleaseSpiritAction(ai, name) {} virtual bool Execute(Event& event) override { @@ -121,7 +121,7 @@ namespace ai class RepopAction : public SpiritHealerAction { public: - RepopAction(PlayerbotAI* ai, string name = "repop") : SpiritHealerAction(ai, name) {} + RepopAction(PlayerbotAI* ai, std::string name = "repop") : SpiritHealerAction(ai, name) {} public: virtual bool Execute(Event& event) @@ -175,7 +175,7 @@ namespace ai class SelfResurrectAction : public ChatCommandAction { public: - SelfResurrectAction(PlayerbotAI* ai, string name = "self resurrect") : ChatCommandAction(ai, name) {} + SelfResurrectAction(PlayerbotAI* ai, std::string name = "self resurrect") : ChatCommandAction(ai, name) {} public: bool Execute(Event& event) override diff --git a/playerbot/strategy/actions/RepairAllAction.cpp b/playerbot/strategy/actions/RepairAllAction.cpp index 67579ff6..23a4c89b 100644 --- a/playerbot/strategy/actions/RepairAllAction.cpp +++ b/playerbot/strategy/actions/RepairAllAction.cpp @@ -9,8 +9,8 @@ using namespace ai; bool RepairAllAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Creature *unit = bot->GetNPCIfCanInteractWith(*i, UNIT_NPC_FLAG_REPAIR); if (!unit) @@ -70,13 +70,13 @@ bool RepairAllAction::Execute(Event& event) if (totalCost > 0) { - ostringstream out; + std::ostringstream out; out << "Repair: " << chat->formatMoney(totalCost) << " (" << unit->GetName() << ")"; ai->TellPlayerNoFacing(requester, out.str(),PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); if (sPlayerbotAIConfig.globalSoundEffects) bot->PlayDistanceSound(1116); - sPlayerbotAIConfig.logEvent(ai, "RepairAllAction", to_string(durability), to_string(totalCost)); + sPlayerbotAIConfig.logEvent(ai, "RepairAllAction", std::to_string(durability), std::to_string(totalCost)); ai->DoSpecificAction("equip upgrades", event, true); } diff --git a/playerbot/strategy/actions/ResetAiAction.cpp b/playerbot/strategy/actions/ResetAiAction.cpp index df4b217e..fb30f096 100644 --- a/playerbot/strategy/actions/ResetAiAction.cpp +++ b/playerbot/strategy/actions/ResetAiAction.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "ResetAiAction.h" -#include "../../PlayerbotDbStore.h" +#include "playerbot/PlayerbotDbStore.h" using namespace ai; @@ -36,17 +36,17 @@ void ResetAiAction::ResetValues() auto results = CharacterDatabase.PQuery("SELECT `value` FROM `ai_playerbot_db_store` WHERE `guid` = '%lu' and `key` = 'value'", guid); if (results) { - list values; + std::list values; do { Field* fields = results->Fetch(); - string val = fields[0].GetString(); + std::string val = fields[0].GetString(); - vector parts = split(val, '>'); + std::vector parts = split(val, '>'); if (parts.size() != 2) continue; - string name = parts[0]; - string text = parts[1]; + std::string name = parts[0]; + std::string text = parts[1]; UntypedValue* value = context->GetUntypedValue(name); if (!value) continue; diff --git a/playerbot/strategy/actions/ResetAiAction.h b/playerbot/strategy/actions/ResetAiAction.h index e97ce64a..e1b0fd71 100644 --- a/playerbot/strategy/actions/ResetAiAction.h +++ b/playerbot/strategy/actions/ResetAiAction.h @@ -6,18 +6,18 @@ namespace ai class ResetAiAction : public ChatCommandAction { public: - ResetAiAction(PlayerbotAI* ai, bool fullReset = true, string name = "reset ai") : ChatCommandAction(ai, name), fullReset(fullReset) {} + ResetAiAction(PlayerbotAI* ai, bool fullReset = true, std::string name = "reset ai") : ChatCommandAction(ai, name), fullReset(fullReset) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "reset ai"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "reset ai"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "Reset the bot to it's initial state.\n" "Saved settings and values will be cleared."; } - virtual vector GetUsedActions() { return { "reset strats" , "reset values" }; } - virtual vector GetUsedValues() { return {}; } + virtual std::vector GetUsedActions() { return { "reset strats" , "reset values" }; } + virtual std::vector GetUsedValues() { return {}; } #endif protected: virtual void ResetStrategies(); @@ -28,53 +28,53 @@ namespace ai class ResetStratsAction : public ResetAiAction { public: - ResetStratsAction(PlayerbotAI* ai, string name = "reset strats", bool fullReset = true) : ResetAiAction(ai, fullReset, name) {} + ResetStratsAction(PlayerbotAI* ai, std::string name = "reset strats", bool fullReset = true) : ResetAiAction(ai, fullReset, name) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "reset strats"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "reset strats"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "Reset the strategies of the bot to the standard values.\n" "Saved strategies will be cleared."; } - virtual vector GetUsedActions() { return {"reset ai"}; } - virtual vector GetUsedValues() { return {}; } + virtual std::vector GetUsedActions() { return {"reset ai"}; } + virtual std::vector GetUsedValues() { return {}; } #endif }; class ResetValuesAction : public ResetAiAction { public: - ResetValuesAction(PlayerbotAI* ai, string name = "reset values", bool fullReset = true) : ResetAiAction(ai, fullReset, name) {} + ResetValuesAction(PlayerbotAI* ai, std::string name = "reset values", bool fullReset = true) : ResetAiAction(ai, fullReset, name) {} virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "reset values"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "reset values"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "Reset the settings of the bot to the default values.\n" "Saved values will be cleared."; } - virtual vector GetUsedActions() { return { "reset ai" }; } - virtual vector GetUsedValues() { return {}; } + virtual std::vector GetUsedActions() { return { "reset ai" }; } + virtual std::vector GetUsedValues() { return {}; } #endif }; class ResetAction : public Action { public: - ResetAction(PlayerbotAI* ai, string name = "reset") : Action(ai, name) {} + ResetAction(PlayerbotAI* ai, std::string name = "reset") : Action(ai, name) {} virtual bool Execute(Event& event) override { ai->Reset(true); return true; }; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "reset"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "reset"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "Reset internal buffers to clear current behavior."; } - virtual vector GetUsedActions() { return { "reset ai" }; } - virtual vector GetUsedValues() { return {}; } + virtual std::vector GetUsedActions() { return { "reset ai" }; } + virtual std::vector GetUsedValues() { return {}; } #endif }; } diff --git a/playerbot/strategy/actions/RevealGatheringItemAction.cpp b/playerbot/strategy/actions/RevealGatheringItemAction.cpp index b75467a4..072f44f1 100644 --- a/playerbot/strategy/actions/RevealGatheringItemAction.cpp +++ b/playerbot/strategy/actions/RevealGatheringItemAction.cpp @@ -35,13 +35,13 @@ bool RevealGatheringItemAction::Execute(Event& event) if (!bot->GetGroup()) return false; - list targets; + std::list targets; AnyGameObjectInObjectRangeCheck u_check(bot, sPlayerbotAIConfig.grindDistance); GameObjectListSearcher searcher(targets, u_check); Cell::VisitAllObjects((const WorldObject*)bot, searcher, sPlayerbotAIConfig.reactDistance); - vector result; - for(list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) + std::vector result; + for(std::list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { GameObject* go = *tIter; if (!go || !sServerFacade.isSpawned(go) || @@ -55,7 +55,7 @@ bool RevealGatheringItemAction::Execute(Event& event) if (lockInfo->Type[i] == LOCK_KEY_SKILL) { uint32 skillId = SkillByLockType(LockType(lockInfo->Index[i])); - uint32 reqSkillValue = max((uint32)2, lockInfo->Skill[i]); + uint32 reqSkillValue = std::max((uint32)2, lockInfo->Skill[i]); if ((skillId == SKILL_MINING || skillId == SKILL_HERBALISM) && ai->HasSkill((SkillType)skillId) && uint32(bot->GetSkillValue(skillId)) >= reqSkillValue) { @@ -76,7 +76,7 @@ bool RevealGatheringItemAction::Execute(Event& event) GameObject *go = result[urand(0, result.size() - 1)]; if (!go) return false; - ostringstream msg; + std::ostringstream msg; msg << "I see a " << ChatHelper::formatGameobject(go) << ". "; switch (go->GetGoType()) { diff --git a/playerbot/strategy/actions/ReviveFromCorpseAction.cpp b/playerbot/strategy/actions/ReviveFromCorpseAction.cpp index 764d157e..a66a4a74 100644 --- a/playerbot/strategy/actions/ReviveFromCorpseAction.cpp +++ b/playerbot/strategy/actions/ReviveFromCorpseAction.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "ReviveFromCorpseAction.h" -#include "../../PlayerbotFactory.h" +#include "playerbot/PlayerbotFactory.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/FleeManager.h" #include "playerbot/TravelMgr.h" @@ -115,7 +115,7 @@ bool FindCorpseAction::Execute(Event& event) return false; else { - list units = AI_VALUE(list, "possible targets no los"); + std::list units = AI_VALUE(std::list, "possible targets no los"); if (botPos.getUnitsAggro(units, bot) == 0) //There are no mobs near. return false; @@ -148,7 +148,7 @@ bool FindCorpseAction::Execute(Event& event) if (!ai->AllowActivity(DETAILED_MOVE_ACTIVITY) && !ai->HasPlayerNearby(moveToPos)) { uint32 delay = sServerFacade.GetDistance2d(bot, corpse) / bot->GetSpeed(MOVE_RUN); //Time a bot would take to travel to it's corpse. - delay = min(delay, uint32(10 * MINUTE)); //Cap time to get to corpse at 10 minutes. + delay = std::min(delay, uint32(10 * MINUTE)); //Cap time to get to corpse at 10 minutes. if (deadTime > delay) { @@ -205,8 +205,8 @@ bool SpiritHealerAction::Execute(Event& event) if (grave && grave.fDist(bot) < sPlayerbotAIConfig.sightDistance) { bool foundSpiritHealer = false; - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* unit = ai->GetUnit(*i); if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER)) @@ -257,7 +257,7 @@ bool SpiritHealerAction::Execute(Event& event) //Time a bot would take to travel to it's corpse. uint32 delay = sServerFacade.GetDistance2d(bot, corpse) / bot->GetSpeed(MOVE_RUN); //Cap time to get to corpse at 10 minutes. - delay = min(delay, uint32(10 * MINUTE)); + delay = std::min(delay, uint32(10 * MINUTE)); shouldTeleportToGY = deadTime > delay; } diff --git a/playerbot/strategy/actions/ReviveFromCorpseAction.h b/playerbot/strategy/actions/ReviveFromCorpseAction.h index 94576cb5..89135fe8 100644 --- a/playerbot/strategy/actions/ReviveFromCorpseAction.h +++ b/playerbot/strategy/actions/ReviveFromCorpseAction.h @@ -21,7 +21,7 @@ namespace ai class SpiritHealerAction : public MovementAction { public: - SpiritHealerAction(PlayerbotAI* ai, string name = "spirit healer") : MovementAction(ai,name) {} + SpiritHealerAction(PlayerbotAI* ai, std::string name = "spirit healer") : MovementAction(ai,name) {} virtual bool Execute(Event& event); virtual bool isUseful(); }; diff --git a/playerbot/strategy/actions/RewardAction.cpp b/playerbot/strategy/actions/RewardAction.cpp index 63d0d57d..489507f7 100644 --- a/playerbot/strategy/actions/RewardAction.cpp +++ b/playerbot/strategy/actions/RewardAction.cpp @@ -9,7 +9,7 @@ using namespace ai; bool RewardAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string link = event.getParam(); + std::string link = event.getParam(); ItemIds itemIds = chat->parseItems(link); if (itemIds.empty()) @@ -18,8 +18,8 @@ bool RewardAction::Execute(Event& event) } uint32 itemId = *itemIds.begin(); - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* npc = ai->GetUnit(*i); if (npc && Reward(requester, itemId, npc)) @@ -28,8 +28,8 @@ bool RewardAction::Execute(Event& event) } } - list gos = AI_VALUE(list, "nearest game objects"); - for (list::iterator i = gos.begin(); i != gos.end(); i++) + std::list gos = AI_VALUE(std::list, "nearest game objects"); + for (std::list::iterator i = gos.begin(); i != gos.end(); i++) { GameObject* go = ai->GetGameObject(*i); if (go && Reward(requester, itemId, go)) @@ -73,7 +73,7 @@ bool RewardAction::Reward(Player* requester, uint32 itemId, Object* questGiver) { bot->RewardQuest(pQuest, rewardIdx, questGiver, false); - map args; + std::map args; args["%item"] = chat->formatItem(pRewardItem); ai->TellPlayer(requester, BOT_TEXT2("quest_choose_reward", args)); diff --git a/playerbot/strategy/actions/RpgAction.cpp b/playerbot/strategy/actions/RpgAction.cpp index 4bde2f0c..16daa14d 100644 --- a/playerbot/strategy/actions/RpgAction.cpp +++ b/playerbot/strategy/actions/RpgAction.cpp @@ -34,15 +34,15 @@ bool RpgAction::Execute(Event& event) bool RpgAction::isUseful() { - return (AI_VALUE(string, "next rpg action").empty() || AI_VALUE(string, "next rpg action") == "rpg") && AI_VALUE(GuidPosition, "rpg target"); + return (AI_VALUE(std::string, "next rpg action").empty() || AI_VALUE(std::string, "next rpg action") == "rpg") && AI_VALUE(GuidPosition, "rpg target"); } bool RpgAction::SetNextRpgAction() { Strategy* rpgStrategy; - vector actions; - vector relevances; - list triggerNodes; + std::vector actions; + std::vector relevances; + std::list triggerNodes; for (auto& strategy : ai->GetAiObjectContext()->GetSupportedStrategies()) { @@ -92,7 +92,7 @@ bool RpgAction::SetNextRpgAction() } } - for (list::iterator i = triggerNodes.begin(); i != triggerNodes.end(); i++) + for (std::list::iterator i = triggerNodes.begin(); i != triggerNodes.end(); i++) { TriggerNode* trigger = *i; delete trigger; @@ -105,18 +105,18 @@ bool RpgAction::SetNextRpgAction() if (ai->HasStrategy("debug rpg", BotState::BOT_STATE_NON_COMBAT)) { - vector> sortedActions; + std::vector> sortedActions; for (int i = 0; i < actions.size(); i++) - sortedActions.push_back(make_pair(actions[i], relevances[i])); + sortedActions.push_back(std::make_pair(actions[i], relevances[i])); - std::sort(sortedActions.begin(), sortedActions.end(), [](pairi, pair j) {return i.second > j.second; }); + std::sort(sortedActions.begin(), sortedActions.end(), [](std::pairi, std::pair j) {return i.second > j.second; }); ai->TellPlayerNoFacing(GetMaster(), "------" + chat->formatWorldobject(AI_VALUE(GuidPosition, "rpg target").GetWorldObject()) + "------"); for (auto action : sortedActions) { - ostringstream out; + std::ostringstream out; out << " " << action.first->getName() << " " << action.second; @@ -132,7 +132,7 @@ bool RpgAction::SetNextRpgAction() if ((ai->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT) || ai->HasStrategy("debug rpg", BotState::BOT_STATE_NON_COMBAT))) { - ostringstream out; + std::ostringstream out; out << "do: "; out << chat->formatWorldobject(AI_VALUE(GuidPosition, "rpg target").GetWorldObject()); @@ -141,7 +141,7 @@ bool RpgAction::SetNextRpgAction() ai->TellPlayerNoFacing(GetMaster(), out); } - SET_AI_VALUE(string, "next rpg action", action->getName()); + SET_AI_VALUE(std::string, "next rpg action", action->getName()); return true; } @@ -151,14 +151,14 @@ bool RpgAction::AddIgnore(ObjectGuid guid) if (HasIgnore(guid)) return false; - set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); + std::set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); ignoreList.insert(guid); if (ignoreList.size() > 50) ignoreList.erase(ignoreList.begin()); - context->GetValue&>("ignore rpg target")->Set(ignoreList); + context->GetValue&>("ignore rpg target")->Set(ignoreList); return true; } @@ -168,18 +168,18 @@ bool RpgAction::RemIgnore(ObjectGuid guid) if (!HasIgnore(guid)) return false; - set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); + std::set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); ignoreList.erase(ignoreList.find(guid)); - context->GetValue&>("ignore rpg target")->Set(ignoreList); + context->GetValue&>("ignore rpg target")->Set(ignoreList); return true; } bool RpgAction::HasIgnore(ObjectGuid guid) { - set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); + std::set& ignoreList = context->GetValue&>("ignore rpg target")->Get(); if (ignoreList.empty()) return false; diff --git a/playerbot/strategy/actions/RpgAction.h b/playerbot/strategy/actions/RpgAction.h index 0f350b9f..64a3a314 100644 --- a/playerbot/strategy/actions/RpgAction.h +++ b/playerbot/strategy/actions/RpgAction.h @@ -7,7 +7,7 @@ namespace ai { class RpgAction : public MovementAction { public: - RpgAction(PlayerbotAI* ai, string name = "rpg") : MovementAction(ai, name) {} + RpgAction(PlayerbotAI* ai, std::string name = "rpg") : MovementAction(ai, name) {} virtual bool Execute(Event& event); virtual bool isUseful(); diff --git a/playerbot/strategy/actions/RpgSubActions.cpp b/playerbot/strategy/actions/RpgSubActions.cpp index 285b9801..c5330572 100644 --- a/playerbot/strategy/actions/RpgSubActions.cpp +++ b/playerbot/strategy/actions/RpgSubActions.cpp @@ -23,12 +23,12 @@ void RpgHelper::BeforeExecute() setFacing(guidP()); } -void RpgHelper::AfterExecute(bool doDelay, bool waitForGroup, string nextAction) +void RpgHelper::AfterExecute(bool doDelay, bool waitForGroup, std::string nextAction) { if ((ai->HasRealPlayerMaster() || bot->GetGroup() || !urand(0,5)) && nextAction == "rpg") nextAction = "rpg cancel"; - SET_AI_VALUE(string, "next rpg action", nextAction); + SET_AI_VALUE(std::string, "next rpg action", nextAction); if(doDelay) setDelay(waitForGroup); @@ -146,7 +146,7 @@ bool RpgTaxiAction::Execute(Event& event) uint32 node = sObjectMgr.GetNearestTaxiNode(guidP.getX(), guidP.getY(), guidP.getZ(), guidP.getMapId(), bot->GetTeam()); - vector nodes; + std::vector nodes; for (uint32 i = 0; i < sTaxiPathStore.GetNumRows(); ++i) { TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i); @@ -276,14 +276,14 @@ bool RpgTradeUsefulAction::Execute(Event& event) if (!player) return false; - list items = AI_VALUE(list, "items useful to give"); + std::list items = AI_VALUE(std::list, "items useful to give"); if (items.empty()) return false; Item* item = items.front(); - ostringstream param; + std::ostringstream param; param << chat->formatWorldobject(player); param << " "; @@ -377,13 +377,13 @@ bool RpgItemAction::Execute(Event& event) if (guidP.IsUnit()) unit = guidP.GetUnit(); - list questItems = AI_VALUE2(list, "inventory items", "quest"); + std::list questItems = AI_VALUE2(std::list, "inventory items", "quest"); bool used = false; for (auto item : questItems) { - if (AI_VALUE2(bool, "can use item on", Qualified::MultiQualify({ to_string(item->GetProto()->ItemId),guidP.to_string() }, ","))) + if (AI_VALUE2(bool, "can use item on", Qualified::MultiQualify({ std::to_string(item->GetProto()->ItemId),guidP.to_string() }, ","))) { used = UseItem(GetMaster(), item, guidP.IsGameObject() ? guidP : ObjectGuid(), nullptr, unit); } diff --git a/playerbot/strategy/actions/RpgSubActions.h b/playerbot/strategy/actions/RpgSubActions.h index 56d4ab23..5a3eedce 100644 --- a/playerbot/strategy/actions/RpgSubActions.h +++ b/playerbot/strategy/actions/RpgSubActions.h @@ -14,7 +14,7 @@ namespace ai RpgHelper(PlayerbotAI* ai) : AiObject(ai) {} void BeforeExecute(); - void AfterExecute(bool doDelay = true, bool waitForGroup = false, string nextAction = "rpg"); + void AfterExecute(bool doDelay = true, bool waitForGroup = false, std::string nextAction = "rpg"); void OnCancel() { resetFacing(guidP()); if (bot->GetTradeData()) bot->TradeCancel(true); }; virtual GuidPosition guidP() { return AI_VALUE(GuidPosition, "rpg target"); } @@ -31,15 +31,15 @@ namespace ai class RpgEnabled { public: - RpgEnabled(PlayerbotAI* ai) { rpg = make_unique(ai); } + RpgEnabled(PlayerbotAI* ai) { rpg = std::make_unique(ai); } protected: - unique_ptr rpg; + std::unique_ptr rpg; }; class RpgSubAction : public Action, public RpgEnabled { public: - RpgSubAction(PlayerbotAI* ai, string name = "rpg sub") : Action(ai, name), RpgEnabled(ai) {} + RpgSubAction(PlayerbotAI* ai, std::string name = "rpg sub") : Action(ai, name), RpgEnabled(ai) {} //Long range is possible? virtual bool isPossible() { return rpg->guidP() && rpg->guidP().GetWorldObject();} @@ -49,14 +49,14 @@ namespace ai virtual bool Execute(Event& event) { rpg->BeforeExecute(); bool doAction = ai->DoSpecificAction(ActionName(), ActionEvent(event), true); rpg->AfterExecute(doAction, true); DoDelay(); return doAction; } protected: void DoDelay(){ SetDuration(ai->GetAIInternalUpdateDelay()); } - virtual string ActionName() { return "none"; } + virtual std::string ActionName() { return "none"; } virtual Event ActionEvent(Event event) { return event; } }; class RpgStayAction : public RpgSubAction { public: - RpgStayAction(PlayerbotAI* ai, string name = "rpg stay") : RpgSubAction(ai, name) {} + RpgStayAction(PlayerbotAI* ai, std::string name = "rpg stay") : RpgSubAction(ai, name) {} //virtual bool isUseful() { return rpg->InRange() && !ai->HasRealPlayerMaster(); } @@ -66,7 +66,7 @@ namespace ai class RpgWorkAction : public RpgSubAction { public: - RpgWorkAction(PlayerbotAI* ai, string name = "rpg work") : RpgSubAction(ai, name ) {} + RpgWorkAction(PlayerbotAI* ai, std::string name = "rpg work") : RpgSubAction(ai, name ) {} //virtual bool isUseful() { return rpg->InRange() && !ai->HasRealPlayerMaster(); } @@ -76,7 +76,7 @@ namespace ai class RpgEmoteAction : public RpgSubAction { public: - RpgEmoteAction(PlayerbotAI* ai, string name = "rpg emote") : RpgSubAction(ai, name) {} + RpgEmoteAction(PlayerbotAI* ai, std::string name = "rpg emote") : RpgSubAction(ai, name) {} //virtual bool isUseful() { return rpg->InRange() && !ai->HasRealPlayerMaster(); } @@ -86,17 +86,17 @@ namespace ai class RpgCancelAction : public RpgSubAction { public: - RpgCancelAction(PlayerbotAI* ai, string name = "rpg cancel") : RpgSubAction(ai, name) {} + RpgCancelAction(PlayerbotAI* ai, std::string name = "rpg cancel") : RpgSubAction(ai, name) {} virtual bool isUseful() {return rpg->InRange();} - virtual bool Execute(Event& event) { rpg->OnCancel(); AI_VALUE(set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); rpg->AfterExecute(false, false, ""); DoDelay(); return true; }; + virtual bool Execute(Event& event) { rpg->OnCancel(); AI_VALUE(std::set&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target")); RESET_AI_VALUE(GuidPosition, "rpg target"); rpg->AfterExecute(false, false, ""); DoDelay(); return true; }; }; class RpgTaxiAction : public RpgSubAction { public: - RpgTaxiAction(PlayerbotAI* ai, string name = "rpg taxi") : RpgSubAction(ai, name) {} + RpgTaxiAction(PlayerbotAI* ai, std::string name = "rpg taxi") : RpgSubAction(ai, name) {} virtual bool isUseful() { return rpg->InRange() && !ai->HasRealPlayerMaster() && bot->GetGroup(); } @@ -106,7 +106,7 @@ namespace ai class RpgDiscoverAction : public RpgTaxiAction { public: - RpgDiscoverAction(PlayerbotAI* ai, string name = "rpg discover") : RpgTaxiAction(ai,name) {} + RpgDiscoverAction(PlayerbotAI* ai, std::string name = "rpg discover") : RpgTaxiAction(ai,name) {} virtual bool isUseful() { return rpg->InRange(); } @@ -116,70 +116,70 @@ namespace ai class RpgStartQuestAction : public RpgSubAction { public: - RpgStartQuestAction(PlayerbotAI* ai, string name = "rpg start quest") : RpgSubAction(ai, name) {} + RpgStartQuestAction(PlayerbotAI* ai, std::string name = "rpg start quest") : RpgSubAction(ai, name) {} virtual bool Execute(Event& event) { rpg->BeforeExecute(); bool doAction = ai->DoSpecificAction(ActionName(), ActionEvent(event), true); rpg->AfterExecute(doAction, true, ""); DoDelay(); return doAction; } private: - virtual string ActionName() { return "accept all quests"; } + virtual std::string ActionName() { return "accept all quests"; } virtual Event ActionEvent(Event event) {WorldPacket p(CMSG_QUESTGIVER_ACCEPT_QUEST); p << rpg->guid(); p.rpos(0); return Event("rpg action", p); } }; class RpgEndQuestAction : public RpgStartQuestAction { public: - RpgEndQuestAction(PlayerbotAI* ai, string name = "rpg end quest") : RpgStartQuestAction(ai, name) {} + RpgEndQuestAction(PlayerbotAI* ai, std::string name = "rpg end quest") : RpgStartQuestAction(ai, name) {} private: - virtual string ActionName() { return "talk to quest giver"; } + virtual std::string ActionName() { return "talk to quest giver"; } virtual Event ActionEvent(Event event) { WorldPacket p(CMSG_QUESTGIVER_COMPLETE_QUEST); p << rpg->guid(); p.rpos(0); return Event("rpg action", p); } }; class RpgBuyAction : public RpgSubAction { public: - RpgBuyAction(PlayerbotAI* ai, string name = "rpg buy") : RpgSubAction(ai, name) {} + RpgBuyAction(PlayerbotAI* ai, std::string name = "rpg buy") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "buy"; } + virtual std::string ActionName() { return "buy"; } virtual Event ActionEvent(Event event) { return Event("rpg action", "vendor"); } }; class RpgSellAction : public RpgSubAction { public: - RpgSellAction(PlayerbotAI* ai, string name = "rpg sell") : RpgSubAction(ai, name) {} + RpgSellAction(PlayerbotAI* ai, std::string name = "rpg sell") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "sell"; } + virtual std::string ActionName() { return "sell"; } virtual Event ActionEvent(Event event) { return Event("rpg action", "vendor"); } }; class RpgAHSellAction : public RpgSubAction { public: - RpgAHSellAction(PlayerbotAI* ai, string name = "rpg ah sell") : RpgSubAction(ai, name) {} + RpgAHSellAction(PlayerbotAI* ai, std::string name = "rpg ah sell") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "ah"; } + virtual std::string ActionName() { return "ah"; } virtual Event ActionEvent(Event event) { return Event("rpg action", "vendor"); } }; class RpgAHBuyAction : public RpgSubAction { public: - RpgAHBuyAction(PlayerbotAI* ai, string name = "rpg ah buy") : RpgSubAction(ai, name) {} + RpgAHBuyAction(PlayerbotAI* ai, std::string name = "rpg ah buy") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "ah bid"; } + virtual std::string ActionName() { return "ah bid"; } virtual Event ActionEvent(Event event) { return Event("rpg action", "vendor"); } }; class RpgGetMailAction : public RpgSubAction { public: - RpgGetMailAction(PlayerbotAI* ai, string name = "rpg get mail") : RpgSubAction(ai, name) {} + RpgGetMailAction(PlayerbotAI* ai, std::string name = "rpg get mail") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "mail"; } + virtual std::string ActionName() { return "mail"; } virtual Event ActionEvent(Event event) { return Event("rpg action", "take"); } virtual bool Execute(Event& event) { bool doAction = RpgSubAction::Execute(event); if (doAction) ai->DoSpecificAction("equip upgrades", event, true); return doAction; } @@ -188,26 +188,26 @@ namespace ai class RpgRepairAction : public RpgSubAction { public: - RpgRepairAction(PlayerbotAI* ai, string name = "rpg repair") : RpgSubAction(ai, name) {} + RpgRepairAction(PlayerbotAI* ai, std::string name = "rpg repair") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "repair"; } + virtual std::string ActionName() { return "repair"; } }; class RpgTrainAction : public RpgSubAction { public: - RpgTrainAction(PlayerbotAI* ai, string name = "rpg train") : RpgSubAction(ai, name) {} + RpgTrainAction(PlayerbotAI* ai, std::string name = "rpg train") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "trainer"; } + virtual std::string ActionName() { return "trainer"; } virtual Event ActionEvent(Event event) { return Event("rpg action",rpg->guidP()); } }; class RpgHealAction : public RpgSubAction { public: - RpgHealAction(PlayerbotAI* ai, string name = "rpg heal") : RpgSubAction(ai, name) {} + RpgHealAction(PlayerbotAI* ai, std::string name = "rpg heal") : RpgSubAction(ai, name) {} virtual bool Execute(Event& event); }; @@ -215,66 +215,66 @@ namespace ai class RpgHomeBindAction : public RpgSubAction { public: - RpgHomeBindAction(PlayerbotAI* ai, string name = "rpg home bind") : RpgSubAction(ai, name) {} + RpgHomeBindAction(PlayerbotAI* ai, std::string name = "rpg home bind") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "home"; } + virtual std::string ActionName() { return "home"; } }; class RpgQueueBgAction : public RpgSubAction { public: - RpgQueueBgAction(PlayerbotAI* ai, string name = "rpg queue bg") : RpgSubAction(ai, name) {} + RpgQueueBgAction(PlayerbotAI* ai, std::string name = "rpg queue bg") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { SET_AI_VALUE(uint32, "bg type", (uint32)AI_VALUE(BattleGroundTypeId, "rpg bg type")); return "free bg join"; } + virtual std::string ActionName() { SET_AI_VALUE(uint32, "bg type", (uint32)AI_VALUE(BattleGroundTypeId, "rpg bg type")); return "free bg join"; } }; class RpgBuyPetitionAction : public RpgSubAction { public: - RpgBuyPetitionAction(PlayerbotAI* ai, string name = "rpg buy petition") : RpgSubAction(ai, name) {} + RpgBuyPetitionAction(PlayerbotAI* ai, std::string name = "rpg buy petition") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "buy petition"; } + virtual std::string ActionName() { return "buy petition"; } }; class RpgUseAction : public RpgSubAction { public: - RpgUseAction(PlayerbotAI* ai, string name = "rpg use") : RpgSubAction(ai, name) {} + RpgUseAction(PlayerbotAI* ai, std::string name = "rpg use") : RpgSubAction(ai, name) {} virtual bool Execute(Event& event) { rpg->BeforeExecute(); return ai->DoSpecificAction(ActionName(), ActionEvent(event), true); rpg->AfterExecute(true); DoDelay();} private: - virtual string ActionName() { if (rpg->guidP().IsGameObject() && rpg->guidP().GetGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST) return "add all loot"; return "use"; } + virtual std::string ActionName() { if (rpg->guidP().IsGameObject() && rpg->guidP().GetGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST) return "add all loot"; return "use"; } virtual Event ActionEvent(Event event) { return Event("rpg action", chat->formatWorldobject(rpg->guidP().GetWorldObject())); } }; class RpgSpellAction : public RpgSubAction { public: - RpgSpellAction(PlayerbotAI* ai, string name = "rpg spell") : RpgSubAction(ai, name) {} + RpgSpellAction(PlayerbotAI* ai, std::string name = "rpg spell") : RpgSubAction(ai, name) {} private: virtual bool isUseful() { return !urand(0,10); } - virtual string ActionName() { return "cast random spell"; } + virtual std::string ActionName() { return "cast random spell"; } virtual Event ActionEvent(Event event) { return Event("rpg action", chat->formatWorldobject(rpg->guidP().GetWorldObject())); } }; class RpgCraftAction : public RpgSubAction { public: - RpgCraftAction(PlayerbotAI* ai, string name = "rpg craft") : RpgSubAction(ai, name) {} + RpgCraftAction(PlayerbotAI* ai, std::string name = "rpg craft") : RpgSubAction(ai, name) {} private: - virtual string ActionName() { return "craft random item"; } + virtual std::string ActionName() { return "craft random item"; } virtual Event ActionEvent(Event event) { return Event("rpg action", chat->formatWorldobject(rpg->guidP().GetWorldObject())); } }; class RpgTradeUsefulAction : public RpgSubAction { public: - RpgTradeUsefulAction(PlayerbotAI* ai, string name = "rpg trade useful") : RpgSubAction(ai, name) {} + RpgTradeUsefulAction(PlayerbotAI* ai, std::string name = "rpg trade useful") : RpgSubAction(ai, name) {} bool IsTradingItem(uint32 entry); @@ -284,7 +284,7 @@ namespace ai class RpgDuelAction : public RpgSubAction { public: - RpgDuelAction(PlayerbotAI* ai, string name = "rpg duel") : RpgSubAction(ai, name) {} + RpgDuelAction(PlayerbotAI* ai, std::string name = "rpg duel") : RpgSubAction(ai, name) {} virtual bool isUseful(); virtual bool Execute(Event& event); @@ -293,7 +293,7 @@ namespace ai class RpgItemAction : public UseItemAction, public RpgEnabled { public: - RpgItemAction(PlayerbotAI* ai, string name = "rpg item") : UseItemAction(ai, name), RpgEnabled(ai) {} + RpgItemAction(PlayerbotAI* ai, std::string name = "rpg item") : UseItemAction(ai, name), RpgEnabled(ai) {} //Long range is possible? virtual bool isPossible() { return rpg->guidP() && rpg->guidP().GetWorldObject(); } diff --git a/playerbot/strategy/actions/RtiAction.cpp b/playerbot/strategy/actions/RtiAction.cpp index 3e7b2abb..1e85d290 100644 --- a/playerbot/strategy/actions/RtiAction.cpp +++ b/playerbot/strategy/actions/RtiAction.cpp @@ -9,8 +9,8 @@ using namespace ai; bool RtiAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); - string type = "rti"; + std::string text = event.getParam(); + std::string type = "rti"; if (text.find("cc ") == 0) { type = "rti cc"; @@ -18,28 +18,28 @@ bool RtiAction::Execute(Event& event) } else if (text.empty() || text == "?") { - ostringstream outRti; outRti << "rti" << ": "; + std::ostringstream outRti; outRti << "rti" << ": "; AppendRti(outRti, "rti"); ai->TellPlayer(requester, outRti); - ostringstream outRtiCc; outRtiCc << "rti cc" << ": "; + std::ostringstream outRtiCc; outRtiCc << "rti cc" << ": "; AppendRti(outRtiCc, "rti cc"); ai->TellPlayer(requester, outRtiCc); return true; } - context->GetValue(type)->Set(text); - ostringstream out; out << type << " set to: "; + context->GetValue(type)->Set(text); + std::ostringstream out; out << type << " set to: "; AppendRti(out, type); ai->TellPlayer(requester, out); return true; } -void RtiAction::AppendRti(ostringstream & out, string type) +void RtiAction::AppendRti(std::ostringstream & out, std::string type) { - out << AI_VALUE(string, type); + out << AI_VALUE(std::string, type); - ostringstream n; n << type << " target"; + std::ostringstream n; n << type << " target"; Unit* target = AI_VALUE(Unit*, n.str()); if (target) out << " (" << target->GetName() << ")"; @@ -54,8 +54,8 @@ bool MarkRtiAction::Execute(Event& event) return false; Unit* target = NULL; - list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + std::list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (!unit) @@ -83,7 +83,7 @@ bool MarkRtiAction::Execute(Event& event) if (!target) return false; - string rti = AI_VALUE(string, "rti"); + std::string rti = AI_VALUE(std::string, "rti"); // Add the default rti if the bot is setup to ignore rti targets if (rti == "none") diff --git a/playerbot/strategy/actions/RtiAction.h b/playerbot/strategy/actions/RtiAction.h index 89dd908a..2a7d6ee4 100644 --- a/playerbot/strategy/actions/RtiAction.h +++ b/playerbot/strategy/actions/RtiAction.h @@ -10,7 +10,7 @@ namespace ai virtual bool Execute(Event& event) override; private: - void AppendRti(ostringstream & out, string type); + void AppendRti(std::ostringstream & out, std::string type); }; class MarkRtiAction : public Action diff --git a/playerbot/strategy/actions/RtscAction.cpp b/playerbot/strategy/actions/RtscAction.cpp index d425b448..dc4c7018 100644 --- a/playerbot/strategy/actions/RtscAction.cpp +++ b/playerbot/strategy/actions/RtscAction.cpp @@ -7,7 +7,7 @@ using namespace ai; bool RTSCAction::Execute(Event& event) { - string command = event.getParam(); + std::string command = event.getParam(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); if (!requester) @@ -28,7 +28,7 @@ bool RTSCAction::Execute(Event& event) } RESET_AI_VALUE(bool, "RTSC selected"); - RESET_AI_VALUE(string, "RTSC next spell action"); + RESET_AI_VALUE(std::string, "RTSC next spell action"); for (auto value : ai->GetAiObjectContext()->GetValues()) if (value.find("RTSC saved location::") != std::string::npos) @@ -48,7 +48,7 @@ bool RTSCAction::Execute(Event& event) else if (command == "cancel") { RESET_AI_VALUE(bool, "RTSC selected"); - RESET_AI_VALUE(string, "RTSC next spell action"); + RESET_AI_VALUE(std::string, "RTSC next spell action"); if(selected) requester->GetSession()->SendPlaySpellVisual(bot->GetObjectGuid(), 6372); return true; @@ -70,7 +70,7 @@ bool RTSCAction::Execute(Event& event) } else if (command.find("save here ") != std::string::npos) { - string locationName = command.substr(10); + std::string locationName = command.substr(10); WorldPosition spellPosition(bot); SET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName, spellPosition); @@ -82,7 +82,7 @@ bool RTSCAction::Execute(Event& event) } else if (command.find("unsave ") != std::string::npos) { - string locationName = command.substr(7); + std::string locationName = command.substr(7); RESET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName); @@ -90,13 +90,13 @@ bool RTSCAction::Execute(Event& event) } if (command.find("save ") != std::string::npos || command == "move") { - SET_AI_VALUE(string, "RTSC next spell action", command); + SET_AI_VALUE(std::string, "RTSC next spell action", command); return true; } if (command.find("show ") != std::string::npos) { - string locationName = command.substr(5); + std::string locationName = command.substr(5); WorldPosition spellPosition = AI_VALUE2(WorldPosition, "RTSC saved location", locationName); if (spellPosition) @@ -109,7 +109,7 @@ bool RTSCAction::Execute(Event& event) } if (command.find("show") != std::string::npos) { - ostringstream out; out << "saved: "; + std::ostringstream out; out << "saved: "; for (auto value : ai->GetAiObjectContext()->GetValues()) if (value.find("RTSC saved location::") != std::string::npos) @@ -123,7 +123,7 @@ bool RTSCAction::Execute(Event& event) } if (command.find("go ") != std::string::npos) { - string locationName = command.substr(3); + std::string locationName = command.substr(3); WorldPosition spellPosition = AI_VALUE2(WorldPosition, "RTSC saved location", locationName); if(spellPosition) @@ -143,7 +143,7 @@ bool RTSCAction::Execute(Event& event) WorldPosition spellPosition = AI_VALUE2(WorldPosition, "RTSC saved location", "jump"); if (!spellPosition) { - SET_AI_VALUE(string, "RTSC next spell action", command); + SET_AI_VALUE(std::string, "RTSC next spell action", command); } else { @@ -153,13 +153,13 @@ bool RTSCAction::Execute(Event& event) RESET_AI_VALUE2(WorldPosition, "RTSC saved location", "jump"); RESET_AI_VALUE2(WorldPosition, "RTSC saved location", "jump point"); ai->ChangeStrategy("-rtsc jump", BotState::BOT_STATE_NON_COMBAT); - ostringstream out; + std::ostringstream out; out << "Can't finish previous jump! Cancelling..."; ai->TellError(requester, out.str()); } else { - ostringstream out; + std::ostringstream out; out << "Another jump is in process! Use 'rtsc jump reset' to stop it"; ai->TellError(requester, out.str()); return false; diff --git a/playerbot/strategy/actions/SaveManaAction.cpp b/playerbot/strategy/actions/SaveManaAction.cpp index 42eb6c9a..87fb7c4e 100644 --- a/playerbot/strategy/actions/SaveManaAction.cpp +++ b/playerbot/strategy/actions/SaveManaAction.cpp @@ -9,12 +9,12 @@ using namespace ai; bool SaveManaAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); double value = AI_VALUE(double, "mana save level"); if (text == "?") { - ostringstream out; out << "Mana save level: " << format(value); + std::ostringstream out; out << "Mana save level: " << format(value); ai->TellPlayer(requester, out); return true; } @@ -46,20 +46,20 @@ bool SaveManaAction::Execute(Event& event) value = atof(text.c_str()); } - value = min(10.0, value); - value = max(1.0, value); + value = std::min(10.0, value); + value = std::max(1.0, value); value = floor(value * 100 + 0.5) / 100.0; ai->GetAiObjectContext()->GetValue("mana save level")->Set(value); - ostringstream out; out << "Mana save level set: " << format(value); + std::ostringstream out; out << "Mana save level set: " << format(value); ai->TellPlayer(requester, out); return true; } -string SaveManaAction::format(double value) +std::string SaveManaAction::format(double value) { - ostringstream out; + std::ostringstream out; if (value <= 1.0) out << "|cFF808080"; else if (value <= 5.0) diff --git a/playerbot/strategy/actions/SaveManaAction.h b/playerbot/strategy/actions/SaveManaAction.h index e150fd4e..f13c2111 100644 --- a/playerbot/strategy/actions/SaveManaAction.h +++ b/playerbot/strategy/actions/SaveManaAction.h @@ -10,6 +10,6 @@ namespace ai virtual bool Execute(Event& event) override; private: - string format(double value); + std::string format(double value); }; } diff --git a/playerbot/strategy/actions/SayAction.cpp b/playerbot/strategy/actions/SayAction.cpp index 4a95ac8a..6a2aea54 100644 --- a/playerbot/strategy/actions/SayAction.cpp +++ b/playerbot/strategy/actions/SayAction.cpp @@ -8,16 +8,16 @@ using namespace ai; -unordered_set noReplyMsgs = { +std::unordered_set noReplyMsgs = { "join", "leave", "follow", "attack", "pull", "flee", "reset", "reset ai", "all ?", "talents", "talents list", "talents auto", "talk", "stay", "stats", "who", "items", "leave", "join", "repair", "summon", "nc ?", "co ?", "de ?", "dead ?", "follow", "los", "guard", "do accept invitation", "stats", "react ?", "reset strats", "home", }; -unordered_set noReplyMsgParts = { "+", "-","@" , "follow target", "focus heal", "cast ", "accept [", "e [", "destroy [", "go zone" }; +std::unordered_set noReplyMsgParts = { "+", "-","@" , "follow target", "focus heal", "cast ", "accept [", "e [", "destroy [", "go zone" }; -unordered_set noReplyMsgStarts = { "e ", "accept ", "cast ", "destroy " }; +std::unordered_set noReplyMsgStarts = { "e ", "accept ", "cast ", "destroy " }; SayAction::SayAction(PlayerbotAI* ai) : Action(ai, "say"), Qualified() { @@ -25,12 +25,12 @@ SayAction::SayAction(PlayerbotAI* ai) : Action(ai, "say"), Qualified() bool SayAction::Execute(Event& event) { - string text = ""; - map placeholders; + std::string text = ""; + std::map placeholders; Unit* target = AI_VALUE(Unit*, "tank target"); if (!target) target = AI_VALUE(Unit*, "current target"); - // set replace strings + // set replace std::strings if (target) placeholders[""] = target->GetName(); placeholders[""] = IsAlliance(bot->getRace()) ? "Alliance" : "Horde"; if (qualifier == "low ammo" || qualifier == "no ammo") @@ -65,7 +65,7 @@ bool SayAction::Execute(Event& event) Group* group = bot->GetGroup(); if (group) { - vector members; + std::vector members; for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next()) { Player* member = ref->getSource(); @@ -88,7 +88,7 @@ bool SayAction::Execute(Event& event) } int index = 0; - for (vector::iterator i = members.begin(); i != members.end(); ++i) + for (std::vector::iterator i = members.begin(); i != members.end(); ++i) { PlayerbotAI* memberAi = (*i)->GetPlayerbotAI(); if (memberAi) diff --git a/playerbot/strategy/actions/SayAction.h b/playerbot/strategy/actions/SayAction.h index 8d00ff09..98c19eaf 100644 --- a/playerbot/strategy/actions/SayAction.h +++ b/playerbot/strategy/actions/SayAction.h @@ -11,7 +11,7 @@ namespace ai SayAction(PlayerbotAI* ai); virtual bool Execute(Event& event); virtual bool isUseful(); - virtual string getName() { return "say::" + qualifier; } + virtual std::string getName() { return "say::" + qualifier; } private: }; diff --git a/playerbot/strategy/actions/SeeSpellAction.cpp b/playerbot/strategy/actions/SeeSpellAction.cpp index 14671673..864ed6e1 100644 --- a/playerbot/strategy/actions/SeeSpellAction.cpp +++ b/playerbot/strategy/actions/SeeSpellAction.cpp @@ -87,7 +87,7 @@ bool SeeSpellAction::Execute(Event& event) float y = spellPosition.getY(); float z = spellPosition.getZ(); - ostringstream out; + std::ostringstream out; if (spellPosition.isOutside()) out << "[outside]"; @@ -116,7 +116,7 @@ bool SeeSpellAction::Execute(Event& event) bool selected = AI_VALUE(bool, "RTSC selected"); bool inRange = spellPosition.distance(bot) <= 10; - string nextAction = AI_VALUE(string, "RTSC next spell action"); + std::string nextAction = AI_VALUE(std::string, "RTSC next spell action"); if (nextAction.empty()) { @@ -138,7 +138,7 @@ bool SeeSpellAction::Execute(Event& event) } else if (nextAction == "jump") { - RESET_AI_VALUE(string, "RTSC next spell action"); + RESET_AI_VALUE(std::string, "RTSC next spell action"); SET_AI_VALUE2(WorldPosition, "RTSC saved location", "jump", spellPosition); bool success = ai->DoSpecificAction("jump::rtsc", Event(), true); if (!success) @@ -146,7 +146,7 @@ bool SeeSpellAction::Execute(Event& event) RESET_AI_VALUE2(WorldPosition, "RTSC saved location", "jump"); RESET_AI_VALUE2(WorldPosition, "RTSC saved location", "jump point"); ai->ChangeStrategy("-rtsc jump", BotState::BOT_STATE_NON_COMBAT); - ostringstream out; + std::ostringstream out; out << "Can't find a way to jump!"; ai->TellError(requester, out.str()); return false; @@ -166,7 +166,7 @@ bool SeeSpellAction::Execute(Event& event) RESET_AI_VALUE2(WorldPosition, "RTSC saved location", "jump"); RESET_AI_VALUE2(WorldPosition, "RTSC saved location", "jump point"); ai->ChangeStrategy("-rtsc jump", BotState::BOT_STATE_NON_COMBAT); - ostringstream out; + std::ostringstream out; out << "Can't move to jump position!"; ai->TellError(requester, out.str()); return false; @@ -177,7 +177,7 @@ bool SeeSpellAction::Execute(Event& event) } else if (nextAction.find("save ") != std::string::npos) { - string locationName; + std::string locationName; if (nextAction.find("save selected ") != std::string::npos) { if (!selected) @@ -193,7 +193,7 @@ bool SeeSpellAction::Execute(Event& event) Creature* wpCreature = bot->SummonCreature(15631, spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(), spellPosition.getO(), TEMPSPAWN_TIMED_DESPAWN, 2000.0f); wpCreature->SetObjectScale(0.5f); - RESET_AI_VALUE(string, "RTSC next spell action"); + RESET_AI_VALUE(std::string, "RTSC next spell action"); return true; } diff --git a/playerbot/strategy/actions/SeeSpellAction.h b/playerbot/strategy/actions/SeeSpellAction.h index 48baff62..13ca1120 100644 --- a/playerbot/strategy/actions/SeeSpellAction.h +++ b/playerbot/strategy/actions/SeeSpellAction.h @@ -10,7 +10,7 @@ namespace ai class SeeSpellAction : public MovementAction { public: - SeeSpellAction(PlayerbotAI* ai, string name = "see spell") : MovementAction(ai, name) {} + SeeSpellAction(PlayerbotAI* ai, std::string name = "see spell") : MovementAction(ai, name) {} virtual bool Execute(Event& event); virtual bool isPossible() override { return true; } diff --git a/playerbot/strategy/actions/SellAction.cpp b/playerbot/strategy/actions/SellAction.cpp index 7eb783a1..dbd5f672 100644 --- a/playerbot/strategy/actions/SellAction.cpp +++ b/playerbot/strategy/actions/SellAction.cpp @@ -28,13 +28,13 @@ bool SellAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); if (text == "*" || text.empty()) text = "gray"; - list items = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - for (list::iterator i = items.begin(); i != items.end(); ++i) + std::list items = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Sell(requester, *i); } @@ -45,8 +45,8 @@ bool SellAction::Execute(Event& event) void SellAction::Sell(Player* requester, FindItemVisitor* visitor) { ai->InventoryIterateItems(visitor, IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list items = visitor->GetResult(); - for (list::iterator i = items.begin(); i != items.end(); ++i) + std::list items = visitor->GetResult(); + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Sell(requester, *i); } @@ -54,10 +54,10 @@ void SellAction::Sell(Player* requester, FindItemVisitor* visitor) void SellAction::Sell(Player* requester, Item* item) { - ostringstream out; - list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); + std::ostringstream out; + std::list vendors = ai->GetAiObjectContext()->GetValue >("nearest npcs")->Get(); - for (list::iterator i = vendors.begin(); i != vendors.end(); ++i) + for (std::list::iterator i = vendors.begin(); i != vendors.end(); ++i) { ObjectGuid vendorguid = *i; Creature *pCreature = bot->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); @@ -69,7 +69,7 @@ void SellAction::Sell(Player* requester, Item* item) uint32 botMoney = bot->GetMoney(); - sPlayerbotAIConfig.logEvent(ai, "SellAction", item->GetProto()->Name1, to_string(item->GetProto()->ItemId)); + sPlayerbotAIConfig.logEvent(ai, "SellAction", item->GetProto()->Name1, std::to_string(item->GetProto()->ItemId)); WorldPacket p; p << vendorguid << itemguid << count; diff --git a/playerbot/strategy/actions/SellAction.h b/playerbot/strategy/actions/SellAction.h index 38f613a5..be89fb4f 100644 --- a/playerbot/strategy/actions/SellAction.h +++ b/playerbot/strategy/actions/SellAction.h @@ -6,15 +6,15 @@ namespace ai class SellAction : public ChatCommandAction { public: - SellAction(PlayerbotAI* ai, string name = "sell") : ChatCommandAction(ai, name) {} + SellAction(PlayerbotAI* ai, std::string name = "sell") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; void Sell(Player* requester, FindItemVisitor* visitor); void Sell(Player* requester, Item* item); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "sell"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "sell"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This command will make bots sell items to a nearby vendor.\n" "Usage: sell qualifier or itemlinks\n" @@ -23,8 +23,8 @@ namespace ai "Example: sell [itemlink] [itemlink]\n" "Example: sell equip \n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "nearest npcs", "item usage" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "nearest npcs", "item usage" }; } #endif }; } \ No newline at end of file diff --git a/playerbot/strategy/actions/SendMailAction.cpp b/playerbot/strategy/actions/SendMailAction.cpp index 8b0de6a2..8291ebf7 100644 --- a/playerbot/strategy/actions/SendMailAction.cpp +++ b/playerbot/strategy/actions/SendMailAction.cpp @@ -3,7 +3,7 @@ #include "playerbot/playerbot.h" #include "SendMailAction.h" -#include "../../../ahbot/AhBot.h" +#include "ahbot/AhBot.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/strategy/ItemVisitors.h" @@ -15,10 +15,10 @@ bool SendMailAction::Execute(Event& event) uint32 account = sObjectMgr.GetPlayerAccountIdByGUID(bot->GetObjectGuid()); bool randomBot = sPlayerbotAIConfig.IsInRandomAccountList(account); - string text = event.getParam(); + std::string text = event.getParam(); Player* receiver = requester; Player* tellTo = requester; - vector ss = split(text, ' '); + std::vector ss = split(text, ' '); if (ss.size() > 1) { Player* p = sObjectMgr.GetPlayer(ss[ss.size() - 1].c_str()); @@ -59,7 +59,7 @@ bool SendMailAction::Execute(Event& event) return false; } - ostringstream body; + std::ostringstream body; body << "Hello, " << receiver->GetName() << ",\n"; body << "\n"; body << "Here is the money you asked for"; @@ -73,12 +73,12 @@ bool SendMailAction::Execute(Event& event) bot->SetMoney(bot->GetMoney() - money); draft.SendMailTo(MailReceiver(receiver), MailSender(bot)); - ostringstream out; out << "Sending mail to " << receiver->GetName(); + std::ostringstream out; out << "Sending mail to " << receiver->GetName(); ai->TellPlayer(requester, out.str()); return true; } - ostringstream body; + std::ostringstream body; body << "Hello, " << receiver->GetName() << ",\n"; body << "\n"; body << "Here are the item(s) you asked for"; @@ -92,13 +92,13 @@ bool SendMailAction::Execute(Event& event) FindItemByIdVisitor visitor(*i); IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BANK); ai->InventoryIterateItems(&visitor, mask); - list items = visitor.GetResult(); - for (list::iterator i = items.begin(); i != items.end(); ++i) + std::list items = visitor.GetResult(); + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Item* item = *i; if (item->IsSoulBound() || item->IsConjuredConsumable()) { - ostringstream out; + std::ostringstream out; out << "Cannot send " << ChatHelper::formatItem(item); bot->Whisper(out.str(), LANG_UNIVERSAL, tellTo->GetObjectGuid()); continue; @@ -115,7 +115,7 @@ bool SendMailAction::Execute(Event& event) uint32 price = item->GetCount() * auctionbot.GetSellPrice(proto); if (!price) { - ostringstream out; + std::ostringstream out; out << ChatHelper::formatItem(item) << ": it is not for sale"; bot->Whisper(out.str(), LANG_UNIVERSAL, tellTo->GetObjectGuid()); return false; @@ -124,7 +124,7 @@ bool SendMailAction::Execute(Event& event) } draft.SendMailTo(MailReceiver(receiver), MailSender(bot)); - ostringstream out; out << "Sent mail to " << receiver->GetName(); + std::ostringstream out; out << "Sent mail to " << receiver->GetName(); bot->Whisper(out.str(), LANG_UNIVERSAL, tellTo->GetObjectGuid()); return true; } diff --git a/playerbot/strategy/actions/SetCraftAction.cpp b/playerbot/strategy/actions/SetCraftAction.cpp index 3d343b58..3477b37b 100644 --- a/playerbot/strategy/actions/SetCraftAction.cpp +++ b/playerbot/strategy/actions/SetCraftAction.cpp @@ -2,12 +2,12 @@ #include "playerbot/playerbot.h" #include "SetCraftAction.h" -#include "../../../ahbot/AhBotConfig.h" +#include "ahbot/AhBotConfig.h" #include "playerbot/ServerFacade.h" #include "playerbot/strategy/values/CraftValues.h" using namespace ai; -map SetCraftAction::skillSpells; +std::map SetCraftAction::skillSpells; bool SetCraftAction::Execute(Event& event) { @@ -15,7 +15,7 @@ bool SetCraftAction::Execute(Event& event) if (!requester) return false; - string link = event.getParam(); + std::string link = event.getParam(); CraftData& data = AI_VALUE(CraftData&, "craft"); if (link == "reset") @@ -119,10 +119,10 @@ void SetCraftAction::TellCraft(Player* requester) if (!proto) return; - ostringstream out; + std::ostringstream out; out << "I will craft " << chat->formatItem(proto) << " using reagents: "; bool first = true; - for (map::iterator i = data.required.begin(); i != data.required.end(); ++i) + for (std::map::iterator i = data.required.begin(); i != data.required.end(); ++i) { uint32 item = i->first; int required = i->second; @@ -152,6 +152,6 @@ uint32 SetCraftAction::GetCraftFee(CraftData& data) if (!proto) return 0; - uint32 level = max(proto->ItemLevel, proto->RequiredLevel); + uint32 level = std::max(proto->ItemLevel, proto->RequiredLevel); return sAhBotConfig.defaultMinPrice * level * level / 40; } diff --git a/playerbot/strategy/actions/SetCraftAction.h b/playerbot/strategy/actions/SetCraftAction.h index 075df7eb..c75d5f74 100644 --- a/playerbot/strategy/actions/SetCraftAction.h +++ b/playerbot/strategy/actions/SetCraftAction.h @@ -15,6 +15,6 @@ namespace ai void TellCraft(Player* requester); private: - static map skillSpells; + static std::map skillSpells; }; } diff --git a/playerbot/strategy/actions/SetHomeAction.cpp b/playerbot/strategy/actions/SetHomeAction.cpp index 20f830ac..b150d76b 100644 --- a/playerbot/strategy/actions/SetHomeAction.cpp +++ b/playerbot/strategy/actions/SetHomeAction.cpp @@ -47,8 +47,8 @@ bool SetHomeAction::Execute(Event& event) } } - list npcs = AI_VALUE(list, "nearest npcs"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest npcs"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Creature *unit = bot->GetNPCIfCanInteractWith(*i, UNIT_NPC_FLAG_INNKEEPER); if (!unit) diff --git a/playerbot/strategy/actions/ShareQuestAction.cpp b/playerbot/strategy/actions/ShareQuestAction.cpp index 892780b7..e984d299 100644 --- a/playerbot/strategy/actions/ShareQuestAction.cpp +++ b/playerbot/strategy/actions/ShareQuestAction.cpp @@ -7,7 +7,7 @@ using namespace ai; bool ShareQuestAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string link = event.getParam(); + std::string link = event.getParam(); if (!requester) return false; diff --git a/playerbot/strategy/actions/ShareQuestAction.h b/playerbot/strategy/actions/ShareQuestAction.h index b3db7228..7e2eb5af 100644 --- a/playerbot/strategy/actions/ShareQuestAction.h +++ b/playerbot/strategy/actions/ShareQuestAction.h @@ -6,7 +6,7 @@ namespace ai class ShareQuestAction : public ChatCommandAction { public: - ShareQuestAction(PlayerbotAI* ai, string name = "share quest") : ChatCommandAction(ai, name) {} + ShareQuestAction(PlayerbotAI* ai, std::string name = "share quest") : ChatCommandAction(ai, name) {} virtual bool Execute(Event& event) override; }; diff --git a/playerbot/strategy/actions/SkipSpellsListAction.cpp b/playerbot/strategy/actions/SkipSpellsListAction.cpp index 3b348ee1..3c768ec4 100644 --- a/playerbot/strategy/actions/SkipSpellsListAction.cpp +++ b/playerbot/strategy/actions/SkipSpellsListAction.cpp @@ -10,8 +10,8 @@ using namespace ai; bool SkipSpellsListAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string cmd = event.getParam(); - set& skipSpells = AI_VALUE(set&, "skip spells list"); + std::string cmd = event.getParam(); + std::set& skipSpells = AI_VALUE(std::set&, "skip spells list"); if (cmd == "reset") { @@ -28,9 +28,9 @@ bool SkipSpellsListAction::Execute(Event& event) else { bool first = true; - ostringstream out; + std::ostringstream out; out << "Ignored spell list: "; - for (set::iterator i = skipSpells.begin(); i != skipSpells.end(); i++) + for (std::set::iterator i = skipSpells.begin(); i != skipSpells.end(); i++) { const SpellEntry* spellEntry = sServerFacade.LookupSpellInfo(*i); if (!spellEntry) @@ -49,10 +49,10 @@ bool SkipSpellsListAction::Execute(Event& event) } else { - std::vector spells = ParseSpells(cmd); + std::vector spells = ParseSpells(cmd); if (!spells.empty()) { - for (string& spell : spells) + for (std::string& spell : spells) { const bool remove = spell.substr(0, 1) == "-"; if (remove) @@ -82,22 +82,22 @@ bool SkipSpellsListAction::Execute(Event& event) if (remove) { - set::iterator j = skipSpells.find(spellId); + std::set::iterator j = skipSpells.find(spellId); if (j != skipSpells.end()) { skipSpells.erase(j); - ostringstream out; + std::ostringstream out; out << chat->formatSpell(spellEntry) << " removed from ignored spells"; ai->TellPlayer(requester, out); } } else { - set::iterator j = skipSpells.find(spellId); + std::set::iterator j = skipSpells.find(spellId); if (j == skipSpells.end()) { skipSpells.insert(spellId); - ostringstream out; + std::ostringstream out; out << chat->formatSpell(spellEntry) << " added to ignored spells"; ai->TellPlayer(requester, out); } @@ -115,7 +115,7 @@ bool SkipSpellsListAction::Execute(Event& event) return false; } -std::vector SkipSpellsListAction::ParseSpells(const string& text) +std::vector SkipSpellsListAction::ParseSpells(const std::string& text) { std::vector spells; diff --git a/playerbot/strategy/actions/SkipSpellsListAction.h b/playerbot/strategy/actions/SkipSpellsListAction.h index ce8e44af..526b1da8 100644 --- a/playerbot/strategy/actions/SkipSpellsListAction.h +++ b/playerbot/strategy/actions/SkipSpellsListAction.h @@ -11,8 +11,8 @@ namespace ai virtual bool Execute(Event& event) override; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "skip spells list"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "skip spells list"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This chat command gives control over the list of spells bots aren't allowed to cast.\n" "Examples:\n" @@ -20,11 +20,11 @@ namespace ai "ss [spell name] : Never cast this spell.\n" "ss -[spell name] : Remove this spell from the ignored spell list.\n"; } - virtual vector GetUsedActions() { return {}; } - virtual vector GetUsedValues() { return { "skip spells list" }; } + virtual std::vector GetUsedActions() { return {}; } + virtual std::vector GetUsedValues() { return { "skip spells list" }; } #endif private: - std::vector ParseSpells(const string& text); + std::vector ParseSpells(const std::string& text); }; } diff --git a/playerbot/strategy/actions/StatsAction.cpp b/playerbot/strategy/actions/StatsAction.cpp index 3eb0dda8..f9249090 100644 --- a/playerbot/strategy/actions/StatsAction.cpp +++ b/playerbot/strategy/actions/StatsAction.cpp @@ -1,14 +1,14 @@ #include "playerbot/playerbot.h" #include "StatsAction.h" -#include "../../RandomItemMgr.h" +#include "playerbot/RandomItemMgr.h" using namespace ai; bool StatsAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - ostringstream out; + std::ostringstream out; ListGold(out); @@ -31,16 +31,16 @@ bool StatsAction::Execute(Event& event) return true; } -void StatsAction::ListGold(ostringstream &out) +void StatsAction::ListGold(std::ostringstream &out) { out << chat->formatMoney(bot->GetMoney()); } -void StatsAction::ListPower(ostringstream& out) +void StatsAction::ListPower(std::ostringstream& out) { uint32 totalPower = 0; - vector qualityCount = { 0,0,0,0,0,0,0 }; + std::vector qualityCount = { 0,0,0,0,0,0,0 }; for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) { @@ -74,10 +74,10 @@ void StatsAction::ListPower(ostringstream& out) char color[32]; sprintf(color, "%x", ItemQualityColors[mostQuality]); - out << "|h|c" << color << "|h" << to_string(totalPower) << "|h|cffffffff|h Pwr"; + out << "|h|c" << color << "|h" << std::to_string(totalPower) << "|h|cffffffff|h Pwr"; } -void StatsAction::ListBagSlots(ostringstream &out) +void StatsAction::ListBagSlots(std::ostringstream &out) { uint32 totalused = 0, total = 16; // list out items in main backpack @@ -104,7 +104,7 @@ void StatsAction::ListBagSlots(ostringstream &out) } - string color = "ff00ff00"; + std::string color = "ff00ff00"; if (totalfree < total / 2) color = "ffffff00"; if (totalfree < total / 4) @@ -112,7 +112,7 @@ void StatsAction::ListBagSlots(ostringstream &out) out << "|h|c" << color << totalfree << "/" << total << "|h|cffffffff Bag"; } -void StatsAction::ListXP( ostringstream &out ) +void StatsAction::ListXP( std::ostringstream &out ) { uint32 curXP = bot->GetUInt32Value(PLAYER_XP); uint32 nextLevelXP = bot->GetUInt32Value(PLAYER_NEXT_LEVEL_XP); @@ -128,7 +128,7 @@ void StatsAction::ListXP( ostringstream &out ) out << "|cff00ff00" << xpPercent << "|cffffd333/|cff00ff00" << restPercent << "%|cffffffff XP"; } -void StatsAction::ListRepairCost(ostringstream &out) +void StatsAction::ListRepairCost(std::ostringstream &out) { uint32 totalCost = 0; double repairPercent = 0; @@ -146,7 +146,7 @@ void StatsAction::ListRepairCost(ostringstream &out) } repairPercent /= repairCount; - string color = "ff00ff00"; + std::string color = "ff00ff00"; if (repairPercent < 50) color = "ffffff00"; if (repairPercent < 25) diff --git a/playerbot/strategy/actions/StatsAction.h b/playerbot/strategy/actions/StatsAction.h index 55322636..eae90b4c 100644 --- a/playerbot/strategy/actions/StatsAction.h +++ b/playerbot/strategy/actions/StatsAction.h @@ -10,11 +10,11 @@ namespace ai virtual bool Execute(Event& event) override; private: - void ListBagSlots(ostringstream &out); - void ListXP(ostringstream &out); - void ListRepairCost(ostringstream &out); - void ListGold(ostringstream &out); - void ListPower(ostringstream& out); + void ListBagSlots(std::ostringstream &out); + void ListXP(std::ostringstream &out); + void ListRepairCost(std::ostringstream &out); + void ListGold(std::ostringstream &out); + void ListPower(std::ostringstream& out); uint32 EstRepair(uint16 pos); double RepairPercent(uint16 pos); }; diff --git a/playerbot/strategy/actions/StayActions.h b/playerbot/strategy/actions/StayActions.h index 1da40cc8..79812f99 100644 --- a/playerbot/strategy/actions/StayActions.h +++ b/playerbot/strategy/actions/StayActions.h @@ -8,7 +8,7 @@ namespace ai class StayActionBase : public MovementAction { public: - StayActionBase(PlayerbotAI* ai, string name) : MovementAction(ai, name) {} + StayActionBase(PlayerbotAI* ai, std::string name) : MovementAction(ai, name) {} protected: bool Stay(Player* requester); diff --git a/playerbot/strategy/actions/SuggestWhatToDoAction.cpp b/playerbot/strategy/actions/SuggestWhatToDoAction.cpp index f046ab46..bc089c5d 100644 --- a/playerbot/strategy/actions/SuggestWhatToDoAction.cpp +++ b/playerbot/strategy/actions/SuggestWhatToDoAction.cpp @@ -1,8 +1,8 @@ #include "playerbot/playerbot.h" #include "SuggestWhatToDoAction.h" -#include "../../../ahbot/AhBot.h" -#include "../../../ahbot/PricingStrategy.h" +#include "ahbot/AhBot.h" +#include "ahbot/PricingStrategy.h" #include "playerbot/AiFactory.h" #include "Chat/ChannelMgr.h" #include "playerbot/PlayerbotAIConfig.h" @@ -14,10 +14,10 @@ using ahbot::PricingStrategy; using namespace ai; -map SuggestWhatToDoAction::instances; -map SuggestWhatToDoAction::factions; +std::map SuggestWhatToDoAction::instances; +std::map SuggestWhatToDoAction::factions; -SuggestWhatToDoAction::SuggestWhatToDoAction(PlayerbotAI* ai, string name) +SuggestWhatToDoAction::SuggestWhatToDoAction(PlayerbotAI* ai, std::string name) : Action{ ai, name } , _locale{ sConfig.GetIntDefault("DBC.Locale", 0 /*LocaleConstant::LOCALE_enUS*/) } { @@ -37,7 +37,7 @@ bool SuggestWhatToDoAction::isUseful() if (!sRandomPlayerbotMgr.IsRandomBot(bot) || bot->GetGroup() || bot->GetInstanceId()) return false; - string qualifier = "suggest what to do"; + std::string qualifier = "suggest what to do"; time_t lastSaid = AI_VALUE2(time_t, "last said", qualifier); return (time(0) - lastSaid) > 30; } @@ -47,7 +47,7 @@ bool SuggestWhatToDoAction::Execute(Event& event) int index = rand() % suggestions.size(); (this->*suggestions[index])(); - string qualifier = "suggest what to do"; + std::string qualifier = "suggest what to do"; time_t lastSaid = AI_VALUE2(time_t, "last said", qualifier); ai->GetAiObjectContext()->GetValue("last said", qualifier)->Set(time(0) + urand(1, 60)); @@ -102,18 +102,18 @@ void SuggestWhatToDoAction::instance() instances["Halls of Reflection"] = 80; } - vector allowedInstances; - for (map::iterator i = instances.begin(); i != instances.end(); ++i) + std::vector allowedInstances; + for (std::map::iterator i = instances.begin(); i != instances.end(); ++i) { if ((int)bot->GetLevel() >= i->second) allowedInstances.push_back(i->first); } if (allowedInstances.empty()) return; - map placeholders; + std::map placeholders; placeholders["%role"] = chat->formatClass(bot, AiFactory::GetPlayerSpecTab(bot)); - ostringstream itemout; + std::ostringstream itemout; //itemout << "|c00b000b0" << allowedInstances[urand(0, allowedInstances.size() - 1)] << "|r"; itemout << allowedInstances[urand(0, allowedInstances.size() - 1)]; placeholders["%instance"] = itemout.str(); @@ -121,9 +121,9 @@ void SuggestWhatToDoAction::instance() spam(BOT_TEXT2("suggest_instance", placeholders), urand(0, 1) ? 0x50 : 0x18, !urand(0, 2), !urand(0, 3)); } -vector SuggestWhatToDoAction::GetIncompletedQuests() +std::vector SuggestWhatToDoAction::GetIncompletedQuests() { - vector result; + std::vector result; for (uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { @@ -141,7 +141,7 @@ vector SuggestWhatToDoAction::GetIncompletedQuests() void SuggestWhatToDoAction::specificQuest() { - vector quests = GetIncompletedQuests(); + std::vector quests = GetIncompletedQuests(); if (quests.empty()) return; @@ -149,7 +149,7 @@ void SuggestWhatToDoAction::specificQuest() Quest const* quest = sObjectMgr.GetQuestTemplate(quests[index]); - map placeholders; + std::map placeholders; placeholders["%role"] = chat->formatClass(bot, AiFactory::GetPlayerSpecTab(bot)); placeholders["%quest"] = chat->formatQuest(quest); @@ -165,17 +165,17 @@ void SuggestWhatToDoAction::grindMaterials() if (!result) return; - map categories; + std::map categories; do { Field* fields = result->Fetch(); categories[fields[0].GetCppString()] = fields[1].GetFloat(); } while (result->NextRow()); - for (map::iterator i = categories.begin(); i != categories.end(); ++i) + for (std::map::iterator i = categories.begin(); i != categories.end(); ++i) { if (urand(0, 10) < 3) { - string name = i->first; + std::string name = i->first; double multiplier = i->second; for (int j = 0; j < ahbot::CategoryList::instance.size(); j++) @@ -183,13 +183,13 @@ void SuggestWhatToDoAction::grindMaterials() ahbot::Category* category = ahbot::CategoryList::instance[j]; if (name == category->GetName()) { - string item = category->GetLabel(); + std::string item = category->GetLabel(); transform(item.begin(), item.end(), item.begin(), ::tolower); - ostringstream itemout; + std::ostringstream itemout; itemout << "|c0000b000" << item << "|r"; item = itemout.str(); - map placeholders; + std::map placeholders; placeholders["%role"] = chat->formatClass(bot, AiFactory::GetPlayerSpecTab(bot)); placeholders["%category"] = item; @@ -245,25 +245,25 @@ void SuggestWhatToDoAction::grindReputation() #endif } - vector levels; + std::vector levels; levels.push_back("honored"); levels.push_back("revered"); levels.push_back("exalted"); - vector allowedFactions; - for (map::iterator i = factions.begin(); i != factions.end(); ++i) { + std::vector allowedFactions; + for (std::map::iterator i = factions.begin(); i != factions.end(); ++i) { if ((int)bot->GetLevel() >= i->second) allowedFactions.push_back(i->first); } if (allowedFactions.empty()) return; - map placeholders; + std::map placeholders; placeholders["%role"] = chat->formatClass(bot, AiFactory::GetPlayerSpecTab(bot)); placeholders["%level"] = levels[urand(0, 2)]; - ostringstream rnd; rnd << urand(1, 5) << "K"; + std::ostringstream rnd; rnd << urand(1, 5) << "K"; placeholders["%rndK"] = rnd.str(); - ostringstream itemout; + std::ostringstream itemout; //itemout << "|c004040b0" << allowedFactions[urand(0, allowedFactions.size() - 1)] << "|r"; itemout << allowedFactions[urand(0, allowedFactions.size() - 1)]; placeholders["%faction"] = itemout.str(); @@ -273,14 +273,14 @@ void SuggestWhatToDoAction::grindReputation() void SuggestWhatToDoAction::something() { - map placeholders; + std::map placeholders; placeholders["%role"] = chat->formatClass(bot, AiFactory::GetPlayerSpecTab(bot)); AreaTableEntry const* entry = GetAreaEntryByAreaID(sServerFacade.GetAreaId(bot)); if (!entry) return; - ostringstream out; + std::ostringstream out; //out << "|cffb04040" << entry->area_name[_locale] << "|r"; out << entry->area_name[_locale]; placeholders["%zone"] = out.str(); @@ -288,12 +288,12 @@ void SuggestWhatToDoAction::something() spam(BOT_TEXT2("suggest_something", placeholders), 0x18, !urand(0, 2), !urand(0, 3)); } -void SuggestWhatToDoAction::spam(string msg, uint8 flags, bool worldChat, bool guild) +void SuggestWhatToDoAction::spam(std::string msg, uint8 flags, bool worldChat, bool guild) { if (msg.empty()) return; - vector channelNames; + std::vector channelNames; ChannelMgr* cMgr = channelMgr(bot->GetTeam()); if (!cMgr) return; @@ -316,7 +316,7 @@ void SuggestWhatToDoAction::spam(string msg, uint8 flags, bool worldChat, bool g if (channel->ChannelID == 24) #endif { - string chanName = channel->pattern[_locale]; + std::string chanName = channel->pattern[_locale]; chn = cMgr->GetChannel(chanName, bot); } else @@ -357,7 +357,7 @@ void SuggestWhatToDoAction::spam(string msg, uint8 flags, bool worldChat, bool g if (!channelNames.empty()) { - string randomName = channelNames[urand(0, channelNames.size() - 1)]; + std::string randomName = channelNames[urand(0, channelNames.size() - 1)]; if (Channel* chn = cMgr->GetChannel(randomName, bot)) chn->Say(bot, msg.c_str(), LANG_UNIVERSAL); } @@ -399,9 +399,9 @@ class FindTradeItemsVisitor : public IterateItemsVisitor return true; } - map count; - vector stacks; - vector items; + std::map count; + std::vector stacks; + std::vector items; private: uint32 quality; @@ -467,7 +467,7 @@ bool SuggestTradeAction::Execute(Event& event) if (!price) return false; - map placeholders; + std::map placeholders; placeholders["%item"] = chat->formatItem(proto, count); placeholders["%gold"] = chat->formatMoney(price); diff --git a/playerbot/strategy/actions/SuggestWhatToDoAction.h b/playerbot/strategy/actions/SuggestWhatToDoAction.h index f488507b..1e6edc86 100644 --- a/playerbot/strategy/actions/SuggestWhatToDoAction.h +++ b/playerbot/strategy/actions/SuggestWhatToDoAction.h @@ -6,26 +6,26 @@ namespace ai class SuggestWhatToDoAction : public Action { public: - SuggestWhatToDoAction(PlayerbotAI* ai, string name = "suggest what to do"); + SuggestWhatToDoAction(PlayerbotAI* ai, std::string name = "suggest what to do"); virtual bool Execute(Event& event) override; virtual bool isUseful(); protected: typedef void (SuggestWhatToDoAction::*Suggestion) (); - vector suggestions; + std::vector suggestions; void instance(); void specificQuest(); void grindMaterials(); void grindReputation(); void something(); void trade(); - void spam(string msg, uint8 flags = 0, bool worldChat = false, bool guild = false); + void spam(std::string msg, uint8 flags = 0, bool worldChat = false, bool guild = false); - vector GetIncompletedQuests(); + std::vector GetIncompletedQuests(); private: - static map instances; - static map factions; + static std::map instances; + static std::map factions; int32 _locale; }; diff --git a/playerbot/strategy/actions/TalkToQuestGiverAction.cpp b/playerbot/strategy/actions/TalkToQuestGiverAction.cpp index 19b01fd6..7c9298fd 100644 --- a/playerbot/strategy/actions/TalkToQuestGiverAction.cpp +++ b/playerbot/strategy/actions/TalkToQuestGiverAction.cpp @@ -11,8 +11,8 @@ bool TalkToQuestGiverAction::ProcessQuest(Player* requester, Quest const* quest, { bool isCompleted = false; - string outputMessage; - map args; + std::string outputMessage; + std::map args; args["%quest"] = chat->formatQuest(quest); QuestStatus status = bot->GetQuestStatus(quest->GetQuestId()); @@ -67,7 +67,7 @@ bool TalkToQuestGiverAction::ProcessQuest(Player* requester, Quest const* quest, return isCompleted; } -bool TalkToQuestGiverAction::TurnInQuest(Player* requester, Quest const* quest, WorldObject* questGiver, string& out) +bool TalkToQuestGiverAction::TurnInQuest(Player* requester, Quest const* quest, WorldObject* questGiver, std::string& out) { uint32 questID = quest->GetQuestId(); if (bot->GetQuestRewardStatus(questID)) @@ -80,7 +80,7 @@ bool TalkToQuestGiverAction::TurnInQuest(Player* requester, Quest const* quest, bot->PlayDistanceSound(621); } - sPlayerbotAIConfig.logEvent(ai, "TalkToQuestGiverAction", quest->GetTitle(), to_string(quest->GetQuestId())); + sPlayerbotAIConfig.logEvent(ai, "TalkToQuestGiverAction", quest->GetTitle(), std::to_string(quest->GetQuestId())); if (quest->GetRewChoiceItemsCount() == 0) { @@ -98,9 +98,9 @@ bool TalkToQuestGiverAction::TurnInQuest(Player* requester, Quest const* quest, return true; } -void TalkToQuestGiverAction::RewardNoItem(Quest const* quest, WorldObject* questGiver, string& out) +void TalkToQuestGiverAction::RewardNoItem(Quest const* quest, WorldObject* questGiver, std::string& out) { - map args; + std::map args; args["%quest"] = chat->formatQuest(quest); if (bot->CanRewardQuest(quest, false)) @@ -114,12 +114,12 @@ void TalkToQuestGiverAction::RewardNoItem(Quest const* quest, WorldObject* quest } } -void TalkToQuestGiverAction::RewardSingleItem(Quest const* quest, WorldObject* questGiver, string& out) +void TalkToQuestGiverAction::RewardSingleItem(Quest const* quest, WorldObject* questGiver, std::string& out) { int index = 0; ItemPrototype const *item = sObjectMgr.GetItemPrototype(quest->RewChoiceItemId[index]); - map args; + std::map args; args["%quest"] = chat->formatQuest(quest); args["%item"] = chat->formatItem(item); @@ -176,13 +176,13 @@ ItemIds TalkToQuestGiverAction::BestRewards(Quest const* quest) } } -void TalkToQuestGiverAction::RewardMultipleItem(Player* requester, Quest const* quest, WorldObject* questGiver, string& out) +void TalkToQuestGiverAction::RewardMultipleItem(Player* requester, Quest const* quest, WorldObject* questGiver, std::string& out) { - map args; + std::map args; args["%quest"] = chat->formatQuest(quest); - set bestIds; - ostringstream outid; + std::set bestIds; + std::ostringstream outid; auto questRewardOption = static_cast(AI_VALUE(uint8, "quest reward")); if (!ai->IsAlt() || questRewardOption == QuestRewardOptionType::QUEST_REWARD_CONFIG_DRIVEN && sPlayerbotAIConfig.autoPickReward == "yes" || @@ -228,9 +228,9 @@ void TalkToQuestGiverAction::RewardMultipleItem(Player* requester, Quest const* } } -void TalkToQuestGiverAction::AskToSelectReward(Player* requester, Quest const* quest, string& out, bool forEquip) +void TalkToQuestGiverAction::AskToSelectReward(Player* requester, Quest const* quest, std::string& out, bool forEquip) { - ostringstream msg; + std::ostringstream msg; for (uint8 i = 0; i < quest->GetRewChoiceItemsCount(); ++i) { ItemPrototype const* item = sObjectMgr.GetItemPrototype(quest->RewChoiceItemId[i]); @@ -242,7 +242,7 @@ void TalkToQuestGiverAction::AskToSelectReward(Player* requester, Quest const* q } } - map args; + std::map args; args["%quest"] = chat->formatQuest(quest); args["%rewards"] = msg.str(); diff --git a/playerbot/strategy/actions/TalkToQuestGiverAction.h b/playerbot/strategy/actions/TalkToQuestGiverAction.h index 3fc1fef4..52754bb9 100644 --- a/playerbot/strategy/actions/TalkToQuestGiverAction.h +++ b/playerbot/strategy/actions/TalkToQuestGiverAction.h @@ -14,11 +14,11 @@ namespace ai virtual bool ProcessQuest(Player* requester, Quest const* quest, WorldObject* questGiver) override; private: - bool TurnInQuest(Player* requester, Quest const* quest, WorldObject* questGiver, string& out); - void RewardNoItem(Quest const* quest, WorldObject* questGiver, string& out); - void RewardSingleItem(Quest const* quest, WorldObject* questGiver, string& out); - set BestRewards(Quest const* quest); - void RewardMultipleItem(Player* requester, Quest const* quest, WorldObject* questGiver, string& out); - void AskToSelectReward(Player* requester, Quest const* quest, string& out, bool forEquip); + bool TurnInQuest(Player* requester, Quest const* quest, WorldObject* questGiver, std::string& out); + void RewardNoItem(Quest const* quest, WorldObject* questGiver, std::string& out); + void RewardSingleItem(Quest const* quest, WorldObject* questGiver, std::string& out); + std::set BestRewards(Quest const* quest); + void RewardMultipleItem(Player* requester, Quest const* quest, WorldObject* questGiver, std::string& out); + void AskToSelectReward(Player* requester, Quest const* quest, std::string& out, bool forEquip); }; } \ No newline at end of file diff --git a/playerbot/strategy/actions/TaxiAction.cpp b/playerbot/strategy/actions/TaxiAction.cpp index e63d1b06..b34e13d7 100644 --- a/playerbot/strategy/actions/TaxiAction.cpp +++ b/playerbot/strategy/actions/TaxiAction.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "TaxiAction.h" -#include "../../../../../game/Server/DBCStructure.h" +#include "Server/DBCStructure.h" #include "playerbot/strategy/values/LastMovementValue.h" using namespace ai; @@ -14,7 +14,7 @@ bool TaxiAction::Execute(Event& event) LastMovement& movement = context->GetValue("last taxi")->Get(); WorldPacket& p = event.getPacket(); - string param = event.getParam(); + std::string param = event.getParam(); if ((!p.empty() && (p.GetOpcode() == CMSG_TAXICLEARALLNODES || p.GetOpcode() == CMSG_TAXICLEARNODE)) || param == "clear") { movement.taxiNodes.clear(); @@ -23,8 +23,8 @@ bool TaxiAction::Execute(Event& event) return true; } - list units = *context->GetValue >("nearest npcs"); - for (list::iterator i = units.begin(); i != units.end(); i++) + std::list units = *context->GetValue >("nearest npcs"); + for (std::list::iterator i = units.begin(); i != units.end(); i++) { Creature *npc = bot->GetNPCIfCanInteractWith(*i, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) @@ -32,7 +32,7 @@ bool TaxiAction::Execute(Event& event) uint32 curloc = sObjectMgr.GetNearestTaxiNode(npc->GetPositionX(), npc->GetPositionY(), npc->GetPositionZ(), npc->GetMapId(), bot->GetTeam()); - vector nodes; + std::vector nodes; for (uint32 i = 0; i < sTaxiPathStore.GetNumRows(); ++i) { TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i); @@ -47,7 +47,7 @@ bool TaxiAction::Execute(Event& event) { ai->TellPlayerNoFacing(requester, "=== Taxi ==="); int index = 1; - for (vector::iterator i = nodes.begin(); i != nodes.end(); ++i) + for (std::vector::iterator i = nodes.begin(); i != nodes.end(); ++i) { TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(*i); if (!entry) continue; @@ -55,7 +55,7 @@ bool TaxiAction::Execute(Event& event) TaxiNodesEntry const* dest = sTaxiNodesStore.LookupEntry(entry->to); if (!dest) continue; - ostringstream out; + std::ostringstream out; out << index++ << ": " << dest->name[0]; ai->TellPlayerNoFacing(requester, out.str()); } diff --git a/playerbot/strategy/actions/TeleportAction.cpp b/playerbot/strategy/actions/TeleportAction.cpp index 4e1d0210..48868f8b 100644 --- a/playerbot/strategy/actions/TeleportAction.cpp +++ b/playerbot/strategy/actions/TeleportAction.cpp @@ -9,8 +9,8 @@ using namespace ai; bool TeleportAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - list gos = *context->GetValue >("nearest game objects"); - for (list::iterator i = gos.begin(); i != gos.end(); i++) + std::list gos = *context->GetValue >("nearest game objects"); + for (std::list::iterator i = gos.begin(); i != gos.end(); i++) { GameObject* go = ai->GetGameObject(*i); if (!go) @@ -28,7 +28,7 @@ bool TeleportAction::Execute(Event& event) if (!bot->GetGameObjectIfCanInteractWith(go->GetObjectGuid(), MAX_GAMEOBJECT_TYPE)) continue; - ostringstream out; out << "Teleporting using " << goInfo->name; + std::ostringstream out; out << "Teleporting using " << goInfo->name; ai->TellPlayerNoFacing(requester, out.str()); ai->ChangeStrategy("-follow,+stay", BotState::BOT_STATE_NON_COMBAT); diff --git a/playerbot/strategy/actions/TellCastFailedAction.cpp b/playerbot/strategy/actions/TellCastFailedAction.cpp index 591f9ecc..c4a25fe9 100644 --- a/playerbot/strategy/actions/TellCastFailedAction.cpp +++ b/playerbot/strategy/actions/TellCastFailedAction.cpp @@ -19,7 +19,7 @@ bool TellCastFailedAction::Execute(Event& event) return false; const SpellEntry *const pSpellInfo = sServerFacade.LookupSpellInfo(spellId); - ostringstream out; out << chat->formatSpell(pSpellInfo) << ": "; + std::ostringstream out; out << chat->formatSpell(pSpellInfo) << ": "; switch (result) { case SPELL_FAILED_NOT_READY: @@ -57,7 +57,7 @@ bool TellCastFailedAction::Execute(Event& event) bool TellSpellAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string spell = event.getParam(); + std::string spell = event.getParam(); uint32 spellId = AI_VALUE2(uint32, "spell id", spell); if (!spellId) return false; @@ -66,7 +66,7 @@ bool TellSpellAction::Execute(Event& event) if (!spellInfo) return false; - ostringstream out; out << chat->formatSpell(spellInfo); + std::ostringstream out; out << chat->formatSpell(spellInfo); ai->TellError(requester, out.str()); return true; } diff --git a/playerbot/strategy/actions/TellItemCountAction.cpp b/playerbot/strategy/actions/TellItemCountAction.cpp index e9efb70c..df05dec7 100644 --- a/playerbot/strategy/actions/TellItemCountAction.cpp +++ b/playerbot/strategy/actions/TellItemCountAction.cpp @@ -10,7 +10,7 @@ bool TellItemCountAction::Execute(Event& event) Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); if(requester) { - string text = event.getParam(); + std::string text = event.getParam(); if (text.find("@") == 0) return false; @@ -25,13 +25,13 @@ bool TellItemCountAction::Execute(Event& event) mask = IterateItemsMask::ITERATE_ITEMS_IN_BUYBACK; - list found = ai->InventoryParseItems(text, mask); - map itemMap; - map soulbound; - map equiped; + std::list found = ai->InventoryParseItems(text, mask); + std::map itemMap; + std::map soulbound; + std::map equiped; bool hasEquip = false; - for (list::iterator i = found.begin(); i != found.end(); i++) + for (std::list::iterator i = found.begin(); i != found.end(); i++) { ItemPrototype const* proto = (*i)->GetProto(); itemMap[proto->ItemId] += (*i)->GetCount(); @@ -45,7 +45,7 @@ bool TellItemCountAction::Execute(Event& event) if ((*i)->GetBagSlot() == INVENTORY_SLOT_BAG_0 && (*i)->GetSlot() < EQUIPMENT_SLOT_END) { ItemQualifier itemQ = ItemQualifier((*i)); - ostringstream out; + std::ostringstream out; out << chat->formatItem(itemQ); if ((*i)->IsSoulBound()) out << " (soulbound)"; @@ -58,7 +58,7 @@ bool TellItemCountAction::Execute(Event& event) return true; ai->TellPlayer(requester, "=== Inventory ==="); - for (map::iterator i = itemMap.begin(); i != itemMap.end(); ++i) + for (std::map::iterator i = itemMap.begin(); i != itemMap.end(); ++i) { if (equiped[i->first] && i->second == 1) continue; diff --git a/playerbot/strategy/actions/TellLosAction.cpp b/playerbot/strategy/actions/TellLosAction.cpp index 8b21677f..87580e44 100644 --- a/playerbot/strategy/actions/TellLosAction.cpp +++ b/playerbot/strategy/actions/TellLosAction.cpp @@ -7,42 +7,42 @@ using namespace ai; bool TellLosAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string param = event.getParam(); + std::string param = event.getParam(); if (param.empty() || param == "targets") { - ListUnits(requester, "--- Targets ---", *context->GetValue >("possible targets")); - ListUnits(requester, "--- Targets (All) ---", *context->GetValue >("all targets")); + ListUnits(requester, "--- Targets ---", *context->GetValue >("possible targets")); + ListUnits(requester, "--- Targets (All) ---", *context->GetValue >("all targets")); } if (param.empty() || param == "npcs") { - ListUnits(requester, "--- NPCs ---", *context->GetValue >("nearest npcs")); + ListUnits(requester, "--- NPCs ---", *context->GetValue >("nearest npcs")); } if (param.empty() || param == "corpses") { - ListUnits(requester, "--- Corpses ---", *context->GetValue >("nearest corpses")); + ListUnits(requester, "--- Corpses ---", *context->GetValue >("nearest corpses")); } if (param.empty() || param == "gos" || param == "game objects") { - ListGameObjects(requester, "--- Game objects ---", *context->GetValue >("nearest game objects")); + ListGameObjects(requester, "--- Game objects ---", *context->GetValue >("nearest game objects")); } if (param.empty() || param == "players") { - ListUnits(requester, "--- Friendly players ---", *context->GetValue >("nearest friendly players")); + ListUnits(requester, "--- Friendly players ---", *context->GetValue >("nearest friendly players")); } return true; } -void TellLosAction::ListUnits(Player* requester, string title, list units) +void TellLosAction::ListUnits(Player* requester, std::string title, std::list units) { ai->TellPlayer(requester, title); - for (list::iterator i = units.begin(); i != units.end(); i++) + for (std::list::iterator i = units.begin(); i != units.end(); i++) { Unit* unit = ai->GetUnit(*i); if (unit) @@ -50,11 +50,11 @@ void TellLosAction::ListUnits(Player* requester, string title, list } } -void TellLosAction::ListGameObjects(Player* requester, string title, list gos) +void TellLosAction::ListGameObjects(Player* requester, std::string title, std::list gos) { ai->TellPlayer(requester, title); - for (list::iterator i = gos.begin(); i != gos.end(); i++) + for (std::list::iterator i = gos.begin(); i != gos.end(); i++) { GameObject* go = ai->GetGameObject(*i); if (go) diff --git a/playerbot/strategy/actions/TellLosAction.h b/playerbot/strategy/actions/TellLosAction.h index 9f63697d..6c6b7324 100644 --- a/playerbot/strategy/actions/TellLosAction.h +++ b/playerbot/strategy/actions/TellLosAction.h @@ -10,7 +10,7 @@ namespace ai virtual bool Execute(Event& event) override; private: - void ListUnits(Player* requester, string title, list units); - void ListGameObjects(Player* requester, string title, list gos); + void ListUnits(Player* requester, std::string title, std::list units); + void ListGameObjects(Player* requester, std::string title, std::list gos); }; } diff --git a/playerbot/strategy/actions/TellMasterAction.h b/playerbot/strategy/actions/TellMasterAction.h index 990f9cec..7b57e526 100644 --- a/playerbot/strategy/actions/TellMasterAction.h +++ b/playerbot/strategy/actions/TellMasterAction.h @@ -6,7 +6,7 @@ namespace ai class TellMasterAction : public Action { public: - TellMasterAction(PlayerbotAI* ai, string text) : Action(ai, "tell master"), text(text) {} + TellMasterAction(PlayerbotAI* ai, std::string text) : Action(ai, "tell master"), text(text) {} virtual bool Execute(Event& event) { @@ -15,7 +15,7 @@ namespace ai } private: - string text; + std::string text; }; class OutOfReactRangeAction : public MovementAction diff --git a/playerbot/strategy/actions/TellReputationAction.cpp b/playerbot/strategy/actions/TellReputationAction.cpp index 630a3b6e..3d759d85 100644 --- a/playerbot/strategy/actions/TellReputationAction.cpp +++ b/playerbot/strategy/actions/TellReputationAction.cpp @@ -28,7 +28,7 @@ bool TellReputationAction::Execute(Event& event) (faction); int32 reputation = bot->GetReputationMgr().GetReputation(faction); - ostringstream out; + std::ostringstream out; out << entry->name[0] << ": "; out << "|cff"; ReputationRank rank = bot->GetReputationMgr().GetRank(entry); diff --git a/playerbot/strategy/actions/TellTargetAction.cpp b/playerbot/strategy/actions/TellTargetAction.cpp index 3c223592..f60091da 100644 --- a/playerbot/strategy/actions/TellTargetAction.cpp +++ b/playerbot/strategy/actions/TellTargetAction.cpp @@ -13,7 +13,7 @@ bool TellTargetAction::Execute(Event& event) Unit* target = context->GetValue("current target")->Get(); if (target) { - ostringstream out; + std::ostringstream out; out << "Attacking " << target->GetName(); ai->TellPlayer(requester, out); @@ -28,8 +28,8 @@ bool TellAttackersAction::Execute(Event& event) ai->TellPlayer(requester, "--- Attackers ---"); - list attackers = context->GetValue>("attackers")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); i++) + std::list attackers = context->GetValue>("attackers")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit || !sServerFacade.IsAlive(unit)) @@ -49,7 +49,7 @@ bool TellAttackersAction::Execute(Event& event) Unit* unit = threatManager->getOwner(); float threat = ref->getThreat(); - ostringstream out; out << unit->GetName() << " (" << threat << ")"; + std::ostringstream out; out << unit->GetName() << " (" << threat << ")"; ai->TellPlayer(requester, out); ref = ref->next(); @@ -62,8 +62,8 @@ bool TellPossibleAttackTargetsAction::Execute(Event& event) Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); ai->TellPlayer(requester, "--- Attack Targets ---"); - list attackers = context->GetValue>("possible attack targets")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); i++) + std::list attackers = context->GetValue>("possible attack targets")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit || !sServerFacade.IsAlive(unit)) @@ -83,7 +83,7 @@ bool TellPossibleAttackTargetsAction::Execute(Event& event) Unit *unit = threatManager->getOwner(); float threat = ref->getThreat(); - ostringstream out; out << unit->GetName() << " (" << threat << ")"; + std::ostringstream out; out << unit->GetName() << " (" << threat << ")"; ai->TellPlayer(requester, out); ref = ref->next(); diff --git a/playerbot/strategy/actions/TradeAction.cpp b/playerbot/strategy/actions/TradeAction.cpp index 9d634969..e2e94311 100644 --- a/playerbot/strategy/actions/TradeAction.cpp +++ b/playerbot/strategy/actions/TradeAction.cpp @@ -8,11 +8,11 @@ using namespace ai; bool TradeAction::Execute(Event& event) { - string text = event.getParam(); + std::string text = event.getParam(); if (!bot->GetTrader()) { - list guids = chat->parseGameobjects(text); + std::list guids = chat->parseGameobjects(text); Player* player = nullptr; for(auto& guid: guids) @@ -55,15 +55,15 @@ bool TradeAction::Execute(Event& event) } size_t pos = text.rfind(" "); - int count = pos!=string::npos ? atoi(text.substr(pos + 1).c_str()) : 1; + int count = pos!= std::string::npos ? atoi(text.substr(pos + 1).c_str()) : 1; IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list found = ai->InventoryParseItems(text, mask); + std::list found = ai->InventoryParseItems(text, mask); if (found.empty()) return false; int traded = 0; - for (list::iterator i = found.begin(); i != found.end(); i++) + for (std::list::iterator i = found.begin(); i != found.end(); i++) { Item* item = *i; diff --git a/playerbot/strategy/actions/TradeAction.h b/playerbot/strategy/actions/TradeAction.h index 599c5ec8..496033fa 100644 --- a/playerbot/strategy/actions/TradeAction.h +++ b/playerbot/strategy/actions/TradeAction.h @@ -13,6 +13,6 @@ namespace ai bool TradeItem(const Item& item, int8 slot); private: - static map slots; + static std::map slots; }; } diff --git a/playerbot/strategy/actions/TradeStatusAction.cpp b/playerbot/strategy/actions/TradeStatusAction.cpp index b4c3d2d6..618dfcc4 100644 --- a/playerbot/strategy/actions/TradeStatusAction.cpp +++ b/playerbot/strategy/actions/TradeStatusAction.cpp @@ -4,7 +4,7 @@ #include "playerbot/strategy/ItemVisitors.h" #include "playerbot/PlayerbotAIConfig.h" -#include "../../../ahbot/AhBot.h" +#include "ahbot/AhBot.h" #include "playerbot/RandomPlayerbotMgr.h" #include "playerbot/ServerFacade.h" #include "playerbot/strategy/values/CraftValues.h" @@ -55,7 +55,7 @@ bool TradeStatusAction::Execute(Event& event) { int32 botMoney = CalculateCost(bot, true); - map givenItemIds, takenItemIds; + std::map givenItemIds, takenItemIds; for (uint32 slot = 0; slot < TRADE_SLOT_TRADED_COUNT; ++slot) { Item* item = trader->GetTradeData()->GetItem((TradeSlots)slot); @@ -74,7 +74,7 @@ bool TradeStatusAction::Execute(Event& event) return false; } - for (map::iterator i = givenItemIds.begin(); i != givenItemIds.end(); ++i) + for (std::map::iterator i = givenItemIds.begin(); i != givenItemIds.end(); ++i) { uint32 itemId = i->first; uint32 count = i->second; @@ -87,7 +87,7 @@ bool TradeStatusAction::Execute(Event& event) } - for (map::iterator i = takenItemIds.begin(); i != takenItemIds.end(); ++i) + for (std::map::iterator i = takenItemIds.begin(); i != takenItemIds.end(); ++i) { uint32 itemId = i->first; uint32 count = i->second; @@ -136,7 +136,7 @@ void TradeStatusAction::BeginTrade() uint32 discount = sRandomPlayerbotMgr.GetTradeDiscount(bot, ai->GetMaster()); if (discount) { - ostringstream out; out << "Discount up to: " << chat->formatMoney(discount); + std::ostringstream out; out << "Discount up to: " << chat->formatMoney(discount); ai->TellPlayer(trader, out); } } @@ -174,7 +174,7 @@ bool TradeStatusAction::CheckTrade() if (isGettingItem) { - string name = trader->GetName(); + std::string name = trader->GetName(); if (bot->GetGroup() && bot->GetGroup()->IsMember(bot->GetTrader()->GetObjectGuid()) && ai->HasRealPlayerMaster()) { ai->TellPlayerNoFacing(trader, "Thank you " + name + ".", PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); @@ -211,7 +211,7 @@ bool TradeStatusAction::CheckTrade() Item* item = bot->GetTradeData()->GetItem((TradeSlots)slot); if (item && !auctionbot.GetSellPrice(item->GetProto())) { - ostringstream out; + std::ostringstream out; out << chat->formatItem(item) << " - This is not for sale"; ai->TellPlayer(trader, out); ai->PlaySound(TEXTEMOTE_NO); @@ -224,7 +224,7 @@ bool TradeStatusAction::CheckTrade() ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", ItemQualifier(item).GetQualifier()); if ((botMoney && !auctionbot.GetBuyPrice(item->GetProto())) || usage == ItemUsage::ITEM_USAGE_NONE) { - ostringstream out; + std::ostringstream out; out << chat->formatItem(item) << " - I don't need this"; ai->TellPlayer(trader, out); ai->PlaySound(TEXTEMOTE_NO); @@ -285,7 +285,7 @@ bool TradeStatusAction::CheckTrade() return true; } - ostringstream out; + std::ostringstream out; out << "I want " << chat->formatMoney(-(delta + discount)) << " for this"; ai->TellPlayer(trader, out); ai->PlaySound(TEXTEMOTE_NO); diff --git a/playerbot/strategy/actions/TrainerAction.cpp b/playerbot/strategy/actions/TrainerAction.cpp index b546f178..d268f9d6 100644 --- a/playerbot/strategy/actions/TrainerAction.cpp +++ b/playerbot/strategy/actions/TrainerAction.cpp @@ -6,7 +6,7 @@ using namespace ai; -void TrainerAction::Learn(uint32 cost, TrainerSpell const* tSpell, ostringstream& msg) +void TrainerAction::Learn(uint32 cost, TrainerSpell const* tSpell, std::ostringstream& msg) { if (sPlayerbotAIConfig.autoTrainSpells != "free" && !ai->HasCheat(BotCheatMask::gold)) { @@ -58,7 +58,7 @@ void TrainerAction::Learn(uint32 cost, TrainerSpell const* tSpell, ostringstream if (!learned) bot->learnSpell(tSpell->spell, false); #endif - sPlayerbotAIConfig.logEvent(ai, "TrainerAction", proto->SpellName[0], to_string(proto->Id)); + sPlayerbotAIConfig.logEvent(ai, "TrainerAction", proto->SpellName[0], std::to_string(proto->Id)); msg << " - learned"; } @@ -132,7 +132,7 @@ void TrainerAction::Iterate(Player* requester, Creature* creature, TrainerSpellA uint32 cost = uint32(floor(tSpell->spellCost * fDiscountMod)); totalCost += cost; - ostringstream out; + std::ostringstream out; out << chat->formatSpell(pSpellInfo) << chat->formatMoney(cost); if (action) @@ -155,7 +155,7 @@ void TrainerAction::Iterate(Player* requester, Creature* creature, TrainerSpellA bool TrainerAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); + std::string text = event.getParam(); Creature* creature = nullptr; if (event.getSource() == "rpg action") @@ -201,7 +201,7 @@ bool TrainerAction::Execute(Event& event) if (spell) spells.insert(spell); - if (text.find("learn") != string::npos || sRandomPlayerbotMgr.IsFreeBot(bot) || (sPlayerbotAIConfig.autoTrainSpells != "no" && (creature->GetCreatureInfo()->TrainerType != TRAINER_TYPE_TRADESKILLS || !ai->HasActivePlayerMaster()))) //Todo rewrite to only exclude start primary profession skills and make config dependent. + if (text.find("learn") != std::string::npos || sRandomPlayerbotMgr.IsFreeBot(bot) || (sPlayerbotAIConfig.autoTrainSpells != "no" && (creature->GetCreatureInfo()->TrainerType != TRAINER_TYPE_TRADESKILLS || !ai->HasActivePlayerMaster()))) //Todo rewrite to only exclude start primary profession skills and make config dependent. Iterate(requester, creature, &TrainerAction::Learn, spells); else Iterate(requester, creature, NULL, spells); @@ -211,7 +211,7 @@ bool TrainerAction::Execute(Event& event) void TrainerAction::TellHeader(Player* requester, Creature* creature) { - ostringstream out; out << "--- Can learn from " << creature->GetName() << " ---"; + std::ostringstream out; out << "--- Can learn from " << creature->GetName() << " ---"; ai->TellPlayer(requester, out, PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } @@ -219,7 +219,7 @@ void TrainerAction::TellFooter(Player* requester, uint32 totalCost) { if (totalCost) { - ostringstream out; out << "Total cost: " << chat->formatMoney(totalCost); + std::ostringstream out; out << "Total cost: " << chat->formatMoney(totalCost); ai->TellPlayer(requester, out, PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } } diff --git a/playerbot/strategy/actions/TrainerAction.h b/playerbot/strategy/actions/TrainerAction.h index 61c3a539..7d6c6550 100644 --- a/playerbot/strategy/actions/TrainerAction.h +++ b/playerbot/strategy/actions/TrainerAction.h @@ -10,9 +10,9 @@ namespace ai virtual bool Execute(Event& event) override; private: - typedef void (TrainerAction::*TrainerSpellAction)(uint32, TrainerSpell const*, ostringstream& msg); + typedef void (TrainerAction::*TrainerSpellAction)(uint32, TrainerSpell const*, std::ostringstream& msg); void Iterate(Player* requester, Creature* creature, TrainerSpellAction action, SpellIds& spells); - void Learn(uint32 cost, TrainerSpell const* tSpell, ostringstream& msg); + void Learn(uint32 cost, TrainerSpell const* tSpell, std::ostringstream& msg); void TellHeader(Player* requester, Creature* creature); void TellFooter(Player* requester, uint32 totalCost); }; diff --git a/playerbot/strategy/actions/TravelAction.cpp b/playerbot/strategy/actions/TravelAction.cpp index 193491de..126f6d83 100644 --- a/playerbot/strategy/actions/TravelAction.cpp +++ b/playerbot/strategy/actions/TravelAction.cpp @@ -23,7 +23,7 @@ bool TravelAction::Execute(Event& event) target->setStatus(TravelStatus::TRAVEL_STATUS_WORK); Unit* newTarget; - list targets; + std::list targets; AnyUnitInObjectRangeCheck u_check(bot, sPlayerbotAIConfig.sightDistance * 2); UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(bot, searcher, sPlayerbotAIConfig.sightDistance * 2); diff --git a/playerbot/strategy/actions/UnequipAction.cpp b/playerbot/strategy/actions/UnequipAction.cpp index ea8a89c8..decf37b2 100644 --- a/playerbot/strategy/actions/UnequipAction.cpp +++ b/playerbot/strategy/actions/UnequipAction.cpp @@ -6,13 +6,13 @@ using namespace ai; -vector split(const string &s, char delim); +std::vector split(const std::string &s, char delim); bool UnequipAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string text = event.getParam(); - list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_EQUIP); + std::string text = event.getParam(); + std::list found = ai->InventoryParseItems(text, IterateItemsMask::ITERATE_ITEMS_IN_EQUIP); for (auto& item : found) { UnequipItem(requester, item); @@ -25,7 +25,7 @@ void UnequipAction::UnequipItem(Player* requester, FindItemVisitor* visitor) { IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP); ai->InventoryIterateItems(visitor, mask); - list items = visitor->GetResult(); + std::list items = visitor->GetResult(); if (!items.empty()) UnequipItem(requester, *items.begin()); } @@ -39,7 +39,7 @@ void UnequipAction::UnequipItem(Player* requester, Item* item) packet << bagIndex << slot << dstBag; bot->GetSession()->HandleAutoStoreBagItemOpcode(packet); - map args; + std::map args; args["%item"] = chat->formatItem(item); ai->TellPlayer(requester, BOT_TEXT2("unequip_command", args), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); } \ No newline at end of file diff --git a/playerbot/strategy/actions/UseItemAction.cpp b/playerbot/strategy/actions/UseItemAction.cpp index bd473aad..583673dc 100644 --- a/playerbot/strategy/actions/UseItemAction.cpp +++ b/playerbot/strategy/actions/UseItemAction.cpp @@ -135,9 +135,9 @@ bool BotUseItemSpell::OpenLockCheck() return false; } -vector ParseItems(const string& text) +std::vector ParseItems(const std::string& text) { - vector itemIds; + std::vector itemIds; uint8 pos = 0; while (true) @@ -155,7 +155,7 @@ vector ParseItems(const string& text) break; } - string idC = text.substr(pos, endPos - pos); + std::string idC = text.substr(pos, endPos - pos); uint32 id = atol(idC.c_str()); pos = endPos; if (id) @@ -187,25 +187,25 @@ bool IsDrink(ItemPrototype const* proto) bool UseItemAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string name = event.getParam(); + std::string name = event.getParam(); if (name.empty()) { name = getName(); } - list items = AI_VALUE2(list, "inventory items", name); - list gos = chat->parseGameobjects(name); + std::list items = AI_VALUE2(std::list, "inventory items", name); + std::list gos = chat->parseGameobjects(name); if (gos.empty()) { if (items.size() > 1) { - list::iterator i = items.begin(); + std::list::iterator i = items.begin(); Item* item = *i++; Item* itemTarget = *i; // Check if the items are in the correct order - const vector itemIds = ParseItems(name); + const std::vector itemIds = ParseItems(name); if(!itemIds.empty() && item->GetEntry() != *itemIds.begin()) { // Swap items to match command order @@ -272,7 +272,7 @@ bool UseItemAction::UseGameObject(Player* requester, ObjectGuid guid) *packet << guid; bot->GetSession()->QueuePacket(std::move(packet)); - ostringstream out; out << "Using " << chat->formatGameobject(go); + std::ostringstream out; out << "Using " << chat->formatGameobject(go); ai->TellPlayerNoFacing(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); return true; } @@ -295,18 +295,18 @@ bool UseItemAction::UseItemAuto(Player* requester, Item* item) ItemPrototype const* proto = item->GetProto(); bool isDrink = IsDrink(proto); - bool isFood = IsFood(proto); - - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - { - // wrong triggering type - if (proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) - continue; - - if (proto->Spells[i].SpellId > 0) + bool isFood = IsFood(proto); + + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + // wrong triggering type + if (proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) + continue; + + if (proto->Spells[i].SpellId > 0) { - spell_index = i; - } + spell_index = i; + } } //Temporary fix for starting quests: @@ -320,7 +320,7 @@ bool UseItemAction::UseItemAuto(Player* requester, Item* item) packet << questid; packet << uint32(0); bot->GetSession()->HandleQuestgiverAcceptQuestOpcode(packet); - ostringstream out; out << "Got quest " << chat->formatQuest(qInfo); + std::ostringstream out; out << "Got quest " << chat->formatQuest(qInfo); ai->TellPlayerNoFacing(requester, out.str(), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); return true; } @@ -334,13 +334,13 @@ bool UseItemAction::UseItemAuto(Player* requester, Item* item) WorldPacket packet(CMSG_USE_ITEM); packet << bagIndex << slot << spell_index << cast_count << item_guid; #endif -#ifdef MANGOSBOT_TWO - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - { - if (item->GetProto()->Spells[i].SpellId > 0) - { - spellId = item->GetProto()->Spells[i].SpellId; - break; +#ifdef MANGOSBOT_TWO + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + if (item->GetProto()->Spells[i].SpellId > 0) + { + spellId = item->GetProto()->Spells[i].SpellId; + break; } } @@ -366,7 +366,7 @@ bool UseItemAction::UseItemAuto(Player* requester, Item* item) float p; if (isDrink && isFood) { - p = min(hp, mp); + p = std::min(hp, mp); TellConsumableUse(requester, item, "Feasting", p); } else if (isDrink) @@ -459,30 +459,30 @@ bool UseItemAction::UseItem(Player* requester, Item* item, ObjectGuid goGuid, It if (itemTarget) { - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - { - if (item->GetProto()->Spells[i].SpellId > 0) - { - spellId = item->GetProto()->Spells[i].SpellId; - spell_index = i; - break; - } + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + if (item->GetProto()->Spells[i].SpellId > 0) + { + spellId = item->GetProto()->Spells[i].SpellId; + spell_index = i; + break; + } } } - + #ifdef MANGOSBOT_ZERO WorldPacket packet(CMSG_USE_ITEM); packet << bagIndex << slot << spell_index; #elif MANGOSBOT_ONE WorldPacket packet(CMSG_USE_ITEM); packet << bagIndex << slot << spell_index << cast_count << item_guid; -#elif MANGOSBOT_TWO - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - { - if (item->GetProto()->Spells[i].SpellId > 0) - { - spellId = item->GetProto()->Spells[i].SpellId; - break; +#elif MANGOSBOT_TWO + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + if (item->GetProto()->Spells[i].SpellId > 0) + { + spellId = item->GetProto()->Spells[i].SpellId; + break; } } @@ -492,9 +492,9 @@ bool UseItemAction::UseItem(Player* requester, Item* item, ObjectGuid goGuid, It bool targetSelected = false; - map replyArgs; + std::map replyArgs; replyArgs["%target"] = chat->formatItem(item); - ostringstream replyStr; replyStr << BOT_TEXT("use_command"); + std::ostringstream replyStr; replyStr << BOT_TEXT("use_command"); if ((int)item->GetProto()->Stackable > 1) { @@ -676,7 +676,7 @@ bool UseItemAction::UseItem(Player* requester, Item* item, ObjectGuid goGuid, It packet << uint32(0); bot->GetSession()->HandleQuestgiverAcceptQuestOpcode(packet); - map args; + std::map args; args["%quest"] = chat->formatQuest(qInfo); ai->TellPlayerNoFacing(requester, BOT_TEXT2("use_command_quest_accepted", args), PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); return true; @@ -775,9 +775,9 @@ bool UseItemAction::UseItem(Player* requester, Item* item, ObjectGuid goGuid, It return true; } -void UseItemAction::TellConsumableUse(Player* requester, Item* item, string action, float percent) +void UseItemAction::TellConsumableUse(Player* requester, Item* item, std::string action, float percent) { - ostringstream out; + std::ostringstream out; out << action << " " << chat->formatItem(item); if ((int)item->GetProto()->Stackable > 1) out << "/x" << item->GetCount(); out << " (" << round(percent) << "%)"; @@ -833,7 +833,7 @@ bool UseItemAction::SocketItem(Player* requester, Item* item, Item* gem, bool re if (fits) { - ostringstream out; out << "Socketing " << chat->formatItem(item); + std::ostringstream out; out << "Socketing " << chat->formatItem(item); out << " with " << chat->formatItem(gem); ai->TellPlayer(requester, out, PlayerbotSecurityLevel::PLAYERBOT_SECURITY_ALLOW_ALL, false); @@ -854,18 +854,18 @@ bool UseItemIdAction::Execute(Event& event) { itemId = GetItemId(); target = GetTarget(); - string params = event.getParam(); - list gos = chat->parseGameobjects(params); + std::string params = event.getParam(); + std::list gos = chat->parseGameobjects(params); if (!gos.empty()) GameObject* go = ai->GetGameObject(*gos.begin()); } else { - vector params = getMultiQualifiers(getQualifier(), ","); + std::vector params = getMultiQualifiers(getQualifier(), ","); itemId = stoi(params[0]); if (params.size() > 1) { - list guidPs = AI_VALUE(list, params[1]); + std::list guidPs = AI_VALUE(std::list, params[1]); if (!guidPs.empty()) { GuidPosition guidP = *guidPs.begin(); @@ -969,7 +969,7 @@ bool UseItemIdAction::CastItemSpell(uint32 itemId, Unit* target, GameObject* goT if (!ai->HasCheat(BotCheatMask::item)) //If bot has no item cheat it needs an item to cast. { - list items = AI_VALUE2(list, "inventory items", chat->formatQItem(itemId)); + std::list items = AI_VALUE2(std::list, "inventory items", chat->formatQItem(itemId)); if (items.empty()) return false; @@ -1057,7 +1057,7 @@ bool UseItemIdAction::isUseful() const ItemPrototype* proto = sObjectMgr.GetItemPrototype(GetItemId()); if (proto) { - set& skipSpells = AI_VALUE(set&, "skip spells list"); + std::set& skipSpells = AI_VALUE(std::set&, "skip spells list"); if(!skipSpells.empty()) { for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) @@ -1145,8 +1145,8 @@ bool UseRandomRecipeAction::isUseful() bool UseRandomRecipeAction::Execute(Event& event) { - list recipes = AI_VALUE2(list, "inventory items", "recipe"); - string recipeName = ""; + std::list recipes = AI_VALUE2(std::list, "inventory items", "recipe"); + std::string recipeName = ""; for (auto& recipe : recipes) { recipeName = recipe->GetProto()->Name1; @@ -1172,7 +1172,7 @@ bool UseRandomQuestItemAction::Execute(Event& event) Unit* unitTarget = nullptr; ObjectGuid goTarget = ObjectGuid(); - list questItems = AI_VALUE2(list, "inventory items", "quest"); + std::list questItems = AI_VALUE2(std::list, "inventory items", "quest"); if (questItems.empty()) return false; @@ -1200,7 +1200,7 @@ bool UseRandomQuestItemAction::Execute(Event& event) { SpellEntry const* spellInfo = sServerFacade.LookupSpellInfo(spellId); - list npcs = AI_VALUE(list, ("nearest npcs")); + std::list npcs = AI_VALUE(std::list, ("nearest npcs")); for (auto& npc : npcs) { Unit* unit = ai->GetUnit(npc); @@ -1212,7 +1212,7 @@ bool UseRandomQuestItemAction::Execute(Event& event) } } - list gos = AI_VALUE(list, ("nearest game objects")); + std::list gos = AI_VALUE(std::list, ("nearest game objects")); for (auto& go : gos) { GameObject* gameObject = ai->GetGameObject(go); diff --git a/playerbot/strategy/actions/UseItemAction.h b/playerbot/strategy/actions/UseItemAction.h index b3a6211c..544bcd6d 100644 --- a/playerbot/strategy/actions/UseItemAction.h +++ b/playerbot/strategy/actions/UseItemAction.h @@ -1,7 +1,7 @@ #pragma once #include "GenericActions.h" #include "playerbot/ServerFacade.h" -#include "../../RandomItemMgr.h" +#include "playerbot/RandomItemMgr.h" namespace ai { @@ -20,7 +20,7 @@ namespace ai class UseItemAction : public ChatCommandAction { public: - UseItemAction(PlayerbotAI* ai, string name = "use", bool selfOnly = false, uint32 duration = sPlayerbotAIConfig.reactDelay) : ChatCommandAction(ai, name, duration), selfOnly(selfOnly) {} + UseItemAction(PlayerbotAI* ai, std::string name = "use", bool selfOnly = false, uint32 duration = sPlayerbotAIConfig.reactDelay) : ChatCommandAction(ai, name, duration), selfOnly(selfOnly) {} public: virtual bool isPossible() override; @@ -37,7 +37,7 @@ namespace ai bool UseItem(Player* requester, Item* item, ObjectGuid go, Item* itemTarget, Unit* unitTarget = nullptr); bool UseGameObject(Player* requester, ObjectGuid guid); bool SocketItem(Player* requester, Item * item, Item * gem, bool replace = false); - void TellConsumableUse(Player* requester, Item* item, string action, float percent); + void TellConsumableUse(Player* requester, Item* item, std::string action, float percent); private: bool selfOnly; @@ -46,7 +46,7 @@ namespace ai class UseItemIdAction : public UseItemAction, public Qualified { public: - UseItemIdAction(PlayerbotAI* ai, string name = "use id", bool selfOnly = false, uint32 duration = sPlayerbotAIConfig.reactDelay) : UseItemAction(ai, name, selfOnly, duration), Qualified() {} + UseItemIdAction(PlayerbotAI* ai, std::string name = "use id", bool selfOnly = false, uint32 duration = sPlayerbotAIConfig.reactDelay) : UseItemAction(ai, name, selfOnly, duration), Qualified() {} virtual bool isPossible() override; virtual bool isUseful() override; @@ -61,7 +61,7 @@ namespace ai class UseTargetedItemIdAction : public UseItemIdAction { public: - UseTargetedItemIdAction(PlayerbotAI* ai, string name, bool selfOnly = false, uint32 duration = sPlayerbotAIConfig.reactDelay) : UseItemIdAction(ai, name, selfOnly, duration) {} + UseTargetedItemIdAction(PlayerbotAI* ai, std::string name, bool selfOnly = false, uint32 duration = sPlayerbotAIConfig.reactDelay) : UseItemIdAction(ai, name, selfOnly, duration) {} virtual Unit* GetTarget() override { return Action::GetTarget(); } virtual uint32 GetItemId() override { return 0; } }; @@ -69,20 +69,20 @@ namespace ai class UseSpellItemAction : public UseItemAction { public: - UseSpellItemAction(PlayerbotAI* ai, string name, bool selfOnly = false) : UseItemAction(ai, name, selfOnly) {} + UseSpellItemAction(PlayerbotAI* ai, std::string name, bool selfOnly = false) : UseItemAction(ai, name, selfOnly) {} virtual bool isUseful() override; }; class UsePotionAction : public UseItemIdAction { public: - UsePotionAction(PlayerbotAI* ai, string name, SpellEffects effect) : UseItemIdAction(ai, name), effect(effect) {} + UsePotionAction(PlayerbotAI* ai, std::string name, SpellEffects effect) : UseItemIdAction(ai, name), effect(effect) {} bool isUseful() override { return UseItemIdAction::isUseful() && AI_VALUE2(bool, "combat", "self target"); } virtual uint32 GetItemId() override { - list items = AI_VALUE2(list, "inventory items", getName()); + std::list items = AI_VALUE2(std::list, "inventory items", getName()); if (items.empty()) { return sRandomItemMgr.GetRandomPotion(bot->GetLevel(), effect); @@ -173,7 +173,7 @@ namespace ai uint32 GetItemId() override { - list items = AI_VALUE2(list, "inventory items", getName()); + std::list items = AI_VALUE2(std::list, "inventory items", getName()); if (items.empty()) { const uint32 level = bot->GetLevel(); @@ -361,8 +361,8 @@ namespace ai if (!bot->InBattleGround() || bot->GetLevel() < 60 || !bot->IsInCombat()) return false; - list units = *context->GetValue >("nearest npcs no los"); - for (list::iterator i = units.begin(); i != units.end(); i++) + std::list units = *context->GetValue >("nearest npcs no los"); + for (std::list::iterator i = units.begin(); i != units.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit) @@ -441,7 +441,7 @@ namespace ai return true; } - virtual string GetTargetName() override { return "self target"; } + virtual std::string GetTargetName() override { return "self target"; } virtual uint32 GetItemId() override { @@ -475,7 +475,7 @@ namespace ai public: ThrowGrenadeAction(PlayerbotAI* ai) : UseTargetedItemIdAction(ai, "throw grenade") {} - virtual string GetTargetName() override { return "current target"; } + virtual std::string GetTargetName() override { return "current target"; } virtual bool isUseful() override { diff --git a/playerbot/strategy/actions/UseMeetingStoneAction.cpp b/playerbot/strategy/actions/UseMeetingStoneAction.cpp index 3e43b2f9..d3833732 100644 --- a/playerbot/strategy/actions/UseMeetingStoneAction.cpp +++ b/playerbot/strategy/actions/UseMeetingStoneAction.cpp @@ -104,12 +104,12 @@ bool SummonAction::Execute(Event& event) bool SummonAction::SummonUsingGos(Player* requester, Player *summoner, Player *player) { - list targets; + std::list targets; AnyGameObjectInObjectRangeCheck u_check(summoner, sPlayerbotAIConfig.sightDistance); GameObjectListSearcher searcher(targets, u_check); Cell::VisitAllObjects((const WorldObject*)summoner, searcher, sPlayerbotAIConfig.sightDistance); - for(list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) + for(std::list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { GameObject* go = *tIter; if (go && sServerFacade.isSpawned(go) && go->GetGoType() == GAMEOBJECT_TYPE_MEETINGSTONE) @@ -125,11 +125,11 @@ bool SummonAction::SummonUsingNpcs(Player* requester, Player *summoner, Player * if (!sPlayerbotAIConfig.summonAtInnkeepersEnabled) return false; - list targets; + std::list targets; AnyUnitInObjectRangeCheck u_check(summoner, sPlayerbotAIConfig.sightDistance); UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(summoner, searcher, sPlayerbotAIConfig.sightDistance); - for(list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) + for(std::list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { Unit* unit = *tIter; if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER)) diff --git a/playerbot/strategy/actions/UseMeetingStoneAction.h b/playerbot/strategy/actions/UseMeetingStoneAction.h index f8d5dec9..92a1ffbe 100644 --- a/playerbot/strategy/actions/UseMeetingStoneAction.h +++ b/playerbot/strategy/actions/UseMeetingStoneAction.h @@ -6,7 +6,7 @@ namespace ai class SummonAction : public MovementAction { public: - SummonAction(PlayerbotAI* ai, string name = "summon") : MovementAction(ai, name) {} + SummonAction(PlayerbotAI* ai, std::string name = "summon") : MovementAction(ai, name) {} bool isPossible() override { return true; } bool isUseful() override { return true; } bool isUsefulWhenStunned() override { return true; } diff --git a/playerbot/strategy/actions/UseTrinketAction.cpp b/playerbot/strategy/actions/UseTrinketAction.cpp index 1a3f8233..3716d610 100644 --- a/playerbot/strategy/actions/UseTrinketAction.cpp +++ b/playerbot/strategy/actions/UseTrinketAction.cpp @@ -10,7 +10,7 @@ using namespace ai; bool UseTrinketAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - list trinkets = AI_VALUE(list, "trinkets on use"); + std::list trinkets = AI_VALUE(std::list, "trinkets on use"); for (Item* item : trinkets) { const ItemPrototype* proto = item->GetProto(); @@ -28,5 +28,5 @@ bool UseTrinketAction::Execute(Event& event) bool UseTrinketAction::isPossible() { - return !AI_VALUE(list, "trinkets on use").empty(); + return !AI_VALUE(std::list, "trinkets on use").empty(); } diff --git a/playerbot/strategy/actions/ValueActions.cpp b/playerbot/strategy/actions/ValueActions.cpp index 619265c7..357bfbf0 100644 --- a/playerbot/strategy/actions/ValueActions.cpp +++ b/playerbot/strategy/actions/ValueActions.cpp @@ -203,17 +203,17 @@ bool SetFocusHealTargetAction::Execute(Event& event) bool SetWaitForAttackTimeAction::Execute(Event& event) { Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); - string newTimeStr = event.getParam(); + std::string newTimeStr = event.getParam(); if (!newTimeStr.empty()) { // Check if the param is a number if (newTimeStr.find_first_not_of("0123456789") == std::string::npos) { - const int newTime = stoi(newTimeStr.c_str()); + const int newTime = std::stoi(newTimeStr.c_str()); if (newTime <= 99) { ai->GetAiObjectContext()->GetValue("wait for attack time")->Set(newTime); - ostringstream out; out << "Wait for attack time set to " << newTime << " seconds"; + std::ostringstream out; out << "Wait for attack time set to " << newTime << " seconds"; ai->TellPlayerNoFacing(requester, out); return true; } diff --git a/playerbot/strategy/actions/ValueActions.h b/playerbot/strategy/actions/ValueActions.h index fb56abf9..04d42b0b 100644 --- a/playerbot/strategy/actions/ValueActions.h +++ b/playerbot/strategy/actions/ValueActions.h @@ -6,21 +6,21 @@ namespace ai class SetFocusHealTargetAction : public ChatCommandAction { public: - SetFocusHealTargetAction(PlayerbotAI* ai, string name = "focus heal target") : ChatCommandAction(ai, name) {} + SetFocusHealTargetAction(PlayerbotAI* ai, std::string name = "focus heal target") : ChatCommandAction(ai, name) {} bool Execute(Event& event) override; }; class SetWaitForAttackTimeAction : public ChatCommandAction { public: - SetWaitForAttackTimeAction(PlayerbotAI* ai, string name = "wait for attack time") : ChatCommandAction(ai, name) {} + SetWaitForAttackTimeAction(PlayerbotAI* ai, std::string name = "wait for attack time") : ChatCommandAction(ai, name) {} bool Execute(Event& event) override; }; class SetFollowTargetAction : public ChatCommandAction { public: - SetFollowTargetAction(PlayerbotAI* ai, string name = "follow target") : ChatCommandAction(ai, name) {} + SetFollowTargetAction(PlayerbotAI* ai, std::string name = "follow target") : ChatCommandAction(ai, name) {} bool Execute(Event& event) override; }; } diff --git a/playerbot/strategy/actions/VehicleActions.cpp b/playerbot/strategy/actions/VehicleActions.cpp index 7fdb52fc..abbdd8fb 100644 --- a/playerbot/strategy/actions/VehicleActions.cpp +++ b/playerbot/strategy/actions/VehicleActions.cpp @@ -16,8 +16,8 @@ bool EnterVehicleAction::Execute(Event& event) if (transportInfo && transportInfo->IsOnVehicle()) return false; - list npcs = AI_VALUE(list, "nearest vehicles"); - for (list::iterator i = npcs.begin(); i != npcs.end(); i++) + std::list npcs = AI_VALUE(std::list, "nearest vehicles"); + for (std::list::iterator i = npcs.begin(); i != npcs.end(); i++) { Unit* vehicle = ai->GetUnit(*i); if (!vehicle) @@ -25,14 +25,14 @@ bool EnterVehicleAction::Execute(Event& event) if (!vehicle->IsFriend(bot)) { - ostringstream out; out << "Vehicle is not friendy!"; + std::ostringstream out; out << "Vehicle is not friendy!"; bot->Say(out.str(), LANG_UNIVERSAL); continue; } if (!vehicle->GetVehicleInfo()->CanBoard(bot)) { - ostringstream out; out << "Can't enter Vehicle!"; + std::ostringstream out; out << "Can't enter Vehicle!"; bot->Say(out.str(), LANG_UNIVERSAL); continue; } @@ -49,7 +49,7 @@ bool EnterVehicleAction::Execute(Event& event) uint8 seat = 0; vehicle->GetVehicleInfo()->Board(bot, seat); - ostringstream out; out << "Entering Vehicle!"; + std::ostringstream out; out << "Entering Vehicle!"; bot->Say(out.str(), LANG_UNIVERSAL); continue; diff --git a/playerbot/strategy/actions/VehicleActions.h b/playerbot/strategy/actions/VehicleActions.h index 0e8f07c7..15031afd 100644 --- a/playerbot/strategy/actions/VehicleActions.h +++ b/playerbot/strategy/actions/VehicleActions.h @@ -10,7 +10,7 @@ namespace ai class EnterVehicleAction : public MovementAction { public: - EnterVehicleAction(PlayerbotAI* ai, string name = "enter vehicle") : MovementAction(ai, name) {} + EnterVehicleAction(PlayerbotAI* ai, std::string name = "enter vehicle") : MovementAction(ai, name) {} virtual bool Execute(Event& event); //virtual bool isUseful(); }; @@ -18,7 +18,7 @@ namespace ai class LeaveVehicleAction : public MovementAction { public: - LeaveVehicleAction(PlayerbotAI* ai, string name = "leave vehicle") : MovementAction(ai, name) {} + LeaveVehicleAction(PlayerbotAI* ai, std::string name = "leave vehicle") : MovementAction(ai, name) {} virtual bool Execute(Event& event); //virtual bool isUseful(); }; diff --git a/playerbot/strategy/actions/WaitForAttackAction.cpp b/playerbot/strategy/actions/WaitForAttackAction.cpp index ceff5053..4e1246fe 100644 --- a/playerbot/strategy/actions/WaitForAttackAction.cpp +++ b/playerbot/strategy/actions/WaitForAttackAction.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "WaitForAttackAction.h" -#include "../generic/CombatStrategy.h" +#include "playerbot/strategy/generic/CombatStrategy.h" using namespace ai; diff --git a/playerbot/strategy/actions/WhoAction.cpp b/playerbot/strategy/actions/WhoAction.cpp index 8286add6..9b8189ab 100644 --- a/playerbot/strategy/actions/WhoAction.cpp +++ b/playerbot/strategy/actions/WhoAction.cpp @@ -3,7 +3,7 @@ #include "WhoAction.h" #include "playerbot/AiFactory.h" #include "playerbot/strategy/ItemVisitors.h" -#include "../../../ahbot/AhBot.h" +#include "ahbot/AhBot.h" #include "playerbot/RandomPlayerbotMgr.h" using namespace ai; @@ -31,8 +31,8 @@ bool WhoAction::Execute(Event& event) if (!sObjectMgr.GetPlayer(owner->GetObjectGuid())) return false; - ostringstream out; - string text = event.getParam(); + std::ostringstream out; + std::string text = event.getParam(); if (!text.empty()) { out << QuerySkill(text); @@ -59,7 +59,7 @@ bool WhoAction::Execute(Event& event) out << "playing with " << ai->GetMaster()->GetName(); } - string tell = out.str(); + std::string tell = out.str(); if (tell.empty()) return false; @@ -69,14 +69,14 @@ bool WhoAction::Execute(Event& event) } -string WhoAction::QueryTrade(string text) +std::string WhoAction::QueryTrade(std::string text) { - ostringstream out; + std::ostringstream out; IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list items = ai->InventoryParseItems(text, mask); - for (list::iterator i = items.begin(); i != items.end(); ++i) + std::list items = ai->InventoryParseItems(text, mask); + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Item* sell = *i; int32 sellPrice = auctionbot.GetSellPrice(sell->GetProto()) * sRandomPlayerbotMgr.GetSellMultiplier(bot) * sell->GetCount(); @@ -90,14 +90,14 @@ string WhoAction::QueryTrade(string text) return ""; } -string WhoAction::QuerySkill(string text) +std::string WhoAction::QuerySkill(std::string text) { - ostringstream out; + std::ostringstream out; uint32 skill = chat->parseSkill(text); if (!skill || !ai->HasSkill((SkillType)skill)) return ""; - string skillName = chat->formatSkill(skill); + std::string skillName = chat->formatSkill(skill); uint32 spellId = AI_VALUE2(uint32, "spell id", skillName); uint16 value = bot->GetSkillValue(skill); #ifdef MANGOS @@ -107,7 +107,7 @@ string WhoAction::QuerySkill(string text) uint16 maxSkill = bot->GetSkillMax(skill); #endif ObjectGuid guid = bot->GetObjectGuid(); - string data = "0"; + std::string data = "0"; out << "|cFFFFFF00|Htrade:" << spellId << ":" << value << ":" << maxSkill << ":" << std::hex << std::uppercase << guid.GetRawValue() << std::nouppercase << std::dec << ":" << data @@ -118,9 +118,9 @@ string WhoAction::QuerySkill(string text) return out.str(); } -string WhoAction::QuerySpec(string text) +std::string WhoAction::QuerySpec(std::string text) { - ostringstream out; + std::ostringstream out; int spec = AiFactory::GetPlayerSpecTab(bot); out << "|h|cffffffff" << chat->formatClass(bot, spec); diff --git a/playerbot/strategy/actions/WhoAction.h b/playerbot/strategy/actions/WhoAction.h index 00ee9b29..a6319aaa 100644 --- a/playerbot/strategy/actions/WhoAction.h +++ b/playerbot/strategy/actions/WhoAction.h @@ -10,8 +10,8 @@ namespace ai virtual bool Execute(Event& event) override; bool isUsefulWhenStunned() override { return true; } private: - string QueryTrade(string text); - string QuerySkill(string text); - string QuerySpec(string text); + std::string QueryTrade(std::string text); + std::string QuerySkill(std::string text); + std::string QuerySpec(std::string text); }; } diff --git a/playerbot/strategy/actions/WorldBuffAction.cpp b/playerbot/strategy/actions/WorldBuffAction.cpp index 8e9c8ecb..7492f62d 100644 --- a/playerbot/strategy/actions/WorldBuffAction.cpp +++ b/playerbot/strategy/actions/WorldBuffAction.cpp @@ -7,7 +7,7 @@ using namespace ai; bool WorldBuffAction::Execute(Event& event) { - string text = event.getParam(); + std::string text = event.getParam(); for (auto& wb : NeedWorldBuffs(bot)) { @@ -17,9 +17,9 @@ bool WorldBuffAction::Execute(Event& event) return false; } -vector WorldBuffAction::NeedWorldBuffs(Unit* unit) +std::vector WorldBuffAction::NeedWorldBuffs(Unit* unit) { - vector retVec; + std::vector retVec; if (sPlayerbotAIConfig.worldBuffs.empty()) return retVec; diff --git a/playerbot/strategy/actions/WorldBuffAction.h b/playerbot/strategy/actions/WorldBuffAction.h index 8dc65282..216b9edb 100644 --- a/playerbot/strategy/actions/WorldBuffAction.h +++ b/playerbot/strategy/actions/WorldBuffAction.h @@ -8,7 +8,7 @@ namespace ai public: WorldBuffAction(PlayerbotAI* ai) : Action(ai, "world buff") {} virtual bool Execute(Event& event); - static vector NeedWorldBuffs(Unit* unit); + static std::vector NeedWorldBuffs(Unit* unit); //static bool AddAura(Unit* unit, uint32 spellId); private: }; diff --git a/playerbot/strategy/actions/WtsAction.cpp b/playerbot/strategy/actions/WtsAction.cpp index 0d21ee68..f5131a57 100644 --- a/playerbot/strategy/actions/WtsAction.cpp +++ b/playerbot/strategy/actions/WtsAction.cpp @@ -3,8 +3,8 @@ #include "WtsAction.h" #include "playerbot/AiFactory.h" #include "playerbot/strategy/ItemVisitors.h" -#include "../../../ahbot/AhBot.h" -#include "../../../ahbot/PricingStrategy.h" +#include "ahbot/AhBot.h" +#include "ahbot/PricingStrategy.h" #include "playerbot/RandomPlayerbotMgr.h" #include "playerbot/strategy/values/ItemUsageValue.h" @@ -18,13 +18,13 @@ bool WtsAction::Execute(Event& event) if (!owner) return false; - ostringstream out; - string text = event.getParam(); + std::ostringstream out; + std::string text = event.getParam(); if (!sRandomPlayerbotMgr.IsRandomBot(bot)) return false; - string link = event.getParam(); + std::string link = event.getParam(); ItemIds itemIds = chat->parseItems(link); if (itemIds.empty()) @@ -37,7 +37,7 @@ bool WtsAction::Execute(Event& event) if (!proto) continue; - ostringstream out; out << itemId; + std::ostringstream out; out << itemId; ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", out.str()); if (usage == ItemUsage::ITEM_USAGE_NONE) continue; @@ -49,7 +49,7 @@ bool WtsAction::Execute(Event& event) if (urand(0, 15) > 2) continue; - ostringstream tell; + std::ostringstream tell; tell << "I'll buy " << chat->formatItem(proto) << " for " << chat->formatMoney(buyPrice); // ignore random bot chat filter diff --git a/playerbot/strategy/actions/XpGainAction.cpp b/playerbot/strategy/actions/XpGainAction.cpp index 69ab8776..8207cf25 100644 --- a/playerbot/strategy/actions/XpGainAction.cpp +++ b/playerbot/strategy/actions/XpGainAction.cpp @@ -28,7 +28,7 @@ bool XpGainAction::Execute(Event& event) if (sPlayerbotAIConfig.hasLog("bot_events.csv")) { - sPlayerbotAIConfig.logEvent(ai, "XpGainAction", guid, to_string(xpgain)); + sPlayerbotAIConfig.logEvent(ai, "XpGainAction", guid, std::to_string(xpgain)); } AI_VALUE(LootObjectStack*, "available loot")->Add(guid); @@ -44,7 +44,7 @@ bool XpGainAction::Execute(Event& event) if (guild) { - map placeholders; + std::map placeholders; placeholders["%name"] = creature->GetName(); if(urand(0,3)) diff --git a/playerbot/strategy/deathknight/BloodDKStrategy.h b/playerbot/strategy/deathknight/BloodDKStrategy.h index 304403ec..9dc7bb77 100644 --- a/playerbot/strategy/deathknight/BloodDKStrategy.h +++ b/playerbot/strategy/deathknight/BloodDKStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: BloodDKStrategy(PlayerbotAI* ai); - string getName() override { return "blood"; } + std::string getName() override { return "blood"; } int GetType() override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } private: diff --git a/playerbot/strategy/deathknight/DKActions.cpp b/playerbot/strategy/deathknight/DKActions.cpp index 344298d2..f92698aa 100644 --- a/playerbot/strategy/deathknight/DKActions.cpp +++ b/playerbot/strategy/deathknight/DKActions.cpp @@ -12,7 +12,7 @@ bool CastRaiseDeadAction::isPossible() if (AI_VALUE2(uint32, "item count", "corpse dust") > 0) return true; - for (auto guid : AI_VALUE(list, "nearest corpses")) + for (auto guid : AI_VALUE(std::list, "nearest corpses")) { Creature* creature = ai->GetCreature(guid); @@ -28,7 +28,7 @@ bool CastRaiseDeadAction::isPossible() return true; } - for (auto guid : AI_VALUE(list, "nearest friendly players")) + for (auto guid : AI_VALUE(std::list, "nearest friendly players")) { Player* player = dynamic_cast(ai->GetUnit(guid)); @@ -41,7 +41,7 @@ bool CastRaiseDeadAction::isPossible() return true; } - for (auto guid : AI_VALUE(list, "enemy player targets")) + for (auto guid : AI_VALUE(std::list, "enemy player targets")) { Player* player = dynamic_cast(ai->GetUnit(guid)); diff --git a/playerbot/strategy/deathknight/DKActions.h b/playerbot/strategy/deathknight/DKActions.h index 065fc910..a9103fa0 100644 --- a/playerbot/strategy/deathknight/DKActions.h +++ b/playerbot/strategy/deathknight/DKActions.h @@ -41,7 +41,7 @@ namespace ai // Unholy presence class CastUnholyMeleeSpellAction : public CastMeleeSpellAction { public: - CastUnholyMeleeSpellAction(PlayerbotAI* ai, string spell) : CastMeleeSpellAction(ai, spell) {} + CastUnholyMeleeSpellAction(PlayerbotAI* ai, std::string spell) : CastMeleeSpellAction(ai, spell) {} virtual NextAction** getPrerequisites() { return NextAction::merge(NextAction::array(0, new NextAction("unholy presence"), NULL), CastMeleeSpellAction::getPrerequisites()); } @@ -51,7 +51,7 @@ namespace ai // Frost presence class CastFrostMeleeSpellAction : public CastMeleeSpellAction { public: - CastFrostMeleeSpellAction(PlayerbotAI* ai, string spell) : CastMeleeSpellAction(ai, spell) {} + CastFrostMeleeSpellAction(PlayerbotAI* ai, std::string spell) : CastMeleeSpellAction(ai, spell) {} virtual NextAction** getPrerequisites() { return NextAction::merge(NextAction::array(0, new NextAction("frost presence"), NULL), CastMeleeSpellAction::getPrerequisites()); } @@ -60,7 +60,7 @@ namespace ai // Blood presence class CastBloodMeleeSpellAction : public CastMeleeSpellAction { public: - CastBloodMeleeSpellAction(PlayerbotAI* ai, string spell) : CastMeleeSpellAction(ai, spell) {} + CastBloodMeleeSpellAction(PlayerbotAI* ai, std::string spell) : CastMeleeSpellAction(ai, spell) {} virtual NextAction** getPrerequisites() { return NextAction::merge(NextAction::array(0, new NextAction("blood presence"), NULL), CastMeleeSpellAction::getPrerequisites()); } diff --git a/playerbot/strategy/deathknight/DKAiObjectContext.cpp b/playerbot/strategy/deathknight/DKAiObjectContext.cpp index 8b1758a6..f2dec172 100644 --- a/playerbot/strategy/deathknight/DKAiObjectContext.cpp +++ b/playerbot/strategy/deathknight/DKAiObjectContext.cpp @@ -1,6 +1,6 @@ #include "playerbot/playerbot.h" -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" #include "DKActions.h" #include "DKAiObjectContext.h" #include "FrostDKStrategy.h" @@ -8,9 +8,9 @@ #include "GenericDKNonCombatStrategy.h" #include "DKReactionStrategy.h" #include "UnholyDKStrategy.h" -#include "../generic/PullStrategy.h" +#include "playerbot/strategy/generic/PullStrategy.h" #include "DKTriggers.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" using namespace ai; diff --git a/playerbot/strategy/deathknight/DKAiObjectContext.h b/playerbot/strategy/deathknight/DKAiObjectContext.h index b5b86ca7..7520970e 100644 --- a/playerbot/strategy/deathknight/DKAiObjectContext.h +++ b/playerbot/strategy/deathknight/DKAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/deathknight/DKReactionStrategy.h b/playerbot/strategy/deathknight/DKReactionStrategy.h index 6eba5656..f43ecfc7 100644 --- a/playerbot/strategy/deathknight/DKReactionStrategy.h +++ b/playerbot/strategy/deathknight/DKReactionStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ReactionStrategy.h" +#include "playerbot/strategy/generic/ReactionStrategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: DKReactionStrategy(PlayerbotAI* ai) : ReactionStrategy(ai) {} - string getName() override { return "react"; } + std::string getName() override { return "react"; } private: void InitReactionTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/deathknight/DKTriggers.h b/playerbot/strategy/deathknight/DKTriggers.h index 9fbdb52f..a3caf641 100644 --- a/playerbot/strategy/deathknight/DKTriggers.h +++ b/playerbot/strategy/deathknight/DKTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { diff --git a/playerbot/strategy/deathknight/FrostDKStrategy.h b/playerbot/strategy/deathknight/FrostDKStrategy.h index 10408786..963f1a16 100644 --- a/playerbot/strategy/deathknight/FrostDKStrategy.h +++ b/playerbot/strategy/deathknight/FrostDKStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: FrostDKStrategy(PlayerbotAI* ai); - string getName() override { return "frost"; } + std::string getName() override { return "frost"; } int GetType() override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } private: @@ -19,7 +19,7 @@ namespace ai { public: FrostDKAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {} - string getName() override { return "frost aoe"; } + std::string getName() override { return "frost aoe"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/deathknight/GenericDKNonCombatStrategy.h b/playerbot/strategy/deathknight/GenericDKNonCombatStrategy.h index a61c78d5..9a473585 100644 --- a/playerbot/strategy/deathknight/GenericDKNonCombatStrategy.h +++ b/playerbot/strategy/deathknight/GenericDKNonCombatStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/NonCombatStrategy.h" +#include "playerbot/strategy/generic/NonCombatStrategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: GenericDKNonCombatStrategy(PlayerbotAI* ai); - string getName() override { return "nc"; } + std::string getName() override { return "nc"; } private: void InitNonCombatTriggers(std::list &triggers) override; @@ -17,7 +17,7 @@ namespace ai { public: DKBuffDpsStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "bdps"; } + std::string getName() override { return "bdps"; } private: void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/deathknight/GenericDKStrategy.h b/playerbot/strategy/deathknight/GenericDKStrategy.h index a5d13b53..9bbfb327 100644 --- a/playerbot/strategy/deathknight/GenericDKStrategy.h +++ b/playerbot/strategy/deathknight/GenericDKStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/MeleeCombatStrategy.h" +#include "playerbot/strategy/generic/MeleeCombatStrategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: GenericDKStrategy(PlayerbotAI* ai); - virtual string getName() override { return "DK"; } + virtual std::string getName() override { return "DK"; } protected: virtual void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/deathknight/UnholyDKStrategy.h b/playerbot/strategy/deathknight/UnholyDKStrategy.h index 9075ad36..598f1e35 100644 --- a/playerbot/strategy/deathknight/UnholyDKStrategy.h +++ b/playerbot/strategy/deathknight/UnholyDKStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: UnholyDKStrategy(PlayerbotAI* ai) : GenericDKStrategy(ai) {} - string getName() override { return "unholy"; } + std::string getName() override { return "unholy"; } int GetType() override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } private: @@ -20,7 +20,7 @@ namespace ai { public: UnholyDKAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {} - string getName() override { return "unholy aoe"; } + std::string getName() override { return "unholy aoe"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/druid/BalanceDruidStrategy.h b/playerbot/strategy/druid/BalanceDruidStrategy.h index 3b2eab02..4be798f7 100644 --- a/playerbot/strategy/druid/BalanceDruidStrategy.h +++ b/playerbot/strategy/druid/BalanceDruidStrategy.h @@ -8,7 +8,7 @@ namespace ai public: BalanceDruidPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "balance"; } + std::string getName() override { return "balance"; } }; class BalanceDruidStrategy : public DruidStrategy @@ -80,7 +80,7 @@ namespace ai { public: BalanceDruidAoePveStrategy(PlayerbotAI* ai) : BalanceDruidAoeStrategy(ai) {} - string getName() override { return "aoe balance pve"; } + std::string getName() override { return "aoe balance pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -91,7 +91,7 @@ namespace ai { public: BalanceDruidAoePvpStrategy(PlayerbotAI* ai) : BalanceDruidAoeStrategy(ai) {} - string getName() override { return "aoe balance pvp"; } + std::string getName() override { return "aoe balance pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -102,7 +102,7 @@ namespace ai { public: BalanceDruidAoeRaidStrategy(PlayerbotAI* ai) : BalanceDruidAoeStrategy(ai) {} - string getName() override { return "aoe balance raid"; } + std::string getName() override { return "aoe balance raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -123,7 +123,7 @@ namespace ai { public: BalanceDruidBuffPveStrategy(PlayerbotAI* ai) : BalanceDruidBuffStrategy(ai) {} - string getName() override { return "buff balance pve"; } + std::string getName() override { return "buff balance pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -134,7 +134,7 @@ namespace ai { public: BalanceDruidBuffPvpStrategy(PlayerbotAI* ai) : BalanceDruidBuffStrategy(ai) {} - string getName() override { return "buff balance pvp"; } + std::string getName() override { return "buff balance pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -145,7 +145,7 @@ namespace ai { public: BalanceDruidBuffRaidStrategy(PlayerbotAI* ai) : BalanceDruidBuffStrategy(ai) {} - string getName() override { return "buff balance raid"; } + std::string getName() override { return "buff balance raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -166,7 +166,7 @@ namespace ai { public: BalanceDruidBoostPveStrategy(PlayerbotAI* ai) : BalanceDruidBoostStrategy(ai) {} - string getName() override { return "boost balance pve"; } + std::string getName() override { return "boost balance pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -177,7 +177,7 @@ namespace ai { public: BalanceDruidBoostPvpStrategy(PlayerbotAI* ai) : BalanceDruidBoostStrategy(ai) {} - string getName() override { return "boost balance pvp"; } + std::string getName() override { return "boost balance pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -188,7 +188,7 @@ namespace ai { public: BalanceDruidBoostRaidStrategy(PlayerbotAI* ai) : BalanceDruidBoostStrategy(ai) {} - string getName() override { return "boost balance raid"; } + std::string getName() override { return "boost balance raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -209,7 +209,7 @@ namespace ai { public: BalanceDruidCcPveStrategy(PlayerbotAI* ai) : BalanceDruidCcStrategy(ai) {} - string getName() override { return "cc balance pve"; } + std::string getName() override { return "cc balance pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -220,7 +220,7 @@ namespace ai { public: BalanceDruidCcPvpStrategy(PlayerbotAI* ai) : BalanceDruidCcStrategy(ai) {} - string getName() override { return "cc balance pvp"; } + std::string getName() override { return "cc balance pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -231,7 +231,7 @@ namespace ai { public: BalanceDruidCcRaidStrategy(PlayerbotAI* ai) : BalanceDruidCcStrategy(ai) {} - string getName() override { return "cc balance raid"; } + std::string getName() override { return "cc balance raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -252,7 +252,7 @@ namespace ai { public: BalanceDruidCurePveStrategy(PlayerbotAI* ai) : BalanceDruidCureStrategy(ai) {} - string getName() override { return "cure balance pve"; } + std::string getName() override { return "cure balance pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -263,7 +263,7 @@ namespace ai { public: BalanceDruidCurePvpStrategy(PlayerbotAI* ai) : BalanceDruidCureStrategy(ai) {} - string getName() override { return "cure balance pvp"; } + std::string getName() override { return "cure balance pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -274,7 +274,7 @@ namespace ai { public: BalanceDruidCureRaidStrategy(PlayerbotAI* ai) : BalanceDruidCureStrategy(ai) {} - string getName() override { return "cure balance raid"; } + std::string getName() override { return "cure balance raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/druid/DpsFeralDruidStrategy.h b/playerbot/strategy/druid/DpsFeralDruidStrategy.h index a0cf9979..755e23b4 100644 --- a/playerbot/strategy/druid/DpsFeralDruidStrategy.h +++ b/playerbot/strategy/druid/DpsFeralDruidStrategy.h @@ -8,7 +8,7 @@ namespace ai public: DpsFeralDruidPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "dps feral"; } + std::string getName() override { return "dps feral"; } }; class DpsFeralDruidStrategy : public DruidStrategy @@ -78,7 +78,7 @@ namespace ai { public: DpsFeralDruidAoePveStrategy(PlayerbotAI* ai) : DpsFeralDruidAoeStrategy(ai) {} - string getName() override { return "aoe dps feral pve"; } + std::string getName() override { return "aoe dps feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: DpsFeralDruidAoePvpStrategy(PlayerbotAI* ai) : DpsFeralDruidAoeStrategy(ai) {} - string getName() override { return "aoe dps feral pvp"; } + std::string getName() override { return "aoe dps feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: DpsFeralDruidAoeRaidStrategy(PlayerbotAI* ai) : DpsFeralDruidAoeStrategy(ai) {} - string getName() override { return "aoe dps feral raid"; } + std::string getName() override { return "aoe dps feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: DpsFeralDruidBuffPveStrategy(PlayerbotAI* ai) : DpsFeralDruidBuffStrategy(ai) {} - string getName() override { return "buff dps feral pve"; } + std::string getName() override { return "buff dps feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: DpsFeralDruidBuffPvpStrategy(PlayerbotAI* ai) : DpsFeralDruidBuffStrategy(ai) {} - string getName() override { return "buff dps feral pvp"; } + std::string getName() override { return "buff dps feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: DpsFeralDruidBuffRaidStrategy(PlayerbotAI* ai) : DpsFeralDruidBuffStrategy(ai) {} - string getName() override { return "buff dps feral raid"; } + std::string getName() override { return "buff dps feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: DpsFeralDruidBoostPveStrategy(PlayerbotAI* ai) : DpsFeralDruidBoostStrategy(ai) {} - string getName() override { return "boost dps feral pve"; } + std::string getName() override { return "boost dps feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: DpsFeralDruidBoostPvpStrategy(PlayerbotAI* ai) : DpsFeralDruidBoostStrategy(ai) {} - string getName() override { return "boost dps feral pvp"; } + std::string getName() override { return "boost dps feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: DpsFeralDruidBoostRaidStrategy(PlayerbotAI* ai) : DpsFeralDruidBoostStrategy(ai) {} - string getName() override { return "boost dps feral raid"; } + std::string getName() override { return "boost dps feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: DpsFeralDruidCcPveStrategy(PlayerbotAI* ai) : DpsFeralDruidCcStrategy(ai) {} - string getName() override { return "cc dps feral pve"; } + std::string getName() override { return "cc dps feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: DpsFeralDruidCcPvpStrategy(PlayerbotAI* ai) : DpsFeralDruidCcStrategy(ai) {} - string getName() override { return "cc dps feral pvp"; } + std::string getName() override { return "cc dps feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: DpsFeralDruidCcRaidStrategy(PlayerbotAI* ai) : DpsFeralDruidCcStrategy(ai) {} - string getName() override { return "cc dps feral raid"; } + std::string getName() override { return "cc dps feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: DpsFeralDruidCurePveStrategy(PlayerbotAI* ai) : DpsFeralDruidCureStrategy(ai) {} - string getName() override { return "cure dps feral pve"; } + std::string getName() override { return "cure dps feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: DpsFeralDruidCurePvpStrategy(PlayerbotAI* ai) : DpsFeralDruidCureStrategy(ai) {} - string getName() override { return "cure dps feral pvp"; } + std::string getName() override { return "cure dps feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: DpsFeralDruidCureRaidStrategy(PlayerbotAI* ai) : DpsFeralDruidCureStrategy(ai) {} - string getName() override { return "cure dps feral raid"; } + std::string getName() override { return "cure dps feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -293,7 +293,7 @@ namespace ai { public: DpsFeralDruidStealthPvpStrategy(PlayerbotAI* ai) : DpsFeralDruidStealthStrategy(ai) {} - string getName() override { return "stealth dps feral pvp"; } + std::string getName() override { return "stealth dps feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -304,7 +304,7 @@ namespace ai { public: DpsFeralDruidStealthPveStrategy(PlayerbotAI* ai) : DpsFeralDruidStealthStrategy(ai) {} - string getName() override { return "stealth dps feral pve"; } + std::string getName() override { return "stealth dps feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -315,7 +315,7 @@ namespace ai { public: DpsFeralDruidStealthRaidStrategy(PlayerbotAI* ai) : DpsFeralDruidStealthStrategy(ai) {} - string getName() override { return "stealth dps feral raid"; } + std::string getName() override { return "stealth dps feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -336,7 +336,7 @@ namespace ai { public: DpsFeralDruidPowershiftStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "powershift"; } + std::string getName() override { return "powershift"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/druid/DruidActions.h b/playerbot/strategy/druid/DruidActions.h index 1614842d..26700408 100644 --- a/playerbot/strategy/druid/DruidActions.h +++ b/playerbot/strategy/druid/DruidActions.h @@ -202,7 +202,7 @@ namespace ai { public: CastInnervateAction(PlayerbotAI* ai) : CastSpellAction(ai, "innervate") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } bool isUseful() override { @@ -388,7 +388,7 @@ namespace ai public: CastProwlAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "prowl") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } virtual bool isUseful() { @@ -578,7 +578,7 @@ namespace ai public: explicit CastLifebloomAction(PlayerbotAI* ai) : CastSpellAction(ai, "lifebloom") {} - string GetTargetName() override { return "party tank without lifebloom"; } + std::string GetTargetName() override { return "party tank without lifebloom"; } }; class UpdateDruidPveStrategiesAction : public UpdateStrategyDependenciesAction diff --git a/playerbot/strategy/druid/DruidAiObjectContext.cpp b/playerbot/strategy/druid/DruidAiObjectContext.cpp index 9df58908..56ec5b41 100644 --- a/playerbot/strategy/druid/DruidAiObjectContext.cpp +++ b/playerbot/strategy/druid/DruidAiObjectContext.cpp @@ -5,10 +5,10 @@ #include "TankFeralDruidStrategy.h" #include "DpsFeralDruidStrategy.h" #include "BalanceDruidStrategy.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "DruidTriggers.h" #include "RestorationDruidStrategy.h" -#include "../generic/PullStrategy.h" +#include "playerbot/strategy/generic/PullStrategy.h" namespace ai { diff --git a/playerbot/strategy/druid/DruidAiObjectContext.h b/playerbot/strategy/druid/DruidAiObjectContext.h index b5d7a2cd..83f2cdca 100644 --- a/playerbot/strategy/druid/DruidAiObjectContext.h +++ b/playerbot/strategy/druid/DruidAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/druid/DruidStrategy.h b/playerbot/strategy/druid/DruidStrategy.h index f5d1f3eb..932ceed5 100644 --- a/playerbot/strategy/druid/DruidStrategy.h +++ b/playerbot/strategy/druid/DruidStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { diff --git a/playerbot/strategy/druid/DruidTriggers.cpp b/playerbot/strategy/druid/DruidTriggers.cpp index 3ff0f745..ee81aacf 100644 --- a/playerbot/strategy/druid/DruidTriggers.cpp +++ b/playerbot/strategy/druid/DruidTriggers.cpp @@ -16,8 +16,8 @@ bool EntanglingRootsKiteTrigger::IsActive() if (!GetTarget()->HasMana()) return false; - list attackers = context->GetValue>("attackers")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); i++) + std::list attackers = context->GetValue>("attackers")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit || !sServerFacade.IsAlive(unit)) diff --git a/playerbot/strategy/druid/DruidTriggers.h b/playerbot/strategy/druid/DruidTriggers.h index 2dc6ec20..da10d6fc 100644 --- a/playerbot/strategy/druid/DruidTriggers.h +++ b/playerbot/strategy/druid/DruidTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { diff --git a/playerbot/strategy/druid/DruidValues.cpp b/playerbot/strategy/druid/DruidValues.cpp index f598b57b..7349f37b 100644 --- a/playerbot/strategy/druid/DruidValues.cpp +++ b/playerbot/strategy/druid/DruidValues.cpp @@ -22,7 +22,7 @@ class TankWithoutLifebloomPredicate : public FindPlayerPredicate, public Playerb } private: - vector auras; + std::vector auras; }; Unit* PartyTankWithoutLifebloomValue::Calculate() diff --git a/playerbot/strategy/druid/DruidValues.h b/playerbot/strategy/druid/DruidValues.h index c9fca8e2..f3dbfec1 100644 --- a/playerbot/strategy/druid/DruidValues.h +++ b/playerbot/strategy/druid/DruidValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/strategy/values/PartyMemberValue.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class PartyTankWithoutLifebloomValue : public PartyMemberValue, public Qualified { public: - PartyTankWithoutLifebloomValue(PlayerbotAI* ai, string name = "party tank without lifebloom", float range = 40.0f) : + PartyTankWithoutLifebloomValue(PlayerbotAI* ai, std::string name = "party tank without lifebloom", float range = 40.0f) : PartyMemberValue(ai, name), Qualified() {} protected: diff --git a/playerbot/strategy/druid/RestorationDruidStrategy.h b/playerbot/strategy/druid/RestorationDruidStrategy.h index 3e5d909c..58263233 100644 --- a/playerbot/strategy/druid/RestorationDruidStrategy.h +++ b/playerbot/strategy/druid/RestorationDruidStrategy.h @@ -8,7 +8,7 @@ namespace ai public: RestorationDruidPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_HEAL | STRATEGY_TYPE_RANGED; } - string getName() override { return "restoration"; } + std::string getName() override { return "restoration"; } }; class RestorationDruidStrategy : public DruidStrategy @@ -76,7 +76,7 @@ namespace ai { public: RestorationDruidAoePveStrategy(PlayerbotAI* ai) : RestorationDruidAoeStrategy(ai) {} - string getName() override { return "aoe restoration pve"; } + std::string getName() override { return "aoe restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: RestorationDruidAoePvpStrategy(PlayerbotAI* ai) : RestorationDruidAoeStrategy(ai) {} - string getName() override { return "aoe restoration pvp"; } + std::string getName() override { return "aoe restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: RestorationDruidAoeRaidStrategy(PlayerbotAI* ai) : RestorationDruidAoeStrategy(ai) {} - string getName() override { return "aoe restoration raid"; } + std::string getName() override { return "aoe restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: RestorationDruidBuffPveStrategy(PlayerbotAI* ai) : RestorationDruidBuffStrategy(ai) {} - string getName() override { return "buff restoration pve"; } + std::string getName() override { return "buff restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: RestorationDruidBuffPvpStrategy(PlayerbotAI* ai) : RestorationDruidBuffStrategy(ai) {} - string getName() override { return "buff restoration pvp"; } + std::string getName() override { return "buff restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: RestorationDruidBuffRaidStrategy(PlayerbotAI* ai) : RestorationDruidBuffStrategy(ai) {} - string getName() override { return "buff restoration raid"; } + std::string getName() override { return "buff restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: RestorationDruidBoostPveStrategy(PlayerbotAI* ai) : RestorationDruidBoostStrategy(ai) {} - string getName() override { return "boost restoration pve"; } + std::string getName() override { return "boost restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: RestorationDruidBoostPvpStrategy(PlayerbotAI* ai) : RestorationDruidBoostStrategy(ai) {} - string getName() override { return "boost restoration pvp"; } + std::string getName() override { return "boost restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: RestorationDruidBoostRaidStrategy(PlayerbotAI* ai) : RestorationDruidBoostStrategy(ai) {} - string getName() override { return "boost restoration raid"; } + std::string getName() override { return "boost restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: RestorationDruidCcPveStrategy(PlayerbotAI* ai) : RestorationDruidCcStrategy(ai) {} - string getName() override { return "cc restoration pve"; } + std::string getName() override { return "cc restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: RestorationDruidCcPvpStrategy(PlayerbotAI* ai) : RestorationDruidCcStrategy(ai) {} - string getName() override { return "cc restoration pvp"; } + std::string getName() override { return "cc restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: RestorationDruidCcRaidStrategy(PlayerbotAI* ai) : RestorationDruidCcStrategy(ai) {} - string getName() override { return "cc restoration raid"; } + std::string getName() override { return "cc restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -248,7 +248,7 @@ namespace ai { public: RestorationDruidCurePveStrategy(PlayerbotAI* ai) : RestorationDruidCureStrategy(ai) {} - string getName() override { return "cure restoration pve"; } + std::string getName() override { return "cure restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -259,7 +259,7 @@ namespace ai { public: RestorationDruidCurePvpStrategy(PlayerbotAI* ai) : RestorationDruidCureStrategy(ai) {} - string getName() override { return "cure restoration pvp"; } + std::string getName() override { return "cure restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -270,7 +270,7 @@ namespace ai { public: RestorationDruidCureRaidStrategy(PlayerbotAI* ai) : RestorationDruidCureStrategy(ai) {} - string getName() override { return "cure restoration raid"; } + std::string getName() override { return "cure restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/druid/TankFeralDruidStrategy.h b/playerbot/strategy/druid/TankFeralDruidStrategy.h index a96202dc..c87c1dcc 100644 --- a/playerbot/strategy/druid/TankFeralDruidStrategy.h +++ b/playerbot/strategy/druid/TankFeralDruidStrategy.h @@ -8,7 +8,7 @@ namespace ai public: TankFeralDruidPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } - string getName() override { return "tank feral"; } + std::string getName() override { return "tank feral"; } }; class TankFeralDruidStrategy : public DruidStrategy @@ -78,7 +78,7 @@ namespace ai { public: TankFeralDruidAoePveStrategy(PlayerbotAI* ai) : TankFeralDruidAoeStrategy(ai) {} - string getName() override { return "aoe tank feral pve"; } + std::string getName() override { return "aoe tank feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: TankFeralDruidAoePvpStrategy(PlayerbotAI* ai) : TankFeralDruidAoeStrategy(ai) {} - string getName() override { return "aoe tank feral pvp"; } + std::string getName() override { return "aoe tank feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: TankFeralDruidAoeRaidStrategy(PlayerbotAI* ai) : TankFeralDruidAoeStrategy(ai) {} - string getName() override { return "aoe tank feral raid"; } + std::string getName() override { return "aoe tank feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: TankFeralDruidBuffPveStrategy(PlayerbotAI* ai) : TankFeralDruidBuffStrategy(ai) {} - string getName() override { return "buff tank feral pve"; } + std::string getName() override { return "buff tank feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: TankFeralDruidBuffPvpStrategy(PlayerbotAI* ai) : TankFeralDruidBuffStrategy(ai) {} - string getName() override { return "buff tank feral pvp"; } + std::string getName() override { return "buff tank feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: TankFeralDruidBuffRaidStrategy(PlayerbotAI* ai) : TankFeralDruidBuffStrategy(ai) {} - string getName() override { return "buff tank feral raid"; } + std::string getName() override { return "buff tank feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: TankFeralDruidBoostPveStrategy(PlayerbotAI* ai) : TankFeralDruidBoostStrategy(ai) {} - string getName() override { return "boost tank feral pve"; } + std::string getName() override { return "boost tank feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: TankFeralDruidBoostPvpStrategy(PlayerbotAI* ai) : TankFeralDruidBoostStrategy(ai) {} - string getName() override { return "boost tank feral pvp"; } + std::string getName() override { return "boost tank feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: TankFeralDruidBoostRaidStrategy(PlayerbotAI* ai) : TankFeralDruidBoostStrategy(ai) {} - string getName() override { return "boost tank feral raid"; } + std::string getName() override { return "boost tank feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: TankFeralDruidCcPveStrategy(PlayerbotAI* ai) : TankFeralDruidCcStrategy(ai) {} - string getName() override { return "cc tank feral pve"; } + std::string getName() override { return "cc tank feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: TankFeralDruidCcPvpStrategy(PlayerbotAI* ai) : TankFeralDruidCcStrategy(ai) {} - string getName() override { return "cc tank feral pvp"; } + std::string getName() override { return "cc tank feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: TankFeralDruidCcRaidStrategy(PlayerbotAI* ai) : TankFeralDruidCcStrategy(ai) {} - string getName() override { return "cc tank feral raid"; } + std::string getName() override { return "cc tank feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: TankFeralDruidCurePveStrategy(PlayerbotAI* ai) : TankFeralDruidCureStrategy(ai) {} - string getName() override { return "cure tank feral pve"; } + std::string getName() override { return "cure tank feral pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: TankFeralDruidCurePvpStrategy(PlayerbotAI* ai) : TankFeralDruidCureStrategy(ai) {} - string getName() override { return "cure tank feral pvp"; } + std::string getName() override { return "cure tank feral pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: TankFeralDruidCureRaidStrategy(PlayerbotAI* ai) : TankFeralDruidCureStrategy(ai) {} - string getName() override { return "cure tank feral raid"; } + std::string getName() override { return "cure tank feral raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/AttackEnemyPlayersStrategy.h b/playerbot/strategy/generic/AttackEnemyPlayersStrategy.h index 2a8ee6fb..37428910 100644 --- a/playerbot/strategy/generic/AttackEnemyPlayersStrategy.h +++ b/playerbot/strategy/generic/AttackEnemyPlayersStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,13 +7,13 @@ namespace ai { public: AttackEnemyPlayersStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "pvp"; } + std::string getName() override { return "pvp"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "pvp"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "pvp"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy detect nearby enemy players and makes the bot attack them."; } - virtual vector GetRelatedStrategies() { return {}; } + virtual std::vector GetRelatedStrategies() { return {}; } #endif private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/BattlegroundStrategy.h b/playerbot/strategy/generic/BattlegroundStrategy.h index 91dbeb86..7c7c7006 100644 --- a/playerbot/strategy/generic/BattlegroundStrategy.h +++ b/playerbot/strategy/generic/BattlegroundStrategy.h @@ -8,13 +8,13 @@ namespace ai public: BGStrategy(PlayerbotAI* ai) : PassTroughStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "bg"; } + std::string getName() override { return "bg"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "bg"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "bg"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots queue up for battle grounds remotely and join them when they get an invite."; } - virtual vector GetRelatedStrategies() { return { "battleground" }; } + virtual std::vector GetRelatedStrategies() { return { "battleground" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -27,13 +27,13 @@ namespace ai public: BattlegroundStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "battleground"; } + std::string getName() override { return "battleground"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "battleground"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "battleground"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy gives bots basic behavior inside battle grounds like checking and moving to objectives and getting ready at the start gates."; } - virtual vector GetRelatedStrategies() { return { "bg", "warsong" ,"arathi", "alterac", "eye", "isle", "arena" }; } + virtual std::vector GetRelatedStrategies() { return { "bg", "warsong" ,"arathi", "alterac", "eye", "isle", "arena" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -44,13 +44,13 @@ namespace ai public: WarsongStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_GENERIC; } - string getName() override { return "warsong"; } + std::string getName() override { return "warsong"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "warsong"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "warsong"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy controls the behavior during a warsong gluch battleground like capturing/retaking flags and picking up buffs."; } - virtual vector GetRelatedStrategies() { return { "battleground", "bg" }; } + virtual std::vector GetRelatedStrategies() { return { "battleground", "bg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -62,13 +62,13 @@ namespace ai public: AlteracStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_GENERIC; } - string getName() override { return "alterac"; } + std::string getName() override { return "alterac"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "alterac"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "alterac"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy controls the behavior during an alertac valley battleground."; } - virtual vector GetRelatedStrategies() { return { "battleground","bg" }; } + virtual std::vector GetRelatedStrategies() { return { "battleground","bg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -80,13 +80,13 @@ namespace ai public: ArathiStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_GENERIC; } - string getName() override { return "arathi"; } + std::string getName() override { return "arathi"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "arathi"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "arathi"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy controls the behavior during an arathi basin battleground."; } - virtual vector GetRelatedStrategies() { return { "battleground","bg" }; } + virtual std::vector GetRelatedStrategies() { return { "battleground","bg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -98,13 +98,13 @@ namespace ai public: EyeStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_GENERIC; } - string getName() { return "eye"; } + std::string getName() { return "eye"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "eye"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "eye"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy controls the behavior during an eye of the storm basin battleground."; } - virtual vector GetRelatedStrategies() { return { "battleground","bg" }; } + virtual std::vector GetRelatedStrategies() { return { "battleground","bg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -116,13 +116,13 @@ namespace ai public: IsleStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_GENERIC; } - string getName() override { return "isle"; } + std::string getName() override { return "isle"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "isle"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "isle"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy controls the behavior during an isle of conquest battleground."; } - virtual vector GetRelatedStrategies() { return { "battleground","bg" }; } + virtual std::vector GetRelatedStrategies() { return { "battleground","bg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -134,13 +134,13 @@ namespace ai public: ArenaStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_GENERIC; } - string getName() override { return "arena"; } + std::string getName() override { return "arena"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "arena"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "arena"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy controls the behavior arena fight."; } - virtual vector GetRelatedStrategies() { return { "battleground","bg" }; } + virtual std::vector GetRelatedStrategies() { return { "battleground","bg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/CastTimeStrategy.cpp b/playerbot/strategy/generic/CastTimeStrategy.cpp index 26e8d794..3b91c020 100644 --- a/playerbot/strategy/generic/CastTimeStrategy.cpp +++ b/playerbot/strategy/generic/CastTimeStrategy.cpp @@ -12,7 +12,7 @@ float CastTimeMultiplier::GetValue(Action* action) if (action == NULL) return 1.0f; uint8 targetHealth = AI_VALUE2(uint8, "health", "current target"); - string name = action->getName(); + std::string name = action->getName(); if (action->GetTarget() != AI_VALUE(Unit*, "current target")) return 1.0f; diff --git a/playerbot/strategy/generic/CastTimeStrategy.h b/playerbot/strategy/generic/CastTimeStrategy.h index e18d409f..3bada464 100644 --- a/playerbot/strategy/generic/CastTimeStrategy.h +++ b/playerbot/strategy/generic/CastTimeStrategy.h @@ -1,6 +1,6 @@ #pragma once -#include "../Multiplier.h" -#include "../Strategy.h" +#include "playerbot/strategy/Multiplier.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -17,13 +17,13 @@ namespace ai { public: CastTimeStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "cast time"; } + std::string getName() override { return "cast time"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "cast time"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "cast time"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots less likely to cast long casttime spells when the target is at critical health."; } - virtual vector GetRelatedStrategies() { return { }; } + virtual std::vector GetRelatedStrategies() { return { }; } #endif void InitCombatMultipliers(std::list& multipliers); }; diff --git a/playerbot/strategy/generic/ChatCommandHandlerStrategy.h b/playerbot/strategy/generic/ChatCommandHandlerStrategy.h index dbe64c6c..7688d6b1 100644 --- a/playerbot/strategy/generic/ChatCommandHandlerStrategy.h +++ b/playerbot/strategy/generic/ChatCommandHandlerStrategy.h @@ -7,15 +7,15 @@ namespace ai { public: ChatCommandHandlerStrategy(PlayerbotAI* ai); - string getName() override { return "chat"; } + std::string getName() override { return "chat"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "chat"; } //Must equal internal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "chat"; } //Must equal internal name + virtual std::string GetHelpDescription() { return "This strategy will make bots respond to various chat commands."; } - virtual vector GetRelatedStrategies() { return { }; } + virtual std::vector GetRelatedStrategies() { return { }; } #endif private: diff --git a/playerbot/strategy/generic/ClassStrategy.h b/playerbot/strategy/generic/ClassStrategy.h index febcee27..c9d341f4 100644 --- a/playerbot/strategy/generic/ClassStrategy.h +++ b/playerbot/strategy/generic/ClassStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -272,7 +272,7 @@ namespace ai { public: StealthedStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "stealthed"; } + std::string getName() override { return "stealthed"; } }; // This is a strategy to be used only as a placeholder @@ -299,7 +299,7 @@ namespace ai { public: AoePlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "aoe"; } + std::string getName() override { return "aoe"; } }; // This strategy is used to hold the cure strategy @@ -307,7 +307,7 @@ namespace ai { public: CurePlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "cure"; } + std::string getName() override { return "cure"; } }; // This strategy is used to hold the cc strategy @@ -315,7 +315,7 @@ namespace ai { public: CcPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "cc"; } + std::string getName() override { return "cc"; } }; // This strategy is used to hold the buff strategy @@ -323,7 +323,7 @@ namespace ai { public: BuffPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "buff"; } + std::string getName() override { return "buff"; } }; // This strategy is used to hold the buff strategy @@ -331,7 +331,7 @@ namespace ai { public: BoostPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "boost"; } + std::string getName() override { return "boost"; } }; // This strategy is used to hold the stealth strategy @@ -339,7 +339,7 @@ namespace ai { public: StealthPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "stealth"; } + std::string getName() override { return "stealth"; } }; // This strategy is used to hold the offheal strategy @@ -347,6 +347,6 @@ namespace ai { public: OffhealPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "offheal"; } + std::string getName() override { return "offheal"; } }; } \ No newline at end of file diff --git a/playerbot/strategy/generic/CombatStrategy.cpp b/playerbot/strategy/generic/CombatStrategy.cpp index be88fc0f..65db64c4 100644 --- a/playerbot/strategy/generic/CombatStrategy.cpp +++ b/playerbot/strategy/generic/CombatStrategy.cpp @@ -5,7 +5,7 @@ using namespace ai; -void CombatStrategy::InitCombatTriggers(list &triggers) +void CombatStrategy::InitCombatTriggers(std::list &triggers) { triggers.push_back(new TriggerNode( "invalid target", @@ -37,7 +37,7 @@ float AvoidAoeStrategyMultiplier::GetValue(Action* action) if (!action) return 1.0f; - string name = action->getName(); + std::string name = action->getName(); if (name == "follow" || name == "co" || name == "nc" || name == "react" || name == "select new target" || name == "flee") return 1.0f; @@ -141,7 +141,7 @@ uint8 WaitForAttackStrategy::GetWaitTime(PlayerbotAI* ai) float WaitForAttackMultiplier::GetValue(Action* action) { // Allow some movement and targeting actions - const string& actionName = action->getName(); + const std::string& actionName = action->getName(); if ((actionName != "wait for attack keep safe distance") && (actionName != "dps assist") && (actionName != "set facing") && diff --git a/playerbot/strategy/generic/CombatStrategy.h b/playerbot/strategy/generic/CombatStrategy.h index 5b9015c5..27823f3f 100644 --- a/playerbot/strategy/generic/CombatStrategy.h +++ b/playerbot/strategy/generic/CombatStrategy.h @@ -17,15 +17,15 @@ namespace ai { public: AvoidAoeStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "avoid aoe"; } + std::string getName() override { return "avoid aoe"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "avoid aoe"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "avoid aoe"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots move away when they are in aoe."; } - virtual vector GetRelatedStrategies() { return { }; } + virtual std::vector GetRelatedStrategies() { return { }; } #endif private: @@ -46,7 +46,7 @@ namespace ai { public: WaitForAttackStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "wait for attack"; } + std::string getName() override { return "wait for attack"; } static bool ShouldWait(PlayerbotAI* ai); static uint8 GetWaitTime(PlayerbotAI* ai); @@ -54,11 +54,11 @@ namespace ai static float GetSafeDistanceThreshold() { return 2.5f; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "wait for attack"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "wait for attack"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots wait a specified time before attacking."; } - virtual vector GetRelatedStrategies() { return { }; } + virtual std::vector GetRelatedStrategies() { return { }; } #endif private: @@ -77,11 +77,11 @@ namespace ai { public: HealInterruptStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "heal interrupt"; } + std::string getName() override { return "heal interrupt"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "heal interrupt"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "heal interrupt"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot interrupt the heal it currently casts if target is at full health"; } @@ -96,11 +96,11 @@ namespace ai { public: PreHealStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "preheal"; } + std::string getName() override { return "preheal"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "preheal"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "preheal"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot calculate melee damage of attacker when deciding how to heal target"; } diff --git a/playerbot/strategy/generic/ConserveManaStrategy.cpp b/playerbot/strategy/generic/ConserveManaStrategy.cpp index 9e688af8..eb4eadc6 100644 --- a/playerbot/strategy/generic/ConserveManaStrategy.cpp +++ b/playerbot/strategy/generic/ConserveManaStrategy.cpp @@ -18,7 +18,7 @@ float ConserveManaMultiplier::GetValue(Action* action) bool hasMana = AI_VALUE2(bool, "has mana", "self target"); bool mediumMana = hasMana && mana < sPlayerbotAIConfig.mediumMana; - string name = action->getName(); + std::string name = action->getName(); if (health < sPlayerbotAIConfig.lowHealth) return 1.0f; @@ -31,7 +31,7 @@ float ConserveManaMultiplier::GetValue(Action* action) if (!spellAction) return 1.0f; - string spell = spellAction->getName(); + std::string spell = spellAction->getName(); uint32 spellId = AI_VALUE2(uint32, "spell id", spell); const SpellEntry* const spellInfo = sServerFacade.LookupSpellInfo(spellId); if (!spellInfo || spellInfo->powerType != POWER_MANA) @@ -65,7 +65,7 @@ float SaveManaMultiplier::GetValue(Action* action) if (!spellAction) return 1.0f; - string spell = spellAction->getName(); + std::string spell = spellAction->getName(); uint32 spellId = AI_VALUE2(uint32, "spell id", spell); const SpellEntry* const spellInfo = sServerFacade.LookupSpellInfo(spellId); if (!spellInfo || spellInfo->powerType != POWER_MANA) diff --git a/playerbot/strategy/generic/ConserveManaStrategy.h b/playerbot/strategy/generic/ConserveManaStrategy.h index cd79099f..3f1a2ceb 100644 --- a/playerbot/strategy/generic/ConserveManaStrategy.h +++ b/playerbot/strategy/generic/ConserveManaStrategy.h @@ -1,6 +1,6 @@ #pragma once -#include "../Multiplier.h" -#include "../Strategy.h" +#include "playerbot/strategy/Multiplier.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -26,15 +26,15 @@ namespace ai { public: ConserveManaStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "conserve mana"; } + std::string getName() override { return "conserve mana"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "conserve mana"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "conserve mana"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots wait longer between casting the same spell twice.\n" "the delay is based on [h:value|mana save level]."; } - virtual vector GetRelatedStrategies() { return { }; } + virtual std::vector GetRelatedStrategies() { return { }; } #endif private: void InitCombatMultipliers(std::list &multipliers) override; diff --git a/playerbot/strategy/generic/DeadStrategy.cpp b/playerbot/strategy/generic/DeadStrategy.cpp index 8ac07013..d0cb86ae 100644 --- a/playerbot/strategy/generic/DeadStrategy.cpp +++ b/playerbot/strategy/generic/DeadStrategy.cpp @@ -1,6 +1,6 @@ #include "playerbot/playerbot.h" -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" #include "DeadStrategy.h" using namespace ai; diff --git a/playerbot/strategy/generic/DeadStrategy.h b/playerbot/strategy/generic/DeadStrategy.h index 72fb9b4f..66da742b 100644 --- a/playerbot/strategy/generic/DeadStrategy.h +++ b/playerbot/strategy/generic/DeadStrategy.h @@ -7,14 +7,14 @@ namespace ai { public: DeadStrategy(PlayerbotAI* ai) : PassTroughStrategy(ai) {} - string getName() override { return "dead"; } + std::string getName() override { return "dead"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dead"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "dead"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will includes various behavior when the bot is dead.\n The main goal is to revive in a safe location."; } - virtual vector GetRelatedStrategies() { return { }; } + virtual std::vector GetRelatedStrategies() { return { }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override {} diff --git a/playerbot/strategy/generic/DebugStrategy.h b/playerbot/strategy/generic/DebugStrategy.h index 14d016a8..9807ee58 100644 --- a/playerbot/strategy/generic/DebugStrategy.h +++ b/playerbot/strategy/generic/DebugStrategy.h @@ -7,14 +7,14 @@ namespace ai public: DebugStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug"; } + virtual std::string getName() { return "debug"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat feedback on the current actions (relevance) [triggers] it is trying to do."; } - virtual vector GetRelatedStrategies() { return { "debug action", "debug move" , "debug rpg", "debug spell", "debug travel", "debug threat" }; } + virtual std::vector GetRelatedStrategies() { return { "debug action", "debug move" , "debug rpg", "debug spell", "debug travel", "debug threat" }; } #endif }; class DebugActionStrategy : public DebugStrategy @@ -22,14 +22,14 @@ namespace ai public: DebugActionStrategy(PlayerbotAI* ai) : DebugStrategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug action"; } + virtual std::string getName() { return "debug action"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug action"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug action"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat feedback on the current actions the bot is considering to do but are impossible or not usefull."; } - virtual vector GetRelatedStrategies() { return { "debug"}; } + virtual std::vector GetRelatedStrategies() { return { "debug"}; } #endif }; class DebugMoveStrategy : public Strategy @@ -37,13 +37,13 @@ namespace ai public: DebugMoveStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug move"; } + virtual std::string getName() { return "debug move"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug move"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug move"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat and visual feedback for it's current movement actions."; } - virtual vector GetRelatedStrategies() { return { "debug", "rpg", "travel", "follow"}; } + virtual std::vector GetRelatedStrategies() { return { "debug", "rpg", "travel", "follow"}; } #endif }; class DebugRpgStrategy : public Strategy @@ -51,13 +51,13 @@ namespace ai public: DebugRpgStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug rpg"; } + virtual std::string getName() { return "debug rpg"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug rpg"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug rpg"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat feedback on rpg target selection during [h:action|choose rpg target] and [h:action|move to rpg target]."; } - virtual vector GetRelatedStrategies() { return { "debug", "rpg"}; } + virtual std::vector GetRelatedStrategies() { return { "debug", "rpg"}; } #endif }; @@ -66,13 +66,13 @@ namespace ai public: DebugSpellStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug spell"; } + virtual std::string getName() { return "debug spell"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug spell"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug spell"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat feedback on the current spell it is casting."; } - virtual vector GetRelatedStrategies() { return { "debug"}; } + virtual std::vector GetRelatedStrategies() { return { "debug"}; } #endif }; @@ -81,13 +81,13 @@ namespace ai public: DebugTravelStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug travel"; } + virtual std::string getName() { return "debug travel"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug travel"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug travel"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat feedback on the locations it is considering during [h:action|choose travel target]."; } - virtual vector GetRelatedStrategies() { return { "debug" , "travel"}; } + virtual std::vector GetRelatedStrategies() { return { "debug" , "travel"}; } #endif }; @@ -96,13 +96,13 @@ namespace ai public: DebugThreatStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug threat"; } + virtual std::string getName() { return "debug threat"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug threat"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug threat"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat (noncombat) or visual (combat) feedback on it's current [h:value:threat|threat value]."; } - virtual vector GetRelatedStrategies() { return { "debug" , "threat" }; } + virtual std::vector GetRelatedStrategies() { return { "debug" , "threat" }; } #endif }; @@ -111,13 +111,13 @@ namespace ai public: DebugMountStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug mount"; } + virtual std::string getName() { return "debug mount"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug mount"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug mount"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat feedback during mount actions."; } - virtual vector GetRelatedStrategies() { return { "debug" , "threat" }; } + virtual std::vector GetRelatedStrategies() { return { "debug" , "threat" }; } #endif }; @@ -126,13 +126,13 @@ namespace ai public: DebugGrindStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() { return STRATEGY_TYPE_NONCOMBAT; } - virtual string getName() { return "debug grind"; } + virtual std::string getName() { return "debug grind"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "debug grind"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "debug grind"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot give chat feedback about grind target selection."; } - virtual vector GetRelatedStrategies() { return { "debug" , "threat" }; } + virtual std::vector GetRelatedStrategies() { return { "debug" , "threat" }; } #endif }; } diff --git a/playerbot/strategy/generic/DpsAssistStrategy.h b/playerbot/strategy/generic/DpsAssistStrategy.h index 55e0e84a..ab536637 100644 --- a/playerbot/strategy/generic/DpsAssistStrategy.h +++ b/playerbot/strategy/generic/DpsAssistStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,15 +7,15 @@ namespace ai { public: DpsAssistStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "dps assist"; } + std::string getName() override { return "dps assist"; } int GetType() override { return STRATEGY_TYPE_DPS; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dps assist"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "dps assist"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot assist others when picking a target to attack."; } - virtual vector GetRelatedStrategies() { return { "dps aoe" }; } + virtual std::vector GetRelatedStrategies() { return { "dps aoe" }; } #endif private: void InitCombatTriggers(std::list& triggers) override; @@ -25,15 +25,15 @@ namespace ai { public: DpsAoeStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "dps aoe"; } + std::string getName() override { return "dps aoe"; } int GetType() override { return STRATEGY_TYPE_DPS; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dps aoe"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "dps aoe"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot use aoe abilities when multiple targets are close to eachother."; } - virtual vector GetRelatedStrategies() { return { "dps assist" }; } + virtual std::vector GetRelatedStrategies() { return { "dps assist" }; } #endif private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/DuelStrategy.h b/playerbot/strategy/generic/DuelStrategy.h index 0675c5b8..594b9072 100644 --- a/playerbot/strategy/generic/DuelStrategy.h +++ b/playerbot/strategy/generic/DuelStrategy.h @@ -7,14 +7,14 @@ namespace ai { public: DuelStrategy(PlayerbotAI* ai) : PassTroughStrategy(ai) {} - string getName() override { return "duel"; } + std::string getName() override { return "duel"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "duel"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "duel"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will allow bots to accept duels and attack their duel target."; } - virtual vector GetRelatedStrategies() { return { "start duel" }; } + virtual std::vector GetRelatedStrategies() { return { "start duel" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -26,14 +26,14 @@ namespace ai { public: StartDuelStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "start duel"; } + std::string getName() override { return "start duel"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "start duel"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "start duel"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will allow bots to start duels with other bots if they are the current [h:value|rpg target]."; } - virtual vector GetRelatedStrategies() { return { "duel", "rpg", "rpg player" }; } + virtual std::vector GetRelatedStrategies() { return { "duel", "rpg", "rpg player" }; } #endif }; } diff --git a/playerbot/strategy/generic/DungeonMultipliers.cpp b/playerbot/strategy/generic/DungeonMultipliers.cpp index bdcf9495..8ba76a8e 100644 --- a/playerbot/strategy/generic/DungeonMultipliers.cpp +++ b/playerbot/strategy/generic/DungeonMultipliers.cpp @@ -1,4 +1,3 @@ -#include "../../../botpch.h" #include "playerbot/playerbot.h" #include "DungeonMultipliers.h" #include "playerbot/strategy/actions/DungeonActions.h" diff --git a/playerbot/strategy/generic/DungeonMultipliers.h b/playerbot/strategy/generic/DungeonMultipliers.h index 0b4030e2..dba75685 100644 --- a/playerbot/strategy/generic/DungeonMultipliers.h +++ b/playerbot/strategy/generic/DungeonMultipliers.h @@ -1,6 +1,6 @@ #pragma once -#include "../Multiplier.h" +#include "playerbot/strategy/Multiplier.h" class Action; diff --git a/playerbot/strategy/generic/DungeonStrategy.h b/playerbot/strategy/generic/DungeonStrategy.h index 1125dd95..e8c31102 100644 --- a/playerbot/strategy/generic/DungeonStrategy.h +++ b/playerbot/strategy/generic/DungeonStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,15 +7,15 @@ namespace ai { public: DungeonStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "dungeon"; } + std::string getName() override { return "dungeon"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "dungeon"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "dungeon"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will enable and disable various dungeon and raid specific strategies as the bot enters and leaves."; } - virtual vector GetRelatedStrategies() { return {"onyxia's lair", "molten core" }; } + virtual std::vector GetRelatedStrategies() { return {"onyxia's lair", "molten core" }; } #endif private: diff --git a/playerbot/strategy/generic/EmoteStrategy.h b/playerbot/strategy/generic/EmoteStrategy.h index d7e4bd09..c0209c56 100644 --- a/playerbot/strategy/generic/EmoteStrategy.h +++ b/playerbot/strategy/generic/EmoteStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,13 +7,13 @@ namespace ai { public: EmoteStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "emote"; } + std::string getName() override { return "emote"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "emote"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "emote"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot react to or randomly send emotes."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/FleeStrategy.cpp b/playerbot/strategy/generic/FleeStrategy.cpp index b4e9b318..c0de57f3 100644 --- a/playerbot/strategy/generic/FleeStrategy.cpp +++ b/playerbot/strategy/generic/FleeStrategy.cpp @@ -4,7 +4,7 @@ using namespace ai; -void FleeStrategy::InitCombatTriggers(list &triggers) +void FleeStrategy::InitCombatTriggers(std::list &triggers) { triggers.push_back(new TriggerNode( "panic", @@ -15,7 +15,7 @@ void FleeStrategy::InitCombatTriggers(list &triggers) NextAction::array(0, new NextAction("flee", ACTION_EMERGENCY + 9), NULL))); } -void FleeFromAddsStrategy::InitCombatTriggers(list &triggers) +void FleeFromAddsStrategy::InitCombatTriggers(std::list &triggers) { triggers.push_back(new TriggerNode( "has nearest adds", diff --git a/playerbot/strategy/generic/FleeStrategy.h b/playerbot/strategy/generic/FleeStrategy.h index a281117d..5efdf770 100644 --- a/playerbot/strategy/generic/FleeStrategy.h +++ b/playerbot/strategy/generic/FleeStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,13 +7,13 @@ namespace ai { public: FleeStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "flee"; }; + std::string getName() override { return "flee"; }; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "flee"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "flee"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot flee when it is in danger."; } - virtual vector GetRelatedStrategies() { return { "flee from adds" }; } + virtual std::vector GetRelatedStrategies() { return { "flee from adds" }; } #endif private: void InitCombatTriggers(std::list &triggers) override; @@ -23,13 +23,13 @@ namespace ai { public: FleeFromAddsStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "flee from adds"; }; + std::string getName() override { return "flee from adds"; }; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "flee from adds"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "flee from adds"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This a position strategy that will make the bot try to avoid adds the prevent aggro."; } - virtual vector GetRelatedStrategies() { return { "flee", "follow", "stay", "runaway", "guard", "free" }; } + virtual std::vector GetRelatedStrategies() { return { "flee", "follow", "stay", "runaway", "guard", "free" }; } #endif private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/FocusTargetStrategy.h b/playerbot/strategy/generic/FocusTargetStrategy.h index 1d858f44..56d3b101 100644 --- a/playerbot/strategy/generic/FocusTargetStrategy.h +++ b/playerbot/strategy/generic/FocusTargetStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,11 +7,11 @@ namespace ai { public: FocusHealTargetStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "focus heal target"; } + std::string getName() override { return "focus heal target"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "focus heal target"; } //Must equal iternal name - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "focus heal target"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot focus heal the specified target using the 'set focus heal ' command"; } diff --git a/playerbot/strategy/generic/FollowMasterStrategy.cpp b/playerbot/strategy/generic/FollowMasterStrategy.cpp index fb689a9e..7b821221 100644 --- a/playerbot/strategy/generic/FollowMasterStrategy.cpp +++ b/playerbot/strategy/generic/FollowMasterStrategy.cpp @@ -66,12 +66,12 @@ void FollowJumpStrategy::InitNonCombatTriggers(std::list& triggers NextAction::array(0, new NextAction("jump::follow", ACTION_IDLE + 1.0f), NULL))); } -void FollowJumpStrategy::InitCombatTriggers(list &triggers) +void FollowJumpStrategy::InitCombatTriggers(std::list &triggers) { InitNonCombatTriggers(triggers); } -void FollowJumpStrategy::InitReactionTriggers(list &triggers) +void FollowJumpStrategy::InitReactionTriggers(std::list &triggers) { InitNonCombatTriggers(triggers); } diff --git a/playerbot/strategy/generic/FollowMasterStrategy.h b/playerbot/strategy/generic/FollowMasterStrategy.h index aa3388d6..78d80bf4 100644 --- a/playerbot/strategy/generic/FollowMasterStrategy.h +++ b/playerbot/strategy/generic/FollowMasterStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -8,13 +8,13 @@ namespace ai public: FollowMasterStrategy(PlayerbotAI* ai) : Strategy(ai) {} int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "follow"; } + std::string getName() override { return "follow"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "follow"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "follow"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make the bot stay near the master"; } - virtual vector GetRelatedStrategies() { return { "stay", "runaway","flee from adds", "guard", "free"}; } + virtual std::vector GetRelatedStrategies() { return { "stay", "runaway","flee from adds", "guard", "free"}; } #endif private: void InitNonCombatTriggers(std::list &triggers) override; @@ -31,13 +31,13 @@ namespace ai public: FreeStrategy(PlayerbotAI* ai) : Strategy(ai) {} int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "free"; } + std::string getName() override { return "free"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "free"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "free"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will allow the bot to move freely"; } - virtual vector GetRelatedStrategies() { return { "follow", "stay", "runaway","flee from adds", "guard" }; } + virtual std::vector GetRelatedStrategies() { return { "follow", "stay", "runaway","flee from adds", "guard" }; } #endif }; @@ -45,13 +45,13 @@ namespace ai { public: FollowJumpStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "follow jump"; } + std::string getName() override { return "follow jump"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "follow jump"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "follow jump"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot jump when following.\n"; } - virtual vector GetRelatedStrategies() { return { "follow" }; } + virtual std::vector GetRelatedStrategies() { return { "follow" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/GrindingStrategy.h b/playerbot/strategy/generic/GrindingStrategy.h index 994189ac..9ef80053 100644 --- a/playerbot/strategy/generic/GrindingStrategy.h +++ b/playerbot/strategy/generic/GrindingStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: GrindingStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "grind"; } + std::string getName() override { return "grind"; } int GetType() override { return STRATEGY_TYPE_DPS; } private: diff --git a/playerbot/strategy/generic/GroupStrategy.h b/playerbot/strategy/generic/GroupStrategy.h index 020297a3..8623352e 100644 --- a/playerbot/strategy/generic/GroupStrategy.h +++ b/playerbot/strategy/generic/GroupStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: GroupStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "group"; } + std::string getName() override { return "group"; } int GetType() override { return STRATEGY_TYPE_GENERIC; } private: diff --git a/playerbot/strategy/generic/GuardStrategy.h b/playerbot/strategy/generic/GuardStrategy.h index 0096d5c8..095f809b 100644 --- a/playerbot/strategy/generic/GuardStrategy.h +++ b/playerbot/strategy/generic/GuardStrategy.h @@ -7,13 +7,13 @@ namespace ai { public: GuardStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "guard"; } + std::string getName() override { return "guard"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "guard"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "guard"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This a position strategy that will make the bot stay in a location until they have something to attack."; } - virtual vector GetRelatedStrategies() { return { "follow", "stay", "runaway", "flee from adds", "free" }; } + virtual std::vector GetRelatedStrategies() { return { "follow", "stay", "runaway", "flee from adds", "free" }; } #endif private: NextAction** GetDefaultNonCombatActions() override; diff --git a/playerbot/strategy/generic/GuildStrategy.h b/playerbot/strategy/generic/GuildStrategy.h index 5c56a2e0..dc62eff6 100644 --- a/playerbot/strategy/generic/GuildStrategy.h +++ b/playerbot/strategy/generic/GuildStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: GuildStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "guild"; } + std::string getName() override { return "guild"; } int GetType() override { return STRATEGY_TYPE_GENERIC; } private: diff --git a/playerbot/strategy/generic/KarazhanDungeonStrategies.h b/playerbot/strategy/generic/KarazhanDungeonStrategies.h index af8ab7e5..9b81b626 100644 --- a/playerbot/strategy/generic/KarazhanDungeonStrategies.h +++ b/playerbot/strategy/generic/KarazhanDungeonStrategies.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: KarazhanDungeonStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "karazhan"; } + std::string getName() override { return "karazhan"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -17,7 +17,7 @@ namespace ai { public: NetherspiteFightStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "netherspite"; } + std::string getName() override { return "netherspite"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -29,7 +29,7 @@ namespace ai { public: PrinceMalchezaarFightStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "prince malchezaar"; } + std::string getName() override { return "prince malchezaar"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/KiteStrategy.h b/playerbot/strategy/generic/KiteStrategy.h index 09229017..8af894d7 100644 --- a/playerbot/strategy/generic/KiteStrategy.h +++ b/playerbot/strategy/generic/KiteStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: KiteStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "kite"; } + std::string getName() override { return "kite"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/LfgStrategy.h b/playerbot/strategy/generic/LfgStrategy.h index dc7de76d..a8325e1d 100644 --- a/playerbot/strategy/generic/LfgStrategy.h +++ b/playerbot/strategy/generic/LfgStrategy.h @@ -8,7 +8,7 @@ namespace ai public: LfgStrategy(PlayerbotAI* ai) : PassTroughStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "lfg"; } + std::string getName() override { return "lfg"; } private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/LootNonCombatStrategy.h b/playerbot/strategy/generic/LootNonCombatStrategy.h index f944c244..11deab8f 100644 --- a/playerbot/strategy/generic/LootNonCombatStrategy.h +++ b/playerbot/strategy/generic/LootNonCombatStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,13 +7,13 @@ namespace ai { public: LootNonCombatStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "loot"; } + std::string getName() override { return "loot"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "loot"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "loot"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots look for, open and get items from nearby lootable objects."; } - virtual vector GetRelatedStrategies() { return { "gather" }; } + virtual std::vector GetRelatedStrategies() { return { "gather" }; } #endif public: void InitNonCombatTriggers(std::list &triggers) override; @@ -23,13 +23,13 @@ namespace ai { public: GatherStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "gather"; } + std::string getName() override { return "gather"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "gather"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "gather"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots look for and save nearby gathering nodes to loot later."; } - virtual vector GetRelatedStrategies() { return { "reveal" }; } + virtual std::vector GetRelatedStrategies() { return { "reveal" }; } #endif private: void InitNonCombatTriggers(std::list &triggers) override; @@ -39,13 +39,13 @@ namespace ai { public: RevealStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "reveal"; } + std::string getName() override { return "reveal"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "reveal"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "reveal"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots point out nearby gathering nodes that they can open."; } - virtual vector GetRelatedStrategies() { return { "gather" }; } + virtual std::vector GetRelatedStrategies() { return { "gather" }; } #endif private: void InitNonCombatTriggers(std::list &triggers) override; @@ -55,13 +55,13 @@ namespace ai { public: RollStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "roll"; } + std::string getName() override { return "roll"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "roll"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "roll"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots automatically roll on items."; } - virtual vector GetRelatedStrategies() { return { "delayed roll"}; } + virtual std::vector GetRelatedStrategies() { return { "delayed roll"}; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -72,13 +72,13 @@ namespace ai { public: DelayedRollStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "delayed roll"; } + std::string getName() override { return "delayed roll"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "delayed roll"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "delayed roll"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy will make bots roll on item after the master rolls.."; } - virtual vector GetRelatedStrategies() { return { "roll" }; } + virtual std::vector GetRelatedStrategies() { return { "roll" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/MaintenanceStrategy.h b/playerbot/strategy/generic/MaintenanceStrategy.h index 71fe2526..d2e1aa16 100644 --- a/playerbot/strategy/generic/MaintenanceStrategy.h +++ b/playerbot/strategy/generic/MaintenanceStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: MaintenanceStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "maintenance"; } + std::string getName() override { return "maintenance"; } int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } private: diff --git a/playerbot/strategy/generic/MarkRtiStrategy.h b/playerbot/strategy/generic/MarkRtiStrategy.h index 995f5027..2fc68f4d 100644 --- a/playerbot/strategy/generic/MarkRtiStrategy.h +++ b/playerbot/strategy/generic/MarkRtiStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: MarkRtiStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "mark rti"; } + std::string getName() override { return "mark rti"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/MeleeCombatStrategy.cpp b/playerbot/strategy/generic/MeleeCombatStrategy.cpp index a0a92569..41f99d25 100644 --- a/playerbot/strategy/generic/MeleeCombatStrategy.cpp +++ b/playerbot/strategy/generic/MeleeCombatStrategy.cpp @@ -4,7 +4,7 @@ using namespace ai; -void MeleeCombatStrategy::InitCombatTriggers(list &triggers) +void MeleeCombatStrategy::InitCombatTriggers(std::list &triggers) { triggers.push_back(new TriggerNode( "enemy out of melee", @@ -15,7 +15,7 @@ void MeleeCombatStrategy::InitCombatTriggers(list &triggers) NextAction::array(0, new NextAction("move out of enemy contact", ACTION_NORMAL + 8.0f), NULL))); } -void SetBehindCombatStrategy::InitCombatTriggers(list &triggers) +void SetBehindCombatStrategy::InitCombatTriggers(std::list &triggers) { triggers.push_back(new TriggerNode( "not behind target", @@ -29,12 +29,12 @@ void ChaseJumpStrategy::InitNonCombatTriggers(std::list& triggers) NextAction::array(0, new NextAction("jump::chase", ACTION_MOVE + 9.0f), NULL))); } -void ChaseJumpStrategy::InitCombatTriggers(list &triggers) +void ChaseJumpStrategy::InitCombatTriggers(std::list &triggers) { InitNonCombatTriggers(triggers); } -void ChaseJumpStrategy::InitReactionTriggers(list &triggers) +void ChaseJumpStrategy::InitReactionTriggers(std::list &triggers) { InitNonCombatTriggers(triggers); } diff --git a/playerbot/strategy/generic/MeleeCombatStrategy.h b/playerbot/strategy/generic/MeleeCombatStrategy.h index 9f0359f2..613efbab 100644 --- a/playerbot/strategy/generic/MeleeCombatStrategy.h +++ b/playerbot/strategy/generic/MeleeCombatStrategy.h @@ -1,5 +1,5 @@ #include "CombatStrategy.h" -#include "../generic/CombatStrategy.h" +#include "playerbot/strategy/generic/CombatStrategy.h" #pragma once namespace ai @@ -10,7 +10,7 @@ namespace ai MeleeCombatStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {} virtual int GetType() override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_MELEE; } - virtual string getName() override { return "close"; } + virtual std::string getName() override { return "close"; } protected: virtual void InitCombatTriggers(std::list& triggers) override; @@ -20,7 +20,7 @@ namespace ai { public: SetBehindCombatStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {} - string getName() override { return "behind"; } + std::string getName() override { return "behind"; } private: void InitCombatTriggers(std::list &triggers) override; @@ -30,13 +30,13 @@ namespace ai { public: ChaseJumpStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "chase jump"; } + std::string getName() override { return "chase jump"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "chase jump"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "chase jump"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot jump when chasing enemies they can't reach.\n"; } - virtual vector GetRelatedStrategies() { return { "melee" }; } + virtual std::vector GetRelatedStrategies() { return { "melee" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/MoltenCoreDungeonStrategies.h b/playerbot/strategy/generic/MoltenCoreDungeonStrategies.h index d4dee3f3..be0e7069 100644 --- a/playerbot/strategy/generic/MoltenCoreDungeonStrategies.h +++ b/playerbot/strategy/generic/MoltenCoreDungeonStrategies.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: MoltenCoreDungeonStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "molten core"; } + std::string getName() override { return "molten core"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -18,7 +18,7 @@ namespace ai { public: MagmadarFightStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "magmadar"; } + std::string getName() override { return "magmadar"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/NaxxramasDungeonStrategies.h b/playerbot/strategy/generic/NaxxramasDungeonStrategies.h index 7eaa3d04..8dc87a4a 100644 --- a/playerbot/strategy/generic/NaxxramasDungeonStrategies.h +++ b/playerbot/strategy/generic/NaxxramasDungeonStrategies.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: NaxxramasDungeonStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "naxxramas"; } + std::string getName() override { return "naxxramas"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -17,7 +17,7 @@ namespace ai { public: FourHorsemanFightStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "four horseman"; } + std::string getName() override { return "four horseman"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/NonCombatStrategy.cpp b/playerbot/strategy/generic/NonCombatStrategy.cpp index a5ab83a7..9801e4e2 100644 --- a/playerbot/strategy/generic/NonCombatStrategy.cpp +++ b/playerbot/strategy/generic/NonCombatStrategy.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "NonCombatStrategy.h" -#include "../Value.h" +#include "playerbot/strategy/Value.h" using namespace ai; diff --git a/playerbot/strategy/generic/NonCombatStrategy.h b/playerbot/strategy/generic/NonCombatStrategy.h index 447409f7..ef1c0760 100644 --- a/playerbot/strategy/generic/NonCombatStrategy.h +++ b/playerbot/strategy/generic/NonCombatStrategy.h @@ -19,7 +19,7 @@ namespace ai public: CollisionStrategy(PlayerbotAI* ai) : Strategy(ai) {} int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "collision"; } + std::string getName() override { return "collision"; } private: void InitNonCombatTriggers(std::list &triggers) override; @@ -30,7 +30,7 @@ namespace ai public: MountStrategy(PlayerbotAI* ai) : Strategy(ai) {}; int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "mount"; } + std::string getName() override { return "mount"; } private: void InitNonCombatTriggers(std::list& triggers) override; @@ -41,7 +41,7 @@ namespace ai public: AttackTaggedStrategy(PlayerbotAI* ai) : Strategy(ai) {} int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "attack tagged"; } + std::string getName() override { return "attack tagged"; } }; class WorldBuffStrategy : public Strategy @@ -49,7 +49,7 @@ namespace ai public: WorldBuffStrategy(PlayerbotAI* ai) : Strategy(ai) {} virtual int GetType() override { return STRATEGY_TYPE_NONCOMBAT; } - string getName() override { return "wbuff"; } + std::string getName() override { return "wbuff"; } protected: virtual void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/OnyxiasLairDungeonStrategies.h b/playerbot/strategy/generic/OnyxiasLairDungeonStrategies.h index a59ca1d5..6a206213 100644 --- a/playerbot/strategy/generic/OnyxiasLairDungeonStrategies.h +++ b/playerbot/strategy/generic/OnyxiasLairDungeonStrategies.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: OnyxiasLairDungeonStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "onyxia's lair"; } + std::string getName() override { return "onyxia's lair"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -17,7 +17,7 @@ namespace ai { public: OnyxiaFightStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "onyxia"; } + std::string getName() override { return "onyxia"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/PassTroughStrategy.h b/playerbot/strategy/generic/PassTroughStrategy.h index cc30b524..fa27bfb9 100644 --- a/playerbot/strategy/generic/PassTroughStrategy.h +++ b/playerbot/strategy/generic/PassTroughStrategy.h @@ -10,9 +10,9 @@ namespace ai protected: virtual void InitNonCombatTriggers(std::list &triggers) override { - for (list::iterator i = supported.begin(); i != supported.end(); i++) + for (std::list::iterator i = supported.begin(); i != supported.end(); i++) { - string s = i->c_str(); + std::string s = i->c_str(); triggers.push_back(new TriggerNode( s, NextAction::array(0, new NextAction(s, relevance), NULL))); @@ -21,9 +21,9 @@ namespace ai virtual void InitCombatTriggers(std::list& triggers) override { - for (list::iterator i = supported.begin(); i != supported.end(); i++) + for (std::list::iterator i = supported.begin(); i != supported.end(); i++) { - string s = i->c_str(); + std::string s = i->c_str(); triggers.push_back(new TriggerNode( s, NextAction::array(0, new NextAction(s, relevance), NULL))); @@ -32,9 +32,9 @@ namespace ai virtual void InitDeadTriggers(std::list& triggers) override { - for (list::iterator i = supported.begin(); i != supported.end(); i++) + for (std::list::iterator i = supported.begin(); i != supported.end(); i++) { - string s = i->c_str(); + std::string s = i->c_str(); triggers.push_back(new TriggerNode( s, NextAction::array(0, new NextAction(s, relevance), NULL))); @@ -42,7 +42,7 @@ namespace ai } protected: - list supported; + std::list supported; float relevance; }; } diff --git a/playerbot/strategy/generic/PassiveStrategy.cpp b/playerbot/strategy/generic/PassiveStrategy.cpp index 20dbb288..9224cb7e 100644 --- a/playerbot/strategy/generic/PassiveStrategy.cpp +++ b/playerbot/strategy/generic/PassiveStrategy.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "PassiveStrategy.h" -#include "../PassiveMultiplier.h" +#include "playerbot/strategy/PassiveMultiplier.h" using namespace ai; diff --git a/playerbot/strategy/generic/PassiveStrategy.h b/playerbot/strategy/generic/PassiveStrategy.h index c896ef02..52a69d77 100644 --- a/playerbot/strategy/generic/PassiveStrategy.h +++ b/playerbot/strategy/generic/PassiveStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: PassiveStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() { return "passive"; } + std::string getName() { return "passive"; } private: void InitNonCombatMultipliers(std::list &multipliers) override; diff --git a/playerbot/strategy/generic/PullStrategy.cpp b/playerbot/strategy/generic/PullStrategy.cpp index 7961a9fc..5d318e39 100644 --- a/playerbot/strategy/generic/PullStrategy.cpp +++ b/playerbot/strategy/generic/PullStrategy.cpp @@ -1,6 +1,6 @@ #include "playerbot/playerbot.h" -#include "../PassiveMultiplier.h" +#include "playerbot/strategy/PassiveMultiplier.h" #include "PullStrategy.h" using namespace ai; @@ -23,7 +23,7 @@ class PullStrategyActionNodeFactory : public NamedObjectFactory } }; -PullStrategy::PullStrategy(PlayerbotAI* ai, string pullAction, string prePullAction) +PullStrategy::PullStrategy(PlayerbotAI* ai, std::string pullAction, std::string prePullAction) : Strategy(ai) , pullActionName(pullAction) , preActionName(prePullAction) @@ -37,9 +37,9 @@ PullStrategy::PullStrategy(PlayerbotAI* ai, string pullAction, string prePullAct return; } -string PullStrategy::GetPullActionName() const +std::string PullStrategy::GetPullActionName() const { - string modPullActionName = pullActionName; + std::string modPullActionName = pullActionName; // Select the faerie fire based on druid strategy if (ai->GetBot()->getClass() == CLASS_DRUID) @@ -56,9 +56,9 @@ string PullStrategy::GetPullActionName() const return modPullActionName; } -string PullStrategy::GetSpellName() const +std::string PullStrategy::GetSpellName() const { - string spellName = GetPullActionName(); + std::string spellName = GetPullActionName(); if (spellName == "shoot") { const Item* equippedWeapon = ai->GetBot()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED); @@ -121,9 +121,9 @@ float PullStrategy::GetRange() const return range; } -string PullStrategy::GetPreActionName() const +std::string PullStrategy::GetPreActionName() const { - string modPullActionName = preActionName; + std::string modPullActionName = preActionName; // Select the faerie fire based on druid strategy if (ai->GetBot()->getClass() == CLASS_DRUID) @@ -187,7 +187,7 @@ bool PullStrategy::CanDoPullAction(Unit* target) { // Check if the bot can perform the pull action bool canPull = false; - const string& pullAction = GetPullActionName(); + const std::string& pullAction = GetPullActionName(); if (!pullAction.empty()) { // Temporarily set the pull target to be used by the can do specific action method diff --git a/playerbot/strategy/generic/PullStrategy.h b/playerbot/strategy/generic/PullStrategy.h index 4a4b2426..c1c8fc3a 100644 --- a/playerbot/strategy/generic/PullStrategy.h +++ b/playerbot/strategy/generic/PullStrategy.h @@ -1,16 +1,16 @@ #pragma once -#include "../Strategy.h" -#include "../Multiplier.h" +#include "playerbot/strategy/Strategy.h" +#include "playerbot/strategy/Multiplier.h" namespace ai { class PullStrategy : public Strategy { public: - PullStrategy(PlayerbotAI* ai, string pullAction, string prePullAction = ""); + PullStrategy(PlayerbotAI* ai, std::string pullAction, std::string prePullAction = ""); public: - string getName() override { return "pull"; } + std::string getName() override { return "pull"; } static PullStrategy* Get(PlayerbotAI* ai); static uint8 GetMaxPullTime() { return 15; } @@ -21,11 +21,11 @@ namespace ai Unit* GetTarget() const; bool HasTarget() const { return GetTarget() != nullptr; } - string GetPullActionName() const; - string GetSpellName() const; + std::string GetPullActionName() const; + std::string GetSpellName() const; float GetRange() const; - string GetPreActionName() const; + std::string GetPreActionName() const; void RequestPull(Unit* target, bool resetTime = true); bool IsPullPendingToStart() const { return pendingToStart; } @@ -44,8 +44,8 @@ namespace ai void InitNonCombatMultipliers(std::list& multipliers) override; private: - string pullActionName; //shoot - string preActionName; + std::string pullActionName; //shoot + std::string preActionName; bool pendingToStart; time_t pullStartTime; ReactStates petReactState; @@ -64,7 +64,7 @@ namespace ai { public: PossibleAdsStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "ads"; } + std::string getName() override { return "ads"; } private: void InitCombatTriggers(std::list &triggers) override; @@ -74,7 +74,7 @@ namespace ai { public: PullBackStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "pull back"; } + std::string getName() override { return "pull back"; } void InitCombatTriggers(std::list& triggers) override; void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/QuestStrategies.h b/playerbot/strategy/generic/QuestStrategies.h index 9cda8e04..a610d250 100644 --- a/playerbot/strategy/generic/QuestStrategies.h +++ b/playerbot/strategy/generic/QuestStrategies.h @@ -18,7 +18,7 @@ namespace ai { public: DefaultQuestStrategy(PlayerbotAI* ai) : QuestStrategy(ai) {} - string getName() override { return "quest"; } + std::string getName() override { return "quest"; } private: void InitNonCombatTriggers(std::list &triggers) override; @@ -28,7 +28,7 @@ namespace ai { public: AcceptAllQuestsStrategy(PlayerbotAI* ai) : QuestStrategy(ai) {} - string getName() override { return "accept all quests"; } + std::string getName() override { return "accept all quests"; } private: void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/RTSCStrategy.h b/playerbot/strategy/generic/RTSCStrategy.h index 63c8ccd2..916688aa 100644 --- a/playerbot/strategy/generic/RTSCStrategy.h +++ b/playerbot/strategy/generic/RTSCStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,14 +7,14 @@ namespace ai { public: RTSCStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "rtsc"; } + std::string getName() override { return "rtsc"; } }; class RTSCSJumptrategy : public Strategy { public: RTSCSJumptrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "rtsc jump"; } + std::string getName() override { return "rtsc jump"; } protected: virtual void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/RacialsStrategy.h b/playerbot/strategy/generic/RacialsStrategy.h index c0f45f5d..338af48f 100644 --- a/playerbot/strategy/generic/RacialsStrategy.h +++ b/playerbot/strategy/generic/RacialsStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: RacialsStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "racials"; } + std::string getName() override { return "racials"; } private: void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/RangedCombatStrategy.cpp b/playerbot/strategy/generic/RangedCombatStrategy.cpp index f0c1be54..f0f48084 100644 --- a/playerbot/strategy/generic/RangedCombatStrategy.cpp +++ b/playerbot/strategy/generic/RangedCombatStrategy.cpp @@ -4,7 +4,7 @@ using namespace ai; -void RangedCombatStrategy::InitCombatTriggers(list &triggers) +void RangedCombatStrategy::InitCombatTriggers(std::list &triggers) { triggers.push_back(new TriggerNode( "enemy too close for spell", diff --git a/playerbot/strategy/generic/RangedCombatStrategy.h b/playerbot/strategy/generic/RangedCombatStrategy.h index dc3c3609..f97e3f76 100644 --- a/playerbot/strategy/generic/RangedCombatStrategy.h +++ b/playerbot/strategy/generic/RangedCombatStrategy.h @@ -8,7 +8,7 @@ namespace ai public: RangedCombatStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_RANGED; } - string getName() override { return "ranged"; } + std::string getName() override { return "ranged"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/ReactionStrategy.cpp b/playerbot/strategy/generic/ReactionStrategy.cpp index 2ddb5221..130c8c70 100644 --- a/playerbot/strategy/generic/ReactionStrategy.cpp +++ b/playerbot/strategy/generic/ReactionStrategy.cpp @@ -5,7 +5,7 @@ using namespace ai; -void ReactionStrategy::InitReactionTriggers(list &triggers) +void ReactionStrategy::InitReactionTriggers(std::list &triggers) { triggers.push_back(new TriggerNode( "combat start", diff --git a/playerbot/strategy/generic/ReturnStrategy.h b/playerbot/strategy/generic/ReturnStrategy.h index f386f8de..473faedd 100644 --- a/playerbot/strategy/generic/ReturnStrategy.h +++ b/playerbot/strategy/generic/ReturnStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: ReturnStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "return"; } + std::string getName() override { return "return"; } private: virtual void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/RpgStrategy.cpp b/playerbot/strategy/generic/RpgStrategy.cpp index d4d1c3ed..fad7e82b 100644 --- a/playerbot/strategy/generic/RpgStrategy.cpp +++ b/playerbot/strategy/generic/RpgStrategy.cpp @@ -9,8 +9,8 @@ float RpgActionMultiplier::GetValue(Action* action) { if (action == NULL) return 1.0f; - string nextAction = AI_VALUE(string, "next rpg action"); - string name = action->getName(); + std::string nextAction = AI_VALUE(std::string, "next rpg action"); + std::string name = action->getName(); if (dynamic_cast(action)) { @@ -198,12 +198,12 @@ void RpgJumpStrategy::InitNonCombatTriggers(std::list& triggers) NextAction::array(0, new NextAction("jump::random", ACTION_PASSTROUGH), NULL))); } -void RpgJumpStrategy::InitCombatTriggers(list &triggers) +void RpgJumpStrategy::InitCombatTriggers(std::list &triggers) { InitNonCombatTriggers(triggers); } -void RpgJumpStrategy::InitReactionTriggers(list &triggers) +void RpgJumpStrategy::InitReactionTriggers(std::list &triggers) { InitNonCombatTriggers(triggers); } diff --git a/playerbot/strategy/generic/RpgStrategy.h b/playerbot/strategy/generic/RpgStrategy.h index f861a3a6..215bab5c 100644 --- a/playerbot/strategy/generic/RpgStrategy.h +++ b/playerbot/strategy/generic/RpgStrategy.h @@ -1,6 +1,6 @@ #pragma once -#include "../Multiplier.h" -#include "../Strategy.h" +#include "playerbot/strategy/Multiplier.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -17,15 +17,15 @@ namespace ai { public: RpgStrategy(PlayerbotAI* ai) : Strategy(ai) {} - virtual string getName() override { return "rpg"; } + virtual std::string getName() override { return "rpg"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move between npcs to automatically do various interaction.\n" "This is the main rpg strategy which make bots pickand move to various rpg targets.\n" "The interactions included in this strategy are limited to emotesand wait."; } - virtual vector GetRelatedStrategies() { return {"rpg quest", "rpg vendor", "rpg explore", "rpg maintenance", "rpg guild", "rpg bg", "rpg player", "rpg craft", "debug rpg"}; } + virtual std::vector GetRelatedStrategies() { return {"rpg quest", "rpg vendor", "rpg explore", "rpg maintenance", "rpg guild", "rpg bg", "rpg player", "rpg craft", "debug rpg"}; } #endif protected: virtual void OnStrategyAdded(BotState state) override; @@ -38,15 +38,15 @@ namespace ai { public: RpgQuestStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg quest"; } + std::string getName() override { return "rpg quest"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg quest"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg quest"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to npcs that have quests the bot can pick up or hand in.\n" "Bots will only pick up quests that give xp unless low on durability.\n" "Bots will also try to do repeatable quests."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; @@ -56,15 +56,15 @@ namespace ai { public: RpgVendorStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg vendor"; } + std::string getName() override { return "rpg vendor"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg vendor"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg vendor"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to vendors, auctionhouses and mail-boxes.\n" "Bots will buy and sell items depending on usage see [h:action|query item usage].\n" "Bots will pick up their mail if there is any items or gold attached."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: virtual void InitNonCombatTriggers(std::list& triggers) override; @@ -74,15 +74,15 @@ namespace ai { public: RpgExploreStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg explore"; } + std::string getName() override { return "rpg explore"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg explore"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg explore"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to innkeepers and flight masters.\n" "Bots will make this inn their new home when their current home is far away.\n" "Bots pick a random flight (when not with a player) or discover new flightpaths."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: virtual void InitNonCombatTriggers(std::list& triggers) override; @@ -92,15 +92,15 @@ namespace ai { public: RpgMaintenanceStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg maintenance"; } + std::string getName() override { return "rpg maintenance"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg maintenance"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg maintenance"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to trainers and armorers.\n" "Bots will automatically train new spells or skills that are available.\n" "Bots will automatically repair their armor when below 80% durability."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: virtual void InitNonCombatTriggers(std::list& triggers) override; @@ -110,14 +110,14 @@ namespace ai { public: RpgGuildStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg guild"; } + std::string getName() override { return "rpg guild"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg guild"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg guild"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to guild master npcs.\n" "Bots will automatically buy a petition if they are not already in a guild."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: virtual void InitNonCombatTriggers(std::list& triggers) override; @@ -127,14 +127,14 @@ namespace ai { public: RpgBgStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg bg"; } + std::string getName() override { return "rpg bg"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg bg"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg bg"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to battlemasters.\n" "Bots will automatically queue for battlegrounds."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: virtual void InitNonCombatTriggers(std::list& triggers) override; @@ -144,15 +144,15 @@ namespace ai { public: RpgPlayerStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg player"; } + std::string getName() override { return "rpg player"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg player"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg player"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to nearby players.\n" "Bots will automatically trade other bots items they don't need but the other bot can use.\n" "Bots will automatically start duels with other players 3 levels above and 10 levels below them."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: virtual void InitNonCombatTriggers(std::list& triggers) override; @@ -162,15 +162,15 @@ namespace ai { public: RpgCraftStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg craft"; } + std::string getName() override { return "rpg craft"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg craft"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg craft"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot move to nearby objects, players, npcs.\n" "Bots will automatically craft items they think are usefull or will give them skill points.\n" "Bots will automatically cast random spells on or near players or npcs."; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: virtual void InitNonCombatTriggers(std::list& triggers) override; @@ -180,14 +180,14 @@ namespace ai { public: RpgJumpStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "rpg jump"; } + std::string getName() override { return "rpg jump"; } #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg jump"; } //Must equal iternal name - virtual string GetHelpDescription() { + virtual std::string GetHelpName() { return "rpg jump"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This strategy makes bot jump randomly.\n" "Chances of jumps forward, in place, backward depend on config.\n"; } - virtual vector GetRelatedStrategies() { return { "rpg" }; } + virtual std::vector GetRelatedStrategies() { return { "rpg" }; } #endif private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/RunawayStrategy.h b/playerbot/strategy/generic/RunawayStrategy.h index c2c3bb8f..c48c36aa 100644 --- a/playerbot/strategy/generic/RunawayStrategy.h +++ b/playerbot/strategy/generic/RunawayStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: RunawayStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "runaway"; } + std::string getName() override { return "runaway"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/SayStrategy.h b/playerbot/strategy/generic/SayStrategy.h index 97cbc503..8b5b5470 100644 --- a/playerbot/strategy/generic/SayStrategy.h +++ b/playerbot/strategy/generic/SayStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: SayStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "say"; } + std::string getName() override { return "say"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/generic/StayStrategy.h b/playerbot/strategy/generic/StayStrategy.h index 502ab5fb..139347e3 100644 --- a/playerbot/strategy/generic/StayStrategy.h +++ b/playerbot/strategy/generic/StayStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: StayStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "stay"; } + std::string getName() override { return "stay"; } private: void InitNonCombatTriggers(std::list& triggers) override; @@ -21,7 +21,7 @@ namespace ai { public: SitStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "sit"; } + std::string getName() override { return "sit"; } private: void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/TankAssistStrategy.h b/playerbot/strategy/generic/TankAssistStrategy.h index 8fbe586f..92da88cd 100644 --- a/playerbot/strategy/generic/TankAssistStrategy.h +++ b/playerbot/strategy/generic/TankAssistStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: TankAssistStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "tank assist"; } + std::string getName() override { return "tank assist"; } int GetType() override { return STRATEGY_TYPE_TANK; } private: diff --git a/playerbot/strategy/generic/TellTargetStrategy.h b/playerbot/strategy/generic/TellTargetStrategy.h index 1584c6c4..6b7e34f3 100644 --- a/playerbot/strategy/generic/TellTargetStrategy.h +++ b/playerbot/strategy/generic/TellTargetStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: TellTargetStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "tell target"; } + std::string getName() override { return "tell target"; } private: void InitCombatTriggers(std::list &triggers) override; }; diff --git a/playerbot/strategy/generic/ThreatStrategy.h b/playerbot/strategy/generic/ThreatStrategy.h index 16207272..77f05fd2 100644 --- a/playerbot/strategy/generic/ThreatStrategy.h +++ b/playerbot/strategy/generic/ThreatStrategy.h @@ -1,6 +1,6 @@ #pragma once -#include "../Multiplier.h" -#include "../Strategy.h" +#include "playerbot/strategy/Multiplier.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -17,7 +17,7 @@ namespace ai { public: ThreatStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "threat"; } + std::string getName() override { return "threat"; } private: void InitCombatMultipliers(std::list &multipliers) override; diff --git a/playerbot/strategy/generic/TravelStrategy.h b/playerbot/strategy/generic/TravelStrategy.h index fbf3e885..2091f4ce 100644 --- a/playerbot/strategy/generic/TravelStrategy.h +++ b/playerbot/strategy/generic/TravelStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: TravelStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "travel"; } + std::string getName() override { return "travel"; } public: void InitNonCombatTriggers(std::list &triggers) override; @@ -18,27 +18,27 @@ namespace ai { public: TravelOnceStrategy(PlayerbotAI* ai) : TravelStrategy(ai) {} - string getName() override { return "travel once"; } + std::string getName() override { return "travel once"; } }; class ExploreStrategy : public Strategy { public: ExploreStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "explore"; } + std::string getName() override { return "explore"; } }; class MapStrategy : public Strategy { public: MapStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "map"; } + std::string getName() override { return "map"; } }; class MapFullStrategy : public Strategy { public: MapFullStrategy(PlayerbotAI* ai) : Strategy(ai) {}; - string getName() override { return "map full"; } + std::string getName() override { return "map full"; } }; } diff --git a/playerbot/strategy/generic/UseFoodStrategy.h b/playerbot/strategy/generic/UseFoodStrategy.h index 9147a918..21168ab1 100644 --- a/playerbot/strategy/generic/UseFoodStrategy.h +++ b/playerbot/strategy/generic/UseFoodStrategy.h @@ -6,7 +6,7 @@ namespace ai { public: UseFoodStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "food"; } + std::string getName() override { return "food"; } private: void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/UsePotionsStrategy.h b/playerbot/strategy/generic/UsePotionsStrategy.h index 9b66d481..d1b46015 100644 --- a/playerbot/strategy/generic/UsePotionsStrategy.h +++ b/playerbot/strategy/generic/UsePotionsStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: UsePotionsStrategy(PlayerbotAI* ai); - string getName() override { return "potions"; } + std::string getName() override { return "potions"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/generic/WorldPacketHandlerStrategy.h b/playerbot/strategy/generic/WorldPacketHandlerStrategy.h index 93167e06..0818ab17 100644 --- a/playerbot/strategy/generic/WorldPacketHandlerStrategy.h +++ b/playerbot/strategy/generic/WorldPacketHandlerStrategy.h @@ -7,7 +7,7 @@ namespace ai { public: WorldPacketHandlerStrategy(PlayerbotAI* ai); - string getName() override { return "default"; } + std::string getName() override { return "default"; } private: void InitNonCombatTriggers(std::list& triggers) override; @@ -19,7 +19,7 @@ namespace ai { public: ReadyCheckStrategy(PlayerbotAI* ai) : PassTroughStrategy(ai) {} - string getName() override { return "ready check"; } + std::string getName() override { return "ready check"; } private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/hunter/BeastMasteryHunterStrategy.h b/playerbot/strategy/hunter/BeastMasteryHunterStrategy.h index 6563b2cf..7f59b1a1 100644 --- a/playerbot/strategy/hunter/BeastMasteryHunterStrategy.h +++ b/playerbot/strategy/hunter/BeastMasteryHunterStrategy.h @@ -8,7 +8,7 @@ namespace ai public: BeastMasteryHunterPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "beast mastery"; } + std::string getName() override { return "beast mastery"; } }; class BeastMasteryHunterStrategy : public HunterStrategy @@ -76,7 +76,7 @@ namespace ai { public: BeastMasteryHunterAoePveStrategy(PlayerbotAI* ai) : BeastMasteryHunterAoeStrategy(ai) {} - string getName() override { return "aoe beast mastery pve"; } + std::string getName() override { return "aoe beast mastery pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: BeastMasteryHunterAoePvpStrategy(PlayerbotAI* ai) : BeastMasteryHunterAoeStrategy(ai) {} - string getName() override { return "aoe beast mastery pvp"; } + std::string getName() override { return "aoe beast mastery pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: BeastMasteryHunterAoeRaidStrategy(PlayerbotAI* ai) : BeastMasteryHunterAoeStrategy(ai) {} - string getName() override { return "aoe beast mastery raid"; } + std::string getName() override { return "aoe beast mastery raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: BeastMasteryHunterBuffPveStrategy(PlayerbotAI* ai) : BeastMasteryHunterBuffStrategy(ai) {} - string getName() override { return "buff beast mastery pve"; } + std::string getName() override { return "buff beast mastery pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: BeastMasteryHunterBuffPvpStrategy(PlayerbotAI* ai) : BeastMasteryHunterBuffStrategy(ai) {} - string getName() override { return "buff beast mastery pvp"; } + std::string getName() override { return "buff beast mastery pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: BeastMasteryHunterBuffRaidStrategy(PlayerbotAI* ai) : BeastMasteryHunterBuffStrategy(ai) {} - string getName() override { return "buff beast mastery raid"; } + std::string getName() override { return "buff beast mastery raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: BeastMasteryHunterBoostPveStrategy(PlayerbotAI* ai) : BeastMasteryHunterBoostStrategy(ai) {} - string getName() override { return "boost beast mastery pve"; } + std::string getName() override { return "boost beast mastery pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: BeastMasteryHunterBoostPvpStrategy(PlayerbotAI* ai) : BeastMasteryHunterBoostStrategy(ai) {} - string getName() override { return "boost beast mastery pvp"; } + std::string getName() override { return "boost beast mastery pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: BeastMasteryHunterBoostRaidStrategy(PlayerbotAI* ai) : BeastMasteryHunterBoostStrategy(ai) {} - string getName() override { return "boost beast mastery raid"; } + std::string getName() override { return "boost beast mastery raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: BeastMasteryHunterCcPveStrategy(PlayerbotAI* ai) : BeastMasteryHunterCcStrategy(ai) {} - string getName() override { return "cc beast mastery pve"; } + std::string getName() override { return "cc beast mastery pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: BeastMasteryHunterCcPvpStrategy(PlayerbotAI* ai) : BeastMasteryHunterCcStrategy(ai) {} - string getName() override { return "cc beast mastery pvp"; } + std::string getName() override { return "cc beast mastery pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: BeastMasteryHunterCcRaidStrategy(PlayerbotAI* ai) : BeastMasteryHunterCcStrategy(ai) {} - string getName() override { return "cc beast mastery raid"; } + std::string getName() override { return "cc beast mastery raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -247,7 +247,7 @@ namespace ai { public: BeastMasteryHunterStingPveStrategy(PlayerbotAI* ai) : BeastMasteryHunterStingStrategy(ai) {} - string getName() override { return "sting beast mastery pve"; } + std::string getName() override { return "sting beast mastery pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -257,7 +257,7 @@ namespace ai { public: BeastMasteryHunterStingPvpStrategy(PlayerbotAI* ai) : BeastMasteryHunterStingStrategy(ai) {} - string getName() override { return "sting beast mastery pvp"; } + std::string getName() override { return "sting beast mastery pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -267,7 +267,7 @@ namespace ai { public: BeastMasteryHunterStingRaidStrategy(PlayerbotAI* ai) : BeastMasteryHunterStingStrategy(ai) {} - string getName() override { return "sting beast mastery raid"; } + std::string getName() override { return "sting beast mastery raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -287,7 +287,7 @@ namespace ai { public: BeastMasteryHunterAspectPveStrategy(PlayerbotAI* ai) : BeastMasteryHunterAspectStrategy(ai) {} - string getName() override { return "aspect beast mastery pve"; } + std::string getName() override { return "aspect beast mastery pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -298,7 +298,7 @@ namespace ai { public: BeastMasteryHunterAspectPvpStrategy(PlayerbotAI* ai) : BeastMasteryHunterAspectStrategy(ai) {} - string getName() override { return "aspect beast mastery pvp"; } + std::string getName() override { return "aspect beast mastery pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -309,7 +309,7 @@ namespace ai { public: BeastMasteryHunterAspectRaidStrategy(PlayerbotAI* ai) : BeastMasteryHunterAspectStrategy(ai) {} - string getName() override { return "aspect beast mastery raid"; } + std::string getName() override { return "aspect beast mastery raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/hunter/HunterActions.h b/playerbot/strategy/hunter/HunterActions.h index f86d3611..b1c65572 100644 --- a/playerbot/strategy/hunter/HunterActions.h +++ b/playerbot/strategy/hunter/HunterActions.h @@ -40,7 +40,7 @@ namespace ai { public: CastScatterShotOnClosestAttackerTargetingMeAction(PlayerbotAI* ai) : CastRangedDebuffSpellAction(ai, "scatter shot") {} - string GetTargetName() override { return "closest attacker targeting me target"; } + std::string GetTargetName() override { return "closest attacker targeting me target"; } }; BEGIN_RANGED_SPELL_ACTION(CastDistractingShotAction, "distracting shot") @@ -131,7 +131,7 @@ namespace ai { public: CastMendPetAction(PlayerbotAI* ai) : CastAuraSpellAction(ai, "mend pet") {} - virtual string GetTargetName() { return "pet target"; } + virtual std::string GetTargetName() { return "pet target"; } }; class CastRevivePetAction : public CastBuffSpellAction @@ -253,7 +253,7 @@ namespace ai { public: CastFlareAction(PlayerbotAI* ai) : CastSpellAction(ai, "flare") {} - virtual string GetTargetName() override { return "nearest stealthed unit"; } + virtual std::string GetTargetName() override { return "nearest stealthed unit"; } }; class CastSteadyShotAction : public CastSpellAction @@ -271,37 +271,37 @@ namespace ai public: #ifdef MANGOSBOT_ZERO // For vanilla, bots need to feign death before dropping the trap - TrapOnTargetAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, "feign death"), trapSpell(spell) + TrapOnTargetAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, "feign death"), trapSpell(spell) { trapSpellID = AI_VALUE2(uint32, "spell id", trapSpell); } #else - TrapOnTargetAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell), trapSpell(spell) {} + TrapOnTargetAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell), trapSpell(spell) {} #endif protected: // Traps don't really have target for the spell - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } // The move to target - virtual string GetTrapTargetName() { return "current target"; } + virtual std::string GetTrapTargetName() { return "current target"; } // The trap spell that will be used - string GetTrapSpellName() { return trapSpell; } + std::string GetTrapSpellName() { return trapSpell; } - string GetReachActionName() override { return "reach melee"; } - string GetTargetQualifier() override { return GetTrapSpellName(); } + std::string GetReachActionName() override { return "reach melee"; } + std::string GetTargetQualifier() override { return GetTrapSpellName(); } ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_NONE; } NextAction** getPrerequisites() override { - const string reachAction = GetReachActionName(); - const string spellName = GetSpellName(); - const string targetName = GetTrapTargetName(); + const std::string reachAction = GetReachActionName(); + const std::string spellName = GetSpellName(); + const std::string targetName = GetTrapTargetName(); // Generate the reach action with qualifiers - vector qualifiers = { spellName, targetName, trapSpell }; - const string qualifiersStr = Qualified::MultiQualify(qualifiers, "::"); + std::vector qualifiers = { spellName, targetName, trapSpell }; + const std::string qualifiersStr = Qualified::MultiQualify(qualifiers, "::"); return NextAction::merge(NextAction::array(0, new NextAction(reachAction + "::" + qualifiersStr), NULL), Action::getPrerequisites()); } @@ -319,31 +319,31 @@ namespace ai #endif private: - string trapSpell; + std::string trapSpell; uint32 trapSpellID; }; class TrapOnCcTargetAction : public TrapOnTargetAction { public: - TrapOnCcTargetAction(PlayerbotAI* ai, string spell) : TrapOnTargetAction(ai, spell) {} - string GetTrapTargetName() override { return "cc target"; } + TrapOnCcTargetAction(PlayerbotAI* ai, std::string spell) : TrapOnTargetAction(ai, spell) {} + std::string GetTrapTargetName() override { return "cc target"; } }; class TrapInPlace : public TrapOnTargetAction { public: - TrapInPlace(PlayerbotAI* ai, string spell) : TrapOnTargetAction(ai, spell) {} - string GetTrapTargetName() override { return "self target"; } + TrapInPlace(PlayerbotAI* ai, std::string spell) : TrapOnTargetAction(ai, spell) {} + std::string GetTrapTargetName() override { return "self target"; } }; class CastTrapAction : public CastSpellAction { public: - CastTrapAction(PlayerbotAI* ai, string spell) : CastSpellAction(ai, spell) {} + CastTrapAction(PlayerbotAI* ai, std::string spell) : CastSpellAction(ai, spell) {} // Traps don't really have target for the spell - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } #ifdef MANGOSBOT_ZERO bool Execute(Event& event) override @@ -438,7 +438,7 @@ namespace ai public: CastDismissPetAction(PlayerbotAI* ai) : CastSpellAction(ai, "dismiss pet") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } bool isUseful() override { diff --git a/playerbot/strategy/hunter/HunterAiObjectContext.cpp b/playerbot/strategy/hunter/HunterAiObjectContext.cpp index 7f981291..bfa52d80 100644 --- a/playerbot/strategy/hunter/HunterAiObjectContext.cpp +++ b/playerbot/strategy/hunter/HunterAiObjectContext.cpp @@ -6,7 +6,7 @@ #include "BeastMasteryHunterStrategy.h" #include "MarksmanshipHunterStrategy.h" #include "SurvivalHunterStrategy.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" namespace ai { diff --git a/playerbot/strategy/hunter/HunterAiObjectContext.h b/playerbot/strategy/hunter/HunterAiObjectContext.h index 8891a548..e389052f 100644 --- a/playerbot/strategy/hunter/HunterAiObjectContext.h +++ b/playerbot/strategy/hunter/HunterAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/hunter/HunterStrategy.h b/playerbot/strategy/hunter/HunterStrategy.h index 1240c306..b4a741e4 100644 --- a/playerbot/strategy/hunter/HunterStrategy.h +++ b/playerbot/strategy/hunter/HunterStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { @@ -7,14 +7,14 @@ namespace ai { public: HunterStingPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "sting"; } + std::string getName() override { return "sting"; } }; class HunterAspectPlaceholderStrategy : public PlaceholderStrategy { public: HunterAspectPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "aspect"; } + std::string getName() override { return "aspect"; } }; class HunterStrategy : public ClassStrategy @@ -218,7 +218,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitCombatTriggers(std::list& triggers) override; @@ -269,7 +269,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitCombatTriggers(std::list& triggers) override; @@ -285,7 +285,7 @@ namespace ai { public: HunterPetStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "pet"; } + std::string getName() override { return "pet"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/hunter/HunterTriggers.h b/playerbot/strategy/hunter/HunterTriggers.h index 15efe8a9..ecc152b7 100644 --- a/playerbot/strategy/hunter/HunterTriggers.h +++ b/playerbot/strategy/hunter/HunterTriggers.h @@ -1,6 +1,6 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { @@ -104,7 +104,7 @@ namespace ai class FrostTrapTrigger : public MeleeLightAoeTrigger { public: - FrostTrapTrigger(PlayerbotAI* ai, string spell = "frost trap") : MeleeLightAoeTrigger(ai) + FrostTrapTrigger(PlayerbotAI* ai, std::string spell = "frost trap") : MeleeLightAoeTrigger(ai) { spellId = AI_VALUE2(uint32, "spell id", spell); } @@ -129,7 +129,7 @@ namespace ai class ExplosiveTrapTrigger : public RangedMediumAoeTrigger { public: - ExplosiveTrapTrigger(PlayerbotAI* ai, string spell = "explosive trap") : RangedMediumAoeTrigger(ai) + ExplosiveTrapTrigger(PlayerbotAI* ai, std::string spell = "explosive trap") : RangedMediumAoeTrigger(ai) { spellId = AI_VALUE2(uint32, "spell id", spell); } @@ -292,7 +292,7 @@ namespace ai { public: AimedShotTrigger(PlayerbotAI* ai) : Trigger(ai, "aimed shot", 2) {} - virtual string GetTargetName() { return "current target"; } + virtual std::string GetTargetName() { return "current target"; } virtual bool IsActive() { diff --git a/playerbot/strategy/hunter/MarksmanshipHunterStrategy.h b/playerbot/strategy/hunter/MarksmanshipHunterStrategy.h index 33814c3b..30378d5a 100644 --- a/playerbot/strategy/hunter/MarksmanshipHunterStrategy.h +++ b/playerbot/strategy/hunter/MarksmanshipHunterStrategy.h @@ -8,7 +8,7 @@ namespace ai public: MarksmanshipHunterPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "marksmanship"; } + std::string getName() override { return "marksmanship"; } }; class MarksmanshipHunterStrategy : public HunterStrategy @@ -76,7 +76,7 @@ namespace ai { public: MarksmanshipHunterAoePveStrategy(PlayerbotAI* ai) : MarksmanshipHunterAoeStrategy(ai) {} - string getName() override { return "aoe marksmanship pve"; } + std::string getName() override { return "aoe marksmanship pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: MarksmanshipHunterAoePvpStrategy(PlayerbotAI* ai) : MarksmanshipHunterAoeStrategy(ai) {} - string getName() override { return "aoe marksmanship pvp"; } + std::string getName() override { return "aoe marksmanship pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: MarksmanshipHunterAoeRaidStrategy(PlayerbotAI* ai) : MarksmanshipHunterAoeStrategy(ai) {} - string getName() override { return "aoe marksmanship raid"; } + std::string getName() override { return "aoe marksmanship raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: MarksmanshipHunterBuffPveStrategy(PlayerbotAI* ai) : MarksmanshipHunterBuffStrategy(ai) {} - string getName() override { return "buff marksmanship pve"; } + std::string getName() override { return "buff marksmanship pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: MarksmanshipHunterBuffPvpStrategy(PlayerbotAI* ai) : MarksmanshipHunterBuffStrategy(ai) {} - string getName() override { return "buff marksmanship pvp"; } + std::string getName() override { return "buff marksmanship pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: MarksmanshipHunterBuffRaidStrategy(PlayerbotAI* ai) : MarksmanshipHunterBuffStrategy(ai) {} - string getName() override { return "buff marksmanship raid"; } + std::string getName() override { return "buff marksmanship raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: MarksmanshipHunterBoostPveStrategy(PlayerbotAI* ai) : MarksmanshipHunterBoostStrategy(ai) {} - string getName() override { return "boost marksmanship pve"; } + std::string getName() override { return "boost marksmanship pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: MarksmanshipHunterBoostPvpStrategy(PlayerbotAI* ai) : MarksmanshipHunterBoostStrategy(ai) {} - string getName() override { return "boost marksmanship pvp"; } + std::string getName() override { return "boost marksmanship pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: MarksmanshipHunterBoostRaidStrategy(PlayerbotAI* ai) : MarksmanshipHunterBoostStrategy(ai) {} - string getName() override { return "boost marksmanship raid"; } + std::string getName() override { return "boost marksmanship raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: MarksmanshipHunterCcPveStrategy(PlayerbotAI* ai) : MarksmanshipHunterCcStrategy(ai) {} - string getName() override { return "cc marksmanship pve"; } + std::string getName() override { return "cc marksmanship pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: MarksmanshipHunterCcPvpStrategy(PlayerbotAI* ai) : MarksmanshipHunterCcStrategy(ai) {} - string getName() override { return "cc marksmanship pvp"; } + std::string getName() override { return "cc marksmanship pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: MarksmanshipHunterCcRaidStrategy(PlayerbotAI* ai) : MarksmanshipHunterCcStrategy(ai) {} - string getName() override { return "cc marksmanship raid"; } + std::string getName() override { return "cc marksmanship raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -247,7 +247,7 @@ namespace ai { public: MarksmanshipHunterStingPveStrategy(PlayerbotAI* ai) : MarksmanshipHunterStingStrategy(ai) {} - string getName() override { return "sting marksmanship pve"; } + std::string getName() override { return "sting marksmanship pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -257,7 +257,7 @@ namespace ai { public: MarksmanshipHunterStingPvpStrategy(PlayerbotAI* ai) : MarksmanshipHunterStingStrategy(ai) {} - string getName() override { return "sting marksmanship pvp"; } + std::string getName() override { return "sting marksmanship pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -267,7 +267,7 @@ namespace ai { public: MarksmanshipHunterStingRaidStrategy(PlayerbotAI* ai) : MarksmanshipHunterStingStrategy(ai) {} - string getName() override { return "sting marksmanship raid"; } + std::string getName() override { return "sting marksmanship raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -287,7 +287,7 @@ namespace ai { public: MarksmanshipHunterAspectPveStrategy(PlayerbotAI* ai) : MarksmanshipHunterAspectStrategy(ai) {} - string getName() override { return "aspect marksmanship pve"; } + std::string getName() override { return "aspect marksmanship pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -298,7 +298,7 @@ namespace ai { public: MarksmanshipHunterAspectPvpStrategy(PlayerbotAI* ai) : MarksmanshipHunterAspectStrategy(ai) {} - string getName() override { return "aspect marksmanship pvp"; } + std::string getName() override { return "aspect marksmanship pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -309,7 +309,7 @@ namespace ai { public: MarksmanshipHunterAspectRaidStrategy(PlayerbotAI* ai) : MarksmanshipHunterAspectStrategy(ai) {} - string getName() override { return "aspect marksmanship raid"; } + std::string getName() override { return "aspect marksmanship raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/hunter/SurvivalHunterStrategy.h b/playerbot/strategy/hunter/SurvivalHunterStrategy.h index 38f6d53d..dcfae223 100644 --- a/playerbot/strategy/hunter/SurvivalHunterStrategy.h +++ b/playerbot/strategy/hunter/SurvivalHunterStrategy.h @@ -8,7 +8,7 @@ namespace ai public: SurvivalHunterPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "survival"; } + std::string getName() override { return "survival"; } }; class SurvivalHunterStrategy : public HunterStrategy @@ -76,7 +76,7 @@ namespace ai { public: SurvivalHunterAoePveStrategy(PlayerbotAI* ai) : SurvivalHunterAoeStrategy(ai) {} - string getName() override { return "aoe survival pve"; } + std::string getName() override { return "aoe survival pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: SurvivalHunterAoePvpStrategy(PlayerbotAI* ai) : SurvivalHunterAoeStrategy(ai) {} - string getName() override { return "aoe survival pvp"; } + std::string getName() override { return "aoe survival pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: SurvivalHunterAoeRaidStrategy(PlayerbotAI* ai) : SurvivalHunterAoeStrategy(ai) {} - string getName() override { return "aoe survival raid"; } + std::string getName() override { return "aoe survival raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: SurvivalHunterBuffPveStrategy(PlayerbotAI* ai) : SurvivalHunterBuffStrategy(ai) {} - string getName() override { return "buff survival pve"; } + std::string getName() override { return "buff survival pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: SurvivalHunterBuffPvpStrategy(PlayerbotAI* ai) : SurvivalHunterBuffStrategy(ai) {} - string getName() override { return "buff survival pvp"; } + std::string getName() override { return "buff survival pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: SurvivalHunterBuffRaidStrategy(PlayerbotAI* ai) : SurvivalHunterBuffStrategy(ai) {} - string getName() override { return "buff survival raid"; } + std::string getName() override { return "buff survival raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: SurvivalHunterBoostPveStrategy(PlayerbotAI* ai) : SurvivalHunterBoostStrategy(ai) {} - string getName() override { return "boost survival pve"; } + std::string getName() override { return "boost survival pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: SurvivalHunterBoostPvpStrategy(PlayerbotAI* ai) : SurvivalHunterBoostStrategy(ai) {} - string getName() override { return "boost survival pvp"; } + std::string getName() override { return "boost survival pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: SurvivalHunterBoostRaidStrategy(PlayerbotAI* ai) : SurvivalHunterBoostStrategy(ai) {} - string getName() override { return "boost survival raid"; } + std::string getName() override { return "boost survival raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: SurvivalHunterCcPveStrategy(PlayerbotAI* ai) : SurvivalHunterCcStrategy(ai) {} - string getName() override { return "cc survival pve"; } + std::string getName() override { return "cc survival pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: SurvivalHunterCcPvpStrategy(PlayerbotAI* ai) : SurvivalHunterCcStrategy(ai) {} - string getName() override { return "cc survival pvp"; } + std::string getName() override { return "cc survival pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: SurvivalHunterCcRaidStrategy(PlayerbotAI* ai) : SurvivalHunterCcStrategy(ai) {} - string getName() override { return "cc survival raid"; } + std::string getName() override { return "cc survival raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -247,7 +247,7 @@ namespace ai { public: SurvivalHunterStingPveStrategy(PlayerbotAI* ai) : SurvivalHunterStingStrategy(ai) {} - string getName() override { return "sting survival pve"; } + std::string getName() override { return "sting survival pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -257,7 +257,7 @@ namespace ai { public: SurvivalHunterStingPvpStrategy(PlayerbotAI* ai) : SurvivalHunterStingStrategy(ai) {} - string getName() override { return "sting survival pvp"; } + std::string getName() override { return "sting survival pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -267,7 +267,7 @@ namespace ai { public: SurvivalHunterStingRaidStrategy(PlayerbotAI* ai) : SurvivalHunterStingStrategy(ai) {} - string getName() override { return "sting survival raid"; } + std::string getName() override { return "sting survival raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -287,7 +287,7 @@ namespace ai { public: SurvivalHunterAspectPveStrategy(PlayerbotAI* ai) : SurvivalHunterAspectStrategy(ai) {} - string getName() override { return "aspect survival pve"; } + std::string getName() override { return "aspect survival pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -298,7 +298,7 @@ namespace ai { public: SurvivalHunterAspectPvpStrategy(PlayerbotAI* ai) : SurvivalHunterAspectStrategy(ai) {} - string getName() override { return "aspect survival pvp"; } + std::string getName() override { return "aspect survival pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -309,7 +309,7 @@ namespace ai { public: SurvivalHunterAspectRaidStrategy(PlayerbotAI* ai) : SurvivalHunterAspectStrategy(ai) {} - string getName() override { return "aspect survival raid"; } + std::string getName() override { return "aspect survival raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/mage/ArcaneMageStrategy.h b/playerbot/strategy/mage/ArcaneMageStrategy.h index f7340486..f62d7a06 100644 --- a/playerbot/strategy/mage/ArcaneMageStrategy.h +++ b/playerbot/strategy/mage/ArcaneMageStrategy.h @@ -8,7 +8,7 @@ namespace ai public: ArcaneMagePlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "arcane"; } + std::string getName() override { return "arcane"; } }; class ArcaneMageStrategy : public MageStrategy @@ -78,7 +78,7 @@ namespace ai { public: ArcaneMageAoePveStrategy(PlayerbotAI* ai) : ArcaneMageAoeStrategy(ai) {} - string getName() override { return "aoe arcane pve"; } + std::string getName() override { return "aoe arcane pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: ArcaneMageAoePvpStrategy(PlayerbotAI* ai) : ArcaneMageAoeStrategy(ai) {} - string getName() override { return "aoe arcane pvp"; } + std::string getName() override { return "aoe arcane pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: ArcaneMageAoeRaidStrategy(PlayerbotAI* ai) : ArcaneMageAoeStrategy(ai) {} - string getName() override { return "aoe arcane raid"; } + std::string getName() override { return "aoe arcane raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: ArcaneMageBuffPveStrategy(PlayerbotAI* ai) : ArcaneMageBuffStrategy(ai) {} - string getName() override { return "buff arcane pve"; } + std::string getName() override { return "buff arcane pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: ArcaneMageBuffPvpStrategy(PlayerbotAI* ai) : ArcaneMageBuffStrategy(ai) {} - string getName() override { return "buff arcane pvp"; } + std::string getName() override { return "buff arcane pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: ArcaneMageBuffRaidStrategy(PlayerbotAI* ai) : ArcaneMageBuffStrategy(ai) {} - string getName() override { return "buff arcane raid"; } + std::string getName() override { return "buff arcane raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: ArcaneMageBoostPveStrategy(PlayerbotAI* ai) : ArcaneMageBoostStrategy(ai) {} - string getName() override { return "boost arcane pve"; } + std::string getName() override { return "boost arcane pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: ArcaneMageBoostPvpStrategy(PlayerbotAI* ai) : ArcaneMageBoostStrategy(ai) {} - string getName() override { return "boost arcane pvp"; } + std::string getName() override { return "boost arcane pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: ArcaneMageBoostRaidStrategy(PlayerbotAI* ai) : ArcaneMageBoostStrategy(ai) {} - string getName() override { return "boost arcane raid"; } + std::string getName() override { return "boost arcane raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: ArcaneMageCcPveStrategy(PlayerbotAI* ai) : ArcaneMageCcStrategy(ai) {} - string getName() override { return "cc arcane pve"; } + std::string getName() override { return "cc arcane pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: ArcaneMageCcPvpStrategy(PlayerbotAI* ai) : ArcaneMageCcStrategy(ai) {} - string getName() override { return "cc arcane pvp"; } + std::string getName() override { return "cc arcane pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: ArcaneMageCcRaidStrategy(PlayerbotAI* ai) : ArcaneMageCcStrategy(ai) {} - string getName() override { return "cc arcane raid"; } + std::string getName() override { return "cc arcane raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: ArcaneMageCurePveStrategy(PlayerbotAI* ai) : ArcaneMageCureStrategy(ai) {} - string getName() override { return "cure arcane pve"; } + std::string getName() override { return "cure arcane pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: ArcaneMageCurePvpStrategy(PlayerbotAI* ai) : ArcaneMageCureStrategy(ai) {} - string getName() override { return "cure arcane pvp"; } + std::string getName() override { return "cure arcane pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: ArcaneMageCureRaidStrategy(PlayerbotAI* ai) : ArcaneMageCureStrategy(ai) {} - string getName() override { return "cure arcane raid"; } + std::string getName() override { return "cure arcane raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/mage/FireMageStrategy.h b/playerbot/strategy/mage/FireMageStrategy.h index d6e8b558..cfc85e15 100644 --- a/playerbot/strategy/mage/FireMageStrategy.h +++ b/playerbot/strategy/mage/FireMageStrategy.h @@ -8,7 +8,7 @@ namespace ai public: FireMagePlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "fire"; } + std::string getName() override { return "fire"; } }; class FireMageStrategy : public MageStrategy @@ -78,7 +78,7 @@ namespace ai { public: FireMageAoePveStrategy(PlayerbotAI* ai) : FireMageAoeStrategy(ai) {} - string getName() override { return "aoe fire pve"; } + std::string getName() override { return "aoe fire pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: FireMageAoePvpStrategy(PlayerbotAI* ai) : FireMageAoeStrategy(ai) {} - string getName() override { return "aoe fire pvp"; } + std::string getName() override { return "aoe fire pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: FireMageAoeRaidStrategy(PlayerbotAI* ai) : FireMageAoeStrategy(ai) {} - string getName() override { return "aoe fire raid"; } + std::string getName() override { return "aoe fire raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: FireMageBuffPveStrategy(PlayerbotAI* ai) : FireMageBuffStrategy(ai) {} - string getName() override { return "buff fire pve"; } + std::string getName() override { return "buff fire pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: FireMageBuffPvpStrategy(PlayerbotAI* ai) : FireMageBuffStrategy(ai) {} - string getName() override { return "buff fire pvp"; } + std::string getName() override { return "buff fire pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: FireMageBuffRaidStrategy(PlayerbotAI* ai) : FireMageBuffStrategy(ai) {} - string getName() override { return "buff fire raid"; } + std::string getName() override { return "buff fire raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: FireMageBoostPveStrategy(PlayerbotAI* ai) : FireMageBoostStrategy(ai) {} - string getName() override { return "boost fire pve"; } + std::string getName() override { return "boost fire pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: FireMageBoostPvpStrategy(PlayerbotAI* ai) : FireMageBoostStrategy(ai) {} - string getName() override { return "boost fire pvp"; } + std::string getName() override { return "boost fire pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: FireMageBoostRaidStrategy(PlayerbotAI* ai) : FireMageBoostStrategy(ai) {} - string getName() override { return "boost fire raid"; } + std::string getName() override { return "boost fire raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: FireMageCcPveStrategy(PlayerbotAI* ai) : FireMageCcStrategy(ai) {} - string getName() override { return "cc fire pve"; } + std::string getName() override { return "cc fire pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: FireMageCcPvpStrategy(PlayerbotAI* ai) : FireMageCcStrategy(ai) {} - string getName() override { return "cc fire pvp"; } + std::string getName() override { return "cc fire pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: FireMageCcRaidStrategy(PlayerbotAI* ai) : FireMageCcStrategy(ai) {} - string getName() override { return "cc fire raid"; } + std::string getName() override { return "cc fire raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: FireMageCurePveStrategy(PlayerbotAI* ai) : FireMageCureStrategy(ai) {} - string getName() override { return "cure fire pve"; } + std::string getName() override { return "cure fire pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: FireMageCurePvpStrategy(PlayerbotAI* ai) : FireMageCureStrategy(ai) {} - string getName() override { return "cure fire pvp"; } + std::string getName() override { return "cure fire pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: FireMageCureRaidStrategy(PlayerbotAI* ai) : FireMageCureStrategy(ai) {} - string getName() override { return "cure fire raid"; } + std::string getName() override { return "cure fire raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/mage/FrostMageStrategy.h b/playerbot/strategy/mage/FrostMageStrategy.h index 8f014d75..1ff28946 100644 --- a/playerbot/strategy/mage/FrostMageStrategy.h +++ b/playerbot/strategy/mage/FrostMageStrategy.h @@ -8,7 +8,7 @@ namespace ai public: FrostMagePlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "frost"; } + std::string getName() override { return "frost"; } }; class FrostMageStrategy : public MageStrategy @@ -78,7 +78,7 @@ namespace ai { public: FrostMageAoePveStrategy(PlayerbotAI* ai) : FrostMageAoeStrategy(ai) {} - string getName() override { return "aoe frost pve"; } + std::string getName() override { return "aoe frost pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: FrostMageAoePvpStrategy(PlayerbotAI* ai) : FrostMageAoeStrategy(ai) {} - string getName() override { return "aoe frost pvp"; } + std::string getName() override { return "aoe frost pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: FrostMageAoeRaidStrategy(PlayerbotAI* ai) : FrostMageAoeStrategy(ai) {} - string getName() override { return "aoe frost raid"; } + std::string getName() override { return "aoe frost raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: FrostMageBuffPveStrategy(PlayerbotAI* ai) : FrostMageBuffStrategy(ai) {} - string getName() override { return "buff frost pve"; } + std::string getName() override { return "buff frost pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: FrostMageBuffPvpStrategy(PlayerbotAI* ai) : FrostMageBuffStrategy(ai) {} - string getName() override { return "buff frost pvp"; } + std::string getName() override { return "buff frost pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: FrostMageBuffRaidStrategy(PlayerbotAI* ai) : FrostMageBuffStrategy(ai) {} - string getName() override { return "buff frost raid"; } + std::string getName() override { return "buff frost raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: FrostMageBoostPveStrategy(PlayerbotAI* ai) : FrostMageBoostStrategy(ai) {} - string getName() override { return "boost frost pve"; } + std::string getName() override { return "boost frost pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: FrostMageBoostPvpStrategy(PlayerbotAI* ai) : FrostMageBoostStrategy(ai) {} - string getName() override { return "boost frost pvp"; } + std::string getName() override { return "boost frost pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: FrostMageBoostRaidStrategy(PlayerbotAI* ai) : FrostMageBoostStrategy(ai) {} - string getName() override { return "boost frost raid"; } + std::string getName() override { return "boost frost raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: FrostMageCcPveStrategy(PlayerbotAI* ai) : FrostMageCcStrategy(ai) {} - string getName() override { return "cc frost pve"; } + std::string getName() override { return "cc frost pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: FrostMageCcPvpStrategy(PlayerbotAI* ai) : FrostMageCcStrategy(ai) {} - string getName() override { return "cc frost pvp"; } + std::string getName() override { return "cc frost pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: FrostMageCcRaidStrategy(PlayerbotAI* ai) : FrostMageCcStrategy(ai) {} - string getName() override { return "cc frost raid"; } + std::string getName() override { return "cc frost raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: FrostMageCurePveStrategy(PlayerbotAI* ai) : FrostMageCureStrategy(ai) {} - string getName() override { return "cure frost pve"; } + std::string getName() override { return "cure frost pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: FrostMageCurePvpStrategy(PlayerbotAI* ai) : FrostMageCureStrategy(ai) {} - string getName() override { return "cure frost pvp"; } + std::string getName() override { return "cure frost pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: FrostMageCureRaidStrategy(PlayerbotAI* ai) : FrostMageCureStrategy(ai) {} - string getName() override { return "cure frost raid"; } + std::string getName() override { return "cure frost raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/mage/MageActions.h b/playerbot/strategy/mage/MageActions.h index 39cc27b4..44edcb30 100644 --- a/playerbot/strategy/mage/MageActions.h +++ b/playerbot/strategy/mage/MageActions.h @@ -33,7 +33,7 @@ namespace ai { public: CastArcaneBlastAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "arcane blast") {} - virtual string GetTargetName() { return "current target"; } + virtual std::string GetTargetName() { return "current target"; } }; class CastArcaneBarrageAction : public CastSpellAction @@ -250,7 +250,7 @@ namespace ai CastPolymorphAction(PlayerbotAI* ai) : CastCrowdControlSpellAction(ai, "polymorph") {} virtual bool Execute(Event& event) { - vector polySpells; + std::vector polySpells; polySpells.push_back("polymorph"); if (bot->HasSpell(28271)) polySpells.push_back("polymorph: turtle"); @@ -283,7 +283,7 @@ namespace ai { public: CastEvocationAction(PlayerbotAI* ai) : CastSpellAction(ai, "evocation") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } }; class CastCounterspellOnEnemyHealerAction : public CastSpellOnEnemyHealerAction @@ -370,7 +370,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->learnSpell(56975, false); - ostringstream out; + std::ostringstream out; out << "I learned Glyph of Fireball"; ai->TellError(requester, out.str()); @@ -388,7 +388,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->removeSpell(56975); - ostringstream out; + std::ostringstream out; out << "I removed Glyph of Fireball"; ai->TellError(requester, out.str()); @@ -406,7 +406,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->learnSpell(56370, false); - ostringstream out; + std::ostringstream out; out << "I learned Glyph of Frostbolt"; ai->TellError(requester, out.str()); @@ -424,7 +424,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->removeSpell(56370); - ostringstream out; + std::ostringstream out; out << "I removed Glyph of Frostbolt"; ai->TellError(requester, out.str()); @@ -442,7 +442,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->learnSpell(64275, false); - ostringstream out; + std::ostringstream out; out << "I learned Glyph of Living Bomb"; ai->TellError(requester, out.str()); @@ -460,7 +460,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->removeSpell(64275); - ostringstream out; + std::ostringstream out; out << "I removed Glyph of Living Bomb"; ai->TellError(requester, out.str()); @@ -478,7 +478,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->learnSpell(63093, false); - ostringstream out; + std::ostringstream out; out << "I learned Glyph of Mirror Image"; ai->TellError(requester, out.str()); @@ -496,7 +496,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->removeSpell(63093); - ostringstream out; + std::ostringstream out; out << "I removed Glyph of Mirror Image"; ai->TellError(requester, out.str()); @@ -514,7 +514,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->learnSpell(42751, false); - ostringstream out; + std::ostringstream out; out << "I learned Glyph of Molten Armor"; ai->TellError(requester, out.str()); @@ -532,7 +532,7 @@ namespace ai Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); bot->removeSpell(42751); - ostringstream out; + std::ostringstream out; out << "I removed Glyph of Molten Armor"; ai->TellError(requester, out.str()); diff --git a/playerbot/strategy/mage/MageAiObjectContext.cpp b/playerbot/strategy/mage/MageAiObjectContext.cpp index f7a21f70..e898af01 100644 --- a/playerbot/strategy/mage/MageAiObjectContext.cpp +++ b/playerbot/strategy/mage/MageAiObjectContext.cpp @@ -1,14 +1,14 @@ #include "playerbot/playerbot.h" -#include "../Strategy.h" +#include "playerbot/strategy/Strategy.h" #include "MageActions.h" #include "MageAiObjectContext.h" #include "FrostMageStrategy.h" #include "ArcaneMageStrategy.h" #include "FireMageStrategy.h" -#include "../generic/PullStrategy.h" +#include "playerbot/strategy/generic/PullStrategy.h" #include "MageTriggers.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" namespace ai { diff --git a/playerbot/strategy/mage/MageAiObjectContext.h b/playerbot/strategy/mage/MageAiObjectContext.h index 0fe90e2a..e8360236 100644 --- a/playerbot/strategy/mage/MageAiObjectContext.h +++ b/playerbot/strategy/mage/MageAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/mage/MageStrategy.h b/playerbot/strategy/mage/MageStrategy.h index 4cd765d8..af110c66 100644 --- a/playerbot/strategy/mage/MageStrategy.h +++ b/playerbot/strategy/mage/MageStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { diff --git a/playerbot/strategy/mage/MageTriggers.h b/playerbot/strategy/mage/MageTriggers.h index f34fd81e..6051da65 100644 --- a/playerbot/strategy/mage/MageTriggers.h +++ b/playerbot/strategy/mage/MageTriggers.h @@ -1,6 +1,6 @@ #pragma once -#include "../triggers/GenericTriggers.h" -#include "../triggers/GlyphTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GlyphTriggers.h" namespace ai { @@ -185,7 +185,7 @@ namespace ai public: IceLanceTrigger(PlayerbotAI* ai) : Trigger(ai, "ice lance") {} bool IsActive() override; - string GetTargetName() override { return "current target"; } + std::string GetTargetName() override { return "current target"; } }; BUFF_TRIGGER(MirrorImageTrigger, "mirror image"); @@ -352,7 +352,7 @@ namespace ai return false; } - virtual string GetTargetName() { return "current target"; } + virtual std::string GetTargetName() { return "current target"; } }; class LivingBombTrigger : public DebuffTrigger @@ -380,7 +380,7 @@ namespace ai virtual bool IsActive() { - return !ai->HasCheat(BotCheatMask::item) && AI_VALUE2(list, "inventory items", "conjured food").empty(); + return !ai->HasCheat(BotCheatMask::item) && AI_VALUE2(std::list, "inventory items", "conjured food").empty(); } }; @@ -391,7 +391,7 @@ namespace ai virtual bool IsActive() { - return !ai->HasCheat(BotCheatMask::item) && AI_VALUE2(list, "inventory items", "conjured water").empty(); + return !ai->HasCheat(BotCheatMask::item) && AI_VALUE2(std::list, "inventory items", "conjured water").empty(); } }; diff --git a/playerbot/strategy/paladin/HolyPaladinStrategy.h b/playerbot/strategy/paladin/HolyPaladinStrategy.h index edadf50e..ecd743c6 100644 --- a/playerbot/strategy/paladin/HolyPaladinStrategy.h +++ b/playerbot/strategy/paladin/HolyPaladinStrategy.h @@ -8,7 +8,7 @@ namespace ai public: HolyPaladinPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_HEAL | STRATEGY_TYPE_RANGED; } - string getName() override { return "holy"; } + std::string getName() override { return "holy"; } }; class HolyPaladinStrategy : public PaladinStrategy @@ -76,7 +76,7 @@ namespace ai { public: HolyPaladinAoePveStrategy(PlayerbotAI* ai) : HolyPaladinAoeStrategy(ai) {} - string getName() override { return "aoe holy pve"; } + std::string getName() override { return "aoe holy pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: HolyPaladinAoePvpStrategy(PlayerbotAI* ai) : HolyPaladinAoeStrategy(ai) {} - string getName() override { return "aoe holy pvp"; } + std::string getName() override { return "aoe holy pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: HolyPaladinAoeRaidStrategy(PlayerbotAI* ai) : HolyPaladinAoeStrategy(ai) {} - string getName() override { return "aoe holy raid"; } + std::string getName() override { return "aoe holy raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: HolyPaladinBuffPveStrategy(PlayerbotAI* ai) : HolyPaladinBuffStrategy(ai) {} - string getName() override { return "buff holy pve"; } + std::string getName() override { return "buff holy pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: HolyPaladinBuffPvpStrategy(PlayerbotAI* ai) : HolyPaladinBuffStrategy(ai) {} - string getName() override { return "buff holy pvp"; } + std::string getName() override { return "buff holy pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: HolyPaladinBuffRaidStrategy(PlayerbotAI* ai) : HolyPaladinBuffStrategy(ai) {} - string getName() override { return "buff holy raid"; } + std::string getName() override { return "buff holy raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: HolyPaladinBoostPveStrategy(PlayerbotAI* ai) : HolyPaladinBoostStrategy(ai) {} - string getName() override { return "boost holy pve"; } + std::string getName() override { return "boost holy pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: HolyPaladinBoostPvpStrategy(PlayerbotAI* ai) : HolyPaladinBoostStrategy(ai) {} - string getName() override { return "boost holy pvp"; } + std::string getName() override { return "boost holy pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: HolyPaladinBoostRaidStrategy(PlayerbotAI* ai) : HolyPaladinBoostStrategy(ai) {} - string getName() override { return "boost holy raid"; } + std::string getName() override { return "boost holy raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: HolyPaladinCcPveStrategy(PlayerbotAI* ai) : HolyPaladinCcStrategy(ai) {} - string getName() override { return "cc holy pve"; } + std::string getName() override { return "cc holy pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: HolyPaladinCcPvpStrategy(PlayerbotAI* ai) : HolyPaladinCcStrategy(ai) {} - string getName() override { return "cc holy pvp"; } + std::string getName() override { return "cc holy pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: HolyPaladinCcRaidStrategy(PlayerbotAI* ai) : HolyPaladinCcStrategy(ai) {} - string getName() override { return "cc holy raid"; } + std::string getName() override { return "cc holy raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -248,7 +248,7 @@ namespace ai { public: HolyPaladinCurePveStrategy(PlayerbotAI* ai) : HolyPaladinCureStrategy(ai) {} - string getName() override { return "cure holy pve"; } + std::string getName() override { return "cure holy pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -259,7 +259,7 @@ namespace ai { public: HolyPaladinCurePvpStrategy(PlayerbotAI* ai) : HolyPaladinCureStrategy(ai) {} - string getName() override { return "cure holy pvp"; } + std::string getName() override { return "cure holy pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -270,7 +270,7 @@ namespace ai { public: HolyPaladinCureRaidStrategy(PlayerbotAI* ai) : HolyPaladinCureStrategy(ai) {} - string getName() override { return "cure holy raid"; } + std::string getName() override { return "cure holy raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -291,7 +291,7 @@ namespace ai { public: HolyPaladinAuraPveStrategy(PlayerbotAI* ai) : HolyPaladinAuraStrategy(ai) {} - string getName() override { return "aura holy pve"; } + std::string getName() override { return "aura holy pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: HolyPaladinAuraPvpStrategy(PlayerbotAI* ai) : HolyPaladinAuraStrategy(ai) {} - string getName() override { return "aura holy pvp"; } + std::string getName() override { return "aura holy pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -313,7 +313,7 @@ namespace ai { public: HolyPaladinAuraRaidStrategy(PlayerbotAI* ai) : HolyPaladinAuraStrategy(ai) {} - string getName() override { return "aura holy raid"; } + std::string getName() override { return "aura holy raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -334,7 +334,7 @@ namespace ai { public: HolyPaladinBlessingPveStrategy(PlayerbotAI* ai) : HolyPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing holy pve"; } + std::string getName() override { return "blessing holy pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -345,7 +345,7 @@ namespace ai { public: HolyPaladinBlessingPvpStrategy(PlayerbotAI* ai) : HolyPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing holy pvp"; } + std::string getName() override { return "blessing holy pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -356,7 +356,7 @@ namespace ai { public: HolyPaladinBlessingRaidStrategy(PlayerbotAI* ai) : HolyPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing holy raid"; } + std::string getName() override { return "blessing holy raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/paladin/PaladinActions.cpp b/playerbot/strategy/paladin/PaladinActions.cpp index 751c46a2..303fdd10 100644 --- a/playerbot/strategy/paladin/PaladinActions.cpp +++ b/playerbot/strategy/paladin/PaladinActions.cpp @@ -6,8 +6,8 @@ using namespace ai; bool CastPaladinAuraAction::Execute(Event& event) { - vector altAuras; - vector haveAuras; + std::vector altAuras; + std::vector haveAuras; altAuras.push_back("devotion aura"); altAuras.push_back("retribution aura"); altAuras.push_back("concentration aura"); @@ -162,8 +162,8 @@ std::vector CastRaidBlessingAction::GetPossibleBlessingsForTarget(U Unit* CastBlessingOnPartyAction::GetTarget() { - vector altBlessings; - vector haveBlessings; + std::vector altBlessings; + std::vector haveBlessings; altBlessings.push_back("blessing of might"); altBlessings.push_back("blessing of wisdom"); altBlessings.push_back("blessing of kings"); diff --git a/playerbot/strategy/paladin/PaladinActions.h b/playerbot/strategy/paladin/PaladinActions.h index 6e4899db..44a5752a 100644 --- a/playerbot/strategy/paladin/PaladinActions.h +++ b/playerbot/strategy/paladin/PaladinActions.h @@ -66,7 +66,7 @@ namespace ai class CastSealSpellAction : public CastBuffSpellAction { public: - CastSealSpellAction(PlayerbotAI* ai, string name) : CastBuffSpellAction(ai, name) {} + CastSealSpellAction(PlayerbotAI* ai, std::string name) : CastBuffSpellAction(ai, name) {} virtual bool isUseful() { return AI_VALUE2(bool, "combat", "self target"); } }; @@ -132,7 +132,7 @@ namespace ai class CastBlessingAction : public CastSpellAction { public: - CastBlessingAction(PlayerbotAI* ai, string name, bool greater) : CastSpellAction(ai, name), greater(greater) {} + CastBlessingAction(PlayerbotAI* ai, std::string name, bool greater) : CastSpellAction(ai, name), greater(greater) {} private: Unit* GetTarget() override; @@ -150,7 +150,7 @@ namespace ai class CastPveBlessingAction : public CastBlessingAction { public: - CastPveBlessingAction(PlayerbotAI* ai, string name = "pve blessing", bool greater = false) : CastBlessingAction(ai, name, greater) {} + CastPveBlessingAction(PlayerbotAI* ai, std::string name = "pve blessing", bool greater = false) : CastBlessingAction(ai, name, greater) {} private: std::vector GetPossibleBlessingsForTarget(Unit* target) const override; @@ -159,7 +159,7 @@ namespace ai class CastPvpBlessingAction : public CastBlessingAction { public: - CastPvpBlessingAction(PlayerbotAI* ai, string name = "pvp blessing", bool greater = false) : CastBlessingAction(ai, name, greater) {} + CastPvpBlessingAction(PlayerbotAI* ai, std::string name = "pvp blessing", bool greater = false) : CastBlessingAction(ai, name, greater) {} private: std::vector GetPossibleBlessingsForTarget(Unit* target) const override; @@ -168,7 +168,7 @@ namespace ai class CastRaidBlessingAction : public CastBlessingAction { public: - CastRaidBlessingAction(PlayerbotAI* ai, string name = "raid blessing", bool greater = false) : CastBlessingAction(ai, name, greater) {} + CastRaidBlessingAction(PlayerbotAI* ai, std::string name = "raid blessing", bool greater = false) : CastBlessingAction(ai, name, greater) {} private: std::vector GetPossibleBlessingsForTarget(Unit* target) const override; @@ -196,7 +196,7 @@ namespace ai class CastBlessingOnPartyAction : public CastSpellAction { public: - CastBlessingOnPartyAction(PlayerbotAI* ai, string name, bool greater) : CastSpellAction(ai, name), greater(greater) {} + CastBlessingOnPartyAction(PlayerbotAI* ai, std::string name, bool greater) : CastSpellAction(ai, name), greater(greater) {} private: Unit* GetTarget() override; @@ -213,7 +213,7 @@ namespace ai class CastPveBlessingOnPartyAction : public CastBlessingOnPartyAction { public: - CastPveBlessingOnPartyAction(PlayerbotAI* ai, string name = "pve blessing on party", bool greater = false) : CastBlessingOnPartyAction(ai, name, greater) {} + CastPveBlessingOnPartyAction(PlayerbotAI* ai, std::string name = "pve blessing on party", bool greater = false) : CastBlessingOnPartyAction(ai, name, greater) {} private: std::vector GetPossibleBlessingsForTarget(Unit* target) const override; @@ -222,7 +222,7 @@ namespace ai class CastPvpBlessingOnPartyAction : public CastBlessingOnPartyAction { public: - CastPvpBlessingOnPartyAction(PlayerbotAI* ai, string name = "pvp blessing on party", bool greater = false) : CastBlessingOnPartyAction(ai, name, greater) {} + CastPvpBlessingOnPartyAction(PlayerbotAI* ai, std::string name = "pvp blessing on party", bool greater = false) : CastBlessingOnPartyAction(ai, name, greater) {} private: std::vector GetPossibleBlessingsForTarget(Unit* target) const override; @@ -231,7 +231,7 @@ namespace ai class CastRaidBlessingOnPartyAction : public CastBlessingOnPartyAction { public: - CastRaidBlessingOnPartyAction(PlayerbotAI* ai, string name = "raid blessing on party", bool greater = false) : CastBlessingOnPartyAction(ai, name, greater) {} + CastRaidBlessingOnPartyAction(PlayerbotAI* ai, std::string name = "raid blessing on party", bool greater = false) : CastBlessingOnPartyAction(ai, name, greater) {} private: std::vector GetPossibleBlessingsForTarget(Unit* target) const override; @@ -272,7 +272,7 @@ namespace ai { public: CastBlessingOfMightOnPartyAction(PlayerbotAI* ai) : BuffOnPartyAction(ai, "blessing of might") {} - string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + std::string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } }; class CastGreaterBlessingOfMightOnPartyAction : public GreaterBuffOnPartyAction @@ -298,7 +298,7 @@ namespace ai { public: CastBlessingOfWisdomOnPartyAction(PlayerbotAI* ai) : BuffOnPartyAction(ai, "blessing of wisdom") {} - string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + std::string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } }; class CastGreaterBlessingOfWisdomOnPartyAction : public GreaterBuffOnPartyAction @@ -324,7 +324,7 @@ namespace ai { public: CastBlessingOfKingsOnPartyAction(PlayerbotAI* ai) : BuffOnPartyAction(ai, "blessing of kings") {} - string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + std::string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } }; class CastGreaterBlessingOfKingsOnPartyAction : public GreaterBuffOnPartyAction @@ -350,7 +350,7 @@ namespace ai { public: CastBlessingOfSanctuaryOnPartyAction(PlayerbotAI* ai) : BuffOnPartyAction(ai, "blessing of sanctuary") {} - string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + std::string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } }; class CastGreaterBlessingOfSanctuaryOnPartyAction : public GreaterBuffOnPartyAction @@ -376,7 +376,7 @@ namespace ai { public: CastBlessingOfLightOnPartyAction(PlayerbotAI* ai) : BuffOnPartyAction(ai, "blessing of light") {} - string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + std::string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } }; class CastGreaterBlessingOfLightOnPartyAction : public GreaterBuffOnPartyAction @@ -402,7 +402,7 @@ namespace ai { public: CastBlessingOfSalvationOnPartyAction(PlayerbotAI* ai) : BuffOnPartyAction(ai, "blessing of salvation", true) {} - string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } + std::string GetTargetQualifier() override { return GetSpellName() + ",greater " + GetSpellName() + "-" + (ignoreTanks ? "1" : "0"); } }; class CastGreaterBlessingOfSalvationOnPartyAction : public GreaterBuffOnPartyAction @@ -482,7 +482,7 @@ namespace ai { public: CastDivineProtectionOnPartyAction(PlayerbotAI* ai) : HealPartyMemberAction(ai, "divine protection") {} - virtual string getName() { return "divine protection on party"; } + virtual std::string getName() { return "divine protection on party"; } }; class CastDivineShieldAction: public CastBuffSpellAction @@ -525,14 +525,14 @@ namespace ai { public: CastPurifyPoisonOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "purify", DISPEL_POISON) {} - virtual string getName() { return "purify poison on party"; } + virtual std::string getName() { return "purify poison on party"; } }; class CastPurifyDiseaseOnPartyAction : public CurePartyMemberAction { public: CastPurifyDiseaseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "purify", DISPEL_DISEASE) {} - virtual string getName() { return "purify disease on party"; } + virtual std::string getName() { return "purify disease on party"; } }; class CastHandOfReckoningAction : public CastSpellAction @@ -569,21 +569,21 @@ namespace ai { public: CastCleansePoisonOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse", DISPEL_POISON) {} - virtual string getName() { return "cleanse poison on party"; } + virtual std::string getName() { return "cleanse poison on party"; } }; class CastCleanseDiseaseOnPartyAction : public CurePartyMemberAction { public: CastCleanseDiseaseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse", DISPEL_DISEASE) {} - virtual string getName() { return "cleanse disease on party"; } + virtual std::string getName() { return "cleanse disease on party"; } }; class CastCleanseMagicOnPartyAction : public CurePartyMemberAction { public: CastCleanseMagicOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse", DISPEL_MAGIC) {} - virtual string getName() { return "cleanse magic on party"; } + virtual std::string getName() { return "cleanse magic on party"; } }; SPELL_ACTION(CastExorcismAction, "exorcism"); @@ -639,8 +639,8 @@ namespace ai public: CastBlessingOfFreedomOnPartyAction(PlayerbotAI* ai) : CastSpellAction(ai, "blessing of freedom") {} bool isUseful() override { return CastSpellAction::isUseful() && !ai->HasAura(GetSpellName(), GetTarget()); } - string GetReachActionName() override { return "reach spell"; } - string GetTargetName() override { return "party member to remove roots"; } + std::string GetReachActionName() override { return "reach spell"; } + std::string GetTargetName() override { return "party member to remove roots"; } }; class CastBlessingOfProtectionOnPartyAction : public CastProtectSpellAction diff --git a/playerbot/strategy/paladin/PaladinAiObjectContext.cpp b/playerbot/strategy/paladin/PaladinAiObjectContext.cpp index ab173172..076d2df7 100644 --- a/playerbot/strategy/paladin/PaladinAiObjectContext.cpp +++ b/playerbot/strategy/paladin/PaladinAiObjectContext.cpp @@ -3,7 +3,7 @@ #include "PaladinActions.h" #include "PaladinTriggers.h" #include "PaladinAiObjectContext.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "HolyPaladinStrategy.h" #include "ProtectionPaladinStrategy.h" #include "RetributionPaladinStrategy.h" diff --git a/playerbot/strategy/paladin/PaladinAiObjectContext.h b/playerbot/strategy/paladin/PaladinAiObjectContext.h index 1889e537..d32fa5af 100644 --- a/playerbot/strategy/paladin/PaladinAiObjectContext.h +++ b/playerbot/strategy/paladin/PaladinAiObjectContext.h @@ -1,5 +1,5 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/paladin/PaladinStrategy.h b/playerbot/strategy/paladin/PaladinStrategy.h index ec1a3862..b2c32c29 100644 --- a/playerbot/strategy/paladin/PaladinStrategy.h +++ b/playerbot/strategy/paladin/PaladinStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { @@ -7,14 +7,14 @@ namespace ai { public: PaladinAuraPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "aura"; } + std::string getName() override { return "aura"; } }; class PaladinBlessingPlaceholderStrategy : public PlaceholderStrategy { public: PaladinBlessingPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "blessing"; } + std::string getName() override { return "blessing"; } }; class PaladinStrategy : public ClassStrategy @@ -325,7 +325,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitNonCombatTriggers(std::list& triggers) override; @@ -345,7 +345,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/paladin/PaladinTriggers.cpp b/playerbot/strategy/paladin/PaladinTriggers.cpp index 751ec3e4..1a54399e 100644 --- a/playerbot/strategy/paladin/PaladinTriggers.cpp +++ b/playerbot/strategy/paladin/PaladinTriggers.cpp @@ -22,8 +22,8 @@ bool BlessingTrigger::IsActive() Unit* target = GetTarget(); if (target) { - vector altBlessings; - vector haveBlessings; + std::vector altBlessings; + std::vector haveBlessings; altBlessings.push_back("blessing of might"); altBlessings.push_back("blessing of wisdom"); altBlessings.push_back("blessing of kings"); @@ -70,8 +70,8 @@ bool GreaterBlessingTrigger::IsActive() Unit* target = GetTarget(); if (target) { - vector altBlessings; - vector haveBlessings; + std::vector altBlessings; + std::vector haveBlessings; altBlessings.push_back("blessing of might"); altBlessings.push_back("blessing of wisdom"); altBlessings.push_back("blessing of kings"); @@ -110,8 +110,8 @@ bool GreaterBlessingTrigger::IsActive() bool BlessingOnPartyTrigger::IsActive() { - vector altBlessings; - vector haveBlessings; + std::vector altBlessings; + std::vector haveBlessings; altBlessings.push_back("blessing of might"); altBlessings.push_back("blessing of wisdom"); altBlessings.push_back("blessing of kings"); @@ -154,8 +154,8 @@ bool BlessingOnPartyTrigger::IsActive() bool GreaterBlessingOnPartyTrigger::IsActive() { - vector altBlessings; - vector haveBlessings; + std::vector altBlessings; + std::vector haveBlessings; altBlessings.push_back("blessing of might"); altBlessings.push_back("blessing of wisdom"); altBlessings.push_back("blessing of kings"); @@ -194,8 +194,8 @@ bool GreaterBlessingOnPartyTrigger::IsActive() bool NoPaladinAuraTrigger::IsActive() { - vector altAuras; - vector haveAuras; + std::vector altAuras; + std::vector haveAuras; altAuras.push_back("devotion aura"); altAuras.push_back("retribution aura"); altAuras.push_back("concentration aura"); diff --git a/playerbot/strategy/paladin/PaladinTriggers.h b/playerbot/strategy/paladin/PaladinTriggers.h index 4b391129..e94fa0c1 100644 --- a/playerbot/strategy/paladin/PaladinTriggers.h +++ b/playerbot/strategy/paladin/PaladinTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { diff --git a/playerbot/strategy/paladin/ProtectionPaladinStrategy.h b/playerbot/strategy/paladin/ProtectionPaladinStrategy.h index b2ef3d4e..9a5a3a6b 100644 --- a/playerbot/strategy/paladin/ProtectionPaladinStrategy.h +++ b/playerbot/strategy/paladin/ProtectionPaladinStrategy.h @@ -8,7 +8,7 @@ namespace ai public: ProtectionPaladinPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } - string getName() override { return "protection"; } + std::string getName() override { return "protection"; } }; class ProtectionPaladinStrategy : public PaladinStrategy @@ -78,7 +78,7 @@ namespace ai { public: ProtectionPaladinAoePveStrategy(PlayerbotAI* ai) : ProtectionPaladinAoeStrategy(ai) {} - string getName() override { return "aoe protection pve"; } + std::string getName() override { return "aoe protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: ProtectionPaladinAoePvpStrategy(PlayerbotAI* ai) : ProtectionPaladinAoeStrategy(ai) {} - string getName() override { return "aoe protection pvp"; } + std::string getName() override { return "aoe protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: ProtectionPaladinAoeRaidStrategy(PlayerbotAI* ai) : ProtectionPaladinAoeStrategy(ai) {} - string getName() override { return "aoe protection raid"; } + std::string getName() override { return "aoe protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: ProtectionPaladinBuffPveStrategy(PlayerbotAI* ai) : ProtectionPaladinBuffStrategy(ai) {} - string getName() override { return "buff protection pve"; } + std::string getName() override { return "buff protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: ProtectionPaladinBuffPvpStrategy(PlayerbotAI* ai) : ProtectionPaladinBuffStrategy(ai) {} - string getName() override { return "buff protection pvp"; } + std::string getName() override { return "buff protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: ProtectionPaladinBuffRaidStrategy(PlayerbotAI* ai) : ProtectionPaladinBuffStrategy(ai) {} - string getName() override { return "buff protection raid"; } + std::string getName() override { return "buff protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: ProtectionPaladinBoostPveStrategy(PlayerbotAI* ai) : ProtectionPaladinBoostStrategy(ai) {} - string getName() override { return "boost protection pve"; } + std::string getName() override { return "boost protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: ProtectionPaladinBoostPvpStrategy(PlayerbotAI* ai) : ProtectionPaladinBoostStrategy(ai) {} - string getName() override { return "boost protection pvp"; } + std::string getName() override { return "boost protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: ProtectionPaladinBoostRaidStrategy(PlayerbotAI* ai) : ProtectionPaladinBoostStrategy(ai) {} - string getName() override { return "boost protection raid"; } + std::string getName() override { return "boost protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: ProtectionPaladinCcPveStrategy(PlayerbotAI* ai) : ProtectionPaladinCcStrategy(ai) {} - string getName() override { return "cc protection pve"; } + std::string getName() override { return "cc protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: ProtectionPaladinCcPvpStrategy(PlayerbotAI* ai) : ProtectionPaladinCcStrategy(ai) {} - string getName() override { return "cc protection pvp"; } + std::string getName() override { return "cc protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: ProtectionPaladinCcRaidStrategy(PlayerbotAI* ai) : ProtectionPaladinCcStrategy(ai) {} - string getName() override { return "cc protection raid"; } + std::string getName() override { return "cc protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: ProtectionPaladinCurePveStrategy(PlayerbotAI* ai) : ProtectionPaladinCureStrategy(ai) {} - string getName() override { return "cure protection pve"; } + std::string getName() override { return "cure protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: ProtectionPaladinCurePvpStrategy(PlayerbotAI* ai) : ProtectionPaladinCureStrategy(ai) {} - string getName() override { return "cure protection pvp"; } + std::string getName() override { return "cure protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: ProtectionPaladinCureRaidStrategy(PlayerbotAI* ai) : ProtectionPaladinCureStrategy(ai) {} - string getName() override { return "cure protection raid"; } + std::string getName() override { return "cure protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -293,7 +293,7 @@ namespace ai { public: ProtectionPaladinAuraPveStrategy(PlayerbotAI* ai) : ProtectionPaladinAuraStrategy(ai) {} - string getName() override { return "aura protection pve"; } + std::string getName() override { return "aura protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -304,7 +304,7 @@ namespace ai { public: ProtectionPaladinAuraPvpStrategy(PlayerbotAI* ai) : ProtectionPaladinAuraStrategy(ai) {} - string getName() override { return "aura protection pvp"; } + std::string getName() override { return "aura protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -315,7 +315,7 @@ namespace ai { public: ProtectionPaladinAuraRaidStrategy(PlayerbotAI* ai) : ProtectionPaladinAuraStrategy(ai) {} - string getName() override { return "aura protection raid"; } + std::string getName() override { return "aura protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -336,7 +336,7 @@ namespace ai { public: ProtectionPaladinBlessingPveStrategy(PlayerbotAI* ai) : ProtectionPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing protection pve"; } + std::string getName() override { return "blessing protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -347,7 +347,7 @@ namespace ai { public: ProtectionPaladinBlessingPvpStrategy(PlayerbotAI* ai) : ProtectionPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing protection pvp"; } + std::string getName() override { return "blessing protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -358,7 +358,7 @@ namespace ai { public: ProtectionPaladinBlessingRaidStrategy(PlayerbotAI* ai) : ProtectionPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing protection raid"; } + std::string getName() override { return "blessing protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/paladin/RetributionPaladinStrategy.h b/playerbot/strategy/paladin/RetributionPaladinStrategy.h index 062fbb04..dc84da41 100644 --- a/playerbot/strategy/paladin/RetributionPaladinStrategy.h +++ b/playerbot/strategy/paladin/RetributionPaladinStrategy.h @@ -8,7 +8,7 @@ namespace ai public: RetributionPaladinPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "retribution"; } + std::string getName() override { return "retribution"; } }; class RetributionPaladinStrategy : public PaladinStrategy @@ -78,7 +78,7 @@ namespace ai { public: RetributionPaladinAoePveStrategy(PlayerbotAI* ai) : RetributionPaladinAoeStrategy(ai) {} - string getName() override { return "aoe retribution pve"; } + std::string getName() override { return "aoe retribution pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: RetributionPaladinAoePvpStrategy(PlayerbotAI* ai) : RetributionPaladinAoeStrategy(ai) {} - string getName() override { return "aoe retribution pvp"; } + std::string getName() override { return "aoe retribution pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: RetributionPaladinAoeRaidStrategy(PlayerbotAI* ai) : RetributionPaladinAoeStrategy(ai) {} - string getName() override { return "aoe retribution raid"; } + std::string getName() override { return "aoe retribution raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: RetributionPaladinBuffPveStrategy(PlayerbotAI* ai) : RetributionPaladinBuffStrategy(ai) {} - string getName() override { return "buff retribution pve"; } + std::string getName() override { return "buff retribution pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: RetributionPaladinBuffPvpStrategy(PlayerbotAI* ai) : RetributionPaladinBuffStrategy(ai) {} - string getName() override { return "buff retribution pvp"; } + std::string getName() override { return "buff retribution pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: RetributionPaladinBuffRaidStrategy(PlayerbotAI* ai) : RetributionPaladinBuffStrategy(ai) {} - string getName() override { return "buff retribution raid"; } + std::string getName() override { return "buff retribution raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: RetributionPaladinBoostPveStrategy(PlayerbotAI* ai) : RetributionPaladinBoostStrategy(ai) {} - string getName() override { return "boost retribution pve"; } + std::string getName() override { return "boost retribution pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: RetributionPaladinBoostPvpStrategy(PlayerbotAI* ai) : RetributionPaladinBoostStrategy(ai) {} - string getName() override { return "boost retribution pvp"; } + std::string getName() override { return "boost retribution pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: RetributionPaladinBoostRaidStrategy(PlayerbotAI* ai) : RetributionPaladinBoostStrategy(ai) {} - string getName() override { return "boost retribution raid"; } + std::string getName() override { return "boost retribution raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: RetributionPaladinCcPveStrategy(PlayerbotAI* ai) : RetributionPaladinCcStrategy(ai) {} - string getName() override { return "cc retribution pve"; } + std::string getName() override { return "cc retribution pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: RetributionPaladinCcPvpStrategy(PlayerbotAI* ai) : RetributionPaladinCcStrategy(ai) {} - string getName() override { return "cc retribution pvp"; } + std::string getName() override { return "cc retribution pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: RetributionPaladinCcRaidStrategy(PlayerbotAI* ai) : RetributionPaladinCcStrategy(ai) {} - string getName() override { return "cc retribution raid"; } + std::string getName() override { return "cc retribution raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: RetributionPaladinCurePveStrategy(PlayerbotAI* ai) : RetributionPaladinCureStrategy(ai) {} - string getName() override { return "cure retribution pve"; } + std::string getName() override { return "cure retribution pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: RetributionPaladinCurePvpStrategy(PlayerbotAI* ai) : RetributionPaladinCureStrategy(ai) {} - string getName() override { return "cure retribution pvp"; } + std::string getName() override { return "cure retribution pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: RetributionPaladinCureRaidStrategy(PlayerbotAI* ai) : RetributionPaladinCureStrategy(ai) {} - string getName() override { return "cure retribution raid"; } + std::string getName() override { return "cure retribution raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -293,7 +293,7 @@ namespace ai { public: RetributionPaladinAuraPveStrategy(PlayerbotAI* ai) : RetributionPaladinAuraStrategy(ai) {} - string getName() override { return "aura retribution pve"; } + std::string getName() override { return "aura retribution pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -304,7 +304,7 @@ namespace ai { public: RetributionPaladinAuraPvpStrategy(PlayerbotAI* ai) : RetributionPaladinAuraStrategy(ai) {} - string getName() override { return "aura retribution pvp"; } + std::string getName() override { return "aura retribution pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -315,7 +315,7 @@ namespace ai { public: RetributionPaladinAuraRaidStrategy(PlayerbotAI* ai) : RetributionPaladinAuraStrategy(ai) {} - string getName() override { return "aura retribution raid"; } + std::string getName() override { return "aura retribution raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -336,7 +336,7 @@ namespace ai { public: RetributionPaladinBlessingPveStrategy(PlayerbotAI* ai) : RetributionPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing retribution pve"; } + std::string getName() override { return "blessing retribution pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -347,7 +347,7 @@ namespace ai { public: RetributionPaladinBlessingPvpStrategy(PlayerbotAI* ai) : RetributionPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing retribution pvp"; } + std::string getName() override { return "blessing retribution pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -358,7 +358,7 @@ namespace ai { public: RetributionPaladinBlessingRaidStrategy(PlayerbotAI* ai) : RetributionPaladinBlessingStrategy(ai) {} - string getName() override { return "blessing retribution raid"; } + std::string getName() override { return "blessing retribution raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/priest/GenericPriestStrategy.h b/playerbot/strategy/priest/GenericPriestStrategy.h index 666bece3..e439bc34 100644 --- a/playerbot/strategy/priest/GenericPriestStrategy.h +++ b/playerbot/strategy/priest/GenericPriestStrategy.h @@ -1,6 +1,6 @@ #pragma once -#include "../Strategy.h" -#include "../generic/CombatStrategy.h" +#include "playerbot/strategy/Strategy.h" +#include "playerbot/strategy/generic/CombatStrategy.h" namespace ai { @@ -17,7 +17,7 @@ namespace ai { public: PriestCureStrategy(PlayerbotAI* ai); - string getName() override { return "cure"; } + std::string getName() override { return "cure"; } private: void InitCombatTriggers(std::list &triggers) override; @@ -28,7 +28,7 @@ namespace ai { public: PriestBoostStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "boost"; } + std::string getName() override { return "boost"; } private: void InitCombatTriggers(std::list &triggers) override; @@ -38,7 +38,7 @@ namespace ai { public: PriestCcStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "cc"; } + std::string getName() override { return "cc"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/priest/HealPriestStrategy.h b/playerbot/strategy/priest/HealPriestStrategy.h index b0f39e67..39aa57ff 100644 --- a/playerbot/strategy/priest/HealPriestStrategy.h +++ b/playerbot/strategy/priest/HealPriestStrategy.h @@ -8,7 +8,7 @@ namespace ai { public: HealPriestStrategy(PlayerbotAI* ai); - virtual string getName() override { return "heal"; } + virtual std::string getName() override { return "heal"; } virtual int GetType() override { return STRATEGY_TYPE_HEAL; } protected: diff --git a/playerbot/strategy/priest/HolyPriestStrategy.h b/playerbot/strategy/priest/HolyPriestStrategy.h index 5998456d..c9c1e373 100644 --- a/playerbot/strategy/priest/HolyPriestStrategy.h +++ b/playerbot/strategy/priest/HolyPriestStrategy.h @@ -8,7 +8,7 @@ namespace ai { public: HolyPriestStrategy(PlayerbotAI* ai); - string getName() override { return "holy"; } + std::string getName() override { return "holy"; } int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } private: diff --git a/playerbot/strategy/priest/PriestAiObjectContext.cpp b/playerbot/strategy/priest/PriestAiObjectContext.cpp index 47cd30fe..2af2fd4c 100644 --- a/playerbot/strategy/priest/PriestAiObjectContext.cpp +++ b/playerbot/strategy/priest/PriestAiObjectContext.cpp @@ -5,9 +5,9 @@ #include "PriestNonCombatStrategy.h" #include "PriestReactionStrategy.h" #include "ShadowPriestStrategy.h" -#include "../generic/PullStrategy.h" +#include "playerbot/strategy/generic/PullStrategy.h" #include "PriestTriggers.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "HolyPriestStrategy.h" using namespace ai; diff --git a/playerbot/strategy/priest/PriestAiObjectContext.h b/playerbot/strategy/priest/PriestAiObjectContext.h index 315c3353..8e5863ee 100644 --- a/playerbot/strategy/priest/PriestAiObjectContext.h +++ b/playerbot/strategy/priest/PriestAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/priest/PriestNonCombatStrategy.h b/playerbot/strategy/priest/PriestNonCombatStrategy.h index 5f045c0f..4dc6a79d 100644 --- a/playerbot/strategy/priest/PriestNonCombatStrategy.h +++ b/playerbot/strategy/priest/PriestNonCombatStrategy.h @@ -1,7 +1,7 @@ #pragma once -#include "../Strategy.h" -#include "../generic/NonCombatStrategy.h" +#include "playerbot/strategy/Strategy.h" +#include "playerbot/strategy/generic/NonCombatStrategy.h" namespace ai { @@ -9,7 +9,7 @@ namespace ai { public: PriestNonCombatStrategy(PlayerbotAI* ai); - string getName() override { return "nc"; } + std::string getName() override { return "nc"; } private: void InitNonCombatTriggers(std::list &triggers) override; @@ -19,7 +19,7 @@ namespace ai { public: PriestBuffStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "buff"; } + std::string getName() override { return "buff"; } private: void InitNonCombatTriggers(std::list &triggers) override; @@ -29,7 +29,7 @@ namespace ai { public: PriestShadowResistanceStrategy(PlayerbotAI* ai) : NonCombatStrategy(ai) {} - string getName() override { return "rshadow"; } + std::string getName() override { return "rshadow"; } private: void InitNonCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/priest/PriestReactionStrategy.h b/playerbot/strategy/priest/PriestReactionStrategy.h index c88ba15a..e9fc2ba7 100644 --- a/playerbot/strategy/priest/PriestReactionStrategy.h +++ b/playerbot/strategy/priest/PriestReactionStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ReactionStrategy.h" +#include "playerbot/strategy/generic/ReactionStrategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: PriestReactionStrategy(PlayerbotAI* ai) : ReactionStrategy(ai) {} - string getName() override { return "react"; } + std::string getName() override { return "react"; } private: void InitReactionTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/priest/PriestTriggers.h b/playerbot/strategy/priest/PriestTriggers.h index be3aef79..ed975880 100644 --- a/playerbot/strategy/priest/PriestTriggers.h +++ b/playerbot/strategy/priest/PriestTriggers.h @@ -1,6 +1,6 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { diff --git a/playerbot/strategy/priest/ShadowPriestStrategy.h b/playerbot/strategy/priest/ShadowPriestStrategy.h index 6843a782..922b73ca 100644 --- a/playerbot/strategy/priest/ShadowPriestStrategy.h +++ b/playerbot/strategy/priest/ShadowPriestStrategy.h @@ -8,7 +8,7 @@ namespace ai { public: ShadowPriestStrategy(PlayerbotAI* ai); - string getName() override { return "shadow"; } + std::string getName() override { return "shadow"; } int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } private: @@ -20,7 +20,7 @@ namespace ai { public: ShadowPriestAoeStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {} - string getName() override { return "shadow aoe"; } + std::string getName() override { return "shadow aoe"; } private: void InitCombatTriggers(std::list &triggers) override; @@ -30,7 +30,7 @@ namespace ai { public: ShadowPriestDebuffStrategy(PlayerbotAI* ai) : CombatStrategy(ai) {} - string getName() override { return "shadow debuff"; } + std::string getName() override { return "shadow debuff"; } private: void InitCombatTriggers(std::list &triggers) override; diff --git a/playerbot/strategy/rogue/AssassinationRogueStrategy.h b/playerbot/strategy/rogue/AssassinationRogueStrategy.h index e6c5c863..96963f36 100644 --- a/playerbot/strategy/rogue/AssassinationRogueStrategy.h +++ b/playerbot/strategy/rogue/AssassinationRogueStrategy.h @@ -8,7 +8,7 @@ namespace ai public: AssassinationRoguePlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "assassination"; } + std::string getName() override { return "assassination"; } }; class AssassinationRogueStrategy : public RogueStrategy @@ -76,7 +76,7 @@ namespace ai { public: AssassinationRogueAoePveStrategy(PlayerbotAI* ai) : AssassinationRogueAoeStrategy(ai) {} - string getName() override { return "aoe assassination pve"; } + std::string getName() override { return "aoe assassination pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: AssassinationRogueAoePvpStrategy(PlayerbotAI* ai) : AssassinationRogueAoeStrategy(ai) {} - string getName() override { return "aoe assassination pvp"; } + std::string getName() override { return "aoe assassination pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: AssassinationRogueAoeRaidStrategy(PlayerbotAI* ai) : AssassinationRogueAoeStrategy(ai) {} - string getName() override { return "aoe assassination raid"; } + std::string getName() override { return "aoe assassination raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: AssassinationRogueBuffPveStrategy(PlayerbotAI* ai) : AssassinationRogueBuffStrategy(ai) {} - string getName() override { return "buff assassination pve"; } + std::string getName() override { return "buff assassination pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: AssassinationRogueBuffPvpStrategy(PlayerbotAI* ai) : AssassinationRogueBuffStrategy(ai) {} - string getName() override { return "buff assassination pvp"; } + std::string getName() override { return "buff assassination pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: AssassinationRogueBuffRaidStrategy(PlayerbotAI* ai) : AssassinationRogueBuffStrategy(ai) {} - string getName() override { return "buff assassination raid"; } + std::string getName() override { return "buff assassination raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: AssassinationRogueBoostPveStrategy(PlayerbotAI* ai) : AssassinationRogueBoostStrategy(ai) {} - string getName() override { return "boost assassination pve"; } + std::string getName() override { return "boost assassination pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: AssassinationRogueBoostPvpStrategy(PlayerbotAI* ai) : AssassinationRogueBoostStrategy(ai) {} - string getName() override { return "boost assassination pvp"; } + std::string getName() override { return "boost assassination pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: AssassinationRogueBoostRaidStrategy(PlayerbotAI* ai) : AssassinationRogueBoostStrategy(ai) {} - string getName() override { return "boost assassination raid"; } + std::string getName() override { return "boost assassination raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: AssassinationRogueCcPveStrategy(PlayerbotAI* ai) : AssassinationRogueCcStrategy(ai) {} - string getName() override { return "cc assassination pve"; } + std::string getName() override { return "cc assassination pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: AssassinationRogueCcPvpStrategy(PlayerbotAI* ai) : AssassinationRogueCcStrategy(ai) {} - string getName() override { return "cc assassination pvp"; } + std::string getName() override { return "cc assassination pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: AssassinationRogueCcRaidStrategy(PlayerbotAI* ai) : AssassinationRogueCcStrategy(ai) {} - string getName() override { return "cc assassination raid"; } + std::string getName() override { return "cc assassination raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -248,7 +248,7 @@ namespace ai { public: AssassinationRogueStealthPveStrategy(PlayerbotAI* ai) : AssassinationRogueStealthStrategy(ai) {} - string getName() override { return "stealth assassination pve"; } + std::string getName() override { return "stealth assassination pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -259,7 +259,7 @@ namespace ai { public: AssassinationRogueStealthPvpStrategy(PlayerbotAI* ai) : AssassinationRogueStealthStrategy(ai) {} - string getName() override { return "stealth assassination pvp"; } + std::string getName() override { return "stealth assassination pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -270,7 +270,7 @@ namespace ai { public: AssassinationRogueStealthRaidStrategy(PlayerbotAI* ai) : AssassinationRogueStealthStrategy(ai) {} - string getName() override { return "stealth assassination raid"; } + std::string getName() override { return "stealth assassination raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -291,7 +291,7 @@ namespace ai { public: AssassinationRoguePoisonsPveStrategy(PlayerbotAI* ai) : AssassinationRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons assassination pve"; } + std::string getName() override { return "poisons assassination pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: AssassinationRoguePoisonsPvpStrategy(PlayerbotAI* ai) : AssassinationRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons assassination pvp"; } + std::string getName() override { return "poisons assassination pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -313,7 +313,7 @@ namespace ai { public: AssassinationRoguePoisonsRaidStrategy(PlayerbotAI* ai) : AssassinationRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons assassination raid"; } + std::string getName() override { return "poisons assassination raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/rogue/CombatRogueStrategy.h b/playerbot/strategy/rogue/CombatRogueStrategy.h index 508502a0..50845e20 100644 --- a/playerbot/strategy/rogue/CombatRogueStrategy.h +++ b/playerbot/strategy/rogue/CombatRogueStrategy.h @@ -8,7 +8,7 @@ namespace ai public: CombatRoguePlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "combat"; } + std::string getName() override { return "combat"; } }; class CombatRogueStrategy : public RogueStrategy @@ -76,7 +76,7 @@ namespace ai { public: CombatRogueAoePveStrategy(PlayerbotAI* ai) : CombatRogueAoeStrategy(ai) {} - string getName() override { return "aoe combat pve"; } + std::string getName() override { return "aoe combat pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: CombatRogueAoePvpStrategy(PlayerbotAI* ai) : CombatRogueAoeStrategy(ai) {} - string getName() override { return "aoe combat pvp"; } + std::string getName() override { return "aoe combat pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: CombatRogueAoeRaidStrategy(PlayerbotAI* ai) : CombatRogueAoeStrategy(ai) {} - string getName() override { return "aoe combat raid"; } + std::string getName() override { return "aoe combat raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: CombatRogueBuffPveStrategy(PlayerbotAI* ai) : CombatRogueBuffStrategy(ai) {} - string getName() override { return "buff combat pve"; } + std::string getName() override { return "buff combat pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: CombatRogueBuffPvpStrategy(PlayerbotAI* ai) : CombatRogueBuffStrategy(ai) {} - string getName() override { return "buff combat pvp"; } + std::string getName() override { return "buff combat pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: CombatRogueBuffRaidStrategy(PlayerbotAI* ai) : CombatRogueBuffStrategy(ai) {} - string getName() override { return "buff combat raid"; } + std::string getName() override { return "buff combat raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: CombatRogueBoostPveStrategy(PlayerbotAI* ai) : CombatRogueBoostStrategy(ai) {} - string getName() override { return "boost combat pve"; } + std::string getName() override { return "boost combat pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: CombatRogueBoostPvpStrategy(PlayerbotAI* ai) : CombatRogueBoostStrategy(ai) {} - string getName() override { return "boost combat pvp"; } + std::string getName() override { return "boost combat pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: CombatRogueBoostRaidStrategy(PlayerbotAI* ai) : CombatRogueBoostStrategy(ai) {} - string getName() override { return "boost combat raid"; } + std::string getName() override { return "boost combat raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: CombatRogueCcPveStrategy(PlayerbotAI* ai) : CombatRogueCcStrategy(ai) {} - string getName() override { return "cc combat pve"; } + std::string getName() override { return "cc combat pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: CombatRogueCcPvpStrategy(PlayerbotAI* ai) : CombatRogueCcStrategy(ai) {} - string getName() override { return "cc combat pvp"; } + std::string getName() override { return "cc combat pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: CombatRogueCcRaidStrategy(PlayerbotAI* ai) : CombatRogueCcStrategy(ai) {} - string getName() override { return "cc combat raid"; } + std::string getName() override { return "cc combat raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -248,7 +248,7 @@ namespace ai { public: CombatRogueStealthPveStrategy(PlayerbotAI* ai) : CombatRogueStealthStrategy(ai) {} - string getName() override { return "stealth combat pve"; } + std::string getName() override { return "stealth combat pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -259,7 +259,7 @@ namespace ai { public: CombatRogueStealthPvpStrategy(PlayerbotAI* ai) : CombatRogueStealthStrategy(ai) {} - string getName() override { return "stealth combat pvp"; } + std::string getName() override { return "stealth combat pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -270,7 +270,7 @@ namespace ai { public: CombatRogueStealthRaidStrategy(PlayerbotAI* ai) : CombatRogueStealthStrategy(ai) {} - string getName() override { return "stealth combat raid"; } + std::string getName() override { return "stealth combat raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -291,7 +291,7 @@ namespace ai { public: CombatRoguePoisonsPveStrategy(PlayerbotAI* ai) : CombatRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons combat pve"; } + std::string getName() override { return "poisons combat pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: CombatRoguePoisonsPvpStrategy(PlayerbotAI* ai) : CombatRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons combat pvp"; } + std::string getName() override { return "poisons combat pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -313,7 +313,7 @@ namespace ai { public: CombatRoguePoisonsRaidStrategy(PlayerbotAI* ai) : CombatRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons combat raid"; } + std::string getName() override { return "poisons combat raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/rogue/RogueActions.h b/playerbot/strategy/rogue/RogueActions.h index c44d16ad..f3edb4c1 100644 --- a/playerbot/strategy/rogue/RogueActions.h +++ b/playerbot/strategy/rogue/RogueActions.h @@ -36,7 +36,7 @@ namespace ai { public: CastSprintAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "sprint") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } }; class CastStealthAction : public CastBuffSpellAction @@ -44,7 +44,7 @@ namespace ai public: CastStealthAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "stealth") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } virtual bool isUseful() { @@ -204,7 +204,7 @@ namespace ai } private: - string GetReachActionName() override { return "reach melee"; } + std::string GetReachActionName() override { return "reach melee"; } }; class CastTricksOfTheTradeOnPartyAction : public BuffOnPartyAction @@ -283,7 +283,7 @@ namespace ai class CastComboAction : public CastMeleeSpellAction { public: - CastComboAction(PlayerbotAI* ai, string name) : CastMeleeSpellAction(ai, name) {} + CastComboAction(PlayerbotAI* ai, std::string name) : CastMeleeSpellAction(ai, name) {} virtual bool isUseful() { diff --git a/playerbot/strategy/rogue/RogueAiObjectContext.cpp b/playerbot/strategy/rogue/RogueAiObjectContext.cpp index 7d4f2adc..d247dfae 100644 --- a/playerbot/strategy/rogue/RogueAiObjectContext.cpp +++ b/playerbot/strategy/rogue/RogueAiObjectContext.cpp @@ -3,8 +3,8 @@ #include "RogueActions.h" #include "RogueTriggers.h" #include "RogueAiObjectContext.h" -#include "../generic/PullStrategy.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/generic/PullStrategy.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "CombatRogueStrategy.h" #include "AssassinationRogueStrategy.h" #include "SubtletyRogueStrategy.h" diff --git a/playerbot/strategy/rogue/RogueAiObjectContext.h b/playerbot/strategy/rogue/RogueAiObjectContext.h index ba346266..7f599fa6 100644 --- a/playerbot/strategy/rogue/RogueAiObjectContext.h +++ b/playerbot/strategy/rogue/RogueAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/rogue/RogueStrategy.h b/playerbot/strategy/rogue/RogueStrategy.h index 5b3e210c..867214f2 100644 --- a/playerbot/strategy/rogue/RogueStrategy.h +++ b/playerbot/strategy/rogue/RogueStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: RoguePoisonsPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "poisons"; } + std::string getName() override { return "poisons"; } }; class RogueStrategy : public ClassStrategy @@ -246,7 +246,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitNonCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/rogue/RogueTriggers.h b/playerbot/strategy/rogue/RogueTriggers.h index 7b578ab3..e4a97283 100644 --- a/playerbot/strategy/rogue/RogueTriggers.h +++ b/playerbot/strategy/rogue/RogueTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { @@ -20,7 +20,7 @@ namespace ai class RogueBoostBuffTrigger : public BoostTrigger { public: - RogueBoostBuffTrigger(PlayerbotAI* ai, string spellName) : BoostTrigger(ai, spellName, 200.0f) {} + RogueBoostBuffTrigger(PlayerbotAI* ai, std::string spellName) : BoostTrigger(ai, spellName, 200.0f) {} virtual bool IsPossible() { return !ai->HasAura("stealth", bot); } }; diff --git a/playerbot/strategy/rogue/SubtletyRogueStrategy.h b/playerbot/strategy/rogue/SubtletyRogueStrategy.h index 70f36afc..7d111a80 100644 --- a/playerbot/strategy/rogue/SubtletyRogueStrategy.h +++ b/playerbot/strategy/rogue/SubtletyRogueStrategy.h @@ -8,7 +8,7 @@ namespace ai public: SubtletyRoguePlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "subtlety"; } + std::string getName() override { return "subtlety"; } }; class SubtletyRogueStrategy : public RogueStrategy @@ -76,7 +76,7 @@ namespace ai { public: SubtletyRogueAoePveStrategy(PlayerbotAI* ai) : SubtletyRogueAoeStrategy(ai) {} - string getName() override { return "aoe subtlety pve"; } + std::string getName() override { return "aoe subtlety pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: SubtletyRogueAoePvpStrategy(PlayerbotAI* ai) : SubtletyRogueAoeStrategy(ai) {} - string getName() override { return "aoe subtlety pvp"; } + std::string getName() override { return "aoe subtlety pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: SubtletyRogueAoeRaidStrategy(PlayerbotAI* ai) : SubtletyRogueAoeStrategy(ai) {} - string getName() override { return "aoe subtlety raid"; } + std::string getName() override { return "aoe subtlety raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: SubtletyRogueBuffPveStrategy(PlayerbotAI* ai) : SubtletyRogueBuffStrategy(ai) {} - string getName() override { return "buff subtlety pve"; } + std::string getName() override { return "buff subtlety pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: SubtletyRogueBuffPvpStrategy(PlayerbotAI* ai) : SubtletyRogueBuffStrategy(ai) {} - string getName() override { return "buff subtlety pvp"; } + std::string getName() override { return "buff subtlety pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: SubtletyRogueBuffRaidStrategy(PlayerbotAI* ai) : SubtletyRogueBuffStrategy(ai) {} - string getName() override { return "buff subtlety raid"; } + std::string getName() override { return "buff subtlety raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: SubtletyRogueBoostPveStrategy(PlayerbotAI* ai) : SubtletyRogueBoostStrategy(ai) {} - string getName() override { return "boost subtlety pve"; } + std::string getName() override { return "boost subtlety pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: SubtletyRogueBoostPvpStrategy(PlayerbotAI* ai) : SubtletyRogueBoostStrategy(ai) {} - string getName() override { return "boost subtlety pvp"; } + std::string getName() override { return "boost subtlety pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: SubtletyRogueBoostRaidStrategy(PlayerbotAI* ai) : SubtletyRogueBoostStrategy(ai) {} - string getName() override { return "boost subtlety raid"; } + std::string getName() override { return "boost subtlety raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: SubtletyRogueCcPveStrategy(PlayerbotAI* ai) : SubtletyRogueCcStrategy(ai) {} - string getName() override { return "cc subtlety pve"; } + std::string getName() override { return "cc subtlety pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: SubtletyRogueCcPvpStrategy(PlayerbotAI* ai) : SubtletyRogueCcStrategy(ai) {} - string getName() override { return "cc subtlety pvp"; } + std::string getName() override { return "cc subtlety pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: SubtletyRogueCcRaidStrategy(PlayerbotAI* ai) : SubtletyRogueCcStrategy(ai) {} - string getName() override { return "cc subtlety raid"; } + std::string getName() override { return "cc subtlety raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -248,7 +248,7 @@ namespace ai { public: SubtletyRogueStealthPveStrategy(PlayerbotAI* ai) : SubtletyRogueStealthStrategy(ai) {} - string getName() override { return "stealth subtlety pve"; } + std::string getName() override { return "stealth subtlety pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -259,7 +259,7 @@ namespace ai { public: SubtletyRogueStealthPvpStrategy(PlayerbotAI* ai) : SubtletyRogueStealthStrategy(ai) {} - string getName() override { return "stealth subtlety pvp"; } + std::string getName() override { return "stealth subtlety pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -270,7 +270,7 @@ namespace ai { public: SubtletyRogueStealthRaidStrategy(PlayerbotAI* ai) : SubtletyRogueStealthStrategy(ai) {} - string getName() override { return "stealth subtlety raid"; } + std::string getName() override { return "stealth subtlety raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -291,7 +291,7 @@ namespace ai { public: SubtletyRoguePoisonsPveStrategy(PlayerbotAI* ai) : SubtletyRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons subtlety pve"; } + std::string getName() override { return "poisons subtlety pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: SubtletyRoguePoisonsPvpStrategy(PlayerbotAI* ai) : SubtletyRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons subtlety pvp"; } + std::string getName() override { return "poisons subtlety pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -313,7 +313,7 @@ namespace ai { public: SubtletyRoguePoisonsRaidStrategy(PlayerbotAI* ai) : SubtletyRoguePoisonsStrategy(ai) {} - string getName() override { return "poisons subtlety raid"; } + std::string getName() override { return "poisons subtlety raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/shaman/ElementalShamanStrategy.h b/playerbot/strategy/shaman/ElementalShamanStrategy.h index 5b16fb14..698b8701 100644 --- a/playerbot/strategy/shaman/ElementalShamanStrategy.h +++ b/playerbot/strategy/shaman/ElementalShamanStrategy.h @@ -8,7 +8,7 @@ namespace ai public: ElementalShamanPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "elemental"; } + std::string getName() override { return "elemental"; } }; class ElementalShamanStrategy : public ShamanStrategy @@ -78,7 +78,7 @@ namespace ai { public: ElementalShamanAoePveStrategy(PlayerbotAI* ai) : ElementalShamanAoeStrategy(ai) {} - string getName() override { return "aoe elemental pve"; } + std::string getName() override { return "aoe elemental pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: ElementalShamanAoePvpStrategy(PlayerbotAI* ai) : ElementalShamanAoeStrategy(ai) {} - string getName() override { return "aoe elemental pvp"; } + std::string getName() override { return "aoe elemental pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: ElementalShamanAoeRaidStrategy(PlayerbotAI* ai) : ElementalShamanAoeStrategy(ai) {} - string getName() override { return "aoe elemental raid"; } + std::string getName() override { return "aoe elemental raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: ElementalShamanCcPveStrategy(PlayerbotAI* ai) : ElementalShamanCcStrategy(ai) {} - string getName() override { return "cc elemental pve"; } + std::string getName() override { return "cc elemental pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: ElementalShamanCcPvpStrategy(PlayerbotAI* ai) : ElementalShamanCcStrategy(ai) {} - string getName() override { return "cc elemental pvp"; } + std::string getName() override { return "cc elemental pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: ElementalShamanCcRaidStrategy(PlayerbotAI* ai) : ElementalShamanCcStrategy(ai) {} - string getName() override { return "cc elemental raid"; } + std::string getName() override { return "cc elemental raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: ElementalShamanCurePveStrategy(PlayerbotAI* ai) : ElementalShamanCureStrategy(ai) {} - string getName() override { return "cure elemental pve"; } + std::string getName() override { return "cure elemental pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: ElementalShamanCurePvpStrategy(PlayerbotAI* ai) : ElementalShamanCureStrategy(ai) {} - string getName() override { return "cure elemental pvp"; } + std::string getName() override { return "cure elemental pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: ElementalShamanCureRaidStrategy(PlayerbotAI* ai) : ElementalShamanCureStrategy(ai) {} - string getName() override { return "cure elemental raid"; } + std::string getName() override { return "cure elemental raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: ElementalShamanTotemsPveStrategy(PlayerbotAI* ai) : ElementalShamanTotemsStrategy(ai) {} - string getName() override { return "totems elemental pve"; } + std::string getName() override { return "totems elemental pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: ElementalShamanTotemsPvpStrategy(PlayerbotAI* ai) : ElementalShamanTotemsStrategy(ai) {} - string getName() override { return "totems elemental pvp"; } + std::string getName() override { return "totems elemental pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: ElementalShamanTotemsRaidStrategy(PlayerbotAI* ai) : ElementalShamanTotemsStrategy(ai) {} - string getName() override { return "totems elemental raid"; } + std::string getName() override { return "totems elemental raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: ElementalShamanBuffPveStrategy(PlayerbotAI* ai) : ElementalShamanBuffStrategy(ai) {} - string getName() override { return "buff elemental pve"; } + std::string getName() override { return "buff elemental pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: ElementalShamanBuffPvpStrategy(PlayerbotAI* ai) : ElementalShamanBuffStrategy(ai) {} - string getName() override { return "buff elemental pvp"; } + std::string getName() override { return "buff elemental pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: ElementalShamanBuffRaidStrategy(PlayerbotAI* ai) : ElementalShamanBuffStrategy(ai) {} - string getName() override { return "buff elemental raid"; } + std::string getName() override { return "buff elemental raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -293,7 +293,7 @@ namespace ai { public: ElementalShamanBoostPveStrategy(PlayerbotAI* ai) : ElementalShamanBoostStrategy(ai) {} - string getName() override { return "boost elemental pve"; } + std::string getName() override { return "boost elemental pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -304,7 +304,7 @@ namespace ai { public: ElementalShamanBoostPvpStrategy(PlayerbotAI* ai) : ElementalShamanBoostStrategy(ai) {} - string getName() override { return "boost elemental pvp"; } + std::string getName() override { return "boost elemental pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -315,7 +315,7 @@ namespace ai { public: ElementalShamanBoostRaidStrategy(PlayerbotAI* ai) : ElementalShamanBoostStrategy(ai) {} - string getName() override { return "boost elemental raid"; } + std::string getName() override { return "boost elemental raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/shaman/EnhancementShamanStrategy.h b/playerbot/strategy/shaman/EnhancementShamanStrategy.h index 06fea713..9863b87f 100644 --- a/playerbot/strategy/shaman/EnhancementShamanStrategy.h +++ b/playerbot/strategy/shaman/EnhancementShamanStrategy.h @@ -8,7 +8,7 @@ namespace ai public: EnhancementShamanPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "enhancement"; } + std::string getName() override { return "enhancement"; } }; class EnhancementShamanStrategy : public ShamanStrategy @@ -78,7 +78,7 @@ namespace ai { public: EnhancementShamanAoePveStrategy(PlayerbotAI* ai) : EnhancementShamanAoeStrategy(ai) {} - string getName() override { return "aoe enhancement pve"; } + std::string getName() override { return "aoe enhancement pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: EnhancementShamanAoePvpStrategy(PlayerbotAI* ai) : EnhancementShamanAoeStrategy(ai) {} - string getName() override { return "aoe enhancement pvp"; } + std::string getName() override { return "aoe enhancement pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: EnhancementShamanAoeRaidStrategy(PlayerbotAI* ai) : EnhancementShamanAoeStrategy(ai) {} - string getName() override { return "aoe enhancement raid"; } + std::string getName() override { return "aoe enhancement raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: EnhancementShamanCcPveStrategy(PlayerbotAI* ai) : EnhancementShamanCcStrategy(ai) {} - string getName() override { return "cc enhancement pve"; } + std::string getName() override { return "cc enhancement pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: EnhancementShamanCcPvpStrategy(PlayerbotAI* ai) : EnhancementShamanCcStrategy(ai) {} - string getName() override { return "cc enhancement pvp"; } + std::string getName() override { return "cc enhancement pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: EnhancementShamanCcRaidStrategy(PlayerbotAI* ai) : EnhancementShamanCcStrategy(ai) {} - string getName() override { return "cc enhancement raid"; } + std::string getName() override { return "cc enhancement raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: EnhancementShamanCurePveStrategy(PlayerbotAI* ai) : EnhancementShamanCureStrategy(ai) {} - string getName() override { return "cure enhancement pve"; } + std::string getName() override { return "cure enhancement pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: EnhancementShamanCurePvpStrategy(PlayerbotAI* ai) : EnhancementShamanCureStrategy(ai) {} - string getName() override { return "cure enhancement pvp"; } + std::string getName() override { return "cure enhancement pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: EnhancementShamanCureRaidStrategy(PlayerbotAI* ai) : EnhancementShamanCureStrategy(ai) {} - string getName() override { return "cure enhancement raid"; } + std::string getName() override { return "cure enhancement raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: EnhancementShamanTotemsPveStrategy(PlayerbotAI* ai) : EnhancementShamanTotemsStrategy(ai) {} - string getName() override { return "totems enhancement pve"; } + std::string getName() override { return "totems enhancement pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: EnhancementShamanTotemsPvpStrategy(PlayerbotAI* ai) : EnhancementShamanTotemsStrategy(ai) {} - string getName() override { return "totems enhancement pvp"; } + std::string getName() override { return "totems enhancement pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: EnhancementShamanTotemsRaidStrategy(PlayerbotAI* ai) : EnhancementShamanTotemsStrategy(ai) {} - string getName() override { return "totems enhancement raid"; } + std::string getName() override { return "totems enhancement raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: EnhancementShamanBuffPveStrategy(PlayerbotAI* ai) : EnhancementShamanBuffStrategy(ai) {} - string getName() override { return "buff enhancement pve"; } + std::string getName() override { return "buff enhancement pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: EnhancementShamanBuffPvpStrategy(PlayerbotAI* ai) : EnhancementShamanBuffStrategy(ai) {} - string getName() override { return "buff enhancement pvp"; } + std::string getName() override { return "buff enhancement pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: EnhancementShamanBuffRaidStrategy(PlayerbotAI* ai) : EnhancementShamanBuffStrategy(ai) {} - string getName() override { return "buff enhancement raid"; } + std::string getName() override { return "buff enhancement raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -293,7 +293,7 @@ namespace ai { public: EnhancementShamanBoostPveStrategy(PlayerbotAI* ai) : EnhancementShamanBoostStrategy(ai) {} - string getName() override { return "boost enhancement pve"; } + std::string getName() override { return "boost enhancement pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -304,7 +304,7 @@ namespace ai { public: EnhancementShamanBoostPvpStrategy(PlayerbotAI* ai) : EnhancementShamanBoostStrategy(ai) {} - string getName() override { return "boost enhancement pvp"; } + std::string getName() override { return "boost enhancement pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -315,7 +315,7 @@ namespace ai { public: EnhancementShamanBoostRaidStrategy(PlayerbotAI* ai) : EnhancementShamanBoostStrategy(ai) {} - string getName() override { return "boost enhancement raid"; } + std::string getName() override { return "boost enhancement raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/shaman/RestorationShamanStrategy.h b/playerbot/strategy/shaman/RestorationShamanStrategy.h index ff9029e9..b3df5e71 100644 --- a/playerbot/strategy/shaman/RestorationShamanStrategy.h +++ b/playerbot/strategy/shaman/RestorationShamanStrategy.h @@ -8,7 +8,7 @@ namespace ai public: RestorationShamanPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_HEAL | STRATEGY_TYPE_RANGED; } - string getName() override { return "restoration"; } + std::string getName() override { return "restoration"; } }; class RestorationShamanStrategy : public ShamanStrategy @@ -76,7 +76,7 @@ namespace ai { public: RestorationShamanAoePveStrategy(PlayerbotAI* ai) : RestorationShamanAoeStrategy(ai) {} - string getName() override { return "aoe restoration pve"; } + std::string getName() override { return "aoe restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -87,7 +87,7 @@ namespace ai { public: RestorationShamanAoePvpStrategy(PlayerbotAI* ai) : RestorationShamanAoeStrategy(ai) {} - string getName() override { return "aoe restoration pvp"; } + std::string getName() override { return "aoe restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -98,7 +98,7 @@ namespace ai { public: RestorationShamanAoeRaidStrategy(PlayerbotAI* ai) : RestorationShamanAoeStrategy(ai) {} - string getName() override { return "aoe restoration raid"; } + std::string getName() override { return "aoe restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -119,7 +119,7 @@ namespace ai { public: RestorationShamanCcPveStrategy(PlayerbotAI* ai) : RestorationShamanCcStrategy(ai) {} - string getName() override { return "cc restoration pve"; } + std::string getName() override { return "cc restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -130,7 +130,7 @@ namespace ai { public: RestorationShamanCcPvpStrategy(PlayerbotAI* ai) : RestorationShamanCcStrategy(ai) {} - string getName() override { return "cc restoration pvp"; } + std::string getName() override { return "cc restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -141,7 +141,7 @@ namespace ai { public: RestorationShamanCcRaidStrategy(PlayerbotAI* ai) : RestorationShamanCcStrategy(ai) {} - string getName() override { return "cc restoration raid"; } + std::string getName() override { return "cc restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -162,7 +162,7 @@ namespace ai { public: RestorationShamanCurePveStrategy(PlayerbotAI* ai) : RestorationShamanCureStrategy(ai) {} - string getName() override { return "cure restoration pve"; } + std::string getName() override { return "cure restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -173,7 +173,7 @@ namespace ai { public: RestorationShamanCurePvpStrategy(PlayerbotAI* ai) : RestorationShamanCureStrategy(ai) {} - string getName() override { return "cure restoration pvp"; } + std::string getName() override { return "cure restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -184,7 +184,7 @@ namespace ai { public: RestorationShamanCureRaidStrategy(PlayerbotAI* ai) : RestorationShamanCureStrategy(ai) {} - string getName() override { return "cure restoration raid"; } + std::string getName() override { return "cure restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -205,7 +205,7 @@ namespace ai { public: RestorationShamanTotemsPveStrategy(PlayerbotAI* ai) : RestorationShamanTotemsStrategy(ai) {} - string getName() override { return "totems restoration pve"; } + std::string getName() override { return "totems restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -216,7 +216,7 @@ namespace ai { public: RestorationShamanTotemsPvpStrategy(PlayerbotAI* ai) : RestorationShamanTotemsStrategy(ai) {} - string getName() override { return "totems restoration pvp"; } + std::string getName() override { return "totems restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -227,7 +227,7 @@ namespace ai { public: RestorationShamanTotemsRaidStrategy(PlayerbotAI* ai) : RestorationShamanTotemsStrategy(ai) {} - string getName() override { return "totems restoration raid"; } + std::string getName() override { return "totems restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -248,7 +248,7 @@ namespace ai { public: RestorationShamanBuffPveStrategy(PlayerbotAI* ai) : RestorationShamanBuffStrategy(ai) {} - string getName() override { return "buff restoration pve"; } + std::string getName() override { return "buff restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -259,7 +259,7 @@ namespace ai { public: RestorationShamanBuffPvpStrategy(PlayerbotAI* ai) : RestorationShamanBuffStrategy(ai) {} - string getName() override { return "buff restoration pvp"; } + std::string getName() override { return "buff restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -270,7 +270,7 @@ namespace ai { public: RestorationShamanBuffRaidStrategy(PlayerbotAI* ai) : RestorationShamanBuffStrategy(ai) {} - string getName() override { return "buff restoration raid"; } + std::string getName() override { return "buff restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -291,7 +291,7 @@ namespace ai { public: RestorationShamanBoostPveStrategy(PlayerbotAI* ai) : RestorationShamanBoostStrategy(ai) {} - string getName() override { return "boost restoration pve"; } + std::string getName() override { return "boost restoration pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: RestorationShamanBoostPvpStrategy(PlayerbotAI* ai) : RestorationShamanBoostStrategy(ai) {} - string getName() override { return "boost restoration pvp"; } + std::string getName() override { return "boost restoration pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -313,7 +313,7 @@ namespace ai { public: RestorationShamanBoostRaidStrategy(PlayerbotAI* ai) : RestorationShamanBoostStrategy(ai) {} - string getName() override { return "boost restoration raid"; } + std::string getName() override { return "boost restoration raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/shaman/ShamanActions.h b/playerbot/strategy/shaman/ShamanActions.h index e71faed4..e5b5a362 100644 --- a/playerbot/strategy/shaman/ShamanActions.h +++ b/playerbot/strategy/shaman/ShamanActions.h @@ -105,7 +105,7 @@ namespace ai class CastTotemAction : public CastBuffSpellAction { public: - CastTotemAction(PlayerbotAI* ai, string spell) : CastBuffSpellAction(ai, spell) {} + CastTotemAction(PlayerbotAI* ai, std::string spell) : CastBuffSpellAction(ai, spell) {} virtual bool isUseful() { return CastBuffSpellAction::isUseful() && !AI_VALUE2(bool, "has totem", name); } }; @@ -162,7 +162,7 @@ namespace ai { public: CastManaTideTotemAction(PlayerbotAI* ai) : CastTotemAction(ai, "mana tide totem") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } }; class CastHealingStreamTotemAction : public CastTotemAction @@ -248,7 +248,7 @@ namespace ai { public: CastSearingTotemAction(PlayerbotAI* ai) : CastTotemAction(ai, "searing totem") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } virtual bool isUseful() { return CastTotemAction::isUseful() && !AI_VALUE2(bool, "has totem", "flametongue totem"); } }; @@ -256,7 +256,7 @@ namespace ai { public: CastMagmaTotemAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "magma totem") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } virtual bool isUseful() { return CastMeleeSpellAction::isUseful() && !AI_VALUE2(bool, "has totem", name); } }; @@ -331,21 +331,21 @@ namespace ai public: CastCleanseSpiritPoisonOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse spirit", DISPEL_POISON) {} - virtual string getName() { return "cleanse spirit poison on party"; } + virtual std::string getName() { return "cleanse spirit poison on party"; } }; class CastCleanseSpiritCurseOnPartyAction : public CurePartyMemberAction { public: CastCleanseSpiritCurseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse spirit", DISPEL_CURSE) {} - virtual string getName() { return "cleanse spirit curse on party"; } + virtual std::string getName() { return "cleanse spirit curse on party"; } }; class CastCleanseSpiritDiseaseOnPartyAction : public CurePartyMemberAction { public: CastCleanseSpiritDiseaseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cleanse spirit", DISPEL_DISEASE) {} - virtual string getName() { return "cleanse spirit disease on party"; } + virtual std::string getName() { return "cleanse spirit disease on party"; } }; class CastFlameShockAction : public CastRangedDebuffSpellAction @@ -424,7 +424,7 @@ namespace ai { public: CastCureDiseaseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "cure disease", DISPEL_DISEASE) {} - virtual string getName() { return "cure disease on party"; } + virtual std::string getName() { return "cure disease on party"; } }; class CastCallOfTheElements : public CastBuffSpellAction diff --git a/playerbot/strategy/shaman/ShamanAiObjectContext.cpp b/playerbot/strategy/shaman/ShamanAiObjectContext.cpp index a99a5e33..1f1d75f9 100644 --- a/playerbot/strategy/shaman/ShamanAiObjectContext.cpp +++ b/playerbot/strategy/shaman/ShamanAiObjectContext.cpp @@ -3,7 +3,7 @@ #include "ShamanActions.h" #include "ShamanAiObjectContext.h" #include "ShamanTriggers.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "ElementalShamanStrategy.h" #include "RestorationShamanStrategy.h" #include "EnhancementShamanStrategy.h" diff --git a/playerbot/strategy/shaman/ShamanAiObjectContext.h b/playerbot/strategy/shaman/ShamanAiObjectContext.h index 718084a6..5bc64b9b 100644 --- a/playerbot/strategy/shaman/ShamanAiObjectContext.h +++ b/playerbot/strategy/shaman/ShamanAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/shaman/ShamanStrategy.h b/playerbot/strategy/shaman/ShamanStrategy.h index b74b8b38..228c1e53 100644 --- a/playerbot/strategy/shaman/ShamanStrategy.h +++ b/playerbot/strategy/shaman/ShamanStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: ShamanTotemsPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "totems"; } + std::string getName() override { return "totems"; } }; class ShamanStrategy : public ClassStrategy @@ -282,7 +282,7 @@ namespace ai { public: ShamanTotemBarElementsStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "totembar elements"; } + std::string getName() override { return "totembar elements"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -292,7 +292,7 @@ namespace ai { public: ShamanTotemBarAncestorsStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "totembar ancestors"; } + std::string getName() override { return "totembar ancestors"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: ShamanTotemBarSpiritsStrategy(PlayerbotAI* ai) : Strategy(ai) {} - string getName() override { return "totembar spirits"; } + std::string getName() override { return "totembar spirits"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -317,7 +317,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/shaman/ShamanTriggers.cpp b/playerbot/strategy/shaman/ShamanTriggers.cpp index b69c8940..76cfdb54 100644 --- a/playerbot/strategy/shaman/ShamanTriggers.cpp +++ b/playerbot/strategy/shaman/ShamanTriggers.cpp @@ -5,7 +5,7 @@ using namespace ai; -list ShamanWeaponTrigger::spells; +std::list ShamanWeaponTrigger::spells; bool ShamanWeaponTrigger::IsActive() { @@ -18,7 +18,7 @@ bool ShamanWeaponTrigger::IsActive() spells.push_back("windfury weapon"); } - for (list::iterator i = spells.begin(); i != spells.end(); ++i) + for (std::list::iterator i = spells.begin(); i != spells.end(); ++i) { uint32 spellId = AI_VALUE2(uint32, "spell id", spell); if (!spellId) diff --git a/playerbot/strategy/shaman/ShamanTriggers.h b/playerbot/strategy/shaman/ShamanTriggers.h index be166baf..4fdb1477 100644 --- a/playerbot/strategy/shaman/ShamanTriggers.h +++ b/playerbot/strategy/shaman/ShamanTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { @@ -9,7 +9,7 @@ namespace ai ShamanWeaponTrigger(PlayerbotAI* ai) : BuffTrigger(ai, "rockbiter weapon") {} virtual bool IsActive(); private: - static list spells; + static std::list spells; }; class ReadyToRemoveTotemsTrigger : public Trigger @@ -41,7 +41,7 @@ namespace ai class TotemTrigger : public Trigger { public: - TotemTrigger(PlayerbotAI* ai, string spell, int attackerCount = 0) : Trigger(ai, spell), attackerCount(attackerCount) {} + TotemTrigger(PlayerbotAI* ai, std::string spell, int attackerCount = 0) : Trigger(ai, spell), attackerCount(attackerCount) {} virtual bool IsActive() { @@ -308,7 +308,7 @@ namespace ai if (!IsPositiveSpell(spellId)) continue; - vector ignoreSpells; + std::vector ignoreSpells; ignoreSpells.push_back(17627); ignoreSpells.push_back(24382); ignoreSpells.push_back(22888); diff --git a/playerbot/strategy/triggers/BotStateTriggers.h b/playerbot/strategy/triggers/BotStateTriggers.h index 5df09415..067bddee 100644 --- a/playerbot/strategy/triggers/BotStateTriggers.h +++ b/playerbot/strategy/triggers/BotStateTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { diff --git a/playerbot/strategy/triggers/ChatCommandTrigger.h b/playerbot/strategy/triggers/ChatCommandTrigger.h index 9d74c6b8..da4d6885 100644 --- a/playerbot/strategy/triggers/ChatCommandTrigger.h +++ b/playerbot/strategy/triggers/ChatCommandTrigger.h @@ -1,14 +1,14 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { class ChatCommandTrigger : public Trigger { public: - ChatCommandTrigger(PlayerbotAI* ai, string command) : Trigger(ai, command) {} + ChatCommandTrigger(PlayerbotAI* ai, std::string command) : Trigger(ai, command) {} - virtual void ExternalEvent(string param, Player* owner = NULL) + virtual void ExternalEvent(std::string param, Player* owner = NULL) { this->param = param; this->owner = owner; diff --git a/playerbot/strategy/triggers/CureTriggers.h b/playerbot/strategy/triggers/CureTriggers.h index 9b640737..0c3ab342 100644 --- a/playerbot/strategy/triggers/CureTriggers.h +++ b/playerbot/strategy/triggers/CureTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { @@ -8,8 +8,8 @@ namespace ai class NeedCureTrigger : public SpellTrigger { public: - NeedCureTrigger(PlayerbotAI* ai, string spell, uint32 dispelType, int checkInterval = 3) : SpellTrigger(ai, spell, checkInterval), dispelType(dispelType) {} - virtual string GetTargetName() { return "self target"; } + NeedCureTrigger(PlayerbotAI* ai, std::string spell, uint32 dispelType, int checkInterval = 3) : SpellTrigger(ai, spell, checkInterval), dispelType(dispelType) {} + virtual std::string GetTargetName() { return "self target"; } virtual bool IsActive(); protected: @@ -19,14 +19,14 @@ namespace ai class TargetAuraDispelTrigger : public NeedCureTrigger { public: - TargetAuraDispelTrigger(PlayerbotAI* ai, string spell, uint32 dispelType, int checkInterval = 3) : NeedCureTrigger(ai, spell, dispelType, checkInterval) {} - virtual string GetTargetName() { return "current target"; } + TargetAuraDispelTrigger(PlayerbotAI* ai, std::string spell, uint32 dispelType, int checkInterval = 3) : NeedCureTrigger(ai, spell, dispelType, checkInterval) {} + virtual std::string GetTargetName() { return "current target"; } }; class PartyMemberNeedCureTrigger : public NeedCureTrigger { public: - PartyMemberNeedCureTrigger(PlayerbotAI* ai, string spell, uint32 dispelType) : NeedCureTrigger(ai, spell, dispelType) {} + PartyMemberNeedCureTrigger(PlayerbotAI* ai, std::string spell, uint32 dispelType) : NeedCureTrigger(ai, spell, dispelType) {} virtual Value* GetTargetValue(); }; diff --git a/playerbot/strategy/triggers/DungeonTriggers.cpp b/playerbot/strategy/triggers/DungeonTriggers.cpp index 59f7c54e..341f0c04 100644 --- a/playerbot/strategy/triggers/DungeonTriggers.cpp +++ b/playerbot/strategy/triggers/DungeonTriggers.cpp @@ -3,7 +3,7 @@ #include "DungeonTriggers.h" #include "playerbot/strategy/values/PositionValue.h" #include "playerbot/ServerFacade.h" -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" #include "playerbot/strategy/values/HazardsValue.h" #include "playerbot/strategy/actions/MovementActions.h" #include "Grids/GridNotifiers.h" @@ -57,7 +57,7 @@ bool StartBossFightTrigger::IsActive() if (bot->IsInWorld() && !bot->IsBeingTeleported()) { AiObjectContext* context = ai->GetAiObjectContext(); - const list attackers = AI_VALUE(list, "attackers"); + const std::list attackers = AI_VALUE(std::list, "attackers"); for (const ObjectGuid& attackerGuid : attackers) { Unit* attacker = ai->GetUnit(attackerGuid); @@ -90,7 +90,7 @@ bool CloseToHazardTrigger::IsActive() bool closeToHazard = false; if (bot->IsInWorld() && !bot->IsBeingTeleported()) { - const list& possibleHazards = GetPossibleHazards(); + const std::list& possibleHazards = GetPossibleHazards(); for (const ObjectGuid& possibleHazardGuid : possibleHazards) { if (IsHazardValid(possibleHazardGuid)) @@ -165,7 +165,7 @@ float CloseToHazardTrigger::GetDistanceToHazard(const ObjectGuid& hazzardGuid) std::list CloseToGameObjectHazardTrigger::GetPossibleHazards() { // This game objects have a maximum range equal to the sight distance on config file (default 60 yards) - return AI_VALUE2(list, "nearest game objects no los", gameObjectID); + return AI_VALUE2(std::list, "nearest game objects no los", gameObjectID); } std::list CloseToCreatureHazardTrigger::GetPossibleHazards() @@ -224,7 +224,7 @@ bool CloseToCreatureTrigger::IsActive() AiObjectContext* context = ai->GetAiObjectContext(); // Iterate through the near creatures - list creatures; + std::list creatures; MaNGOS::AllCreaturesOfEntryInRangeCheck u_check(bot, creatureID, range); MaNGOS::UnitListSearcher searcher(creatures, u_check); Cell::VisitAllObjects(bot, searcher, range); diff --git a/playerbot/strategy/triggers/DungeonTriggers.h b/playerbot/strategy/triggers/DungeonTriggers.h index e6fc37fe..aa8230f6 100644 --- a/playerbot/strategy/triggers/DungeonTriggers.h +++ b/playerbot/strategy/triggers/DungeonTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { @@ -8,7 +8,7 @@ namespace ai public: // You can get the mapID from worlddb > instance_template > map column // or from here https://wow.tools/dbc/?dbc=map&build=1.12.1.5875 - EnterDungeonTrigger(PlayerbotAI* ai, string name, string dungeonStrategy, uint32 mapID) + EnterDungeonTrigger(PlayerbotAI* ai, std::string name, std::string dungeonStrategy, uint32 mapID) : Trigger(ai, name, 5) , dungeonStrategy(dungeonStrategy) , mapID(mapID) {} @@ -16,7 +16,7 @@ namespace ai bool IsActive() override; private: - string dungeonStrategy; + std::string dungeonStrategy; uint32 mapID; }; @@ -25,7 +25,7 @@ namespace ai public: // You can get the mapID from worlddb > instance_template > map column // or from here https://wow.tools/dbc/?dbc=map&build=1.12.1.5875 - LeaveDungeonTrigger(PlayerbotAI* ai, string name, string dungeonStrategy, uint32 mapID) + LeaveDungeonTrigger(PlayerbotAI* ai, std::string name, std::string dungeonStrategy, uint32 mapID) : Trigger(ai, name, 5) , dungeonStrategy(dungeonStrategy) , mapID(mapID) {} @@ -33,14 +33,14 @@ namespace ai bool IsActive() override; private: - string dungeonStrategy; + std::string dungeonStrategy; uint32 mapID; }; class StartBossFightTrigger : public Trigger { public: - StartBossFightTrigger(PlayerbotAI* ai, string name, string bossStrategy, uint64 bossID) + StartBossFightTrigger(PlayerbotAI* ai, std::string name, std::string bossStrategy, uint64 bossID) : Trigger(ai, name, 1) , bossStrategy(bossStrategy) , bossID(bossID) {} @@ -48,14 +48,14 @@ namespace ai bool IsActive() override; private: - string bossStrategy; + std::string bossStrategy; uint64 bossID; }; class EndBossFightTrigger : public Trigger { public: - EndBossFightTrigger(PlayerbotAI* ai, string name, string bossStrategy, uint64 bossID) + EndBossFightTrigger(PlayerbotAI* ai, std::string name, std::string bossStrategy, uint64 bossID) : Trigger(ai, name, 5) , bossStrategy(bossStrategy) , bossID(bossID) {} @@ -63,14 +63,14 @@ namespace ai bool IsActive() override; private: - string bossStrategy; + std::string bossStrategy; uint64 bossID; }; class CloseToHazardTrigger : public Trigger { public: - CloseToHazardTrigger(PlayerbotAI* ai, string name, int checkInterval, float hazardRadius, time_t hazardDuration) + CloseToHazardTrigger(PlayerbotAI* ai, std::string name, int checkInterval, float hazardRadius, time_t hazardDuration) : Trigger(ai, name, checkInterval) , hazardRadius(hazardRadius) , hazardDuration(hazardDuration) {} @@ -92,7 +92,7 @@ namespace ai class CloseToGameObjectHazardTrigger : public CloseToHazardTrigger { public: - CloseToGameObjectHazardTrigger(PlayerbotAI* ai, string name, uint32 gameObjectID, float radius, time_t expirationTime) + CloseToGameObjectHazardTrigger(PlayerbotAI* ai, std::string name, uint32 gameObjectID, float radius, time_t expirationTime) : CloseToHazardTrigger(ai, name, 1, radius, expirationTime) , gameObjectID(gameObjectID) {} @@ -106,7 +106,7 @@ namespace ai class CloseToCreatureHazardTrigger : public CloseToHazardTrigger { public: - CloseToCreatureHazardTrigger(PlayerbotAI* ai, string name, uint32 creatureID, float radius, time_t expirationTime) + CloseToCreatureHazardTrigger(PlayerbotAI* ai, std::string name, uint32 creatureID, float radius, time_t expirationTime) : CloseToHazardTrigger(ai, name, 1, radius, expirationTime) , creatureID(creatureID) {} @@ -121,7 +121,7 @@ namespace ai class CloseToHostileCreatureHazardTrigger : public CloseToCreatureHazardTrigger { public: - CloseToHostileCreatureHazardTrigger(PlayerbotAI* ai, string name, uint32 creatureID, float radius, time_t expirationTime) + CloseToHostileCreatureHazardTrigger(PlayerbotAI* ai, std::string name, uint32 creatureID, float radius, time_t expirationTime) : CloseToCreatureHazardTrigger(ai, name, creatureID, radius, expirationTime) {} private: @@ -131,7 +131,7 @@ namespace ai class CloseToCreatureTrigger : public Trigger { public: - CloseToCreatureTrigger(PlayerbotAI* ai, string name, uint32 creatureID, float range) + CloseToCreatureTrigger(PlayerbotAI* ai, std::string name, uint32 creatureID, float range) : Trigger(ai, name, 1) , creatureID(creatureID) , range(range) {} @@ -146,7 +146,7 @@ namespace ai class ItemReadyTrigger : public Trigger { public: - ItemReadyTrigger(PlayerbotAI* ai, string name, uint32 itemID) + ItemReadyTrigger(PlayerbotAI* ai, std::string name, uint32 itemID) : Trigger(ai, name, 1) , itemID(itemID) {} @@ -159,7 +159,7 @@ namespace ai class ItemBuffReadyTrigger : public ItemReadyTrigger { public: - ItemBuffReadyTrigger(PlayerbotAI* ai, string name, uint32 itemID, uint32 buffID) + ItemBuffReadyTrigger(PlayerbotAI* ai, std::string name, uint32 itemID, uint32 buffID) : ItemReadyTrigger(ai, name, itemID) , buffID(buffID) {} diff --git a/playerbot/strategy/triggers/GenericTriggers.cpp b/playerbot/strategy/triggers/GenericTriggers.cpp index 728f5e8f..87863328 100644 --- a/playerbot/strategy/triggers/GenericTriggers.cpp +++ b/playerbot/strategy/triggers/GenericTriggers.cpp @@ -103,7 +103,7 @@ bool OutNumberedTrigger::IsActive() int32 botLevel = bot->GetLevel(); float healthMod = bot->GetHealthPercent() / 100.0f; uint32 friendPower = 100 + 100 * healthMod, foePower = 0; - for (auto &attacker : ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get()) + for (auto &attacker : ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get()) { Creature* creature = ai->GetCreature(attacker); if (!creature) @@ -123,7 +123,7 @@ bool OutNumberedTrigger::IsActive() if (!foePower) return false; - for (auto & helper : ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get()) + for (auto & helper : ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get()) { Unit* player = ai->GetUnit(helper); @@ -332,7 +332,7 @@ bool RandomTrigger::IsActive() bool AndTrigger::IsActive() { - vector tnames = getMultiQualifiers(getQualifier(), ","); + std::vector tnames = getMultiQualifiers(getQualifier(), ","); for (auto tname : tnames) { @@ -344,10 +344,10 @@ bool AndTrigger::IsActive() return true; } -string AndTrigger::getName() +std::string AndTrigger::getName() { - string name; - vector tnames = getMultiQualifiers(getQualifier(), ","); + std::string name; + std::vector tnames = getMultiQualifiers(getQualifier(), ","); for (auto tname : tnames) { @@ -361,7 +361,7 @@ string AndTrigger::getName() bool OrTrigger::IsActive() { - vector tnames = getMultiQualifiers(getQualifier(), ","); + std::vector tnames = getMultiQualifiers(getQualifier(), ","); for (auto tname : tnames) { @@ -373,10 +373,10 @@ bool OrTrigger::IsActive() return false; } -string OrTrigger::getName() +std::string OrTrigger::getName() { - string name; - vector tnames = getMultiQualifiers(getQualifier(), ","); + std::string name; + std::vector tnames = getMultiQualifiers(getQualifier(), ","); for (auto tname : tnames) { @@ -402,7 +402,7 @@ bool TwoTriggers::IsActive() return trigger1->IsActive() && trigger2->IsActive(); } -string TwoTriggers::getName() +std::string TwoTriggers::getName() { std::string name; name = name1 + " and " + name2; @@ -534,7 +534,7 @@ bool NoMovementTrigger::IsActive() bool NoPossibleTargetsTrigger::IsActive() { - list targets = AI_VALUE(list, "possible targets"); + std::list targets = AI_VALUE(std::list, "possible targets"); return !targets.size(); } @@ -610,13 +610,13 @@ bool IsSwimmingTrigger::IsActive() bool HasNearestAddsTrigger::IsActive() { - list targets = AI_VALUE(list, "nearest adds"); + std::list targets = AI_VALUE(std::list, "nearest adds"); return targets.size(); } bool HasItemForSpellTrigger::IsActive() { - string spell = getName(); + std::string spell = getName(); uint32 spellId = AI_VALUE2(uint32, "spell id", spell); return spellId && AI_VALUE2(Item*, "item for spell", spellId); } @@ -732,7 +732,7 @@ bool GreaterBuffOnPartyTrigger::IsActive() bool TargetOfAttacker::IsActive() { - return !AI_VALUE(list, "attackers targeting me").empty(); + return !AI_VALUE(std::list, "attackers targeting me").empty(); } bool TargetOfAttackerInRange::IsActive() @@ -743,7 +743,7 @@ bool TargetOfAttackerInRange::IsActive() bool TargetOfCastedAuraTypeTrigger::IsActive() { - const list& attackers = AI_VALUE(list, "attackers"); + const std::list& attackers = AI_VALUE(std::list, "attackers"); for (const ObjectGuid& attackerGuid : attackers) { // Check against the given creature id diff --git a/playerbot/strategy/triggers/GenericTriggers.h b/playerbot/strategy/triggers/GenericTriggers.h index 3e87131a..692cdff2 100644 --- a/playerbot/strategy/triggers/GenericTriggers.h +++ b/playerbot/strategy/triggers/GenericTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/ServerFacade.h" #include "Spells/SpellAuraDefines.h" @@ -9,7 +9,7 @@ namespace ai class StatAvailable : public Trigger { public: - StatAvailable(PlayerbotAI* ai, int amount, string name = "stat available") : Trigger(ai, name) + StatAvailable(PlayerbotAI* ai, int amount, std::string name = "stat available") : Trigger(ai, name) { this->amount = amount; } @@ -103,30 +103,30 @@ namespace ai class SpellTrigger : public Trigger { public: - SpellTrigger(PlayerbotAI* ai, string spell, int checkInterval = 1) : Trigger(ai, spell, checkInterval) + SpellTrigger(PlayerbotAI* ai, std::string spell, int checkInterval = 1) : Trigger(ai, spell, checkInterval) { this->spell = spell; } - virtual string GetTargetName() override { return "current target"; } - virtual string getName() { return spell; } + virtual std::string GetTargetName() override { return "current target"; } + virtual std::string getName() { return spell; } virtual bool IsActive() override; protected: - string spell; + std::string spell; }; class SpellCanBeCastedTrigger : public SpellTrigger { public: - SpellCanBeCastedTrigger(PlayerbotAI* ai, string spell) : SpellTrigger(ai, spell) {} + SpellCanBeCastedTrigger(PlayerbotAI* ai, std::string spell) : SpellTrigger(ai, spell) {} virtual bool IsActive() override; }; class SpellNoCooldownTrigger : public SpellTrigger { public: - SpellNoCooldownTrigger(PlayerbotAI* ai, string spell) : SpellTrigger(ai, spell) {} + SpellNoCooldownTrigger(PlayerbotAI* ai, std::string spell) : SpellTrigger(ai, spell) {} virtual bool IsActive() override; }; @@ -134,22 +134,22 @@ namespace ai class InterruptSpellTrigger : public SpellTrigger { public: - InterruptSpellTrigger(PlayerbotAI* ai, string spell) : SpellTrigger(ai, spell) {} - virtual string GetTargetName() override { return "current target"; } + InterruptSpellTrigger(PlayerbotAI* ai, std::string spell) : SpellTrigger(ai, spell) {} + virtual std::string GetTargetName() override { return "current target"; } virtual bool IsActive() override; }; class TargetOfAttacker : public Trigger { public: - TargetOfAttacker(PlayerbotAI* ai, string name = "target of attacker", int checkInterval = 1) : Trigger(ai, name, checkInterval) {} + TargetOfAttacker(PlayerbotAI* ai, std::string name = "target of attacker", int checkInterval = 1) : Trigger(ai, name, checkInterval) {} virtual bool IsActive() override; }; class TargetOfAttackerInRange : public TargetOfAttacker { public: - TargetOfAttackerInRange(PlayerbotAI* ai, string name, float distance, int checkInterval = 1) : TargetOfAttacker(ai, name, checkInterval), distance(distance) {} + TargetOfAttackerInRange(PlayerbotAI* ai, std::string name, float distance, int checkInterval = 1) : TargetOfAttacker(ai, name, checkInterval), distance(distance) {} virtual bool IsActive() override; private: @@ -165,7 +165,7 @@ namespace ai class TargetOfCastedAuraTypeTrigger : public Trigger { public: - TargetOfCastedAuraTypeTrigger(PlayerbotAI* ai, string name, AuraType auraType, int checkInterval = 1) : Trigger(ai, name, checkInterval), auraType(auraType) {} + TargetOfCastedAuraTypeTrigger(PlayerbotAI* ai, std::string name, AuraType auraType, int checkInterval = 1) : Trigger(ai, name, checkInterval), auraType(auraType) {} virtual bool IsActive() override; private: @@ -175,13 +175,13 @@ namespace ai class TargetOfFearCastTrigger : public TargetOfCastedAuraTypeTrigger { public: - TargetOfFearCastTrigger(PlayerbotAI* ai, string name = "target of fear cast") : TargetOfCastedAuraTypeTrigger(ai, name, AuraType::SPELL_AURA_MOD_FEAR) {} + TargetOfFearCastTrigger(PlayerbotAI* ai, std::string name = "target of fear cast") : TargetOfCastedAuraTypeTrigger(ai, name, AuraType::SPELL_AURA_MOD_FEAR) {} }; class DeflectSpellTrigger : public SpellTrigger { public: - DeflectSpellTrigger(PlayerbotAI* ai, string spell) : SpellTrigger(ai, spell) {} + DeflectSpellTrigger(PlayerbotAI* ai, std::string spell) : SpellTrigger(ai, spell) {} virtual bool IsActive() override; }; @@ -199,7 +199,7 @@ namespace ai return AI_VALUE(uint8, "attackers count") >= amount; } - virtual string getName() override { return "attackers count"; } + virtual std::string getName() override { return "attackers count"; } protected: int amount; @@ -218,7 +218,7 @@ namespace ai MyAttackerCountTrigger(PlayerbotAI* ai, int amount) : AttackerCountTrigger(ai, amount) {} virtual bool IsActive() override; - virtual string getName() override { return "my attacker count"; } + virtual std::string getName() override { return "my attacker count"; } }; class MultipleAttackersTrigger : public MyAttackerCountTrigger @@ -230,28 +230,28 @@ namespace ai class HighThreatTrigger : public Trigger { public: - HighThreatTrigger(PlayerbotAI* ai, string name = "high threat", int checkinterval = 1) : Trigger(ai, name, checkinterval) {} + HighThreatTrigger(PlayerbotAI* ai, std::string name = "high threat", int checkinterval = 1) : Trigger(ai, name, checkinterval) {} virtual bool IsActive() override; }; class MediumThreatTrigger : public Trigger { public: - MediumThreatTrigger(PlayerbotAI* ai, string name = "medium threat", int checkinterval = 1) : Trigger(ai, name, checkinterval) {} + MediumThreatTrigger(PlayerbotAI* ai, std::string name = "medium threat", int checkinterval = 1) : Trigger(ai, name, checkinterval) {} virtual bool IsActive() override; }; class SomeThreatTrigger : public Trigger { public: - SomeThreatTrigger(PlayerbotAI* ai, string name = "some threat", int checkinterval = 1) : Trigger(ai, name, checkinterval) {} + SomeThreatTrigger(PlayerbotAI* ai, std::string name = "some threat", int checkinterval = 1) : Trigger(ai, name, checkinterval) {} virtual bool IsActive() override; }; class NoThreatTrigger : public SomeThreatTrigger { public: - NoThreatTrigger(PlayerbotAI* ai, string name = "some threat", int checkinterval = 1) : SomeThreatTrigger(ai, name, checkinterval) {} + NoThreatTrigger(PlayerbotAI* ai, std::string name = "some threat", int checkinterval = 1) : SomeThreatTrigger(ai, name, checkinterval) {} virtual bool IsActive() override; }; @@ -259,7 +259,7 @@ namespace ai { public: AoeTrigger(PlayerbotAI* ai, int amount = 3, float range = 40.0f) : AttackerCountTrigger(ai, amount), range(range) {} - string getName() override { return "aoe"; } + std::string getName() override { return "aoe"; } bool IsActive() override; private: @@ -317,10 +317,10 @@ namespace ai class BuffTrigger : public SpellTrigger { public: - BuffTrigger(PlayerbotAI* ai, string spell, int checkInterval = 1, bool checkIsOwner = false) : SpellTrigger(ai, spell, checkInterval) { this->checkIsOwner = checkIsOwner; } + BuffTrigger(PlayerbotAI* ai, std::string spell, int checkInterval = 1, bool checkIsOwner = false) : SpellTrigger(ai, spell, checkInterval) { this->checkIsOwner = checkIsOwner; } public: - virtual string GetTargetName() override { return "self target"; } + virtual std::string GetTargetName() override { return "self target"; } virtual bool IsActive() override; protected: @@ -330,7 +330,7 @@ namespace ai class MyBuffTrigger : public BuffTrigger { public: - MyBuffTrigger(PlayerbotAI* ai, string spell, int checkInterval = 1) : BuffTrigger(ai, spell, checkInterval) {} + MyBuffTrigger(PlayerbotAI* ai, std::string spell, int checkInterval = 1) : BuffTrigger(ai, spell, checkInterval) {} public: virtual bool IsActive() override; @@ -339,11 +339,11 @@ namespace ai class BuffOnPartyTrigger : public BuffTrigger { public: - BuffOnPartyTrigger(PlayerbotAI* ai, string spell, int checkInterval = 2, bool ignoreTanks = false) : BuffTrigger(ai, spell, checkInterval), ignoreTanks(ignoreTanks) {} + BuffOnPartyTrigger(PlayerbotAI* ai, std::string spell, int checkInterval = 2, bool ignoreTanks = false) : BuffTrigger(ai, spell, checkInterval), ignoreTanks(ignoreTanks) {} public: virtual Value* GetTargetValue() override; - virtual string getName() override { return spell + " on party"; } + virtual std::string getName() override { return spell + " on party"; } protected: bool ignoreTanks; @@ -352,7 +352,7 @@ namespace ai class GreaterBuffOnPartyTrigger : public BuffOnPartyTrigger { public: - GreaterBuffOnPartyTrigger(PlayerbotAI* ai, string spell, string lowerSpell, int checkInterval = 2, bool ignoreTanks = false) : BuffOnPartyTrigger(ai, spell, checkInterval, ignoreTanks), lowerSpell(lowerSpell) {} + GreaterBuffOnPartyTrigger(PlayerbotAI* ai, std::string spell, std::string lowerSpell, int checkInterval = 2, bool ignoreTanks = false) : BuffOnPartyTrigger(ai, spell, checkInterval, ignoreTanks), lowerSpell(lowerSpell) {} virtual Value* GetTargetValue() override; virtual bool IsActive() override; @@ -363,29 +363,29 @@ namespace ai class BuffOnTankTrigger : public BuffTrigger { public: - BuffOnTankTrigger(PlayerbotAI* ai, string spell, int checkInterval = 2) : BuffTrigger(ai, spell, checkInterval) {} + BuffOnTankTrigger(PlayerbotAI* ai, std::string spell, int checkInterval = 2) : BuffTrigger(ai, spell, checkInterval) {} public: virtual Value* GetTargetValue() override; - virtual string getName() override { return spell + " on tank"; } + virtual std::string getName() override { return spell + " on tank"; } }; class MyBuffOnPartyTrigger : public BuffOnPartyTrigger { public: - MyBuffOnPartyTrigger(PlayerbotAI* ai, string spell, int checkInterval = 2, bool ignoreTanks = false) : BuffOnPartyTrigger(ai, spell, checkInterval, ignoreTanks) {} + MyBuffOnPartyTrigger(PlayerbotAI* ai, std::string spell, int checkInterval = 2, bool ignoreTanks = false) : BuffOnPartyTrigger(ai, spell, checkInterval, ignoreTanks) {} public: virtual Value* GetTargetValue() override; - virtual string getName() override { return spell + " on party"; } + virtual std::string getName() override { return spell + " on party"; } }; class NoBuffAndComboPointsAvailableTrigger : public BuffTrigger { public: - NoBuffAndComboPointsAvailableTrigger(PlayerbotAI* ai, string spell, uint8 comboPoints, bool checkIsOwner = true, int checkInterval = 1) : BuffTrigger(ai, spell, checkInterval, checkIsOwner), comboPoints(comboPoints) {} - virtual string GetTargetName() override { return "self target"; } - virtual string GetComboPointsTargetName() { return "current target"; } + NoBuffAndComboPointsAvailableTrigger(PlayerbotAI* ai, std::string spell, uint8 comboPoints, bool checkIsOwner = true, int checkInterval = 1) : BuffTrigger(ai, spell, checkInterval, checkIsOwner), comboPoints(comboPoints) {} + virtual std::string GetTargetName() override { return "self target"; } + virtual std::string GetComboPointsTargetName() { return "current target"; } virtual bool IsActive() override; private: @@ -395,15 +395,15 @@ namespace ai class NoDebuffAndComboPointsAvailableTrigger : public NoBuffAndComboPointsAvailableTrigger { public: - NoDebuffAndComboPointsAvailableTrigger(PlayerbotAI* ai, string spell, uint8 comboPoints, bool checkIsOwner = true, int checkInterval = 1) : NoBuffAndComboPointsAvailableTrigger(ai, spell, comboPoints, checkIsOwner, checkIsOwner) {} - virtual string GetTargetName() override { return "current target"; } + NoDebuffAndComboPointsAvailableTrigger(PlayerbotAI* ai, std::string spell, uint8 comboPoints, bool checkIsOwner = true, int checkInterval = 1) : NoBuffAndComboPointsAvailableTrigger(ai, spell, comboPoints, checkIsOwner, checkIsOwner) {} + virtual std::string GetTargetName() override { return "current target"; } }; class ProtectPartyMemberTrigger : public Trigger { public: ProtectPartyMemberTrigger(PlayerbotAI* ai) : Trigger(ai, "protect party member") {} - virtual string GetTargetName() override { return "party member to protect"; } + virtual std::string GetTargetName() override { return "party member to protect"; } virtual bool IsActive() override { @@ -414,7 +414,7 @@ namespace ai class NoAttackersTrigger : public Trigger { public: - NoAttackersTrigger(PlayerbotAI* ai, string name = "no attackers") : Trigger(ai, name) {} + NoAttackersTrigger(PlayerbotAI* ai, std::string name = "no attackers") : Trigger(ai, name) {} virtual bool IsActive() override; }; @@ -442,10 +442,10 @@ namespace ai class DebuffTrigger : public BuffTrigger { public: - DebuffTrigger(PlayerbotAI* ai, string spell, int checkInterval = 1, bool checkIsOwner = false) : BuffTrigger(ai, spell, checkInterval, checkIsOwner) {} + DebuffTrigger(PlayerbotAI* ai, std::string spell, int checkInterval = 1, bool checkIsOwner = false) : BuffTrigger(ai, spell, checkInterval, checkIsOwner) {} public: - virtual string GetTargetName() override { return "current target"; } + virtual std::string GetTargetName() override { return "current target"; } virtual bool IsActive() override; protected: @@ -455,17 +455,17 @@ namespace ai class DebuffOnAttackerTrigger : public DebuffTrigger { public: - DebuffOnAttackerTrigger(PlayerbotAI* ai, string spell) : DebuffTrigger(ai, spell) {} + DebuffOnAttackerTrigger(PlayerbotAI* ai, std::string spell) : DebuffTrigger(ai, spell) {} public: virtual Value* GetTargetValue(); - virtual string getName() { return spell + " on attacker"; } + virtual std::string getName() { return spell + " on attacker"; } }; class BoostTrigger : public BuffTrigger { public: - BoostTrigger(PlayerbotAI* ai, string spell, float balance = 50) : BuffTrigger(ai, spell, 3), balance(balance) {} + BoostTrigger(PlayerbotAI* ai, std::string spell, float balance = 50) : BuffTrigger(ai, spell, 3), balance(balance) {} virtual bool IsActive() override; protected: @@ -475,7 +475,7 @@ namespace ai class RandomTrigger : public Trigger { public: - RandomTrigger(PlayerbotAI* ai, string name, int probability = 7) : Trigger(ai, name) + RandomTrigger(PlayerbotAI* ai, std::string name, int probability = 7) : Trigger(ai, name) { this->probability = probability; lastCheck = time(0); @@ -491,24 +491,24 @@ namespace ai class TimeTrigger : public Trigger { public: - TimeTrigger(PlayerbotAI* ai, string name, int interval = 2) : Trigger(ai, name, interval) {} + TimeTrigger(PlayerbotAI* ai, std::string name, int interval = 2) : Trigger(ai, name, interval) {} virtual bool IsActive() { return true; } }; class AndTrigger : public Trigger, public Qualified { public: - AndTrigger(PlayerbotAI* ai, string name = "and", int checkInterval = 1) : Trigger(ai, name, checkInterval), Qualified() {} + AndTrigger(PlayerbotAI* ai, std::string name = "and", int checkInterval = 1) : Trigger(ai, name, checkInterval), Qualified() {} virtual bool IsActive() override; - virtual string getName(); + virtual std::string getName(); }; class OrTrigger : public Trigger, public Qualified { public: - OrTrigger(PlayerbotAI* ai, string name = "or", int checkInterval = 1) : Trigger(ai, name, checkInterval), Qualified() {} + OrTrigger(PlayerbotAI* ai, std::string name = "or", int checkInterval = 1) : Trigger(ai, name, checkInterval), Qualified() {} virtual bool IsActive() override; - virtual string getName(); + virtual std::string getName(); }; class TwoTriggers : public Trigger @@ -521,7 +521,7 @@ namespace ai } virtual bool IsActive() override; - virtual string getName(); + virtual std::string getName(); protected: std::string name1; @@ -531,15 +531,15 @@ namespace ai class ValueTrigger : public Trigger, public Qualified { public: - ValueTrigger(PlayerbotAI* ai, string name = "val", int checkInterval = 1) : Trigger(ai, name, checkInterval), Qualified() {} + ValueTrigger(PlayerbotAI* ai, std::string name = "val", int checkInterval = 1) : Trigger(ai, name, checkInterval), Qualified() {} virtual bool IsActive() { return AI_VALUE(bool, getQualifier()); } }; class SnareTargetTrigger : public DebuffTrigger { public: - SnareTargetTrigger(PlayerbotAI* ai, string spell, int interval = 1) : DebuffTrigger(ai, spell, interval) {} - virtual string getName() { return spell + " on snare target"; } + SnareTargetTrigger(PlayerbotAI* ai, std::string spell, int interval = 1) : DebuffTrigger(ai, spell, interval) {} + virtual std::string getName() { return spell + " on snare target"; } virtual Value* GetTargetValue(); }; @@ -584,11 +584,11 @@ namespace ai }; BEGIN_TRIGGER(PanicTrigger, Trigger) - virtual string getName() { return "panic"; } + virtual std::string getName() { return "panic"; } END_TRIGGER() BEGIN_TRIGGER(OutNumberedTrigger, Trigger) - virtual string getName() { return "outnumbered"; } + virtual std::string getName() { return "outnumbered"; } END_TRIGGER() class NoPetTrigger : public Trigger @@ -605,31 +605,31 @@ namespace ai class ItemCountTrigger : public Trigger { public: - ItemCountTrigger(PlayerbotAI* ai, string item, int count, int interval = 30) : Trigger(ai, item, interval) + ItemCountTrigger(PlayerbotAI* ai, std::string item, int count, int interval = 30) : Trigger(ai, item, interval) { this->item = item; this->count = count; } virtual bool IsActive() override; - virtual string getName() { return "item count"; } + virtual std::string getName() { return "item count"; } protected: - string item; + std::string item; int count; }; class AmmoCountTrigger : public ItemCountTrigger { public: - AmmoCountTrigger(PlayerbotAI* ai, string item, uint32 count = 1, int interval = 30) : ItemCountTrigger(ai, item, count, interval) {} + AmmoCountTrigger(PlayerbotAI* ai, std::string item, uint32 count = 1, int interval = 30) : ItemCountTrigger(ai, item, count, interval) {} }; class HasAuraTrigger : public Trigger { public: - HasAuraTrigger(PlayerbotAI* ai, string spell, int interval = 1, int auraTypeId = TOTAL_AURAS) : Trigger(ai, spell, interval), auraTypeId(auraTypeId) {} - virtual string GetTargetName() override { return "self target"; } + HasAuraTrigger(PlayerbotAI* ai, std::string spell, int interval = 1, int auraTypeId = TOTAL_AURAS) : Trigger(ai, spell, interval), auraTypeId(auraTypeId) {} + virtual std::string GetTargetName() override { return "self target"; } virtual bool IsActive() override; protected: @@ -639,8 +639,8 @@ namespace ai class HasNoAuraTrigger : public Trigger { public: - HasNoAuraTrigger(PlayerbotAI* ai, string spell) : Trigger(ai, spell) {} - virtual string GetTargetName() override { return "self target"; } + HasNoAuraTrigger(PlayerbotAI* ai, std::string spell) : Trigger(ai, spell) {} + virtual std::string GetTargetName() override { return "self target"; } virtual bool IsActive() override; }; @@ -694,14 +694,14 @@ namespace ai class HasCcTargetTrigger : public Trigger { public: - HasCcTargetTrigger(PlayerbotAI* ai, string name) : Trigger(ai, name) {} + HasCcTargetTrigger(PlayerbotAI* ai, std::string name) : Trigger(ai, name) {} virtual bool IsActive() override; }; class NoMovementTrigger : public Trigger { public: - NoMovementTrigger(PlayerbotAI* ai, string name) : Trigger(ai, name) {} + NoMovementTrigger(PlayerbotAI* ai, std::string name) : Trigger(ai, name) {} virtual bool IsActive() override; }; @@ -750,7 +750,7 @@ namespace ai class HasItemForSpellTrigger : public Trigger { public: - HasItemForSpellTrigger(PlayerbotAI* ai, string spell) : Trigger(ai, spell) {} + HasItemForSpellTrigger(PlayerbotAI* ai, std::string spell) : Trigger(ai, spell) {} virtual bool IsActive() override; }; @@ -764,9 +764,9 @@ namespace ai class InterruptEnemyHealerTrigger : public SpellTrigger { public: - InterruptEnemyHealerTrigger(PlayerbotAI* ai, string spell) : SpellTrigger(ai, spell) {} + InterruptEnemyHealerTrigger(PlayerbotAI* ai, std::string spell) : SpellTrigger(ai, spell) {} virtual Value* GetTargetValue(); - virtual string getName() { return spell + " on enemy healer"; } + virtual std::string getName() { return spell + " on enemy healer"; } }; class RandomBotUpdateTrigger : public RandomTrigger @@ -789,7 +789,7 @@ namespace ai { return !ai->HasPlayerNearby(); /*if (!bot->InBattleGround()) - return AI_VALUE(list, "nearest non bot players").empty(); + return AI_VALUE(std::list, "nearest non bot players").empty(); else return false;*/ } @@ -820,7 +820,7 @@ namespace ai class StayTimeTrigger : public Trigger { public: - StayTimeTrigger(PlayerbotAI* ai, uint32 delay, string name) : Trigger(ai, name, 5), delay(delay) {} + StayTimeTrigger(PlayerbotAI* ai, uint32 delay, std::string name) : Trigger(ai, name, 5), delay(delay) {} virtual bool IsActive() override; @@ -859,7 +859,7 @@ namespace ai class GiveItemTrigger : public Trigger { public: - GiveItemTrigger(PlayerbotAI* ai, string name, string item) : Trigger(ai, name, 2), item(item) {} + GiveItemTrigger(PlayerbotAI* ai, std::string name, std::string item) : Trigger(ai, name, 2), item(item) {} virtual bool IsActive() { @@ -867,7 +867,7 @@ namespace ai } protected: - string item; + std::string item; }; class GiveFoodTrigger : public GiveItemTrigger @@ -932,7 +932,7 @@ namespace ai { public: UseTrinketTrigger(PlayerbotAI* ai) : Trigger(ai, "use trinket", 3) {} - virtual bool IsActive() { return !AI_VALUE(list, "trinkets on use").empty(); } + virtual bool IsActive() { return !AI_VALUE(std::list, "trinkets on use").empty(); } }; class HasAreaDebuffTrigger : public Trigger @@ -966,8 +966,8 @@ namespace ai if (AI_VALUE2(uint8, "health", "self target") > sPlayerbotAIConfig.almostFullHealth) return false; - list corpses = context->GetValue >("nearest corpses")->Get(); - for (list::iterator i = corpses.begin(); i != corpses.end(); i++) + std::list corpses = context->GetValue >("nearest corpses")->Get(); + for (std::list::iterator i = corpses.begin(); i != corpses.end(); i++) { if (!i->IsUnit()) continue; @@ -1143,7 +1143,7 @@ namespace ai virtual bool IsActive() { - for (auto& attacker : ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get()) + for (auto& attacker : ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get()) { Unit* enemy = ai->GetUnit(attacker); if (!enemy) @@ -1192,14 +1192,14 @@ namespace ai class BuffOnTargetTrigger : public Trigger { public: - BuffOnTargetTrigger(PlayerbotAI* ai, string name, uint32 buffID) + BuffOnTargetTrigger(PlayerbotAI* ai, std::string name, uint32 buffID) : Trigger(ai, name, 1) , buffID(buffID) {} virtual bool IsActive() override; protected: - virtual string GetTargetName() override { return "current target"; } + virtual std::string GetTargetName() override { return "current target"; } protected: uint32 buffID; @@ -1208,14 +1208,14 @@ namespace ai class DispelOnTargetTrigger : public Trigger { public: - DispelOnTargetTrigger(PlayerbotAI* ai, string name, DispelType dispelType, int checkInterval = 1) + DispelOnTargetTrigger(PlayerbotAI* ai, std::string name, DispelType dispelType, int checkInterval = 1) : Trigger(ai, name, checkInterval) , dispelType(dispelType) {} virtual bool IsActive() override; protected: - virtual string GetTargetName() override { return "current target"; } + virtual std::string GetTargetName() override { return "current target"; } private: DispelType dispelType; @@ -1224,7 +1224,7 @@ namespace ai class DispelEnrageOnTargetTrigger : public DispelOnTargetTrigger { public: - DispelEnrageOnTargetTrigger(PlayerbotAI* ai, string name = "dispel enrage") : DispelOnTargetTrigger(ai, name, DISPEL_ENRAGE) {} + DispelEnrageOnTargetTrigger(PlayerbotAI* ai, std::string name = "dispel enrage") : DispelOnTargetTrigger(ai, name, DISPEL_ENRAGE) {} }; class RtscJumpTrigger : public Trigger diff --git a/playerbot/strategy/triggers/GlyphTriggers.h b/playerbot/strategy/triggers/GlyphTriggers.h index 004da63d..f6b56a01 100644 --- a/playerbot/strategy/triggers/GlyphTriggers.h +++ b/playerbot/strategy/triggers/GlyphTriggers.h @@ -1,14 +1,14 @@ #pragma once #include "playerbot/playerbot.h" -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { class LearnGlyphTrigger : public Trigger { public: - LearnGlyphTrigger(PlayerbotAI* ai, string triggerName, int glyphId, int requiredSpellId = -1, int requiredLevel = -1, string requiredCombatStrategy = "") : Trigger(ai, triggerName, 60) { + LearnGlyphTrigger(PlayerbotAI* ai, std::string triggerName, int glyphId, int requiredSpellId = -1, int requiredLevel = -1, std::string requiredCombatStrategy = "") : Trigger(ai, triggerName, 60) { this->glyphId = glyphId; this->requiredSpellId = requiredSpellId; this->requiredLevel = requiredLevel; @@ -33,13 +33,13 @@ namespace ai private: int glyphId, requiredSpellId, requiredLevel; - string requiredCombatStrategy; + std::string requiredCombatStrategy; }; class RemoveGlyphTrigger : public Trigger { public: - RemoveGlyphTrigger(PlayerbotAI* ai, string triggerName, int glyphId, int requiredSpellId = -1, int requiredLevel = -1, string requiredCombatStrategy = "") : Trigger(ai, triggerName, 60) { + RemoveGlyphTrigger(PlayerbotAI* ai, std::string triggerName, int glyphId, int requiredSpellId = -1, int requiredLevel = -1, std::string requiredCombatStrategy = "") : Trigger(ai, triggerName, 60) { this->glyphId = glyphId; this->requiredSpellId = requiredSpellId; this->requiredLevel = requiredLevel; @@ -64,6 +64,6 @@ namespace ai private: int glyphId, requiredSpellId, requiredLevel; - string requiredCombatStrategy; + std::string requiredCombatStrategy; }; } \ No newline at end of file diff --git a/playerbot/strategy/triggers/GuildTriggers.h b/playerbot/strategy/triggers/GuildTriggers.h index 7c6a81a8..f4bab5fd 100644 --- a/playerbot/strategy/triggers/GuildTriggers.h +++ b/playerbot/strategy/triggers/GuildTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { diff --git a/playerbot/strategy/triggers/HealthTriggers.cpp b/playerbot/strategy/triggers/HealthTriggers.cpp index 5007d63f..74b5bd86 100644 --- a/playerbot/strategy/triggers/HealthTriggers.cpp +++ b/playerbot/strategy/triggers/HealthTriggers.cpp @@ -31,7 +31,7 @@ bool HealthInRangeTrigger::IsActive() healthCheck = healthPredict < maxValue && healthPredict >= minValue; if (healthCheck && ai->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT)) { - string msg = GetTargetName() + " hp: " + std::to_string(healthPercent) + ", predicted: " + std::to_string(healthPredict); + std::string msg = GetTargetName() + " hp: " + std::to_string(healthPercent) + ", predicted: " + std::to_string(healthPredict); ai->TellPlayerNoFacing(GetMaster(), msg); } } @@ -70,7 +70,7 @@ bool HealTargetFullHealthTrigger::IsActive() // Interrupt pre casted heals if target is not injured. if (PlayerbotAI::IsHealSpell(currentSpell->m_spellInfo)) { - string status = "fullhp"; + std::string status = "fullhp"; if (Unit* pTarget = currentSpell->m_targets.getUnitTarget()) { bool hpFull = pTarget->GetHealth() == pTarget->GetMaxHealth(); @@ -89,7 +89,7 @@ bool HealTargetFullHealthTrigger::IsActive() uint32 manaCost = currentSpell->GetPowerCost(); if (ai->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT)) { - string msg = "target " + status + ", can save " + std::to_string(manaCost) + " mana, cast left : " + std::to_string(currentSpell->GetCastedTime()) + "ms"; + std::string msg = "target " + status + ", can save " + std::to_string(manaCost) + " mana, cast left : " + std::to_string(currentSpell->GetCastedTime()) + "ms"; ai->TellPlayerNoFacing(GetMaster(), msg); } return true; diff --git a/playerbot/strategy/triggers/HealthTriggers.h b/playerbot/strategy/triggers/HealthTriggers.h index 390ad7e5..65f28c27 100644 --- a/playerbot/strategy/triggers/HealthTriggers.h +++ b/playerbot/strategy/triggers/HealthTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" #include "playerbot/PlayerbotAIConfig.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class ValueInRangeTrigger : public Trigger { public: - ValueInRangeTrigger(PlayerbotAI* ai, string name, float maxValue, float minValue) : Trigger(ai, name) + ValueInRangeTrigger(PlayerbotAI* ai, std::string name, float maxValue, float minValue) : Trigger(ai, name) { this->maxValue = maxValue; this->minValue = minValue; @@ -29,7 +29,7 @@ namespace ai class HealthInRangeTrigger : public ValueInRangeTrigger { public: - HealthInRangeTrigger(PlayerbotAI* ai, string name, float maxValue, float minValue = 0, bool isTankRequired = false) : ValueInRangeTrigger(ai, name, maxValue, minValue) + HealthInRangeTrigger(PlayerbotAI* ai, std::string name, float maxValue, float minValue = 0, bool isTankRequired = false) : ValueInRangeTrigger(ai, name, maxValue, minValue) { this->isTankRequired = isTankRequired; } @@ -44,11 +44,11 @@ namespace ai class LowHealthTrigger : public HealthInRangeTrigger { public: - LowHealthTrigger(PlayerbotAI* ai, string name = "low health", + LowHealthTrigger(PlayerbotAI* ai, std::string name = "low health", float value = sPlayerbotAIConfig.lowHealth, float minValue = sPlayerbotAIConfig.criticalHealth) : HealthInRangeTrigger(ai, name, value, minValue) {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } }; class CriticalHealthTrigger : public LowHealthTrigger @@ -75,10 +75,10 @@ namespace ai class PartyMemberLowHealthTrigger : public HealthInRangeTrigger { public: - PartyMemberLowHealthTrigger(PlayerbotAI* ai, string name = "party member low health", float value = sPlayerbotAIConfig.lowHealth, float minValue = sPlayerbotAIConfig.criticalHealth, bool isTankRequired = false) : + PartyMemberLowHealthTrigger(PlayerbotAI* ai, std::string name = "party member low health", float value = sPlayerbotAIConfig.lowHealth, float minValue = sPlayerbotAIConfig.criticalHealth, bool isTankRequired = false) : HealthInRangeTrigger(ai, name, value, minValue, isTankRequired) {} - virtual string GetTargetName() { return "party member to heal"; } + virtual std::string GetTargetName() { return "party member to heal"; } }; class PartyMemberCriticalHealthTrigger : public PartyMemberLowHealthTrigger @@ -106,7 +106,7 @@ namespace ai { public: TargetLowHealthTrigger(PlayerbotAI* ai, float value, float minValue = 0) : HealthInRangeTrigger(ai, "target low health", value, minValue) {} - virtual string GetTargetName() { return "current target"; } + virtual std::string GetTargetName() { return "current target"; } }; class TargetCriticalHealthTrigger : public TargetLowHealthTrigger @@ -119,7 +119,7 @@ namespace ai { public: PartyMemberDeadTrigger(PlayerbotAI* ai) : Trigger(ai, "resurrect", 3) {} - virtual string GetTargetName() { return "party member to resurrect"; } + virtual std::string GetTargetName() { return "party member to resurrect"; } virtual bool IsActive(); }; @@ -127,21 +127,21 @@ namespace ai { public: DeadTrigger(PlayerbotAI* ai) : Trigger(ai, "dead") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } virtual bool IsActive(); }; class AoeHealTrigger : public Trigger { public: - AoeHealTrigger(PlayerbotAI* ai, string name, string type, int count) : + AoeHealTrigger(PlayerbotAI* ai, std::string name, std::string type, int count) : Trigger(ai, name), type(type), count(count) {} public: virtual bool IsActive(); protected: int count; - string type; + std::string type; }; class HealTargetFullHealthTrigger : public Trigger diff --git a/playerbot/strategy/triggers/KarazhanDungeonTriggers.cpp b/playerbot/strategy/triggers/KarazhanDungeonTriggers.cpp index c360857a..aaf1fbbc 100644 --- a/playerbot/strategy/triggers/KarazhanDungeonTriggers.cpp +++ b/playerbot/strategy/triggers/KarazhanDungeonTriggers.cpp @@ -11,7 +11,7 @@ using namespace ai; bool NetherspiteBeamsCheatNeedRefreshTrigger::IsActive() { //Checking that is portal phase - list creatures; + std::list creatures; MaNGOS::AllCreaturesOfEntryInRangeCheck u_check(bot, 17369, 100); MaNGOS::UnitListSearcher searcher(creatures, u_check); Cell::VisitAllObjects(bot, searcher, 100); diff --git a/playerbot/strategy/triggers/LfgTriggers.h b/playerbot/strategy/triggers/LfgTriggers.h index 9cda5c2f..7294962c 100644 --- a/playerbot/strategy/triggers/LfgTriggers.h +++ b/playerbot/strategy/triggers/LfgTriggers.h @@ -1,6 +1,6 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { diff --git a/playerbot/strategy/triggers/LootTriggers.cpp b/playerbot/strategy/triggers/LootTriggers.cpp index 7903adb1..66194663 100644 --- a/playerbot/strategy/triggers/LootTriggers.cpp +++ b/playerbot/strategy/triggers/LootTriggers.cpp @@ -11,7 +11,7 @@ bool LootAvailableTrigger::IsActive() return AI_VALUE(bool, "has available loot") && ( sServerFacade.IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "loot target"), INTERACTION_DISTANCE) || - AI_VALUE(list, "all targets").empty() + AI_VALUE(std::list, "all targets").empty() ) && !AI_VALUE2(bool, "combat", "self target") && !AI_VALUE2(bool, "mounted", "self target"); diff --git a/playerbot/strategy/triggers/LootTriggers.h b/playerbot/strategy/triggers/LootTriggers.h index 4a561893..ae3c07e1 100644 --- a/playerbot/strategy/triggers/LootTriggers.h +++ b/playerbot/strategy/triggers/LootTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" #include "playerbot/strategy/values/LastMovementValue.h" namespace ai diff --git a/playerbot/strategy/triggers/PullTriggers.cpp b/playerbot/strategy/triggers/PullTriggers.cpp index 37be1996..944a0e20 100644 --- a/playerbot/strategy/triggers/PullTriggers.cpp +++ b/playerbot/strategy/triggers/PullTriggers.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "playerbot/strategy/Action.h" -#include "../generic/PullStrategy.h" +#include "playerbot/strategy/generic/PullStrategy.h" #include "PullTriggers.h" #include "playerbot/strategy/values/PositionValue.h" diff --git a/playerbot/strategy/triggers/PullTriggers.h b/playerbot/strategy/triggers/PullTriggers.h index b44dd6b3..8db23058 100644 --- a/playerbot/strategy/triggers/PullTriggers.h +++ b/playerbot/strategy/triggers/PullTriggers.h @@ -1,19 +1,19 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { class PullStartTrigger : public Trigger { public: - PullStartTrigger(PlayerbotAI* ai, string name = "pull start") : Trigger(ai, name) {} + PullStartTrigger(PlayerbotAI* ai, std::string name = "pull start") : Trigger(ai, name) {} bool IsActive() override; }; class PullEndTrigger : public Trigger { public: - PullEndTrigger(PlayerbotAI* ai, string name = "pull end") : Trigger(ai, name) {} + PullEndTrigger(PlayerbotAI* ai, std::string name = "pull end") : Trigger(ai, name) {} bool IsActive() override; }; } diff --git a/playerbot/strategy/triggers/PvpTriggers.cpp b/playerbot/strategy/triggers/PvpTriggers.cpp index f02b94a3..d7028973 100644 --- a/playerbot/strategy/triggers/PvpTriggers.cpp +++ b/playerbot/strategy/triggers/PvpTriggers.cpp @@ -233,7 +233,7 @@ bool PlayerWantsInBattlegroundTrigger::IsActive() bool VehicleNearTrigger::IsActive() { - list npcs = AI_VALUE(list, "nearest vehicles"); + std::list npcs = AI_VALUE(std::list, "nearest vehicles"); return npcs.size(); } diff --git a/playerbot/strategy/triggers/PvpTriggers.h b/playerbot/strategy/triggers/PvpTriggers.h index a23fec2a..01101f12 100644 --- a/playerbot/strategy/triggers/PvpTriggers.h +++ b/playerbot/strategy/triggers/PvpTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { diff --git a/playerbot/strategy/triggers/RangeTriggers.h b/playerbot/strategy/triggers/RangeTriggers.h index a0bca3f7..5a6a8355 100644 --- a/playerbot/strategy/triggers/RangeTriggers.h +++ b/playerbot/strategy/triggers/RangeTriggers.h @@ -1,8 +1,8 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/ServerFacade.h" -#include "../generic/CombatStrategy.h" +#include "playerbot/strategy/generic/CombatStrategy.h" #include "playerbot/strategy/values/PossibleAttackTargetsValue.h" #include "playerbot/strategy/values/Formations.h" @@ -173,7 +173,7 @@ namespace ai class EnemyInRangeTrigger : public Trigger { public: - EnemyInRangeTrigger(PlayerbotAI* ai, string name, float distance, bool enemyMustBePlayer = false, bool enemyTargetsBot = false) + EnemyInRangeTrigger(PlayerbotAI* ai, std::string name, float distance, bool enemyMustBePlayer = false, bool enemyTargetsBot = false) : Trigger(ai, name) , distance(distance) , enemyMustBePlayer(enemyMustBePlayer) @@ -215,7 +215,7 @@ namespace ai class OutOfRangeTrigger : public Trigger { public: - OutOfRangeTrigger(PlayerbotAI* ai, string name, float distance) : Trigger(ai, name) + OutOfRangeTrigger(PlayerbotAI* ai, std::string name, float distance) : Trigger(ai, name) { this->distance = distance; } @@ -227,7 +227,7 @@ namespace ai sServerFacade.IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance); } - virtual string GetTargetName() { return "current target"; } + virtual std::string GetTargetName() { return "current target"; } protected: float distance; @@ -267,7 +267,7 @@ namespace ai { public: PartyMemberToHealOutOfSpellRangeTrigger(PlayerbotAI* ai) : OutOfRangeTrigger(ai, "party member to heal out of spell range", ai->GetRange("heal")) {} - virtual string GetTargetName() { return "party member to heal"; } + virtual std::string GetTargetName() { return "party member to heal"; } virtual bool IsActive() { @@ -282,7 +282,7 @@ namespace ai class FarFromMasterTrigger : public Trigger { public: - FarFromMasterTrigger(PlayerbotAI* ai, string name = "far from master", float distance = 12.0f, int checkInterval = 50) : Trigger(ai, name, checkInterval), distance(distance) {} + FarFromMasterTrigger(PlayerbotAI* ai, std::string name = "far from master", float distance = 12.0f, int checkInterval = 50) : Trigger(ai, name, checkInterval), distance(distance) {} virtual bool IsActive() { @@ -305,13 +305,13 @@ namespace ai class OutOfReactRangeTrigger : public FarFromMasterTrigger { public: - OutOfReactRangeTrigger(PlayerbotAI* ai,string name = "out of react range", float distance = sPlayerbotAIConfig.reactDistance, int checkInterval = 2) : FarFromMasterTrigger(ai, name, distance, checkInterval) {} + OutOfReactRangeTrigger(PlayerbotAI* ai, std::string name = "out of react range", float distance = sPlayerbotAIConfig.reactDistance, int checkInterval = 2) : FarFromMasterTrigger(ai, name, distance, checkInterval) {} }; class NotNearMasterTrigger : public OutOfReactRangeTrigger { public: - NotNearMasterTrigger(PlayerbotAI* ai, string name = "not near master", int checkInterval = 2) : OutOfReactRangeTrigger(ai, name, 5.0f, checkInterval) {} + NotNearMasterTrigger(PlayerbotAI* ai, std::string name = "not near master", int checkInterval = 2) : OutOfReactRangeTrigger(ai, name, 5.0f, checkInterval) {} virtual bool IsActive() { @@ -400,7 +400,7 @@ namespace ai class WaitForAttackSafeDistanceTrigger : public Trigger { public: - WaitForAttackSafeDistanceTrigger(PlayerbotAI* ai, string name = "wait for attack safe distance") : Trigger(ai, name) {} + WaitForAttackSafeDistanceTrigger(PlayerbotAI* ai, std::string name = "wait for attack safe distance") : Trigger(ai, name) {} virtual bool IsActive() { diff --git a/playerbot/strategy/triggers/RpgTriggers.cpp b/playerbot/strategy/triggers/RpgTriggers.cpp index 60f60986..a91801af 100644 --- a/playerbot/strategy/triggers/RpgTriggers.cpp +++ b/playerbot/strategy/triggers/RpgTriggers.cpp @@ -30,7 +30,7 @@ bool RpgTaxiTrigger::IsActive() if (!bot->m_taxi.IsTaximaskNodeKnown(node)) return false; - vector nodes; + std::vector nodes; for (uint32 i = 0; i < sTaxiPathStore.GetNumRows(); ++i) { TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i); @@ -520,7 +520,7 @@ bool RpgCraftTrigger::IsActive() if (!guidP.GetWorldObject()) return false; - vector spellIds = AI_VALUE(vector, "craft spells"); + std::vector spellIds = AI_VALUE(std::vector, "craft spells"); for (uint32 spellId : spellIds) { @@ -599,7 +599,7 @@ bool RpgTradeUsefulTrigger::IsActive() if (bot->GetTrader() && bot->GetTrader() != player) return false; - if (AI_VALUE_LAZY(list, "items useful to give").empty()) + if (AI_VALUE_LAZY(std::list, "items useful to give").empty()) return false; return true; @@ -652,7 +652,7 @@ bool RpgDuelTrigger::IsActive() return false; } - if (!AI_VALUE(list, "all targets").empty()) + if (!AI_VALUE(std::list, "all targets").empty()) return false; return true; @@ -673,11 +673,11 @@ bool RpgItemTrigger::IsActive() else if (guidP.IsGameObject()) gameObject = guidP.GetGameObject(); - list questItems = AI_VALUE2(list, "inventory items", "quest"); + std::list questItems = AI_VALUE2(std::list, "inventory items", "quest"); for (auto item : questItems) { - if (AI_VALUE2(bool, "can use item on", Qualified::MultiQualify({ to_string(item->GetProto()->ItemId),guidP.to_string() }, ","))) + if (AI_VALUE2(bool, "can use item on", Qualified::MultiQualify({ std::to_string(item->GetProto()->ItemId),guidP.to_string() }, ","))) return true; } diff --git a/playerbot/strategy/triggers/RpgTriggers.h b/playerbot/strategy/triggers/RpgTriggers.h index 74b7d837..860b6f02 100644 --- a/playerbot/strategy/triggers/RpgTriggers.h +++ b/playerbot/strategy/triggers/RpgTriggers.h @@ -1,12 +1,12 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { class NoRpgTargetTrigger : public Trigger { public: - NoRpgTargetTrigger(PlayerbotAI* ai, string name = "no rpg target", int checkInterval = 10) : Trigger(ai, name, checkInterval) {} + NoRpgTargetTrigger(PlayerbotAI* ai, std::string name = "no rpg target", int checkInterval = 10) : Trigger(ai, name, checkInterval) {} virtual bool IsActive() { return !AI_VALUE(GuidPosition, "rpg target") || AI_VALUE2(float, "distance", "rpg target") > sPlayerbotAIConfig.reactDistance * 2; }; }; @@ -14,21 +14,21 @@ namespace ai class HasRpgTargetTrigger : public NoRpgTargetTrigger { public: - HasRpgTargetTrigger(PlayerbotAI* ai, string name = "has rpg target", int checkInterval = 2) : NoRpgTargetTrigger(ai, name, checkInterval) {} + HasRpgTargetTrigger(PlayerbotAI* ai, std::string name = "has rpg target", int checkInterval = 2) : NoRpgTargetTrigger(ai, name, checkInterval) {} - virtual bool IsActive() { return !NoRpgTargetTrigger::IsActive() && AI_VALUE(string, "next rpg action") != "choose rpg target"; }; //Ingore rpg targets that only have the cancel action available. + virtual bool IsActive() { return !NoRpgTargetTrigger::IsActive() && AI_VALUE(std::string, "next rpg action") != "choose rpg target"; }; //Ingore rpg targets that only have the cancel action available. }; class FarFromRpgTargetTrigger : public NoRpgTargetTrigger { public: - FarFromRpgTargetTrigger(PlayerbotAI* ai, string name = "far from rpg target", int checkInterval = 1) : NoRpgTargetTrigger(ai, name, checkInterval) {} + FarFromRpgTargetTrigger(PlayerbotAI* ai, std::string name = "far from rpg target", int checkInterval = 1) : NoRpgTargetTrigger(ai, name, checkInterval) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "far from rpg target"; } //Must equal iternal name - virtual string GetHelpDescription() { return "This trigger activates [h:strategy|no rpg target] is not active and is 5y away from it's current [h:value|rpg target].";} - virtual vector GetUsedTriggers() { return { "no rpg target" }; } - virtual vector GetUsedValues() { return {"distance", "rpg target"}; } + virtual std::string GetHelpName() { return "far from rpg target"; } //Must equal iternal name + virtual std::string GetHelpDescription() { return "This trigger activates [h:strategy|no rpg target] is not active and is 5y away from it's current [h:value|rpg target].";} + virtual std::vector GetUsedTriggers() { return { "no rpg target" }; } + virtual std::vector GetUsedValues() { return {"distance", "rpg target"}; } #endif virtual bool IsActive() { return !NoRpgTargetTrigger::IsActive() && AI_VALUE2(float, "distance", "rpg target") > INTERACTION_DISTANCE; }; @@ -37,7 +37,7 @@ namespace ai class NearRpgTargetTrigger : public FarFromRpgTargetTrigger { public: - NearRpgTargetTrigger(PlayerbotAI* ai, string name = "near rpg target", int checkInterval = 1) : FarFromRpgTargetTrigger(ai, name, checkInterval) {} + NearRpgTargetTrigger(PlayerbotAI* ai, std::string name = "near rpg target", int checkInterval = 1) : FarFromRpgTargetTrigger(ai, name, checkInterval) {} virtual bool IsActive() { return !NoRpgTargetTrigger::IsActive() && !FarFromRpgTargetTrigger::IsActive(); }; }; @@ -46,103 +46,103 @@ namespace ai class RpgTrigger : public FarFromRpgTargetTrigger { public: - RpgTrigger(PlayerbotAI* ai, string name = "rpg", int checkInterval = 2) : FarFromRpgTargetTrigger(ai, name, checkInterval) {} + RpgTrigger(PlayerbotAI* ai, std::string name = "rpg", int checkInterval = 2) : FarFromRpgTargetTrigger(ai, name, checkInterval) {} GuidPosition getGuidP() { return AI_VALUE(GuidPosition, "rpg target"); } virtual bool IsActive(); - virtual Event Check() { if (!NoRpgTargetTrigger::IsActive() && (AI_VALUE(string, "next rpg action") == "choose rpg target" || !FarFromRpgTargetTrigger::IsActive())) return Trigger::Check(); return Event(); }; + virtual Event Check() { if (!NoRpgTargetTrigger::IsActive() && (AI_VALUE(std::string, "next rpg action") == "choose rpg target" || !FarFromRpgTargetTrigger::IsActive())) return Trigger::Check(); return Event(); }; }; class RpgWanderTrigger : public RpgTrigger { public: - RpgWanderTrigger(PlayerbotAI* ai, string name = "rpg wander") : RpgTrigger(ai, name) {} + RpgWanderTrigger(PlayerbotAI* ai, std::string name = "rpg wander") : RpgTrigger(ai, name) {} virtual bool IsActive() { return ai->HasRealPlayerMaster() && (!bot->GetGroup() || !getGuidP().GetPlayer() || !bot->GetGroup()->IsMember(getGuidP())); }; }; class RpgTaxiTrigger : public RpgTrigger { public: - RpgTaxiTrigger(PlayerbotAI* ai, string name = "rpg taxi") : RpgTrigger(ai, name) {} + RpgTaxiTrigger(PlayerbotAI* ai, std::string name = "rpg taxi") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgDiscoverTrigger : public RpgTrigger { public: - RpgDiscoverTrigger(PlayerbotAI* ai, string name = "rpg discover") : RpgTrigger(ai, name) {} + RpgDiscoverTrigger(PlayerbotAI* ai, std::string name = "rpg discover") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgStartQuestTrigger : public RpgTrigger { public: - RpgStartQuestTrigger(PlayerbotAI* ai, string name = "rpg start quest") : RpgTrigger(ai, name) {} + RpgStartQuestTrigger(PlayerbotAI* ai, std::string name = "rpg start quest") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgEndQuestTrigger : public RpgTrigger { public: - RpgEndQuestTrigger(PlayerbotAI* ai, string name = "rpg end quest") : RpgTrigger(ai, name) {} + RpgEndQuestTrigger(PlayerbotAI* ai, std::string name = "rpg end quest") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgRepeatQuestTrigger : public RpgTrigger { public: - RpgRepeatQuestTrigger(PlayerbotAI* ai, string name = "rpg repeat quest") : RpgTrigger(ai, name) {} + RpgRepeatQuestTrigger(PlayerbotAI* ai, std::string name = "rpg repeat quest") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgBuyTrigger : public RpgTrigger { public: - RpgBuyTrigger(PlayerbotAI* ai, string name = "rpg buy") : RpgTrigger(ai, name) {} + RpgBuyTrigger(PlayerbotAI* ai, std::string name = "rpg buy") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgSellTrigger : public RpgTrigger { public: - RpgSellTrigger(PlayerbotAI* ai, string name = "rpg sell") : RpgTrigger(ai, name) {} + RpgSellTrigger(PlayerbotAI* ai, std::string name = "rpg sell") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgAHSellTrigger : public RpgTrigger { public: - RpgAHSellTrigger(PlayerbotAI* ai, string name = "rpg ah sell") : RpgTrigger(ai, name) {} + RpgAHSellTrigger(PlayerbotAI* ai, std::string name = "rpg ah sell") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgAHBuyTrigger : public RpgTrigger { public: - RpgAHBuyTrigger(PlayerbotAI* ai, string name = "rpg ah buy") : RpgTrigger(ai, name) {} + RpgAHBuyTrigger(PlayerbotAI* ai, std::string name = "rpg ah buy") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgGetMailTrigger : public RpgTrigger { public: - RpgGetMailTrigger(PlayerbotAI* ai, string name = "rpg get mail") : RpgTrigger(ai, name) {} + RpgGetMailTrigger(PlayerbotAI* ai, std::string name = "rpg get mail") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgRepairTrigger : public RpgTrigger { public: - RpgRepairTrigger(PlayerbotAI* ai, string name = "rpg repair") : RpgTrigger(ai, name) {} + RpgRepairTrigger(PlayerbotAI* ai, std::string name = "rpg repair") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgTrainTrigger : public RpgTrigger { public: - RpgTrainTrigger(PlayerbotAI* ai, string name = "rpg train") : RpgTrigger(ai, name) {} + RpgTrainTrigger(PlayerbotAI* ai, std::string name = "rpg train") : RpgTrigger(ai, name) {} static bool IsTrainerOf(CreatureInfo const* cInfo, Player* pPlayer); @@ -152,56 +152,56 @@ namespace ai class RpgHealTrigger : public RpgTrigger { public: - RpgHealTrigger(PlayerbotAI* ai, string name = "rpg heal") : RpgTrigger(ai, name) {} + RpgHealTrigger(PlayerbotAI* ai, std::string name = "rpg heal") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgHomeBindTrigger : public RpgTrigger { public: - RpgHomeBindTrigger(PlayerbotAI* ai, string name = "rpg home bind") : RpgTrigger(ai, name) {} + RpgHomeBindTrigger(PlayerbotAI* ai, std::string name = "rpg home bind") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgQueueBGTrigger : public RpgTrigger { public: - RpgQueueBGTrigger(PlayerbotAI* ai, string name = "rpg queue bg") : RpgTrigger(ai, name) {} + RpgQueueBGTrigger(PlayerbotAI* ai, std::string name = "rpg queue bg") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgBuyPetitionTrigger : public RpgTrigger { public: - RpgBuyPetitionTrigger(PlayerbotAI* ai, string name = "rpg buy petition") : RpgTrigger(ai, name) {} + RpgBuyPetitionTrigger(PlayerbotAI* ai, std::string name = "rpg buy petition") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgUseTrigger : public RpgTrigger { public: - RpgUseTrigger(PlayerbotAI* ai, string name = "rpg use") : RpgTrigger(ai, name) {} + RpgUseTrigger(PlayerbotAI* ai, std::string name = "rpg use") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgSpellTrigger : public RpgTrigger { public: - RpgSpellTrigger(PlayerbotAI* ai, string name = "rpg spell") : RpgTrigger(ai, name) {} + RpgSpellTrigger(PlayerbotAI* ai, std::string name = "rpg spell") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgCraftTrigger : public RpgTrigger { public: - RpgCraftTrigger(PlayerbotAI* ai, string name = "rpg craft") : RpgTrigger(ai, name) {} + RpgCraftTrigger(PlayerbotAI* ai, std::string name = "rpg craft") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgTradeUsefulTrigger : public RpgTrigger { public: - RpgTradeUsefulTrigger(PlayerbotAI* ai, string name = "rpg trade useful") : RpgTrigger(ai, name) {} + RpgTradeUsefulTrigger(PlayerbotAI* ai, std::string name = "rpg trade useful") : RpgTrigger(ai, name) {} virtual bool IsActive(); private: virtual bool isFriend(Player* player); //Move to value later. @@ -210,21 +210,21 @@ namespace ai class RpgDuelTrigger : public RpgTrigger { public: - RpgDuelTrigger(PlayerbotAI* ai, string name = "rpg duel") : RpgTrigger(ai, name) {} + RpgDuelTrigger(PlayerbotAI* ai, std::string name = "rpg duel") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RpgItemTrigger : public RpgTrigger { public: - RpgItemTrigger(PlayerbotAI* ai, string name = "rpg item") : RpgTrigger(ai, name) {} + RpgItemTrigger(PlayerbotAI* ai, std::string name = "rpg item") : RpgTrigger(ai, name) {} virtual bool IsActive(); }; class RandomJumpTrigger : public Trigger { public: - RandomJumpTrigger(PlayerbotAI* ai, string name = "random jump") : Trigger(ai, name, 2) {} + RandomJumpTrigger(PlayerbotAI* ai, std::string name = "random jump") : Trigger(ai, name, 2) {} bool IsActive() override; }; } diff --git a/playerbot/strategy/triggers/RtiTriggers.h b/playerbot/strategy/triggers/RtiTriggers.h index 384abd1a..d61bd788 100644 --- a/playerbot/strategy/triggers/RtiTriggers.h +++ b/playerbot/strategy/triggers/RtiTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/ServerFacade.h" #include "playerbot/strategy/values/RtiTargetValue.h" @@ -20,7 +20,7 @@ namespace ai else { // Check for the default rti if the bot is setup to ignore rti targets - string rti = AI_VALUE(string, "rti"); + std::string rti = AI_VALUE(std::string, "rti"); if (rti == "none") { Group* group = bot->GetGroup(); diff --git a/playerbot/strategy/triggers/StuckTriggers.h b/playerbot/strategy/triggers/StuckTriggers.h index 7b0af1ec..a905b8cb 100644 --- a/playerbot/strategy/triggers/StuckTriggers.h +++ b/playerbot/strategy/triggers/StuckTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" #include namespace ai diff --git a/playerbot/strategy/triggers/TravelTriggers.h b/playerbot/strategy/triggers/TravelTriggers.h index b677105a..78d7e275 100644 --- a/playerbot/strategy/triggers/TravelTriggers.h +++ b/playerbot/strategy/triggers/TravelTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { diff --git a/playerbot/strategy/triggers/WithinAreaTrigger.h b/playerbot/strategy/triggers/WithinAreaTrigger.h index 80afbcfa..b2e758fd 100644 --- a/playerbot/strategy/triggers/WithinAreaTrigger.h +++ b/playerbot/strategy/triggers/WithinAreaTrigger.h @@ -1,5 +1,5 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" #include "playerbot/strategy/values/LastMovementValue.h" namespace ai diff --git a/playerbot/strategy/triggers/WorldPacketTrigger.h b/playerbot/strategy/triggers/WorldPacketTrigger.h index 59141a99..cb619d2c 100644 --- a/playerbot/strategy/triggers/WorldPacketTrigger.h +++ b/playerbot/strategy/triggers/WorldPacketTrigger.h @@ -1,12 +1,12 @@ #pragma once -#include "../Trigger.h" +#include "playerbot/strategy/Trigger.h" namespace ai { class WorldPacketTrigger : public Trigger { public: - WorldPacketTrigger(PlayerbotAI* ai, string command) : Trigger(ai, command), triggered(false) {} + WorldPacketTrigger(PlayerbotAI* ai, std::string command) : Trigger(ai, command), triggered(false) {} virtual void ExternalEvent(WorldPacket &packet, Player* owner = NULL) { diff --git a/playerbot/strategy/values/ActiveSpellValue.h b/playerbot/strategy/values/ActiveSpellValue.h index 7873f09b..4ba928cb 100644 --- a/playerbot/strategy/values/ActiveSpellValue.h +++ b/playerbot/strategy/values/ActiveSpellValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class ActiveSpellValue : public CalculatedValue { public: - ActiveSpellValue(PlayerbotAI* ai, string name = "active spell") : CalculatedValue(ai, name) {} + ActiveSpellValue(PlayerbotAI* ai, std::string name = "active spell") : CalculatedValue(ai, name) {} virtual uint32 Calculate(); }; diff --git a/playerbot/strategy/values/AlwaysLootListValue.cpp b/playerbot/strategy/values/AlwaysLootListValue.cpp index ae2843a3..b4607495 100644 --- a/playerbot/strategy/values/AlwaysLootListValue.cpp +++ b/playerbot/strategy/values/AlwaysLootListValue.cpp @@ -6,11 +6,11 @@ using namespace ai; -string AlwaysLootListValue::Save() +std::string AlwaysLootListValue::Save() { - ostringstream out; + std::ostringstream out; bool first = true; - for (set::iterator i = value.begin(); i != value.end(); ++i) + for (std::set::iterator i = value.begin(); i != value.end(); ++i) { if (!first) out << ","; else first = false; @@ -19,12 +19,12 @@ string AlwaysLootListValue::Save() return out.str(); } -bool AlwaysLootListValue::Load(string text) +bool AlwaysLootListValue::Load(std::string text) { value.clear(); - vector ss = split(text, ','); - for (vector::iterator i = ss.begin(); i != ss.end(); ++i) + std::vector ss = split(text, ','); + for (std::vector::iterator i = ss.begin(); i != ss.end(); ++i) { value.insert(atoi(i->c_str())); } diff --git a/playerbot/strategy/values/AlwaysLootListValue.h b/playerbot/strategy/values/AlwaysLootListValue.h index 83b5c001..917ac1f3 100644 --- a/playerbot/strategy/values/AlwaysLootListValue.h +++ b/playerbot/strategy/values/AlwaysLootListValue.h @@ -1,17 +1,17 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { - class AlwaysLootListValue : public ManualSetValue&> + class AlwaysLootListValue : public ManualSetValue&> { public: - AlwaysLootListValue(PlayerbotAI* ai, string name = "always loot list") : ManualSetValue&>(ai, list, name) {} + AlwaysLootListValue(PlayerbotAI* ai, std::string name = "always loot list") : ManualSetValue&>(ai, list, name) {} - virtual string Save(); - virtual bool Load(string value); + virtual std::string Save(); + virtual bool Load(std::string value); private: - set list; + std::set list; }; } diff --git a/playerbot/strategy/values/AoeHealValues.h b/playerbot/strategy/values/AoeHealValues.h index 946fc701..61b068e3 100644 --- a/playerbot/strategy/values/AoeHealValues.h +++ b/playerbot/strategy/values/AoeHealValues.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class AoeHealValue : public Uint8CalculatedValue, public Qualified { public: - AoeHealValue(PlayerbotAI* ai, string name = "aoe heal") : Uint8CalculatedValue(ai, name, 3), Qualified() {} + AoeHealValue(PlayerbotAI* ai, std::string name = "aoe heal") : Uint8CalculatedValue(ai, name, 3), Qualified() {} public: virtual uint8 Calculate(); diff --git a/playerbot/strategy/values/AoeValues.cpp b/playerbot/strategy/values/AoeValues.cpp index c6e73a63..6ed093a0 100644 --- a/playerbot/strategy/values/AoeValues.cpp +++ b/playerbot/strategy/values/AoeValues.cpp @@ -6,16 +6,16 @@ #include "playerbot/ServerFacade.h" using namespace ai; -list AoeCountValue::FindMaxDensity(Player* bot, float range) +std::list AoeCountValue::FindMaxDensity(Player* bot, float range) { int maxCount = 0; ObjectGuid maxGroup; - map > groups; + std::map > groups; if (bot) { - list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue>("attackers"); + std::list units = *bot->GetPlayerbotAI()->GetAiObjectContext()->GetValue>("attackers"); - for (list::iterator i = units.begin(); i != units.end(); ++i) + for (std::list::iterator i = units.begin(); i != units.end(); ++i) { Unit* unit = bot->GetPlayerbotAI()->GetUnit(*i); if (unit) @@ -23,7 +23,7 @@ list AoeCountValue::FindMaxDensity(Player* bot, float range) float distanceToPlayer = sServerFacade.GetDistance2d(unit, bot); if (sServerFacade.IsDistanceLessOrEqualThan(distanceToPlayer, range)) { - for (list::iterator j = units.begin(); j != units.end(); ++j) + for (std::list::iterator j = units.begin(); j != units.end(); ++j) { Unit* other = bot->GetPlayerbotAI()->GetUnit(*j); if (other) @@ -48,7 +48,7 @@ list AoeCountValue::FindMaxDensity(Player* bot, float range) if (!maxCount) { - return list(); + return std::list(); } return groups[maxGroup]; @@ -56,13 +56,13 @@ list AoeCountValue::FindMaxDensity(Player* bot, float range) WorldLocation AoePositionValue::Calculate() { - list group = AoeCountValue::FindMaxDensity(bot); + std::list group = AoeCountValue::FindMaxDensity(bot); if (group.empty()) return WorldLocation(); // Note: don't know where these values come from or even used. float x1, y1, x2, y2; - for (list::iterator i = group.begin(); i != group.end(); ++i) + for (std::list::iterator i = group.begin(); i != group.end(); ++i) { Unit* unit = bot->GetPlayerbotAI()->GetUnit(*i); if (!unit) @@ -98,11 +98,11 @@ bool HasAreaDebuffValue::Calculate() if (!checkTarget) return false; - list nearestDynObjects = *context->GetValue >("nearest dynamic objects no los"); + std::list nearestDynObjects = *context->GetValue >("nearest dynamic objects no los"); if (nearestDynObjects.empty()) return false; - for (list::iterator i = nearestDynObjects.begin(); i != nearestDynObjects.end(); ++i) + for (std::list::iterator i = nearestDynObjects.begin(); i != nearestDynObjects.end(); ++i) { DynamicObject* go = checkTarget->GetMap()->GetDynamicObject(*i); if (!go) diff --git a/playerbot/strategy/values/AoeValues.h b/playerbot/strategy/values/AoeValues.h index d4074c11..c4893bf0 100644 --- a/playerbot/strategy/values/AoeValues.h +++ b/playerbot/strategy/values/AoeValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -18,7 +18,7 @@ namespace ai AoeCountValue(PlayerbotAI* ai) : CalculatedValue(ai, "aoe count") {} public: - static list FindMaxDensity(Player* bot, float range = 100.0f); + static std::list FindMaxDensity(Player* bot, float range = 100.0f); virtual uint8 Calculate(); }; diff --git a/playerbot/strategy/values/Arrow.cpp b/playerbot/strategy/values/Arrow.cpp index 855448bd..d3d40e14 100644 --- a/playerbot/strategy/values/Arrow.cpp +++ b/playerbot/strategy/values/Arrow.cpp @@ -1,4 +1,3 @@ -#include "../../../botpch.h" #include "playerbot/playerbot.h" #include "Formations.h" #include "Arrow.h" @@ -127,7 +126,7 @@ void FormationSlot::PlaceUnits(UnitPlacer* placer) { uint32 index = 0; uint32 count = units.size(); - for (vector::iterator i = units.begin(); i != units.end(); ++i) + for (std::vector::iterator i = units.begin(); i != units.end(); ++i) { FormationUnit* unit = *i; unit->SetLocation(placer->Place(unit, index, count)); @@ -143,7 +142,7 @@ UnitPosition MultiLineUnitPlacer::Place(FormationUnit *unit, uint32 index, uint3 int lineNo = index / 6; int indexInLine = index % 6; - int lineSize = max(count - lineNo * 6, uint32(6)); + int lineSize = std::max(count - lineNo * 6, uint32(6)); float x = cos(orientation) * range * lineNo; float y = sin(orientation) * range * lineNo; return placer.Place(unit, indexInLine, lineSize); @@ -159,7 +158,7 @@ UnitPosition SingleLineUnitPlacer::Place(FormationUnit *unit, uint32 index, uint void FormationSlot::Move(float dx, float dy) { - for (vector::iterator i = units.begin(); i != units.end(); ++i) + for (std::vector::iterator i = units.begin(); i != units.end(); ++i) { FormationUnit* unit = *i; unit->SetLocation(unit->GetX() + dx, unit->GetY() + dy); @@ -168,7 +167,7 @@ void FormationSlot::Move(float dx, float dy) FormationSlot::~FormationSlot() { - for (vector::iterator i = units.begin(); i != units.end(); ++i) + for (std::vector::iterator i = units.begin(); i != units.end(); ++i) { FormationUnit* unit = *i; delete unit; diff --git a/playerbot/strategy/values/Arrow.h b/playerbot/strategy/values/Arrow.h index 48f496be..e128fd03 100644 --- a/playerbot/strategy/values/Arrow.h +++ b/playerbot/strategy/values/Arrow.h @@ -59,7 +59,7 @@ namespace ai private: WorldLocation center; - vector units; + std::vector units; }; diff --git a/playerbot/strategy/values/AttackerCountValues.cpp b/playerbot/strategy/values/AttackerCountValues.cpp index 6daf966d..e68fa922 100644 --- a/playerbot/strategy/values/AttackerCountValues.cpp +++ b/playerbot/strategy/values/AttackerCountValues.cpp @@ -60,22 +60,22 @@ bool HasAggroValue::Calculate() uint8 AttackersCountValue::Calculate() { - return context->GetValue>("attackers")->Get().size(); + return context->GetValue>("attackers")->Get().size(); } uint8 PossibleAttackTargetsCountValue::Calculate() { - return context->GetValue>("possible attack targets")->Get().size(); + return context->GetValue>("possible attack targets")->Get().size(); } bool HasAttackersValue::Calculate() { - return !context->GetValue>("attackers", 1)->Get().empty(); + return !context->GetValue>("attackers", 1)->Get().empty(); } bool HasPossibleAttackTargetsValue::Calculate() { - return !context->GetValue>("possible attack targets", 1)->Get().empty(); + return !context->GetValue>("possible attack targets", 1)->Get().empty(); } uint8 BalancePercentValue::Calculate() @@ -102,8 +102,8 @@ uint8 BalancePercentValue::Calculate() } } - list v = context->GetValue>("possible attack targets")->Get(); - for (list::iterator i = v.begin(); i!=v.end(); i++) + std::list v = context->GetValue>("possible attack targets")->Get(); + for (std::list::iterator i = v.begin(); i!=v.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit || !sServerFacade.IsAlive(unit)) diff --git a/playerbot/strategy/values/AttackerCountValues.h b/playerbot/strategy/values/AttackerCountValues.h index be3dde9d..34af16df 100644 --- a/playerbot/strategy/values/AttackerCountValues.h +++ b/playerbot/strategy/values/AttackerCountValues.h @@ -6,35 +6,35 @@ namespace ai class AttackersCountValue : public Uint8CalculatedValue, public Qualified { public: - AttackersCountValue(PlayerbotAI* ai, string name = "attackers count") : Uint8CalculatedValue(ai, name, 4), Qualified() {} + AttackersCountValue(PlayerbotAI* ai, std::string name = "attackers count") : Uint8CalculatedValue(ai, name, 4), Qualified() {} virtual uint8 Calculate(); }; class PossibleAttackTargetsCountValue : public Uint8CalculatedValue, public Qualified { public: - PossibleAttackTargetsCountValue(PlayerbotAI* ai, string name = "possible attack targets count") : Uint8CalculatedValue(ai, name, 4), Qualified() {} + PossibleAttackTargetsCountValue(PlayerbotAI* ai, std::string name = "possible attack targets count") : Uint8CalculatedValue(ai, name, 4), Qualified() {} virtual uint8 Calculate(); }; class HasAttackersValue : public BoolCalculatedValue, public Qualified { public: - HasAttackersValue(PlayerbotAI* ai, string name = "has attackers") : BoolCalculatedValue(ai, name, 4), Qualified() {} + HasAttackersValue(PlayerbotAI* ai, std::string name = "has attackers") : BoolCalculatedValue(ai, name, 4), Qualified() {} virtual bool Calculate(); }; class HasPossibleAttackTargetsValue : public BoolCalculatedValue, public Qualified { public: - HasPossibleAttackTargetsValue(PlayerbotAI* ai, string name = "has possible attack targets") : BoolCalculatedValue(ai, name, 4), Qualified() {} + HasPossibleAttackTargetsValue(PlayerbotAI* ai, std::string name = "has possible attack targets") : BoolCalculatedValue(ai, name, 4), Qualified() {} virtual bool Calculate(); }; class MyAttackerCountValue : public Uint8CalculatedValue, public Qualified { public: - MyAttackerCountValue(PlayerbotAI* ai, string name = "my attackers count") : Uint8CalculatedValue(ai, name, 4), Qualified() {} + MyAttackerCountValue(PlayerbotAI* ai, std::string name = "my attackers count") : Uint8CalculatedValue(ai, name, 4), Qualified() {} Unit* GetTarget() { @@ -47,7 +47,7 @@ namespace ai class HasAggroValue : public BoolCalculatedValue, public Qualified { public: - HasAggroValue(PlayerbotAI* ai, string name = "has agro") : BoolCalculatedValue(ai, name, 4), Qualified() {} + HasAggroValue(PlayerbotAI* ai, std::string name = "has agro") : BoolCalculatedValue(ai, name, 4), Qualified() {} Unit* GetTarget() { @@ -60,7 +60,7 @@ namespace ai class BalancePercentValue : public Uint8CalculatedValue, public Qualified { public: - BalancePercentValue(PlayerbotAI* ai, string name = "balance percentage") : Uint8CalculatedValue(ai, name, 4), Qualified() {} + BalancePercentValue(PlayerbotAI* ai, std::string name = "balance percentage") : Uint8CalculatedValue(ai, name, 4), Qualified() {} Unit* GetTarget() { diff --git a/playerbot/strategy/values/AttackerWithoutAuraTargetValue.cpp b/playerbot/strategy/values/AttackerWithoutAuraTargetValue.cpp index df66c572..751e0f93 100644 --- a/playerbot/strategy/values/AttackerWithoutAuraTargetValue.cpp +++ b/playerbot/strategy/values/AttackerWithoutAuraTargetValue.cpp @@ -7,9 +7,9 @@ using namespace ai; Unit* AttackerWithoutAuraTargetValue::Calculate() { - list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); + std::list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); Unit* target = ai->GetAiObjectContext()->GetValue("current target")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (!unit || unit == target) diff --git a/playerbot/strategy/values/AttackerWithoutAuraTargetValue.h b/playerbot/strategy/values/AttackerWithoutAuraTargetValue.h index 74a14d00..3a046de5 100644 --- a/playerbot/strategy/values/AttackerWithoutAuraTargetValue.h +++ b/playerbot/strategy/values/AttackerWithoutAuraTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/AttackersValue.cpp b/playerbot/strategy/values/AttackersValue.cpp index 260114f5..373bf57f 100644 --- a/playerbot/strategy/values/AttackersValue.cpp +++ b/playerbot/strategy/values/AttackersValue.cpp @@ -7,9 +7,9 @@ using namespace ai; using namespace MaNGOS; -list AttackersValue::Calculate() +std::list AttackersValue::Calculate() { - list result; + std::list result; if (!ai->AllowActivity(ALL_ACTIVITY)) return result; @@ -25,7 +25,7 @@ list AttackersValue::Calculate() if (!sPlayerbotAIConfig.tweakValue) { // Try to get the value from nearby friendly bots. - list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); + std::list nearGuids = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); for (auto& i : nearGuids) { Player* player = sObjectMgr.GetPlayer(i); @@ -47,7 +47,7 @@ list AttackersValue::Calculate() if (!botAi) continue; - string valueName = "attackers" + !qualifier.empty() ? "::" + qualifier : ""; + std::string valueName = "attackers" + !qualifier.empty() ? "::" + qualifier : ""; // Ignore bots without the value. if (!PHAS_AI_VALUE(valueName)) @@ -72,9 +72,9 @@ list AttackersValue::Calculate() calculatePos = pAttackersValue->calculatePos; - result = PAI_VALUE(list, valueName); + result = PAI_VALUE(std::list, valueName); - vector specificTargetNames = { "current target","old target","attack target","pull target" }; + std::vector specificTargetNames = { "current target","old target","attack target","pull target" }; Unit* target; //Remove bot specific targets of the other bot. @@ -99,7 +99,7 @@ list AttackersValue::Calculate() calculatePos = bot; - set targets; + std::set targets; // Check if we only need one attacker bool getOne = false; @@ -108,7 +108,7 @@ list AttackersValue::Calculate() getOne = stoi(qualifier); } - set invalidTargets; + std::set invalidTargets; // Add the targets of the bot AddTargetsOf(bot, targets, invalidTargets, getOne); @@ -137,7 +137,7 @@ list AttackersValue::Calculate() return result; } -void AttackersValue::AddTargetsOf(Group* group, set& targets, set& invalidTargets, bool getOne) +void AttackersValue::AddTargetsOf(Group* group, std::set& targets, std::set& invalidTargets, bool getOne) { Group::MemberSlotList const& groupSlot = group->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) @@ -162,12 +162,12 @@ void AttackersValue::AddTargetsOf(Group* group, set& targets, set& targets, set& invalidTargets, bool getOne) +void AttackersValue::AddTargetsOf(Player* player, std::set& targets, std::set& invalidTargets, bool getOne) { // If the player is available if (ai->IsSafe(player)) { - set units; + std::set units; // If the player is a bot PlayerbotAI* playerBot = player->GetPlayerbotAI(); @@ -175,10 +175,10 @@ void AttackersValue::AddTargetsOf(Player* player, set& targets, set qualifiers = { range, ignoreValidate }; - const list possibleTargets = PAI_VALUE2(list, "possible targets", Qualified::MultiQualify(qualifiers, ":")); + const std::string ignoreValidate = std::to_string(true); + const std::string range = std::to_string((int32)GetRange()); + const std::vector qualifiers = { range, ignoreValidate }; + const std::list possibleTargets = PAI_VALUE2(std::list, "possible targets", Qualified::MultiQualify(qualifiers, ":")); for (const ObjectGuid& guid : possibleTargets) { if (Unit* unit = ai->GetUnit(guid)) @@ -371,9 +371,9 @@ bool AttackersValue::IsValid(Unit* target, Player* player, Player* owner, bool c return true; } -string AttackersValue::Format() +std::string AttackersValue::Format() { - ostringstream out; + std::ostringstream out; for (auto& target : value) { @@ -395,7 +395,7 @@ std::list AttackersTargetingMeValue::Calculate() { std::list result; - const list& attackers = AI_VALUE(list, "attackers"); + const std::list& attackers = AI_VALUE(std::list, "attackers"); for (const ObjectGuid& attackerGuid : attackers) { Unit* attacker = ai->GetUnit(attackerGuid); diff --git a/playerbot/strategy/values/AttackersValue.h b/playerbot/strategy/values/AttackersValue.h index 62e8de37..a46d1b05 100644 --- a/playerbot/strategy/values/AttackersValue.h +++ b/playerbot/strategy/values/AttackersValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/PlayerbotAIConfig.h" namespace ai @@ -9,35 +9,35 @@ namespace ai { struct AddGuardiansHelper { - explicit AddGuardiansHelper(set& units) : units(units) {} + explicit AddGuardiansHelper(std::set& units) : units(units) {} void operator()(Unit* target) const { units.insert(target); } - set& units; + std::set& units; }; public: - AttackersValue(PlayerbotAI* ai, string name = "attackers", int interval = 2) : ObjectGuidListCalculatedValue(ai, name, interval), Qualified() {} - virtual list Calculate() override; + AttackersValue(PlayerbotAI* ai, std::string name = "attackers", int interval = 2) : ObjectGuidListCalculatedValue(ai, name, interval), Qualified() {} + virtual std::list Calculate() override; static bool IsValid(Unit* target, Player* player, Player* owner = nullptr, bool checkInCombat = true, bool validatePossibleTarget = true); - virtual string Format(); + virtual std::string Format(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "attackers"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "combat"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "attackers"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "combat"; } + virtual std::string GetHelpDescription() { return "This value contains all the units attacking the player, it's group or those the player or group is attacking."; } - virtual vector GetUsedValues() { return {"possible targets", "current target" , "attack target" , "pull target" }; } + virtual std::vector GetUsedValues() { return {"possible targets", "current target" , "attack target" , "pull target" }; } #endif private: - void AddTargetsOf(Group* group, set& targets, set& invalidTargets, bool getOne = false); - void AddTargetsOf(Player* player, set& targets, set& invalidTargets, bool getOne = false); + void AddTargetsOf(Group* group, std::set& targets, std::set& invalidTargets, bool getOne = false); + void AddTargetsOf(Player* player, std::set& targets, std::set& invalidTargets, bool getOne = false); static float GetRange() { return sPlayerbotAIConfig.sightDistance; } static bool InCombat(Unit* target, Player* player, bool checkPullTargets = true); @@ -49,7 +49,7 @@ namespace ai class AttackersTargetingMeValue : public ObjectGuidListCalculatedValue { public: - AttackersTargetingMeValue(PlayerbotAI* ai, string name = "attackers targeting me") : ObjectGuidListCalculatedValue(ai, name) {} - list Calculate() override; + AttackersTargetingMeValue(PlayerbotAI* ai, std::string name = "attackers targeting me") : ObjectGuidListCalculatedValue(ai, name) {} + std::list Calculate() override; }; } diff --git a/playerbot/strategy/values/AvailableLootValue.h b/playerbot/strategy/values/AvailableLootValue.h index ce099620..57c0f413 100644 --- a/playerbot/strategy/values/AvailableLootValue.h +++ b/playerbot/strategy/values/AvailableLootValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/LootObjectStack.h" #include "playerbot/ServerFacade.h" @@ -9,7 +9,7 @@ namespace ai class AvailableLootValue : public ManualSetValue { public: - AvailableLootValue(PlayerbotAI* ai, string name = "available loot") : ManualSetValue(ai, NULL, name) + AvailableLootValue(PlayerbotAI* ai, std::string name = "available loot") : ManualSetValue(ai, NULL, name) { value = new LootObjectStack(ai->GetBot()); } @@ -24,13 +24,13 @@ namespace ai class LootTargetValue : public ManualSetValue { public: - LootTargetValue(PlayerbotAI* ai, string name = "loot target") : ManualSetValue(ai, LootObject(), name) {} + LootTargetValue(PlayerbotAI* ai, std::string name = "loot target") : ManualSetValue(ai, LootObject(), name) {} }; class CanLootValue : public BoolCalculatedValue { public: - CanLootValue(PlayerbotAI* ai, string name = "can loot") : BoolCalculatedValue(ai, name) {} + CanLootValue(PlayerbotAI* ai, std::string name = "can loot") : BoolCalculatedValue(ai, name) {} virtual bool Calculate() { diff --git a/playerbot/strategy/values/BudgetValues.h b/playerbot/strategy/values/BudgetValues.h index 8a9e6ce7..1b198c02 100644 --- a/playerbot/strategy/values/BudgetValues.h +++ b/playerbot/strategy/values/BudgetValues.h @@ -1,8 +1,7 @@ #pragma once -#include "../Value.h" -#include "../NamedObjectContext.h" -#include "../../../botpch.h" +#include "playerbot/strategy/Value.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "playerbot/playerbot.h" namespace ai @@ -51,7 +50,7 @@ namespace ai TotalMoneyNeededForValue(PlayerbotAI* ai) : Uint32CalculatedValue(ai, "total money needed for", 60), Qualified() {} virtual uint32 Calculate(); private: - vector saveMoneyFor = { NeedMoneyFor::repair,NeedMoneyFor::ammo, NeedMoneyFor::ah, NeedMoneyFor::guild, NeedMoneyFor::spells, NeedMoneyFor::travel }; + std::vector saveMoneyFor = { NeedMoneyFor::repair,NeedMoneyFor::ammo, NeedMoneyFor::ah, NeedMoneyFor::guild, NeedMoneyFor::spells, NeedMoneyFor::travel }; }; class FreeMoneyForValue : public Uint32CalculatedValue, public Qualified diff --git a/playerbot/strategy/values/CcTargetValue.cpp b/playerbot/strategy/values/CcTargetValue.cpp index 8f373265..b4ba2085 100644 --- a/playerbot/strategy/values/CcTargetValue.cpp +++ b/playerbot/strategy/values/CcTargetValue.cpp @@ -10,7 +10,7 @@ using namespace ai; class FindTargetForCcStrategy : public FindTargetStrategy { public: - FindTargetForCcStrategy(PlayerbotAI* ai, string spell) : FindTargetStrategy(ai) + FindTargetForCcStrategy(PlayerbotAI* ai, std::string spell) : FindTargetStrategy(ai) { this->spell = spell; maxDistance = 0; @@ -91,15 +91,15 @@ class FindTargetForCcStrategy : public FindTargetStrategy } private: - string spell; + std::string spell; float maxDistance; }; Unit* CcTargetValue::Calculate() { - list possible = AI_VALUE(list,"possible targets no los"); + std::list possible = AI_VALUE(std::list,"possible targets no los"); - for (list::iterator i = possible.begin(); i != possible.end(); ++i) + for (std::list::iterator i = possible.begin(); i != possible.end(); ++i) { ObjectGuid guid = *i; Unit* add = ai->GetUnit(guid); diff --git a/playerbot/strategy/values/CcTargetValue.h b/playerbot/strategy/values/CcTargetValue.h index 89573716..e667e7cd 100644 --- a/playerbot/strategy/values/CcTargetValue.h +++ b/playerbot/strategy/values/CcTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" namespace ai @@ -8,7 +8,7 @@ namespace ai class CcTargetValue : public TargetValue, public Qualified { public: - CcTargetValue(PlayerbotAI* ai, string name = "cc target") : TargetValue(ai, name), Qualified() {} + CcTargetValue(PlayerbotAI* ai, std::string name = "cc target") : TargetValue(ai, name), Qualified() {} public: Unit* Calculate(); diff --git a/playerbot/strategy/values/ChatValue.h b/playerbot/strategy/values/ChatValue.h index b98aabda..f9d72656 100644 --- a/playerbot/strategy/values/ChatValue.h +++ b/playerbot/strategy/values/ChatValue.h @@ -1,11 +1,11 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class ChatValue : public ManualSetValue { public: - ChatValue(PlayerbotAI* ai, string name = "chat") : ManualSetValue(ai, CHAT_MSG_WHISPER, name) {} + ChatValue(PlayerbotAI* ai, std::string name = "chat") : ManualSetValue(ai, CHAT_MSG_WHISPER, name) {} }; } diff --git a/playerbot/strategy/values/CollisionValue.cpp b/playerbot/strategy/values/CollisionValue.cpp index ebb32dff..4c3908d5 100644 --- a/playerbot/strategy/values/CollisionValue.cpp +++ b/playerbot/strategy/values/CollisionValue.cpp @@ -16,13 +16,13 @@ bool CollisionValue::Calculate() if (!target) return false; - list targets; + std::list targets; float range = sPlayerbotAIConfig.contactDistance; MaNGOS::AnyUnitInObjectRangeCheck u_check(bot, range); MaNGOS::UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(bot, searcher, range); - for (list::iterator i = targets.begin(); i != targets.end(); ++i) + for (std::list::iterator i = targets.begin(); i != targets.end(); ++i) { Unit* target = *i; if (bot == target) continue; diff --git a/playerbot/strategy/values/CollisionValue.h b/playerbot/strategy/values/CollisionValue.h index f74d7ae1..7a3fc63a 100644 --- a/playerbot/strategy/values/CollisionValue.h +++ b/playerbot/strategy/values/CollisionValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class CollisionValue : public BoolCalculatedValue, public Qualified { public: - CollisionValue(PlayerbotAI* ai, string name = "collision") : BoolCalculatedValue(ai, name), Qualified() {} + CollisionValue(PlayerbotAI* ai, std::string name = "collision") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate(); }; diff --git a/playerbot/strategy/values/CombatStartTimeValue.h b/playerbot/strategy/values/CombatStartTimeValue.h index cd53e3a5..513147af 100644 --- a/playerbot/strategy/values/CombatStartTimeValue.h +++ b/playerbot/strategy/values/CombatStartTimeValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/CraftValues.cpp b/playerbot/strategy/values/CraftValues.cpp index 107573d0..781a6c73 100644 --- a/playerbot/strategy/values/CraftValues.cpp +++ b/playerbot/strategy/values/CraftValues.cpp @@ -5,9 +5,9 @@ using namespace ai; -vector CraftSpellsValue::Calculate() +std::vector CraftSpellsValue::Calculate() { - vector spellIds; + std::vector spellIds; PlayerSpellMap const& spellMap = bot->GetSpellMap(); @@ -96,7 +96,7 @@ bool ShouldCraftSpellValue::Calculate() { if (pSpellInfo->EffectItemType[i]) { - ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", to_string(pSpellInfo->EffectItemType[i])); + ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", std::to_string(pSpellInfo->EffectItemType[i])); bool needItem = false; diff --git a/playerbot/strategy/values/CraftValues.h b/playerbot/strategy/values/CraftValues.h index 20ab2642..46368335 100644 --- a/playerbot/strategy/values/CraftValues.h +++ b/playerbot/strategy/values/CraftValues.h @@ -1,6 +1,6 @@ #pragma once -#include "../Value.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/Value.h" +#include "playerbot/strategy/NamedObjectContext.h" namespace ai { @@ -21,7 +21,7 @@ namespace ai bool IsFulfilled() { - for (map::iterator i = required.begin(); i != required.end(); ++i) + for (std::map::iterator i = required.begin(); i != required.end(); ++i) { uint32 item = i->first; if (obtained[item] < i->second) @@ -41,7 +41,7 @@ namespace ai void Crafted(uint32 count) { - for (map::iterator i = required.begin(); i != required.end(); ++i) + for (std::map::iterator i = required.begin(); i != required.end(); ++i) { uint32 item = i->first; if (obtained[item] >= required[item] * (int)count) @@ -53,43 +53,43 @@ namespace ai public: uint32 itemId; - map required, obtained; + std::map required, obtained; }; class CraftValue : public ManualSetValue { public: - CraftValue(PlayerbotAI* ai, string name = "craft") : ManualSetValue(ai, data, name) {} + CraftValue(PlayerbotAI* ai, std::string name = "craft") : ManualSetValue(ai, data, name) {} private: CraftData data; }; - class CraftSpellsValue : public CalculatedValue> //All crafting spells + class CraftSpellsValue : public CalculatedValue> //All crafting spells { public: - CraftSpellsValue(PlayerbotAI* ai, string name = "craft spells", int checkInterval = 10) : CalculatedValue>(ai, name, checkInterval) {} - virtual vector Calculate() override; + CraftSpellsValue(PlayerbotAI* ai, std::string name = "craft spells", int checkInterval = 10) : CalculatedValue>(ai, name, checkInterval) {} + virtual std::vector Calculate() override; }; class HasReagentsForValue : public BoolCalculatedValue, public Qualified //Does the bot have reagents to cast this craft spell? { public: - HasReagentsForValue(PlayerbotAI* ai, string name = "has reagents for", int checkInterval = 1) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {} + HasReagentsForValue(PlayerbotAI* ai, std::string name = "has reagents for", int checkInterval = 1) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {} virtual bool Calculate() override; }; class CanCraftSpellValue : public BoolCalculatedValue, public Qualified { public: - CanCraftSpellValue(PlayerbotAI* ai, string name = "can craft spell", int checkInterval = 10) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {} + CanCraftSpellValue(PlayerbotAI* ai, std::string name = "can craft spell", int checkInterval = 10) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {} virtual bool Calculate() override; }; class ShouldCraftSpellValue : public BoolCalculatedValue, public Qualified { public: - ShouldCraftSpellValue(PlayerbotAI* ai, string name = "should craft spell", int checkInterval = 10) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {} + ShouldCraftSpellValue(PlayerbotAI* ai, std::string name = "should craft spell", int checkInterval = 10) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {} virtual bool Calculate() override; static bool SpellGivesSkillUp(uint32 spellId, Player* bot); }; diff --git a/playerbot/strategy/values/CurrentCcTargetValue.cpp b/playerbot/strategy/values/CurrentCcTargetValue.cpp index 873c8d04..3d39cd24 100644 --- a/playerbot/strategy/values/CurrentCcTargetValue.cpp +++ b/playerbot/strategy/values/CurrentCcTargetValue.cpp @@ -7,7 +7,7 @@ using namespace ai; class FindCurrentCcTargetStrategy : public FindTargetStrategy { public: - FindCurrentCcTargetStrategy(PlayerbotAI* ai, string spell) : FindTargetStrategy(ai) + FindCurrentCcTargetStrategy(PlayerbotAI* ai, std::string spell) : FindTargetStrategy(ai) { this->spell = spell; } @@ -20,7 +20,7 @@ class FindCurrentCcTargetStrategy : public FindTargetStrategy } private: - string spell; + std::string spell; }; diff --git a/playerbot/strategy/values/CurrentCcTargetValue.h b/playerbot/strategy/values/CurrentCcTargetValue.h index c31125d4..99557267 100644 --- a/playerbot/strategy/values/CurrentCcTargetValue.h +++ b/playerbot/strategy/values/CurrentCcTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" namespace ai @@ -8,7 +8,7 @@ namespace ai class CurrentCcTargetValue : public TargetValue, public Qualified { public: - CurrentCcTargetValue(PlayerbotAI* ai, string name = "current cc target") : TargetValue(ai, name), Qualified() {} + CurrentCcTargetValue(PlayerbotAI* ai, std::string name = "current cc target") : TargetValue(ai, name), Qualified() {} public: Unit* Calculate(); diff --git a/playerbot/strategy/values/CurrentTargetValue.h b/playerbot/strategy/values/CurrentTargetValue.h index c68390ac..67e77787 100644 --- a/playerbot/strategy/values/CurrentTargetValue.h +++ b/playerbot/strategy/values/CurrentTargetValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class CurrentTargetValue : public UnitManualSetValue { public: - CurrentTargetValue(PlayerbotAI* ai, string name = "current target") : UnitManualSetValue(ai, nullptr, name) {} + CurrentTargetValue(PlayerbotAI* ai, std::string name = "current target") : UnitManualSetValue(ai, nullptr, name) {} virtual Unit* Get(); virtual void Set(Unit* unit); diff --git a/playerbot/strategy/values/DeadValues.cpp b/playerbot/strategy/values/DeadValues.cpp index dee5d5d2..cc3fc77f 100644 --- a/playerbot/strategy/values/DeadValues.cpp +++ b/playerbot/strategy/values/DeadValues.cpp @@ -22,7 +22,7 @@ GuidPosition GraveyardValue::Calculate() refPosition = AI_VALUE(WorldPosition, "home bind"); else if (getQualifier() == "start") { - vector races; + std::vector races; if (bot->GetTeam() == ALLIANCE) races = { RACE_HUMAN, RACE_DWARF,RACE_GNOME,RACE_NIGHTELF }; @@ -123,7 +123,7 @@ bool ShouldSpiritHealerValue::Calculate() float graveYardDistance = WorldPosition(bot).fDist(corpse); bool corpseInSight = corpseDistance < sPlayerbotAIConfig.sightDistance; bool graveInSight = graveYardDistance < sPlayerbotAIConfig.sightDistance; - bool enemiesNear = !AI_VALUE(list, "possible targets").empty(); + bool enemiesNear = !AI_VALUE(std::list, "possible targets").empty(); if (enemiesNear) { diff --git a/playerbot/strategy/values/DeadValues.h b/playerbot/strategy/values/DeadValues.h index ac36369e..f15ddd03 100644 --- a/playerbot/strategy/values/DeadValues.h +++ b/playerbot/strategy/values/DeadValues.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class GraveyardValue : public GuidPositionCalculatedValue, public Qualified { public: - GraveyardValue(PlayerbotAI* ai, string name = "graveyard", int checkInterval = 10) : GuidPositionCalculatedValue(ai, name, checkInterval), Qualified() {} + GraveyardValue(PlayerbotAI* ai, std::string name = "graveyard", int checkInterval = 10) : GuidPositionCalculatedValue(ai, name, checkInterval), Qualified() {} public: GuidPosition Calculate(); @@ -15,7 +15,7 @@ namespace ai class BestGraveyardValue : public GuidPositionCalculatedValue { public: - BestGraveyardValue(PlayerbotAI* ai, string name = "best graveyard", int checkInterval = 10) : GuidPositionCalculatedValue(ai, name, checkInterval) {} + BestGraveyardValue(PlayerbotAI* ai, std::string name = "best graveyard", int checkInterval = 10) : GuidPositionCalculatedValue(ai, name, checkInterval) {} public: GuidPosition Calculate(); @@ -24,7 +24,7 @@ namespace ai class ShouldSpiritHealerValue : public BoolCalculatedValue { public: - ShouldSpiritHealerValue(PlayerbotAI* ai, string name = "should spirit healer") : BoolCalculatedValue(ai, name) {} + ShouldSpiritHealerValue(PlayerbotAI* ai, std::string name = "should spirit healer") : BoolCalculatedValue(ai, name) {} public: bool Calculate(); diff --git a/playerbot/strategy/values/DistanceValue.h b/playerbot/strategy/values/DistanceValue.h index 4b55442d..d300ac2d 100644 --- a/playerbot/strategy/values/DistanceValue.h +++ b/playerbot/strategy/values/DistanceValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" #include "playerbot/LootObjectStack.h" #include "playerbot/ServerFacade.h" @@ -10,7 +10,7 @@ namespace ai class DistanceValue : public FloatCalculatedValue, public Qualified { public: - DistanceValue(PlayerbotAI* ai, string name = "distance") : FloatCalculatedValue(ai, name), Qualified() {} + DistanceValue(PlayerbotAI* ai, std::string name = "distance") : FloatCalculatedValue(ai, name), Qualified() {} public: float Calculate() @@ -30,7 +30,7 @@ namespace ai if (qualifier.find("position_") == 0) { - string position = qualifier.substr(9); + std::string position = qualifier.substr(9); ai::PositionEntry pos = context->GetValue("position")->Get()[position]; if (!pos.isSet()) return 0.0f; if (ai->GetBot()->GetMapId() != pos.mapId) return 0.0f; @@ -91,7 +91,7 @@ namespace ai class InsideTargetValue : public BoolCalculatedValue, public Qualified { public: - InsideTargetValue(PlayerbotAI* ai, string name = "inside target") : BoolCalculatedValue(ai, name), Qualified() {} + InsideTargetValue(PlayerbotAI* ai, std::string name = "inside target") : BoolCalculatedValue(ai, name), Qualified() {} public: bool Calculate() diff --git a/playerbot/strategy/values/DpsTargetValue.h b/playerbot/strategy/values/DpsTargetValue.h index fa207d38..660a14b7 100644 --- a/playerbot/strategy/values/DpsTargetValue.h +++ b/playerbot/strategy/values/DpsTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "RtiTargetValue.h" #include "TargetValue.h" @@ -8,7 +8,7 @@ namespace ai class DpsTargetValue : public RtiTargetValue { public: - DpsTargetValue(PlayerbotAI* ai, string type = "rti", string name = "dps target") : RtiTargetValue(ai, type, name) {} + DpsTargetValue(PlayerbotAI* ai, std::string type = "rti", std::string name = "dps target") : RtiTargetValue(ai, type, name) {} public: Unit* Calculate(); @@ -17,7 +17,7 @@ namespace ai class DpsAoeTargetValue : public RtiTargetValue { public: - DpsAoeTargetValue(PlayerbotAI* ai, string type = "rti", string name = "dps aoe target") : RtiTargetValue(ai, type, name) {} + DpsAoeTargetValue(PlayerbotAI* ai, std::string type = "rti", std::string name = "dps aoe target") : RtiTargetValue(ai, type, name) {} public: Unit* Calculate(); diff --git a/playerbot/strategy/values/DuelTargetValue.h b/playerbot/strategy/values/DuelTargetValue.h index 917b964b..e6db7c2e 100644 --- a/playerbot/strategy/values/DuelTargetValue.h +++ b/playerbot/strategy/values/DuelTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class DuelTargetValue : public TargetValue { public: - DuelTargetValue(PlayerbotAI* ai, string name = "duel target") : TargetValue(ai, name) {} + DuelTargetValue(PlayerbotAI* ai, std::string name = "duel target") : TargetValue(ai, name) {} public: Unit* Calculate(); diff --git a/playerbot/strategy/values/EnemyHealerTargetValue.cpp b/playerbot/strategy/values/EnemyHealerTargetValue.cpp index 3e1f3b52..56d6290b 100644 --- a/playerbot/strategy/values/EnemyHealerTargetValue.cpp +++ b/playerbot/strategy/values/EnemyHealerTargetValue.cpp @@ -8,11 +8,11 @@ using namespace ai; Unit* EnemyHealerTargetValue::Calculate() { - string spell = qualifier; + std::string spell = qualifier; - list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); + std::list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); Unit* target = ai->GetAiObjectContext()->GetValue("current target")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (!unit || unit == target) diff --git a/playerbot/strategy/values/EnemyHealerTargetValue.h b/playerbot/strategy/values/EnemyHealerTargetValue.h index 52b5749c..3e8f725a 100644 --- a/playerbot/strategy/values/EnemyHealerTargetValue.h +++ b/playerbot/strategy/values/EnemyHealerTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/EnemyPlayerValue.cpp b/playerbot/strategy/values/EnemyPlayerValue.cpp index c157f7c6..84ca7447 100644 --- a/playerbot/strategy/values/EnemyPlayerValue.cpp +++ b/playerbot/strategy/values/EnemyPlayerValue.cpp @@ -4,11 +4,10 @@ #include "TargetValue.h" using namespace ai; -using namespace std; -list EnemyPlayersValue::Calculate() +std::list EnemyPlayersValue::Calculate() { - list result; + std::list result; if (ai->AllowActivity(ALL_ACTIVITY)) { if (bot->IsInWorld() && !bot->IsBeingTeleported()) @@ -17,20 +16,20 @@ list EnemyPlayersValue::Calculate() bool getOne = false; if (!qualifier.empty()) { - getOne = stoi(qualifier); + getOne = std::stoi(qualifier); } if (getOne) { // Try to get one enemy target - result = AI_VALUE2(list, "possible attack targets", 1); + result = AI_VALUE2(std::list, "possible attack targets", 1); ApplyFilter(result, getOne); } // If the one enemy player failed, retry with multiple possible attack targets if (result.empty()) { - result = AI_VALUE(list, "possible attack targets"); + result = AI_VALUE(std::list, "possible attack targets"); ApplyFilter(result, getOne); } } @@ -80,9 +79,9 @@ bool EnemyPlayersValue::IsValid(Unit* target, Player* player) return false; } -void EnemyPlayersValue::ApplyFilter(list& targets, bool getOne) +void EnemyPlayersValue::ApplyFilter(std::list& targets, bool getOne) { - list filteredTargets; + std::list filteredTargets; for (const ObjectGuid& targetGuid : targets) { Unit* target = ai->GetUnit(targetGuid); @@ -102,7 +101,7 @@ void EnemyPlayersValue::ApplyFilter(list& targets, bool getOne) bool HasEnemyPlayersValue::Calculate() { - return !context->GetValue>("enemy player targets", 1)->Get().empty(); + return !context->GetValue>("enemy player targets", 1)->Get().empty(); } Unit* EnemyPlayerValue::Calculate() @@ -114,7 +113,7 @@ Unit* EnemyPlayerValue::Calculate() } Unit* bestEnemyPlayer = nullptr; - list enemyPlayers = AI_VALUE(list, "enemy player targets"); + std::list enemyPlayers = AI_VALUE(std::list, "enemy player targets"); if (!enemyPlayers.empty()) { const bool isMelee = !ai->IsRanged(bot); diff --git a/playerbot/strategy/values/EnemyPlayerValue.h b/playerbot/strategy/values/EnemyPlayerValue.h index 256a8806..5dac8c3e 100644 --- a/playerbot/strategy/values/EnemyPlayerValue.h +++ b/playerbot/strategy/values/EnemyPlayerValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" #include "PossibleTargetsValue.h" @@ -10,25 +10,25 @@ namespace ai { public: EnemyPlayersValue(PlayerbotAI* ai) : ObjectGuidListCalculatedValue(ai, "enemy players"), Qualified() {} - list Calculate(); + std::list Calculate(); static bool IsValid(Unit* target, Player* player); private: - void ApplyFilter(list& targets, bool getOne); + void ApplyFilter(std::list& targets, bool getOne); }; class HasEnemyPlayersValue : public BoolCalculatedValue, public Qualified { public: - HasEnemyPlayersValue(PlayerbotAI* ai, string name = "has enemy players") : BoolCalculatedValue(ai, name, 3), Qualified() {} + HasEnemyPlayersValue(PlayerbotAI* ai, std::string name = "has enemy players") : BoolCalculatedValue(ai, name, 3), Qualified() {} virtual bool Calculate(); }; class EnemyPlayerValue : public UnitCalculatedValue { public: - EnemyPlayerValue(PlayerbotAI* ai, string name = "enemy player") : UnitCalculatedValue(ai, name) {} + EnemyPlayerValue(PlayerbotAI* ai, std::string name = "enemy player") : UnitCalculatedValue(ai, name) {} virtual Unit* Calculate(); static float GetMaxAttackDistance(Player* bot); diff --git a/playerbot/strategy/values/EngineValues.h b/playerbot/strategy/values/EngineValues.h index ba4f244b..6b6601dc 100644 --- a/playerbot/strategy/values/EngineValues.h +++ b/playerbot/strategy/values/EngineValues.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class ActionPossibleValue : public BoolCalculatedValue, public Qualified { public: - ActionPossibleValue(PlayerbotAI* ai, string name = "action possible") : BoolCalculatedValue(ai, name), Qualified() {} + ActionPossibleValue(PlayerbotAI* ai, std::string name = "action possible") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate(); }; @@ -14,7 +14,7 @@ namespace ai class ActionUsefulValue : public BoolCalculatedValue, public Qualified { public: - ActionUsefulValue(PlayerbotAI* ai, string name = "action useful") : BoolCalculatedValue(ai, name), Qualified() {} + ActionUsefulValue(PlayerbotAI* ai, std::string name = "action useful") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate(); }; @@ -22,7 +22,7 @@ namespace ai class TriggerActiveValue : public BoolCalculatedValue, public Qualified { public: - TriggerActiveValue(PlayerbotAI* ai, string name = "trigger active") : BoolCalculatedValue(ai, name), Qualified() {} + TriggerActiveValue(PlayerbotAI* ai, std::string name = "trigger active") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate(); }; diff --git a/playerbot/strategy/values/EntryValues.h b/playerbot/strategy/values/EntryValues.h index 14cda959..3514c94c 100644 --- a/playerbot/strategy/values/EntryValues.h +++ b/playerbot/strategy/values/EntryValues.h @@ -1,25 +1,25 @@ #pragma once #include "playerbot/playerbot.h" -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class MCRunesValue : public StringCalculatedValue, public Qualified { public: - MCRunesValue(PlayerbotAI* ai, string name = "mc runes") : StringCalculatedValue(ai, name, 1), Qualified() {} + MCRunesValue(PlayerbotAI* ai, std::string name = "mc runes") : StringCalculatedValue(ai, name, 1), Qualified() {} - virtual string Calculate() { return "176951,176952,176953,176954,176955,176956,176957"; }; + virtual std::string Calculate() { return "176951,176952,176953,176954,176955,176956,176957"; }; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "mc runes"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "entry"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "mc runes"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "entry"; } + virtual std::string GetHelpDescription() { return "This value contains the entries of the Molten Core runes."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; } diff --git a/playerbot/strategy/values/FocusTargetValue.h b/playerbot/strategy/values/FocusTargetValue.h index 6e651ac1..b326f629 100644 --- a/playerbot/strategy/values/FocusTargetValue.h +++ b/playerbot/strategy/values/FocusTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/Formations.cpp b/playerbot/strategy/values/Formations.cpp index da483cd8..8b0f4472 100644 --- a/playerbot/strategy/values/Formations.cpp +++ b/playerbot/strategy/values/Formations.cpp @@ -124,7 +124,7 @@ namespace ai { public: MeleeFormation(PlayerbotAI* ai) : FollowFormation(ai, "melee") {} - virtual string GetTargetName() { return "master target"; } + virtual std::string GetTargetName() { return "master target"; } virtual float GetAngle() override { return GetFollowAngle(); } virtual float GetOffset() override { return ai->GetRange("follow"); } }; @@ -133,7 +133,7 @@ namespace ai { public: QueueFormation(PlayerbotAI* ai) : FollowFormation(ai, "queue") {} - virtual string GetTargetName() { return "line target"; } + virtual std::string GetTargetName() { return "line target"; } virtual float GetAngle() override { return M_PI_F; } virtual float GetOffset() override { return ai->GetRange("follow"); } }; @@ -290,7 +290,7 @@ namespace ai float z = followTarget->GetPositionZ(); float orientation = followTarget->GetOrientation(); - vector players; + std::vector players; for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next()) { Player* member = gref->getSource(); @@ -326,8 +326,8 @@ namespace ai float z = followTarget->GetPositionZ(); float orientation = followTarget->GetOrientation(); - vector tanks; - vector dps; + std::vector tanks; + std::vector dps; for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next()) { Player* member = gref->getSource(); @@ -372,7 +372,7 @@ namespace ai { public: FarFormation(PlayerbotAI* ai) : FollowFormation(ai, "far") {} - virtual string GetTargetName() { return "master target"; } + virtual std::string GetTargetName() { return "master target"; } virtual float GetAngle() override { Unit* followTarget = AI_VALUE(Unit*, "follow target"); @@ -474,7 +474,7 @@ float Formation::GetFollowAngle() } else if (group) { - vector roster; + std::vector roster; for (GroupReference *ref = group->GetFirstMember(); ref; ref = ref->next()) { Player* member = ref->getSource(); @@ -505,7 +505,7 @@ float Formation::GetFollowAngle() } } - for (vector::iterator i = roster.begin(); i != roster.end(); ++i) + for (std::vector::iterator i = roster.begin(); i != roster.end(); ++i) { if (*i == bot) break; index++; @@ -527,12 +527,12 @@ void FormationValue::Reset() value = new NearFormation(ai); } -string FormationValue::Save() +std::string FormationValue::Save() { return value ? value->getName() : "?"; } -bool FormationValue::Load(string formation) +bool FormationValue::Load(std::string formation) { if (formation == "melee") { @@ -591,13 +591,13 @@ bool FormationValue::Load(string formation) bool SetFormationAction::Execute(Event& event) { - string formation = event.getParam(); + std::string formation = event.getParam(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); FormationValue* value = (FormationValue*)context->GetValue("formation"); if (formation == "?" || formation.empty()) { - ostringstream str; str << "Formation: |cff00ff00" << value->Get()->getName(); + std::ostringstream str; str << "Formation: |cff00ff00" << value->Get()->getName(); ai->TellPlayer(requester, str); return true; } @@ -613,18 +613,18 @@ bool SetFormationAction::Execute(Event& event) if (!value->Load(formation)) { - ostringstream str; str << "Invalid formation: |cffff0000" << formation; + std::ostringstream str; str << "Invalid formation: |cffff0000" << formation; ai->TellPlayer(requester, str); ai->TellPlayer(requester, "Please set to any of:|cffffffff near (default), queue, chaos, circle, line, shield, arrow, melee, far"); return false; } - ostringstream str; str << "Formation set to: " << formation; + std::ostringstream str; str << "Formation set to: " << formation; ai->TellPlayer(requester, str); return true; } -WorldLocation MoveFormation::MoveLine(vector line, float diff, float cx, float cy, float cz, float orientation, float range) +WorldLocation MoveFormation::MoveLine(std::vector line, float diff, float cx, float cy, float cz, float orientation, float range) { if (line.size() < 5) { @@ -637,7 +637,7 @@ WorldLocation MoveFormation::MoveLine(vector line, float diff, float cx float radius = range * i; float x = cx + cos(orientation) * radius; float y = cy + sin(orientation) * radius; - vector singleLine; + std::vector singleLine; for (int j = 0; j < 5 && !line.empty(); j++) { singleLine.push_back(line[line.size() - 1]); @@ -652,7 +652,7 @@ WorldLocation MoveFormation::MoveLine(vector line, float diff, float cx return Formation::NullLocation; } -WorldLocation MoveFormation::MoveSingleLine(vector line, float diff, float cx, float cy, float cz, float orientation, float range) +WorldLocation MoveFormation::MoveSingleLine(std::vector line, float diff, float cx, float cy, float cz, float orientation, float range) { float count = line.size(); float angle = orientation - M_PI / 2.0f; @@ -660,7 +660,7 @@ WorldLocation MoveFormation::MoveSingleLine(vector line, float diff, fl float y = cy + sin(angle) * (range * floor(count / 2.0f) + diff); int index = 0; - for (vector::iterator i = line.begin(); i != line.end(); i++) + for (std::vector::iterator i = line.begin(); i != line.end(); i++) { Player* member = *i; diff --git a/playerbot/strategy/values/Formations.h b/playerbot/strategy/values/Formations.h index 9b318917..2f594ac5 100644 --- a/playerbot/strategy/values/Formations.h +++ b/playerbot/strategy/values/Formations.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/strategy/actions/GenericActions.h" @@ -8,10 +8,10 @@ namespace ai class Formation : public AiNamedObject { public: - Formation(PlayerbotAI* ai, string name) : AiNamedObject (ai, name) {} + Formation(PlayerbotAI* ai, std::string name) : AiNamedObject (ai, name) {} public: - virtual string GetTargetName() { return ""; } + virtual std::string GetTargetName() { return ""; } virtual WorldLocation GetLocation() { return NullLocation; } virtual float GetAngle(); virtual float GetOffset(); @@ -26,24 +26,24 @@ namespace ai class FollowFormation : public Formation { public: - FollowFormation(PlayerbotAI* ai, string name) : Formation(ai, name) {} + FollowFormation(PlayerbotAI* ai, std::string name) : Formation(ai, name) {} virtual WorldLocation GetLocation(); }; class MoveFormation : public Formation { public: - MoveFormation(PlayerbotAI* ai, string name) : Formation(ai, name) {} + MoveFormation(PlayerbotAI* ai, std::string name) : Formation(ai, name) {} protected: - WorldLocation MoveLine(vector line, float diff, float cx, float cy, float cz, float orientation, float range); - WorldLocation MoveSingleLine(vector line, float diff, float cx, float cy, float cz, float orientation, float range); + WorldLocation MoveLine(std::vector line, float diff, float cx, float cy, float cz, float orientation, float range); + WorldLocation MoveSingleLine(std::vector line, float diff, float cx, float cy, float cz, float orientation, float range); }; class MoveAheadFormation : public MoveFormation { public: - MoveAheadFormation(PlayerbotAI* ai, string name) : MoveFormation(ai, name) {} + MoveAheadFormation(PlayerbotAI* ai, std::string name) : MoveFormation(ai, name) {} virtual WorldLocation GetLocation(); virtual WorldLocation GetLocationInternal() { return NullLocation; } }; @@ -54,14 +54,14 @@ namespace ai FormationValue(PlayerbotAI* ai); ~FormationValue() { if (value) { delete value; value = NULL; } } virtual void Reset(); - virtual string Save(); - virtual bool Load(string value); + virtual std::string Save(); + virtual bool Load(std::string value); }; class FormationPositionValue : public CalculatedValue { public: - FormationPositionValue(PlayerbotAI* ai, string name = "formation position") : CalculatedValue(ai, name) {} + FormationPositionValue(PlayerbotAI* ai, std::string name = "formation position") : CalculatedValue(ai, name) {} virtual WorldPosition Calculate() { Formation* formation = AI_VALUE(Formation*, "formation"); diff --git a/playerbot/strategy/values/FreeMoveValues.h b/playerbot/strategy/values/FreeMoveValues.h index 3ccac0ec..00fce74c 100644 --- a/playerbot/strategy/values/FreeMoveValues.h +++ b/playerbot/strategy/values/FreeMoveValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -20,7 +20,7 @@ namespace ai class CanFreeMoveToValue : public BoolCalculatedValue, public Qualified { public: - CanFreeMoveToValue(PlayerbotAI* ai, string name = "can free move to", int checkInterval = 2) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {}; + CanFreeMoveToValue(PlayerbotAI* ai, std::string name = "can free move to", int checkInterval = 2) : BoolCalculatedValue(ai, name, checkInterval), Qualified() {}; virtual bool Calculate() override; protected: virtual float GetRange() { return ai->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT) ? INTERACTION_DISTANCE : AI_VALUE(float, "free move range"); } diff --git a/playerbot/strategy/values/GrindTargetValue.cpp b/playerbot/strategy/values/GrindTargetValue.cpp index 76bdfb89..3fc0d1b8 100644 --- a/playerbot/strategy/values/GrindTargetValue.cpp +++ b/playerbot/strategy/values/GrindTargetValue.cpp @@ -37,8 +37,8 @@ Unit* GrindTargetValue::FindTargetForGrinding(int assistCount) if (master && (master == bot || master->GetMapId() != bot->GetMapId() || master->IsBeingTeleported() || !master->GetPlayerbotAI())) master = nullptr; - list attackers = context->GetValue>("possible attack targets")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); i++) + std::list attackers = context->GetValue>("possible attack targets")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit || !sServerFacade.IsAlive(unit)) @@ -57,7 +57,7 @@ Unit* GrindTargetValue::FindTargetForGrinding(int assistCount) return unit; } - list targets = *context->GetValue >("possible targets"); + std::list targets = *context->GetValue >("possible targets"); if (targets.empty()) return NULL; @@ -65,9 +65,9 @@ Unit* GrindTargetValue::FindTargetForGrinding(int assistCount) float distance = 0; Unit* result = NULL; - unordered_map needForQuestMap; + std::unordered_map needForQuestMap; - for (list::iterator tIter = targets.begin(); tIter != targets.end(); tIter++) + for (std::list::iterator tIter = targets.begin(); tIter != targets.end(); tIter++) { Unit* unit = ai->GetUnit(*tIter); if (!unit) @@ -97,7 +97,7 @@ Unit* GrindTargetValue::FindTargetForGrinding(int assistCount) if (!bot->InBattleGround() && (int)unit->GetLevel() - (int)bot->GetLevel() > 4 && !unit->GetObjectGuid().IsPlayer()) { if (ai->HasStrategy("debug grind", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayer(GetMaster(), chat->formatWorldobject(unit) + " ignored (" + to_string((int)unit->GetLevel() - (int)bot->GetLevel()) + " levels above bot)."); + ai->TellPlayer(GetMaster(), chat->formatWorldobject(unit) + " ignored (" + std::to_string((int)unit->GetLevel() - (int)bot->GetLevel()) + " levels above bot)."); continue; } @@ -165,7 +165,7 @@ Unit* GrindTargetValue::FindTargetForGrinding(int assistCount) if (!bot->InBattleGround() && GetTargetingPlayerCount(unit) > assistCount) { if (ai->HasStrategy("debug grind", BotState::BOT_STATE_NON_COMBAT)) - ai->TellPlayer(GetMaster(), chat->formatWorldobject(unit) + " increased distance (" + to_string(GetTargetingPlayerCount(unit)) + " bots already targeting)."); + ai->TellPlayer(GetMaster(), chat->formatWorldobject(unit) + " increased distance (" + std::to_string(GetTargetingPlayerCount(unit)) + " bots already targeting)."); newdistance =+ GetTargetingPlayerCount(unit) * 5; } diff --git a/playerbot/strategy/values/GrindTargetValue.h b/playerbot/strategy/values/GrindTargetValue.h index 9e37adc5..40390718 100644 --- a/playerbot/strategy/values/GrindTargetValue.h +++ b/playerbot/strategy/values/GrindTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" namespace ai @@ -8,7 +8,7 @@ namespace ai class GrindTargetValue : public TargetValue { public: - GrindTargetValue(PlayerbotAI* ai, string name = "grind target") : TargetValue(ai, name) {} + GrindTargetValue(PlayerbotAI* ai, std::string name = "grind target") : TargetValue(ai, name) {} public: Unit* Calculate(); diff --git a/playerbot/strategy/values/GroupValues.cpp b/playerbot/strategy/values/GroupValues.cpp index de20ce76..44c90689 100644 --- a/playerbot/strategy/values/GroupValues.cpp +++ b/playerbot/strategy/values/GroupValues.cpp @@ -6,9 +6,9 @@ using namespace ai; -list GroupMembersValue::Calculate() +std::list GroupMembersValue::Calculate() { - list members; + std::list members; Group* group = bot->GetGroup(); if (group) @@ -53,7 +53,7 @@ uint32 GroupBoolCountValue::Calculate() { uint32 count = 0; - for (ObjectGuid guid : AI_VALUE(list, "group members")) + for (ObjectGuid guid : AI_VALUE(std::list, "group members")) { Player* player = sObjectMgr.GetPlayer(guid); @@ -75,7 +75,7 @@ uint32 GroupBoolCountValue::Calculate() bool GroupBoolANDValue::Calculate() { - for (ObjectGuid guid : AI_VALUE(list, "group members")) + for (ObjectGuid guid : AI_VALUE(std::list, "group members")) { Player* player = sObjectMgr.GetPlayer(guid); @@ -97,7 +97,7 @@ bool GroupBoolANDValue::Calculate() bool GroupBoolORValue::Calculate() { - for (ObjectGuid guid : AI_VALUE(list, "group members")) + for (ObjectGuid guid : AI_VALUE(std::list, "group members")) { Player* player = sObjectMgr.GetPlayer(guid); @@ -121,7 +121,7 @@ bool GroupReadyValue::Calculate() { bool inDungeon = !WorldPosition(bot).isOverworld(); - for (ObjectGuid guid : AI_VALUE(list, "group members")) + for (ObjectGuid guid : AI_VALUE(std::list, "group members")) { Player* member = sObjectMgr.GetPlayer(guid); diff --git a/playerbot/strategy/values/GroupValues.h b/playerbot/strategy/values/GroupValues.h index 243356c1..632f0294 100644 --- a/playerbot/strategy/values/GroupValues.h +++ b/playerbot/strategy/values/GroupValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: GroupMembersValue(PlayerbotAI* ai) : ObjectGuidListCalculatedValue(ai, "group members",2) {} - virtual list Calculate(); + virtual std::list Calculate(); }; class IsFollowingPartyValue : public BoolCalculatedValue diff --git a/playerbot/strategy/values/GuidPositionValues.cpp b/playerbot/strategy/values/GuidPositionValues.cpp index 749da1cc..6d9ec72b 100644 --- a/playerbot/strategy/values/GuidPositionValues.cpp +++ b/playerbot/strategy/values/GuidPositionValues.cpp @@ -8,29 +8,29 @@ using namespace ai; using namespace MaNGOS; -list GameObjectsValue::Calculate() +std::list GameObjectsValue::Calculate() { - list targets; + std::list targets; AnyGameObjectInObjectRangeCheck u_check(bot, sPlayerbotAIConfig.reactDistance); GameObjectListSearcher searcher(targets, u_check); Cell::VisitAllObjects((const WorldObject*)bot, searcher, sPlayerbotAIConfig.reactDistance); - list result; + std::list result; for (auto& target : targets) result.push_back(target); return result; } -list EntryFilterValue::Calculate() +std::list EntryFilterValue::Calculate() { - vector pair = getMultiQualifiers(getQualifier(), ","); + std::vector pair = getMultiQualifiers(getQualifier(), ","); - list guidList = AI_VALUE(list, pair[0]); - vector entryList = getMultiQualifiers(AI_VALUE(string ,pair[1]), ","); + std::list guidList = AI_VALUE(std::list, pair[0]); + std::vector entryList = getMultiQualifiers(AI_VALUE(std::string ,pair[1]), ","); - list result; + std::list result; for (auto guid : guidList) { @@ -42,14 +42,14 @@ list EntryFilterValue::Calculate() return result; } -list RangeFilterValue::Calculate() +std::list RangeFilterValue::Calculate() { - vector pair = getMultiQualifiers(getQualifier(), ","); + std::vector pair = getMultiQualifiers(getQualifier(), ","); - list guidList = AI_VALUE(list, pair[0]); + std::list guidList = AI_VALUE(std::list, pair[0]); float range = stof(pair[1]); - list result; + std::list result; for (auto guid : guidList) { @@ -60,11 +60,11 @@ list RangeFilterValue::Calculate() return result; } -list GoUsableFilterValue::Calculate() +std::list GoUsableFilterValue::Calculate() { - list guidList = AI_VALUE(list, getQualifier()); + std::list guidList = AI_VALUE(std::list, getQualifier()); - list result; + std::list result; for (auto guid : guidList) { @@ -79,11 +79,11 @@ list GoUsableFilterValue::Calculate() return result; } -list GoTrappedFilterValue::Calculate() +std::list GoTrappedFilterValue::Calculate() { - list guidList = AI_VALUE(list, getQualifier()); + std::list guidList = AI_VALUE(std::list, getQualifier()); - list result; + std::list result; for (auto guid : guidList) { diff --git a/playerbot/strategy/values/GuidPositionValues.h b/playerbot/strategy/values/GuidPositionValues.h index c90c9f94..37ec49e6 100644 --- a/playerbot/strategy/values/GuidPositionValues.h +++ b/playerbot/strategy/values/GuidPositionValues.h @@ -1,7 +1,7 @@ #pragma once #include "playerbot/playerbot.h" -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai @@ -9,81 +9,81 @@ namespace ai class GameObjectsValue : public GuidPositionListCalculatedValue { public: - GameObjectsValue(PlayerbotAI* ai, string name = "gos") : GuidPositionListCalculatedValue(ai, name, 1) {} + GameObjectsValue(PlayerbotAI* ai, std::string name = "gos") : GuidPositionListCalculatedValue(ai, name, 1) {} - virtual list Calculate(); + virtual std::list Calculate(); }; class EntryFilterValue : public GuidPositionListCalculatedValue, public Qualified { public: - EntryFilterValue(PlayerbotAI* ai, string name = "entry filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} + EntryFilterValue(PlayerbotAI* ai, std::string name = "entry filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} - virtual list Calculate(); + virtual std::list Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "entry filter"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "entry"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "entry filter"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "entry"; } + virtual std::string GetHelpDescription() { return "This value will returns only the ObjectGuids of specific entries."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; class RangeFilterValue : public GuidPositionListCalculatedValue, public Qualified { public: - RangeFilterValue(PlayerbotAI* ai, string name = "range filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} + RangeFilterValue(PlayerbotAI* ai, std::string name = "range filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} - virtual list Calculate(); + virtual std::list Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "range filter"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "entry"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "range filter"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "entry"; } + virtual std::string GetHelpDescription() { return "This value will returns only the ObjectGuids within a specific range."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; class GoUsableFilterValue : public GuidPositionListCalculatedValue, public Qualified { public: - GoUsableFilterValue(PlayerbotAI* ai, string name = "go usable filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} + GoUsableFilterValue(PlayerbotAI* ai, std::string name = "go usable filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} - virtual list Calculate(); + virtual std::list Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "go usable filter"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "entry"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "go usable filter"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "entry"; } + virtual std::string GetHelpDescription() { return "This value will returns only the ObjectGuids within a specific range."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; class GoTrappedFilterValue : public GuidPositionListCalculatedValue, public Qualified { public: - GoTrappedFilterValue(PlayerbotAI* ai, string name = "go trapped filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} + GoTrappedFilterValue(PlayerbotAI* ai, std::string name = "go trapped filter") : GuidPositionListCalculatedValue(ai, name, 1), Qualified() {} - virtual list Calculate(); + virtual std::list Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "go trapped filter"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "entry"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "go trapped filter"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "entry"; } + virtual std::string GetHelpDescription() { return "This value will returns only the ObjectGuids that are not trapped."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; @@ -91,17 +91,17 @@ namespace ai class GosInSightValue : public GuidPositionListCalculatedValue { public: - GosInSightValue(PlayerbotAI* ai, string name = "gos in sight") : GuidPositionListCalculatedValue(ai, name, 3) {} + GosInSightValue(PlayerbotAI* ai, std::string name = "gos in sight") : GuidPositionListCalculatedValue(ai, name, 3) {} - virtual list Calculate() { return AI_VALUE2(list, "range filter", "gos," + to_string(sPlayerbotAIConfig.sightDistance)); } + virtual std::list Calculate() { return AI_VALUE2(std::list, "range filter", "gos," + std::to_string(sPlayerbotAIConfig.sightDistance)); } }; class GoSCloseValue : public GuidPositionListCalculatedValue, public Qualified { public: - GoSCloseValue(PlayerbotAI* ai, string name = "gos close") : GuidPositionListCalculatedValue(ai, name, 3), Qualified() {} + GoSCloseValue(PlayerbotAI* ai, std::string name = "gos close") : GuidPositionListCalculatedValue(ai, name, 3), Qualified() {} - virtual list Calculate() { return AI_VALUE2(list, "range filter", "gos," + to_string(INTERACTION_DISTANCE)); } + virtual std::list Calculate() { return AI_VALUE2(std::list, "range filter", "gos," + std::to_string(INTERACTION_DISTANCE)); } }; @@ -109,8 +109,8 @@ namespace ai class HasObjectValue : public BoolCalculatedValue, public Qualified { public: - HasObjectValue(PlayerbotAI* ai, string name = "has object") : BoolCalculatedValue(ai, name, 3), Qualified() {} + HasObjectValue(PlayerbotAI* ai, std::string name = "has object") : BoolCalculatedValue(ai, name, 3), Qualified() {} - virtual bool Calculate() { return !AI_VALUE(list, getQualifier()).empty(); } + virtual bool Calculate() { return !AI_VALUE(std::list, getQualifier()).empty(); } }; } diff --git a/playerbot/strategy/values/GuildValues.cpp b/playerbot/strategy/values/GuildValues.cpp index 103bd722..21710b40 100644 --- a/playerbot/strategy/values/GuildValues.cpp +++ b/playerbot/strategy/values/GuildValues.cpp @@ -10,7 +10,7 @@ uint8 PetitionSignsValue::Calculate() if (bot->GetGuildId()) return 0; - list petitions = AI_VALUE2(list, "inventory items", chat->formatQItem(5863)); + std::list petitions = AI_VALUE2(std::list, "inventory items", chat->formatQItem(5863)); if (petitions.empty()) return 0; diff --git a/playerbot/strategy/values/GuildValues.h b/playerbot/strategy/values/GuildValues.h index fbefe848..92dab4d5 100644 --- a/playerbot/strategy/values/GuildValues.h +++ b/playerbot/strategy/values/GuildValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/HasAvailableLootValue.h b/playerbot/strategy/values/HasAvailableLootValue.h index d65b6bcd..816cd8fc 100644 --- a/playerbot/strategy/values/HasAvailableLootValue.h +++ b/playerbot/strategy/values/HasAvailableLootValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/PlayerbotAIConfig.h" namespace ai diff --git a/playerbot/strategy/values/HasTotemValue.h b/playerbot/strategy/values/HasTotemValue.h index 24c93c21..52c57ebc 100644 --- a/playerbot/strategy/values/HasTotemValue.h +++ b/playerbot/strategy/values/HasTotemValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" #include "playerbot/LootObjectStack.h" @@ -8,12 +8,12 @@ namespace ai class HasTotemValue : public BoolCalculatedValue, public Qualified { public: - HasTotemValue(PlayerbotAI* ai, string name = "has totem") : BoolCalculatedValue(ai, name), Qualified() {} + HasTotemValue(PlayerbotAI* ai, std::string name = "has totem") : BoolCalculatedValue(ai, name), Qualified() {} bool Calculate() { - list units = *context->GetValue >("nearest npcs"); - for (list::iterator i = units.begin(); i != units.end(); i++) + std::list units = *context->GetValue >("nearest npcs"); + for (std::list::iterator i = units.begin(); i != units.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit) diff --git a/playerbot/strategy/values/HaveAnyTotemValue.h b/playerbot/strategy/values/HaveAnyTotemValue.h index 57f31122..88d43971 100644 --- a/playerbot/strategy/values/HaveAnyTotemValue.h +++ b/playerbot/strategy/values/HaveAnyTotemValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" #include "playerbot/LootObjectStack.h" @@ -8,12 +8,12 @@ namespace ai class HaveAnyTotemValue : public BoolCalculatedValue, public Qualified { public: - HaveAnyTotemValue(PlayerbotAI* ai, string name = "have any totem") : BoolCalculatedValue(ai, name), Qualified() {} + HaveAnyTotemValue(PlayerbotAI* ai, std::string name = "have any totem") : BoolCalculatedValue(ai, name), Qualified() {} bool Calculate() { - list units = *context->GetValue >("nearest npcs"); - for (list::iterator i = units.begin(); i != units.end(); i++) + std::list units = *context->GetValue >("nearest npcs"); + for (std::list::iterator i = units.begin(); i != units.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit) diff --git a/playerbot/strategy/values/HazardsValue.cpp b/playerbot/strategy/values/HazardsValue.cpp index 900e29f3..5a4b842d 100644 --- a/playerbot/strategy/values/HazardsValue.cpp +++ b/playerbot/strategy/values/HazardsValue.cpp @@ -1,7 +1,7 @@ #include "playerbot/playerbot.h" #include "HazardsValue.h" -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" #include "MotionGenerators/PathFinder.h" using namespace ai; diff --git a/playerbot/strategy/values/HazardsValue.h b/playerbot/strategy/values/HazardsValue.h index 872cb6d1..800a5540 100644 --- a/playerbot/strategy/values/HazardsValue.h +++ b/playerbot/strategy/values/HazardsValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/WorldPosition.h" namespace ai @@ -42,14 +42,14 @@ namespace ai class StoredHazardsValue : public ManualSetValue> { public: - StoredHazardsValue(PlayerbotAI* ai, string name = "stored hazards") : ManualSetValue>(ai, {}, name) {} + StoredHazardsValue(PlayerbotAI* ai, std::string name = "stored hazards") : ManualSetValue>(ai, {}, name) {} }; // Value to add hazards which the bot must avoid when moving around class AddHazardValue : public ManualSetValue { public: - AddHazardValue(PlayerbotAI* ai, string name = "add hazard") : ManualSetValue(ai, Hazard(), name) {} + AddHazardValue(PlayerbotAI* ai, std::string name = "add hazard") : ManualSetValue(ai, Hazard(), name) {} private: void Set(Hazard hazard) override; @@ -59,7 +59,7 @@ namespace ai class HazardsValue : public CalculatedValue> { public: - HazardsValue(PlayerbotAI* ai, string name = "hazards") : CalculatedValue>(ai, name, 1) {} + HazardsValue(PlayerbotAI* ai, std::string name = "hazards") : CalculatedValue>(ai, name, 1) {} private: std::list Calculate() override; diff --git a/playerbot/strategy/values/InvalidTargetValue.cpp b/playerbot/strategy/values/InvalidTargetValue.cpp index 6c2d9e98..473a2f0b 100644 --- a/playerbot/strategy/values/InvalidTargetValue.cpp +++ b/playerbot/strategy/values/InvalidTargetValue.cpp @@ -33,7 +33,7 @@ bool InvalidTargetValue::Calculate() const bool validTarget = PossibleAttackTargetsValue::IsValid(target, bot); if (!validTarget) { - list attackers = AI_VALUE(list, "possible attack targets"); + std::list attackers = AI_VALUE(std::list, "possible attack targets"); if (std::find(attackers.begin(), attackers.end(), target->GetObjectGuid()) != attackers.end()) { return false; diff --git a/playerbot/strategy/values/InvalidTargetValue.h b/playerbot/strategy/values/InvalidTargetValue.h index 952225e9..95f64c0c 100644 --- a/playerbot/strategy/values/InvalidTargetValue.h +++ b/playerbot/strategy/values/InvalidTargetValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class InvalidTargetValue : public BoolCalculatedValue, public Qualified { public: - InvalidTargetValue(PlayerbotAI* ai, string name = "invalid target") : BoolCalculatedValue(ai, name), Qualified() {} + InvalidTargetValue(PlayerbotAI* ai, std::string name = "invalid target") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate(); }; } diff --git a/playerbot/strategy/values/IsBehindValue.h b/playerbot/strategy/values/IsBehindValue.h index 17e202f4..a8ae4fe3 100644 --- a/playerbot/strategy/values/IsBehindValue.h +++ b/playerbot/strategy/values/IsBehindValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/IsFacingValue.h b/playerbot/strategy/values/IsFacingValue.h index 3eda7b86..478aa9db 100644 --- a/playerbot/strategy/values/IsFacingValue.h +++ b/playerbot/strategy/values/IsFacingValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class IsFacingValue : public BoolCalculatedValue, public Qualified { public: - IsFacingValue(PlayerbotAI* ai, string name = "is facing") : BoolCalculatedValue(ai, name), Qualified() {} + IsFacingValue(PlayerbotAI* ai, std::string name = "is facing") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate() { diff --git a/playerbot/strategy/values/IsMovingValue.h b/playerbot/strategy/values/IsMovingValue.h index 490aa78e..81b60223 100644 --- a/playerbot/strategy/values/IsMovingValue.h +++ b/playerbot/strategy/values/IsMovingValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "MotionGenerators/TargetedMovementGenerator.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class IsMovingValue : public BoolCalculatedValue, public Qualified { public: - IsMovingValue(PlayerbotAI* ai, string name = "is moving") : BoolCalculatedValue(ai, name), Qualified() {} + IsMovingValue(PlayerbotAI* ai, std::string name = "is moving") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate() { @@ -23,7 +23,7 @@ namespace ai class IsSwimmingValue : public BoolCalculatedValue, public Qualified { public: - IsSwimmingValue(PlayerbotAI* ai, string name = "is swimming") : BoolCalculatedValue(ai, name), Qualified() {} + IsSwimmingValue(PlayerbotAI* ai, std::string name = "is swimming") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate() { diff --git a/playerbot/strategy/values/ItemCountValue.cpp b/playerbot/strategy/values/ItemCountValue.cpp index 17dc442d..ec62c608 100644 --- a/playerbot/strategy/values/ItemCountValue.cpp +++ b/playerbot/strategy/values/ItemCountValue.cpp @@ -7,16 +7,16 @@ using namespace ai; -static list Find(PlayerbotAI* ai, string qualifier) +static std::list Find(PlayerbotAI* ai, std::string qualifier) { - list result; + std::list result; Player* bot = ai->GetBot(); IterateItemsMask mask = IterateItemsMask((uint8)IterateItemsMask::ITERATE_ITEMS_IN_EQUIP | (uint8)IterateItemsMask::ITERATE_ITEMS_IN_BAGS); - list items = ai->InventoryParseItems(qualifier, mask); - for (list::iterator i = items.begin(); i != items.end(); i++) + std::list items = ai->InventoryParseItems(qualifier, mask); + for (std::list::iterator i = items.begin(); i != items.end(); i++) result.push_back(*i); return result; @@ -25,8 +25,8 @@ static list Find(PlayerbotAI* ai, string qualifier) uint32 ItemCountValue::Calculate() { uint32 count = 0; - list items = Find(ai, qualifier); - for (list::iterator i = items.begin(); i != items.end(); ++i) + std::list items = Find(ai, qualifier); + for (std::list::iterator i = items.begin(); i != items.end(); ++i) { Item* item = *i; count += item->GetCount(); @@ -35,15 +35,15 @@ uint32 ItemCountValue::Calculate() return count; } -list InventoryItemValue::Calculate() +std::list InventoryItemValue::Calculate() { return Find(ai, qualifier); } -list EquipedUsableTrinketValue::Calculate() +std::list EquipedUsableTrinketValue::Calculate() { - list trinkets; - list result; + std::list trinkets; + std::list result; Player* bot = ai->GetBot(); diff --git a/playerbot/strategy/values/ItemCountValue.h b/playerbot/strategy/values/ItemCountValue.h index 832f74bb..b8a2e5e6 100644 --- a/playerbot/strategy/values/ItemCountValue.h +++ b/playerbot/strategy/values/ItemCountValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/strategy/ItemVisitors.h" namespace ai @@ -7,28 +7,28 @@ namespace ai class ItemCountValue : public Uint32CalculatedValue, public Qualified { public: - ItemCountValue(PlayerbotAI* ai, string name = "item count") : Uint32CalculatedValue(ai, name), Qualified() {} + ItemCountValue(PlayerbotAI* ai, std::string name = "item count") : Uint32CalculatedValue(ai, name), Qualified() {} virtual uint32 Calculate(); }; - class InventoryItemValue : public CalculatedValue >, public Qualified + class InventoryItemValue : public CalculatedValue >, public Qualified { public: - InventoryItemValue(PlayerbotAI* ai, string name = "inventory items") : CalculatedValue >(ai, name), Qualified() {} - virtual list Calculate(); + InventoryItemValue(PlayerbotAI* ai, std::string name = "inventory items") : CalculatedValue >(ai, name), Qualified() {} + virtual std::list Calculate(); }; - class InventoryItemIdValue : public CalculatedValue >, public Qualified + class InventoryItemIdValue : public CalculatedValue >, public Qualified { public: - InventoryItemIdValue(PlayerbotAI* ai, string name = "inventory item ids") : CalculatedValue >(ai, name), Qualified() {} - virtual list Calculate() {list retVal; for (auto& item : AI_VALUE2(list, "inventory items", getQualifier())) { ItemPrototype const* proto = item->GetProto(); retVal.push_back(proto->ItemId);} return retVal;}; + InventoryItemIdValue(PlayerbotAI* ai, std::string name = "inventory item ids") : CalculatedValue >(ai, name), Qualified() {} + virtual std::list Calculate() { std::list retVal; for (auto& item : AI_VALUE2(std::list, "inventory items", getQualifier())) { ItemPrototype const* proto = item->GetProto(); retVal.push_back(proto->ItemId);} return retVal;}; }; - class EquipedUsableTrinketValue : public CalculatedValue >, public Qualified + class EquipedUsableTrinketValue : public CalculatedValue >, public Qualified { public: - EquipedUsableTrinketValue(PlayerbotAI* ai) : CalculatedValue >(ai), Qualified() {} - virtual list Calculate(); + EquipedUsableTrinketValue(PlayerbotAI* ai) : CalculatedValue >(ai), Qualified() {} + virtual std::list Calculate(); }; } diff --git a/playerbot/strategy/values/ItemForSpellValue.cpp b/playerbot/strategy/values/ItemForSpellValue.cpp index 314bbfc4..1ac4dca6 100644 --- a/playerbot/strategy/values/ItemForSpellValue.cpp +++ b/playerbot/strategy/values/ItemForSpellValue.cpp @@ -68,7 +68,7 @@ Item* ItemForSpellValue::Calculate() if (!strcmpi(spellInfo->SpellName[0], "disenchant")) return NULL; - vector slots; + std::vector slots; for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; slot++) { @@ -84,9 +84,9 @@ Item* ItemForSpellValue::Calculate() return itemForSpell; } - vector items; + std::vector items; - for (auto& item : AI_VALUE2(list, "inventory items", "all")) + for (auto& item : AI_VALUE2(std::list, "inventory items", "all")) items.push_back(item); std::shuffle(items.begin(), items.end(), *GetRandomGenerator()); diff --git a/playerbot/strategy/values/ItemForSpellValue.h b/playerbot/strategy/values/ItemForSpellValue.h index 9bf2426f..f4889fd7 100644 --- a/playerbot/strategy/values/ItemForSpellValue.h +++ b/playerbot/strategy/values/ItemForSpellValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class ItemForSpellValue : public CalculatedValue, public Qualified { public: - ItemForSpellValue(PlayerbotAI* ai, string name = "item for spell") : CalculatedValue(ai, name), Qualified() {} + ItemForSpellValue(PlayerbotAI* ai, std::string name = "item for spell") : CalculatedValue(ai, name), Qualified() {} virtual Item* Calculate(); private: diff --git a/playerbot/strategy/values/ItemUsageValue.cpp b/playerbot/strategy/values/ItemUsageValue.cpp index 5e26ef6a..e61f7b54 100644 --- a/playerbot/strategy/values/ItemUsageValue.cpp +++ b/playerbot/strategy/values/ItemUsageValue.cpp @@ -4,8 +4,8 @@ #include "CraftValues.h" #include "MountValues.h" -#include "../../../ahbot/AhBot.h" -#include "../../RandomItemMgr.h" +#include "ahbot/AhBot.h" +#include "playerbot/RandomItemMgr.h" #include "playerbot/ServerFacade.h" #include "AuctionHouseBot/AuctionHouseBot.h" @@ -13,7 +13,7 @@ using namespace ai; -ItemQualifier::ItemQualifier(string qualifier, bool linkQualifier) +ItemQualifier::ItemQualifier(std::string qualifier, bool linkQualifier) { itemId = 0; enchantId = 0; @@ -24,7 +24,7 @@ ItemQualifier::ItemQualifier(string qualifier, bool linkQualifier) gem4 = 0; proto = nullptr; - vector numbers = Qualified::getMultiQualifiers(qualifier, ":"); + std::vector numbers = Qualified::getMultiQualifiers(qualifier, ":"); if (numbers.empty()) return; @@ -159,7 +159,7 @@ ItemUsage ItemUsageValue::Calculate() if (proto->Class == ITEM_CLASS_CONSUMABLE && !ai->HasCheat(BotCheatMask::item)) { - string foodType = GetConsumableType(proto, bot->HasMana()); + std::string foodType = GetConsumableType(proto, bot->HasMana()); if (!foodType.empty() && bot->CanUseItem(proto) == EQUIP_ERR_OK) { @@ -190,7 +190,7 @@ ItemUsage ItemUsageValue::Calculate() //EQUIP if (MountValue::GetMountSpell(itemId) && bot->CanUseItem(proto) == EQUIP_ERR_OK && MountValue::GetSpeed(MountValue::GetMountSpell(itemId))) { - vector mounts = AI_VALUE(vector, "mount list"); + std::vector mounts = AI_VALUE(std::vector, "mount list"); if (mounts.empty()) return ItemUsage::ITEM_USAGE_EQUIP; @@ -339,7 +339,7 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemQualifier& itemQualifier) uint16 dest; - list items = AI_VALUE2(list, "inventory items", chat->formatItem(itemQualifier)); + std::list items = AI_VALUE2(std::list, "inventory items", chat->formatItem(itemQualifier)); InventoryResult result; if (!items.empty()) { @@ -640,7 +640,7 @@ bool ItemUsageValue::IsItemUsefulForSkill(ItemPrototype const* proto) bool ItemUsageValue::IsItemNeededForUsefullCraft(ItemPrototype const* proto, bool checkAllReagents) { - vector spellIds = AI_VALUE(vector, "craft spells"); + std::vector spellIds = AI_VALUE(std::vector, "craft spells"); for (uint32 spellId : spellIds) { @@ -687,7 +687,7 @@ bool ItemUsageValue::IsItemNeededForUsefullCraft(ItemPrototype const* proto, boo Item* ItemUsageValue::CurrentItem(ItemPrototype const* proto) { Item* bestItem = nullptr; - list found = AI_VALUE2(list < Item*>, "inventory items", chat->formatItem(proto)); + std::list found = AI_VALUE2(std::list < Item*>, "inventory items", chat->formatItem(proto)); for (auto item : found) { @@ -711,7 +711,7 @@ float ItemUsageValue::CurrentStacks(PlayerbotAI* ai, ItemPrototype const* proto) AiObjectContext* context = ai->GetAiObjectContext(); ChatHelper* chat = ai->GetChatHelper(); - list found = AI_VALUE2(list, "inventory items", chat->formatItem(proto)); + std::list found = AI_VALUE2(std::list, "inventory items", chat->formatItem(proto)); float itemCount = 0; @@ -723,9 +723,9 @@ float ItemUsageValue::CurrentStacks(PlayerbotAI* ai, ItemPrototype const* proto) return itemCount / maxStack; } -float ItemUsageValue::BetterStacks(ItemPrototype const* proto, string itemType) +float ItemUsageValue::BetterStacks(ItemPrototype const* proto, std::string itemType) { - list items = AI_VALUE2(list, "inventory items", itemType); + std::list items = AI_VALUE2(std::list, "inventory items", itemType); float stacks = 0; @@ -749,9 +749,9 @@ float ItemUsageValue::BetterStacks(ItemPrototype const* proto, string itemType) } -vector ItemUsageValue::SpellsUsingItem(uint32 itemId, Player* bot) +std::vector ItemUsageValue::SpellsUsingItem(uint32 itemId, Player* bot) { - vector retSpells; + std::vector retSpells; PlayerSpellMap const& spellMap = bot->GetSpellMap(); @@ -774,9 +774,9 @@ vector ItemUsageValue::SpellsUsingItem(uint32 itemId, Player* bot) return retSpells; } -string ItemUsageValue::GetConsumableType(ItemPrototype const* proto, bool hasMana) +std::string ItemUsageValue::GetConsumableType(ItemPrototype const* proto, bool hasMana) { - string foodType = ""; + std::string foodType = ""; if ((proto->SubClass == ITEM_SUBCLASS_CONSUMABLE || proto->SubClass == ITEM_SUBCLASS_FOOD)) { diff --git a/playerbot/strategy/values/ItemUsageValue.h b/playerbot/strategy/values/ItemUsageValue.h index 0f3935ac..5b721fe2 100644 --- a/playerbot/strategy/values/ItemUsageValue.h +++ b/playerbot/strategy/values/ItemUsageValue.h @@ -1,6 +1,6 @@ #pragma once -#include "../Value.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/Value.h" +#include "playerbot/strategy/NamedObjectContext.h" namespace ai { @@ -12,7 +12,7 @@ namespace ai ItemQualifier(Item* item) { itemId = item->GetProto()->ItemId; enchantId = item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT); randomPropertyId = item->GetItemRandomPropertyId(); gem1 = GemId(item, 0); gem2 = GemId(item, 1); gem3 = GemId(item, 2); gem4 = GemId(item, 3); proto = item->GetProto();}; ItemQualifier(LootItem* item) { itemId = item->itemId; enchantId = 0; randomPropertyId = item->randomPropertyId; gem1 = 0; gem2 = 0; gem3 = 0; gem4 = 0; proto = nullptr; }; ItemQualifier(AuctionEntry* auction) { itemId = auction->itemTemplate; enchantId = 0; randomPropertyId = auction->itemRandomPropertyId; gem1 = 0; gem2 = 0; gem3 = 0; gem4 = 0; proto = nullptr;}; - ItemQualifier(string qualifier, bool linkQualifier = true); + ItemQualifier(std::string qualifier, bool linkQualifier = true); uint32 GetId() { return itemId; } uint32 GetEnchantId() { return enchantId; } @@ -23,11 +23,11 @@ namespace ai uint32 GetGem4() { return gem4; } #ifdef MANGOSBOT_ZERO - string GetLinkQualifier() { return to_string(itemId) + ":" + to_string(enchantId) + ":" + to_string(randomPropertyId) + ":0"; } + std::string GetLinkQualifier() { return std::to_string(itemId) + ":" + std::to_string(enchantId) + ":" + std::to_string(randomPropertyId) + ":0"; } #else - string GetLinkQualifier() { return to_string(itemId) + ":" + to_string(enchantId) + ":" + to_string(gem1) + ":" + to_string(gem2) + ":" + to_string(gem3) + ":" + to_string(gem4) + ":" + to_string(randomPropertyId) + ":0"; } + std::string GetLinkQualifier() { return std::to_string(itemId) + ":" + std::to_string(enchantId) + ":" + std::to_string(gem1) + ":" + std::to_string(gem2) + ":" + std::to_string(gem3) + ":" + std::to_string(gem4) + ":" + std::to_string(randomPropertyId) + ":0"; } #endif - string GetQualifier() { return to_string(itemId) + ((enchantId || gem1 || gem2 || gem3 || gem4 || randomPropertyId) ? ":" + to_string(enchantId) + ":" + to_string(gem1) + ":" + to_string(gem2) + ":" + to_string(gem3) + ":" + to_string(gem4) + ":" + to_string(randomPropertyId) : ""); } + std::string GetQualifier() { return std::to_string(itemId) + ((enchantId || gem1 || gem2 || gem3 || gem4 || randomPropertyId) ? ":" + std::to_string(enchantId) + ":" + std::to_string(gem1) + ":" + std::to_string(gem2) + ":" + std::to_string(gem3) + ":" + std::to_string(gem4) + ":" + std::to_string(randomPropertyId) : ""); } ItemPrototype const* GetProto() { if (!proto) proto = sItemStorage.LookupEntry(itemId); return proto; }; static uint32 GemId(Item* item, uint8 gemSlot = 0); @@ -73,7 +73,7 @@ namespace ai class ItemUsageValue : public CalculatedValue, public Qualified { public: - ItemUsageValue(PlayerbotAI* ai, string name = "item usage") : CalculatedValue(ai, name), Qualified() {} + ItemUsageValue(PlayerbotAI* ai, std::string name = "item usage") : CalculatedValue(ai, name), Qualified() {} virtual ItemUsage Calculate(); private: @@ -84,43 +84,43 @@ namespace ai bool IsItemUsefulForSkill(ItemPrototype const * proto); bool IsItemNeededForUsefullCraft(ItemPrototype const* proto, bool checkAllReagents); Item* CurrentItem(ItemPrototype const* proto); - float BetterStacks(ItemPrototype const* proto, string usageType = ""); + float BetterStacks(ItemPrototype const* proto, std::string usageType = ""); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "item usage"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "item"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "item usage"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "item"; } + virtual std::string GetHelpDescription() { return "This value gives the reason why a bot finds an item useful.\n" "Based on this value bots will equip/unequip/need/greed/loot/destroy/sell/ah/craft items."; } - virtual vector GetUsedValues() { return {"bag space", "force item usage", "inventory items", "item count" }; } + virtual std::vector GetUsedValues() { return {"bag space", "force item usage", "inventory items", "item count" }; } #endif public: static float CurrentStacks(PlayerbotAI* ai, ItemPrototype const* proto); - static vector SpellsUsingItem(uint32 itemId, Player* bot); + static std::vector SpellsUsingItem(uint32 itemId, Player* bot); - static string GetConsumableType(ItemPrototype const* proto, bool hasMana); + static std::string GetConsumableType(ItemPrototype const* proto, bool hasMana); }; class ForceItemUsageValue : public ManualSetValue, public Qualified { public: - ForceItemUsageValue(PlayerbotAI* ai, string name = "force item usage") : ManualSetValue(ai, ForceItemUsage::FORCE_USAGE_NONE, name), Qualified() {} + ForceItemUsageValue(PlayerbotAI* ai, std::string name = "force item usage") : ManualSetValue(ai, ForceItemUsage::FORCE_USAGE_NONE, name), Qualified() {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "force item usage"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "item"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "force item usage"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "item"; } + virtual std::string GetHelpDescription() { return "This value overrides some reasons why a bot finds an item useful\n" "Based on this value bots will no longer sell/ah/destroy/unequip items."; } - virtual vector GetUsedValues() { return {}; } + virtual std::vector GetUsedValues() { return {}; } #endif - virtual string Save() override { return (uint8)value ? to_string((uint8)value) : "?"; } - virtual bool Load(string force) override { if (!force.empty()) value = ForceItemUsage(stoi(force)); return !force.empty(); } + virtual std::string Save() override { return (uint8)value ? std::to_string((uint8)value) : "?"; } + virtual bool Load(std::string force) override { if (!force.empty()) value = ForceItemUsage(stoi(force)); return !force.empty(); } }; } diff --git a/playerbot/strategy/values/LastMovementValue.h b/playerbot/strategy/values/LastMovementValue.h index 296f98da..75527d81 100644 --- a/playerbot/strategy/values/LastMovementValue.h +++ b/playerbot/strategy/values/LastMovementValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/TravelNode.h" namespace ai @@ -88,7 +88,7 @@ namespace ai return *this; }; public: - vector taxiNodes; + std::vector taxiNodes; ObjectGuid taxiMaster; Unit* lastFollow; uint32 lastAreaTrigger; diff --git a/playerbot/strategy/values/LastPotionUsedTimeValue.h b/playerbot/strategy/values/LastPotionUsedTimeValue.h index ce6c1a60..a522607d 100644 --- a/playerbot/strategy/values/LastPotionUsedTimeValue.h +++ b/playerbot/strategy/values/LastPotionUsedTimeValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/LastSaidValue.h b/playerbot/strategy/values/LastSaidValue.h index 233ffdb2..498bbbcf 100644 --- a/playerbot/strategy/values/LastSaidValue.h +++ b/playerbot/strategy/values/LastSaidValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/LastSpellCastTimeValue.h b/playerbot/strategy/values/LastSpellCastTimeValue.h index 82b6ffbc..cf58f523 100644 --- a/playerbot/strategy/values/LastSpellCastTimeValue.h +++ b/playerbot/strategy/values/LastSpellCastTimeValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/LastSpellCastValue.h b/playerbot/strategy/values/LastSpellCastValue.h index 9861af36..4737d520 100644 --- a/playerbot/strategy/values/LastSpellCastValue.h +++ b/playerbot/strategy/values/LastSpellCastValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -31,7 +31,7 @@ namespace ai class LastSpellCastValue : public ManualSetValue { public: - LastSpellCastValue(PlayerbotAI* ai, string name = "last spell cast") : ManualSetValue(ai, data, name) {} + LastSpellCastValue(PlayerbotAI* ai, std::string name = "last spell cast") : ManualSetValue(ai, data, name) {} private: LastSpellCast data; diff --git a/playerbot/strategy/values/LeastHpTargetValue.cpp b/playerbot/strategy/values/LeastHpTargetValue.cpp index 0dfe4179..b42808d9 100644 --- a/playerbot/strategy/values/LeastHpTargetValue.cpp +++ b/playerbot/strategy/values/LeastHpTargetValue.cpp @@ -4,7 +4,6 @@ #include "TargetValue.h" using namespace ai; -using namespace std; class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy { diff --git a/playerbot/strategy/values/LeastHpTargetValue.h b/playerbot/strategy/values/LeastHpTargetValue.h index 1e5e046d..da31bd4f 100644 --- a/playerbot/strategy/values/LeastHpTargetValue.h +++ b/playerbot/strategy/values/LeastHpTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class LeastHpTargetValue : public TargetValue { public: - LeastHpTargetValue(PlayerbotAI* ai, string name = "least hp target") : TargetValue(ai, name) {} + LeastHpTargetValue(PlayerbotAI* ai, std::string name = "least hp target") : TargetValue(ai, name) {} public: Unit* Calculate(); diff --git a/playerbot/strategy/values/LfgValues.h b/playerbot/strategy/values/LfgValues.h index b6687c0d..18108b93 100644 --- a/playerbot/strategy/values/LfgValues.h +++ b/playerbot/strategy/values/LfgValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -12,7 +12,7 @@ namespace ai class BotRolesValue : public Uint8CalculatedValue, public Qualified { public: - BotRolesValue(PlayerbotAI* ai, string name = "bot roles") : Uint8CalculatedValue(ai, name, 10), Qualified() {} + BotRolesValue(PlayerbotAI* ai, std::string name = "bot roles") : Uint8CalculatedValue(ai, name, 10), Qualified() {} virtual uint8 Calculate() { return AiFactory::GetPlayerRoles(bot); diff --git a/playerbot/strategy/values/LineTargetValue.h b/playerbot/strategy/values/LineTargetValue.h index 8aec2c4e..e4e9dc90 100644 --- a/playerbot/strategy/values/LineTargetValue.h +++ b/playerbot/strategy/values/LineTargetValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class LineTargetValue : public UnitCalculatedValue { public: - LineTargetValue(PlayerbotAI* ai, string name = "line target") : UnitCalculatedValue(ai, name) {} + LineTargetValue(PlayerbotAI* ai, std::string name = "line target") : UnitCalculatedValue(ai, name) {} public: virtual Unit* Calculate(); diff --git a/playerbot/strategy/values/LogLevelValue.h b/playerbot/strategy/values/LogLevelValue.h index 2af1ce29..8feb5704 100644 --- a/playerbot/strategy/values/LogLevelValue.h +++ b/playerbot/strategy/values/LogLevelValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class LogLevelValue : public ManualSetValue { public: - LogLevelValue(PlayerbotAI* ai, string name = "log level") : + LogLevelValue(PlayerbotAI* ai, std::string name = "log level") : ManualSetValue(ai, LOG_LVL_DEBUG, name) {} }; } diff --git a/playerbot/strategy/values/LootStrategyValue.cpp b/playerbot/strategy/values/LootStrategyValue.cpp index e04b2684..18026f2d 100644 --- a/playerbot/strategy/values/LootStrategyValue.cpp +++ b/playerbot/strategy/values/LootStrategyValue.cpp @@ -4,9 +4,8 @@ #include "playerbot/strategy/values/ItemUsageValue.h" using namespace ai; -using namespace std; -void LootStrategyValue::Set(string newValue) +void LootStrategyValue::Set(std::string newValue) { //Backwards compatibility if (newValue == "normal") @@ -39,9 +38,9 @@ bool LootStrategyValue::CanLoot(ItemQualifier& itemQualifier, PlayerbotAI* ai) if (usage == ItemUsage::ITEM_USAGE_FORCE_GREED) return true; - vector strategies = StrSplit(AI_VALUE(string, "loot strategy"), ","); + std::vector strategies = StrSplit(AI_VALUE(std::string, "loot strategy"), ","); - for (string& strategy : strategies) //equip,quest,skill,disenchant,use,vendor,trash + for (std::string& strategy : strategies) //equip,quest,skill,disenchant,use,vendor,trash { if (strategy == "equip" && usage == ItemUsage::ITEM_USAGE_EQUIP) return true; diff --git a/playerbot/strategy/values/LootStrategyValue.h b/playerbot/strategy/values/LootStrategyValue.h index 17a42ad0..7f63660f 100644 --- a/playerbot/strategy/values/LootStrategyValue.h +++ b/playerbot/strategy/values/LootStrategyValue.h @@ -1,6 +1,6 @@ #pragma once #include "playerbot/LootObjectStack.h" -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "SubStrategyValue.h" namespace ai @@ -8,9 +8,9 @@ namespace ai class LootStrategyValue : public SubStrategyValue { public: - LootStrategyValue(PlayerbotAI* ai, string defaultValue = "equip,quest,skill,disenchant,use,vendor", string name = "loot strategy", string allowedValues = "equip,quest,skill,disenchant,use,vendor,trash") : SubStrategyValue(ai, defaultValue, name, allowedValues) {} + LootStrategyValue(PlayerbotAI* ai, std::string defaultValue = "equip,quest,skill,disenchant,use,vendor", std::string name = "loot strategy", std::string allowedValues = "equip,quest,skill,disenchant,use,vendor,trash") : SubStrategyValue(ai, defaultValue, name, allowedValues) {} - virtual void Set(string newValue) override; + virtual void Set(std::string newValue) override; static bool CanLoot(ItemQualifier& itemQualifier, PlayerbotAI* ai); }; diff --git a/playerbot/strategy/values/LootValues.cpp b/playerbot/strategy/values/LootValues.cpp index 78e9818e..35482bdb 100644 --- a/playerbot/strategy/values/LootValues.cpp +++ b/playerbot/strategy/values/LootValues.cpp @@ -1,4 +1,3 @@ -#include "../../../botpch.h" #include "playerbot/playerbot.h" #include "SharedValueContext.h" #include "LootValues.h" @@ -6,9 +5,9 @@ using namespace ai; -vector LootAccess::GetLootContentFor(Player* player) const +std::vector LootAccess::GetLootContentFor(Player* player) const { - vector retvec; + std::vector retvec; for (LootItemList::const_iterator lootItemItr = m_lootItems.begin(); lootItemItr != m_lootItems.end(); ++lootItemItr) { @@ -135,7 +134,7 @@ DropMap* DropMapValue::Calculate() if(lTemplateA) for (LootStoreItem const& lItem : lTemplateA->Entries) - dropMap->insert(make_pair(lItem.itemid,sEntry)); + dropMap->insert(std::make_pair(lItem.itemid,sEntry)); } for (uint32 entry = 0; entry < sGOStorage.GetMaxEntry(); entry++) @@ -146,20 +145,20 @@ DropMap* DropMapValue::Calculate() if(lTemplateA) for (LootStoreItem const& lItem : lTemplateA->Entries) - dropMap->insert(make_pair(lItem.itemid, -sEntry)); + dropMap->insert(std::make_pair(lItem.itemid, -sEntry)); } return dropMap; } //What items does this entry have in its loot list? -list ItemDropListValue::Calculate() +std::list ItemDropListValue::Calculate() { uint32 itemId = stoi(getQualifier()); DropMap* dropMap = GAI_VALUE(DropMap*, "drop map"); - list entries; + std::list entries; auto range = dropMap->equal_range(itemId); @@ -170,11 +169,11 @@ list ItemDropListValue::Calculate() } //What items does this entry have in its loot list? -list EntryLootListValue::Calculate() +std::list EntryLootListValue::Calculate() { int32 entry = stoi(getQualifier()); - list items; + std::list items; LootTemplateAccess const* lTemplateA; @@ -215,7 +214,7 @@ itemUsageMap EntryLootUsageValue::Calculate() { itemUsageMap items; - for (auto itemId : GAI_VALUE2(list, "entry loot list", getQualifier())) + for (auto itemId : GAI_VALUE2(std::list, "entry loot list", getQualifier())) { items[AI_VALUE2(ItemUsage, "item usage", itemId)].push_back(itemId); } @@ -245,7 +244,7 @@ uint32 StackSpaceForItem::Calculate() if (maxStack == 1) return 0; - list found = AI_VALUE2(list < Item*>, "inventory items", chat->formatItem(proto)); + std::list found = AI_VALUE2(std::list < Item*>, "inventory items", chat->formatItem(proto)); maxValue = 0; @@ -343,9 +342,9 @@ void ActiveRolls::CleanUp(Player* bot, LootRollMap& rollMap, ObjectGuid guid, ui } } -string ActiveRolls::Format() +std::string ActiveRolls::Format() { - ostringstream out; + std::ostringstream out; for (auto& roll : value) { @@ -356,7 +355,7 @@ string ActiveRolls::Format() else out << roll.first; - string itemLink; + std::string itemLink; Loot* loot = sLootMgr.GetLoot(bot, roll.first); if (loot) diff --git a/playerbot/strategy/values/LootValues.h b/playerbot/strategy/values/LootValues.h index 20038823..f753edb6 100644 --- a/playerbot/strategy/values/LootValues.h +++ b/playerbot/strategy/values/LootValues.h @@ -22,7 +22,7 @@ namespace ai friend class GroupLootRoll; friend class LootMgr; - vector GetLootContentFor(Player* player) const; + std::vector GetLootContentFor(Player* player) const; uint32 GetLootStatusFor(Player const* player) const; bool IsLootedFor(Player const* player) const; bool IsLootedForAll() const; @@ -55,8 +55,8 @@ namespace ai }; // itemId, entry - typedef unordered_multimap DropMap; - typedef unordered_map , float > ChanceMap; + typedef std::unordered_multimap DropMap; + typedef std::unordered_map , float > ChanceMap; //Returns the loot map of all entries class DropMapValue : public SingleCalculatedValue @@ -68,50 +68,50 @@ namespace ai virtual DropMap* Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "drop map"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "drop map"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value returns all creatures and game objects and the items they drop."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; //Returns the entries that drop a specific item - class ItemDropListValue : public SingleCalculatedValue>, public Qualified + class ItemDropListValue : public SingleCalculatedValue>, public Qualified { public: ItemDropListValue(PlayerbotAI* ai) : SingleCalculatedValue(ai, "item drop list"), Qualified() {} - virtual list Calculate(); + virtual std::list Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "item drop list"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "item drop list"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value returns all creatures or game objects that drop a specific item."; } - virtual vector GetUsedValues() { return { "drop map" }; } + virtual std::vector GetUsedValues() { return { "drop map" }; } #endif }; //Returns the items a specific entry can drop - class EntryLootListValue : public SingleCalculatedValue>, public Qualified + class EntryLootListValue : public SingleCalculatedValue>, public Qualified { public: EntryLootListValue(PlayerbotAI* ai) : SingleCalculatedValue(ai, "entry loot list"), Qualified() {} - virtual list Calculate(); + virtual std::list Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "entry loot list"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "entry loot list"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value returns all the items dropped by a specific creature or game object."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; @@ -122,17 +122,17 @@ namespace ai virtual float Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "loot chance"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "loot chance"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value returns the chance a specific creature or game object will drop a certain item."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; - typedef unordered_map> itemUsageMap; + typedef std::unordered_map> itemUsageMap; class EntryLootUsageValue : public CalculatedValue, public Qualified { @@ -141,13 +141,13 @@ namespace ai virtual itemUsageMap Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "entry loot usage" ; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "entry loot usage" ; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value returns all the items a creature or game object drops and if the bot thinks this item is useful somehow."; } - virtual vector GetUsedValues() { return { "entry loot list", "item usage" }; } + virtual std::vector GetUsedValues() { return { "entry loot list", "item usage" }; } #endif }; @@ -158,13 +158,13 @@ namespace ai virtual bool Calculate() { itemUsageMap uMap = AI_VALUE2(itemUsageMap, "entry loot usage", getQualifier()); return uMap.find(ItemUsage::ITEM_USAGE_EQUIP) != uMap.end(); }; #ifdef GenerateBotHelp - virtual string GetHelpName() { return "has upgrade"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "has upgrade"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value checks if a specific creature or game object drops an item that is an equipment upgrade for the bot."; } - virtual vector GetUsedValues() { return { "entry loot usage" }; } + virtual std::vector GetUsedValues() { return { "entry loot usage" }; } #endif }; @@ -177,14 +177,14 @@ namespace ai virtual uint32 Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "stack space for item"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "item"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "stack space for item"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "item"; } + virtual std::string GetHelpDescription() { return "This value returns the number of items of a specific type it can store.\n" "Without a player bots are limited to 80% bag space and will only have space for items in existing stacks"; } - virtual vector GetUsedValues() { return { "bag space" , "inventory items" }; } + virtual std::vector GetUsedValues() { return { "bag space" , "inventory items" }; } #endif }; @@ -195,35 +195,35 @@ namespace ai virtual bool Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "should loot object"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "should loot object"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value checks if an lootable object might hold something the bot can loot.\n" "It returns true if the object has unknown loot, gold or an item it is allowed to loot and can store in an empty space or a stack of similar items."; } - virtual vector GetUsedValues() { return { "stack space for item" }; } + virtual std::vector GetUsedValues() { return { "stack space for item" }; } #endif }; - typedef unordered_multimap LootRollMap; + typedef std::unordered_multimap LootRollMap; class ActiveRolls : public ManualSetValue { public: ActiveRolls(PlayerbotAI* ai) : ManualSetValue(ai, {}, "active rolls") {} static void CleanUp(Player* bot, LootRollMap& value, ObjectGuid guid = ObjectGuid(), uint32 slot = 0); - virtual string Format(); + virtual std::string Format(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "active rolls"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "loot"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "active rolls"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "loot"; } + virtual std::string GetHelpDescription() { return "This value contains the active rolls a bot has.\n" "This value is filled and emptied when bots see and do rolls."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; } diff --git a/playerbot/strategy/values/MaintenanceValues.h b/playerbot/strategy/values/MaintenanceValues.h index e2739fde..31cbcd0a 100644 --- a/playerbot/strategy/values/MaintenanceValues.h +++ b/playerbot/strategy/values/MaintenanceValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "ItemUsageValue.h" #include "BudgetValues.h" @@ -60,7 +60,7 @@ namespace ai { public: CanSellValue(PlayerbotAI* ai) : BoolCalculatedValue(ai, "can sell",2) {} - virtual bool Calculate() { return ai->HasStrategy("rpg vendor", BotState::BOT_STATE_NON_COMBAT) && AI_VALUE2(uint32, "item count", "usage " + to_string((uint8)ItemUsage::ITEM_USAGE_VENDOR)) > 1; }; + virtual bool Calculate() { return ai->HasStrategy("rpg vendor", BotState::BOT_STATE_NON_COMBAT) && AI_VALUE2(uint32, "item count", "usage " + std::to_string((uint8)ItemUsage::ITEM_USAGE_VENDOR)) > 1; }; }; class CanBuyValue : public BoolCalculatedValue @@ -74,7 +74,7 @@ namespace ai { public: CanAHSellValue(PlayerbotAI* ai) : BoolCalculatedValue(ai, "can ah sell", 2) {} - virtual bool Calculate() { return ai->HasStrategy("rpg vendor", BotState::BOT_STATE_NON_COMBAT) && AI_VALUE2(uint32, "item count", "usage " + to_string((uint8)ItemUsage::ITEM_USAGE_AH)) > 1 && AI_VALUE2(uint32, "free money for", (uint32)NeedMoneyFor::ah) > GetAuctionDeposit(); }; + virtual bool Calculate() { return ai->HasStrategy("rpg vendor", BotState::BOT_STATE_NON_COMBAT) && AI_VALUE2(uint32, "item count", "usage " + std::to_string((uint8)ItemUsage::ITEM_USAGE_AH)) > 1 && AI_VALUE2(uint32, "free money for", (uint32)NeedMoneyFor::ah) > GetAuctionDeposit(); }; uint32 GetAuctionDeposit() { @@ -86,7 +86,7 @@ namespace ai #endif float minDeposit = 0; - for (auto item : AI_VALUE2(list, "inventory items", "usage " + to_string((uint8)ItemUsage::ITEM_USAGE_AH))) + for (auto item : AI_VALUE2(std::list, "inventory items", "usage " + std::to_string((uint8)ItemUsage::ITEM_USAGE_AH))) { float deposit = float(item->GetProto()->SellPrice * item->GetCount() * (time / MIN_AUCTION_TIME)); diff --git a/playerbot/strategy/values/ManaSaveLevelValue.h b/playerbot/strategy/values/ManaSaveLevelValue.h index c4165025..aa3ea695 100644 --- a/playerbot/strategy/values/ManaSaveLevelValue.h +++ b/playerbot/strategy/values/ManaSaveLevelValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -8,7 +8,7 @@ namespace ai public: ManaSaveLevelValue(PlayerbotAI* ai) : ManualSetValue(ai, 1.0, "mana save level") {} - virtual string Save() { ostringstream out; out << value; return out.str(); } - virtual bool Load(string text) { value = atof(text.c_str()); return true; } + virtual std::string Save() { std::ostringstream out; out << value; return out.str(); } + virtual bool Load(std::string text) { value = atof(text.c_str()); return true; } }; } diff --git a/playerbot/strategy/values/MasterTargetValue.h b/playerbot/strategy/values/MasterTargetValue.h index 416c0518..504e3acb 100644 --- a/playerbot/strategy/values/MasterTargetValue.h +++ b/playerbot/strategy/values/MasterTargetValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class MasterTargetValue : public UnitCalculatedValue { public: - MasterTargetValue(PlayerbotAI* ai, string name = "master target") : UnitCalculatedValue(ai, name) {} + MasterTargetValue(PlayerbotAI* ai, std::string name = "master target") : UnitCalculatedValue(ai, name) {} virtual Unit* Calculate() { return ai->GetGroupMaster(); } }; diff --git a/playerbot/strategy/values/MountValues.cpp b/playerbot/strategy/values/MountValues.cpp index 3b9e29c6..fa1a27c2 100644 --- a/playerbot/strategy/values/MountValues.cpp +++ b/playerbot/strategy/values/MountValues.cpp @@ -200,11 +200,11 @@ uint32 CurrentMountSpeedValue::Calculate() return mountSpeed; } -vector MountListValue::Calculate() +std::vector MountListValue::Calculate() { - vector mounts; + std::vector mounts; - for (auto& mount : AI_VALUE2(list, "inventory items", "mount")) + for (auto& mount : AI_VALUE2(std::list, "inventory items", "mount")) mounts.push_back(MountValue(ai, mount)); for (PlayerSpellMap::iterator itr = bot->GetSpellMap().begin(); itr != bot->GetSpellMap().end(); ++itr) @@ -215,12 +215,12 @@ vector MountListValue::Calculate() return mounts; } -string MountListValue::Format() +std::string MountListValue::Format() { - ostringstream out; out << "{"; + std::ostringstream out; out << "{"; for (auto& mount : this->Calculate()) { - string speed = to_string(mount.GetSpeed(false) + 1) + "%" + (mount.GetSpeed(true) ? ("/" + (to_string(mount.GetSpeed(true) + 1) + "%")) : ""); + std::string speed = std::to_string(mount.GetSpeed(false) + 1) + "%" + (mount.GetSpeed(true) ? ("/" + (std::to_string(mount.GetSpeed(true) + 1) + "%")) : ""); out << (mount.IsItem() ? "(item)" : "(spell)") << chat->formatSpell(mount.GetSpellId()) << "(" << speed.c_str() << "),"; } out << "}"; diff --git a/playerbot/strategy/values/MountValues.h b/playerbot/strategy/values/MountValues.h index 7ea0b959..ce46d1a4 100644 --- a/playerbot/strategy/values/MountValues.h +++ b/playerbot/strategy/values/MountValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -31,11 +31,11 @@ namespace ai virtual uint32 Calculate(); }; - class MountListValue : public CalculatedValue> + class MountListValue : public CalculatedValue> { public: - MountListValue(PlayerbotAI* ai) : CalculatedValue>(ai, "mount list", 10) {} - virtual vector Calculate(); - virtual string Format(); + MountListValue(PlayerbotAI* ai) : CalculatedValue>(ai, "mount list", 10) {} + virtual std::vector Calculate(); + virtual std::string Format(); }; } diff --git a/playerbot/strategy/values/MoveStyleValue.cpp b/playerbot/strategy/values/MoveStyleValue.cpp index 2094c889..46ae905e 100644 --- a/playerbot/strategy/values/MoveStyleValue.cpp +++ b/playerbot/strategy/values/MoveStyleValue.cpp @@ -4,10 +4,9 @@ #include "playerbot/strategy/values/ItemUsageValue.h" using namespace ai; -using namespace std; -bool MoveStyleValue::HasValue(PlayerbotAI* ai, const string& value) +bool MoveStyleValue::HasValue(PlayerbotAI* ai, const std::string& value) { - string styles = ai->GetAiObjectContext()->GetValue("move style")->Get(); - return styles.find(value) != string::npos; + std::string styles = ai->GetAiObjectContext()->GetValue("move style")->Get(); + return styles.find(value) != std::string::npos; } \ No newline at end of file diff --git a/playerbot/strategy/values/MoveStyleValue.h b/playerbot/strategy/values/MoveStyleValue.h index 32e40fce..143daf2f 100644 --- a/playerbot/strategy/values/MoveStyleValue.h +++ b/playerbot/strategy/values/MoveStyleValue.h @@ -1,6 +1,6 @@ #pragma once #include "playerbot/LootObjectStack.h" -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "SubStrategyValue.h" namespace ai @@ -8,12 +8,12 @@ namespace ai class MoveStyleValue : public SubStrategyValue { public: - MoveStyleValue(PlayerbotAI* ai, const string& defaultValue = "", const string& name = "move style", const string& allowedValues = "wait,noedge") : SubStrategyValue(ai, defaultValue, name, allowedValues) {} + MoveStyleValue(PlayerbotAI* ai, const std::string& defaultValue = "", const std::string& name = "move style", const std::string& allowedValues = "wait,noedge") : SubStrategyValue(ai, defaultValue, name, allowedValues) {} static bool WaitForEnemy(PlayerbotAI* ai) { return HasValue(ai, "wait"); } static bool CheckForEdges(PlayerbotAI* ai) { return HasValue(ai, "noedge"); } private: - static bool HasValue(PlayerbotAI* ai, const string& value); + static bool HasValue(PlayerbotAI* ai, const std::string& value); }; } diff --git a/playerbot/strategy/values/NearestAdsValue.h b/playerbot/strategy/values/NearestAdsValue.h index b3c19fdd..66b0bfe6 100644 --- a/playerbot/strategy/values/NearestAdsValue.h +++ b/playerbot/strategy/values/NearestAdsValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "NearestUnitsValue.h" #include "playerbot/PlayerbotAIConfig.h" #include "PossibleTargetsValue.h" diff --git a/playerbot/strategy/values/NearestCorpsesValue.cpp b/playerbot/strategy/values/NearestCorpsesValue.cpp index f79aceef..b4ef8143 100644 --- a/playerbot/strategy/values/NearestCorpsesValue.cpp +++ b/playerbot/strategy/values/NearestCorpsesValue.cpp @@ -24,7 +24,7 @@ class AnyDeadUnitInObjectRangeCheck float i_range; }; -void NearestCorpsesValue::FindUnits(list &targets) +void NearestCorpsesValue::FindUnits(std::list &targets) { AnyDeadUnitInObjectRangeCheck u_check(bot, range); UnitListSearcher searcher(targets, u_check); diff --git a/playerbot/strategy/values/NearestCorpsesValue.h b/playerbot/strategy/values/NearestCorpsesValue.h index 700aa747..ca7a5c9c 100644 --- a/playerbot/strategy/values/NearestCorpsesValue.h +++ b/playerbot/strategy/values/NearestCorpsesValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "NearestUnitsValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -12,7 +12,7 @@ namespace ai NearestUnitsValue(ai, "nearest corpses", range) {} protected: - void FindUnits(list &targets); + void FindUnits(std::list &targets); bool AcceptUnit(Unit* unit); }; diff --git a/playerbot/strategy/values/NearestFriendlyPlayersValue.cpp b/playerbot/strategy/values/NearestFriendlyPlayersValue.cpp index f72c8c26..bd44566b 100644 --- a/playerbot/strategy/values/NearestFriendlyPlayersValue.cpp +++ b/playerbot/strategy/values/NearestFriendlyPlayersValue.cpp @@ -9,7 +9,7 @@ using namespace ai; using namespace MaNGOS; -void NearestFriendlyPlayersValue::FindUnits(list &targets) +void NearestFriendlyPlayersValue::FindUnits(std::list &targets) { AnyFriendlyUnitInObjectRangeCheck u_check(bot, range); UnitListSearcher searcher(targets, u_check); diff --git a/playerbot/strategy/values/NearestFriendlyPlayersValue.h b/playerbot/strategy/values/NearestFriendlyPlayersValue.h index 0dd11675..66a4ac78 100644 --- a/playerbot/strategy/values/NearestFriendlyPlayersValue.h +++ b/playerbot/strategy/values/NearestFriendlyPlayersValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "NearestUnitsValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -12,7 +12,7 @@ namespace ai NearestUnitsValue(ai, "nearest friendly players", range) {} protected: - void FindUnits(list &targets); + void FindUnits(std::list &targets); virtual bool AcceptUnit(Unit* unit); }; } diff --git a/playerbot/strategy/values/NearestGameObjects.cpp b/playerbot/strategy/values/NearestGameObjects.cpp index 99a9e1fa..863c295d 100644 --- a/playerbot/strategy/values/NearestGameObjects.cpp +++ b/playerbot/strategy/values/NearestGameObjects.cpp @@ -44,9 +44,9 @@ class AnyDynamicObjectInObjectRangeCheck float i_range; }; -list NearestGameObjects::Calculate() +std::list NearestGameObjects::Calculate() { - list targets; + std::list targets; if (!qualifier.empty()) { @@ -62,8 +62,8 @@ list NearestGameObjects::Calculate() Cell::VisitAllObjects((const WorldObject*)bot, searcher, range); } - list result; - for(list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) + std::list result; + for(std::list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { GameObject* go = *tIter; if(ignoreLos || sServerFacade.IsWithinLOSInMap(bot, go)) @@ -73,9 +73,9 @@ list NearestGameObjects::Calculate() return result; } -list NearestDynamicObjects::Calculate() +std::list NearestDynamicObjects::Calculate() { - list targets; + std::list targets; // Remove this when updating wotlk core #ifndef MANGOSBOT_TWO @@ -84,8 +84,8 @@ list NearestDynamicObjects::Calculate() Cell::VisitAllObjects((const WorldObject*)bot, searcher, range); #endif - list result; - for (list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) + std::list result; + for (std::list::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { DynamicObject* go = *tIter; if (ignoreLos || sServerFacade.IsWithinLOSInMap(bot, go)) diff --git a/playerbot/strategy/values/NearestGameObjects.h b/playerbot/strategy/values/NearestGameObjects.h index 9f7d9d99..ac6aa418 100644 --- a/playerbot/strategy/values/NearestGameObjects.h +++ b/playerbot/strategy/values/NearestGameObjects.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/PlayerbotAIConfig.h" namespace ai @@ -30,11 +30,11 @@ namespace ai class NearestGameObjects : public ObjectGuidListCalculatedValue, public Qualified { public: - NearestGameObjects(PlayerbotAI* ai, float range = sPlayerbotAIConfig.sightDistance, bool ignoreLos = false, string name = "nearest game objects") : + NearestGameObjects(PlayerbotAI* ai, float range = sPlayerbotAIConfig.sightDistance, bool ignoreLos = false, std::string name = "nearest game objects") : ObjectGuidListCalculatedValue(ai, name), range(range) , ignoreLos(ignoreLos), Qualified() {} protected: - virtual list Calculate(); + virtual std::list Calculate(); private: float range; @@ -44,11 +44,11 @@ namespace ai class NearestDynamicObjects : public ObjectGuidListCalculatedValue { public: - NearestDynamicObjects(PlayerbotAI* ai, float range = sPlayerbotAIConfig.farDistance, bool ignoreLos = false, string name = "nearest dynamic objects") : + NearestDynamicObjects(PlayerbotAI* ai, float range = sPlayerbotAIConfig.farDistance, bool ignoreLos = false, std::string name = "nearest dynamic objects") : ObjectGuidListCalculatedValue(ai, name), range(range), ignoreLos(ignoreLos) {} protected: - virtual list Calculate(); + virtual std::list Calculate(); private: float range; diff --git a/playerbot/strategy/values/NearestNonBotPlayersValue.cpp b/playerbot/strategy/values/NearestNonBotPlayersValue.cpp index 0ff32aba..dc247059 100644 --- a/playerbot/strategy/values/NearestNonBotPlayersValue.cpp +++ b/playerbot/strategy/values/NearestNonBotPlayersValue.cpp @@ -9,7 +9,7 @@ using namespace ai; using namespace MaNGOS; -void NearestNonBotPlayersValue::FindUnits(list &targets) +void NearestNonBotPlayersValue::FindUnits(std::list &targets) { AnyUnitInObjectRangeCheck u_check(bot, range); UnitListSearcher searcher(targets, u_check); diff --git a/playerbot/strategy/values/NearestNonBotPlayersValue.h b/playerbot/strategy/values/NearestNonBotPlayersValue.h index 44f83e33..66ed4e5e 100644 --- a/playerbot/strategy/values/NearestNonBotPlayersValue.h +++ b/playerbot/strategy/values/NearestNonBotPlayersValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "NearestUnitsValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -12,7 +12,7 @@ namespace ai NearestUnitsValue(ai, "nearest non bot players", range, true) {} protected: - void FindUnits(list &targets); + void FindUnits(std::list &targets); bool AcceptUnit(Unit* unit); }; } diff --git a/playerbot/strategy/values/NearestNpcsValue.cpp b/playerbot/strategy/values/NearestNpcsValue.cpp index fb554ff8..f01287ac 100644 --- a/playerbot/strategy/values/NearestNpcsValue.cpp +++ b/playerbot/strategy/values/NearestNpcsValue.cpp @@ -13,7 +13,7 @@ using namespace ai; using namespace MaNGOS; -void NearestNpcsValue::FindUnits(list &targets) +void NearestNpcsValue::FindUnits(std::list &targets) { AnyUnitInObjectRangeCheck u_check(bot, range); UnitListSearcher searcher(targets, u_check); @@ -25,7 +25,7 @@ bool NearestNpcsValue::AcceptUnit(Unit* unit) return !sServerFacade.IsHostileTo(unit, bot) && !dynamic_cast(unit); } -void NearestVehiclesValue::FindUnits(list& targets) +void NearestVehiclesValue::FindUnits(std::list& targets) { AnyUnitInObjectRangeCheck u_check(bot, range); UnitListSearcher searcher(targets, u_check); diff --git a/playerbot/strategy/values/NearestNpcsValue.h b/playerbot/strategy/values/NearestNpcsValue.h index 42d13a6a..3d63010a 100644 --- a/playerbot/strategy/values/NearestNpcsValue.h +++ b/playerbot/strategy/values/NearestNpcsValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "NearestUnitsValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -12,7 +12,7 @@ namespace ai NearestUnitsValue(ai, "nearest npcs", range, ignoreLos) {} protected: - void FindUnits(list &targets); + void FindUnits(std::list &targets); bool AcceptUnit(Unit* unit); }; @@ -23,7 +23,7 @@ namespace ai NearestUnitsValue(ai, "nearest vehicles", range) {} protected: - void FindUnits(list& targets); + void FindUnits(std::list& targets); bool AcceptUnit(Unit* unit); }; } diff --git a/playerbot/strategy/values/NearestUnitsValue.h b/playerbot/strategy/values/NearestUnitsValue.h index 18633e92..b15087a3 100644 --- a/playerbot/strategy/values/NearestUnitsValue.h +++ b/playerbot/strategy/values/NearestUnitsValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/ServerFacade.h" @@ -12,17 +12,17 @@ namespace ai class NearestUnitsValue : public ObjectGuidListCalculatedValue { public: - NearestUnitsValue(PlayerbotAI* ai, string name = "nearest units", float range = sPlayerbotAIConfig.sightDistance, bool ignoreLos = false) : + NearestUnitsValue(PlayerbotAI* ai, std::string name = "nearest units", float range = sPlayerbotAIConfig.sightDistance, bool ignoreLos = false) : ObjectGuidListCalculatedValue(ai, name, 2), range(range), ignoreLos(ignoreLos) {} public: - virtual list Calculate() + virtual std::list Calculate() { - list targets; + std::list targets; FindUnits(targets); - list results; - for(list::iterator i = targets.begin(); i!= targets.end(); ++i) + std::list results; + for(std::list::iterator i = targets.begin(); i!= targets.end(); ++i) { Unit* unit = *i; if(ai->IsSafe(unit)) @@ -35,7 +35,7 @@ namespace ai } protected: - virtual void FindUnits(list &targets) = 0; + virtual void FindUnits(std::list &targets) = 0; virtual bool AcceptUnit(Unit* unit) = 0; protected: @@ -50,7 +50,7 @@ namespace ai NearestUnitsValue(ai, "nearest stealthed units", range) {} protected: - void FindUnits(list& targets) + void FindUnits(std::list& targets) { MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(bot, range); MaNGOS::UnitListSearcher searcher(targets, u_check); @@ -79,12 +79,12 @@ namespace ai virtual Unit* Calculate() { - list targets = AI_VALUE(list, "nearest stealthed units"); + std::list targets = AI_VALUE(std::list, "nearest stealthed units"); if (targets.empty()) return nullptr; - vector units; - for (list::iterator i = targets.begin(); i != targets.end(); ++i) + std::vector units; + for (std::list::iterator i = targets.begin(); i != targets.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (!unit) diff --git a/playerbot/strategy/values/NewPlayerNearbyValue.cpp b/playerbot/strategy/values/NewPlayerNearbyValue.cpp index 33f338e3..490e4c52 100644 --- a/playerbot/strategy/values/NewPlayerNearbyValue.cpp +++ b/playerbot/strategy/values/NewPlayerNearbyValue.cpp @@ -6,9 +6,9 @@ using namespace ai; ObjectGuid NewPlayerNearbyValue::Calculate() { - list players = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); - set& alreadySeenPlayers = ai->GetAiObjectContext()->GetValue& >("already seen players")->Get(); - for (list::iterator i = players.begin(); i != players.end(); ++i) + std::list players = ai->GetAiObjectContext()->GetValue >("nearest friendly players")->Get(); + std::set& alreadySeenPlayers = ai->GetAiObjectContext()->GetValue& >("already seen players")->Get(); + for (std::list::iterator i = players.begin(); i != players.end(); ++i) { ObjectGuid guid = *i; if (alreadySeenPlayers.find(guid) == alreadySeenPlayers.end()) diff --git a/playerbot/strategy/values/NewPlayerNearbyValue.h b/playerbot/strategy/values/NewPlayerNearbyValue.h index e11de0b2..e98abe27 100644 --- a/playerbot/strategy/values/NewPlayerNearbyValue.h +++ b/playerbot/strategy/values/NewPlayerNearbyValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -10,12 +10,12 @@ namespace ai virtual ObjectGuid Calculate(); }; - class AlreadySeenPlayersValue : public ManualSetValue& > + class AlreadySeenPlayersValue : public ManualSetValue& > { public: - AlreadySeenPlayersValue(PlayerbotAI* ai) : ManualSetValue& >(ai, data, "already seen players") {} + AlreadySeenPlayersValue(PlayerbotAI* ai) : ManualSetValue& >(ai, data, "already seen players") {} private: - set data; + std::set data; }; } diff --git a/playerbot/strategy/values/OperatorValues.cpp b/playerbot/strategy/values/OperatorValues.cpp index e1b443ab..032cdb40 100644 --- a/playerbot/strategy/values/OperatorValues.cpp +++ b/playerbot/strategy/values/OperatorValues.cpp @@ -1,13 +1,12 @@ -#include "../../../botpch.h" #include "playerbot/playerbot.h" -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "OperatorValues.h" namespace ai { bool BoolAndValue::Calculate() { - vector values = getMultiQualifiers(getQualifier(), ","); + std::vector values = getMultiQualifiers(getQualifier(), ","); for (auto value : values) { @@ -20,7 +19,7 @@ namespace ai bool NotValue::Calculate() { - vector values = getMultiQualifiers(getQualifier(), ","); + std::vector values = getMultiQualifiers(getQualifier(), ","); for (auto value : values) { diff --git a/playerbot/strategy/values/OperatorValues.h b/playerbot/strategy/values/OperatorValues.h index 63c4aeba..14d849f0 100644 --- a/playerbot/strategy/values/OperatorValues.h +++ b/playerbot/strategy/values/OperatorValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -10,13 +10,13 @@ namespace ai virtual bool Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "bool and"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "operator"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "bool and"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "operator"; } + virtual std::string GetHelpDescription() { return "This value will return true if all of the values included in the qualifier return true."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; @@ -27,13 +27,13 @@ namespace ai virtual bool Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "not"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "operator"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "not"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "operator"; } + virtual std::string GetHelpDescription() { return "This value will return false if any of the values included in the qualifier return true."; } - virtual vector GetUsedValues() { return { }; } + virtual std::vector GetUsedValues() { return { }; } #endif }; } diff --git a/playerbot/strategy/values/OutfitListValue.cpp b/playerbot/strategy/values/OutfitListValue.cpp index 7e1b3e78..f8665274 100644 --- a/playerbot/strategy/values/OutfitListValue.cpp +++ b/playerbot/strategy/values/OutfitListValue.cpp @@ -3,11 +3,10 @@ #include "OutfitListValue.h" using namespace ai; -using namespace std; -string OutfitListValue::Save() +std::string OutfitListValue::Save() { - ostringstream out; + std::ostringstream out; bool first = true; for (Outfit::iterator i = value.begin(); i != value.end(); ++i) { @@ -18,12 +17,12 @@ string OutfitListValue::Save() return out.str(); } -bool OutfitListValue::Load(string text) +bool OutfitListValue::Load(std::string text) { value.clear(); - vector ss = split(text, '^'); - for (vector::iterator i = ss.begin(); i != ss.end(); ++i) + std::vector ss = split(text, '^'); + for (std::vector::iterator i = ss.begin(); i != ss.end(); ++i) { value.push_back(*i); } diff --git a/playerbot/strategy/values/OutfitListValue.h b/playerbot/strategy/values/OutfitListValue.h index 2782009c..96d733b1 100644 --- a/playerbot/strategy/values/OutfitListValue.h +++ b/playerbot/strategy/values/OutfitListValue.h @@ -1,16 +1,16 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { - typedef list Outfit; + typedef std::list Outfit; class OutfitListValue : public ManualSetValue { public: - OutfitListValue(PlayerbotAI* ai, string name = "outfit list") : ManualSetValue(ai, list, name) {} + OutfitListValue(PlayerbotAI* ai, std::string name = "outfit list") : ManualSetValue(ai, list, name) {} - virtual string Save(); - virtual bool Load(string value); + virtual std::string Save(); + virtual bool Load(std::string value); private: Outfit list; diff --git a/playerbot/strategy/values/PartyMemberToDispel.h b/playerbot/strategy/values/PartyMemberToDispel.h index 12dceba2..45b57b63 100644 --- a/playerbot/strategy/values/PartyMemberToDispel.h +++ b/playerbot/strategy/values/PartyMemberToDispel.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "PartyMemberValue.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class PartyMemberToDispel : public PartyMemberValue, public Qualified { public: - PartyMemberToDispel(PlayerbotAI* ai, string name = "party member to dispel") : + PartyMemberToDispel(PlayerbotAI* ai, std::string name = "party member to dispel") : PartyMemberValue(ai, name), Qualified() {} protected: diff --git a/playerbot/strategy/values/PartyMemberToHeal.cpp b/playerbot/strategy/values/PartyMemberToHeal.cpp index cf087ec7..8dfcbcd8 100644 --- a/playerbot/strategy/values/PartyMemberToHeal.cpp +++ b/playerbot/strategy/values/PartyMemberToHeal.cpp @@ -41,8 +41,8 @@ bool compareByMissingHealth(const Unit* u1, const Unit* u2, bool incomingDamage Unit* PartyMemberToHeal::Calculate() { - vector needHeals; - vector tankTargets; + std::vector needHeals; + std::vector tankTargets; if (bot->GetSelectionGuid()) { Unit* target = ai->GetUnit(bot->GetSelectionGuid()); @@ -235,10 +235,10 @@ Unit* PartyMemberToProtect::Calculate() if (!group) return NULL; - vector needProtect; + std::vector needProtect; - list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + std::list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (!unit) diff --git a/playerbot/strategy/values/PartyMemberToHeal.h b/playerbot/strategy/values/PartyMemberToHeal.h index 3042aeba..c976c084 100644 --- a/playerbot/strategy/values/PartyMemberToHeal.h +++ b/playerbot/strategy/values/PartyMemberToHeal.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "PartyMemberValue.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class PartyMemberToHeal : public PartyMemberValue { public: - PartyMemberToHeal(PlayerbotAI* ai, string name = "party member to heal") : + PartyMemberToHeal(PlayerbotAI* ai, std::string name = "party member to heal") : PartyMemberValue(ai, name) {} protected: @@ -22,7 +22,7 @@ namespace ai class PartyMemberToProtect : public PartyMemberValue { public: - PartyMemberToProtect(PlayerbotAI* ai, string name = "party member to protect") : + PartyMemberToProtect(PlayerbotAI* ai, std::string name = "party member to protect") : PartyMemberValue(ai, name) {} protected: @@ -32,7 +32,7 @@ namespace ai class PartyMemberToRemoveRoots : public PartyMemberValue { public: - PartyMemberToRemoveRoots(PlayerbotAI* ai, string name = "party member to remove roots") : + PartyMemberToRemoveRoots(PlayerbotAI* ai, std::string name = "party member to remove roots") : PartyMemberValue(ai, name) {} protected: diff --git a/playerbot/strategy/values/PartyMemberToResurrect.h b/playerbot/strategy/values/PartyMemberToResurrect.h index e3d6fdf8..9bcc40ce 100644 --- a/playerbot/strategy/values/PartyMemberToResurrect.h +++ b/playerbot/strategy/values/PartyMemberToResurrect.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "PartyMemberValue.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class PartyMemberToResurrect : public PartyMemberValue { public: - PartyMemberToResurrect(PlayerbotAI* ai, string name = "party member to resurrect") : + PartyMemberToResurrect(PlayerbotAI* ai, std::string name = "party member to resurrect") : PartyMemberValue(ai,name) {} protected: diff --git a/playerbot/strategy/values/PartyMemberValue.cpp b/playerbot/strategy/values/PartyMemberValue.cpp index 803555fc..031ce1e1 100644 --- a/playerbot/strategy/values/PartyMemberValue.cpp +++ b/playerbot/strategy/values/PartyMemberValue.cpp @@ -5,11 +5,10 @@ #include "playerbot/ServerFacade.h" using namespace ai; -using namespace std; -Unit* PartyMemberValue::FindPartyMember(list* party, FindPlayerPredicate &predicate, bool ignoreTanks) +Unit* PartyMemberValue::FindPartyMember(std::list* party, FindPlayerPredicate &predicate, bool ignoreTanks) { - for (list::iterator i = party->begin(); i != party->end(); ++i) + for (std::list::iterator i = party->begin(); i != party->end(); ++i) { Player* player = *i; @@ -35,11 +34,11 @@ Unit* PartyMemberValue::FindPartyMember(list* party, FindPlayerPredicat Unit* PartyMemberValue::FindPartyMember(FindPlayerPredicate &predicate, bool ignoreOutOfGroup, bool ignoreTanks) { Player* master = GetMaster(); - list nearestPlayers; + std::list nearestPlayers; if(ai->AllowActivity(OUT_OF_PARTY_ACTIVITY)) - nearestPlayers = AI_VALUE(list, "nearest friendly players"); + nearestPlayers = AI_VALUE(std::list, "nearest friendly players"); - list nearestGroupPlayers; + std::list nearestGroupPlayers; Group* group = bot->GetGroup(); if (group) @@ -67,9 +66,9 @@ Unit* PartyMemberValue::FindPartyMember(FindPlayerPredicate &predicate, bool ign nearestPlayers = nearestGroupPlayers; - list healers, tanks, others, masters; + std::list healers, tanks, others, masters; if (master) masters.push_back(master); - for (list::iterator i = nearestPlayers.begin(); i != nearestPlayers.end(); ++i) + for (std::list::iterator i = nearestPlayers.begin(); i != nearestPlayers.end(); ++i) { Player* player = dynamic_cast(ai->GetUnit(*i)); if (!player || player == bot) @@ -91,15 +90,15 @@ Unit* PartyMemberValue::FindPartyMember(FindPlayerPredicate &predicate, bool ign } } - list* > lists; + std::list* > lists; lists.push_back(&healers); lists.push_back(&tanks); lists.push_back(&masters); lists.push_back(&others); - for (list* >::iterator i = lists.begin(); i != lists.end(); ++i) + for (std::list* >::iterator i = lists.begin(); i != lists.end(); ++i) { - list* party = *i; + std::list* party = *i; Unit* target = FindPartyMember(party, predicate, ignoreTanks); if (target) return target; @@ -124,11 +123,11 @@ bool PartyMemberValue::Check(Unit* player) bool PartyMemberValue::IsTargetOfSpellCast(Player* target, SpellEntryPredicate &predicate) { - list nearestPlayers = AI_VALUE(list, "nearest friendly players"); + std::list nearestPlayers = AI_VALUE(std::list, "nearest friendly players"); ObjectGuid targetGuid = target ? target->GetObjectGuid() : bot->GetObjectGuid(); ObjectGuid corpseGuid = target && target->GetCorpse() ? target->GetCorpse()->GetObjectGuid() : ObjectGuid(); - for (list::iterator i = nearestPlayers.begin(); i != nearestPlayers.end(); ++i) + for (std::list::iterator i = nearestPlayers.begin(); i != nearestPlayers.end(); ++i) { Player* player = dynamic_cast(ai->GetUnit(*i)); if (!player || player == bot) diff --git a/playerbot/strategy/values/PartyMemberValue.h b/playerbot/strategy/values/PartyMemberValue.h index 4a9640c4..1f7818f0 100644 --- a/playerbot/strategy/values/PartyMemberValue.h +++ b/playerbot/strategy/values/PartyMemberValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -19,14 +19,14 @@ namespace ai class PartyMemberValue : public UnitCalculatedValue { public: - PartyMemberValue(PlayerbotAI* ai, string name = "party member") : UnitCalculatedValue(ai, name) {} + PartyMemberValue(PlayerbotAI* ai, std::string name = "party member") : UnitCalculatedValue(ai, name) {} public: bool IsTargetOfSpellCast(Player* target, SpellEntryPredicate &predicate); protected: Unit* FindPartyMember(FindPlayerPredicate &predicate, bool ignoreOutOfGroup = false, bool ignoreTanks = false); - Unit* FindPartyMember(list* party, FindPlayerPredicate &predicate, bool ignoreTanks); + Unit* FindPartyMember(std::list* party, FindPlayerPredicate &predicate, bool ignoreTanks); bool Check(Unit* player); }; } diff --git a/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp b/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp index d175298e..a3b57b75 100644 --- a/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp +++ b/playerbot/strategy/values/PartyMemberWithoutAuraValue.cpp @@ -5,12 +5,12 @@ #include "playerbot/ServerFacade.h" using namespace ai; -extern vector split(const string &s, char delim); +extern std::vector split(const std::string &s, char delim); class PlayerWithoutAuraPredicate : public FindPlayerPredicate, public PlayerbotAIAware { public: - PlayerWithoutAuraPredicate(PlayerbotAI* ai, string aura) : + PlayerWithoutAuraPredicate(PlayerbotAI* ai, std::string aura) : PlayerbotAIAware(ai), FindPlayerPredicate(), auras(split(aura, ',')) {} public: @@ -22,7 +22,7 @@ class PlayerWithoutAuraPredicate : public FindPlayerPredicate, public PlayerbotA if (!sServerFacade.IsAlive(unit)) return false; - for (vector::iterator i = auras.begin(); i != auras.end(); ++i) + for (std::vector::iterator i = auras.begin(); i != auras.end(); ++i) { #ifdef MANGOSBOT_ZERO // Ignore mana buff spells for non mana users @@ -43,7 +43,7 @@ class PlayerWithoutAuraPredicate : public FindPlayerPredicate, public PlayerbotA } private: - vector auras; + std::vector auras; }; Unit* FriendlyUnitWithoutAuraValue::Calculate() @@ -81,7 +81,7 @@ Unit* PartyMemberWithoutAuraValue::Calculate() class PlayerWithoutMyAuraPredicate : public FindPlayerPredicate, public PlayerbotAIAware { public: - PlayerWithoutMyAuraPredicate(PlayerbotAI* ai, string aura) : + PlayerWithoutMyAuraPredicate(PlayerbotAI* ai, std::string aura) : PlayerbotAIAware(ai), FindPlayerPredicate(), auras(split(aura, ',')) {} public: @@ -94,7 +94,7 @@ class PlayerWithoutMyAuraPredicate : public FindPlayerPredicate, public Playerbo if (!sServerFacade.IsAlive(unit)) return false; if (sServerFacade.GetDistance2d(unit, ai->GetBot()) > 30.0f) return false; - for (vector::iterator i = auras.begin(); i != auras.end(); ++i) + for (std::vector::iterator i = auras.begin(); i != auras.end(); ++i) { if (ai->HasMyAura(*i, unit)) return false; @@ -104,7 +104,7 @@ class PlayerWithoutMyAuraPredicate : public FindPlayerPredicate, public Playerbo } private: - vector auras; + std::vector auras; }; Unit* PartyMemberWithoutMyAuraValue::Calculate() @@ -126,7 +126,7 @@ Unit* PartyMemberWithoutMyAuraValue::Calculate() class TankWithoutAuraPredicate : public FindPlayerPredicate, public PlayerbotAIAware { public: - TankWithoutAuraPredicate(PlayerbotAI* ai, string aura) : + TankWithoutAuraPredicate(PlayerbotAI* ai, std::string aura) : PlayerbotAIAware(ai), FindPlayerPredicate(), auras(split(aura, ',')) {} public: @@ -137,7 +137,7 @@ class TankWithoutAuraPredicate : public FindPlayerPredicate, public PlayerbotAIA if (ai->IsTank((Player*)unit)) { bool missingAura = false; - for (vector::iterator i = auras.begin(); i != auras.end(); ++i) + for (std::vector::iterator i = auras.begin(); i != auras.end(); ++i) { if (!ai->HasAura(*i, unit)) { @@ -154,7 +154,7 @@ class TankWithoutAuraPredicate : public FindPlayerPredicate, public PlayerbotAIA } private: - vector auras; + std::vector auras; }; Unit* PartyTankWithoutAuraValue::Calculate() diff --git a/playerbot/strategy/values/PartyMemberWithoutAuraValue.h b/playerbot/strategy/values/PartyMemberWithoutAuraValue.h index 406cca30..09bc29ff 100644 --- a/playerbot/strategy/values/PartyMemberWithoutAuraValue.h +++ b/playerbot/strategy/values/PartyMemberWithoutAuraValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "PartyMemberValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -8,7 +8,7 @@ namespace ai class FriendlyUnitWithoutAuraValue : public PartyMemberValue, public Qualified { public: - FriendlyUnitWithoutAuraValue(PlayerbotAI* ai, string name = "friendly unit without aura", float range = sPlayerbotAIConfig.sightDistance) : + FriendlyUnitWithoutAuraValue(PlayerbotAI* ai, std::string name = "friendly unit without aura", float range = sPlayerbotAIConfig.sightDistance) : PartyMemberValue(ai, name), Qualified() {} protected: @@ -18,7 +18,7 @@ namespace ai class PartyMemberWithoutAuraValue : public PartyMemberValue, public Qualified { public: - PartyMemberWithoutAuraValue(PlayerbotAI* ai, string name = "party member without aura", float range = sPlayerbotAIConfig.sightDistance) : + PartyMemberWithoutAuraValue(PlayerbotAI* ai, std::string name = "party member without aura", float range = sPlayerbotAIConfig.sightDistance) : PartyMemberValue(ai, name), Qualified() {} protected: @@ -28,7 +28,7 @@ namespace ai class PartyMemberWithoutMyAuraValue : public PartyMemberValue, public Qualified { public: - PartyMemberWithoutMyAuraValue(PlayerbotAI* ai, string name = "party member without my aura", float range = 30.0f) : + PartyMemberWithoutMyAuraValue(PlayerbotAI* ai, std::string name = "party member without my aura", float range = 30.0f) : PartyMemberValue(ai, name), Qualified() {} protected: @@ -38,7 +38,7 @@ namespace ai class PartyTankWithoutAuraValue : public PartyMemberValue, public Qualified { public: - PartyTankWithoutAuraValue(PlayerbotAI* ai, string name = "party tank without aura", float range = 30.0f) : + PartyTankWithoutAuraValue(PlayerbotAI* ai, std::string name = "party tank without aura", float range = 30.0f) : PartyMemberValue(ai, name), Qualified() {} protected: diff --git a/playerbot/strategy/values/PartyMemberWithoutItemValue.cpp b/playerbot/strategy/values/PartyMemberWithoutItemValue.cpp index 05220fc6..f875b77d 100644 --- a/playerbot/strategy/values/PartyMemberWithoutItemValue.cpp +++ b/playerbot/strategy/values/PartyMemberWithoutItemValue.cpp @@ -8,7 +8,7 @@ using namespace ai; class PlayerWithoutItemPredicate : public FindPlayerPredicate, public PlayerbotAIAware { public: - PlayerWithoutItemPredicate(PlayerbotAI* ai, string item) : + PlayerWithoutItemPredicate(PlayerbotAI* ai, std::string item) : PlayerbotAIAware(ai), FindPlayerPredicate(), item(item) {} public: @@ -41,7 +41,7 @@ class PlayerWithoutItemPredicate : public FindPlayerPredicate, public PlayerbotA } private: - string item; + std::string item; }; Unit* PartyMemberWithoutItemValue::Calculate() diff --git a/playerbot/strategy/values/PartyMemberWithoutItemValue.h b/playerbot/strategy/values/PartyMemberWithoutItemValue.h index 99d78724..677f6bd1 100644 --- a/playerbot/strategy/values/PartyMemberWithoutItemValue.h +++ b/playerbot/strategy/values/PartyMemberWithoutItemValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "PartyMemberValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -8,7 +8,7 @@ namespace ai class PartyMemberWithoutItemValue : public PartyMemberValue, public Qualified { public: - PartyMemberWithoutItemValue(PlayerbotAI* ai, string name = "party member without item", float range = sPlayerbotAIConfig.farDistance) : + PartyMemberWithoutItemValue(PlayerbotAI* ai, std::string name = "party member without item", float range = sPlayerbotAIConfig.farDistance) : PartyMemberValue(ai, name), Qualified() {} protected: @@ -19,7 +19,7 @@ namespace ai class PartyMemberWithoutFoodValue : public PartyMemberWithoutItemValue { public: - PartyMemberWithoutFoodValue(PlayerbotAI* ai, string name = "party member without food") : PartyMemberWithoutItemValue(ai, name) {} + PartyMemberWithoutFoodValue(PlayerbotAI* ai, std::string name = "party member without food") : PartyMemberWithoutItemValue(ai, name) {} protected: virtual FindPlayerPredicate* CreatePredicate(); @@ -28,7 +28,7 @@ namespace ai class PartyMemberWithoutWaterValue : public PartyMemberWithoutItemValue { public: - PartyMemberWithoutWaterValue(PlayerbotAI* ai, string name = "party member without water") : PartyMemberWithoutItemValue(ai, name) {} + PartyMemberWithoutWaterValue(PlayerbotAI* ai, std::string name = "party member without water") : PartyMemberWithoutItemValue(ai, name) {} protected: virtual FindPlayerPredicate* CreatePredicate(); diff --git a/playerbot/strategy/values/PetTargetValue.h b/playerbot/strategy/values/PetTargetValue.h index 89b431a4..86888695 100644 --- a/playerbot/strategy/values/PetTargetValue.h +++ b/playerbot/strategy/values/PetTargetValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class PetTargetValue : public UnitCalculatedValue { public: - PetTargetValue(PlayerbotAI* ai, string name = "pet target") : UnitCalculatedValue(ai, name) {} + PetTargetValue(PlayerbotAI* ai, std::string name = "pet target") : UnitCalculatedValue(ai, name) {} virtual Unit* Calculate() { return (Unit*)(ai->GetBot()->GetPet()); } }; diff --git a/playerbot/strategy/values/PositionValue.cpp b/playerbot/strategy/values/PositionValue.cpp index 92012081..6a9e6de1 100644 --- a/playerbot/strategy/values/PositionValue.cpp +++ b/playerbot/strategy/values/PositionValue.cpp @@ -4,18 +4,18 @@ using namespace ai; -PositionValue::PositionValue(PlayerbotAI* ai, string name) +PositionValue::PositionValue(PlayerbotAI* ai, std::string name) : ManualSetValue(ai, positions, name) { } -string PositionValue::Save() +std::string PositionValue::Save() { - ostringstream out; + std::ostringstream out; bool first = true; for (ai::PositionMap::iterator i = value.begin(); i != value.end(); ++i) { - string name = i->first; + std::string name = i->first; ai::PositionEntry pos = i->second; if (pos.isSet()) { @@ -28,18 +28,18 @@ string PositionValue::Save() return out.str(); } -bool PositionValue::Load(string text) +bool PositionValue::Load(std::string text) { value.clear(); - vector ss = split(text, '^'); - for (vector::iterator i = ss.begin(); i != ss.end(); ++i) + std::vector ss = split(text, '^'); + for (std::vector::iterator i = ss.begin(); i != ss.end(); ++i) { - vector s1 = split(*i, '='); + std::vector s1 = split(*i, '='); if (s1.size() != 2) continue; - string name = s1[0]; + std::string name = s1[0]; - vector s2 = split(s1[1], ','); + std::vector s2 = split(s1[1], ','); if (s2.size() != 4) continue; double x = atof(s2[0].c_str()); double y = atof(s2[1].c_str()); diff --git a/playerbot/strategy/values/PositionValue.h b/playerbot/strategy/values/PositionValue.h index b8dc6f64..081a5590 100644 --- a/playerbot/strategy/values/PositionValue.h +++ b/playerbot/strategy/values/PositionValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -22,14 +22,14 @@ namespace ai uint32 mapId; }; - typedef map PositionMap; + typedef std::map PositionMap; class PositionValue : public ManualSetValue { public: - PositionValue(PlayerbotAI* ai, string name = "position"); - virtual string Save(); - virtual bool Load(string value); + PositionValue(PlayerbotAI* ai, std::string name = "position"); + virtual std::string Save(); + virtual bool Load(std::string value); private: PositionMap positions; @@ -38,7 +38,7 @@ namespace ai class SinglePositionValue : public CalculatedValue, public Qualified { public: - SinglePositionValue(PlayerbotAI* ai, string name = "pos") : CalculatedValue(ai, name), Qualified() {}; + SinglePositionValue(PlayerbotAI* ai, std::string name = "pos") : CalculatedValue(ai, name), Qualified() {}; virtual PositionEntry Calculate() override; virtual void Set(PositionEntry value) override; virtual void Reset() override; @@ -47,7 +47,7 @@ namespace ai class CurrentPositionValue : public LogCalculatedValue { public: - CurrentPositionValue(PlayerbotAI* ai, string name = "current position", uint32 checkInterval = 1) : LogCalculatedValue(ai, name, checkInterval) { minChangeInterval = 60; logLength = 30; }; + CurrentPositionValue(PlayerbotAI* ai, std::string name = "current position", uint32 checkInterval = 1) : LogCalculatedValue(ai, name, checkInterval) { minChangeInterval = 60; logLength = 30; }; virtual bool EqualToLast(WorldPosition value) { return value.fDist(lastValue) < sPlayerbotAIConfig.tooCloseDistance; } virtual WorldPosition Calculate() { return WorldPosition(bot); }; }; @@ -55,7 +55,7 @@ namespace ai class MasterPositionValue : public MemoryCalculatedValue { public: - MasterPositionValue(PlayerbotAI* ai, string name = "master position", uint32 checkInterval = 1) : MemoryCalculatedValue(ai, name, checkInterval) { minChangeInterval = 1; }; + MasterPositionValue(PlayerbotAI* ai, std::string name = "master position", uint32 checkInterval = 1) : MemoryCalculatedValue(ai, name, checkInterval) { minChangeInterval = 1; }; virtual bool EqualToLast(WorldPosition value) { return value.fDist(lastValue) < sPlayerbotAIConfig.lootDistance; } virtual WorldPosition Calculate() { Player* master = GetMaster(); if (master) return WorldPosition(master); return WorldPosition(); }; }; @@ -63,7 +63,7 @@ namespace ai class CustomPositionValue : public ManualSetValue, public Qualified { public: - CustomPositionValue(PlayerbotAI* ai, string name = "custom position") : ManualSetValue(ai, WorldPosition(), name), Qualified() { }; + CustomPositionValue(PlayerbotAI* ai, std::string name = "custom position") : ManualSetValue(ai, WorldPosition(), name), Qualified() { }; virtual WorldPosition Calculate() { return WorldPosition(bot); }; }; } diff --git a/playerbot/strategy/values/PossibleAttackTargetsValue.cpp b/playerbot/strategy/values/PossibleAttackTargetsValue.cpp index fe8e5d17..26d8684a 100644 --- a/playerbot/strategy/values/PossibleAttackTargetsValue.cpp +++ b/playerbot/strategy/values/PossibleAttackTargetsValue.cpp @@ -13,9 +13,9 @@ using namespace ai; using namespace MaNGOS; -list PossibleAttackTargetsValue::Calculate() +std::list PossibleAttackTargetsValue::Calculate() { - list result; + std::list result; if (ai->AllowActivity(ALL_ACTIVITY)) { if (bot->IsInWorld() && !bot->IsBeingTeleported()) @@ -30,14 +30,14 @@ list PossibleAttackTargetsValue::Calculate() if (getOne) { // Try to get one possible attack target - result = AI_VALUE2(list, "attackers", 1); + result = AI_VALUE2(std::list, "attackers", 1); RemoveNonThreating(result, getOne); } // If the one possible attack target failed, retry with multiple attackers if (result.empty()) { - result = AI_VALUE(list, "attackers"); + result = AI_VALUE(std::list, "attackers"); RemoveNonThreating(result, getOne); } } @@ -46,31 +46,31 @@ list PossibleAttackTargetsValue::Calculate() return result; } -void PossibleAttackTargetsValue::RemoveNonThreating(list& targets, bool getOne) +void PossibleAttackTargetsValue::RemoveNonThreating(std::list& targets, bool getOne) { - list breakableCC; - list unBreakableCC; + std::list breakableCC; + std::list unBreakableCC; - for(list::iterator tIter = targets.begin(); tIter != targets.end();) + for(std::list::iterator tIter = targets.begin(); tIter != targets.end();) { Unit* target = ai->GetUnit(*tIter); if (!IsValid(target, bot, sPlayerbotAIConfig.sightDistance, true, false)) { - list::iterator tIter2 = tIter; + std::list::iterator tIter2 = tIter; ++tIter; targets.erase(tIter2); } else if (!HasIgnoreCCRti(target, bot) && HasBreakableCC(target, bot)) { breakableCC.push_back(*tIter); - list::iterator tIter2 = tIter; + std::list::iterator tIter2 = tIter; ++tIter; targets.erase(tIter2); } else if (!HasIgnoreCCRti(target, bot) && HasUnBreakableCC(target, bot)) { unBreakableCC.push_back(*tIter); - list::iterator tIter2 = tIter; + std::list::iterator tIter2 = tIter; ++tIter; targets.erase(tIter2); } @@ -79,7 +79,7 @@ void PossibleAttackTargetsValue::RemoveNonThreating(list& targets, b if (getOne) { // If the target is valid return it straight away - list result = { *tIter }; + std::list result = { *tIter }; targets = result; break; } @@ -193,9 +193,9 @@ bool PossibleAttackTargetsValue::IsImmuneToDamage(Unit* target, Player* player) return false; } -string PossibleAttackTargetsValue::Format() +std::string PossibleAttackTargetsValue::Format() { - ostringstream out; + std::ostringstream out; for (auto& target : value) { @@ -327,10 +327,10 @@ bool PossibleAttackTargetsValue::IsPossibleTarget(Unit* target, Player* player, bool PossibleAddsValue::Calculate() { PlayerbotAI *ai = bot->GetPlayerbotAI(); - list possible = ai->GetAiObjectContext()->GetValue>("possible targets no los")->Get(); - list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); + std::list possible = ai->GetAiObjectContext()->GetValue>("possible targets no los")->Get(); + std::list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); - for (list::iterator i = possible.begin(); i != possible.end(); ++i) + for (std::list::iterator i = possible.begin(); i != possible.end(); ++i) { ObjectGuid guid = *i; if (find(attackers.begin(), attackers.end(), guid) != attackers.end()) continue; @@ -338,7 +338,7 @@ bool PossibleAddsValue::Calculate() Unit* add = ai->GetUnit(guid); if (add && !add->GetGuidValue(UNIT_FIELD_TARGET) && !sServerFacade.GetThreatManager(add).getCurrentVictim() && sServerFacade.IsHostileTo(add, bot)) { - for (list::iterator j = attackers.begin(); j != attackers.end(); ++j) + for (std::list::iterator j = attackers.begin(); j != attackers.end(); ++j) { Unit* attacker = ai->GetUnit(*j); if (!attacker) continue; diff --git a/playerbot/strategy/values/PossibleAttackTargetsValue.h b/playerbot/strategy/values/PossibleAttackTargetsValue.h index fe71a6f7..421a87fc 100644 --- a/playerbot/strategy/values/PossibleAttackTargetsValue.h +++ b/playerbot/strategy/values/PossibleAttackTargetsValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" #include "NearestUnitsValue.h" @@ -10,25 +10,25 @@ namespace ai { public: PossibleAttackTargetsValue(PlayerbotAI* ai) : ObjectGuidListCalculatedValue(ai, "possible attack targets", 2), Qualified() {} - list Calculate(); + std::list Calculate(); static bool IsValid(Unit* target, Player* player, float range = sPlayerbotAIConfig.sightDistance, bool ignoreCC = false, bool checkAttackerValid = true); static bool IsPossibleTarget(Unit* target, Player* player, float range, bool ignoreCC); static bool HasBreakableCC(Unit* target, Player* player); static bool HasUnBreakableCC(Unit* target, Player* player); - virtual string Format(); + virtual std::string Format(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "possible attack targets"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "combat"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "possible attack targets"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "combat"; } + virtual std::string GetHelpDescription() { return "This value contains all the units the bot should attack."; } - virtual vector GetUsedValues() { return { "attackers", "attack target"}; } + virtual std::vector GetUsedValues() { return { "attackers", "attack target"}; } #endif private: - void RemoveNonThreating(list& targets, bool getOne); + void RemoveNonThreating(std::list& targets, bool getOne); static bool IsImmuneToDamage(Unit* target, Player* player); static bool HasIgnoreCCRti(Unit* target, Player* player); @@ -38,17 +38,17 @@ namespace ai class PossibleAddsValue : public BoolCalculatedValue { public: - PossibleAddsValue(PlayerbotAI* const ai, string name = "possible adds") : BoolCalculatedValue(ai, name) {} + PossibleAddsValue(PlayerbotAI* const ai, std::string name = "possible adds") : BoolCalculatedValue(ai, name) {} virtual bool Calculate(); #ifdef GenerateBotHelp - virtual string GetHelpName() { return "possible adds"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "combat"; } - virtual string GetHelpDescription() + virtual std::string GetHelpName() { return "possible adds"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "combat"; } + virtual std::string GetHelpDescription() { return "This value returns true if any of the targets the bot wants to attack could agro adds."; } - virtual vector GetUsedValues() { return { "possible targets no los", "possible attack targets" }; } + virtual std::vector GetUsedValues() { return { "possible targets no los", "possible attack targets" }; } #endif }; } diff --git a/playerbot/strategy/values/PossibleRpgTargetsValue.cpp b/playerbot/strategy/values/PossibleRpgTargetsValue.cpp index 8bf2ea18..c2e04a3b 100644 --- a/playerbot/strategy/values/PossibleRpgTargetsValue.cpp +++ b/playerbot/strategy/values/PossibleRpgTargetsValue.cpp @@ -12,7 +12,7 @@ using namespace ai; using namespace MaNGOS; -vector PossibleRpgTargetsValue::allowedNpcFlags; +std::vector PossibleRpgTargetsValue::allowedNpcFlags; PossibleRpgTargetsValue::PossibleRpgTargetsValue(PlayerbotAI* ai, float range) : NearestUnitsValue(ai, "possible rpg targets", range, true) @@ -45,7 +45,7 @@ PossibleRpgTargetsValue::PossibleRpgTargetsValue(PlayerbotAI* ai, float range) : } } -void PossibleRpgTargetsValue::FindUnits(list &targets) +void PossibleRpgTargetsValue::FindUnits(std::list &targets) { AnyUnitInObjectRangeCheck u_check(bot, range); UnitListSearcher searcher(targets, u_check); @@ -68,7 +68,7 @@ bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit) if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER)) return false; - for (vector::iterator i = allowedNpcFlags.begin(); i != allowedNpcFlags.end(); ++i) + for (std::vector::iterator i = allowedNpcFlags.begin(); i != allowedNpcFlags.end(); ++i) { if (unit->HasFlag(UNIT_NPC_FLAGS, *i)) return true; } diff --git a/playerbot/strategy/values/PossibleRpgTargetsValue.h b/playerbot/strategy/values/PossibleRpgTargetsValue.h index 21181a50..87150ae1 100644 --- a/playerbot/strategy/values/PossibleRpgTargetsValue.h +++ b/playerbot/strategy/values/PossibleRpgTargetsValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "NearestUnitsValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -11,10 +11,10 @@ namespace ai PossibleRpgTargetsValue(PlayerbotAI* ai, float range = sPlayerbotAIConfig.rpgDistance); protected: - void FindUnits(list &targets); + void FindUnits(std::list &targets); bool AcceptUnit(Unit* unit); public: - static vector allowedNpcFlags; + static std::vector allowedNpcFlags; }; } diff --git a/playerbot/strategy/values/PossibleTargetsValue.cpp b/playerbot/strategy/values/PossibleTargetsValue.cpp index 6a2e0dc5..9f70bdff 100644 --- a/playerbot/strategy/values/PossibleTargetsValue.cpp +++ b/playerbot/strategy/values/PossibleTargetsValue.cpp @@ -11,7 +11,7 @@ using namespace ai; using namespace MaNGOS; -list PossibleTargetsValue::Calculate() +std::list PossibleTargetsValue::Calculate() { float rangeCheck = range; bool shouldIgnoreValidate = false; @@ -21,11 +21,11 @@ list PossibleTargetsValue::Calculate() shouldIgnoreValidate = Qualified::getMultiQualifierInt(qualifier, 1, ":"); } - list targets; + std::list targets; FindPossibleTargets(bot, targets, rangeCheck); - list results; - for (list::iterator i = targets.begin(); i != targets.end(); ++i) + std::list results; + for (std::list::iterator i = targets.begin(); i != targets.end(); ++i) { Unit* unit = *i; if (unit && (shouldIgnoreValidate || AcceptUnit(unit))) @@ -37,7 +37,7 @@ list PossibleTargetsValue::Calculate() return results; } -void PossibleTargetsValue::FindUnits(list &targets) +void PossibleTargetsValue::FindUnits(std::list &targets) { FindPossibleTargets(bot, targets, range); } @@ -47,7 +47,7 @@ bool PossibleTargetsValue::AcceptUnit(Unit* unit) return IsValid(unit, bot, ignoreLos); } -void PossibleTargetsValue::FindPossibleTargets(Player* player, list& targets, float range) +void PossibleTargetsValue::FindPossibleTargets(Player* player, std::list& targets, float range) { MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(player, range); MaNGOS::UnitListSearcher searcher(targets, u_check); diff --git a/playerbot/strategy/values/PossibleTargetsValue.h b/playerbot/strategy/values/PossibleTargetsValue.h index 927c3221..12dba57b 100644 --- a/playerbot/strategy/values/PossibleTargetsValue.h +++ b/playerbot/strategy/values/PossibleTargetsValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "NearestUnitsValue.h" #include "playerbot/PlayerbotAIConfig.h" @@ -9,17 +9,17 @@ namespace ai class PossibleTargetsValue : public NearestUnitsValue, public Qualified { public: - PossibleTargetsValue(PlayerbotAI* ai, string name = "possible targets", float range = sPlayerbotAIConfig.sightDistance, bool ignoreLos = false) : + PossibleTargetsValue(PlayerbotAI* ai, std::string name = "possible targets", float range = sPlayerbotAIConfig.sightDistance, bool ignoreLos = false) : NearestUnitsValue(ai, name, range, ignoreLos), Qualified() {} - list Calculate() override; + std::list Calculate() override; static bool IsValid(Unit* target, Player* player, bool ignoreLos = false); protected: - virtual void FindUnits(list &targets); + virtual void FindUnits(std::list &targets); virtual bool AcceptUnit(Unit* unit); - static void FindPossibleTargets(Player* player, list& targets, float range); + static void FindPossibleTargets(Player* player, std::list& targets, float range); static bool IsFriendly(Unit* target, Player* player); static bool IsAttackable(Unit* target, Player* player); }; diff --git a/playerbot/strategy/values/PvpValues.cpp b/playerbot/strategy/values/PvpValues.cpp index 3b1a84e8..c3035797 100644 --- a/playerbot/strategy/values/PvpValues.cpp +++ b/playerbot/strategy/values/PvpValues.cpp @@ -11,17 +11,17 @@ using namespace ai; -list BgMastersValue::Calculate() +std::list BgMastersValue::Calculate() { BattleGroundTypeId bgTypeId = (BattleGroundTypeId)stoi(qualifier); - vector entries; - map>> battleMastersCache = sRandomPlayerbotMgr.getBattleMastersCache(); + std::vector entries; + std::map>> battleMastersCache = sRandomPlayerbotMgr.getBattleMastersCache(); entries.insert(entries.end(), battleMastersCache[TEAM_BOTH_ALLOWED][bgTypeId].begin(), battleMastersCache[TEAM_BOTH_ALLOWED][bgTypeId].end()); entries.insert(entries.end(), battleMastersCache[ALLIANCE][bgTypeId].begin(), battleMastersCache[ALLIANCE][bgTypeId].end()); entries.insert(entries.end(), battleMastersCache[HORDE][bgTypeId].begin(), battleMastersCache[HORDE][bgTypeId].end()); - list bmGuids; + std::list bmGuids; for (auto entry : entries) { @@ -48,7 +48,7 @@ CreatureDataPair const* BgMasterValue::NearestBm(bool allowDead) { WorldPosition botPos(bot); - list bmPairs = GAI_VALUE2(list, "bg masters", qualifier); + std::list bmPairs = GAI_VALUE2(std::list, "bg masters", qualifier); float rDist; CreatureDataPair const* rbmPair = nullptr; @@ -144,7 +144,7 @@ BattleGroundTypeId RpgBgTypeValue::Calculate() if (bot->InBattleGroundQueueForBattleGroundQueueType(queueTypeId)) continue; - map>> battleMastersCache = sRandomPlayerbotMgr.getBattleMastersCache(); + std::map>> battleMastersCache = sRandomPlayerbotMgr.getBattleMastersCache(); for (auto& entry : battleMastersCache[TEAM_BOTH_ALLOWED][bgTypeId]) if (entry == guidPosition.GetEntry()) diff --git a/playerbot/strategy/values/PvpValues.h b/playerbot/strategy/values/PvpValues.h index 63bb202a..8d985b7d 100644 --- a/playerbot/strategy/values/PvpValues.h +++ b/playerbot/strategy/values/PvpValues.h @@ -1,7 +1,7 @@ #pragma once -#include "../Value.h" -#include "../AiObjectContext.h" +#include "playerbot/strategy/Value.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { @@ -23,11 +23,11 @@ namespace ai BgRoleValue(PlayerbotAI* ai) : ManualSetValue(ai, 0, "bg role") {} }; - class BgMastersValue : public SingleCalculatedValue>, public Qualified + class BgMastersValue : public SingleCalculatedValue>, public Qualified { public: - BgMastersValue(PlayerbotAI* ai) : SingleCalculatedValue>(ai, "bg masters"), Qualified() {} - virtual list Calculate(); + BgMastersValue(PlayerbotAI* ai) : SingleCalculatedValue>(ai, "bg masters"), Qualified() {} + virtual std::list Calculate(); }; class BgMasterValue : public CDPairCalculatedValue, public Qualified diff --git a/playerbot/strategy/values/QuestValues.cpp b/playerbot/strategy/values/QuestValues.cpp index e8d4fb98..8a32437e 100644 --- a/playerbot/strategy/values/QuestValues.cpp +++ b/playerbot/strategy/values/QuestValues.cpp @@ -45,7 +45,7 @@ entryQuestRelationMap EntryQuestRelationMapValue::Calculate() //Loot objective if (quest->ReqItemId[objective]) { - for (auto& entry : GAI_VALUE2(list, "item drop list", quest->ReqItemId[objective])) + for (auto& entry : GAI_VALUE2(std::list, "item drop list", quest->ReqItemId[objective])) rMap[entry][questId] |= relationFlag; } } @@ -118,7 +118,7 @@ questGuidpMap QuestGuidpMapValue::Calculate() questGiverMap QuestGiversValue::Calculate() { uint32 level = 0; - string q = getQualifier(); + std::string q = getQualifier(); bool hasQualifier = !q.empty(); if (hasQualifier) @@ -152,11 +152,11 @@ questGiverMap QuestGiversValue::Calculate() return guidps; } -list ActiveQuestGiversValue::Calculate() +std::list ActiveQuestGiversValue::Calculate() { questGiverMap qGivers = GAI_VALUE2(questGiverMap, "quest givers", bot->GetLevel()); - list retQuestGivers; + std::list retQuestGivers; for (auto& qGiver : qGivers) { @@ -196,11 +196,11 @@ list ActiveQuestGiversValue::Calculate() return retQuestGivers; } -list ActiveQuestTakersValue::Calculate() +std::list ActiveQuestTakersValue::Calculate() { questGuidpMap questMap = GAI_VALUE(questGuidpMap, "quest guidp map"); - list retQuestTakers; + std::list retQuestTakers; QuestStatusMap& questStatusMap = bot->getQuestStatusMap(); @@ -256,11 +256,11 @@ list ActiveQuestTakersValue::Calculate() return retQuestTakers; } -list ActiveQuestObjectivesValue::Calculate() +std::list ActiveQuestObjectivesValue::Calculate() { questGuidpMap questMap = GAI_VALUE(questGuidpMap, "quest guidp map"); - list retQuestObjectives; + std::list retQuestObjectives; QuestStatusMap& questStatusMap = bot->getQuestStatusMap(); @@ -507,7 +507,7 @@ bool NeedQuestObjectiveValue::Calculate() bool CanUseItemOn::Calculate() { uint32 itemId = getMultiQualifierInt(getQualifier(), 0, ","); - string guidPString = getMultiQualifierStr(getQualifier(), 1, ","); + std::string guidPString = getMultiQualifierStr(getQualifier(), 1, ","); GuidPosition guidP(guidPString); Unit* unit = nullptr; diff --git a/playerbot/strategy/values/QuestValues.h b/playerbot/strategy/values/QuestValues.h index c1467b5e..88d13261 100644 --- a/playerbot/strategy/values/QuestValues.h +++ b/playerbot/strategy/values/QuestValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "LootValues.h" namespace ai @@ -36,21 +36,21 @@ namespace ai }; // questId, QuestRelationFlag - typedef unordered_map questRelationMap; + typedef std::unordered_map questRelationMap; // entry - typedef unordered_map entryQuestRelationMap; + typedef std::unordered_map entryQuestRelationMap; // entry - typedef unordered_map < int32, list> questEntryGuidps; + typedef std::unordered_map> questEntryGuidps; // QuestRelationFlag - typedef unordered_map < uint32, questEntryGuidps> questRelationGuidps; + typedef std::unordered_map questRelationGuidps; // questId - typedef unordered_map < uint32, questRelationGuidps> questGuidpMap; + typedef std::unordered_map questGuidpMap; // questId - typedef unordered_map < uint32, list> questGiverMap; + typedef std::unordered_map> questGiverMap; //Returns the quest relation Flags for all entries and quests @@ -73,8 +73,8 @@ namespace ai bool operator()(GameObjectDataPair const& dataPair); questGuidpMap GetResult() const { return data; }; private: - unordered_map>> entryMap; - unordered_map>> itemMap; + std::unordered_map>> entryMap; + std::unordered_map>> itemMap; entryQuestRelationMap relationMap; @@ -99,27 +99,27 @@ namespace ai }; //All questgivers that have a quest for the bot. - class ActiveQuestGiversValue : public CalculatedValue> + class ActiveQuestGiversValue : public CalculatedValue> { public: ActiveQuestGiversValue(PlayerbotAI* ai) : CalculatedValue(ai, "active quest givers", 5) {} - virtual list Calculate() override; + virtual std::list Calculate() override; }; //All quest takers that the bot has a quest for. - class ActiveQuestTakersValue : public CalculatedValue> + class ActiveQuestTakersValue : public CalculatedValue> { public: ActiveQuestTakersValue(PlayerbotAI* ai) : CalculatedValue(ai, "active quest takers", 5) {} - virtual list Calculate() override; + virtual std::list Calculate() override; }; //All objectives that the bot still has to complete. - class ActiveQuestObjectivesValue : public CalculatedValue> + class ActiveQuestObjectivesValue : public CalculatedValue> { public: ActiveQuestObjectivesValue(PlayerbotAI* ai) : CalculatedValue(ai, "active quest objectives", 5) {} - virtual list Calculate() override; + virtual std::list Calculate() override; }; //Free quest log slots @@ -134,7 +134,7 @@ namespace ai class DialogStatusValue : public Uint32CalculatedValue, public Qualified { public: - DialogStatusValue(PlayerbotAI* ai, string name = "dialog status") : Uint32CalculatedValue(ai, name , 2), Qualified() {} + DialogStatusValue(PlayerbotAI* ai, std::string name = "dialog status") : Uint32CalculatedValue(ai, name , 2), Qualified() {} static uint32 getDialogStatus(Player* bot, int32 questgiver, uint32 questId = 0); virtual uint32 Calculate() override { return getDialogStatus(bot, stoi(getQualifier())); } }; diff --git a/playerbot/strategy/values/RTSCValues.h b/playerbot/strategy/values/RTSCValues.h index b2d01494..273ad7e9 100644 --- a/playerbot/strategy/values/RTSCValues.h +++ b/playerbot/strategy/values/RTSCValues.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class SeeSpellLocationValue : public LogCalculatedValue { public: - SeeSpellLocationValue(PlayerbotAI* ai, string name = "see spell location") : LogCalculatedValue(ai, name) {}; + SeeSpellLocationValue(PlayerbotAI* ai, std::string name = "see spell location") : LogCalculatedValue(ai, name) {}; virtual bool EqualToLast(WorldPosition value) { return value == lastValue; }; @@ -16,20 +16,20 @@ namespace ai class RTSCSelectedValue : public ManualSetValue { public: - RTSCSelectedValue(PlayerbotAI* ai, bool defaultvalue = false, string name = "RTSC selected") : ManualSetValue(ai, defaultvalue,name) {}; + RTSCSelectedValue(PlayerbotAI* ai, bool defaultvalue = false, std::string name = "RTSC selected") : ManualSetValue(ai, defaultvalue,name) {}; }; - class RTSCNextSpellActionValue : public ManualSetValue + class RTSCNextSpellActionValue : public ManualSetValue { public: - RTSCNextSpellActionValue(PlayerbotAI* ai, string defaultvalue = "", string name = "RTSC next spell action") : ManualSetValue(ai, defaultvalue, name) {}; + RTSCNextSpellActionValue(PlayerbotAI* ai, std::string defaultvalue = "", std::string name = "RTSC next spell action") : ManualSetValue(ai, defaultvalue, name) {}; }; class RTSCSavedLocationValue : public ManualSetValue, public Qualified { public: - RTSCSavedLocationValue(PlayerbotAI* ai, WorldPosition defaultvalue = WorldPosition(), string name = "RTSC saved location") : ManualSetValue(ai, defaultvalue, name), Qualified() {}; - virtual string Save() { return value.to_string(); } - virtual bool Load(string text) { value = WorldPosition(text); return true; } + RTSCSavedLocationValue(PlayerbotAI* ai, WorldPosition defaultvalue = WorldPosition(), std::string name = "RTSC saved location") : ManualSetValue(ai, defaultvalue, name), Qualified() {}; + virtual std::string Save() { return value.to_string(); } + virtual bool Load(std::string text) { value = WorldPosition(text); return true; } }; } diff --git a/playerbot/strategy/values/RandomBotUpdateValue.h b/playerbot/strategy/values/RandomBotUpdateValue.h index 924fbd80..576510ff 100644 --- a/playerbot/strategy/values/RandomBotUpdateValue.h +++ b/playerbot/strategy/values/RandomBotUpdateValue.h @@ -1,11 +1,11 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class RandomBotUpdateValue : public ManualSetValue { public: - RandomBotUpdateValue(PlayerbotAI* ai, string name = "random bot update") : ManualSetValue(ai, false, name) {} + RandomBotUpdateValue(PlayerbotAI* ai, std::string name = "random bot update") : ManualSetValue(ai, false, name) {} }; } diff --git a/playerbot/strategy/values/RangeValues.cpp b/playerbot/strategy/values/RangeValues.cpp index 620d2ccd..0bc34731 100644 --- a/playerbot/strategy/values/RangeValues.cpp +++ b/playerbot/strategy/values/RangeValues.cpp @@ -9,12 +9,12 @@ RangeValue::RangeValue(PlayerbotAI* ai) { } -string RangeValue::Save() +std::string RangeValue::Save() { - ostringstream out; out << value; return out.str(); + std::ostringstream out; out << value; return out.str(); } -bool RangeValue::Load(string text) +bool RangeValue::Load(std::string text) { value = atof(text.c_str()); return true; diff --git a/playerbot/strategy/values/RangeValues.h b/playerbot/strategy/values/RangeValues.h index 0efd590b..086d9011 100644 --- a/playerbot/strategy/values/RangeValues.h +++ b/playerbot/strategy/values/RangeValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: RangeValue(PlayerbotAI* ai); - virtual string Save(); - virtual bool Load(string value); + virtual std::string Save(); + virtual bool Load(std::string value); }; } diff --git a/playerbot/strategy/values/RpgValues.h b/playerbot/strategy/values/RpgValues.h index 8a0b7c0f..117e83fa 100644 --- a/playerbot/strategy/values/RpgValues.h +++ b/playerbot/strategy/values/RpgValues.h @@ -1,11 +1,11 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { - class NextRpgActionValue : public ManualSetValue + class NextRpgActionValue : public ManualSetValue { public: - NextRpgActionValue(PlayerbotAI* ai, string defaultValue = "", string name = "next rpg action") : ManualSetValue(ai, defaultValue, name) {}; + NextRpgActionValue(PlayerbotAI* ai, std::string defaultValue = "", std::string name = "next rpg action") : ManualSetValue(ai, defaultValue, name) {}; }; } diff --git a/playerbot/strategy/values/RtiTargetValue.h b/playerbot/strategy/values/RtiTargetValue.h index 10d6c61a..eb884f55 100644 --- a/playerbot/strategy/values/RtiTargetValue.h +++ b/playerbot/strategy/values/RtiTargetValue.h @@ -1,7 +1,7 @@ #pragma once #include "playerbot/PlayerbotAIConfig.h" #include "playerbot/ServerFacade.h" -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "Groups/Group.h" #include "TargetValue.h" @@ -10,11 +10,11 @@ namespace ai class RtiTargetValue : public TargetValue { public: - RtiTargetValue(PlayerbotAI* ai, string type = "rti", string name = "rti target") : type(type), TargetValue(ai,name) + RtiTargetValue(PlayerbotAI* ai, std::string type = "rti", std::string name = "rti target") : type(type), TargetValue(ai,name) {} public: - static int GetRtiIndex(string rti) + static int GetRtiIndex(std::string rti) { int index = -1; if(rti == "star") index = 0; @@ -34,7 +34,7 @@ namespace ai if(!group) return NULL; - string rti = AI_VALUE(string, type); + std::string rti = AI_VALUE(std::string, type); int index = GetRtiIndex(rti); if (index == -1) @@ -44,8 +44,8 @@ namespace ai if (!guid) return NULL; - list attackers = context->GetValue>("possible targets")->Get(); - if (find(attackers.begin(), attackers.end(), guid) == attackers.end()) return NULL; + std::list attackers = context->GetValue>("possible targets")->Get(); + if (std::find(attackers.begin(), attackers.end(), guid) == attackers.end()) return NULL; Unit* unit = ai->GetUnit(ObjectGuid(guid)); if (!unit || sServerFacade.UnitIsDead(unit) || @@ -56,12 +56,12 @@ namespace ai } private: - string type; + std::string type; }; class RtiCcTargetValue : public RtiTargetValue { public: - RtiCcTargetValue(PlayerbotAI* ai, string name = "rti cc target") : RtiTargetValue(ai, "rti cc", name) {} + RtiCcTargetValue(PlayerbotAI* ai, std::string name = "rti cc target") : RtiTargetValue(ai, "rti cc", name) {} }; } diff --git a/playerbot/strategy/values/RtiValue.cpp b/playerbot/strategy/values/RtiValue.cpp index bd4fb09a..beb9b7e6 100644 --- a/playerbot/strategy/values/RtiValue.cpp +++ b/playerbot/strategy/values/RtiValue.cpp @@ -5,11 +5,11 @@ using namespace ai; RtiValue::RtiValue(PlayerbotAI* ai) - : ManualSetValue(ai, "skull", "rti") + : ManualSetValue(ai, "skull", "rti") { } RtiCcValue::RtiCcValue(PlayerbotAI* ai) - : ManualSetValue(ai, "moon", "rti cc") + : ManualSetValue(ai, "moon", "rti cc") { } diff --git a/playerbot/strategy/values/RtiValue.h b/playerbot/strategy/values/RtiValue.h index 8cb98ac6..5f9f6a98 100644 --- a/playerbot/strategy/values/RtiValue.h +++ b/playerbot/strategy/values/RtiValue.h @@ -1,22 +1,22 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { - class RtiValue : public ManualSetValue + class RtiValue : public ManualSetValue { public: RtiValue(PlayerbotAI* ai); - virtual string Save() { return value; } - virtual bool Load(string text) { value = text; return true; } + virtual std::string Save() { return value; } + virtual bool Load(std::string text) { value = text; return true; } }; - class RtiCcValue : public ManualSetValue + class RtiCcValue : public ManualSetValue { public: RtiCcValue(PlayerbotAI* ai); - virtual string Save() { return value; } - virtual bool Load(string text) { value = text; return true; } + virtual std::string Save() { return value; } + virtual bool Load(std::string text) { value = text; return true; } }; } diff --git a/playerbot/strategy/values/SelfTargetValue.h b/playerbot/strategy/values/SelfTargetValue.h index bb03b402..51b08d7f 100644 --- a/playerbot/strategy/values/SelfTargetValue.h +++ b/playerbot/strategy/values/SelfTargetValue.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class SelfTargetValue : public UnitCalculatedValue { public: - SelfTargetValue(PlayerbotAI* ai, string name = "self target") : UnitCalculatedValue(ai, name) {} + SelfTargetValue(PlayerbotAI* ai, std::string name = "self target") : UnitCalculatedValue(ai, name) {} virtual Unit* Calculate() { return ai->GetBot(); } }; diff --git a/playerbot/strategy/values/SharedValueContext.h b/playerbot/strategy/values/SharedValueContext.h index 223d9661..e4d9c19d 100644 --- a/playerbot/strategy/values/SharedValueContext.h +++ b/playerbot/strategy/values/SharedValueContext.h @@ -51,7 +51,7 @@ namespace ai SharedObjectContext() { valueContexts.Add(new SharedValueContext()); }; public: - virtual UntypedValue* GetUntypedValue(const string& name) + virtual UntypedValue* GetUntypedValue(const std::string& name) { PlayerbotAI* ai = new PlayerbotAI(); UntypedValue* value = valueContexts.GetObject(name, ai); @@ -60,21 +60,21 @@ namespace ai } template - Value* GetValue(const string& name) + Value* GetValue(const std::string& name) { return dynamic_cast*>(GetUntypedValue(name)); } template - Value* GetValue(const string& name, const string& param) + Value* GetValue(const std::string& name, const std::string& param) { - return GetValue((string(name) + "::" + param)); + return GetValue((std::string(name) + "::" + param)); } template - Value* GetValue(const string& name, int32 param) + Value* GetValue(const std::string& name, int32 param) { - ostringstream out; out << param; + std::ostringstream out; out << param; return GetValue(name, out.str()); } protected: diff --git a/playerbot/strategy/values/SkipSpellsListValue.cpp b/playerbot/strategy/values/SkipSpellsListValue.cpp index f598e6a9..3b341a36 100644 --- a/playerbot/strategy/values/SkipSpellsListValue.cpp +++ b/playerbot/strategy/values/SkipSpellsListValue.cpp @@ -3,13 +3,12 @@ #include "SkipSpellsListValue.h" using namespace ai; -using namespace std; -string SkipSpellsListValue::Save() +std::string SkipSpellsListValue::Save() { - ostringstream out; + std::ostringstream out; bool first = true; - for (set::iterator i = value.begin(); i != value.end(); ++i) + for (std::set::iterator i = value.begin(); i != value.end(); ++i) { if (!first) out << ","; else first = false; @@ -18,12 +17,12 @@ string SkipSpellsListValue::Save() return out.str(); } -bool SkipSpellsListValue::Load(string text) +bool SkipSpellsListValue::Load(std::string text) { value.clear(); - vector ss = split(text, ','); - for (vector::iterator i = ss.begin(); i != ss.end(); ++i) + std::vector ss = split(text, ','); + for (std::vector::iterator i = ss.begin(); i != ss.end(); ++i) { value.insert(atoi(i->c_str())); } diff --git a/playerbot/strategy/values/SkipSpellsListValue.h b/playerbot/strategy/values/SkipSpellsListValue.h index 053b615c..585458fa 100644 --- a/playerbot/strategy/values/SkipSpellsListValue.h +++ b/playerbot/strategy/values/SkipSpellsListValue.h @@ -1,17 +1,17 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { - class SkipSpellsListValue : public ManualSetValue&> + class SkipSpellsListValue : public ManualSetValue&> { public: - SkipSpellsListValue(PlayerbotAI* ai, string name = "skip spells list") : ManualSetValue&>(ai, list, name) {} + SkipSpellsListValue(PlayerbotAI* ai, std::string name = "skip spells list") : ManualSetValue&>(ai, list, name) {} - virtual string Save(); - virtual bool Load(string value); + virtual std::string Save(); + virtual bool Load(std::string value); private: - set list; + std::set list; }; } diff --git a/playerbot/strategy/values/SnareTargetValue.cpp b/playerbot/strategy/values/SnareTargetValue.cpp index 76f40e03..b222e9ea 100644 --- a/playerbot/strategy/values/SnareTargetValue.cpp +++ b/playerbot/strategy/values/SnareTargetValue.cpp @@ -9,7 +9,7 @@ using namespace ai; Unit* SnareTargetValue::Calculate() { - string spell = qualifier; + std::string spell = qualifier; Unit* enemy = AI_VALUE(Unit*, "enemy player target"); if (enemy) @@ -19,9 +19,9 @@ Unit* SnareTargetValue::Calculate() return enemy; } - list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); + std::list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); Unit* target = ai->GetAiObjectContext()->GetValue("current target")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (!unit) diff --git a/playerbot/strategy/values/SnareTargetValue.h b/playerbot/strategy/values/SnareTargetValue.h index df34d356..c58bf554 100644 --- a/playerbot/strategy/values/SnareTargetValue.h +++ b/playerbot/strategy/values/SnareTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { diff --git a/playerbot/strategy/values/SpellCastUsefulValue.cpp b/playerbot/strategy/values/SpellCastUsefulValue.cpp index e81fd52c..52ee68f0 100644 --- a/playerbot/strategy/values/SpellCastUsefulValue.cpp +++ b/playerbot/strategy/values/SpellCastUsefulValue.cpp @@ -57,18 +57,18 @@ bool SpellCastUsefulValue::Calculate() return false; } - set& skipSpells = AI_VALUE(set&, "skip spells list"); + std::set& skipSpells = AI_VALUE(std::set&, "skip spells list"); if (skipSpells.find(spellid) != skipSpells.end()) return false; - const string spellName = spellInfo->SpellName[0]; - for (set::iterator i = skipSpells.begin(); i != skipSpells.end(); ++i) + const std::string spellName = spellInfo->SpellName[0]; + for (std::set::iterator i = skipSpells.begin(); i != skipSpells.end(); ++i) { SpellEntry const *spell = sServerFacade.LookupSpellInfo(*i); if (!spell) continue; - wstring wnamepart; + std::wstring wnamepart; if (!Utf8toWStr(spell->SpellName[0], wnamepart)) continue; diff --git a/playerbot/strategy/values/SpellCastUsefulValue.h b/playerbot/strategy/values/SpellCastUsefulValue.h index ac7a84a7..dc29ddab 100644 --- a/playerbot/strategy/values/SpellCastUsefulValue.h +++ b/playerbot/strategy/values/SpellCastUsefulValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" namespace ai @@ -7,7 +7,7 @@ namespace ai class SpellCastUsefulValue : public BoolCalculatedValue, public Qualified { public: - SpellCastUsefulValue(PlayerbotAI* ai, string name = "spell cast useful") : BoolCalculatedValue(ai, name), Qualified() {} + SpellCastUsefulValue(PlayerbotAI* ai, std::string name = "spell cast useful") : BoolCalculatedValue(ai, name), Qualified() {} virtual bool Calculate(); }; } diff --git a/playerbot/strategy/values/SpellIdValue.cpp b/playerbot/strategy/values/SpellIdValue.cpp index 105d53e8..97a65c83 100644 --- a/playerbot/strategy/values/SpellIdValue.cpp +++ b/playerbot/strategy/values/SpellIdValue.cpp @@ -19,7 +19,7 @@ VehicleSpellIdValue::VehicleSpellIdValue(PlayerbotAI* ai) : CalculatedValueSpellName[0]; } - vector ids = chat->SpellIds(namepart); + std::vector ids = chat->SpellIds(namepart); char firstSymbol = 'x'; int spellLength = 0; - wstring wnamepart; + std::wstring wnamepart; if (ids.empty()) { @@ -49,7 +49,7 @@ uint32 SpellIdValue::Calculate() int loc = bot->GetSession()->GetSessionDbcLocale(); - set spellIds; + std::set spellIds; for (PlayerSpellMap::iterator itr = bot->GetSpellMap().begin(); itr != bot->GetSpellMap().end(); ++itr) { uint32 spellId = itr->first; @@ -134,7 +134,7 @@ uint32 SpellIdValue::Calculate() if (saveMana <= 1) { - for (set::reverse_iterator itr = spellIds.rbegin(); itr != spellIds.rend(); ++itr) + for (std::set::reverse_iterator itr = spellIds.rbegin(); itr != spellIds.rend(); ++itr) { const SpellEntry* pSpellInfo = sServerFacade.LookupSpellInfo(*itr); if (!pSpellInfo) @@ -142,7 +142,7 @@ uint32 SpellIdValue::Calculate() std::string spellName = pSpellInfo->Rank[0]; - // For atoi, the input string has to start with a digit, so lets search for the first digit + // For atoi, the input std::string has to start with a digit, so lets search for the first digit size_t i = 0; for (; i < spellName.length(); i++) { if (isdigit(spellName[i])) break; } @@ -173,7 +173,7 @@ uint32 SpellIdValue::Calculate() } else { - for (set::reverse_iterator i = spellIds.rbegin(); i != spellIds.rend(); ++i) + for (std::set::reverse_iterator i = spellIds.rbegin(); i != spellIds.rend(); ++i) { if (!highestSpellId) highestSpellId = *i; if (sSpellMgr.IsSpellHigherRankOfSpell(*i, highestSpellId)) highestSpellId = *i; @@ -202,7 +202,7 @@ uint32 VehicleSpellIdValue::Calculate() if (!seat || !seat->HasFlag(SEAT_FLAG_CAN_CAST)) return 0; - string namepart = qualifier; + std::string namepart = qualifier; PlayerbotChatHandler handler(bot); uint32 extractedSpellId = handler.extractSpellId(namepart); diff --git a/playerbot/strategy/values/SpellIdValue.h b/playerbot/strategy/values/SpellIdValue.h index a0b7ea5a..2d2321aa 100644 --- a/playerbot/strategy/values/SpellIdValue.h +++ b/playerbot/strategy/values/SpellIdValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" namespace ai diff --git a/playerbot/strategy/values/Stances.cpp b/playerbot/strategy/values/Stances.cpp index 6a78ae07..696b0d25 100644 --- a/playerbot/strategy/values/Stances.cpp +++ b/playerbot/strategy/values/Stances.cpp @@ -44,7 +44,7 @@ WorldLocation Stance::GetNearLocation(float angle, float distance) WorldLocation MoveStance::GetLocationInternal() { Unit* target = GetTarget(); - float distance = max(sPlayerbotAIConfig.meleeDistance, target->GetObjectBoundingRadius()); + float distance = std::max(sPlayerbotAIConfig.meleeDistance, target->GetObjectBoundingRadius()); float angle = GetAngle(); return GetNearLocation(angle, distance); @@ -187,12 +187,12 @@ void StanceValue::Reset() value = new NearStance(ai); } -string StanceValue::Save() +std::string StanceValue::Save() { return value ? value->getName() : "?"; } -bool StanceValue::Load(string name) +bool StanceValue::Load(std::string name) { if (name == "behind") { @@ -221,13 +221,13 @@ bool StanceValue::Load(string name) bool SetStanceAction::Execute(Event& event) { - string stance = event.getParam(); + std::string stance = event.getParam(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); StanceValue* value = (StanceValue*)context->GetValue("stance"); if (stance == "?" || stance.empty()) { - ostringstream str; str << "Stance: |cff00ff00" << value->Get()->getName(); + std::ostringstream str; str << "Stance: |cff00ff00" << value->Get()->getName(); ai->TellPlayer(requester, str); return true; } @@ -243,13 +243,13 @@ bool SetStanceAction::Execute(Event& event) if (!value->Load(stance)) { - ostringstream str; str << "Invalid stance: |cffff0000" << stance; + std::ostringstream str; str << "Invalid stance: |cffff0000" << stance; ai->TellPlayer(requester, str); ai->TellPlayer(requester, "Please set to any of:|cffffffff near (default), tank, turnback, behind"); return false; } - ostringstream str; str << "Stance set to: " << stance; + std::ostringstream str; str << "Stance set to: " << stance; ai->TellPlayer(requester, str); return true; } diff --git a/playerbot/strategy/values/Stances.h b/playerbot/strategy/values/Stances.h index 6b01e0ec..ca6e6b73 100644 --- a/playerbot/strategy/values/Stances.h +++ b/playerbot/strategy/values/Stances.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/PlayerbotAIConfig.h" #include "Formations.h" @@ -8,7 +8,7 @@ namespace ai class Stance : public Formation { public: - Stance(PlayerbotAI* ai, string name) : Formation (ai, name) {} + Stance(PlayerbotAI* ai, std::string name) : Formation (ai, name) {} virtual ~Stance() {} protected: virtual Unit* GetTarget(); @@ -17,14 +17,14 @@ namespace ai public: virtual WorldLocation GetLocation(); - virtual string GetTargetName() { return "current target"; } + virtual std::string GetTargetName() { return "current target"; } virtual float GetMaxDistance() { return sPlayerbotAIConfig.contactDistance; } }; class MoveStance : public Stance { public: - MoveStance(PlayerbotAI* ai, string name) : Stance (ai, name) {} + MoveStance(PlayerbotAI* ai, std::string name) : Stance (ai, name) {} protected: virtual WorldLocation GetLocationInternal(); @@ -40,8 +40,8 @@ namespace ai StanceValue(PlayerbotAI* ai); ~StanceValue() { if (value) { delete value; value = NULL; } } virtual void Reset(); - virtual string Save(); - virtual bool Load(string value); + virtual std::string Save(); + virtual bool Load(std::string value); }; class SetStanceAction : public ChatCommandAction diff --git a/playerbot/strategy/values/StatsValues.h b/playerbot/strategy/values/StatsValues.h index 077b9bc9..c363640e 100644 --- a/playerbot/strategy/values/StatsValues.h +++ b/playerbot/strategy/values/StatsValues.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" class Unit; @@ -8,7 +8,7 @@ namespace ai class HealthValue : public Uint8CalculatedValue, public Qualified { public: - HealthValue(PlayerbotAI* ai, string name = "health") : Uint8CalculatedValue(ai, name), Qualified() {} + HealthValue(PlayerbotAI* ai, std::string name = "health") : Uint8CalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -22,7 +22,7 @@ namespace ai class IsDeadValue : public BoolCalculatedValue, public Qualified { public: - IsDeadValue(PlayerbotAI* ai, string name = "dead") : BoolCalculatedValue(ai, name), Qualified() {} + IsDeadValue(PlayerbotAI* ai, std::string name = "dead") : BoolCalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -36,21 +36,21 @@ namespace ai class PetIsDeadValue : public BoolCalculatedValue { public: - PetIsDeadValue(PlayerbotAI* ai, string name = "pet dead") : BoolCalculatedValue(ai, name) {} + PetIsDeadValue(PlayerbotAI* ai, std::string name = "pet dead") : BoolCalculatedValue(ai, name) {} virtual bool Calculate(); }; class PetIsHappyValue : public BoolCalculatedValue { public: - PetIsHappyValue(PlayerbotAI* ai, string name = "pet happy") : BoolCalculatedValue(ai, name) {} + PetIsHappyValue(PlayerbotAI* ai, std::string name = "pet happy") : BoolCalculatedValue(ai, name) {} virtual bool Calculate(); }; class RageValue : public Uint8CalculatedValue, public Qualified { public: - RageValue(PlayerbotAI* ai, string name = "rage") : Uint8CalculatedValue(ai, name), Qualified() {} + RageValue(PlayerbotAI* ai, std::string name = "rage") : Uint8CalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -64,7 +64,7 @@ namespace ai class EnergyValue : public Uint8CalculatedValue, public Qualified { public: - EnergyValue(PlayerbotAI* ai, string name = "energy") : Uint8CalculatedValue(ai, name), Qualified() {} + EnergyValue(PlayerbotAI* ai, std::string name = "energy") : Uint8CalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -78,7 +78,7 @@ namespace ai class ManaValue : public Uint8CalculatedValue, public Qualified { public: - ManaValue(PlayerbotAI* ai, string name = "mana") : Uint8CalculatedValue(ai, name), Qualified() {} + ManaValue(PlayerbotAI* ai, std::string name = "mana") : Uint8CalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -92,7 +92,7 @@ namespace ai class HasManaValue : public BoolCalculatedValue, public Qualified { public: - HasManaValue(PlayerbotAI* ai, string name = "has mana") : BoolCalculatedValue(ai, name), Qualified() {} + HasManaValue(PlayerbotAI* ai, std::string name = "has mana") : BoolCalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -106,7 +106,7 @@ namespace ai class ComboPointsValue : public Uint8CalculatedValue, public Qualified { public: - ComboPointsValue(PlayerbotAI* ai, string name = "combo points") : Uint8CalculatedValue(ai, name), Qualified() {} + ComboPointsValue(PlayerbotAI* ai, std::string name = "combo points") : Uint8CalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -120,7 +120,7 @@ namespace ai class IsMountedValue : public BoolCalculatedValue, public Qualified { public: - IsMountedValue(PlayerbotAI* ai, string name = "mounted") : BoolCalculatedValue(ai, name), Qualified() {} + IsMountedValue(PlayerbotAI* ai, std::string name = "mounted") : BoolCalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -134,7 +134,7 @@ namespace ai class IsInCombatValue : public MemoryCalculatedValue, public Qualified { public: - IsInCombatValue(PlayerbotAI* ai, string name = "combat") : MemoryCalculatedValue(ai, name), Qualified() {} + IsInCombatValue(PlayerbotAI* ai, std::string name = "combat") : MemoryCalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -145,7 +145,7 @@ namespace ai virtual bool EqualToLast(bool value) { return value == lastValue; } virtual bool Calculate(); - virtual string Format() + virtual std::string Format() { return this->Calculate() ? "true" : "false"; } @@ -154,21 +154,21 @@ namespace ai class BagSpaceValue : public Uint8CalculatedValue { public: - BagSpaceValue(PlayerbotAI* ai, string name = "bag space") : Uint8CalculatedValue(ai, name) {} + BagSpaceValue(PlayerbotAI* ai, std::string name = "bag space") : Uint8CalculatedValue(ai, name) {} virtual uint8 Calculate(); }; class DurabilityValue : public Uint8CalculatedValue { public: - DurabilityValue(PlayerbotAI* ai, string name = "durability") : Uint8CalculatedValue(ai, name) {} + DurabilityValue(PlayerbotAI* ai, std::string name = "durability") : Uint8CalculatedValue(ai, name) {} virtual uint8 Calculate(); }; class SpeedValue : public Uint8CalculatedValue, public Qualified { public: - SpeedValue(PlayerbotAI* ai, string name = "speed") : Uint8CalculatedValue(ai, name), Qualified() {} + SpeedValue(PlayerbotAI* ai, std::string name = "speed") : Uint8CalculatedValue(ai, name), Qualified() {} Unit* GetTarget() { @@ -182,18 +182,18 @@ namespace ai class IsInGroupValue : public BoolCalculatedValue { public: - IsInGroupValue(PlayerbotAI* ai, string name = "in group") : BoolCalculatedValue(ai, name) {} + IsInGroupValue(PlayerbotAI* ai, std::string name = "in group") : BoolCalculatedValue(ai, name) {} virtual bool Calculate() { return bot->GetGroup(); } }; class DeathCountValue : public ManualSetValue { public: - DeathCountValue(PlayerbotAI* ai, string name = "death count") : ManualSetValue(ai, 0, name) {} + DeathCountValue(PlayerbotAI* ai, std::string name = "death count") : ManualSetValue(ai, 0, name) {} - virtual string Format() + virtual std::string Format() { - ostringstream out; out << (int)this->value; + std::ostringstream out; out << (int)this->value; return out.str(); } }; @@ -202,13 +202,13 @@ namespace ai class ExperienceValue : public MemoryCalculatedValue { public: - ExperienceValue(PlayerbotAI* ai, string name = "experience", uint32 checkInterval = 60) : MemoryCalculatedValue(ai, name, checkInterval) {} + ExperienceValue(PlayerbotAI* ai, std::string name = "experience", uint32 checkInterval = 60) : MemoryCalculatedValue(ai, name, checkInterval) {} virtual bool EqualToLast(uint32 value) { return value != lastValue; } virtual uint32 Calculate() { return bot->GetUInt32Value(PLAYER_XP);} - virtual string Format() + virtual std::string Format() { - ostringstream out; out << (int)this->Calculate() << " last change:" << LastChangeDelay() << "s"; + std::ostringstream out; out << (int)this->Calculate() << " last change:" << LastChangeDelay() << "s"; return out.str(); } }; @@ -216,7 +216,7 @@ namespace ai class HonorValue : public ExperienceValue { public: - HonorValue(PlayerbotAI* ai, string name = "honor", uint32 checkInterval = 60) : ExperienceValue(ai, name, checkInterval) {} + HonorValue(PlayerbotAI* ai, std::string name = "honor", uint32 checkInterval = 60) : ExperienceValue(ai, name, checkInterval) {} virtual bool EqualToLast(uint32 value) { return value != lastValue; } virtual uint32 Calculate() { return bot->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS); } }; diff --git a/playerbot/strategy/values/SubStrategyValue.cpp b/playerbot/strategy/values/SubStrategyValue.cpp index 80fbbaff..0c5b091b 100644 --- a/playerbot/strategy/values/SubStrategyValue.cpp +++ b/playerbot/strategy/values/SubStrategyValue.cpp @@ -3,19 +3,19 @@ using namespace ai; -void SubStrategyValue::Set(string newValue) +void SubStrategyValue::Set(std::string newValue) { SetValues(value, newValue, allowedValues); } -void SubStrategyValue::SetValues(string& currentValue, const string newValue, const string allowedValues) +void SubStrategyValue::SetValues(std::string& currentValue, const std::string newValue, const std::string allowedValues) { - vector currentValues = StrSplit(currentValue, ","); - vector newValues = StrSplit(newValue, ","); - vector allowedVals = StrSplit(allowedValues, ","); + std::vector currentValues = StrSplit(currentValue, ","); + std::vector newValues = StrSplit(newValue, ","); + std::vector allowedVals = StrSplit(allowedValues, ","); - for (string& newVal : newValues) + for (std::string& newVal : newValues) { char operation = newVal[0]; @@ -43,14 +43,14 @@ void SubStrategyValue::SetValues(string& currentValue, const string newValue, co currentValue = ""; - for (string value : currentValues) + for (std::string value : currentValues) currentValue += value + ","; if(!currentValues.empty()) currentValue.pop_back(); } -bool SubStrategyValue::Load(string value) +bool SubStrategyValue::Load(std::string value) { this->value = ""; Set(value); diff --git a/playerbot/strategy/values/SubStrategyValue.h b/playerbot/strategy/values/SubStrategyValue.h index 3e13896d..ec3efcba 100644 --- a/playerbot/strategy/values/SubStrategyValue.h +++ b/playerbot/strategy/values/SubStrategyValue.h @@ -1,21 +1,21 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { - class SubStrategyValue : public ManualSetValue + class SubStrategyValue : public ManualSetValue { public: - SubStrategyValue(PlayerbotAI* ai, string defaultValue = "", string name = "substrategy", string allowedValues = "") : ManualSetValue(ai, defaultValue, name), allowedValues(allowedValues) {}; - virtual void Set(string newValue) override; + SubStrategyValue(PlayerbotAI* ai, std::string defaultValue = "", std::string name = "substrategy", std::string allowedValues = "") : ManualSetValue(ai, defaultValue, name), allowedValues(allowedValues) {}; + virtual void Set(std::string newValue) override; - void SetValues(string& currentValue, const string newValue, const string allowedValue); - virtual vector GetAllowedValues() { return StrSplit(allowedValues, ","); } + void SetValues(std::string& currentValue, const std::string newValue, const std::string allowedValue); + virtual std::vector GetAllowedValues() { return StrSplit(allowedValues, ","); } - virtual string Save() override { return value; }; - virtual bool Load(string value) override; + virtual std::string Save() override { return value; }; + virtual bool Load(std::string value) override; private: - string allowedValues; + std::string allowedValues; }; }; diff --git a/playerbot/strategy/values/TalentSpecValue.h b/playerbot/strategy/values/TalentSpecValue.h index 9f92b578..6826d387 100644 --- a/playerbot/strategy/values/TalentSpecValue.h +++ b/playerbot/strategy/values/TalentSpecValue.h @@ -1,18 +1,18 @@ #pragma once -#include "../Value.h" -#include "../../PlayerTalentSpec.h" +#include "playerbot/strategy/Value.h" +#include "playerbot/PlayerTalentSpec.h" namespace ai { class TalentSpecValue : public ManualSetValue { public: - TalentSpecValue(PlayerbotAI* ai, string name = "talent spec") : ManualSetValue(ai, PlayerTalentSpec::TALENT_SPEC_INVALID, name) {} + TalentSpecValue(PlayerbotAI* ai, std::string name = "talent spec") : ManualSetValue(ai, PlayerTalentSpec::TALENT_SPEC_INVALID, name) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "talent spec"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "talent spec"; } - virtual string GetHelpDescription() { return "This value stores the current talent spec for the bot."; } - virtual vector GetUsedValues() { return {}; } + virtual std::string GetHelpName() { return "talent spec"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "talent spec"; } + virtual std::string GetHelpDescription() { return "This value stores the current talent spec for the bot."; } + virtual std::vector GetUsedValues() { return {}; } #endif }; } diff --git a/playerbot/strategy/values/TankTargetValue.cpp b/playerbot/strategy/values/TankTargetValue.cpp index 9eb71a05..23262a9e 100644 --- a/playerbot/strategy/values/TankTargetValue.cpp +++ b/playerbot/strategy/values/TankTargetValue.cpp @@ -21,7 +21,7 @@ class FindTargetForTankStrategy : public FindNonCcTargetStrategy if (!PossibleAttackTargetsValue::IsValid(creature, player)) { - list attackers = PAI_VALUE(list, "possible attack targets"); + std::list attackers = PAI_VALUE(std::list, "possible attack targets"); if (std::find(attackers.begin(), attackers.end(), creature->GetObjectGuid()) == attackers.end()) return; } diff --git a/playerbot/strategy/values/TankTargetValue.h b/playerbot/strategy/values/TankTargetValue.h index 350321d4..59b51101 100644 --- a/playerbot/strategy/values/TankTargetValue.h +++ b/playerbot/strategy/values/TankTargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "TargetValue.h" #include "RtiTargetValue.h" @@ -8,7 +8,7 @@ namespace ai class TankTargetValue : public RtiTargetValue { public: - TankTargetValue(PlayerbotAI* ai, string type = "rti", string name = "tank target") : RtiTargetValue(ai, type, name) {} + TankTargetValue(PlayerbotAI* ai, std::string type = "rti", std::string name = "tank target") : RtiTargetValue(ai, type, name) {} public: Unit* Calculate(); diff --git a/playerbot/strategy/values/TargetValue.cpp b/playerbot/strategy/values/TargetValue.cpp index 25a6f6e5..108f6a9e 100644 --- a/playerbot/strategy/values/TargetValue.cpp +++ b/playerbot/strategy/values/TargetValue.cpp @@ -12,8 +12,8 @@ using namespace ai; Unit* TargetValue::FindTarget(FindTargetStrategy* strategy) { - list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + std::list attackers = ai->GetAiObjectContext()->GetValue>("possible attack targets")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* unit = ai->GetUnit(*i); if (!unit) @@ -43,7 +43,7 @@ bool FindNonCcTargetStrategy::IsCcTarget(Unit* attacker) if (PAI_VALUE(Unit*,"rti cc target") == attacker) return true; - string rti = PAI_VALUE(string,"rti cc"); + std::string rti = PAI_VALUE(std::string,"rti cc"); int index = RtiTargetValue::GetRtiIndex(rti); if (index != -1) { @@ -76,7 +76,7 @@ void FindTargetStrategy::GetPlayerCount(Unit* creature, int* tankCount, int* dps *dpsCount = 0; Unit::AttackerSet attackers(creature->getAttackers()); - for (set::const_iterator i = attackers.begin(); i != attackers.end(); i++) + for (std::set::const_iterator i = attackers.begin(); i != attackers.end(); i++) { Unit* attacker = *i; if (!attacker || !sServerFacade.IsAlive(attacker) || attacker == bot) @@ -154,7 +154,7 @@ Unit* ClosestAttackerTargetingMeTargetValue::Calculate() Unit* result = nullptr; float closest = 9999.0f; - const std::list& attackers = AI_VALUE(list, "attackers targeting me"); + const std::list& attackers = AI_VALUE(std::list, "attackers targeting me"); for (const ObjectGuid& attackerGuid : attackers) { Unit* attacker = ai->GetUnit(attackerGuid); diff --git a/playerbot/strategy/values/TargetValue.h b/playerbot/strategy/values/TargetValue.h index 8d5416b1..af15d90a 100644 --- a/playerbot/strategy/values/TargetValue.h +++ b/playerbot/strategy/values/TargetValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" #include "playerbot/TravelMgr.h" namespace ai @@ -25,8 +25,8 @@ namespace ai PlayerbotAI* ai; protected: - map tankCountCache; - map dpsCountCache; + std::map tankCountCache; + std::map dpsCountCache; }; class FindNonCcTargetStrategy : public FindTargetStrategy @@ -42,12 +42,12 @@ namespace ai class TargetValue : public UnitCalculatedValue { public: - TargetValue(PlayerbotAI* ai, string name = "target", int checkInterval = 1) : UnitCalculatedValue(ai, name, checkInterval) {} + TargetValue(PlayerbotAI* ai, std::string name = "target", int checkInterval = 1) : UnitCalculatedValue(ai, name, checkInterval) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "target"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "target"; } - virtual string GetHelpDescription() { return "This value contains a [h:object|unit] which is the best target based on the current target strategy."; } - virtual vector GetUsedValues() { return { "possible attack targets" }; } + virtual std::string GetHelpName() { return "target"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "target"; } + virtual std::string GetHelpDescription() { return "This value contains a [h:object|unit] which is the best target based on the current target strategy."; } + virtual std::vector GetUsedValues() { return { "possible attack targets" }; } #endif protected: Unit* FindTarget(FindTargetStrategy* strategy); @@ -56,15 +56,15 @@ namespace ai class RpgTargetValue : public ManualSetValue { public: - RpgTargetValue(PlayerbotAI* ai, string name = "rpg target") : ManualSetValue(ai, GuidPosition(), name) {} + RpgTargetValue(PlayerbotAI* ai, std::string name = "rpg target") : ManualSetValue(ai, GuidPosition(), name) {} #ifdef GenerateBotHelp - virtual string GetHelpName() { return "rpg target"; } //Must equal iternal name - virtual string GetHelpTypeName() { return "rpg"; } - virtual string GetHelpDescription() { return "This value contains the [h:object|objectGuid] of a [h:object|unit] or [h:object|gameObject] to move to and rpg with.\nThis value is manually set."; } - virtual vector GetUsedValues() { return {}; } + virtual std::string GetHelpName() { return "rpg target"; } //Must equal iternal name + virtual std::string GetHelpTypeName() { return "rpg"; } + virtual std::string GetHelpDescription() { return "This value contains the [h:object|objectGuid] of a [h:object|unit] or [h:object|gameObject] to move to and rpg with.\nThis value is manually set."; } + virtual std::vector GetUsedValues() { return {}; } #endif - virtual string Format() + virtual std::string Format() { return chat->formatGuidPosition(value); } @@ -73,7 +73,7 @@ namespace ai class TravelTargetValue : public ManualSetValue { public: - TravelTargetValue(PlayerbotAI* ai, string name = "travel target") : ManualSetValue(ai, new TravelTarget(ai), name) {} + TravelTargetValue(PlayerbotAI* ai, std::string name = "travel target") : ManualSetValue(ai, new TravelTarget(ai), name) {} virtual ~TravelTargetValue() { delete value; } }; @@ -93,31 +93,31 @@ namespace ai WorldPosition Calculate(); }; - class IgnoreRpgTargetValue : public ManualSetValue& > + class IgnoreRpgTargetValue : public ManualSetValue& > { public: - IgnoreRpgTargetValue(PlayerbotAI* ai) : ManualSetValue& >(ai, data, "ignore rpg targets") {} + IgnoreRpgTargetValue(PlayerbotAI* ai) : ManualSetValue& >(ai, data, "ignore rpg targets") {} private: - set data; + std::set data; }; class TalkTargetValue : public ManualSetValue { public: - TalkTargetValue(PlayerbotAI* ai, string name = "talk target") : ManualSetValue(ai, ObjectGuid(), name) {} + TalkTargetValue(PlayerbotAI* ai, std::string name = "talk target") : ManualSetValue(ai, ObjectGuid(), name) {} }; class AttackTargetValue : public ManualSetValue { public: - AttackTargetValue(PlayerbotAI* ai, string name = "attack target") : ManualSetValue(ai, ObjectGuid(), name) {} + AttackTargetValue(PlayerbotAI* ai, std::string name = "attack target") : ManualSetValue(ai, ObjectGuid(), name) {} }; class PullTargetValue : public UnitManualSetValue { public: - PullTargetValue(PlayerbotAI* ai, string name = "pull target") : UnitManualSetValue(ai, nullptr, name) {} + PullTargetValue(PlayerbotAI* ai, std::string name = "pull target") : UnitManualSetValue(ai, nullptr, name) {} void Set(Unit* unit) override; Unit* Get() override; @@ -128,20 +128,20 @@ namespace ai class FollowTargetValue : public UnitCalculatedValue { public: - FollowTargetValue(PlayerbotAI* ai, string name = "follow target") : UnitCalculatedValue(ai, name) {} + FollowTargetValue(PlayerbotAI* ai, std::string name = "follow target") : UnitCalculatedValue(ai, name) {} Unit* Calculate() override; }; class ManualFollowTargetValue : public GuidPositionManualSetValue { public: - ManualFollowTargetValue(PlayerbotAI* ai, string name = "manual follow target") : GuidPositionManualSetValue(ai, GuidPosition(), name) {} + ManualFollowTargetValue(PlayerbotAI* ai, std::string name = "manual follow target") : GuidPositionManualSetValue(ai, GuidPosition(), name) {} }; class ClosestAttackerTargetingMeTargetValue : public UnitCalculatedValue { public: - ClosestAttackerTargetingMeTargetValue(PlayerbotAI* ai, string name = "closest attacker targeting me") : UnitCalculatedValue(ai, name) {} + ClosestAttackerTargetingMeTargetValue(PlayerbotAI* ai, std::string name = "closest attacker targeting me") : UnitCalculatedValue(ai, name) {} Unit* Calculate() override; }; } diff --git a/playerbot/strategy/values/ThreatValues.cpp b/playerbot/strategy/values/ThreatValues.cpp index 72b5a294..c9f52b32 100644 --- a/playerbot/strategy/values/ThreatValues.cpp +++ b/playerbot/strategy/values/ThreatValues.cpp @@ -31,8 +31,8 @@ uint8 ThreatValue::Calculate() if (qualifier == "aoe") { uint8 maxThreat = 0; - list attackers = context->GetValue>("possible attack targets")->Get(); - for (list::iterator i = attackers.begin(); i != attackers.end(); i++) + std::list attackers = context->GetValue>("possible attack targets")->Get(); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); i++) { Unit* unit = ai->GetUnit(*i); if (!unit || !sServerFacade.IsAlive(unit)) diff --git a/playerbot/strategy/values/ThreatValues.h b/playerbot/strategy/values/ThreatValues.h index 2b411cc3..2e885ba6 100644 --- a/playerbot/strategy/values/ThreatValues.h +++ b/playerbot/strategy/values/ThreatValues.h @@ -1,12 +1,12 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { class MyThreatValue : public LogCalculatedValue, public Qualified { public: - MyThreatValue(PlayerbotAI* ai, string name = "my threat") : LogCalculatedValue(ai, name), Qualified() { minChangeInterval = 1; lastTarget = ObjectGuid(); } + MyThreatValue(PlayerbotAI* ai, std::string name = "my threat") : LogCalculatedValue(ai, name), Qualified() { minChangeInterval = 1; lastTarget = ObjectGuid(); } virtual bool EqualToLast(float value) { return value == lastValue; } virtual float Calculate(); @@ -17,14 +17,14 @@ namespace ai class TankThreatValue : public FloatCalculatedValue, public Qualified { public: - TankThreatValue(PlayerbotAI* ai, string name = "tank threat") : FloatCalculatedValue(ai, name), Qualified() {} + TankThreatValue(PlayerbotAI* ai, std::string name = "tank threat") : FloatCalculatedValue(ai, name), Qualified() {} virtual float Calculate(); }; class ThreatValue : public Uint8CalculatedValue, public Qualified { public: - ThreatValue(PlayerbotAI* ai, string name = "threat") : Uint8CalculatedValue(ai, name), Qualified() {} + ThreatValue(PlayerbotAI* ai, std::string name = "threat") : Uint8CalculatedValue(ai, name), Qualified() {} virtual uint8 Calculate(); static float GetThreat(Player* player, Unit* target); static float GetTankThreat(PlayerbotAI* ai, Unit* target); diff --git a/playerbot/strategy/values/TradeValues.cpp b/playerbot/strategy/values/TradeValues.cpp index 57c7fb42..38896678 100644 --- a/playerbot/strategy/values/TradeValues.cpp +++ b/playerbot/strategy/values/TradeValues.cpp @@ -24,22 +24,22 @@ bool ItemsUsefulToGiveValue::IsTradingItem(uint32 entry) return false; } -list ItemsUsefulToGiveValue::Calculate() +std::list ItemsUsefulToGiveValue::Calculate() { GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target"); Player* player = guidP.GetPlayer(); - list giveItems; + std::list giveItems; if (ai->HasActivePlayerMaster() || !player->GetPlayerbotAI()) return giveItems; - list myUsages = { ItemUsage::ITEM_USAGE_NONE , ItemUsage::ITEM_USAGE_VENDOR, ItemUsage::ITEM_USAGE_AH, ItemUsage::ITEM_USAGE_DISENCHANT }; + std::list myUsages = { ItemUsage::ITEM_USAGE_NONE , ItemUsage::ITEM_USAGE_VENDOR, ItemUsage::ITEM_USAGE_AH, ItemUsage::ITEM_USAGE_DISENCHANT }; for (auto& myUsage : myUsages) { - list myItems = AI_VALUE2(list, "inventory items", "usage " + to_string((uint8)myUsage)); + std::list myItems = AI_VALUE2(std::list, "inventory items", "usage " + std::to_string((uint8)myUsage)); myItems.reverse(); for (auto& item : myItems) diff --git a/playerbot/strategy/values/TradeValues.h b/playerbot/strategy/values/TradeValues.h index c2624fde..d932eb59 100644 --- a/playerbot/strategy/values/TradeValues.h +++ b/playerbot/strategy/values/TradeValues.h @@ -1,13 +1,13 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { - class ItemsUsefulToGiveValue : public CalculatedValue< list>, public Qualified + class ItemsUsefulToGiveValue : public CalculatedValue< std::list>, public Qualified { public: - ItemsUsefulToGiveValue(PlayerbotAI* ai, string name = "useful to give") : CalculatedValue(ai, name), Qualified() {} - list Calculate(); + ItemsUsefulToGiveValue(PlayerbotAI* ai, std::string name = "useful to give") : CalculatedValue(ai, name), Qualified() {} + std::list Calculate(); private: bool IsTradingItem(uint32 entry); diff --git a/playerbot/strategy/values/TrainerValues.cpp b/playerbot/strategy/values/TrainerValues.cpp index 8ac1c3c3..bbf5962e 100644 --- a/playerbot/strategy/values/TrainerValues.cpp +++ b/playerbot/strategy/values/TrainerValues.cpp @@ -12,7 +12,7 @@ trainableSpellMap* TrainableSpellMapValue::Calculate() trainableSpellMap* spellMap = new trainableSpellMap; // template, trainer - unordered_map > trainerTemplateIds; + std::unordered_map > trainerTemplateIds; //Select all trainer lists and their trainers. for (uint32 id = 0; id < sCreatureStorage.GetMaxEntry(); ++id) @@ -75,10 +75,10 @@ trainableSpellMap* TrainableSpellMapValue::Calculate() return spellMap; } -vector TrainableClassSpells::Calculate() +std::vector TrainableClassSpells::Calculate() { - vector trainableSpells; - unordered_map hasSpell; + std::vector trainableSpells; + std::unordered_map hasSpell; trainableSpellMap* spellMap = GAI_VALUE(trainableSpellMap*, "trainable spell map"); @@ -107,9 +107,9 @@ vector TrainableClassSpells::Calculate() return trainableSpells; } -string TrainableClassSpells::Format() +std::string TrainableClassSpells::Format() { - vector vec; + std::vector vec; for (auto t : value) { SpellEntry const* spell = sServerFacade.LookupSpellInfo(t->spell); if (!spell) @@ -124,7 +124,7 @@ uint32 TrainCostValue::Calculate() { uint32 TotalCost = 0; - for (auto& spells : AI_VALUE(vector, "trainable class spells")) + for (auto& spells : AI_VALUE(std::vector, "trainable class spells")) TotalCost += spells->spellCost; /* diff --git a/playerbot/strategy/values/TrainerValues.h b/playerbot/strategy/values/TrainerValues.h index 21c0095c..b0c5d06b 100644 --- a/playerbot/strategy/values/TrainerValues.h +++ b/playerbot/strategy/values/TrainerValues.h @@ -4,11 +4,11 @@ namespace ai { // spell , trainers - typedef unordered_map> spellTrainerMap; + typedef std::unordered_map> spellTrainerMap; // spellsTypes, spell - typedef unordered_map trainableSpellList; + typedef std::unordered_map trainableSpellList; // trainerType, spellsTypes - typedef unordered_map trainableSpellMap; + typedef std::unordered_map trainableSpellMap; class TrainableSpellMapValue : public SingleCalculatedValue { @@ -19,14 +19,14 @@ namespace ai virtual ~TrainableSpellMapValue() { delete value; } }; - class TrainableClassSpells : public CalculatedValue> + class TrainableClassSpells : public CalculatedValue> { public: - TrainableClassSpells(PlayerbotAI* ai) : CalculatedValue>(ai, "trainable class spells") {} + TrainableClassSpells(PlayerbotAI* ai) : CalculatedValue>(ai, "trainable class spells") {} - virtual vector Calculate(); + virtual std::vector Calculate(); - virtual string Format() override; + virtual std::string Format() override; }; class TrainCostValue : public Uint32CalculatedValue diff --git a/playerbot/strategy/values/ValueContext.h b/playerbot/strategy/values/ValueContext.h index dedd8da3..f5042dbd 100644 --- a/playerbot/strategy/values/ValueContext.h +++ b/playerbot/strategy/values/ValueContext.h @@ -97,7 +97,7 @@ #include "TalentSpecValue.h" #include "MountValues.h" #include "DeadValues.h" -#include "../druid/DruidValues.h" +#include "playerbot/strategy/druid/DruidValues.h" namespace ai { diff --git a/playerbot/strategy/values/VendorValues.cpp b/playerbot/strategy/values/VendorValues.cpp index 595d14b6..16631740 100644 --- a/playerbot/strategy/values/VendorValues.cpp +++ b/playerbot/strategy/values/VendorValues.cpp @@ -31,7 +31,7 @@ bool VendorHasUsefulItemValue::Calculate() vendorItems.push_back(vItem); } - unordered_map freeMoney; + std::unordered_map freeMoney; freeMoney[ItemUsage::ITEM_USAGE_EQUIP] = AI_VALUE2(uint32, "free money for", (uint32)NeedMoneyFor::gear); freeMoney[ItemUsage::ITEM_USAGE_USE] = AI_VALUE2(uint32, "free money for", (uint32)NeedMoneyFor::consumables); diff --git a/playerbot/strategy/values/VendorValues.h b/playerbot/strategy/values/VendorValues.h index cb64f71a..2bd230c8 100644 --- a/playerbot/strategy/values/VendorValues.h +++ b/playerbot/strategy/values/VendorValues.h @@ -1,7 +1,7 @@ #pragma once -#include "../Value.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/Value.h" +#include "playerbot/strategy/NamedObjectContext.h" class PlayerbotAI; diff --git a/playerbot/strategy/values/WaitForAttackTimeValue.h b/playerbot/strategy/values/WaitForAttackTimeValue.h index 4a9aec73..ab1e8989 100644 --- a/playerbot/strategy/values/WaitForAttackTimeValue.h +++ b/playerbot/strategy/values/WaitForAttackTimeValue.h @@ -1,5 +1,5 @@ #pragma once -#include "../Value.h" +#include "playerbot/strategy/Value.h" namespace ai { @@ -7,7 +7,7 @@ namespace ai { public: WaitForAttackTimeValue(PlayerbotAI* ai) : ManualSetValue(ai, 10), Qualified() {} - virtual string Save() { return std::to_string(value); } - virtual bool Load(string inValue) { value = stoi(inValue); return true; } + virtual std::string Save() { return std::to_string(value); } + virtual bool Load(std::string inValue) { value = stoi(inValue); return true; } }; } diff --git a/playerbot/strategy/warlock/AfflictionWarlockStrategy.h b/playerbot/strategy/warlock/AfflictionWarlockStrategy.h index a5ecbc9e..2671bc52 100644 --- a/playerbot/strategy/warlock/AfflictionWarlockStrategy.h +++ b/playerbot/strategy/warlock/AfflictionWarlockStrategy.h @@ -8,7 +8,7 @@ namespace ai public: AfflictionWarlockPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "affliction"; } + std::string getName() override { return "affliction"; } }; class AfflictionWarlockStrategy : public WarlockStrategy @@ -78,7 +78,7 @@ namespace ai { public: AfflictionWarlockAoePveStrategy(PlayerbotAI* ai) : AfflictionWarlockAoeStrategy(ai) {} - string getName() override { return "aoe affliction pve"; } + std::string getName() override { return "aoe affliction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: AfflictionWarlockAoePvpStrategy(PlayerbotAI* ai) : AfflictionWarlockAoeStrategy(ai) {} - string getName() override { return "aoe affliction pvp"; } + std::string getName() override { return "aoe affliction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: AfflictionWarlockAoeRaidStrategy(PlayerbotAI* ai) : AfflictionWarlockAoeStrategy(ai) {} - string getName() override { return "aoe affliction raid"; } + std::string getName() override { return "aoe affliction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: AfflictionWarlockBuffPveStrategy(PlayerbotAI* ai) : AfflictionWarlockBuffStrategy(ai) {} - string getName() override { return "buff affliction pve"; } + std::string getName() override { return "buff affliction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: AfflictionWarlockBuffPvpStrategy(PlayerbotAI* ai) : AfflictionWarlockBuffStrategy(ai) {} - string getName() override { return "buff affliction pvp"; } + std::string getName() override { return "buff affliction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: AfflictionWarlockBuffRaidStrategy(PlayerbotAI* ai) : AfflictionWarlockBuffStrategy(ai) {} - string getName() override { return "buff affliction raid"; } + std::string getName() override { return "buff affliction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: AfflictionWarlockBoostPveStrategy(PlayerbotAI* ai) : AfflictionWarlockBoostStrategy(ai) {} - string getName() override { return "boost affliction pve"; } + std::string getName() override { return "boost affliction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: AfflictionWarlockBoostPvpStrategy(PlayerbotAI* ai) : AfflictionWarlockBoostStrategy(ai) {} - string getName() override { return "boost affliction pvp"; } + std::string getName() override { return "boost affliction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: AfflictionWarlockBoostRaidStrategy(PlayerbotAI* ai) : AfflictionWarlockBoostStrategy(ai) {} - string getName() override { return "boost affliction raid"; } + std::string getName() override { return "boost affliction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: AfflictionWarlockCcPveStrategy(PlayerbotAI* ai) : AfflictionWarlockCcStrategy(ai) {} - string getName() override { return "cc affliction pve"; } + std::string getName() override { return "cc affliction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: AfflictionWarlockCcPvpStrategy(PlayerbotAI* ai) : AfflictionWarlockCcStrategy(ai) {} - string getName() override { return "cc affliction pvp"; } + std::string getName() override { return "cc affliction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: AfflictionWarlockCcRaidStrategy(PlayerbotAI* ai) : AfflictionWarlockCcStrategy(ai) {} - string getName() override { return "cc affliction raid"; } + std::string getName() override { return "cc affliction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: AfflictionWarlockPetPveStrategy(PlayerbotAI* ai) : AfflictionWarlockPetStrategy(ai) {} - string getName() override { return "pet affliction pve"; } + std::string getName() override { return "pet affliction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: AfflictionWarlockPetPvpStrategy(PlayerbotAI* ai) : AfflictionWarlockPetStrategy(ai) {} - string getName() override { return "pet affliction pvp"; } + std::string getName() override { return "pet affliction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: AfflictionWarlockPetRaidStrategy(PlayerbotAI* ai) : AfflictionWarlockPetStrategy(ai) {} - string getName() override { return "pet affliction raid"; } + std::string getName() override { return "pet affliction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -292,7 +292,7 @@ namespace ai { public: AfflictionWarlockCursesPveStrategy(PlayerbotAI* ai) : AfflictionWarlockCursesStrategy(ai) {} - string getName() override { return "curse affliction pve"; } + std::string getName() override { return "curse affliction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: AfflictionWarlockCursesPvpStrategy(PlayerbotAI* ai) : AfflictionWarlockCursesStrategy(ai) {} - string getName() override { return "curse affliction pvp"; } + std::string getName() override { return "curse affliction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -312,7 +312,7 @@ namespace ai { public: AfflictionWarlockCursesRaidStrategy(PlayerbotAI* ai) : AfflictionWarlockCursesStrategy(ai) {} - string getName() override { return "curse affliction raid"; } + std::string getName() override { return "curse affliction raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/warlock/DemonologyWarlockStrategy.h b/playerbot/strategy/warlock/DemonologyWarlockStrategy.h index ea0ce35f..ba6e6987 100644 --- a/playerbot/strategy/warlock/DemonologyWarlockStrategy.h +++ b/playerbot/strategy/warlock/DemonologyWarlockStrategy.h @@ -8,7 +8,7 @@ namespace ai public: DemonologyWarlockPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "demonology"; } + std::string getName() override { return "demonology"; } }; class DemonologyWarlockStrategy : public WarlockStrategy @@ -78,7 +78,7 @@ namespace ai { public: DemonologyWarlockAoePveStrategy(PlayerbotAI* ai) : DemonologyWarlockAoeStrategy(ai) {} - string getName() override { return "aoe demonology pve"; } + std::string getName() override { return "aoe demonology pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: DemonologyWarlockAoePvpStrategy(PlayerbotAI* ai) : DemonologyWarlockAoeStrategy(ai) {} - string getName() override { return "aoe demonology pvp"; } + std::string getName() override { return "aoe demonology pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: DemonologyWarlockAoeRaidStrategy(PlayerbotAI* ai) : DemonologyWarlockAoeStrategy(ai) {} - string getName() override { return "aoe demonology raid"; } + std::string getName() override { return "aoe demonology raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: DemonologyWarlockBuffPveStrategy(PlayerbotAI* ai) : DemonologyWarlockBuffStrategy(ai) {} - string getName() override { return "buff demonology pve"; } + std::string getName() override { return "buff demonology pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: DemonologyWarlockBuffPvpStrategy(PlayerbotAI* ai) : DemonologyWarlockBuffStrategy(ai) {} - string getName() override { return "buff demonology pvp"; } + std::string getName() override { return "buff demonology pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: DemonologyWarlockBuffRaidStrategy(PlayerbotAI* ai) : DemonologyWarlockBuffStrategy(ai) {} - string getName() override { return "buff demonology raid"; } + std::string getName() override { return "buff demonology raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: DemonologyWarlockBoostPveStrategy(PlayerbotAI* ai) : DemonologyWarlockBoostStrategy(ai) {} - string getName() override { return "boost demonology pve"; } + std::string getName() override { return "boost demonology pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: DemonologyWarlockBoostPvpStrategy(PlayerbotAI* ai) : DemonologyWarlockBoostStrategy(ai) {} - string getName() override { return "boost demonology pvp"; } + std::string getName() override { return "boost demonology pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: DemonologyWarlockBoostRaidStrategy(PlayerbotAI* ai) : DemonologyWarlockBoostStrategy(ai) {} - string getName() override { return "boost demonology raid"; } + std::string getName() override { return "boost demonology raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: DemonologyWarlockCcPveStrategy(PlayerbotAI* ai) : DemonologyWarlockCcStrategy(ai) {} - string getName() override { return "cc demonology pve"; } + std::string getName() override { return "cc demonology pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: DemonologyWarlockCcPvpStrategy(PlayerbotAI* ai) : DemonologyWarlockCcStrategy(ai) {} - string getName() override { return "cc demonology pvp"; } + std::string getName() override { return "cc demonology pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: DemonologyWarlockCcRaidStrategy(PlayerbotAI* ai) : DemonologyWarlockCcStrategy(ai) {} - string getName() override { return "cc demonology raid"; } + std::string getName() override { return "cc demonology raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: DemonologyWarlockPetPveStrategy(PlayerbotAI* ai) : DemonologyWarlockPetStrategy(ai) {} - string getName() override { return "pet demonology pve"; } + std::string getName() override { return "pet demonology pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: DemonologyWarlockPetPvpStrategy(PlayerbotAI* ai) : DemonologyWarlockPetStrategy(ai) {} - string getName() override { return "pet demonology pvp"; } + std::string getName() override { return "pet demonology pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: DemonologyWarlockPetRaidStrategy(PlayerbotAI* ai) : DemonologyWarlockPetStrategy(ai) {} - string getName() override { return "pet demonology raid"; } + std::string getName() override { return "pet demonology raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -292,7 +292,7 @@ namespace ai { public: DemonologyWarlockCursesPveStrategy(PlayerbotAI* ai) : DemonologyWarlockCursesStrategy(ai) {} - string getName() override { return "curse demonology pve"; } + std::string getName() override { return "curse demonology pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: DemonologyWarlockCursesPvpStrategy(PlayerbotAI* ai) : DemonologyWarlockCursesStrategy(ai) {} - string getName() override { return "curse demonology pvp"; } + std::string getName() override { return "curse demonology pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -312,7 +312,7 @@ namespace ai { public: DemonologyWarlockCursesRaidStrategy(PlayerbotAI* ai) : DemonologyWarlockCursesStrategy(ai) {} - string getName() override { return "curse demonology raid"; } + std::string getName() override { return "curse demonology raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/warlock/DestructionWarlockStrategy.h b/playerbot/strategy/warlock/DestructionWarlockStrategy.h index 75cf8d5b..fa51b34f 100644 --- a/playerbot/strategy/warlock/DestructionWarlockStrategy.h +++ b/playerbot/strategy/warlock/DestructionWarlockStrategy.h @@ -8,7 +8,7 @@ namespace ai public: DestructionWarlockPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; } - string getName() override { return "destruction"; } + std::string getName() override { return "destruction"; } }; class DestructionWarlockStrategy : public WarlockStrategy @@ -78,7 +78,7 @@ namespace ai { public: DestructionWarlockAoePveStrategy(PlayerbotAI* ai) : DestructionWarlockAoeStrategy(ai) {} - string getName() override { return "aoe destruction pve"; } + std::string getName() override { return "aoe destruction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: DestructionWarlockAoePvpStrategy(PlayerbotAI* ai) : DestructionWarlockAoeStrategy(ai) {} - string getName() override { return "aoe destruction pvp"; } + std::string getName() override { return "aoe destruction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: DestructionWarlockAoeRaidStrategy(PlayerbotAI* ai) : DestructionWarlockAoeStrategy(ai) {} - string getName() override { return "aoe destruction raid"; } + std::string getName() override { return "aoe destruction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: DestructionWarlockBuffPveStrategy(PlayerbotAI* ai) : DestructionWarlockBuffStrategy(ai) {} - string getName() override { return "buff destruction pve"; } + std::string getName() override { return "buff destruction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: DestructionWarlockBuffPvpStrategy(PlayerbotAI* ai) : DestructionWarlockBuffStrategy(ai) {} - string getName() override { return "buff destruction pvp"; } + std::string getName() override { return "buff destruction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: DestructionWarlockBuffRaidStrategy(PlayerbotAI* ai) : DestructionWarlockBuffStrategy(ai) {} - string getName() override { return "buff destruction raid"; } + std::string getName() override { return "buff destruction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: DestructionWarlockBoostPveStrategy(PlayerbotAI* ai) : DestructionWarlockBoostStrategy(ai) {} - string getName() override { return "boost destruction pve"; } + std::string getName() override { return "boost destruction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: DestructionWarlockBoostPvpStrategy(PlayerbotAI* ai) : DestructionWarlockBoostStrategy(ai) {} - string getName() override { return "boost destruction pvp"; } + std::string getName() override { return "boost destruction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: DestructionWarlockBoostRaidStrategy(PlayerbotAI* ai) : DestructionWarlockBoostStrategy(ai) {} - string getName() override { return "boost destruction raid"; } + std::string getName() override { return "boost destruction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: DestructionWarlockCcPveStrategy(PlayerbotAI* ai) : DestructionWarlockCcStrategy(ai) {} - string getName() override { return "cc destruction pve"; } + std::string getName() override { return "cc destruction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: DestructionWarlockCcPvpStrategy(PlayerbotAI* ai) : DestructionWarlockCcStrategy(ai) {} - string getName() override { return "cc destruction pvp"; } + std::string getName() override { return "cc destruction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: DestructionWarlockCcRaidStrategy(PlayerbotAI* ai) : DestructionWarlockCcStrategy(ai) {} - string getName() override { return "cc destruction raid"; } + std::string getName() override { return "cc destruction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -250,7 +250,7 @@ namespace ai { public: DestructionWarlockPetPveStrategy(PlayerbotAI* ai) : DestructionWarlockPetStrategy(ai) {} - string getName() override { return "pet destruction pve"; } + std::string getName() override { return "pet destruction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -261,7 +261,7 @@ namespace ai { public: DestructionWarlockPetPvpStrategy(PlayerbotAI* ai) : DestructionWarlockPetStrategy(ai) {} - string getName() override { return "pet destruction pvp"; } + std::string getName() override { return "pet destruction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -272,7 +272,7 @@ namespace ai { public: DestructionWarlockPetRaidStrategy(PlayerbotAI* ai) : DestructionWarlockPetStrategy(ai) {} - string getName() override { return "pet destruction raid"; } + std::string getName() override { return "pet destruction raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -292,7 +292,7 @@ namespace ai { public: DestructionWarlockCursesPveStrategy(PlayerbotAI* ai) : DestructionWarlockCursesStrategy(ai) {} - string getName() override { return "curse destruction pve"; } + std::string getName() override { return "curse destruction pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -302,7 +302,7 @@ namespace ai { public: DestructionWarlockCursesPvpStrategy(PlayerbotAI* ai) : DestructionWarlockCursesStrategy(ai) {} - string getName() override { return "curse destruction pvp"; } + std::string getName() override { return "curse destruction pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -312,7 +312,7 @@ namespace ai { public: DestructionWarlockCursesRaidStrategy(PlayerbotAI* ai) : DestructionWarlockCursesStrategy(ai) {} - string getName() override { return "curse destruction raid"; } + std::string getName() override { return "curse destruction raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/warlock/WarlockActions.h b/playerbot/strategy/warlock/WarlockActions.h index 656dda38..04efafab 100644 --- a/playerbot/strategy/warlock/WarlockActions.h +++ b/playerbot/strategy/warlock/WarlockActions.h @@ -125,7 +125,7 @@ namespace ai { public: CastSoulShatterAction(PlayerbotAI* ai) : CastSpellAction(ai, "soulshatter") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } }; class CastSoulFireAction : public CastSpellAction @@ -278,7 +278,7 @@ namespace ai { public: CastSacrificeAction(PlayerbotAI* ai) : CastPetSpellAction(ai, "sacrifice") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } }; class CastSpellLockAction : public CastPetSpellAction @@ -291,16 +291,16 @@ namespace ai { public: CastSpellLockOnEnemyHealerAction(PlayerbotAI* ai) : CastPetSpellAction(ai, "spell lock") {} - virtual string GetTargetName() override { return "enemy healer target"; } - virtual string GetTargetQualifier() override { return GetSpellName(); } - virtual string getName() override { return GetSpellName() + " on enemy healer"; } + virtual std::string GetTargetName() override { return "enemy healer target"; } + virtual std::string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string getName() override { return GetSpellName() + " on enemy healer"; } }; class CastSummonImpAction : public CastBuffSpellAction { public: CastSummonImpAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "summon imp") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } bool isUseful() override { @@ -318,7 +318,7 @@ namespace ai { public: CastSummonSuccubusAction(PlayerbotAI* ai) : CastSpellAction(ai, "summon succubus") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } bool isUseful() override { @@ -336,7 +336,7 @@ namespace ai { public: CastSummonFelhunterAction(PlayerbotAI* ai) : CastSpellAction(ai, "summon felhunter") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } bool isUseful() override { @@ -354,7 +354,7 @@ namespace ai { public: CastSummonVoidwalkerAction(PlayerbotAI* ai) : CastSpellAction(ai, "summon voidwalker") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } bool isUseful() override { @@ -372,7 +372,7 @@ namespace ai { public: CastSummonFelguardAction(PlayerbotAI* ai) : CastSpellAction(ai, "summon felguard") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } bool isUseful() override { @@ -397,29 +397,29 @@ namespace ai { public: CastCreateHealthstoneAction(PlayerbotAI* ai) : CastSpellAction(ai, "create healthstone") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } }; class CastCreateFirestoneAction : public CastSpellAction { public: CastCreateFirestoneAction(PlayerbotAI* ai) : CastSpellAction(ai, "create firestone") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } }; class CastCreateSpellstoneAction : public CastSpellAction { public: CastCreateSpellstoneAction(PlayerbotAI* ai) : CastSpellAction(ai, "create spellstone") {} - string GetTargetName() override { return "self target"; } + std::string GetTargetName() override { return "self target"; } }; class CastBanishAction : public CastSpellAction { public: CastBanishAction(PlayerbotAI* ai) : CastSpellAction(ai, "banish") {} - virtual string GetTargetName() override { return "snare target"; } - virtual string GetTargetQualifier() override { return GetSpellName(); } + virtual std::string GetTargetName() override { return "snare target"; } + virtual std::string GetTargetQualifier() override { return GetSpellName(); } virtual ActionThreatType getThreatType() { return ActionThreatType::ACTION_THREAT_NONE; } }; @@ -484,7 +484,7 @@ namespace ai { public: CastLifeTapAction(PlayerbotAI* ai) : CastSpellAction(ai, "life tap") {} - virtual string GetTargetName() { return "self target"; } + virtual std::string GetTargetName() { return "self target"; } virtual bool isUseful() { return AI_VALUE2(uint8, "health", "self target") > sPlayerbotAIConfig.lowHealth; } }; diff --git a/playerbot/strategy/warlock/WarlockAiObjectContext.cpp b/playerbot/strategy/warlock/WarlockAiObjectContext.cpp index a76dc6fc..75a02775 100644 --- a/playerbot/strategy/warlock/WarlockAiObjectContext.cpp +++ b/playerbot/strategy/warlock/WarlockAiObjectContext.cpp @@ -2,9 +2,9 @@ #include "playerbot/playerbot.h" #include "WarlockActions.h" #include "WarlockAiObjectContext.h" -#include "../generic/PullStrategy.h" +#include "playerbot/strategy/generic/PullStrategy.h" #include "WarlockTriggers.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "playerbot/strategy/actions/UseItemAction.h" #include "AfflictionWarlockStrategy.h" #include "DestructionWarlockStrategy.h" diff --git a/playerbot/strategy/warlock/WarlockAiObjectContext.h b/playerbot/strategy/warlock/WarlockAiObjectContext.h index 0d3fa27f..8b695a33 100644 --- a/playerbot/strategy/warlock/WarlockAiObjectContext.h +++ b/playerbot/strategy/warlock/WarlockAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/warlock/WarlockStrategy.h b/playerbot/strategy/warlock/WarlockStrategy.h index 66334533..ffe0de1d 100644 --- a/playerbot/strategy/warlock/WarlockStrategy.h +++ b/playerbot/strategy/warlock/WarlockStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { @@ -7,14 +7,14 @@ namespace ai { public: WarlockPetPlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "pet"; } + std::string getName() override { return "pet"; } }; class WarlockCursePlaceholderStrategy : public PlaceholderStrategy { public: WarlockCursePlaceholderStrategy(PlayerbotAI* ai) : PlaceholderStrategy(ai) {} - string getName() override { return "curse"; } + std::string getName() override { return "curse"; } }; class WarlockStrategy : public ClassStrategy @@ -247,7 +247,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitNonCombatTriggers(std::list& triggers) override; @@ -267,7 +267,7 @@ namespace ai , triggerName(inTriggerName) , actionName(inActionName) {} - string getName() override { return name; } + std::string getName() override { return name; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/warlock/WarlockTriggers.cpp b/playerbot/strategy/warlock/WarlockTriggers.cpp index 8202f3bd..65692a3d 100644 --- a/playerbot/strategy/warlock/WarlockTriggers.cpp +++ b/playerbot/strategy/warlock/WarlockTriggers.cpp @@ -93,9 +93,9 @@ bool NoCurseTrigger::IsActive() bool NoCurseOnAttackerTrigger::IsActive() { - list attackers = AI_VALUE(list, "possible attack targets"); + std::list attackers = AI_VALUE(std::list, "possible attack targets"); Unit* currentTarget = AI_VALUE(Unit*, "current target"); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* attacker = ai->GetUnit(*i); if (attacker && attacker != currentTarget) @@ -130,8 +130,8 @@ bool FearPvpTrigger::IsActive() { // Check if the bot has feared anyone bool alreadyFeared = false; - list attackers = AI_VALUE(list, "attackers"); - for (list::iterator i = attackers.begin(); i != attackers.end(); ++i) + std::list attackers = AI_VALUE(std::list, "attackers"); + for (std::list::iterator i = attackers.begin(); i != attackers.end(); ++i) { Unit* attacker = ai->GetUnit(*i); if (ai->HasAura("fear", attacker, false, true)) diff --git a/playerbot/strategy/warlock/WarlockTriggers.h b/playerbot/strategy/warlock/WarlockTriggers.h index bd7bf369..74ad8695 100644 --- a/playerbot/strategy/warlock/WarlockTriggers.h +++ b/playerbot/strategy/warlock/WarlockTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai { @@ -24,7 +24,7 @@ namespace ai bool IsActive() override; private: - string GetTargetName() override { return "current target"; } + std::string GetTargetName() override { return "current target"; } }; class NoCurseOnAttackerTrigger : public Trigger @@ -142,7 +142,7 @@ namespace ai class WarlockConjuredItemTrigger : public ItemCountTrigger { public: - WarlockConjuredItemTrigger(PlayerbotAI* ai, string item) : ItemCountTrigger(ai, item, 1) {} + WarlockConjuredItemTrigger(PlayerbotAI* ai, std::string item) : ItemCountTrigger(ai, item, 1) {} virtual bool IsActive() { return ItemCountTrigger::IsActive() && (ai->HasCheat(BotCheatMask::item) || AI_VALUE2(uint32, "item count", "soul shard") > 0); } }; diff --git a/playerbot/strategy/warrior/ArmsWarriorStrategy.h b/playerbot/strategy/warrior/ArmsWarriorStrategy.h index eefd501d..bf63190a 100644 --- a/playerbot/strategy/warrior/ArmsWarriorStrategy.h +++ b/playerbot/strategy/warrior/ArmsWarriorStrategy.h @@ -8,7 +8,7 @@ namespace ai public: ArmsWarriorPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "arms"; } + std::string getName() override { return "arms"; } }; class ArmsWarriorStrategy : public WarriorStrategy @@ -78,7 +78,7 @@ namespace ai { public: ArmsWarriorAoePveStrategy(PlayerbotAI* ai) : ArmsWarriorAoeStrategy(ai) {} - string getName() override { return "aoe arms pve"; } + std::string getName() override { return "aoe arms pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: ArmsWarriorAoePvpStrategy(PlayerbotAI* ai) : ArmsWarriorAoeStrategy(ai) {} - string getName() override { return "aoe arms pvp"; } + std::string getName() override { return "aoe arms pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: ArmsWarriorAoeRaidStrategy(PlayerbotAI* ai) : ArmsWarriorAoeStrategy(ai) {} - string getName() override { return "aoe arms raid"; } + std::string getName() override { return "aoe arms raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: ArmsWarriorBuffPveStrategy(PlayerbotAI* ai) : ArmsWarriorBuffStrategy(ai) {} - string getName() override { return "buff arms pve"; } + std::string getName() override { return "buff arms pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: ArmsWarriorBuffPvpStrategy(PlayerbotAI* ai) : ArmsWarriorBuffStrategy(ai) {} - string getName() override { return "buff arms pvp"; } + std::string getName() override { return "buff arms pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: ArmsWarriorBuffRaidStrategy(PlayerbotAI* ai) : ArmsWarriorBuffStrategy(ai) {} - string getName() override { return "buff arms raid"; } + std::string getName() override { return "buff arms raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: ArmsWarriorBoostPveStrategy(PlayerbotAI* ai) : ArmsWarriorBoostStrategy(ai) {} - string getName() override { return "boost arms pve"; } + std::string getName() override { return "boost arms pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: ArmsWarriorBoostPvpStrategy(PlayerbotAI* ai) : ArmsWarriorBoostStrategy(ai) {} - string getName() override { return "boost arms pvp"; } + std::string getName() override { return "boost arms pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: ArmsWarriorBoostRaidStrategy(PlayerbotAI* ai) : ArmsWarriorBoostStrategy(ai) {} - string getName() override { return "boost arms raid"; } + std::string getName() override { return "boost arms raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: ArmsWarriorCcPveStrategy(PlayerbotAI* ai) : ArmsWarriorCcStrategy(ai) {} - string getName() override { return "cc arms pve"; } + std::string getName() override { return "cc arms pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: ArmsWarriorCcPvpStrategy(PlayerbotAI* ai) : ArmsWarriorCcStrategy(ai) {} - string getName() override { return "cc arms pvp"; } + std::string getName() override { return "cc arms pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: ArmsWarriorCcRaidStrategy(PlayerbotAI* ai) : ArmsWarriorCcStrategy(ai) {} - string getName() override { return "cc arms raid"; } + std::string getName() override { return "cc arms raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/warrior/FuryWarriorStrategy.h b/playerbot/strategy/warrior/FuryWarriorStrategy.h index b5b2458e..44f43312 100644 --- a/playerbot/strategy/warrior/FuryWarriorStrategy.h +++ b/playerbot/strategy/warrior/FuryWarriorStrategy.h @@ -8,7 +8,7 @@ namespace ai public: FuryWarriorPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_COMBAT | STRATEGY_TYPE_DPS | STRATEGY_TYPE_MELEE; } - string getName() override { return "fury"; } + std::string getName() override { return "fury"; } }; class FuryWarriorStrategy : public WarriorStrategy @@ -78,7 +78,7 @@ namespace ai { public: FuryWarriorAoePveStrategy(PlayerbotAI* ai) : FuryWarriorAoeStrategy(ai) {} - string getName() override { return "aoe fury pve"; } + std::string getName() override { return "aoe fury pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: FuryWarriorAoePvpStrategy(PlayerbotAI* ai) : FuryWarriorAoeStrategy(ai) {} - string getName() override { return "aoe fury pvp"; } + std::string getName() override { return "aoe fury pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: FuryWarriorAoeRaidStrategy(PlayerbotAI* ai) : FuryWarriorAoeStrategy(ai) {} - string getName() override { return "aoe fury raid"; } + std::string getName() override { return "aoe fury raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: FuryWarriorBuffPveStrategy(PlayerbotAI* ai) : FuryWarriorBuffStrategy(ai) {} - string getName() override { return "buff fury pve"; } + std::string getName() override { return "buff fury pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: FuryWarriorBuffPvpStrategy(PlayerbotAI* ai) : FuryWarriorBuffStrategy(ai) {} - string getName() override { return "buff fury pvp"; } + std::string getName() override { return "buff fury pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: FuryWarriorBuffRaidStrategy(PlayerbotAI* ai) : FuryWarriorBuffStrategy(ai) {} - string getName() override { return "buff fury raid"; } + std::string getName() override { return "buff fury raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: FuryWarriorBoostPveStrategy(PlayerbotAI* ai) : FuryWarriorBoostStrategy(ai) {} - string getName() override { return "boost fury pve"; } + std::string getName() override { return "boost fury pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: FuryWarriorBoostPvpStrategy(PlayerbotAI* ai) : FuryWarriorBoostStrategy(ai) {} - string getName() override { return "boost fury pvp"; } + std::string getName() override { return "boost fury pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: FuryWarriorBoostRaidStrategy(PlayerbotAI* ai) : FuryWarriorBoostStrategy(ai) {} - string getName() override { return "boost fury raid"; } + std::string getName() override { return "boost fury raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: FuryWarriorCcPveStrategy(PlayerbotAI* ai) : FuryWarriorCcStrategy(ai) {} - string getName() override { return "cc fury pve"; } + std::string getName() override { return "cc fury pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: FuryWarriorCcPvpStrategy(PlayerbotAI* ai) : FuryWarriorCcStrategy(ai) {} - string getName() override { return "cc fury pvp"; } + std::string getName() override { return "cc fury pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: FuryWarriorCcRaidStrategy(PlayerbotAI* ai) : FuryWarriorCcStrategy(ai) {} - string getName() override { return "cc fury raid"; } + std::string getName() override { return "cc fury raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/warrior/ProtectionWarriorStrategy.h b/playerbot/strategy/warrior/ProtectionWarriorStrategy.h index cca2910e..fd341eb6 100644 --- a/playerbot/strategy/warrior/ProtectionWarriorStrategy.h +++ b/playerbot/strategy/warrior/ProtectionWarriorStrategy.h @@ -8,7 +8,7 @@ namespace ai public: ProtectionWarriorPlaceholderStrategy(PlayerbotAI* ai) : SpecPlaceholderStrategy(ai) {} int GetType() override { return STRATEGY_TYPE_TANK | STRATEGY_TYPE_MELEE; } - string getName() override { return "protection"; } + std::string getName() override { return "protection"; } }; class ProtectionWarriorStrategy : public WarriorStrategy @@ -78,7 +78,7 @@ namespace ai { public: ProtectionWarriorAoePveStrategy(PlayerbotAI* ai) : ProtectionWarriorAoeStrategy(ai) {} - string getName() override { return "aoe protection pve"; } + std::string getName() override { return "aoe protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -89,7 +89,7 @@ namespace ai { public: ProtectionWarriorAoePvpStrategy(PlayerbotAI* ai) : ProtectionWarriorAoeStrategy(ai) {} - string getName() override { return "aoe protection pvp"; } + std::string getName() override { return "aoe protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -100,7 +100,7 @@ namespace ai { public: ProtectionWarriorAoeRaidStrategy(PlayerbotAI* ai) : ProtectionWarriorAoeStrategy(ai) {} - string getName() override { return "aoe protection raid"; } + std::string getName() override { return "aoe protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -121,7 +121,7 @@ namespace ai { public: ProtectionWarriorBuffPveStrategy(PlayerbotAI* ai) : ProtectionWarriorBuffStrategy(ai) {} - string getName() override { return "buff protection pve"; } + std::string getName() override { return "buff protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -132,7 +132,7 @@ namespace ai { public: ProtectionWarriorBuffPvpStrategy(PlayerbotAI* ai) : ProtectionWarriorBuffStrategy(ai) {} - string getName() override { return "buff protection pvp"; } + std::string getName() override { return "buff protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -143,7 +143,7 @@ namespace ai { public: ProtectionWarriorBuffRaidStrategy(PlayerbotAI* ai) : ProtectionWarriorBuffStrategy(ai) {} - string getName() override { return "buff protection raid"; } + std::string getName() override { return "buff protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -164,7 +164,7 @@ namespace ai { public: ProtectionWarriorBoostPveStrategy(PlayerbotAI* ai) : ProtectionWarriorBoostStrategy(ai) {} - string getName() override { return "boost protection pve"; } + std::string getName() override { return "boost protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -175,7 +175,7 @@ namespace ai { public: ProtectionWarriorBoostPvpStrategy(PlayerbotAI* ai) : ProtectionWarriorBoostStrategy(ai) {} - string getName() override { return "boost protection pvp"; } + std::string getName() override { return "boost protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -186,7 +186,7 @@ namespace ai { public: ProtectionWarriorBoostRaidStrategy(PlayerbotAI* ai) : ProtectionWarriorBoostStrategy(ai) {} - string getName() override { return "boost protection raid"; } + std::string getName() override { return "boost protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -207,7 +207,7 @@ namespace ai { public: ProtectionWarriorCcPveStrategy(PlayerbotAI* ai) : ProtectionWarriorCcStrategy(ai) {} - string getName() override { return "cc protection pve"; } + std::string getName() override { return "cc protection pve"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -218,7 +218,7 @@ namespace ai { public: ProtectionWarriorCcPvpStrategy(PlayerbotAI* ai) : ProtectionWarriorCcStrategy(ai) {} - string getName() override { return "cc protection pvp"; } + std::string getName() override { return "cc protection pvp"; } private: void InitCombatTriggers(std::list& triggers) override; @@ -229,7 +229,7 @@ namespace ai { public: ProtectionWarriorCcRaidStrategy(PlayerbotAI* ai) : ProtectionWarriorCcStrategy(ai) {} - string getName() override { return "cc protection raid"; } + std::string getName() override { return "cc protection raid"; } private: void InitCombatTriggers(std::list& triggers) override; diff --git a/playerbot/strategy/warrior/WarriorAiObjectContext.cpp b/playerbot/strategy/warrior/WarriorAiObjectContext.cpp index 9402ee98..5034b93d 100644 --- a/playerbot/strategy/warrior/WarriorAiObjectContext.cpp +++ b/playerbot/strategy/warrior/WarriorAiObjectContext.cpp @@ -1,6 +1,6 @@ #include "playerbot/playerbot.h" -#include "../NamedObjectContext.h" +#include "playerbot/strategy/NamedObjectContext.h" #include "WarriorActions.h" #include "WarriorTriggers.h" #include "WarriorAiObjectContext.h" diff --git a/playerbot/strategy/warrior/WarriorAiObjectContext.h b/playerbot/strategy/warrior/WarriorAiObjectContext.h index bc1b5d49..e8f1fab2 100644 --- a/playerbot/strategy/warrior/WarriorAiObjectContext.h +++ b/playerbot/strategy/warrior/WarriorAiObjectContext.h @@ -1,6 +1,6 @@ #pragma once -#include "../AiObjectContext.h" +#include "playerbot/strategy/AiObjectContext.h" namespace ai { diff --git a/playerbot/strategy/warrior/WarriorStrategy.h b/playerbot/strategy/warrior/WarriorStrategy.h index 9fed7c3b..905f35b3 100644 --- a/playerbot/strategy/warrior/WarriorStrategy.h +++ b/playerbot/strategy/warrior/WarriorStrategy.h @@ -1,5 +1,5 @@ #pragma once -#include "../generic/ClassStrategy.h" +#include "playerbot/strategy/generic/ClassStrategy.h" namespace ai { diff --git a/playerbot/strategy/warrior/WarriorTriggers.h b/playerbot/strategy/warrior/WarriorTriggers.h index 90e6d840..18e9b842 100644 --- a/playerbot/strategy/warrior/WarriorTriggers.h +++ b/playerbot/strategy/warrior/WarriorTriggers.h @@ -1,5 +1,5 @@ #pragma once -#include "../triggers/GenericTriggers.h" +#include "playerbot/strategy/triggers/GenericTriggers.h" namespace ai {