[Initialization] Ammo init

This commit is contained in:
Yunfan Li
2024-06-28 20:14:22 +08:00
parent 6abc8d51e9
commit 3556a38dcd
4 changed files with 8 additions and 13 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -1257,9 +1257,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
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);