mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[10902] Simplify code for triggering linked trap
This commit is contained in:
parent
2f4e7a9377
commit
d9579dd44a
3 changed files with 21 additions and 26 deletions
|
|
@ -812,7 +812,6 @@ void GameObject::SummonLinkedTrapIfAny()
|
|||
GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
|
||||
{
|
||||
delete linkedGO;
|
||||
linkedGO = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -828,8 +827,13 @@ void GameObject::SummonLinkedTrapIfAny()
|
|||
GetMap()->Add(linkedGO);
|
||||
}
|
||||
|
||||
void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
|
||||
void GameObject::TriggerLinkedGameObject(Unit* target)
|
||||
{
|
||||
uint32 trapEntry = GetGOInfo()->GetLinkedGameObjectEntry();
|
||||
|
||||
if (!trapEntry)
|
||||
return;
|
||||
|
||||
GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(trapEntry);
|
||||
if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
|
||||
return;
|
||||
|
|
@ -937,10 +941,7 @@ void GameObject::Use(Unit* user)
|
|||
// activate script
|
||||
GetMap()->ScriptsStart(sGameObjectScripts, GetDBTableGUIDLow(), spellCaster, this);
|
||||
|
||||
// triggering linked GO
|
||||
if (uint32 trapEntry = GetGOInfo()->button.linkedTrapId)
|
||||
TriggeringLinkedGameObject(trapEntry, user);
|
||||
|
||||
TriggerLinkedGameObject(user);
|
||||
return;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: // 2
|
||||
|
|
@ -958,7 +959,7 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
return;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_CHEST:
|
||||
case GAMEOBJECT_TYPE_CHEST: // 3
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
|
@ -972,10 +973,7 @@ void GameObject::Use(Unit* user)
|
|||
GetMap()->ScriptsStart(sEventScripts, GetGOInfo()->chest.eventId, user, this);
|
||||
}
|
||||
|
||||
// triggering linked GO
|
||||
if (uint32 trapEntry = GetGOInfo()->chest.linkedTrapId)
|
||||
TriggeringLinkedGameObject(trapEntry, user);
|
||||
|
||||
TriggerLinkedGameObject(user);
|
||||
return;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_GENERIC: // 5
|
||||
|
|
@ -987,7 +985,7 @@ void GameObject::Use(Unit* user)
|
|||
case GAMEOBJECT_TYPE_TRAP: // 6
|
||||
{
|
||||
// Currently we do not expect trap code below to be Use()
|
||||
// directly (except from spell effect). Code here will be called by TriggeringLinkedGameObject.
|
||||
// directly (except from spell effect). Code here will be called by TriggerLinkedGameObject.
|
||||
|
||||
// FIXME: when GO casting will be implemented trap must cast spell to target
|
||||
if (uint32 spellId = GetGOInfo()->trap.spellId)
|
||||
|
|
@ -1058,11 +1056,9 @@ void GameObject::Use(Unit* user)
|
|||
player->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR+info->chair.height);
|
||||
return;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_SPELL_FOCUS:
|
||||
case GAMEOBJECT_TYPE_SPELL_FOCUS: // 8
|
||||
{
|
||||
// triggering linked GO
|
||||
if (uint32 trapEntry = GetGOInfo()->spellFocus.linkedTrapId)
|
||||
TriggeringLinkedGameObject(trapEntry, user);
|
||||
TriggerLinkedGameObject(user);
|
||||
|
||||
// some may be activated in addition? Conditions for this? (ex: entry 181616)
|
||||
break;
|
||||
|
|
@ -1110,8 +1106,7 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
}
|
||||
|
||||
if (uint32 trapEntry = info->goober.linkedTrapId)
|
||||
TriggeringLinkedGameObject(trapEntry, user);
|
||||
TriggerLinkedGameObject(user);
|
||||
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
SetLootState(GO_ACTIVATED);
|
||||
|
|
@ -1497,7 +1492,7 @@ void GameObject::Use(Unit* user)
|
|||
return;
|
||||
}
|
||||
|
||||
Spell *spell = new Spell(spellCaster, spellInfo, triggered,GetGUID());
|
||||
Spell *spell = new Spell(spellCaster, spellInfo, triggered, GetObjectGuid());
|
||||
|
||||
// spell target is user of GO
|
||||
SpellCastTargets targets;
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
bool IsFriendlyTo(Unit const* unit) const;
|
||||
|
||||
void SummonLinkedTrapIfAny();
|
||||
void TriggeringLinkedGameObject( uint32 trapEntry, Unit* target);
|
||||
void TriggerLinkedGameObject(Unit* target);
|
||||
|
||||
bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10901"
|
||||
#define REVISION_NR "10902"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue