[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:
VladimirMangos 2010-08-10 17:26:11 +04:00
parent 0aa9e5a133
commit 45cdc67f58
16 changed files with 22391 additions and 22313 deletions

View file

@ -41,8 +41,8 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
// used also for charmed creature
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
// used also for charmed creature/player
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)) );
if (!pet)
{
@ -98,7 +98,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
case COMMAND_ATTACK: //spellid=1792 //ATTACK
{
const uint64& selguid = _player->GetSelection();
Unit *TargetUnit = ObjectAccessor::GetUnit(*_player, selguid);
Unit *TargetUnit = _player->GetMap()->GetUnit(selguid);
if(!TargetUnit)
return;
@ -174,7 +174,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
return;
if(guid2)
unit_target = ObjectAccessor::GetUnit(*_player,guid2);
unit_target = _player->GetMap()->GetUnit(guid2);
// do not cast unknown spells
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );
@ -286,7 +286,7 @@ void WorldSession::HandlePetNameQuery( WorldPacket & recv_data )
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)
return;
@ -318,7 +318,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
recv_data >> petguid;
Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(petguid);
Creature* pet = _player->GetMap()->GetAnyTypeCreature(petguid);
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
{
@ -506,7 +506,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
return;
// pet/charmed
if (Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(guid))
if (Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid))
{
if(pet->isPet())
{
@ -563,7 +563,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
if(!_player->GetPet() && !_player->GetCharm())
return;
Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(guid);
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
{
@ -607,7 +607,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
if (!_player->GetPet() && !_player->GetCharm())
return;
Creature* pet = _player->GetMap()->GetCreatureOrPetOrVehicle(guid);
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
{