[9205] Move script call GOHello to GameObject::Use

This provide more accurate call in case of delay use from spell effects

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-01-17 23:43:39 +01:00
parent 16c0ff3ef7
commit 544d396beb
4 changed files with 9 additions and 12 deletions

View file

@ -36,6 +36,7 @@
#include "BattleGround.h" #include "BattleGround.h"
#include "BattleGroundAV.h" #include "BattleGroundAV.h"
#include "Util.h" #include "Util.h"
#include "ScriptCalls.h"
GameObject::GameObject() : WorldObject() GameObject::GameObject() : WorldObject()
{ {
@ -869,6 +870,9 @@ void GameObject::Use(Unit* user)
uint32 spellId = 0; uint32 spellId = 0;
bool triggered = false; bool triggered = false;
if (user->GetTypeId() == TYPEID_PLAYER && Script->GOHello((Player*)user, this))
return;
switch(GetGoType()) switch(GetGoType())
{ {
case GAMEOBJECT_TYPE_DOOR: //0 case GAMEOBJECT_TYPE_DOOR: //0

View file

@ -3092,15 +3092,8 @@ void Spell::EffectEnergisePct(uint32 i)
void Spell::SendLoot(uint64 guid, LootType loottype) void Spell::SendLoot(uint64 guid, LootType loottype)
{ {
Player* player = (Player*)m_caster;
if (!player)
return;
if (gameObjTarget) if (gameObjTarget)
{ {
if (Script->GOHello(player, gameObjTarget))
return;
switch (gameObjTarget->GetGoType()) switch (gameObjTarget->GetGoType())
{ {
case GAMEOBJECT_TYPE_DOOR: case GAMEOBJECT_TYPE_DOOR:
@ -3122,8 +3115,11 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
} }
} }
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
// Send loot // Send loot
player->SendLoot(guid, loottype); ((Player*)m_caster)->SendLoot(guid, loottype);
} }
void Spell::EffectOpenLock(uint32 effIndex) void Spell::EffectOpenLock(uint32 effIndex)

View file

@ -251,9 +251,6 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
if(!obj) if(!obj)
return; return;
if (Script->GOHello(_player, obj))
return;
obj->Use(_player); obj->Use(_player);
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9204" #define REVISION_NR "9205"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__