From 3556a38dcdd155473b468db2c7f840b0cd944517 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 28 Jun 2024 20:14:22 +0800 Subject: [PATCH] [Initialization] Ammo init --- src/PlayerbotFactory.cpp | 5 ++--- src/PlayerbotMgr.cpp | 2 +- src/RandomItemMgr.cpp | 10 ++++------ src/RandomPlayerbotMgr.cpp | 4 +--- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 1512046d..10fc482b 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -2502,8 +2502,7 @@ void PlayerbotFactory::InitAmmo() case ITEM_SUBCLASS_WEAPON_CROSSBOW: subClass = ITEM_SUBCLASS_ARROW; break; - case ITEM_SUBCLASS_WEAPON_THROWN: - subClass = ITEM_SUBCLASS_THROWN; + default: break; } @@ -2516,7 +2515,7 @@ void PlayerbotFactory::InitAmmo() if (count < maxCount / 2) { - if (Item* newItem = StoreNewItemInInventorySlot(bot, entry, maxCount / 2)) { + if (Item* newItem = StoreNewItemInInventorySlot(bot, entry, maxCount)) { newItem->AddToUpdateQueueOf(bot); } } diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index ea239ca5..099350f2 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -450,7 +450,7 @@ void PlayerbotHolder::OnBotLogin(Player* const bot) if (isRandomAccount && sPlayerbotAIConfig->randomBotFixedLevel) { bot->SetPlayerFlag(PLAYER_FLAGS_NO_XP_GAIN); - } else { + } else if (isRandomAccount && !sPlayerbotAIConfig->randomBotFixedLevel) { bot->RemovePlayerFlag(PLAYER_FLAGS_NO_XP_GAIN); } diff --git a/src/RandomItemMgr.cpp b/src/RandomItemMgr.cpp index d909b4b0..e02b865b 100644 --- a/src/RandomItemMgr.cpp +++ b/src/RandomItemMgr.cpp @@ -2202,9 +2202,7 @@ RandomItemList RandomItemMgr::Query(uint32 level, uint8 clazz, uint8 slot, uint3 void RandomItemMgr::BuildAmmoCache() { - uint32 maxLevel = sPlayerbotAIConfig->randomBotMaxLevel; - if (maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) - maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); + uint32 maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); LOG_INFO("server.loading", "Building ammo cache for {} levels", maxLevel); @@ -2241,9 +2239,9 @@ uint32 RandomItemMgr::GetAmmo(uint32 level, uint32 subClass) void RandomItemMgr::BuildPotionCache() { - uint32 maxLevel = sPlayerbotAIConfig->randomBotMaxLevel; - if (maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) - maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); + uint32 maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); + // if (maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) + // maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); LOG_INFO("server.loading", "Building potion cache for {} levels", maxLevel); diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index 4d6295b7..334b6499 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -1257,9 +1257,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector& void RandomPlayerbotMgr::PrepareTeleportCache() { - uint8 maxLevel = sPlayerbotAIConfig->randomBotMaxLevel; - if (maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) - maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); + uint32 maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); LOG_INFO("playerbots", "Preparing random teleport caches for {} levels...", maxLevel);