feat(gameobject): allow gameobjects to loot money + align table with TC (#1368)

This commit is contained in:
Francesco Borzì
2019-01-28 20:24:43 +01:00
committed by GitHub
parent 1905c36353
commit 38b368e909
8 changed files with 146 additions and 18 deletions

View File

@@ -287,8 +287,11 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
SetObjectScale(goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
{
SetUInt32Value(GAMEOBJECT_FACTION, addon->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
}
SetEntry(goinfo->entry);
@@ -688,8 +691,9 @@ void GameObject::Update(uint32 diff)
//any return here in case battleground traps
// Xinef: Do not return here for summoned gos that should be deleted few lines below
// Xinef: Battleground objects are treated as spawned by default
if ((GetGOInfo()->flags & GO_FLAG_NODESPAWN) && isSpawnedByDefault())
return;
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
if ((addon->flags & GO_FLAG_NODESPAWN) && isSpawnedByDefault())
return;
}
loot.clear();
@@ -710,7 +714,8 @@ void GameObject::Update(uint32 diff)
{
SendObjectDeSpawnAnim(GetGUID());
//reset flags
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
}
if (!m_respawnDelayTime)
@@ -736,6 +741,11 @@ void GameObject::Update(uint32 diff)
sScriptMgr->OnGameObjectUpdate(this, diff);
}
GameObjectTemplateAddon const* GameObject::GetTemplateAddon() const
{
return sObjectMgr->GetGameObjectTemplateAddon(GetGOInfo()->entry);
}
void GameObject::Refresh()
{
// not refresh despawned not casted GO (despawned casted GO destroyed in all cases anyway)
@@ -760,7 +770,9 @@ void GameObject::Delete()
SendObjectDeSpawnAnim(GetGUID());
SetGoState(GO_STATE_READY);
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
// Xinef: if ritual gameobject is removed, clear anim spells
if (GetGOInfo()->type == GAMEOBJECT_TYPE_SUMMONING_RITUAL)