[7159] Allow GO cast as need (use go coordinates for target select in some cases)

Fixed work all Huter traps target selection
More check in ObjectAccessor::Get Object
More generic work 22 TARGET_CASTER_COORDINATES target type

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-01-24 03:44:37 +03:00
parent c2a0a18a38
commit abaa111eaa
10 changed files with 71 additions and 42 deletions

View file

@ -171,11 +171,16 @@ Corpse*
ObjectAccessor::GetCorpse(WorldObject const &u, uint64 guid)
{
Corpse * ret = GetObjectInWorld(guid, (Corpse*)NULL);
if(ret && ret->GetMapId() != u.GetMapId()) ret = NULL;
if(!ret)
return NULL;
if(ret->GetMapId() != u.GetMapId())
ret = NULL;
if(ret->GetInstanceId() != u.GetInstanceId())
return NULL;
return ret;
}
Object* ObjectAccessor::GetObjectByTypeMask(Player const &p, uint64 guid, uint32 typemask)
Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, uint32 typemask)
{
Object *obj = NULL;
@ -203,9 +208,9 @@ Object* ObjectAccessor::GetObjectByTypeMask(Player const &p, uint64 guid, uint32
if(obj) return obj;
}
if(typemask & TYPEMASK_ITEM)
if(typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER)
{
obj = p.GetItemByGuid( guid );
obj = ((Player const &)p).GetItemByGuid( guid );
if(obj) return obj;
}
@ -216,15 +221,25 @@ GameObject*
ObjectAccessor::GetGameObject(WorldObject const &u, uint64 guid)
{
GameObject * ret = GetObjectInWorld(guid, (GameObject*)NULL);
if(ret && ret->GetMapId() != u.GetMapId()) ret = NULL;
if(!ret)
return NULL;
if(ret->GetMapId() != u.GetMapId())
ret = NULL;
if(ret->GetInstanceId() != u.GetInstanceId())
return NULL;
return ret;
}
DynamicObject*
ObjectAccessor::GetDynamicObject(Unit const &u, uint64 guid)
ObjectAccessor::GetDynamicObject(WorldObject const &u, uint64 guid)
{
DynamicObject * ret = GetObjectInWorld(guid, (DynamicObject*)NULL);
if(ret && ret->GetMapId() != u.GetMapId()) ret = NULL;
if(!ret)
return NULL;
if(ret->GetMapId() != u.GetMapId())
ret = NULL;
if(ret->GetInstanceId() != u.GetInstanceId())
return NULL;
return ret;
}