mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +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:
@@ -94,7 +94,7 @@ void GameObject::CleanupsBeforeDelete()
|
||||
ownerType = "pet";
|
||||
|
||||
sLog.outError("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
|
||||
GetGUIDLow(), GetGOInfo()->id, m_spellId, GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType);
|
||||
GetGUIDLow(), GetGOInfo()->id, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -398,7 +398,7 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
if (GetAutoCloseTime() && (m_cooldownTime < time(NULL)))
|
||||
if (GetGOInfo()->GetAutoCloseTime() && (m_cooldownTime < time(NULL)))
|
||||
ResetDoorOrButton();
|
||||
break;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
}
|
||||
|
||||
//burning flags in some battlegrounds, if you find better condition, just add it
|
||||
if (GetGoAnimProgress() > 0)
|
||||
if (GetGOInfo()->IsDespawnAtAction() || GetGoAnimProgress() > 0)
|
||||
{
|
||||
SendObjectDeSpawnAnim(GetGUID());
|
||||
//reset flags
|
||||
@@ -622,7 +622,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
|
||||
if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, ArtKit) )
|
||||
return false;
|
||||
|
||||
if(!GetDespawnPossibility())
|
||||
if(!GetGOInfo()->GetDespawnPossibility() && !GetGOInfo()->IsDespawnAtAction())
|
||||
{
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
|
||||
m_spawnedByDefault = true;
|
||||
@@ -670,22 +670,6 @@ GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid)
|
||||
return object.GetMap()->GetGameObject(guid);
|
||||
}
|
||||
|
||||
uint32 GameObject::GetLootId(GameObjectInfo const* ginfo)
|
||||
{
|
||||
if (!ginfo)
|
||||
return 0;
|
||||
|
||||
switch(ginfo->type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
return ginfo->chest.lootId;
|
||||
case GAMEOBJECT_TYPE_FISHINGHOLE:
|
||||
return ginfo->fishinghole.lootId;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
/*** QUEST SYSTEM ***/
|
||||
/*********************************************************/
|
||||
@@ -801,7 +785,7 @@ bool GameObject::ActivateToQuest( Player *pTarget)const
|
||||
// scan GO chest with loot including quest items
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
{
|
||||
if(LootTemplates_Gameobject.HaveQuestLootForPlayer(GetLootId(), pTarget))
|
||||
if(LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->GetLootId(), pTarget))
|
||||
{
|
||||
//TODO: fix this hack
|
||||
//look for battlegroundAV for some objects which are only activated after mine gots captured by own team
|
||||
@@ -907,7 +891,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
|
||||
return;
|
||||
|
||||
if(!time_to_restore)
|
||||
time_to_restore = GetAutoCloseTime();
|
||||
time_to_restore = GetGOInfo()->GetAutoCloseTime();
|
||||
|
||||
SwitchDoorOrButton(true,alternative);
|
||||
SetLootState(GO_ACTIVATED);
|
||||
@@ -1382,6 +1366,7 @@ void GameObject::Use(Unit* user)
|
||||
}
|
||||
|
||||
Spell *spell = new Spell(spellCaster, spellInfo, triggered);
|
||||
//Spell *spell = new Spell(spellCaster, spellInfo, triggered,GetGUID());
|
||||
|
||||
// spell target is user of GO
|
||||
SpellCastTargets targets;
|
||||
|
||||
Reference in New Issue
Block a user