Skip to content

Commit

Permalink
[9205] Move script call GOHello to GameObject::Use
Browse files Browse the repository at this point in the history
This provide more accurate call in case of delay use from spell effects

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed Jan 17, 2010
1 parent 002a370 commit fd675b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
4 changes: 4 additions & 0 deletions src/game/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "BattleGround.h"
#include "BattleGroundAV.h"
#include "Util.h"
#include "ScriptCalls.h"

GameObject::GameObject() : WorldObject()
{
Expand Down Expand Up @@ -869,6 +870,9 @@ void GameObject::Use(Unit* user)
uint32 spellId = 0;
bool triggered = false;

if (user->GetTypeId() == TYPEID_PLAYER && Script->GOHello((Player*)user, this))
return;

switch(GetGoType())
{
case GAMEOBJECT_TYPE_DOOR: //0
Expand Down
12 changes: 4 additions & 8 deletions src/game/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3092,15 +3092,8 @@ void Spell::EffectEnergisePct(uint32 i)

void Spell::SendLoot(uint64 guid, LootType loottype)
{
Player* player = (Player*)m_caster;
if (!player)
return;

if (gameObjTarget)
{
if (Script->GOHello(player, gameObjTarget))
return;

switch (gameObjTarget->GetGoType())
{
case GAMEOBJECT_TYPE_DOOR:
Expand All @@ -3122,8 +3115,11 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
}
}

if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;

// Send loot
player->SendLoot(guid, loottype);
((Player*)m_caster)->SendLoot(guid, loottype);
}

void Spell::EffectOpenLock(uint32 effIndex)
Expand Down
3 changes: 0 additions & 3 deletions src/game/SpellHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
if(!obj)
return;

if (Script->GOHello(_player, obj))
return;

obj->Use(_player);
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9204"
#define REVISION_NR "9205"
#endif // __REVISION_NR_H__

0 comments on commit fd675b5

Please sign in to comment.