mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
[8183] Some gameobject despanw related fixes Author: VladimirMangos
* Implement use `consumable` field in gameobject template for gameobject required explcit despawn at use.
* Move gameobject template fields cech function from Gameobject to gameobject template class, and update callers.
* Cast spells at gameobject use with gameobject guid as original caster guid, as already used in some other cases. (skipped)
--HG--
branch : trunk
This commit is contained in:
@@ -1525,6 +1525,12 @@ void ObjectMgr::LoadGameobjects()
|
||||
data.rotation2 = fields[ 9].GetFloat();
|
||||
data.rotation3 = fields[10].GetFloat();
|
||||
data.spawntimesecs = fields[11].GetInt32();
|
||||
|
||||
if (data.spawntimesecs==0 && gInfo->IsDespawnAtAction())
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but gameobejct marked as despawnable at action.",guid,data.id);
|
||||
}
|
||||
|
||||
data.animprogress = fields[12].GetUInt32();
|
||||
data.ArtKit = 0;
|
||||
|
||||
@@ -6140,6 +6146,16 @@ inline void CheckGONoDamageImmuneId(GameObjectInfo const* goInfo,uint32 dataN,ui
|
||||
goInfo->id,goInfo->type,N,dataN);
|
||||
}
|
||||
|
||||
inline void CheckGOConsumable(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
|
||||
{
|
||||
// 0/1 correct values
|
||||
if (dataN <= 1)
|
||||
return;
|
||||
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.",
|
||||
goInfo->id,goInfo->type,N,dataN);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameobjectInfo()
|
||||
{
|
||||
SQLGameObjectLoader loader;
|
||||
@@ -6182,6 +6198,8 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||
if (goInfo->chest.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->chest.lockId,0);
|
||||
|
||||
CheckGOConsumable(goInfo,goInfo->chest.consumable,3);
|
||||
|
||||
if (goInfo->chest.linkedTrapId) // linked trap
|
||||
CheckGOLinkedTrapId(goInfo,goInfo->chest.linkedTrapId,7);
|
||||
break;
|
||||
@@ -6217,6 +6235,8 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||
if (goInfo->goober.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->goober.lockId,0);
|
||||
|
||||
CheckGOConsumable(goInfo,goInfo->goober.consumable,3);
|
||||
|
||||
if (goInfo->goober.pageId) // pageId
|
||||
{
|
||||
if (!sPageTextStore.LookupEntry<PageText>(goInfo->goober.pageId))
|
||||
@@ -7183,7 +7203,7 @@ void ObjectMgr::LoadGameObjectForQuests()
|
||||
// scan GO chest with loot including quest items
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
{
|
||||
uint32 loot_id = GameObject::GetLootId(goInfo);
|
||||
uint32 loot_id = goInfo->GetLootId();
|
||||
|
||||
// find quest loot for GO
|
||||
if(LootTemplates_Gameobject.HaveQuestLootFor(loot_id))
|
||||
|
||||
Reference in New Issue
Block a user