From 6d56c5c5c36937b78e2d14af7ea2d4c9d055a3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Sat, 26 Mar 2022 10:12:41 -0600 Subject: [PATCH] Set correct owner for randombot items to prevent crash when applying enchants --- src/PlayerbotFactory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 4d1a8b83..5c73de9a 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -1061,6 +1061,7 @@ void PlayerbotFactory::InitEquipmentNew(bool incremental) newItem->AddToWorld(); newItem->AddToUpdateQueueOf(bot); bot->AutoUnequipOffhandIfNeed(); + newItem->SetOwnerGUID(bot->GetGUID()); EnchantItem(newItem); LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Equip: {}, slot: {}, Old item: {}", bot->GetGUID().ToString().c_str(), IsAlliance(bot->getRace()) ? "A" : "H", bot->getLevel(), bot->GetName(), newItemId, slot, itemInSlot); @@ -1086,6 +1087,7 @@ void PlayerbotFactory::InitEquipmentNew(bool incremental) if (newItem) { bot->AutoUnequipOffhandIfNeed(); + newItem->SetOwnerGUID(bot->GetGUID()); EnchantItem(newItem); found = true; LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Equip: {}, slot: {}",