mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[9317] Call linkedtrap summon in more cases.
* GAMEOBJECT_TYPE_BUTTON can have linked traps * Spell::EffectSummonObject also can summon objects with linked traps Thanks to patman128 for research second case. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
02c23b247e
commit
87a35b0489
5 changed files with 52 additions and 43 deletions
|
|
@ -770,6 +770,33 @@ bool GameObject::ActivateToQuest( Player *pTarget)const
|
|||
return false;
|
||||
}
|
||||
|
||||
void GameObject::SummonLinkedTrapIfAny()
|
||||
{
|
||||
uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry();
|
||||
if (!linkedEntry)
|
||||
return;
|
||||
|
||||
GameObject* linkedGO = new GameObject;
|
||||
if (!linkedGO->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, GetMap(),
|
||||
GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
delete linkedGO;
|
||||
linkedGO = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
linkedGO->SetRespawnTime(GetRespawnDelay());
|
||||
linkedGO->SetSpellId(GetSpellId());
|
||||
|
||||
if (GetOwnerGUID())
|
||||
{
|
||||
linkedGO->SetOwnerGUID(GetOwnerGUID());
|
||||
linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, GetUInt32Value(GAMEOBJECT_LEVEL));
|
||||
}
|
||||
|
||||
GetMap()->Add(linkedGO);
|
||||
}
|
||||
|
||||
void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
|
||||
{
|
||||
GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(trapEntry);
|
||||
|
|
@ -869,15 +896,28 @@ void GameObject::Use(Unit* user)
|
|||
switch(GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: //0
|
||||
case GAMEOBJECT_TYPE_BUTTON: //1
|
||||
{
|
||||
//doors/buttons never really despawn, only reset to default state/flags
|
||||
//doors never really despawn, only reset to default state/flags
|
||||
UseDoorOrButton();
|
||||
|
||||
// activate script
|
||||
GetMap()->ScriptsStart(sGameObjectScripts, GetDBTableGUIDLow(), spellCaster, this);
|
||||
return;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_BUTTON: //1
|
||||
{
|
||||
//buttons never really despawn, only reset to default state/flags
|
||||
UseDoorOrButton();
|
||||
|
||||
// activate script
|
||||
GetMap()->ScriptsStart(sGameObjectScripts, GetDBTableGUIDLow(), spellCaster, this);
|
||||
|
||||
// triggering linked GO
|
||||
if (uint32 trapEntry = GetGOInfo()->button.linkedTrapId)
|
||||
TriggeringLinkedGameObject(trapEntry, user);
|
||||
|
||||
return;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: //2
|
||||
{
|
||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ struct GameObjectInfo
|
|||
uint32 startOpen; //0
|
||||
uint32 lockId; //1 -> Lock.dbc
|
||||
uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILISECONDS (previous was 0x10000)
|
||||
uint32 linkedTrap; //3
|
||||
uint32 linkedTrapId; //3
|
||||
uint32 noDamageImmune; //4 isBattlegroundObject
|
||||
uint32 large; //5
|
||||
uint32 openTextID; //6 can be used to replace castBarCaption?
|
||||
|
|
@ -457,6 +457,7 @@ struct GameObjectInfo
|
|||
{
|
||||
switch(type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrapId;
|
||||
case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId;
|
||||
case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId;
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrapId;
|
||||
|
|
@ -677,6 +678,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
void ResetDoorOrButton();
|
||||
|
||||
|
||||
void SummonLinkedTrapIfAny();
|
||||
void TriggeringLinkedGameObject( uint32 trapEntry, Unit* target);
|
||||
|
||||
bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const;
|
||||
|
|
|
|||
|
|
@ -5959,6 +5959,8 @@ void ObjectMgr::LoadGameobjectInfo()
|
|||
{
|
||||
if (goInfo->button.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->button.lockId,1);
|
||||
if (goInfo->button.linkedTrapId) // linked trap
|
||||
CheckGOLinkedTrapId(goInfo,goInfo->button.linkedTrapId,3);
|
||||
CheckGONoDamageImmuneId(goInfo,goInfo->button.noDamageImmune,4);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4922,25 +4922,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
|
|||
}
|
||||
}
|
||||
|
||||
if(uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
|
||||
{
|
||||
GameObject* linkedGO = new GameObject;
|
||||
if(linkedGO->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
|
||||
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
|
||||
linkedGO->SetSpellId(m_spellInfo->Id);
|
||||
|
||||
// Wild object not have owner and check clickable by players
|
||||
map->Add(linkedGO);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete linkedGO;
|
||||
linkedGO = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
pGameObj->SummonLinkedTrapIfAny();
|
||||
}
|
||||
|
||||
void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
|
|
@ -6141,6 +6123,8 @@ void Spell::EffectSummonObject(uint32 i)
|
|||
map->Add(pGameObj);
|
||||
|
||||
m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID();
|
||||
|
||||
pGameObj->SummonLinkedTrapIfAny();
|
||||
}
|
||||
|
||||
void Spell::EffectResurrect(uint32 /*effIndex*/)
|
||||
|
|
@ -6763,26 +6747,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
|
|||
|
||||
cMap->Add(pGameObj);
|
||||
|
||||
if(uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
|
||||
{
|
||||
GameObject* linkedGO = new GameObject;
|
||||
if(linkedGO->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
|
||||
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
|
||||
linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
|
||||
linkedGO->SetSpellId(m_spellInfo->Id);
|
||||
linkedGO->SetOwnerGUID(m_caster->GetGUID());
|
||||
|
||||
linkedGO->GetMap()->Add(linkedGO);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete linkedGO;
|
||||
linkedGO = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
pGameObj->SummonLinkedTrapIfAny();
|
||||
}
|
||||
|
||||
void Spell::EffectProspecting(uint32 /*i*/)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9316"
|
||||
#define REVISION_NR "9317"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue