mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 20:02:25 +01:00
Core/GameObjects: Handle despawning and respawning of nearby linked t…
…raps on gameobject despawn and respawn
This commit is contained in:
@@ -454,6 +454,10 @@ void GameObject::Update(uint32 diff)
|
||||
m_SkillupList.clear();
|
||||
m_usetimes = 0;
|
||||
|
||||
// If nearby linked trap exists, respawn it
|
||||
if (GameObject* linkedTrap = GetLinkedTrap())
|
||||
linkedTrap->SetLootState(GO_READY);
|
||||
|
||||
switch (GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_FISHINGNODE: // can't fish now
|
||||
@@ -637,6 +641,10 @@ void GameObject::Update(uint32 diff)
|
||||
}
|
||||
case GO_JUST_DEACTIVATED:
|
||||
{
|
||||
// If nearby linked trap exists, despawn it
|
||||
if (GameObject* linkedTrap = GetLinkedTrap())
|
||||
linkedTrap->SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
||||
//if Gameobject should cast spell, then this, but some GOs (type = 10) should be destroyed
|
||||
if (GetGoType() == GAMEOBJECT_TYPE_GOOBER)
|
||||
{
|
||||
@@ -2287,6 +2295,11 @@ bool GameObject::IsLootAllowedFor(Player const* player) const
|
||||
return true;
|
||||
}
|
||||
|
||||
GameObject* GameObject::GetLinkedTrap()
|
||||
{
|
||||
return ObjectAccessor::GetGameObject(*this, m_linkedTrap);
|
||||
}
|
||||
|
||||
void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const
|
||||
{
|
||||
if (!target)
|
||||
|
||||
@@ -821,6 +821,9 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
uint32 m_groupLootTimer; // (msecs)timer used for group loot
|
||||
ObjectGuid::LowType lootingGroupLowGUID; // used to find group which is looting
|
||||
|
||||
GameObject* GetLinkedTrap();
|
||||
void SetLinkedTrap(GameObject* linkedTrap) { m_linkedTrap = linkedTrap->GetGUID(); }
|
||||
|
||||
bool hasQuest(uint32 quest_id) const override;
|
||||
bool hasInvolvedQuest(uint32 quest_id) const override;
|
||||
bool ActivateToQuest(Player* target) const;
|
||||
@@ -927,6 +930,9 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
ObjectGuid m_lootRecipient;
|
||||
uint32 m_lootRecipientGroup;
|
||||
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
|
||||
|
||||
ObjectGuid m_linkedTrap;
|
||||
|
||||
private:
|
||||
void RemoveFromOwner();
|
||||
void SwitchDoorOrButton(bool activate, bool alternative = false);
|
||||
|
||||
@@ -3236,7 +3236,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
||||
m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), G3D::Quat(), 255, GO_STATE_READY))
|
||||
{
|
||||
linkedGO->CopyPhaseFrom(m_caster);
|
||||
|
||||
pGameObj->SetLinkedTrap(linkedGO);
|
||||
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
|
||||
linkedGO->SetSpellId(m_spellInfo->Id);
|
||||
|
||||
@@ -4879,6 +4879,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
|
||||
{
|
||||
linkedGO->CopyPhaseFrom(m_caster);
|
||||
|
||||
pGameObj->SetLinkedTrap(linkedGO);
|
||||
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
|
||||
//linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
|
||||
linkedGO->SetSpellId(m_spellInfo->Id);
|
||||
|
||||
Reference in New Issue
Block a user