mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix initself crash
This commit is contained in:
@@ -5257,6 +5257,7 @@ bool PlayerbotAI::EqualLowercaseName(std::string s1, std::string s2)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A custom CanEquipItem (remove AutoUnequipOffhand in FindEquipSlot to prevent unequip on `item usage` calculation)
|
||||||
InventoryResult PlayerbotAI::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading) const
|
InventoryResult PlayerbotAI::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading) const
|
||||||
{
|
{
|
||||||
dest = 0;
|
dest = 0;
|
||||||
|
|||||||
@@ -2060,7 +2060,8 @@ bool PlayerbotFactory::CanEquipUnseenItem(uint8 slot, uint16& dest, uint32 item)
|
|||||||
|
|
||||||
if (Item* pItem = Item::CreateItem(item, 1, bot, false, 0, true))
|
if (Item* pItem = Item::CreateItem(item, 1, bot, false, 0, true))
|
||||||
{
|
{
|
||||||
InventoryResult result = botAI->CanEquipItem(slot, dest, pItem, true, true);
|
InventoryResult result = botAI ? botAI->CanEquipItem(slot, dest, pItem, true, true)
|
||||||
|
: bot->CanEquipItem(slot, dest, pItem, true, true);
|
||||||
pItem->RemoveFromUpdateQueueOf(bot);
|
pItem->RemoveFromUpdateQueueOf(bot);
|
||||||
delete pItem;
|
delete pItem;
|
||||||
return result == EQUIP_ERR_OK;
|
return result == EQUIP_ERR_OK;
|
||||||
@@ -2382,10 +2383,10 @@ void PlayerbotFactory::InitAvailableSpells()
|
|||||||
{
|
{
|
||||||
bot->learnSpell(tSpell->learnedSpell[0], false);
|
bot->learnSpell(tSpell->learnedSpell[0], false);
|
||||||
}
|
}
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
botAI->CastSpell(tSpell->spell, bot);
|
// botAI->CastSpell(tSpell->spell, bot);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
// LOG_INFO("playerbots", "C: {}, ok: {}", ++learnedCounter, oktest);
|
// LOG_INFO("playerbots", "C: {}, ok: {}", ++learnedCounter, oktest);
|
||||||
// if (++learnedCounter > 20)
|
// if (++learnedCounter > 20)
|
||||||
|
|||||||
Reference in New Issue
Block a user