set ammo, fix enchantment

This commit is contained in:
Yunfan Li
2023-08-08 17:26:40 +08:00
parent aea611adc4
commit c335eb8e14
2 changed files with 6 additions and 9 deletions

View File

@@ -4013,7 +4013,7 @@ void PlayerbotAI::ImbueItem(Item* item, uint32 targetFlag, ObjectGuid targetGUID
void PlayerbotAI::EnchantItemT(uint32 spellid, uint8 slot) void PlayerbotAI::EnchantItemT(uint32 spellid, uint8 slot)
{ {
Item* pItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); Item* pItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (!pItem) if (!pItem || !pItem->IsInWorld())
return; return;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);

View File

@@ -2154,18 +2154,15 @@ void PlayerbotFactory::InitAmmo()
return; return;
uint32 entry = sRandomItemMgr->GetAmmo(level, subClass); uint32 entry = sRandomItemMgr->GetAmmo(level, subClass);
uint32 count = bot->GetItemCount(entry) / 200; uint32 count = bot->GetItemCount(entry);
uint32 maxCount = 5 + level / 10; uint32 maxCount = 10000;
if (count < maxCount) if (count < maxCount / 2)
{ {
for (uint32 i = 0; i < maxCount - count; i++) if (Item* newItem = StoreNewItemInInventorySlot(bot, entry, maxCount / 2)) {
{ newItem->AddToUpdateQueueOf(bot);
if (Item* newItem = StoreNewItemInInventorySlot(bot, entry, 200))
newItem->AddToUpdateQueueOf(bot);
} }
} }
bot->SetAmmo(entry); bot->SetAmmo(entry);
} }