mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10338] Create Map version for GetPlayer/GetUnit fucntions
* This let make map local way access for cases when player/all units expected to be at same map (for scripts cases for example). Ofc, still exist many places where code expect world wide player search. Spell casting for support far target cases, groups/guilds/chat/etc packets * Function Unit::GetUnit depricated and will removed soon. * Function GetCreatureOrPetOrVehicle renamed to less horriable GetAnyTypeCreature name.
This commit is contained in:
parent
0aa9e5a133
commit
45cdc67f58
16 changed files with 22391 additions and 22313 deletions
|
|
@ -78,7 +78,7 @@ void AggressorAI::EnterEvadeMode()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid );
|
Unit* victim = m_creature->GetMap()->GetUnit(i_victimGuid);
|
||||||
|
|
||||||
if (!victim)
|
if (!victim)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1993,7 +1993,8 @@ Unit* ChatHandler::getSelectedUnit()
|
||||||
if (guid == 0)
|
if (guid == 0)
|
||||||
return m_session->GetPlayer();
|
return m_session->GetPlayer();
|
||||||
|
|
||||||
return ObjectAccessor::GetUnit(*m_session->GetPlayer(),guid);
|
// can be selected player at another map
|
||||||
|
return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* ChatHandler::getSelectedCreature()
|
Creature* ChatHandler::getSelectedCreature()
|
||||||
|
|
@ -2001,7 +2002,7 @@ Creature* ChatHandler::getSelectedCreature()
|
||||||
if(!m_session)
|
if(!m_session)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return m_session->GetPlayer()->GetMap()->GetCreatureOrPetOrVehicle(m_session->GetPlayer()->GetSelection());
|
return m_session->GetPlayer()->GetMap()->GetAnyTypeCreature(m_session->GetPlayer()->GetSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,17 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str());
|
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str());
|
||||||
|
|
||||||
Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid);
|
if(!guid.IsUnit())
|
||||||
|
{
|
||||||
|
sLog.outError("WORLD: %s isn't unit", guid.GetString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Unit *pEnemy = _player->GetMap()->GetUnit(guid);
|
||||||
|
|
||||||
if(!pEnemy)
|
if(!pEnemy)
|
||||||
{
|
{
|
||||||
if(!guid.IsUnit())
|
sLog.outError( "WORLD: Enemy %s not found", guid.GetString().c_str());
|
||||||
sLog.outError("WORLD: %s isn't player, pet or creature", guid.GetString().c_str());
|
|
||||||
else
|
|
||||||
sLog.outError( "WORLD: Enemy %s not found", guid.GetString().c_str());
|
|
||||||
|
|
||||||
// stop attack state at client
|
// stop attack state at client
|
||||||
SendAttackStop(NULL);
|
SendAttackStop(NULL);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ void GuardAI::EnterEvadeMode()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid );
|
Unit* victim = m_creature->GetMap()->GetUnit(i_victimGuid);
|
||||||
|
|
||||||
if (!victim)
|
if (!victim)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2882,32 +2882,69 @@ void Map::ScriptsProcess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return player that in world at CURRENT map
|
||||||
|
*
|
||||||
|
* Note: This is function preferred if you sure that need player only placed at specific map
|
||||||
|
* This is not true for some spell cast targeting and most packet handlers
|
||||||
|
*
|
||||||
|
* @param guid must be player guid (HIGHGUID_PLAYER)
|
||||||
|
*/
|
||||||
|
Player* Map::GetPlayer(ObjectGuid guid)
|
||||||
|
{
|
||||||
|
Player* plr = ObjectAccessor::FindPlayer(guid); // return only in world players
|
||||||
|
return plr && plr->GetMap() == this ? plr : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return creature (non-pet and then most summoned by spell creatures, and not vehicle) that in world at CURRENT map
|
||||||
|
*
|
||||||
|
* @param guid must be creature guid (HIGHGUID_UNIT)
|
||||||
|
*/
|
||||||
Creature* Map::GetCreature(ObjectGuid guid)
|
Creature* Map::GetCreature(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
return m_objectsStore.find<Creature>(guid.GetRawValue(), (Creature*)NULL);
|
return m_objectsStore.find<Creature>(guid.GetRawValue(), (Creature*)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return vehicle that in world at CURRENT map
|
||||||
|
*
|
||||||
|
* @param guid must be vehicle guid (HIGHGUID_VEHICLE)
|
||||||
|
*/
|
||||||
Vehicle* Map::GetVehicle(ObjectGuid guid)
|
Vehicle* Map::GetVehicle(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
return m_objectsStore.find<Vehicle>(guid.GetRawValue(), (Vehicle*)NULL);
|
return m_objectsStore.find<Vehicle>(guid.GetRawValue(), (Vehicle*)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return pet that in world at CURRENT map
|
||||||
|
*
|
||||||
|
* @param guid must be pet guid (HIGHGUID_PET)
|
||||||
|
*/
|
||||||
Pet* Map::GetPet(ObjectGuid guid)
|
Pet* Map::GetPet(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
return m_objectsStore.find<Pet>(guid.GetRawValue(), (Pet*)NULL);
|
return m_objectsStore.find<Pet>(guid.GetRawValue(), (Pet*)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return corpse that at CURRENT map
|
||||||
|
*
|
||||||
|
* Note: corpse can be NOT IN WORLD, so can't be used corspe->GetMap() without pre-check corpse->isInWorld()
|
||||||
|
*
|
||||||
|
* @param guid must be corpse guid (HIGHGUID_CORPSE)
|
||||||
|
*/
|
||||||
Corpse* Map::GetCorpse(ObjectGuid guid)
|
Corpse* Map::GetCorpse(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
Corpse * ret = ObjectAccessor::GetCorpseInMap(guid,GetId());
|
Corpse * ret = ObjectAccessor::GetCorpseInMap(guid,GetId());
|
||||||
if (!ret)
|
return ret && ret->GetInstanceId() == GetInstanceId() ? ret : NULL;
|
||||||
return NULL;
|
|
||||||
if (ret->GetInstanceId() != GetInstanceId())
|
|
||||||
return NULL;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* Map::GetCreatureOrPetOrVehicle(ObjectGuid guid)
|
/**
|
||||||
|
* Function return non-player unit object that in world at CURRENT map, so creature, or pet, or vehicle
|
||||||
|
*
|
||||||
|
* @param guid must be non-player unit guid (HIGHGUID_PET HIGHGUID_UNIT HIGHGUID_VEHICLE)
|
||||||
|
*/
|
||||||
|
Creature* Map::GetAnyTypeCreature(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
switch(guid.GetHigh())
|
switch(guid.GetHigh())
|
||||||
{
|
{
|
||||||
|
|
@ -2920,27 +2957,61 @@ Creature* Map::GetCreatureOrPetOrVehicle(ObjectGuid guid)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return gameobject that in world at CURRENT map
|
||||||
|
*
|
||||||
|
* @param guid must be gameobject guid (HIGHGUID_GAMEOBJECT)
|
||||||
|
*/
|
||||||
GameObject* Map::GetGameObject(ObjectGuid guid)
|
GameObject* Map::GetGameObject(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
return m_objectsStore.find<GameObject>(guid.GetRawValue(), (GameObject*)NULL);
|
return m_objectsStore.find<GameObject>(guid.GetRawValue(), (GameObject*)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return dynamic object that in world at CURRENT map
|
||||||
|
*
|
||||||
|
* @param guid must be dynamic object guid (HIGHGUID_DYNAMICOBJECT)
|
||||||
|
*/
|
||||||
DynamicObject* Map::GetDynamicObject(ObjectGuid guid)
|
DynamicObject* Map::GetDynamicObject(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
return m_objectsStore.find<DynamicObject>(guid.GetRawValue(), (DynamicObject*)NULL);
|
return m_objectsStore.find<DynamicObject>(guid.GetRawValue(), (DynamicObject*)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return unit in world at CURRENT map
|
||||||
|
*
|
||||||
|
* Note: in case player guid not always expected need player at current map only.
|
||||||
|
* For example in spell casting can be expected any in world player targeting in some cases
|
||||||
|
*
|
||||||
|
* @param guid must be unit guid (HIGHGUID_PLAYER HIGHGUID_PET HIGHGUID_UNIT HIGHGUID_VEHICLE)
|
||||||
|
*/
|
||||||
|
Unit* Map::GetUnit(ObjectGuid guid)
|
||||||
|
{
|
||||||
|
if (guid.IsPlayer())
|
||||||
|
return GetPlayer(guid);
|
||||||
|
|
||||||
|
return GetAnyTypeCreature(guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function return world object in world at CURRENT map, so any except transports
|
||||||
|
*/
|
||||||
WorldObject* Map::GetWorldObject(ObjectGuid guid)
|
WorldObject* Map::GetWorldObject(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
switch(guid.GetHigh())
|
switch(guid.GetHigh())
|
||||||
{
|
{
|
||||||
case HIGHGUID_PLAYER: return ObjectAccessor::FindPlayer(guid);
|
case HIGHGUID_PLAYER: return GetPlayer(guid);
|
||||||
case HIGHGUID_GAMEOBJECT: return GetGameObject(guid);
|
case HIGHGUID_GAMEOBJECT: return GetGameObject(guid);
|
||||||
case HIGHGUID_UNIT: return GetCreature(guid);
|
case HIGHGUID_UNIT: return GetCreature(guid);
|
||||||
case HIGHGUID_PET: return GetPet(guid);
|
case HIGHGUID_PET: return GetPet(guid);
|
||||||
case HIGHGUID_VEHICLE: return GetVehicle(guid);
|
case HIGHGUID_VEHICLE: return GetVehicle(guid);
|
||||||
case HIGHGUID_DYNAMICOBJECT:return GetDynamicObject(guid);
|
case HIGHGUID_DYNAMICOBJECT:return GetDynamicObject(guid);
|
||||||
case HIGHGUID_CORPSE: return GetCorpse(guid);
|
case HIGHGUID_CORPSE:
|
||||||
|
{
|
||||||
|
// corpse special case, it can be not in world
|
||||||
|
Corpse* corpse = GetCorpse(guid);
|
||||||
|
return corpse && corpse->IsInWorld() ? corpse : NULL;
|
||||||
|
}
|
||||||
case HIGHGUID_MO_TRANSPORT:
|
case HIGHGUID_MO_TRANSPORT:
|
||||||
case HIGHGUID_TRANSPORT:
|
case HIGHGUID_TRANSPORT:
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
||||||
|
|
@ -240,14 +240,16 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
||||||
// must called with RemoveFromWorld
|
// must called with RemoveFromWorld
|
||||||
void RemoveFromActive(WorldObject* obj);
|
void RemoveFromActive(WorldObject* obj);
|
||||||
|
|
||||||
|
Player* GetPlayer(ObjectGuid guid);
|
||||||
Creature* GetCreature(ObjectGuid guid);
|
Creature* GetCreature(ObjectGuid guid);
|
||||||
Vehicle* GetVehicle(ObjectGuid guid);
|
Vehicle* GetVehicle(ObjectGuid guid);
|
||||||
Pet* GetPet(ObjectGuid guid);
|
Pet* GetPet(ObjectGuid guid);
|
||||||
Creature* GetCreatureOrPetOrVehicle(ObjectGuid guid);
|
Creature* GetAnyTypeCreature(ObjectGuid guid); // normal creature or pet or vehicle
|
||||||
GameObject* GetGameObject(ObjectGuid guid);
|
GameObject* GetGameObject(ObjectGuid guid);
|
||||||
DynamicObject* GetDynamicObject(ObjectGuid guid);
|
DynamicObject* GetDynamicObject(ObjectGuid guid);
|
||||||
Corpse* GetCorpse(ObjectGuid guid);
|
Corpse* GetCorpse(ObjectGuid guid); // !!! find corpse can be not in world
|
||||||
WorldObject* GetWorldObject(ObjectGuid guid);
|
Unit* GetUnit(ObjectGuid guid); // only use if sure that need objects at current map, specially for player case
|
||||||
|
WorldObject* GetWorldObject(ObjectGuid guid); // only use if sure that need objects at current map, specially for player case
|
||||||
|
|
||||||
TypeUnorderedMapContainer<AllMapStoredObjectTypes>& GetObjectsStore() { return m_objectsStore; }
|
TypeUnorderedMapContainer<AllMapStoredObjectTypes>& GetObjectsStore() { return m_objectsStore; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
|
||||||
if (!u.IsInWorld())
|
if (!u.IsInWorld())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return u.GetMap()->GetCreatureOrPetOrVehicle(guid);
|
return u.GetMap()->GetAnyTypeCreature(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,12 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
||||||
static Creature* GetCreatureInWorld(ObjectGuid guid) { return FindHelper<Creature>(guid); }
|
static Creature* GetCreatureInWorld(ObjectGuid guid) { return FindHelper<Creature>(guid); }
|
||||||
static GameObject* GetGameObjectInWorld(ObjectGuid guid) { return FindHelper<GameObject>(guid); }
|
static GameObject* GetGameObjectInWorld(ObjectGuid guid) { return FindHelper<GameObject>(guid); }
|
||||||
|
|
||||||
// possible local search for specific object map
|
// Search player at any map in world and other objects at same map with `obj`
|
||||||
static Unit* GetUnit(WorldObject const &, ObjectGuid guid);
|
// Note: recommended use Map::GetUnit version if player also expected at same map only
|
||||||
|
static Unit* GetUnit(WorldObject const& obj, ObjectGuid guid);
|
||||||
|
|
||||||
// Player access
|
// Player access
|
||||||
static Player* FindPlayer(ObjectGuid guid);
|
static Player* FindPlayer(ObjectGuid guid); // if need player at specific map better use Map::GetPlayer
|
||||||
static Player* FindPlayerByName(const char *name);
|
static Player* FindPlayerByName(const char *name);
|
||||||
static void KickPlayer(uint64 guid);
|
static void KickPlayer(uint64 guid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
||||||
uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
|
uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
|
||||||
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
|
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
|
||||||
|
|
||||||
// used also for charmed creature
|
// used also for charmed creature/player
|
||||||
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
|
Unit* pet = _player->GetMap()->GetUnit(guid1);
|
||||||
DETAIL_LOG("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) );
|
DETAIL_LOG("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) );
|
||||||
if (!pet)
|
if (!pet)
|
||||||
{
|
{
|
||||||
|
|
@ -98,7 +98,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
||||||
case COMMAND_ATTACK: //spellid=1792 //ATTACK
|
case COMMAND_ATTACK: //spellid=1792 //ATTACK
|
||||||
{
|
{
|
||||||
const uint64& selguid = _player->GetSelection();
|
const uint64& selguid = _player->GetSelection();
|
||||||
Unit *TargetUnit = ObjectAccessor::GetUnit(*_player, selguid);
|
Unit *TargetUnit = _player->GetMap()->GetUnit(selguid);
|
||||||
if(!TargetUnit)
|
if(!TargetUnit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(guid2)
|
if(guid2)
|
||||||
unit_target = ObjectAccessor::GetUnit(*_player,guid2);
|
unit_target = _player->GetMap()->GetUnit(guid2);
|
||||||
|
|
||||||
// do not cast unknown spells
|
// do not cast unknown spells
|
||||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );
|
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );
|
||||||
|
|
@ -286,7 +286,7 @@ void WorldSession::HandlePetNameQuery( WorldPacket & recv_data )
|
||||||
|
|
||||||
void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
|
void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
|
||||||
{
|
{
|
||||||
Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(petguid);
|
Creature* pet = _player->GetMap()->GetAnyTypeCreature(petguid);
|
||||||
if(!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
|
if(!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -318,7 +318,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
||||||
|
|
||||||
recv_data >> petguid;
|
recv_data >> petguid;
|
||||||
|
|
||||||
Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(petguid);
|
Creature* pet = _player->GetMap()->GetAnyTypeCreature(petguid);
|
||||||
|
|
||||||
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
|
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
|
||||||
{
|
{
|
||||||
|
|
@ -506,7 +506,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// pet/charmed
|
// pet/charmed
|
||||||
if (Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(guid))
|
if (Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid))
|
||||||
{
|
{
|
||||||
if(pet->isPet())
|
if(pet->isPet())
|
||||||
{
|
{
|
||||||
|
|
@ -563,7 +563,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
|
||||||
if(!_player->GetPet() && !_player->GetCharm())
|
if(!_player->GetPet() && !_player->GetCharm())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(guid);
|
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
|
||||||
|
|
||||||
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
|
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
|
||||||
{
|
{
|
||||||
|
|
@ -607,7 +607,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||||
if (!_player->GetPet() && !_player->GetCharm())
|
if (!_player->GetPet() && !_player->GetCharm())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(guid);
|
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
|
||||||
|
|
||||||
if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
|
if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2240,7 +2240,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// exist (we need look pets also for some interaction (quest/etc)
|
// exist (we need look pets also for some interaction (quest/etc)
|
||||||
Creature *unit = GetMap()->GetCreatureOrPetOrVehicle(guid);
|
Creature *unit = GetMap()->GetAnyTypeCreature(guid);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -13066,7 +13066,7 @@ void Player::PrepareQuestMenu( uint64 guid )
|
||||||
QuestRelations* pObjectQIR;
|
QuestRelations* pObjectQIR;
|
||||||
|
|
||||||
// pets also can have quests
|
// pets also can have quests
|
||||||
if (Creature *pCreature = GetMap()->GetCreatureOrPetOrVehicle(guid))
|
if (Creature *pCreature = GetMap()->GetAnyTypeCreature(guid))
|
||||||
{
|
{
|
||||||
pObject = (Object*)pCreature;
|
pObject = (Object*)pCreature;
|
||||||
pObjectQR = &sObjectMgr.mCreatureQuestRelations;
|
pObjectQR = &sObjectMgr.mCreatureQuestRelations;
|
||||||
|
|
@ -13160,7 +13160,7 @@ void Player::SendPreparedQuest(uint64 guid)
|
||||||
std::string title = "";
|
std::string title = "";
|
||||||
|
|
||||||
// need pet case for some quests
|
// need pet case for some quests
|
||||||
if (Creature *pCreature = GetMap()->GetCreatureOrPetOrVehicle(guid))
|
if (Creature *pCreature = GetMap()->GetAnyTypeCreature(guid))
|
||||||
{
|
{
|
||||||
uint32 textid = GetGossipTextId(pCreature);
|
uint32 textid = GetGossipTextId(pCreature);
|
||||||
|
|
||||||
|
|
@ -13233,7 +13233,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
|
||||||
QuestRelations* pObjectQR;
|
QuestRelations* pObjectQR;
|
||||||
QuestRelations* pObjectQIR;
|
QuestRelations* pObjectQIR;
|
||||||
|
|
||||||
if (Creature *pCreature = GetMap()->GetCreatureOrPetOrVehicle(guid))
|
if (Creature *pCreature = GetMap()->GetAnyTypeCreature(guid))
|
||||||
{
|
{
|
||||||
pObject = (Object*)pCreature;
|
pObject = (Object*)pCreature;
|
||||||
pObjectQR = &sObjectMgr.mCreatureQuestRelations;
|
pObjectQR = &sObjectMgr.mCreatureQuestRelations;
|
||||||
|
|
@ -20035,7 +20035,7 @@ void Player::UpdateForQuestWorldObjects()
|
||||||
}
|
}
|
||||||
else if (itr->IsCreatureOrVehicle())
|
else if (itr->IsCreatureOrVehicle())
|
||||||
{
|
{
|
||||||
Creature *obj = GetMap()->GetCreatureOrPetOrVehicle(*itr);
|
Creature *obj = GetMap()->GetAnyTypeCreature(*itr);
|
||||||
if(!obj)
|
if(!obj)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -659,7 +659,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
||||||
if (itr->IsCreatureOrPet())
|
if (itr->IsCreatureOrPet())
|
||||||
{
|
{
|
||||||
// need also pet quests case support
|
// need also pet quests case support
|
||||||
Creature *questgiver = GetPlayer()->GetMap()->GetCreatureOrPetOrVehicle(*itr);
|
Creature *questgiver = GetPlayer()->GetMap()->GetAnyTypeCreature(*itr);
|
||||||
|
|
||||||
if (!questgiver || questgiver->IsHostileTo(_player))
|
if (!questgiver || questgiver->IsHostileTo(_player))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ ReactorAI::EnterEvadeMode()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid );
|
Unit* victim = m_creature->GetMap()->GetUnit(i_victimGuid);
|
||||||
|
|
||||||
if (!victim)
|
if (!victim)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2794,7 +2794,7 @@ void Spell::EffectJump(SpellEffectIndex eff_idx)
|
||||||
else if(unitTarget->getVictim())
|
else if(unitTarget->getVictim())
|
||||||
pTarget = m_caster->getVictim();
|
pTarget = m_caster->getVictim();
|
||||||
else if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
else if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());
|
pTarget = m_caster->GetMap()->GetUnit(((Player*)m_caster)->GetSelection());
|
||||||
|
|
||||||
o = pTarget ? pTarget->GetOrientation() : m_caster->GetOrientation();
|
o = pTarget ? pTarget->GetOrientation() : m_caster->GetOrientation();
|
||||||
}
|
}
|
||||||
|
|
@ -2863,7 +2863,7 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx)
|
||||||
else if(unitTarget->getVictim())
|
else if(unitTarget->getVictim())
|
||||||
pTarget = unitTarget->getVictim();
|
pTarget = unitTarget->getVictim();
|
||||||
else if(unitTarget->GetTypeId() == TYPEID_PLAYER)
|
else if(unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||||
pTarget = ObjectAccessor::GetUnit(*unitTarget, ((Player*)unitTarget)->GetSelection());
|
pTarget = unitTarget->GetMap()->GetUnit(((Player*)unitTarget)->GetSelection());
|
||||||
|
|
||||||
// Init dest coordinates
|
// Init dest coordinates
|
||||||
float x = m_targets.m_destX;
|
float x = m_targets.m_destX;
|
||||||
|
|
|
||||||
|
|
@ -486,7 +486,7 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* pet = GetPlayer()->GetMap()->GetCreatureOrPetOrVehicle(guid);
|
Creature* pet = GetPlayer()->GetMap()->GetAnyTypeCreature(guid);
|
||||||
|
|
||||||
if(!pet)
|
if(!pet)
|
||||||
{
|
{
|
||||||
|
|
@ -574,7 +574,7 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
|
||||||
if (_player->isInCombat()) // client prevent click and set different icon at combat state
|
if (_player->isInCombat()) // client prevent click and set different icon at combat state
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature *unit = _player->GetMap()->GetCreatureOrPetOrVehicle(guid);
|
Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid);
|
||||||
if (!unit || unit->isInCombat()) // client prevent click and set different icon at combat state
|
if (!unit || unit->isInCombat()) // client prevent click and set different icon at combat state
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
|
||||||
// SPELLMOD_RANGE not applied in this place just because nonexistent range mods for attacking totems
|
// SPELLMOD_RANGE not applied in this place just because nonexistent range mods for attacking totems
|
||||||
|
|
||||||
// pointer to appropriate target if found any
|
// pointer to appropriate target if found any
|
||||||
Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*m_creature, i_victimGuid) : NULL;
|
Unit* victim = i_victimGuid ? m_creature->GetMap()->GetUnit(i_victimGuid) : NULL;
|
||||||
|
|
||||||
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
|
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
|
||||||
if( !victim ||
|
if( !victim ||
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10337"
|
#define REVISION_NR "10338"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue