mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
Various Cleanups (game N-O)
This commit is contained in:
parent
8d0c106aa4
commit
94795f2bff
14 changed files with 1560 additions and 1519 deletions
|
|
@ -45,12 +45,12 @@ enum StableResultCode
|
|||
STABLE_ERR_EXOTIC = 0x0C, // "you are unable to control exotic creatures"
|
||||
};
|
||||
|
||||
void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleTabardVendorActivateOpcode - %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
|
|
@ -58,7 +58,7 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
SendTabardVendorActivate(guid);
|
||||
|
|
@ -66,12 +66,12 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::SendTabardVendorActivate(ObjectGuid guid)
|
||||
{
|
||||
WorldPacket data( MSG_TABARDVENDOR_ACTIVATE, 8 );
|
||||
WorldPacket data(MSG_TABARDVENDOR_ACTIVATE, 8);
|
||||
data << ObjectGuid(guid);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleBankerActivateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
SendShowBank(guid);
|
||||
|
|
@ -103,7 +103,7 @@ void WorldSession::SendShowMailBox(ObjectGuid guid)
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTrainerListOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleTrainerListOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
|
||||
|
|
@ -142,9 +142,9 @@ static void SendTrainerSpellHelper(WorldPacket& data, TrainerSpell const* tSpell
|
|||
|
||||
void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: SendTrainerList" );
|
||||
DEBUG_LOG("WORLD: SendTrainerList");
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER);
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG("WORLD: SendTrainerList - %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
|
|
@ -159,7 +159,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
|
|||
if (!unit->IsTrainerOf(_player,true))
|
||||
return;
|
||||
|
||||
CreatureInfo const *ci = unit->GetCreatureInfo();
|
||||
CreatureInfo const* ci = unit->GetCreatureInfo();
|
||||
if (!ci)
|
||||
return;
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
|
|||
uint32 maxcount = (cSpells ? cSpells->spellList.size() : 0) + (tSpells ? tSpells->spellList.size() : 0);
|
||||
uint32 trainer_type = cSpells && cSpells->trainerType ? cSpells->trainerType : (tSpells ? tSpells->trainerType : 0);
|
||||
|
||||
WorldPacket data( SMSG_TRAINER_LIST, 8+4+4+maxcount*38 + strTitle.size()+1);
|
||||
WorldPacket data(SMSG_TRAINER_LIST, 8+4+4+maxcount*38 + strTitle.size()+1);
|
||||
data << ObjectGuid(guid);
|
||||
data << uint32(trainer_type);
|
||||
|
||||
|
|
@ -190,12 +190,12 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
|
|||
|
||||
if (cSpells)
|
||||
{
|
||||
for(TrainerSpellMap::const_iterator itr = cSpells->spellList.begin(); itr != cSpells->spellList.end(); ++itr)
|
||||
for (TrainerSpellMap::const_iterator itr = cSpells->spellList.begin(); itr != cSpells->spellList.end(); ++itr)
|
||||
{
|
||||
TrainerSpell const* tSpell = &itr->second;
|
||||
|
||||
uint32 reqLevel = 0;
|
||||
if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell, &reqLevel))
|
||||
if (!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell, &reqLevel))
|
||||
continue;
|
||||
|
||||
reqLevel = tSpell->isProvidedReqLevel ? tSpell->reqLevel : std::max(reqLevel, tSpell->reqLevel);
|
||||
|
|
@ -210,12 +210,12 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
|
|||
|
||||
if (tSpells)
|
||||
{
|
||||
for(TrainerSpellMap::const_iterator itr = tSpells->spellList.begin(); itr != tSpells->spellList.end(); ++itr)
|
||||
for (TrainerSpellMap::const_iterator itr = tSpells->spellList.begin(); itr != tSpells->spellList.end(); ++itr)
|
||||
{
|
||||
TrainerSpell const* tSpell = &itr->second;
|
||||
|
||||
uint32 reqLevel = 0;
|
||||
if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell, &reqLevel))
|
||||
if (!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell, &reqLevel))
|
||||
continue;
|
||||
|
||||
reqLevel = tSpell->isProvidedReqLevel ? tSpell->reqLevel : std::max(reqLevel, tSpell->reqLevel);
|
||||
|
|
@ -234,7 +234,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
uint32 spellId = 0;
|
||||
|
|
@ -242,7 +242,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
|
|||
recv_data >> guid >> spellId;
|
||||
DEBUG_LOG("WORLD: Received CMSG_TRAINER_BUY_SPELL Trainer: %s, learn spell id is: %u", guid.GetString().c_str(), spellId);
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleTrainerBuySpellOpcode - %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
|
|
@ -276,7 +276,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
|
|||
|
||||
// can't be learn, cheat? Or double learn with lags...
|
||||
uint32 reqLevel = 0;
|
||||
if(!_player->IsSpellFitByClassAndRace(trainer_spell->learnedSpell, &reqLevel))
|
||||
if (!_player->IsSpellFitByClassAndRace(trainer_spell->learnedSpell, &reqLevel))
|
||||
return;
|
||||
|
||||
reqLevel = trainer_spell->isProvidedReqLevel ? trainer_spell->reqLevel : std::max(reqLevel, trainer_spell->reqLevel);
|
||||
|
|
@ -287,10 +287,10 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
|
|||
uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit)));
|
||||
|
||||
// check money requirement
|
||||
if(_player->GetMoney() < nSpellCost )
|
||||
if (_player->GetMoney() < nSpellCost)
|
||||
return;
|
||||
|
||||
_player->ModifyMoney( -int32(nSpellCost) );
|
||||
_player->ModifyMoney(-int32(nSpellCost));
|
||||
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); // visual effect on trainer
|
||||
data << ObjectGuid(guid);
|
||||
|
|
@ -303,7 +303,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
|
|||
SendPacket(&data);
|
||||
|
||||
// learn explicitly or cast explicitly
|
||||
if(trainer_spell->IsCastable())
|
||||
if (trainer_spell->IsCastable())
|
||||
_player->CastSpell(_player, trainer_spell->spell, true);
|
||||
else
|
||||
_player->learnSpell(spellId, false);
|
||||
|
|
@ -314,14 +314,14 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleGossipHelloOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_GOSSIP_HELLO");
|
||||
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!pCreature)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleGossipHelloOpcode - %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
|
|
@ -345,7 +345,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_GOSSIP_SELECT_OPTION");
|
||||
|
||||
|
|
@ -371,7 +371,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
|||
|
||||
if (guid.IsAnyTypeCreature())
|
||||
{
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
if (!pCreature)
|
||||
{
|
||||
|
|
@ -384,7 +384,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
else if (guid.IsGameObject())
|
||||
{
|
||||
GameObject *pGo = GetPlayer()->GetGameObjectIfCanInteractWith(guid);
|
||||
GameObject* pGo = GetPlayer()->GetGameObjectIfCanInteractWith(guid);
|
||||
|
||||
if (!pGo)
|
||||
{
|
||||
|
|
@ -397,7 +397,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
|
||||
|
||||
|
|
@ -405,10 +405,10 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
|
|||
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER);
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleSpiritHealerActivateOpcode - %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
DEBUG_LOG("WORLD: HandleSpiritHealerActivateOpcode - %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -426,9 +426,9 @@ void WorldSession::SendSpiritResurrect()
|
|||
_player->DurabilityLossAll(0.25f,true);
|
||||
|
||||
// get corpse nearest graveyard
|
||||
WorldSafeLocsEntry const *corpseGrave = NULL;
|
||||
Corpse *corpse = _player->GetCorpse();
|
||||
if(corpse)
|
||||
WorldSafeLocsEntry const* corpseGrave = NULL;
|
||||
Corpse* corpse = _player->GetCorpse();
|
||||
if (corpse)
|
||||
corpseGrave = sObjectMgr.GetClosestGraveYard(
|
||||
corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam());
|
||||
|
||||
|
|
@ -436,12 +436,12 @@ void WorldSession::SendSpiritResurrect()
|
|||
_player->SpawnCorpseBones();
|
||||
|
||||
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
|
||||
if(corpseGrave)
|
||||
if (corpseGrave)
|
||||
{
|
||||
WorldSafeLocsEntry const *ghostGrave = sObjectMgr.GetClosestGraveYard(
|
||||
WorldSafeLocsEntry const* ghostGrave = sObjectMgr.GetClosestGraveYard(
|
||||
_player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam());
|
||||
|
||||
if(corpseGrave != ghostGrave)
|
||||
if (corpseGrave != ghostGrave)
|
||||
_player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation());
|
||||
// or update at original position
|
||||
else
|
||||
|
|
@ -458,15 +458,15 @@ void WorldSession::SendSpiritResurrect()
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleBinderActivateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid npcGuid;
|
||||
recv_data >> npcGuid;
|
||||
|
||||
if(!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
|
||||
if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid,UNIT_NPC_FLAG_INNKEEPER);
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid,UNIT_NPC_FLAG_INNKEEPER);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG("WORLD: HandleBinderActivateOpcode - %s not found or you can't interact with him.", npcGuid.GetString().c_str());
|
||||
|
|
@ -474,30 +474,30 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
SendBindPoint(unit);
|
||||
}
|
||||
|
||||
void WorldSession::SendBindPoint(Creature *npc)
|
||||
void WorldSession::SendBindPoint(Creature* npc)
|
||||
{
|
||||
// prevent set homebind to instances in any case
|
||||
if(GetPlayer()->GetMap()->Instanceable())
|
||||
if (GetPlayer()->GetMap()->Instanceable())
|
||||
return;
|
||||
|
||||
// send spell for bind 3286 bind magic
|
||||
npc->CastSpell(_player, 3286, true); // Bind
|
||||
|
||||
WorldPacket data( SMSG_TRAINER_BUY_SUCCEEDED, (8+4));
|
||||
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, (8+4));
|
||||
data << npc->GetObjectGuid();
|
||||
data << uint32(3286); // Bind
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
}
|
||||
|
||||
void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv MSG_LIST_STABLED_PETS");
|
||||
ObjectGuid npcGUID;
|
||||
|
|
@ -511,20 +511,20 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
SendStablePet(npcGUID);
|
||||
}
|
||||
|
||||
void WorldSession::SendStablePet( ObjectGuid guid )
|
||||
void WorldSession::SendStablePet(ObjectGuid guid)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv MSG_LIST_STABLED_PETS Send.");
|
||||
|
||||
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
|
||||
data << guid;
|
||||
|
||||
Pet *pet = _player->GetPet();
|
||||
Pet* pet = _player->GetPet();
|
||||
|
||||
size_t wpos = data.wpos();
|
||||
data << uint8(0); // place holder for slot show number
|
||||
|
|
@ -534,7 +534,7 @@ void WorldSession::SendStablePet( ObjectGuid guid )
|
|||
uint8 num = 0; // counter for place holder
|
||||
|
||||
// not let move dead pet in slot
|
||||
if(pet && pet->isAlive() && pet->getPetType()==HUNTER_PET)
|
||||
if (pet && pet->isAlive() && pet->getPetType()==HUNTER_PET)
|
||||
{
|
||||
data << uint32(pet->GetCharmInfo()->GetPetNumber());
|
||||
data << uint32(pet->GetEntry());
|
||||
|
|
@ -548,11 +548,11 @@ void WorldSession::SendStablePet( ObjectGuid guid )
|
|||
QueryResult* result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
|
||||
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
|
||||
if(result)
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
data << uint32(fields[1].GetUInt32()); // petnumber
|
||||
data << uint32(fields[2].GetUInt32()); // creature entry
|
||||
|
|
@ -561,7 +561,8 @@ void WorldSession::SendStablePet( ObjectGuid guid )
|
|||
data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show)
|
||||
|
||||
++num;
|
||||
}while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
|
@ -602,14 +603,14 @@ bool WorldSession::CheckStableMaster(ObjectGuid guid)
|
|||
return true;
|
||||
}
|
||||
|
||||
void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
||||
void WorldSession::HandleStablePet(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_STABLE_PET");
|
||||
ObjectGuid npcGUID;
|
||||
|
||||
recv_data >> npcGUID;
|
||||
|
||||
if(!GetPlayer()->isAlive())
|
||||
if (!GetPlayer()->isAlive())
|
||||
{
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
|
|
@ -622,13 +623,13 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
Pet *pet = _player->GetPet();
|
||||
Pet* pet = _player->GetPet();
|
||||
|
||||
// can't place in stable dead pet
|
||||
if(!pet||!pet->isAlive()||pet->getPetType()!=HUNTER_PET)
|
||||
if (!pet||!pet->isAlive()||pet->getPetType()!=HUNTER_PET)
|
||||
{
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
|
|
@ -636,28 +637,29 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
|||
|
||||
uint32 free_slot = 1;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
|
||||
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
if(result)
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 slot = fields[1].GetUInt32();
|
||||
|
||||
// slots ordered in query, and if not equal then free
|
||||
if(slot!=free_slot)
|
||||
if (slot!=free_slot)
|
||||
break;
|
||||
|
||||
// this slot not free, skip
|
||||
++free_slot;
|
||||
}while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
if( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
|
||||
if (free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
|
||||
{
|
||||
pet->Unsummon(PetSaveMode(free_slot), _player);
|
||||
SendStableResult(STABLE_SUCCESS_STABLE);
|
||||
|
|
@ -666,7 +668,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
|||
SendStableResult(STABLE_ERR_STABLE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
||||
void WorldSession::HandleUnstablePet(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_UNSTABLE_PET.");
|
||||
ObjectGuid npcGUID;
|
||||
|
|
@ -681,30 +683,30 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
uint32 creature_id = 0;
|
||||
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
|
||||
_player->GetGUIDLow(),petnumber,PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
if(result)
|
||||
if (result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
creature_id = fields[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
if(!creature_id)
|
||||
if (!creature_id)
|
||||
{
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id);
|
||||
if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
|
||||
if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
|
||||
{
|
||||
// if problem in exotic pet
|
||||
if (creatureInfo && creatureInfo->isTameable(true))
|
||||
|
|
@ -715,18 +717,18 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
Pet* pet = _player->GetPet();
|
||||
if(pet && pet->isAlive())
|
||||
if (pet && pet->isAlive())
|
||||
{
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
// delete dead pet
|
||||
if(pet)
|
||||
if (pet)
|
||||
pet->Unsummon(PET_SAVE_AS_DELETED, _player);
|
||||
|
||||
Pet *newpet = new Pet(HUNTER_PET);
|
||||
if(!newpet->LoadPetFromDB(_player,creature_id,petnumber))
|
||||
Pet* newpet = new Pet(HUNTER_PET);
|
||||
if (!newpet->LoadPetFromDB(_player,creature_id,petnumber))
|
||||
{
|
||||
delete newpet;
|
||||
newpet = NULL;
|
||||
|
|
@ -737,7 +739,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
|||
SendStableResult(STABLE_SUCCESS_UNSTABLE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
|
||||
void WorldSession::HandleBuyStableSlot(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_BUY_STABLE_SLOT.");
|
||||
ObjectGuid npcGUID;
|
||||
|
|
@ -751,13 +753,13 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
if(GetPlayer()->m_stableSlots < MAX_PET_STABLES)
|
||||
if (GetPlayer()->m_stableSlots < MAX_PET_STABLES)
|
||||
{
|
||||
StableSlotPricesEntry const *SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
|
||||
if(_player->GetMoney() >= SlotPrice->Price)
|
||||
StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
|
||||
if (_player->GetMoney() >= SlotPrice->Price)
|
||||
{
|
||||
++GetPlayer()->m_stableSlots;
|
||||
_player->ModifyMoney(-int32(SlotPrice->Price));
|
||||
|
|
@ -770,12 +772,12 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
|
|||
SendStableResult(STABLE_ERR_STABLE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleStableRevivePet( WorldPacket &/* recv_data */)
|
||||
void WorldSession::HandleStableRevivePet(WorldPacket& /* recv_data */)
|
||||
{
|
||||
DEBUG_LOG("HandleStableRevivePet: Not implemented");
|
||||
}
|
||||
|
||||
void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
||||
void WorldSession::HandleStableSwapPet(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_STABLE_SWAP_PET.");
|
||||
ObjectGuid npcGUID;
|
||||
|
|
@ -790,41 +792,41 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
|
||||
Pet* pet = _player->GetPet();
|
||||
|
||||
if(!pet || pet->getPetType()!=HUNTER_PET)
|
||||
if (!pet || pet->getPetType()!=HUNTER_PET)
|
||||
{
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
// find swapped pet slot in stable
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
_player->GetGUIDLow(),pet_number);
|
||||
if(!result)
|
||||
if (!result)
|
||||
{
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 slot = fields[0].GetUInt32();
|
||||
uint32 creature_id = fields[1].GetUInt32();
|
||||
delete result;
|
||||
|
||||
if(!creature_id)
|
||||
if (!creature_id)
|
||||
{
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creature_id);
|
||||
if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
|
||||
if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets()))
|
||||
{
|
||||
// if problem in exotic pet
|
||||
if (creatureInfo && creatureInfo->isTameable(true))
|
||||
|
|
@ -838,8 +840,8 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
|||
pet->Unsummon(pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED, _player);
|
||||
|
||||
// summon unstabled pet
|
||||
Pet *newpet = new Pet;
|
||||
if(!newpet->LoadPetFromDB(_player,creature_id,pet_number))
|
||||
Pet* newpet = new Pet;
|
||||
if (!newpet->LoadPetFromDB(_player,creature_id,pet_number))
|
||||
{
|
||||
delete newpet;
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
|
|
@ -848,7 +850,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
|||
SendStableResult(STABLE_SUCCESS_UNSTABLE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleRepairItemOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_REPAIR_ITEM");
|
||||
|
||||
|
|
@ -858,15 +860,15 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
|
|||
|
||||
recv_data >> npcGuid >> itemGuid >> guildBank;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_REPAIR);
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_REPAIR);
|
||||
if (!unit)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleRepairItemOpcode - %s not found or you can't interact with him.", npcGuid.GetString().c_str());
|
||||
DEBUG_LOG("WORLD: HandleRepairItemOpcode - %s not found or you can't interact with him.", npcGuid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// remove fake death
|
||||
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
// reputation discount
|
||||
|
|
@ -879,7 +881,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
|
|||
|
||||
Item* item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
if(item)
|
||||
if (item)
|
||||
TotalCost= _player->DurabilityRepair(item->GetPos(), true, discountMod, (guildBank > 0));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
struct PageText
|
||||
{
|
||||
uint32 Page_ID;
|
||||
char * Text;
|
||||
char* Text;
|
||||
|
||||
uint32 Next_Page;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ class MANGOS_DLL_DECL NullCreatureAI : public CreatureAI
|
|||
explicit NullCreatureAI(Creature* c) : CreatureAI(c) {}
|
||||
~NullCreatureAI();
|
||||
|
||||
void MoveInLineOfSight(Unit *) {}
|
||||
void AttackStart(Unit *) {}
|
||||
void AttackedBy( Unit *) {}
|
||||
void MoveInLineOfSight(Unit*) {}
|
||||
void AttackStart(Unit*) {}
|
||||
void AttackedBy(Unit*) {}
|
||||
void EnterEvadeMode() {}
|
||||
|
||||
bool IsVisible(Unit *) const { return false; }
|
||||
bool IsVisible(Unit*) const { return false; }
|
||||
|
||||
void UpdateAI(const uint32) {}
|
||||
static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; }
|
||||
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
#include "TemporarySummon.h"
|
||||
#include "movement/packet_builder.h"
|
||||
|
||||
Object::Object( )
|
||||
Object::Object()
|
||||
{
|
||||
m_objectTypeId = TYPEID_OBJECT;
|
||||
m_objectType = TYPEMASK_OBJECT;
|
||||
|
|
@ -56,22 +56,22 @@ Object::Object( )
|
|||
m_objectUpdated = false;
|
||||
}
|
||||
|
||||
Object::~Object( )
|
||||
Object::~Object()
|
||||
{
|
||||
if(IsInWorld())
|
||||
if (IsInWorld())
|
||||
{
|
||||
///- Do NOT call RemoveFromWorld here, if the object is a player it will crash
|
||||
sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still in world!!", GetGUIDLow(), GetTypeId());
|
||||
MANGOS_ASSERT(false);
|
||||
}
|
||||
|
||||
if(m_objectUpdated)
|
||||
if (m_objectUpdated)
|
||||
{
|
||||
sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still have updated status!!", GetGUIDLow(), GetTypeId());
|
||||
MANGOS_ASSERT(false);
|
||||
}
|
||||
|
||||
if(m_uint32Values)
|
||||
if (m_uint32Values)
|
||||
{
|
||||
//DEBUG_LOG("Object desctr 1 check (%p)",(void*)this);
|
||||
delete [] m_uint32Values;
|
||||
|
|
@ -93,7 +93,7 @@ void Object::_InitValues()
|
|||
|
||||
void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
|
||||
{
|
||||
if(!m_uint32Values)
|
||||
if (!m_uint32Values)
|
||||
_InitValues();
|
||||
|
||||
ObjectGuid guid = ObjectGuid(guidhigh, entry, guidlow);
|
||||
|
|
@ -118,7 +118,7 @@ void Object::SendForcedObjectUpdate()
|
|||
RemoveFromClientUpdateList();
|
||||
|
||||
WorldPacket packet; // here we allocate a std::vector with a size of 0x10000
|
||||
for(UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
|
||||
for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
|
||||
{
|
||||
iter->second.BuildPacket(&packet);
|
||||
iter->first->GetSession()->SendPacket(&packet);
|
||||
|
|
@ -126,7 +126,7 @@ void Object::SendForcedObjectUpdate()
|
|||
}
|
||||
}
|
||||
|
||||
void Object::BuildMovementUpdateBlock(UpdateData * data, uint16 flags ) const
|
||||
void Object::BuildMovementUpdateBlock(UpdateData* data, uint16 flags) const
|
||||
{
|
||||
ByteBuffer buf(500);
|
||||
|
||||
|
|
@ -138,19 +138,19 @@ void Object::BuildMovementUpdateBlock(UpdateData * data, uint16 flags ) const
|
|||
data->AddUpdateBlock(buf);
|
||||
}
|
||||
|
||||
void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
|
||||
void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const
|
||||
{
|
||||
if(!target)
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
uint8 updatetype = UPDATETYPE_CREATE_OBJECT;
|
||||
uint16 updateFlags = m_updateFlag;
|
||||
|
||||
/** lower flag1 **/
|
||||
if(target == this) // building packet for yourself
|
||||
if (target == this) // building packet for yourself
|
||||
updateFlags |= UPDATEFLAG_SELF;
|
||||
|
||||
if(updateFlags & UPDATEFLAG_HAS_POSITION)
|
||||
if (updateFlags & UPDATEFLAG_HAS_POSITION)
|
||||
{
|
||||
// UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses...
|
||||
if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
|
||||
|
|
@ -163,7 +163,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
|
|||
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
|
||||
if (isType(TYPEMASK_GAMEOBJECT))
|
||||
{
|
||||
switch(((GameObject*)this)->GetGoType())
|
||||
switch (((GameObject*)this)->GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_TRAP:
|
||||
case GAMEOBJECT_TYPE_DUEL_ARBITER:
|
||||
|
|
@ -179,9 +179,9 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c
|
|||
}
|
||||
}
|
||||
|
||||
if(isType(TYPEMASK_UNIT))
|
||||
if (isType(TYPEMASK_UNIT))
|
||||
{
|
||||
if(((Unit*)this)->getVictim())
|
||||
if (((Unit*)this)->getVictim())
|
||||
updateFlags |= UPDATEFLAG_HAS_ATTACKING_TARGET;
|
||||
}
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ void Object::SendCreateUpdateToPlayer(Player* player)
|
|||
player->GetSession()->SendPacket(&packet);
|
||||
}
|
||||
|
||||
void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
|
||||
void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const
|
||||
{
|
||||
ByteBuffer buf(500);
|
||||
|
||||
|
|
@ -229,12 +229,12 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) c
|
|||
data->AddUpdateBlock(buf);
|
||||
}
|
||||
|
||||
void Object::BuildOutOfRangeUpdateBlock(UpdateData * data) const
|
||||
void Object::BuildOutOfRangeUpdateBlock(UpdateData* data) const
|
||||
{
|
||||
data->AddOutOfRangeGUID(GetObjectGuid());
|
||||
}
|
||||
|
||||
void Object::DestroyForPlayer( Player *target, bool anim ) const
|
||||
void Object::DestroyForPlayer(Player* target, bool anim) const
|
||||
{
|
||||
MANGOS_ASSERT(target);
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ void Object::DestroyForPlayer( Player *target, bool anim ) const
|
|||
target->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
||||
void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||
{
|
||||
//uint16 moveFlags2 = (isType(TYPEMASK_UNIT) ? ((Unit*)this)->m_movementInfo.GetMovementFlags2() : MOVEFLAG2_NONE);
|
||||
|
||||
|
|
@ -253,12 +253,12 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
// 0x20
|
||||
if (updateFlags & UPDATEFLAG_LIVING)
|
||||
{
|
||||
Unit *unit = ((Unit*)this);
|
||||
Unit* unit = ((Unit*)this);
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player *player = ((Player*)unit);
|
||||
if(player->GetTransport())
|
||||
Player* player = ((Player*)unit);
|
||||
if (player->GetTransport())
|
||||
player->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
|
||||
else
|
||||
player->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
|
||||
|
|
@ -286,7 +286,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
}
|
||||
else
|
||||
{
|
||||
if(updateFlags & UPDATEFLAG_POSITION)
|
||||
if (updateFlags & UPDATEFLAG_POSITION)
|
||||
{
|
||||
*data << uint8(0); // unk PGUID!
|
||||
*data << float(((WorldObject*)this)->GetPositionX());
|
||||
|
|
@ -297,7 +297,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
*data << float(((WorldObject*)this)->GetPositionZ());
|
||||
*data << float(((WorldObject*)this)->GetOrientation());
|
||||
|
||||
if(GetTypeId() == TYPEID_CORPSE)
|
||||
if (GetTypeId() == TYPEID_CORPSE)
|
||||
*data << float(((WorldObject*)this)->GetOrientation());
|
||||
else
|
||||
*data << float(0);
|
||||
|
|
@ -308,28 +308,28 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
if (updateFlags & UPDATEFLAG_HAS_POSITION)
|
||||
{
|
||||
// 0x02
|
||||
if(updateFlags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
|
||||
if (updateFlags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
|
||||
{
|
||||
*data << float(0);
|
||||
*data << float(0);
|
||||
*data << float(0);
|
||||
*data << float(((WorldObject *)this)->GetOrientation());
|
||||
*data << float(((WorldObject*)this)->GetOrientation());
|
||||
}
|
||||
else
|
||||
{
|
||||
*data << float(((WorldObject *)this)->GetPositionX());
|
||||
*data << float(((WorldObject *)this)->GetPositionY());
|
||||
*data << float(((WorldObject *)this)->GetPositionZ());
|
||||
*data << float(((WorldObject *)this)->GetOrientation());
|
||||
*data << float(((WorldObject*)this)->GetPositionX());
|
||||
*data << float(((WorldObject*)this)->GetPositionY());
|
||||
*data << float(((WorldObject*)this)->GetPositionZ());
|
||||
*data << float(((WorldObject*)this)->GetOrientation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 0x8
|
||||
if(updateFlags & UPDATEFLAG_LOWGUID)
|
||||
if (updateFlags & UPDATEFLAG_LOWGUID)
|
||||
{
|
||||
switch(GetTypeId())
|
||||
switch (GetTypeId())
|
||||
{
|
||||
case TYPEID_OBJECT:
|
||||
case TYPEID_ITEM:
|
||||
|
|
@ -343,7 +343,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
*data << uint32(0x0000000B); // unk, can be 0xB or 0xC
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
if(updateFlags & UPDATEFLAG_SELF)
|
||||
if (updateFlags & UPDATEFLAG_SELF)
|
||||
*data << uint32(0x0000002F); // unk, can be 0x15 or 0x22
|
||||
else
|
||||
*data << uint32(0x00000008); // unk, can be 0x7 or 0x8
|
||||
|
|
@ -355,9 +355,9 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
}
|
||||
|
||||
// 0x10
|
||||
if(updateFlags & UPDATEFLAG_HIGHGUID)
|
||||
if (updateFlags & UPDATEFLAG_HIGHGUID)
|
||||
{
|
||||
switch(GetTypeId())
|
||||
switch (GetTypeId())
|
||||
{
|
||||
case TYPEID_OBJECT:
|
||||
case TYPEID_ITEM:
|
||||
|
|
@ -371,7 +371,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
*data << uint32(0x0000000B); // unk, can be 0xB or 0xC
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
if(updateFlags & UPDATEFLAG_SELF)
|
||||
if (updateFlags & UPDATEFLAG_SELF)
|
||||
*data << uint32(0x0000002F); // unk, can be 0x15 or 0x22
|
||||
else
|
||||
*data << uint32(0x00000008); // unk, can be 0x7 or 0x8
|
||||
|
|
@ -383,7 +383,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
}
|
||||
|
||||
// 0x4
|
||||
if(updateFlags & UPDATEFLAG_HAS_ATTACKING_TARGET) // packed guid (current target guid)
|
||||
if (updateFlags & UPDATEFLAG_HAS_ATTACKING_TARGET) // packed guid (current target guid)
|
||||
{
|
||||
if (((Unit*)this)->getVictim())
|
||||
*data << ((Unit*)this)->getVictim()->GetPackGUID();
|
||||
|
|
@ -392,7 +392,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
}
|
||||
|
||||
// 0x2
|
||||
if(updateFlags & UPDATEFLAG_TRANSPORT)
|
||||
if (updateFlags & UPDATEFLAG_TRANSPORT)
|
||||
{
|
||||
*data << uint32(WorldTimer::getMSTime()); // ms time
|
||||
}
|
||||
|
|
@ -405,13 +405,13 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
|
|||
}
|
||||
|
||||
// 0x200
|
||||
if(updateFlags & UPDATEFLAG_ROTATION)
|
||||
if (updateFlags & UPDATEFLAG_ROTATION)
|
||||
{
|
||||
*data << int64(((GameObject*)this)->GetPackedWorldRotation());
|
||||
}
|
||||
}
|
||||
|
||||
void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *updateMask, Player *target) const
|
||||
void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const
|
||||
{
|
||||
if (!target)
|
||||
return;
|
||||
|
|
@ -465,7 +465,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
|
|||
// 2 specialized loops for speed optimization in non-unit case
|
||||
if (isType(TYPEMASK_UNIT)) // unit (creature/player) case
|
||||
{
|
||||
for(uint16 index = 0; index < m_valuesCount; ++index)
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
{
|
||||
if (updateMask->GetBit(index))
|
||||
{
|
||||
|
|
@ -551,7 +551,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
|
|||
}
|
||||
else if (isType(TYPEMASK_GAMEOBJECT)) // gameobject case
|
||||
{
|
||||
for(uint16 index = 0; index < m_valuesCount; ++index)
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
{
|
||||
if (updateMask->GetBit(index))
|
||||
{
|
||||
|
|
@ -563,7 +563,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
|
|||
|
||||
if (IsActivateToQuest)
|
||||
{
|
||||
switch(((GameObject*)this)->GetGoType())
|
||||
switch (((GameObject*)this)->GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER:
|
||||
// GO also seen with GO_DYNFLAG_LO_SPARKLE explicit, relation/reason unclear (192861)
|
||||
|
|
@ -598,7 +598,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
|
|||
}
|
||||
else // other objects case (no special index checks)
|
||||
{
|
||||
for(uint16 index = 0; index < m_valuesCount; ++index)
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
{
|
||||
if (updateMask->GetBit(index))
|
||||
{
|
||||
|
|
@ -611,18 +611,18 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
|
|||
|
||||
void Object::ClearUpdateMask(bool remove)
|
||||
{
|
||||
if(m_uint32Values)
|
||||
if (m_uint32Values)
|
||||
{
|
||||
for( uint16 index = 0; index < m_valuesCount; ++index )
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
{
|
||||
if(m_uint32Values_mirror[index]!= m_uint32Values[index])
|
||||
if (m_uint32Values_mirror[index]!= m_uint32Values[index])
|
||||
m_uint32Values_mirror[index] = m_uint32Values[index];
|
||||
}
|
||||
}
|
||||
|
||||
if(m_objectUpdated)
|
||||
if (m_objectUpdated)
|
||||
{
|
||||
if(remove)
|
||||
if (remove)
|
||||
RemoveFromClientUpdateList();
|
||||
m_objectUpdated = false;
|
||||
}
|
||||
|
|
@ -630,11 +630,11 @@ void Object::ClearUpdateMask(bool remove)
|
|||
|
||||
bool Object::LoadValues(const char* data)
|
||||
{
|
||||
if(!m_uint32Values) _InitValues();
|
||||
if (!m_uint32Values) _InitValues();
|
||||
|
||||
Tokens tokens = StrSplit(data, " ");
|
||||
|
||||
if(tokens.size() != m_valuesCount)
|
||||
if (tokens.size() != m_valuesCount)
|
||||
return false;
|
||||
|
||||
Tokens::iterator iter;
|
||||
|
|
@ -647,50 +647,50 @@ bool Object::LoadValues(const char* data)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Object::_SetUpdateBits(UpdateMask *updateMask, Player* /*target*/) const
|
||||
void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const
|
||||
{
|
||||
for( uint16 index = 0; index < m_valuesCount; ++index )
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
{
|
||||
if(m_uint32Values_mirror[index]!= m_uint32Values[index])
|
||||
if (m_uint32Values_mirror[index]!= m_uint32Values[index])
|
||||
updateMask->SetBit(index);
|
||||
}
|
||||
}
|
||||
|
||||
void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const
|
||||
void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const
|
||||
{
|
||||
for( uint16 index = 0; index < m_valuesCount; ++index )
|
||||
for (uint16 index = 0; index < m_valuesCount; ++index)
|
||||
{
|
||||
if(GetUInt32Value(index) != 0)
|
||||
if (GetUInt32Value(index) != 0)
|
||||
updateMask->SetBit(index);
|
||||
}
|
||||
}
|
||||
|
||||
void Object::SetInt32Value( uint16 index, int32 value )
|
||||
void Object::SetInt32Value(uint16 index, int32 value)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
|
||||
if(m_int32Values[ index ] != value)
|
||||
if (m_int32Values[ index ] != value)
|
||||
{
|
||||
m_int32Values[ index ] = value;
|
||||
MarkForClientUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Object::SetUInt32Value( uint16 index, uint32 value )
|
||||
void Object::SetUInt32Value(uint16 index, uint32 value)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
|
||||
if(m_uint32Values[ index ] != value)
|
||||
if (m_uint32Values[ index ] != value)
|
||||
{
|
||||
m_uint32Values[ index ] = value;
|
||||
MarkForClientUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Object::SetUInt64Value( uint16 index, const uint64 &value )
|
||||
void Object::SetUInt64Value(uint16 index, const uint64& value)
|
||||
{
|
||||
MANGOS_ASSERT( index + 1 < m_valuesCount || PrintIndexError( index, true ) );
|
||||
if(*((uint64*)&(m_uint32Values[ index ])) != value)
|
||||
MANGOS_ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
|
||||
if (*((uint64*)&(m_uint32Values[ index ])) != value)
|
||||
{
|
||||
m_uint32Values[ index ] = *((uint32*)&value);
|
||||
m_uint32Values[ index + 1 ] = *(((uint32*)&value) + 1);
|
||||
|
|
@ -698,28 +698,28 @@ void Object::SetUInt64Value( uint16 index, const uint64 &value )
|
|||
}
|
||||
}
|
||||
|
||||
void Object::SetFloatValue( uint16 index, float value )
|
||||
void Object::SetFloatValue(uint16 index, float value)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
|
||||
if(m_floatValues[ index ] != value)
|
||||
if (m_floatValues[ index ] != value)
|
||||
{
|
||||
m_floatValues[ index ] = value;
|
||||
MarkForClientUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Object::SetByteValue( uint16 index, uint8 offset, uint8 value )
|
||||
void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
|
||||
if(offset > 4)
|
||||
if (offset > 4)
|
||||
{
|
||||
sLog.outError("Object::SetByteValue: wrong offset %u", offset);
|
||||
return;
|
||||
}
|
||||
|
||||
if(uint8(m_uint32Values[ index ] >> (offset * 8)) != value)
|
||||
if (uint8(m_uint32Values[ index ] >> (offset * 8)) != value)
|
||||
{
|
||||
m_uint32Values[ index ] &= ~uint32(uint32(0xFF) << (offset * 8));
|
||||
m_uint32Values[ index ] |= uint32(uint32(value) << (offset * 8));
|
||||
|
|
@ -727,17 +727,17 @@ void Object::SetByteValue( uint16 index, uint8 offset, uint8 value )
|
|||
}
|
||||
}
|
||||
|
||||
void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value )
|
||||
void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
|
||||
if(offset > 2)
|
||||
if (offset > 2)
|
||||
{
|
||||
sLog.outError("Object::SetUInt16Value: wrong offset %u", offset);
|
||||
return;
|
||||
}
|
||||
|
||||
if(uint16(m_uint32Values[ index ] >> (offset * 16)) != value)
|
||||
if (uint16(m_uint32Values[ index ] >> (offset * 16)) != value)
|
||||
{
|
||||
m_uint32Values[ index ] &= ~uint32(uint32(0xFFFF) << (offset * 16));
|
||||
m_uint32Values[ index ] |= uint32(uint32(value) << (offset * 16));
|
||||
|
|
@ -745,17 +745,17 @@ void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value )
|
|||
}
|
||||
}
|
||||
|
||||
void Object::SetStatFloatValue( uint16 index, float value)
|
||||
void Object::SetStatFloatValue(uint16 index, float value)
|
||||
{
|
||||
if(value < 0)
|
||||
if (value < 0)
|
||||
value = 0.0f;
|
||||
|
||||
SetFloatValue(index, value);
|
||||
}
|
||||
|
||||
void Object::SetStatInt32Value( uint16 index, int32 value)
|
||||
void Object::SetStatInt32Value(uint16 index, int32 value)
|
||||
{
|
||||
if(value < 0)
|
||||
if (value < 0)
|
||||
value = 0;
|
||||
|
||||
SetUInt32Value(index, uint32(value));
|
||||
|
|
@ -765,7 +765,7 @@ void Object::ApplyModUInt32Value(uint16 index, int32 val, bool apply)
|
|||
{
|
||||
int32 cur = GetUInt32Value(index);
|
||||
cur += (apply ? val : -val);
|
||||
if(cur < 0)
|
||||
if (cur < 0)
|
||||
cur = 0;
|
||||
SetUInt32Value(index, cur);
|
||||
}
|
||||
|
|
@ -788,65 +788,65 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply)
|
|||
{
|
||||
float cur = GetFloatValue(index);
|
||||
cur += (apply ? val : -val);
|
||||
if(cur < 0)
|
||||
if (cur < 0)
|
||||
cur = 0;
|
||||
SetFloatValue(index, cur);
|
||||
}
|
||||
|
||||
void Object::SetFlag( uint16 index, uint32 newFlag )
|
||||
void Object::SetFlag(uint16 index, uint32 newFlag)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
uint32 oldval = m_uint32Values[ index ];
|
||||
uint32 newval = oldval | newFlag;
|
||||
|
||||
if(oldval != newval)
|
||||
if (oldval != newval)
|
||||
{
|
||||
m_uint32Values[ index ] = newval;
|
||||
MarkForClientUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Object::RemoveFlag( uint16 index, uint32 oldFlag )
|
||||
void Object::RemoveFlag(uint16 index, uint32 oldFlag)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
uint32 oldval = m_uint32Values[ index ];
|
||||
uint32 newval = oldval & ~oldFlag;
|
||||
|
||||
if(oldval != newval)
|
||||
if (oldval != newval)
|
||||
{
|
||||
m_uint32Values[ index ] = newval;
|
||||
MarkForClientUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag )
|
||||
void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
|
||||
if(offset > 4)
|
||||
if (offset > 4)
|
||||
{
|
||||
sLog.outError("Object::SetByteFlag: wrong offset %u", offset);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!(uint8(m_uint32Values[ index ] >> (offset * 8)) & newFlag))
|
||||
if (!(uint8(m_uint32Values[ index ] >> (offset * 8)) & newFlag))
|
||||
{
|
||||
m_uint32Values[ index ] |= uint32(uint32(newFlag) << (offset * 8));
|
||||
MarkForClientUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag )
|
||||
void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index, true));
|
||||
|
||||
if(offset > 4)
|
||||
if (offset > 4)
|
||||
{
|
||||
sLog.outError("Object::RemoveByteFlag: wrong offset %u", offset);
|
||||
return;
|
||||
}
|
||||
|
||||
if(uint8(m_uint32Values[ index ] >> (offset * 8)) & oldFlag)
|
||||
if (uint8(m_uint32Values[ index ] >> (offset * 8)) & oldFlag)
|
||||
{
|
||||
m_uint32Values[ index ] &= ~uint32(uint32(oldFlag) << (offset * 8));
|
||||
MarkForClientUpdate();
|
||||
|
|
@ -898,7 +898,7 @@ void Object::BuildUpdateDataForPlayer(Player* pl, UpdateDataMapType& update_play
|
|||
|
||||
if (iter == update_players.end())
|
||||
{
|
||||
std::pair<UpdateDataMapType::iterator, bool> p = update_players.insert( UpdateDataMapType::value_type(pl, UpdateData()) );
|
||||
std::pair<UpdateDataMapType::iterator, bool> p = update_players.insert(UpdateDataMapType::value_type(pl, UpdateData()));
|
||||
MANGOS_ASSERT(p.second);
|
||||
iter = p.first;
|
||||
}
|
||||
|
|
@ -918,7 +918,7 @@ void Object::RemoveFromClientUpdateList()
|
|||
MANGOS_ASSERT(false);
|
||||
}
|
||||
|
||||
void Object::BuildUpdateData( UpdateDataMapType& /*update_players */)
|
||||
void Object::BuildUpdateData(UpdateDataMapType& /*update_players */)
|
||||
{
|
||||
sLog.outError("Unexpected call of Object::BuildUpdateData for object (TypeId: %u Update fields: %u)",GetTypeId(), m_valuesCount);
|
||||
MANGOS_ASSERT(false);
|
||||
|
|
@ -926,9 +926,9 @@ void Object::BuildUpdateData( UpdateDataMapType& /*update_players */)
|
|||
|
||||
void Object::MarkForClientUpdate()
|
||||
{
|
||||
if(m_inWorld)
|
||||
if (m_inWorld)
|
||||
{
|
||||
if(!m_objectUpdated)
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
AddToClientUpdateList();
|
||||
m_objectUpdated = true;
|
||||
|
|
@ -946,7 +946,7 @@ void WorldObject::CleanupsBeforeDelete()
|
|||
RemoveFromWorld();
|
||||
}
|
||||
|
||||
void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask )
|
||||
void WorldObject::_Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
|
||||
{
|
||||
Object::_Create(guidlow, 0, guidhigh);
|
||||
m_phaseMask = phaseMask;
|
||||
|
|
@ -1001,7 +1001,7 @@ InstanceData* WorldObject::GetInstanceData() const
|
|||
return GetMap()->GetInstanceData();
|
||||
}
|
||||
|
||||
//slow
|
||||
//slow
|
||||
float WorldObject::GetDistance(const WorldObject* obj) const
|
||||
{
|
||||
float dx = GetPositionX() - obj->GetPositionX();
|
||||
|
|
@ -1009,7 +1009,7 @@ float WorldObject::GetDistance(const WorldObject* obj) const
|
|||
float dz = GetPositionZ() - obj->GetPositionZ();
|
||||
float sizefactor = GetObjectBoundingRadius() + obj->GetObjectBoundingRadius();
|
||||
float dist = sqrt((dx*dx) + (dy*dy) + (dz*dz)) - sizefactor;
|
||||
return ( dist > 0 ? dist : 0);
|
||||
return (dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance2d(float x, float y) const
|
||||
|
|
@ -1018,7 +1018,7 @@ float WorldObject::GetDistance2d(float x, float y) const
|
|||
float dy = GetPositionY() - y;
|
||||
float sizefactor = GetObjectBoundingRadius();
|
||||
float dist = sqrt((dx*dx) + (dy*dy)) - sizefactor;
|
||||
return ( dist > 0 ? dist : 0);
|
||||
return (dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance(float x, float y, float z) const
|
||||
|
|
@ -1028,7 +1028,7 @@ float WorldObject::GetDistance(float x, float y, float z) const
|
|||
float dz = GetPositionZ() - z;
|
||||
float sizefactor = GetObjectBoundingRadius();
|
||||
float dist = sqrt((dx*dx) + (dy*dy) + (dz*dz)) - sizefactor;
|
||||
return ( dist > 0 ? dist : 0);
|
||||
return (dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance2d(const WorldObject* obj) const
|
||||
|
|
@ -1037,7 +1037,7 @@ float WorldObject::GetDistance2d(const WorldObject* obj) const
|
|||
float dy = GetPositionY() - obj->GetPositionY();
|
||||
float sizefactor = GetObjectBoundingRadius() + obj->GetObjectBoundingRadius();
|
||||
float dist = sqrt((dx*dx) + (dy*dy)) - sizefactor;
|
||||
return ( dist > 0 ? dist : 0);
|
||||
return (dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
float WorldObject::GetDistanceZ(const WorldObject* obj) const
|
||||
|
|
@ -1045,7 +1045,7 @@ float WorldObject::GetDistanceZ(const WorldObject* obj) const
|
|||
float dz = fabs(GetPositionZ() - obj->GetPositionZ());
|
||||
float sizefactor = GetObjectBoundingRadius() + obj->GetObjectBoundingRadius();
|
||||
float dist = dz - sizefactor;
|
||||
return ( dist > 0 ? dist : 0);
|
||||
return (dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDist3d(float x, float y, float z, float dist2compare) const
|
||||
|
|
@ -1078,7 +1078,7 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
|
|||
float dx = GetPositionX() - obj->GetPositionX();
|
||||
float dy = GetPositionY() - obj->GetPositionY();
|
||||
float distsq = dx*dx + dy*dy;
|
||||
if(is3D)
|
||||
if (is3D)
|
||||
{
|
||||
float dz = GetPositionZ() - obj->GetPositionZ();
|
||||
distsq += dz*dz;
|
||||
|
|
@ -1094,7 +1094,7 @@ bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const
|
|||
if (!IsInMap(obj)) return false;
|
||||
float ox,oy,oz;
|
||||
obj->GetPosition(ox,oy,oz);
|
||||
return(IsWithinLOS(ox, oy, oz ));
|
||||
return(IsWithinLOS(ox, oy, oz));
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const
|
||||
|
|
@ -1109,7 +1109,7 @@ bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* o
|
|||
float dx1 = GetPositionX() - obj1->GetPositionX();
|
||||
float dy1 = GetPositionY() - obj1->GetPositionY();
|
||||
float distsq1 = dx1*dx1 + dy1*dy1;
|
||||
if(is3D)
|
||||
if (is3D)
|
||||
{
|
||||
float dz1 = GetPositionZ() - obj1->GetPositionZ();
|
||||
distsq1 += dz1*dz1;
|
||||
|
|
@ -1118,7 +1118,7 @@ bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* o
|
|||
float dx2 = GetPositionX() - obj2->GetPositionX();
|
||||
float dy2 = GetPositionY() - obj2->GetPositionY();
|
||||
float distsq2 = dx2*dx2 + dy2*dy2;
|
||||
if(is3D)
|
||||
if (is3D)
|
||||
{
|
||||
float dz2 = GetPositionZ() - obj2->GetPositionZ();
|
||||
distsq2 += dz2*dz2;
|
||||
|
|
@ -1132,7 +1132,7 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
|
|||
float dx = GetPositionX() - obj->GetPositionX();
|
||||
float dy = GetPositionY() - obj->GetPositionY();
|
||||
float distsq = dx*dx + dy*dy;
|
||||
if(is3D)
|
||||
if (is3D)
|
||||
{
|
||||
float dz = GetPositionZ() - obj->GetPositionZ();
|
||||
distsq += dz*dz;
|
||||
|
|
@ -1141,10 +1141,10 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
|
|||
float sizefactor = GetObjectBoundingRadius() + obj->GetObjectBoundingRadius();
|
||||
|
||||
// check only for real range
|
||||
if(minRange > 0.0f)
|
||||
if (minRange > 0.0f)
|
||||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
if (distsq < mindist * mindist)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1161,10 +1161,10 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange)
|
|||
float sizefactor = GetObjectBoundingRadius();
|
||||
|
||||
// check only for real range
|
||||
if(minRange > 0.0f)
|
||||
if (minRange > 0.0f)
|
||||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
if (distsq < mindist * mindist)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1182,10 +1182,10 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
|||
float sizefactor = GetObjectBoundingRadius();
|
||||
|
||||
// check only for real range
|
||||
if(minRange > 0.0f)
|
||||
if (minRange > 0.0f)
|
||||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
if (distsq < mindist * mindist)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1240,32 +1240,32 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
|
|||
|
||||
float lborder = -1 * (arc/2.0f); // in range -pi..0
|
||||
float rborder = (arc/2.0f); // in range 0..pi
|
||||
return (( angle >= lborder ) && ( angle <= rborder ));
|
||||
return ((angle >= lborder) && (angle <= rborder));
|
||||
}
|
||||
|
||||
bool WorldObject::isInFrontInMap(WorldObject const* target, float distance, float arc) const
|
||||
{
|
||||
return IsWithinDistInMap(target, distance) && HasInArc( arc, target );
|
||||
return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
|
||||
}
|
||||
|
||||
bool WorldObject::isInBackInMap(WorldObject const* target, float distance, float arc) const
|
||||
{
|
||||
return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI_F - arc, target );
|
||||
return IsWithinDistInMap(target, distance) && !HasInArc(2 * M_PI_F - arc, target);
|
||||
}
|
||||
|
||||
bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const
|
||||
{
|
||||
return IsWithinDist(target, distance) && HasInArc( arc, target );
|
||||
return IsWithinDist(target, distance) && HasInArc(arc, target);
|
||||
}
|
||||
|
||||
bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const
|
||||
{
|
||||
return IsWithinDist(target, distance) && !HasInArc( 2 * M_PI_F - arc, target );
|
||||
return IsWithinDist(target, distance) && !HasInArc(2 * M_PI_F - arc, target);
|
||||
}
|
||||
|
||||
void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const
|
||||
void WorldObject::GetRandomPoint(float x, float y, float z, float distance, float& rand_x, float& rand_y, float& rand_z) const
|
||||
{
|
||||
if(distance == 0)
|
||||
if (distance == 0)
|
||||
{
|
||||
rand_x = x;
|
||||
rand_y = y;
|
||||
|
|
@ -1286,14 +1286,14 @@ void WorldObject::GetRandomPoint( float x, float y, float z, float distance, flo
|
|||
UpdateGroundPositionZ(rand_x,rand_y,rand_z); // update to LOS height if available
|
||||
}
|
||||
|
||||
void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const
|
||||
void WorldObject::UpdateGroundPositionZ(float x, float y, float& z) const
|
||||
{
|
||||
float new_z = GetTerrain()->GetHeight(x,y,z,true);
|
||||
if(new_z > INVALID_HEIGHT)
|
||||
if (new_z > INVALID_HEIGHT)
|
||||
z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface
|
||||
}
|
||||
|
||||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
||||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z) const
|
||||
{
|
||||
switch (GetTypeId())
|
||||
{
|
||||
|
|
@ -1350,7 +1350,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
|
|||
default:
|
||||
{
|
||||
float ground_z = GetTerrain()->GetHeight(x, y, z, true);
|
||||
if(ground_z > INVALID_HEIGHT)
|
||||
if (ground_z > INVALID_HEIGHT)
|
||||
z = ground_z;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1444,8 +1444,8 @@ void WorldObject::MonsterYellToZone(int32 textId, uint32 language, Unit* target)
|
|||
uint32 zoneid = GetZoneId();
|
||||
|
||||
Map::PlayerList const& pList = GetMap()->GetPlayers();
|
||||
for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||
if(itr->getSource()->GetZoneId()==zoneid)
|
||||
for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||
if (itr->getSource()->GetZoneId()==zoneid)
|
||||
say_do(itr->getSource());
|
||||
}
|
||||
|
||||
|
|
@ -1474,7 +1474,7 @@ void WorldObject::MonsterWhisper(int32 textId, Unit* target, bool IsBossWhisper)
|
|||
((Player*)target)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldObject::BuildMonsterChat(WorldPacket *data, ObjectGuid senderGuid, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName)
|
||||
void WorldObject::BuildMonsterChat(WorldPacket* data, ObjectGuid senderGuid, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName)
|
||||
{
|
||||
*data << uint8(msgtype);
|
||||
*data << uint32(language);
|
||||
|
|
@ -1493,21 +1493,21 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, ObjectGuid senderGuid, uin
|
|||
*data << uint8(0); // ChatTag
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
|
||||
void WorldObject::SendMessageToSet(WorldPacket* data, bool /*bToSelf*/)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageBroadcast(this, data);
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
|
||||
void WorldObject::SendMessageToSetInRange(WorldPacket* data, float dist, bool /*bToSelf*/)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageDistBroadcast(this, data, dist);
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver)
|
||||
void WorldObject::SendMessageToSetExcept(WorldPacket* data, Player const* skipped_receiver)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
if (IsInWorld())
|
||||
|
|
@ -1532,7 +1532,7 @@ void WorldObject::SendGameObjectCustomAnim(ObjectGuid guid, uint32 animId /*= 0*
|
|||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void WorldObject::SetMap(Map * map)
|
||||
void WorldObject::SetMap(Map* map)
|
||||
{
|
||||
MANGOS_ASSERT(map);
|
||||
m_currMap = map;
|
||||
|
|
@ -1554,8 +1554,8 @@ void WorldObject::AddObjectToRemoveList()
|
|||
|
||||
Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime, bool asActiveObject)
|
||||
{
|
||||
CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(id);
|
||||
if(!cinfo)
|
||||
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(id);
|
||||
if (!cinfo)
|
||||
{
|
||||
sLog.outErrorDb("WorldObject::SummonCreature: Creature (Entry: %u) not existed for summoner: %s. ", id, GetGuidStr().c_str());
|
||||
return NULL;
|
||||
|
|
@ -1585,7 +1585,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
|||
|
||||
pCreature->Summon(spwtype, despwtime);
|
||||
|
||||
if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI())
|
||||
if (GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI())
|
||||
((Creature*)this)->AI()->JustSummoned(pCreature);
|
||||
|
||||
// return the creature therewith the summoner has access to it
|
||||
|
|
@ -1670,7 +1670,7 @@ namespace MaNGOS
|
|||
|
||||
//===================================================================================================
|
||||
|
||||
void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle ) const
|
||||
void WorldObject::GetNearPoint2D(float& x, float& y, float distance2d, float absAngle) const
|
||||
{
|
||||
x = GetPositionX() + (GetObjectBoundingRadius() + distance2d) * cos(absAngle);
|
||||
y = GetPositionY() + (GetObjectBoundingRadius() + distance2d) * sin(absAngle);
|
||||
|
|
@ -1679,13 +1679,13 @@ void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float abs
|
|||
MaNGOS::NormalizeMapCoord(y);
|
||||
}
|
||||
|
||||
void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_bounding_radius, float distance2d, float absAngle) const
|
||||
void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_bounding_radius, float distance2d, float absAngle) const
|
||||
{
|
||||
GetNearPoint2D(x, y, distance2d + searcher_bounding_radius, absAngle);
|
||||
const float init_z = z = GetPositionZ();
|
||||
|
||||
// if detection disabled, return first point
|
||||
if(!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
||||
{
|
||||
if (searcher)
|
||||
searcher->UpdateAllowedPositionZ(x, y, z); // update to LOS height if available
|
||||
|
|
@ -1792,29 +1792,29 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
|||
{
|
||||
m_phaseMask = newPhaseMask;
|
||||
|
||||
if(update && IsInWorld())
|
||||
if (update && IsInWorld())
|
||||
UpdateVisibilityAndView();
|
||||
}
|
||||
|
||||
void WorldObject::PlayDistanceSound( uint32 sound_id, Player* target /*= NULL*/ )
|
||||
void WorldObject::PlayDistanceSound(uint32 sound_id, Player* target /*= NULL*/)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_OBJECT_SOUND,4+8);
|
||||
data << uint32(sound_id);
|
||||
data << GetObjectGuid();
|
||||
if (target)
|
||||
target->SendDirectMessage( &data );
|
||||
target->SendDirectMessage(&data);
|
||||
else
|
||||
SendMessageToSet( &data, true );
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void WorldObject::PlayDirectSound( uint32 sound_id, Player* target /*= NULL*/ )
|
||||
void WorldObject::PlayDirectSound(uint32 sound_id, Player* target /*= NULL*/)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << uint32(sound_id);
|
||||
if (target)
|
||||
target->SendDirectMessage( &data );
|
||||
target->SendDirectMessage(&data);
|
||||
else
|
||||
SendMessageToSet( &data, true );
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void WorldObject::UpdateVisibilityAndView()
|
||||
|
|
@ -1844,30 +1844,30 @@ void WorldObject::RemoveFromClientUpdateList()
|
|||
|
||||
struct WorldObjectChangeAccumulator
|
||||
{
|
||||
UpdateDataMapType &i_updateDatas;
|
||||
WorldObject &i_object;
|
||||
WorldObjectChangeAccumulator(WorldObject &obj, UpdateDataMapType &d) : i_updateDatas(d), i_object(obj)
|
||||
UpdateDataMapType& i_updateDatas;
|
||||
WorldObject& i_object;
|
||||
WorldObjectChangeAccumulator(WorldObject& obj, UpdateDataMapType& d) : i_updateDatas(d), i_object(obj)
|
||||
{
|
||||
// send self fields changes in another way, otherwise
|
||||
// with new camera system when player's camera too far from player, camera wouldn't receive packets and changes from player
|
||||
if(i_object.isType(TYPEMASK_PLAYER))
|
||||
if (i_object.isType(TYPEMASK_PLAYER))
|
||||
i_object.BuildUpdateDataForPlayer((Player*)&i_object, i_updateDatas);
|
||||
}
|
||||
|
||||
void Visit(CameraMapType &m)
|
||||
void Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player* owner = iter->getSource()->GetOwner();
|
||||
if(owner != &i_object && owner->HaveAtClient(&i_object))
|
||||
if (owner != &i_object && owner->HaveAtClient(&i_object))
|
||||
i_object.BuildUpdateDataForPlayer(owner, i_updateDatas);
|
||||
}
|
||||
}
|
||||
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
|
||||
};
|
||||
|
||||
void WorldObject::BuildUpdateData( UpdateDataMapType & update_players)
|
||||
void WorldObject::BuildUpdateData(UpdateDataMapType& update_players)
|
||||
{
|
||||
WorldObjectChangeAccumulator notifier(*this, update_players);
|
||||
Cell::VisitWorldObjects(this, notifier, GetMap()->GetVisibilityDistance());
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ struct WorldLocation
|
|||
float orientation;
|
||||
explicit WorldLocation(uint32 _mapid = 0, float _x = 0, float _y = 0, float _z = 0, float _o = 0)
|
||||
: mapid(_mapid), coord_x(_x), coord_y(_y), coord_z(_z), orientation(_o) {}
|
||||
WorldLocation(WorldLocation const &loc)
|
||||
WorldLocation(WorldLocation const& loc)
|
||||
: mapid(loc.mapid), coord_x(loc.coord_x), coord_y(loc.coord_y), coord_z(loc.coord_z), orientation(loc.orientation) {}
|
||||
};
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ class WorldUpdateCounter
|
|||
|
||||
time_t timeElapsed()
|
||||
{
|
||||
if(!m_tmStart)
|
||||
if (!m_tmStart)
|
||||
m_tmStart = WorldTimer::tickPrevTime();
|
||||
|
||||
return WorldTimer::getMSTimeDiff(m_tmStart, WorldTimer::tickTime());
|
||||
|
|
@ -118,12 +118,12 @@ class WorldUpdateCounter
|
|||
class MANGOS_DLL_SPEC Object
|
||||
{
|
||||
public:
|
||||
virtual ~Object ( );
|
||||
virtual ~Object();
|
||||
|
||||
const bool& IsInWorld() const { return m_inWorld; }
|
||||
virtual void AddToWorld()
|
||||
{
|
||||
if(m_inWorld)
|
||||
if (m_inWorld)
|
||||
return;
|
||||
|
||||
m_inWorld = true;
|
||||
|
|
@ -156,7 +156,7 @@ class MANGOS_DLL_SPEC Object
|
|||
uint8 GetTypeId() const { return m_objectTypeId; }
|
||||
bool isType(TypeMask mask) const { return (mask & m_objectType); }
|
||||
|
||||
virtual void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
|
||||
virtual void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const;
|
||||
void SendCreateUpdateToPlayer(Player* player);
|
||||
|
||||
// must be overwrite in appropriate subclasses (WorldObject, Item currently), or will crash
|
||||
|
|
@ -166,93 +166,93 @@ class MANGOS_DLL_SPEC Object
|
|||
void MarkForClientUpdate();
|
||||
void SendForcedObjectUpdate();
|
||||
|
||||
void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
|
||||
void BuildOutOfRangeUpdateBlock( UpdateData *data ) const;
|
||||
void BuildMovementUpdateBlock( UpdateData * data, uint16 flags = 0 ) const;
|
||||
void BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const;
|
||||
void BuildOutOfRangeUpdateBlock(UpdateData* data) const;
|
||||
void BuildMovementUpdateBlock(UpdateData* data, uint16 flags = 0) const;
|
||||
|
||||
virtual void DestroyForPlayer( Player *target, bool anim = false ) const;
|
||||
virtual void DestroyForPlayer(Player* target, bool anim = false) const;
|
||||
|
||||
const int32& GetInt32Value( uint16 index ) const
|
||||
const int32& GetInt32Value(uint16 index) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
return m_int32Values[ index ];
|
||||
}
|
||||
|
||||
const uint32& GetUInt32Value( uint16 index ) const
|
||||
const uint32& GetUInt32Value(uint16 index) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
return m_uint32Values[ index ];
|
||||
}
|
||||
|
||||
const uint64& GetUInt64Value( uint16 index ) const
|
||||
const uint64& GetUInt64Value(uint16 index) const
|
||||
{
|
||||
MANGOS_ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , false) );
|
||||
MANGOS_ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , false));
|
||||
return *((uint64*)&(m_uint32Values[ index ]));
|
||||
}
|
||||
|
||||
const float& GetFloatValue( uint16 index ) const
|
||||
const float& GetFloatValue(uint16 index) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
return m_floatValues[ index ];
|
||||
}
|
||||
|
||||
uint8 GetByteValue( uint16 index, uint8 offset) const
|
||||
uint8 GetByteValue(uint16 index, uint8 offset) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
|
||||
MANGOS_ASSERT( offset < 4 );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
MANGOS_ASSERT(offset < 4);
|
||||
return *(((uint8*)&m_uint32Values[ index ])+offset);
|
||||
}
|
||||
|
||||
uint16 GetUInt16Value( uint16 index, uint8 offset) const
|
||||
uint16 GetUInt16Value(uint16 index, uint8 offset) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
|
||||
MANGOS_ASSERT( offset < 2 );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
MANGOS_ASSERT(offset < 2);
|
||||
return *(((uint16*)&m_uint32Values[ index ])+offset);
|
||||
}
|
||||
|
||||
ObjectGuid const& GetGuidValue( uint16 index ) const { return *reinterpret_cast<ObjectGuid const*>(&GetUInt64Value(index)); }
|
||||
ObjectGuid const& GetGuidValue(uint16 index) const { return *reinterpret_cast<ObjectGuid const*>(&GetUInt64Value(index)); }
|
||||
|
||||
void SetInt32Value( uint16 index, int32 value );
|
||||
void SetUInt32Value( uint16 index, uint32 value );
|
||||
void SetUInt64Value( uint16 index, const uint64 &value );
|
||||
void SetFloatValue( uint16 index, float value );
|
||||
void SetByteValue( uint16 index, uint8 offset, uint8 value );
|
||||
void SetUInt16Value( uint16 index, uint8 offset, uint16 value );
|
||||
void SetInt16Value( uint16 index, uint8 offset, int16 value ) { SetUInt16Value(index,offset,(uint16)value); }
|
||||
void SetGuidValue( uint16 index, ObjectGuid const& value ) { SetUInt64Value(index, value.GetRawValue()); }
|
||||
void SetStatFloatValue( uint16 index, float value);
|
||||
void SetStatInt32Value( uint16 index, int32 value);
|
||||
void SetInt32Value(uint16 index, int32 value);
|
||||
void SetUInt32Value(uint16 index, uint32 value);
|
||||
void SetUInt64Value(uint16 index, const uint64& value);
|
||||
void SetFloatValue(uint16 index, float value);
|
||||
void SetByteValue(uint16 index, uint8 offset, uint8 value);
|
||||
void SetUInt16Value(uint16 index, uint8 offset, uint16 value);
|
||||
void SetInt16Value(uint16 index, uint8 offset, int16 value) { SetUInt16Value(index,offset,(uint16)value); }
|
||||
void SetGuidValue(uint16 index, ObjectGuid const& value) { SetUInt64Value(index, value.GetRawValue()); }
|
||||
void SetStatFloatValue(uint16 index, float value);
|
||||
void SetStatInt32Value(uint16 index, int32 value);
|
||||
|
||||
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
|
||||
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
|
||||
void ApplyModUInt64Value(uint16 index, int32 val, bool apply);
|
||||
void ApplyModPositiveFloatValue( uint16 index, float val, bool apply);
|
||||
void ApplyModSignedFloatValue( uint16 index, float val, bool apply);
|
||||
void ApplyModPositiveFloatValue(uint16 index, float val, bool apply);
|
||||
void ApplyModSignedFloatValue(uint16 index, float val, bool apply);
|
||||
|
||||
void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
|
||||
{
|
||||
val = val != -100.0f ? val : -99.9f ;
|
||||
SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)) );
|
||||
SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)));
|
||||
}
|
||||
|
||||
void SetFlag( uint16 index, uint32 newFlag );
|
||||
void RemoveFlag( uint16 index, uint32 oldFlag );
|
||||
void SetFlag(uint16 index, uint32 newFlag);
|
||||
void RemoveFlag(uint16 index, uint32 oldFlag);
|
||||
|
||||
void ToggleFlag( uint16 index, uint32 flag)
|
||||
void ToggleFlag(uint16 index, uint32 flag)
|
||||
{
|
||||
if(HasFlag(index, flag))
|
||||
if (HasFlag(index, flag))
|
||||
RemoveFlag(index, flag);
|
||||
else
|
||||
SetFlag(index, flag);
|
||||
}
|
||||
|
||||
bool HasFlag( uint16 index, uint32 flag ) const
|
||||
bool HasFlag(uint16 index, uint32 flag) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
return (m_uint32Values[ index ] & flag) != 0;
|
||||
}
|
||||
|
||||
void ApplyModFlag( uint16 index, uint32 flag, bool apply)
|
||||
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
SetFlag(index, flag);
|
||||
|
|
@ -260,10 +260,10 @@ class MANGOS_DLL_SPEC Object
|
|||
RemoveFlag(index, flag);
|
||||
}
|
||||
|
||||
void SetByteFlag( uint16 index, uint8 offset, uint8 newFlag );
|
||||
void RemoveByteFlag( uint16 index, uint8 offset, uint8 newFlag );
|
||||
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag);
|
||||
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag);
|
||||
|
||||
void ToggleByteFlag( uint16 index, uint8 offset, uint8 flag )
|
||||
void ToggleByteFlag(uint16 index, uint8 offset, uint8 flag)
|
||||
{
|
||||
if (HasByteFlag(index, offset, flag))
|
||||
RemoveByteFlag(index, offset, flag);
|
||||
|
|
@ -271,14 +271,14 @@ class MANGOS_DLL_SPEC Object
|
|||
SetByteFlag(index, offset, flag);
|
||||
}
|
||||
|
||||
bool HasByteFlag( uint16 index, uint8 offset, uint8 flag ) const
|
||||
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
|
||||
MANGOS_ASSERT( offset < 4 );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
MANGOS_ASSERT(offset < 4);
|
||||
return (((uint8*)&m_uint32Values[index])[offset] & flag) != 0;
|
||||
}
|
||||
|
||||
void ApplyModByteFlag( uint16 index, uint8 offset, uint32 flag, bool apply)
|
||||
void ApplyModByteFlag(uint16 index, uint8 offset, uint32 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
SetByteFlag(index, offset, flag);
|
||||
|
|
@ -289,7 +289,7 @@ class MANGOS_DLL_SPEC Object
|
|||
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
|
||||
void RemoveShortFlag(uint16 index, bool highpart, uint16 oldFlag);
|
||||
|
||||
void ToggleShortFlag( uint16 index, bool highpart, uint8 flag )
|
||||
void ToggleShortFlag(uint16 index, bool highpart, uint8 flag)
|
||||
{
|
||||
if (HasShortFlag(index, highpart, flag))
|
||||
RemoveShortFlag(index, highpart, flag);
|
||||
|
|
@ -297,13 +297,13 @@ class MANGOS_DLL_SPEC Object
|
|||
SetShortFlag(index, highpart, flag);
|
||||
}
|
||||
|
||||
bool HasShortFlag( uint16 index, bool highpart, uint8 flag ) const
|
||||
bool HasShortFlag(uint16 index, bool highpart, uint8 flag) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
return (((uint16*)&m_uint32Values[index])[highpart ? 1 : 0] & flag) != 0;
|
||||
}
|
||||
|
||||
void ApplyModShortFlag( uint16 index, bool highpart, uint32 flag, bool apply)
|
||||
void ApplyModShortFlag(uint16 index, bool highpart, uint32 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
SetShortFlag(index, highpart, flag);
|
||||
|
|
@ -311,21 +311,21 @@ class MANGOS_DLL_SPEC Object
|
|||
RemoveShortFlag(index, highpart, flag);
|
||||
}
|
||||
|
||||
void SetFlag64( uint16 index, uint64 newFlag )
|
||||
void SetFlag64(uint16 index, uint64 newFlag)
|
||||
{
|
||||
uint64 oldval = GetUInt64Value(index);
|
||||
uint64 newval = oldval | newFlag;
|
||||
SetUInt64Value(index,newval);
|
||||
}
|
||||
|
||||
void RemoveFlag64( uint16 index, uint64 oldFlag )
|
||||
void RemoveFlag64(uint16 index, uint64 oldFlag)
|
||||
{
|
||||
uint64 oldval = GetUInt64Value(index);
|
||||
uint64 newval = oldval & ~oldFlag;
|
||||
SetUInt64Value(index,newval);
|
||||
}
|
||||
|
||||
void ToggleFlag64( uint16 index, uint64 flag)
|
||||
void ToggleFlag64(uint16 index, uint64 flag)
|
||||
{
|
||||
if (HasFlag64(index, flag))
|
||||
RemoveFlag64(index, flag);
|
||||
|
|
@ -333,13 +333,13 @@ class MANGOS_DLL_SPEC Object
|
|||
SetFlag64(index, flag);
|
||||
}
|
||||
|
||||
bool HasFlag64( uint16 index, uint64 flag ) const
|
||||
bool HasFlag64(uint16 index, uint64 flag) const
|
||||
{
|
||||
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
|
||||
return (GetUInt64Value( index ) & flag) != 0;
|
||||
MANGOS_ASSERT(index < m_valuesCount || PrintIndexError(index , false));
|
||||
return (GetUInt64Value(index) & flag) != 0;
|
||||
}
|
||||
|
||||
void ApplyModFlag64( uint16 index, uint64 flag, bool apply)
|
||||
void ApplyModFlag64(uint16 index, uint64 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
SetFlag64(index, flag);
|
||||
|
|
@ -359,17 +359,17 @@ class MANGOS_DLL_SPEC Object
|
|||
virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
|
||||
|
||||
protected:
|
||||
Object ( );
|
||||
Object();
|
||||
|
||||
void _InitValues();
|
||||
void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh);
|
||||
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh);
|
||||
|
||||
virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const;
|
||||
virtual void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
|
||||
|
||||
virtual void _SetCreateBits(UpdateMask *updateMask, Player *target) const;
|
||||
virtual void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
|
||||
|
||||
void BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const;
|
||||
void BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target ) const;
|
||||
void BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const;
|
||||
void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const;
|
||||
void BuildUpdateDataForPlayer(Player* pl, UpdateDataMapType& update_players);
|
||||
|
||||
uint16 m_objectType;
|
||||
|
|
@ -379,12 +379,12 @@ class MANGOS_DLL_SPEC Object
|
|||
|
||||
union
|
||||
{
|
||||
int32 *m_int32Values;
|
||||
uint32 *m_uint32Values;
|
||||
float *m_floatValues;
|
||||
int32* m_int32Values;
|
||||
uint32* m_uint32Values;
|
||||
float* m_floatValues;
|
||||
};
|
||||
|
||||
uint32 *m_uint32Values_mirror;
|
||||
uint32* m_uint32Values_mirror;
|
||||
|
||||
uint16 m_valuesCount;
|
||||
|
||||
|
|
@ -417,49 +417,49 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
class MANGOS_DLL_SPEC UpdateHelper
|
||||
{
|
||||
public:
|
||||
explicit UpdateHelper(WorldObject * obj) : m_obj(obj) {}
|
||||
explicit UpdateHelper(WorldObject* obj) : m_obj(obj) {}
|
||||
~UpdateHelper() { }
|
||||
|
||||
void Update( uint32 time_diff )
|
||||
void Update(uint32 time_diff)
|
||||
{
|
||||
m_obj->Update( m_obj->m_updateTracker.timeElapsed(), time_diff);
|
||||
m_obj->Update(m_obj->m_updateTracker.timeElapsed(), time_diff);
|
||||
m_obj->m_updateTracker.Reset();
|
||||
}
|
||||
|
||||
private:
|
||||
UpdateHelper( const UpdateHelper& );
|
||||
UpdateHelper& operator=( const UpdateHelper& );
|
||||
UpdateHelper(const UpdateHelper&);
|
||||
UpdateHelper& operator=(const UpdateHelper&);
|
||||
|
||||
WorldObject * const m_obj;
|
||||
WorldObject* const m_obj;
|
||||
};
|
||||
|
||||
virtual ~WorldObject ( ) {}
|
||||
virtual ~WorldObject() {}
|
||||
|
||||
virtual void Update(uint32 /*update_diff*/, uint32 /*time_diff*/) {}
|
||||
|
||||
void _Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
|
||||
void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
|
||||
|
||||
void Relocate(float x, float y, float z, float orientation);
|
||||
void Relocate(float x, float y, float z);
|
||||
|
||||
void SetOrientation(float orientation);
|
||||
|
||||
float GetPositionX( ) const { return m_position.x; }
|
||||
float GetPositionY( ) const { return m_position.y; }
|
||||
float GetPositionZ( ) const { return m_position.z; }
|
||||
void GetPosition( float &x, float &y, float &z ) const
|
||||
float GetPositionX() const { return m_position.x; }
|
||||
float GetPositionY() const { return m_position.y; }
|
||||
float GetPositionZ() const { return m_position.z; }
|
||||
void GetPosition(float& x, float& y, float& z) const
|
||||
{ x = m_position.x; y = m_position.y; z = m_position.z; }
|
||||
void GetPosition( WorldLocation &loc ) const
|
||||
void GetPosition(WorldLocation& loc) const
|
||||
{ loc.mapid = m_mapId; GetPosition(loc.coord_x, loc.coord_y, loc.coord_z); loc.orientation = GetOrientation(); }
|
||||
float GetOrientation( ) const { return m_position.o; }
|
||||
void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const;
|
||||
void GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_bounding_radius, float distance2d, float absAngle) const;
|
||||
void GetClosePoint(float &x, float &y, float &z, float bounding_radius, float distance2d = 0, float angle = 0, const WorldObject* obj = NULL ) const
|
||||
float GetOrientation() const { return m_position.o; }
|
||||
void GetNearPoint2D(float& x, float& y, float distance, float absAngle) const;
|
||||
void GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_bounding_radius, float distance2d, float absAngle) const;
|
||||
void GetClosePoint(float& x, float& y, float& z, float bounding_radius, float distance2d = 0, float angle = 0, const WorldObject* obj = NULL) const
|
||||
{
|
||||
// angle calculated from current orientation
|
||||
GetNearPoint(obj, x, y, z, bounding_radius, distance2d, GetOrientation() + angle);
|
||||
}
|
||||
void GetContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const
|
||||
void GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const
|
||||
{
|
||||
// angle to face `obj` to `this` using distance includes size of `obj`
|
||||
GetNearPoint(obj, x, y, z, obj->GetObjectBoundingRadius(), distance2d, GetAngle(obj));
|
||||
|
|
@ -468,10 +468,10 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
virtual float GetObjectBoundingRadius() const { return DEFAULT_WORLD_OBJECT_SIZE; }
|
||||
|
||||
bool IsPositionValid() const;
|
||||
void UpdateGroundPositionZ(float x, float y, float &z) const;
|
||||
void UpdateAllowedPositionZ(float x, float y, float &z) const;
|
||||
void UpdateGroundPositionZ(float x, float y, float& z) const;
|
||||
void UpdateAllowedPositionZ(float x, float y, float& z) const;
|
||||
|
||||
void GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z ) const;
|
||||
void GetRandomPoint(float x, float y, float z, float distance, float& rand_x, float& rand_y, float& rand_z) const;
|
||||
|
||||
uint32 GetMapId() const { return m_mapId; }
|
||||
uint32 GetInstanceId() const { return m_InstanceId; }
|
||||
|
|
@ -492,7 +492,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
|
||||
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }
|
||||
|
||||
float GetDistance( const WorldObject* obj ) const;
|
||||
float GetDistance(const WorldObject* obj) const;
|
||||
float GetDistance(float x, float y, float z) const;
|
||||
float GetDistance2d(const WorldObject* obj) const;
|
||||
float GetDistance2d(float x, float y) const;
|
||||
|
|
@ -522,9 +522,9 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
|
||||
bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
|
||||
|
||||
float GetAngle( const WorldObject* obj ) const;
|
||||
float GetAngle( const float x, const float y ) const;
|
||||
bool HasInArc( const float arcangle, const WorldObject* obj ) const;
|
||||
float GetAngle(const WorldObject* obj) const;
|
||||
float GetAngle(const float x, const float y) const;
|
||||
bool HasInArc(const float arcangle, const WorldObject* obj) const;
|
||||
bool isInFrontInMap(WorldObject const* target,float distance, float arc = M_PI) const;
|
||||
bool isInBackInMap(WorldObject const* target, float distance, float arc = M_PI) const;
|
||||
bool isInFront(WorldObject const* target,float distance, float arc = M_PI) const;
|
||||
|
|
@ -532,9 +532,9 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
|
||||
virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units
|
||||
|
||||
virtual void SendMessageToSet(WorldPacket *data, bool self);
|
||||
virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self);
|
||||
void SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver);
|
||||
virtual void SendMessageToSet(WorldPacket* data, bool self);
|
||||
virtual void SendMessageToSetInRange(WorldPacket* data, float dist, bool self);
|
||||
void SendMessageToSetExcept(WorldPacket* data, Player const* skipped_receiver);
|
||||
|
||||
void MonsterSay(const char* text, uint32 language, Unit* target = NULL);
|
||||
void MonsterYell(const char* text, uint32 language, Unit* target = NULL);
|
||||
|
|
@ -545,7 +545,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
void MonsterTextEmote(int32 textId, Unit* target, bool IsBossEmote = false);
|
||||
void MonsterWhisper(int32 textId, Unit* receiver, bool IsBossWhisper = false);
|
||||
void MonsterYellToZone(int32 textId, uint32 language, Unit* target);
|
||||
static void BuildMonsterChat(WorldPacket *data, ObjectGuid senderGuid, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName);
|
||||
static void BuildMonsterChat(WorldPacket* data, ObjectGuid senderGuid, uint8 msgtype, char const* text, uint32 language, char const* name, ObjectGuid targetGuid, char const* targetName);
|
||||
|
||||
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
|
||||
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
|
||||
|
|
@ -569,8 +569,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
// low level function for visibility change code, must be define in all main world object subclasses
|
||||
virtual bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const = 0;
|
||||
|
||||
void SetMap(Map * map);
|
||||
Map * GetMap() const { MANGOS_ASSERT(m_currMap); return m_currMap; }
|
||||
void SetMap(Map* map);
|
||||
Map* GetMap() const { MANGOS_ASSERT(m_currMap); return m_currMap; }
|
||||
//used to check all object's GetMap() calls when object is not in world!
|
||||
void ResetMap() { m_currMap = NULL; }
|
||||
|
||||
|
|
@ -579,7 +579,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
|
||||
void AddToClientUpdateList();
|
||||
void RemoveFromClientUpdateList();
|
||||
void BuildUpdateData(UpdateDataMapType &);
|
||||
void BuildUpdateData(UpdateDataMapType&);
|
||||
|
||||
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime, bool asActiveObject = false);
|
||||
|
||||
|
|
@ -607,7 +607,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
std::string m_name;
|
||||
|
||||
private:
|
||||
Map * m_currMap; //current object's Map location
|
||||
Map* m_currMap; //current object's Map location
|
||||
|
||||
uint32 m_mapId; // object at map with map_id
|
||||
uint32 m_InstanceId; // in map copy with instance id
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ACE_Thread_Mutex);
|
|||
ObjectAccessor::ObjectAccessor() {}
|
||||
ObjectAccessor::~ObjectAccessor()
|
||||
{
|
||||
for(Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
|
||||
for (Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
|
||||
{
|
||||
itr->second->RemoveFromWorld();
|
||||
delete itr->second;
|
||||
|
|
@ -48,7 +48,7 @@ ObjectAccessor::~ObjectAccessor()
|
|||
}
|
||||
|
||||
Unit*
|
||||
ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
|
||||
ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid guid)
|
||||
{
|
||||
if (!guid)
|
||||
return NULL;
|
||||
|
|
@ -64,7 +64,7 @@ ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
|
|||
|
||||
Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
||||
{
|
||||
Corpse * ret = HashMapHolder<Corpse>::Find(guid);
|
||||
Corpse* ret = HashMapHolder<Corpse>::Find(guid);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
if (ret->GetMapId() != mapid)
|
||||
|
|
@ -85,12 +85,12 @@ Player* ObjectAccessor::FindPlayer(ObjectGuid guid, bool inWorld /*= true*/)
|
|||
return plr;
|
||||
}
|
||||
|
||||
Player* ObjectAccessor::FindPlayerByName(const char *name)
|
||||
Player* ObjectAccessor::FindPlayerByName(const char* name)
|
||||
{
|
||||
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
if (iter->second->IsInWorld() && ( ::strcmp(name, iter->second->GetName()) == 0 ))
|
||||
if (iter->second->IsInWorld() && (::strcmp(name, iter->second->GetName()) == 0))
|
||||
return iter->second;
|
||||
|
||||
return NULL;
|
||||
|
|
@ -130,13 +130,13 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid)
|
|||
}
|
||||
|
||||
void
|
||||
ObjectAccessor::RemoveCorpse(Corpse *corpse)
|
||||
ObjectAccessor::RemoveCorpse(Corpse* corpse)
|
||||
{
|
||||
MANGOS_ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
|
||||
|
||||
Guard guard(i_corpseGuard);
|
||||
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGuid());
|
||||
if( iter == i_player2corpse.end() )
|
||||
if (iter == i_player2corpse.end())
|
||||
return;
|
||||
|
||||
// build mapid*cellid -> guid_set map
|
||||
|
|
@ -150,7 +150,7 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse)
|
|||
}
|
||||
|
||||
void
|
||||
ObjectAccessor::AddCorpse(Corpse *corpse)
|
||||
ObjectAccessor::AddCorpse(Corpse* corpse)
|
||||
{
|
||||
MANGOS_ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
|
||||
|
||||
|
|
@ -169,8 +169,8 @@ void
|
|||
ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* map)
|
||||
{
|
||||
Guard guard(i_corpseGuard);
|
||||
for(Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter)
|
||||
if(iter->second->GetGrid() == gridpair)
|
||||
for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter)
|
||||
if (iter->second->GetGrid() == gridpair)
|
||||
{
|
||||
// verify, if the corpse in our instance (add only corpses which are)
|
||||
if (map->Instanceable())
|
||||
|
|
@ -190,8 +190,8 @@ ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* ma
|
|||
Corpse*
|
||||
ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia)
|
||||
{
|
||||
Corpse *corpse = GetCorpseForPlayerGUID(player_guid);
|
||||
if(!corpse)
|
||||
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
|
||||
if (!corpse)
|
||||
{
|
||||
//in fact this function is called from several places
|
||||
//even when player doesn't have a corpse, not an error
|
||||
|
|
@ -206,14 +206,14 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia)
|
|||
|
||||
// remove resurrectable corpse from grid object registry (loaded state checked into call)
|
||||
// do not load the map if it's not loaded
|
||||
Map *map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId());
|
||||
Map* map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId());
|
||||
if (map)
|
||||
map->Remove(corpse, false);
|
||||
|
||||
// remove corpse from DB
|
||||
corpse->DeleteFromDB();
|
||||
|
||||
Corpse *bones = NULL;
|
||||
Corpse* bones = NULL;
|
||||
// create the bones only if the map and the grid is loaded at the corpse's location
|
||||
// ignore bones creating option in case insignia
|
||||
if (map && (insignia ||
|
||||
|
|
@ -239,7 +239,7 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia)
|
|||
|
||||
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
if(corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
|
||||
if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
|
||||
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
|
||||
}
|
||||
|
||||
|
|
@ -257,12 +257,12 @@ void ObjectAccessor::RemoveOldCorpses()
|
|||
{
|
||||
time_t now = time(NULL);
|
||||
Player2CorpsesMapType::iterator next;
|
||||
for(Player2CorpsesMapType::iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); itr = next)
|
||||
for (Player2CorpsesMapType::iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); itr = next)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
|
||||
if(!itr->second->IsExpired(now))
|
||||
if (!itr->second->IsExpired(now))
|
||||
continue;
|
||||
|
||||
ConvertCorpseForPlayer(itr->first);
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
|||
|
||||
ObjectAccessor();
|
||||
~ObjectAccessor();
|
||||
ObjectAccessor(const ObjectAccessor &);
|
||||
ObjectAccessor& operator=(const ObjectAccessor &);
|
||||
ObjectAccessor(const ObjectAccessor&);
|
||||
ObjectAccessor& operator=(const ObjectAccessor&);
|
||||
|
||||
public:
|
||||
typedef UNORDERED_MAP<ObjectGuid, Corpse*> Player2CorpsesMapType;
|
||||
|
|
@ -101,7 +101,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
|||
|
||||
// Player access
|
||||
static Player* FindPlayer(ObjectGuid guid, bool inWorld = true);// 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(ObjectGuid guid);
|
||||
|
||||
HashMapHolder<Player>::MapType& GetPlayers()
|
||||
|
|
@ -114,17 +114,17 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
|||
// Corpse access
|
||||
Corpse* GetCorpseForPlayerGUID(ObjectGuid guid);
|
||||
static Corpse* GetCorpseInMap(ObjectGuid guid, uint32 mapid);
|
||||
void RemoveCorpse(Corpse *corpse);
|
||||
void RemoveCorpse(Corpse* corpse);
|
||||
void AddCorpse(Corpse* corpse);
|
||||
void AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* map);
|
||||
Corpse* ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia = false);
|
||||
void RemoveOldCorpses();
|
||||
|
||||
// For call from Player/Corpse AddToWorld/RemoveFromWorld only
|
||||
void AddObject(Corpse *object) { HashMapHolder<Corpse>::Insert(object); }
|
||||
void AddObject(Player *object) { HashMapHolder<Player>::Insert(object); }
|
||||
void RemoveObject(Corpse *object) { HashMapHolder<Corpse>::Remove(object); }
|
||||
void RemoveObject(Player *object) { HashMapHolder<Player>::Remove(object); }
|
||||
void AddObject(Corpse* object) { HashMapHolder<Corpse>::Insert(object); }
|
||||
void AddObject(Player* object) { HashMapHolder<Player>::Insert(object); }
|
||||
void RemoveObject(Corpse* object) { HashMapHolder<Corpse>::Remove(object); }
|
||||
void RemoveObject(Player* object) { HashMapHolder<Player>::Remove(object); }
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -33,30 +33,30 @@ class MANGOS_DLL_DECL ObjectGridRespawnMover
|
|||
public:
|
||||
ObjectGridRespawnMover() {}
|
||||
|
||||
void Move(GridType &grid);
|
||||
void Move(GridType& grid);
|
||||
|
||||
template<class T> void Visit(GridRefManager<T> &) {}
|
||||
void Visit(CreatureMapType &m);
|
||||
template<class T> void Visit(GridRefManager<T>&) {}
|
||||
void Visit(CreatureMapType& m);
|
||||
};
|
||||
|
||||
void
|
||||
ObjectGridRespawnMover::Move(GridType &grid)
|
||||
ObjectGridRespawnMover::Move(GridType& grid)
|
||||
{
|
||||
TypeContainerVisitor<ObjectGridRespawnMover, GridTypeMapContainer > mover(*this);
|
||||
grid.Visit(mover);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectGridRespawnMover::Visit(CreatureMapType &m)
|
||||
ObjectGridRespawnMover::Visit(CreatureMapType& m)
|
||||
{
|
||||
// creature in unloading grid can have respawn point in another grid
|
||||
// if it will be unloaded then it will not respawn in original grid until unload/load original grid
|
||||
// move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn.
|
||||
for(CreatureMapType::iterator iter=m.begin(), next; iter != m.end(); iter = next)
|
||||
for (CreatureMapType::iterator iter=m.begin(), next; iter != m.end(); iter = next)
|
||||
{
|
||||
next = iter; ++next;
|
||||
|
||||
Creature * c = iter->getSource();
|
||||
Creature* c = iter->getSource();
|
||||
|
||||
MANGOS_ASSERT(!c->IsPet() && "ObjectGridRespawnMover don't must be called for pets");
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
|
|||
CellPair resp_val = MaNGOS::ComputeCellPair(resp_x, resp_y);
|
||||
Cell resp_cell(resp_val);
|
||||
|
||||
if(cur_cell.DiffGrid(resp_cell))
|
||||
if (cur_cell.DiffGrid(resp_cell))
|
||||
{
|
||||
c->GetMap()->CreatureRespawnRelocation(c);
|
||||
// false result ignored: will be unload with other creatures at grid
|
||||
|
|
@ -80,16 +80,16 @@ class ObjectWorldLoader
|
|||
{
|
||||
public:
|
||||
explicit ObjectWorldLoader(ObjectGridLoader& gloader)
|
||||
: i_cell(gloader.i_cell), i_grid(gloader.i_grid), i_map(gloader.i_map), i_corpses (0)
|
||||
: i_cell(gloader.i_cell), i_grid(gloader.i_grid), i_map(gloader.i_map), i_corpses(0)
|
||||
{}
|
||||
|
||||
void Visit(CorpseMapType &m);
|
||||
void Visit(CorpseMapType& m);
|
||||
|
||||
template<class T> void Visit(GridRefManager<T>&) { }
|
||||
|
||||
private:
|
||||
Cell i_cell;
|
||||
NGridType &i_grid;
|
||||
NGridType& i_grid;
|
||||
Map* i_map;
|
||||
public:
|
||||
uint32 i_corpses;
|
||||
|
|
@ -99,7 +99,7 @@ template<class T> void addUnitState(T* /*obj*/, CellPair const& /*cell_pair*/)
|
|||
{
|
||||
}
|
||||
|
||||
template<> void addUnitState(Creature *obj, CellPair const& cell_pair)
|
||||
template<> void addUnitState(Creature* obj, CellPair const& cell_pair)
|
||||
{
|
||||
Cell cell(cell_pair);
|
||||
|
||||
|
|
@ -107,17 +107,17 @@ template<> void addUnitState(Creature *obj, CellPair const& cell_pair)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map, GridType& grid)
|
||||
void LoadHelper(CellGuidSet const& guid_set, CellPair& cell, GridRefManager<T>& m, uint32& count, Map* map, GridType& grid)
|
||||
{
|
||||
BattleGround* bg = map->IsBattleGroundOrArena() ? ((BattleGroundMap*)map)->GetBG() : NULL;
|
||||
|
||||
for(CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
|
||||
for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
|
||||
{
|
||||
uint32 guid = *i_guid;
|
||||
|
||||
T* obj = new T;
|
||||
//sLog.outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading",table,guid);
|
||||
if(!obj->LoadFromDB(guid, map))
|
||||
if (!obj->LoadFromDB(guid, map))
|
||||
{
|
||||
delete obj;
|
||||
continue;
|
||||
|
|
@ -128,7 +128,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
|
|||
addUnitState(obj,cell);
|
||||
obj->SetMap(map);
|
||||
obj->AddToWorld();
|
||||
if(obj->isActiveObject())
|
||||
if (obj->isActiveObject())
|
||||
map->AddToActive(obj);
|
||||
|
||||
obj->GetViewPoint().Event_AddedToWorld(&grid);
|
||||
|
|
@ -140,19 +140,19 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
|
|||
}
|
||||
}
|
||||
|
||||
void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType &m, uint32 &count, Map* map, GridType& grid)
|
||||
void LoadHelper(CellCorpseSet const& cell_corpses, CellPair& cell, CorpseMapType& m, uint32& count, Map* map, GridType& grid)
|
||||
{
|
||||
if(cell_corpses.empty())
|
||||
if (cell_corpses.empty())
|
||||
return;
|
||||
|
||||
for(CellCorpseSet::const_iterator itr = cell_corpses.begin(); itr != cell_corpses.end(); ++itr)
|
||||
for (CellCorpseSet::const_iterator itr = cell_corpses.begin(); itr != cell_corpses.end(); ++itr)
|
||||
{
|
||||
if(itr->second != map->GetInstanceId())
|
||||
if (itr->second != map->GetInstanceId())
|
||||
continue;
|
||||
|
||||
uint32 player_lowguid = itr->first;
|
||||
|
||||
Corpse *obj = sObjectAccessor.GetCorpseForPlayerGUID(ObjectGuid(HIGHGUID_PLAYER, player_lowguid));
|
||||
Corpse* obj = sObjectAccessor.GetCorpseForPlayerGUID(ObjectGuid(HIGHGUID_PLAYER, player_lowguid));
|
||||
if (!obj)
|
||||
continue;
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType
|
|||
}
|
||||
|
||||
void
|
||||
ObjectGridLoader::Visit(GameObjectMapType &m)
|
||||
ObjectGridLoader::Visit(GameObjectMapType& m)
|
||||
{
|
||||
uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX();
|
||||
uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY();
|
||||
|
|
@ -178,13 +178,13 @@ ObjectGridLoader::Visit(GameObjectMapType &m)
|
|||
|
||||
CellObjectGuids const& cell_guids = sObjectMgr.GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id);
|
||||
|
||||
GridType& grid = (*i_map->getNGrid(i_cell.GridX(),i_cell.GridY())) (i_cell.CellX(),i_cell.CellY());
|
||||
GridType& grid = (*i_map->getNGrid(i_cell.GridX(),i_cell.GridY()))(i_cell.CellX(),i_cell.CellY());
|
||||
LoadHelper(cell_guids.gameobjects, cell_pair, m, i_gameObjects, i_map, grid);
|
||||
LoadHelper(i_map->GetPersistentState()->GetCellObjectGuids(cell_id).gameobjects, cell_pair, m, i_gameObjects, i_map, grid);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectGridLoader::Visit(CreatureMapType &m)
|
||||
ObjectGridLoader::Visit(CreatureMapType& m)
|
||||
{
|
||||
uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX();
|
||||
uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY();
|
||||
|
|
@ -193,13 +193,13 @@ ObjectGridLoader::Visit(CreatureMapType &m)
|
|||
|
||||
CellObjectGuids const& cell_guids = sObjectMgr.GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id);
|
||||
|
||||
GridType& grid = (*i_map->getNGrid(i_cell.GridX(),i_cell.GridY())) (i_cell.CellX(),i_cell.CellY());
|
||||
GridType& grid = (*i_map->getNGrid(i_cell.GridX(),i_cell.GridY()))(i_cell.CellX(),i_cell.CellY());
|
||||
LoadHelper(cell_guids.creatures, cell_pair, m, i_creatures, i_map, grid);
|
||||
LoadHelper(i_map->GetPersistentState()->GetCellObjectGuids(cell_id).creatures, cell_pair, m, i_creatures, i_map, grid);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectWorldLoader::Visit(CorpseMapType &m)
|
||||
ObjectWorldLoader::Visit(CorpseMapType& m)
|
||||
{
|
||||
uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX();
|
||||
uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY();
|
||||
|
|
@ -208,12 +208,12 @@ ObjectWorldLoader::Visit(CorpseMapType &m)
|
|||
|
||||
// corpses are always added to spawn mode 0 and they are spawned by their instance id
|
||||
CellObjectGuids const& cell_guids = sObjectMgr.GetCellObjectGuids(i_map->GetId(), 0, cell_id);
|
||||
GridType& grid = (*i_map->getNGrid(i_cell.GridX(),i_cell.GridY())) (i_cell.CellX(),i_cell.CellY());
|
||||
GridType& grid = (*i_map->getNGrid(i_cell.GridX(),i_cell.GridY()))(i_cell.CellX(),i_cell.CellY());
|
||||
LoadHelper(cell_guids.corpses, cell_pair, m, i_corpses, i_map, grid);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectGridLoader::Load(GridType &grid)
|
||||
ObjectGridLoader::Load(GridType& grid)
|
||||
{
|
||||
{
|
||||
TypeContainerVisitor<ObjectGridLoader, GridTypeMapContainer > loader(*this);
|
||||
|
|
@ -232,10 +232,10 @@ void ObjectGridLoader::LoadN(void)
|
|||
{
|
||||
i_gameObjects = 0; i_creatures = 0; i_corpses = 0;
|
||||
i_cell.data.Part.cell_y = 0;
|
||||
for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
{
|
||||
i_cell.data.Part.cell_x = x;
|
||||
for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
{
|
||||
i_cell.data.Part.cell_y = y;
|
||||
GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader;
|
||||
|
|
@ -247,9 +247,9 @@ void ObjectGridLoader::LoadN(void)
|
|||
|
||||
void ObjectGridUnloader::MoveToRespawnN()
|
||||
{
|
||||
for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
{
|
||||
for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
{
|
||||
ObjectGridRespawnMover mover;
|
||||
mover.Move(i_grid(x, y));
|
||||
|
|
@ -258,7 +258,7 @@ void ObjectGridUnloader::MoveToRespawnN()
|
|||
}
|
||||
|
||||
void
|
||||
ObjectGridUnloader::Unload(GridType &grid)
|
||||
ObjectGridUnloader::Unload(GridType& grid)
|
||||
{
|
||||
TypeContainerVisitor<ObjectGridUnloader, GridTypeMapContainer > unloader(*this);
|
||||
grid.Visit(unloader);
|
||||
|
|
@ -266,17 +266,17 @@ ObjectGridUnloader::Unload(GridType &grid)
|
|||
|
||||
template<class T>
|
||||
void
|
||||
ObjectGridUnloader::Visit(GridRefManager<T> &m)
|
||||
ObjectGridUnloader::Visit(GridRefManager<T>& m)
|
||||
{
|
||||
// remove all cross-reference before deleting
|
||||
for(typename GridRefManager<T>::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
for (typename GridRefManager<T>::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
iter->getSource()->CleanupsBeforeDelete();
|
||||
|
||||
while(!m.isEmpty())
|
||||
while (!m.isEmpty())
|
||||
{
|
||||
T *obj = m.getFirst()->getSource();
|
||||
T* obj = m.getFirst()->getSource();
|
||||
// if option set then object already saved at this moment
|
||||
if(!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
|
||||
obj->SaveRespawnTime();
|
||||
///- object must be out of world before delete
|
||||
obj->RemoveFromWorld();
|
||||
|
|
@ -286,17 +286,17 @@ ObjectGridUnloader::Visit(GridRefManager<T> &m)
|
|||
}
|
||||
|
||||
void
|
||||
ObjectGridStoper::Stop(GridType &grid)
|
||||
ObjectGridStoper::Stop(GridType& grid)
|
||||
{
|
||||
TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer > stoper(*this);
|
||||
grid.Visit(stoper);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectGridStoper::Visit(CreatureMapType &m)
|
||||
ObjectGridStoper::Visit(CreatureMapType& m)
|
||||
{
|
||||
// stop any fights at grid de-activation and remove dynobjects created at cast by creatures
|
||||
for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
iter->getSource()->CombatStop();
|
||||
iter->getSource()->DeleteThreatList();
|
||||
|
|
@ -304,5 +304,5 @@ ObjectGridStoper::Visit(CreatureMapType &m)
|
|||
}
|
||||
}
|
||||
|
||||
template void ObjectGridUnloader::Visit(GameObjectMapType &);
|
||||
template void ObjectGridUnloader::Visit(DynamicObjectMapType &);
|
||||
template void ObjectGridUnloader::Visit(GameObjectMapType&);
|
||||
template void ObjectGridUnloader::Visit(DynamicObjectMapType&);
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ class MANGOS_DLL_DECL ObjectGridLoader
|
|||
friend class ObjectWorldLoader;
|
||||
|
||||
public:
|
||||
ObjectGridLoader(NGridType &grid, Map* map, const Cell &cell)
|
||||
: i_cell(cell), i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses (0)
|
||||
ObjectGridLoader(NGridType& grid, Map* map, const Cell& cell)
|
||||
: i_cell(cell), i_grid(grid), i_map(map), i_gameObjects(0), i_creatures(0), i_corpses(0)
|
||||
{}
|
||||
|
||||
void Load(GridType &grid);
|
||||
void Visit(GameObjectMapType &m);
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(CorpseMapType &) {}
|
||||
void Load(GridType& grid);
|
||||
void Visit(GameObjectMapType& m);
|
||||
void Visit(CreatureMapType& m);
|
||||
void Visit(CorpseMapType&) {}
|
||||
|
||||
void Visit(DynamicObjectMapType&) { }
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class MANGOS_DLL_DECL ObjectGridLoader
|
|||
|
||||
private:
|
||||
Cell i_cell;
|
||||
NGridType &i_grid;
|
||||
NGridType& i_grid;
|
||||
Map* i_map;
|
||||
uint32 i_gameObjects;
|
||||
uint32 i_creatures;
|
||||
|
|
@ -58,14 +58,14 @@ class MANGOS_DLL_DECL ObjectGridLoader
|
|||
class MANGOS_DLL_DECL ObjectGridUnloader
|
||||
{
|
||||
public:
|
||||
ObjectGridUnloader(NGridType &grid) : i_grid(grid) {}
|
||||
ObjectGridUnloader(NGridType& grid) : i_grid(grid) {}
|
||||
|
||||
void MoveToRespawnN();
|
||||
void UnloadN()
|
||||
{
|
||||
for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
{
|
||||
for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
{
|
||||
GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader;
|
||||
loader.Unload(i_grid(x, y), *this);
|
||||
|
|
@ -73,23 +73,23 @@ class MANGOS_DLL_DECL ObjectGridUnloader
|
|||
}
|
||||
}
|
||||
|
||||
void Unload(GridType &grid);
|
||||
template<class T> void Visit(GridRefManager<T> &m);
|
||||
void Unload(GridType& grid);
|
||||
template<class T> void Visit(GridRefManager<T>& m);
|
||||
private:
|
||||
NGridType &i_grid;
|
||||
NGridType& i_grid;
|
||||
};
|
||||
|
||||
class MANGOS_DLL_DECL ObjectGridStoper
|
||||
{
|
||||
public:
|
||||
ObjectGridStoper(NGridType &grid) : i_grid(grid) {}
|
||||
ObjectGridStoper(NGridType& grid) : i_grid(grid) {}
|
||||
|
||||
void MoveToRespawnN();
|
||||
void StopN()
|
||||
{
|
||||
for(unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
for (unsigned int x=0; x < MAX_NUMBER_OF_CELLS; ++x)
|
||||
{
|
||||
for(unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
for (unsigned int y=0; y < MAX_NUMBER_OF_CELLS; ++y)
|
||||
{
|
||||
GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> loader;
|
||||
loader.Stop(i_grid(x, y), *this);
|
||||
|
|
@ -97,12 +97,12 @@ class MANGOS_DLL_DECL ObjectGridStoper
|
|||
}
|
||||
}
|
||||
|
||||
void Stop(GridType &grid);
|
||||
void Visit(CreatureMapType &m);
|
||||
void Stop(GridType& grid);
|
||||
void Visit(CreatureMapType& m);
|
||||
|
||||
template<class NONACTIVE> void Visit(GridRefManager<NONACTIVE> &) {}
|
||||
template<class NONACTIVE> void Visit(GridRefManager<NONACTIVE>&) {}
|
||||
private:
|
||||
NGridType &i_grid;
|
||||
NGridType& i_grid;
|
||||
};
|
||||
|
||||
typedef GridLoader<Player, AllWorldObjectTypes, AllGridObjectTypes> GridLoaderType;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
char const* ObjectGuid::GetTypeName(HighGuid high)
|
||||
{
|
||||
switch(high)
|
||||
switch (high)
|
||||
{
|
||||
case HIGHGUID_ITEM: return "Item";
|
||||
case HIGHGUID_PLAYER: return "Player";
|
||||
|
|
@ -80,7 +80,7 @@ ByteBuffer& operator<< (ByteBuffer& buf, ObjectGuid const& guid)
|
|||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer &operator>>(ByteBuffer& buf, ObjectGuid& guid)
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid)
|
||||
{
|
||||
guid.Set(buf.read<uint64>());
|
||||
return buf;
|
||||
|
|
@ -92,7 +92,7 @@ ByteBuffer& operator<< (ByteBuffer& buf, PackedGuid const& guid)
|
|||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer &operator>>(ByteBuffer& buf, PackedGuidReader const& guid)
|
||||
ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid)
|
||||
{
|
||||
guid.m_guidPtr->Set(buf.readPackGUID());
|
||||
return buf;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class MANGOS_DLL_SPEC ObjectGuid
|
|||
|
||||
static TypeID GetTypeId(HighGuid high)
|
||||
{
|
||||
switch(high)
|
||||
switch (high)
|
||||
{
|
||||
case HIGHGUID_ITEM: return TYPEID_ITEM;
|
||||
//case HIGHGUID_CONTAINER: return TYPEID_CONTAINER; HIGHGUID_CONTAINER==HIGHGUID_ITEM currently
|
||||
|
|
@ -167,7 +167,7 @@ class MANGOS_DLL_SPEC ObjectGuid
|
|||
|
||||
TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
|
||||
|
||||
bool operator! () const { return IsEmpty(); }
|
||||
bool operator!() const { return IsEmpty(); }
|
||||
bool operator== (ObjectGuid const& guid) const { return GetRawValue() == guid.GetRawValue(); }
|
||||
bool operator!= (ObjectGuid const& guid) const { return GetRawValue() != guid.GetRawValue(); }
|
||||
bool operator< (ObjectGuid const& guid) const { return GetRawValue() < guid.GetRawValue(); }
|
||||
|
|
@ -180,7 +180,7 @@ class MANGOS_DLL_SPEC ObjectGuid
|
|||
private: // internal functions
|
||||
static bool HasEntry(HighGuid high)
|
||||
{
|
||||
switch(high)
|
||||
switch (high)
|
||||
{
|
||||
case HIGHGUID_ITEM:
|
||||
case HIGHGUID_PLAYER:
|
||||
|
|
@ -261,16 +261,16 @@ inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this);
|
|||
|
||||
HASH_NAMESPACE_START
|
||||
|
||||
template<>
|
||||
class hash<ObjectGuid>
|
||||
{
|
||||
template<>
|
||||
class hash<ObjectGuid>
|
||||
{
|
||||
public:
|
||||
|
||||
size_t operator() (ObjectGuid const& key) const
|
||||
size_t operator()(ObjectGuid const& key) const
|
||||
{
|
||||
return hash<uint64>()(key.GetRawValue());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
HASH_NAMESPACE_END
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -123,7 +123,7 @@ class FindCreatureData
|
|||
FindCreatureData(uint32 id, Player* player) : i_id(id), i_player(player),
|
||||
i_anyData(NULL), i_mapData(NULL), i_mapDist(0.0f), i_spawnedData(NULL), i_spawnedDist(0.0f) {}
|
||||
|
||||
bool operator() (CreatureDataPair const& dataPair);
|
||||
bool operator()(CreatureDataPair const& dataPair);
|
||||
CreatureDataPair const* GetResult() const;
|
||||
|
||||
private:
|
||||
|
|
@ -146,7 +146,7 @@ class FindGOData
|
|||
FindGOData(uint32 id, Player* player) : i_id(id), i_player(player),
|
||||
i_anyData(NULL), i_mapData(NULL), i_mapDist(0.0f), i_spawnedData(NULL), i_spawnedDist(0.0f) {}
|
||||
|
||||
bool operator() (GameObjectDataPair const& dataPair);
|
||||
bool operator()(GameObjectDataPair const& dataPair);
|
||||
GameObjectDataPair const* GetResult() const;
|
||||
|
||||
private:
|
||||
|
|
@ -180,7 +180,7 @@ typedef std::pair<QuestRelationsMap::const_iterator, QuestRelationsMap::const_it
|
|||
|
||||
struct PetLevelInfo
|
||||
{
|
||||
PetLevelInfo() : health(0), mana(0) { for(int i=0; i < MAX_STATS; ++i ) stats[i] = 0; }
|
||||
PetLevelInfo() : health(0), mana(0) { for (int i=0; i < MAX_STATS; ++i) stats[i] = 0; }
|
||||
|
||||
uint16 stats[MAX_STATS];
|
||||
uint16 health;
|
||||
|
|
@ -337,7 +337,8 @@ typedef std::multimap<uint32 /*zoneId*/, GraveYardData> GraveYardMap;
|
|||
typedef std::pair<GraveYardMap::const_iterator, GraveYardMap::const_iterator> GraveYardMapBounds;
|
||||
|
||||
enum ConditionType
|
||||
{ // value1 value2 for the Condition enumed
|
||||
{
|
||||
// value1 value2 for the Condition enumed
|
||||
CONDITION_NOT = -3, // cond-id-1 0 returns !cond-id-1
|
||||
CONDITION_OR = -2, // cond-id-1 cond-id-2 returns cond-id-1 OR cond-id-2
|
||||
CONDITION_AND = -1, // cond-id-1 cond-id-2 returns cond-id-1 AND cond-id-2
|
||||
|
|
@ -422,7 +423,7 @@ enum SkillRangeType
|
|||
SKILL_RANGE_NONE, // 0..0 always
|
||||
};
|
||||
|
||||
SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial);
|
||||
SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial);
|
||||
|
||||
#define MAX_PLAYER_NAME 12 // max allowed by client name length
|
||||
#define MAX_INTERNAL_PLAYER_NAME 15 // max server internal player name length ( > MAX_PLAYER_NAME for support declined names )
|
||||
|
|
@ -488,7 +489,7 @@ class ObjectMgr
|
|||
typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap;
|
||||
|
||||
void LoadGameobjectInfo();
|
||||
void AddGameobjectInfo(GameObjectInfo *goinfo);
|
||||
void AddGameobjectInfo(GameObjectInfo* goinfo);
|
||||
|
||||
void PackGroupIds();
|
||||
Group* GetGroupById(uint32 id) const;
|
||||
|
|
@ -510,30 +511,30 @@ class ObjectMgr
|
|||
|
||||
PlayerClassInfo const* GetPlayerClassInfo(uint32 class_) const
|
||||
{
|
||||
if(class_ >= MAX_CLASSES) return NULL;
|
||||
if (class_ >= MAX_CLASSES) return NULL;
|
||||
return &playerClassInfo[class_];
|
||||
}
|
||||
void GetPlayerClassLevelInfo(uint32 class_,uint32 level, PlayerClassLevelInfo* info) const;
|
||||
|
||||
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
|
||||
{
|
||||
if(race >= MAX_RACES) return NULL;
|
||||
if(class_ >= MAX_CLASSES) return NULL;
|
||||
if (race >= MAX_RACES) return NULL;
|
||||
if (class_ >= MAX_CLASSES) return NULL;
|
||||
PlayerInfo const* info = &playerInfo[race][class_];
|
||||
if(info->displayId_m==0 || info->displayId_f==0) return NULL;
|
||||
if (info->displayId_m==0 || info->displayId_f==0) return NULL;
|
||||
return info;
|
||||
}
|
||||
void GetPlayerLevelInfo(uint32 race, uint32 class_,uint32 level, PlayerLevelInfo* info) const;
|
||||
|
||||
ObjectGuid GetPlayerGuidByName(std::string name) const;
|
||||
bool GetPlayerNameByGUID(ObjectGuid guid, std::string &name) const;
|
||||
bool GetPlayerNameByGUID(ObjectGuid guid, std::string& name) const;
|
||||
Team GetPlayerTeamByGUID(ObjectGuid guid) const;
|
||||
uint32 GetPlayerAccountIdByGUID(ObjectGuid guid) const;
|
||||
uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const;
|
||||
|
||||
uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid, Team team );
|
||||
void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost);
|
||||
uint32 GetTaxiMountDisplayId( uint32 id, Team team, bool allowed_alt_team = false);
|
||||
uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, Team team);
|
||||
void GetTaxiPath(uint32 source, uint32 destination, uint32& path, uint32& cost);
|
||||
uint32 GetTaxiMountDisplayId(uint32 id, Team team, bool allowed_alt_team = false);
|
||||
|
||||
Quest const* GetQuestTemplate(uint32 quest_id) const
|
||||
{
|
||||
|
|
@ -545,7 +546,7 @@ class ObjectMgr
|
|||
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
|
||||
{
|
||||
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
|
||||
if(itr != mQuestAreaTriggerMap.end())
|
||||
if (itr != mQuestAreaTriggerMap.end())
|
||||
return itr->second;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -569,8 +570,8 @@ class ObjectMgr
|
|||
|
||||
AreaTrigger const* GetAreaTrigger(uint32 trigger) const
|
||||
{
|
||||
AreaTriggerMap::const_iterator itr = mAreaTriggers.find( trigger );
|
||||
if( itr != mAreaTriggers.end( ) )
|
||||
AreaTriggerMap::const_iterator itr = mAreaTriggers.find(trigger);
|
||||
if (itr != mAreaTriggers.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -590,7 +591,7 @@ class ObjectMgr
|
|||
ReputationOnKillEntry const* GetReputationOnKillEntry(uint32 id) const
|
||||
{
|
||||
RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
|
||||
if(itr != mRepOnKill.end())
|
||||
if (itr != mRepOnKill.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -607,7 +608,7 @@ class ObjectMgr
|
|||
PointOfInterest const* GetPointOfInterest(uint32 id) const
|
||||
{
|
||||
PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
|
||||
if(itr != mPointsOfInterest.end())
|
||||
if (itr != mPointsOfInterest.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -615,7 +616,7 @@ class ObjectMgr
|
|||
QuestPOIVector const* GetQuestPOIVector(uint32 questId)
|
||||
{
|
||||
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
|
||||
if(itr != mQuestPOIMap.end())
|
||||
if (itr != mQuestPOIMap.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -759,7 +760,7 @@ class ObjectMgr
|
|||
if (map_itr == m_mailLevelRewardMap.end())
|
||||
return NULL;
|
||||
|
||||
for(MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
|
||||
for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
|
||||
if (set_itr->raceMask & raceMask)
|
||||
return &*set_itr;
|
||||
|
||||
|
|
@ -769,7 +770,7 @@ class ObjectMgr
|
|||
WeatherZoneChances const* GetWeatherChances(uint32 zone_id) const
|
||||
{
|
||||
WeatherZoneMap::const_iterator itr = mWeatherZoneMap.find(zone_id);
|
||||
if(itr != mWeatherZoneMap.end())
|
||||
if (itr != mWeatherZoneMap.end())
|
||||
return &itr->second;
|
||||
else
|
||||
return NULL;
|
||||
|
|
@ -778,7 +779,7 @@ class ObjectMgr
|
|||
CreatureDataPair const* GetCreatureDataPair(uint32 guid) const
|
||||
{
|
||||
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
|
||||
if(itr==mCreatureDataMap.end()) return NULL;
|
||||
if (itr==mCreatureDataMap.end()) return NULL;
|
||||
return &*itr;
|
||||
}
|
||||
|
||||
|
|
@ -802,7 +803,7 @@ class ObjectMgr
|
|||
CreatureLocale const* GetCreatureLocale(uint32 entry) const
|
||||
{
|
||||
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
|
||||
if(itr==mCreatureLocaleMap.end()) return NULL;
|
||||
if (itr==mCreatureLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -811,14 +812,14 @@ class ObjectMgr
|
|||
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
|
||||
{
|
||||
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
|
||||
if(itr==mGameObjectLocaleMap.end()) return NULL;
|
||||
if (itr==mGameObjectLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
ItemLocale const* GetItemLocale(uint32 entry) const
|
||||
{
|
||||
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
|
||||
if(itr==mItemLocaleMap.end()) return NULL;
|
||||
if (itr==mItemLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -827,7 +828,7 @@ class ObjectMgr
|
|||
QuestLocale const* GetQuestLocale(uint32 entry) const
|
||||
{
|
||||
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
|
||||
if(itr==mQuestLocaleMap.end()) return NULL;
|
||||
if (itr==mQuestLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -836,39 +837,39 @@ class ObjectMgr
|
|||
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
|
||||
{
|
||||
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
|
||||
if(itr==mNpcTextLocaleMap.end()) return NULL;
|
||||
if (itr==mNpcTextLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
typedef std::string NpcTextArray[MAX_GOSSIP_TEXT_OPTIONS];
|
||||
void GetNpcTextLocaleStringsAll(uint32 entry, int32 loc_idx, NpcTextArray *text0_Ptr, NpcTextArray* text1_Ptr) const;
|
||||
void GetNpcTextLocaleStringsAll(uint32 entry, int32 loc_idx, NpcTextArray* text0_Ptr, NpcTextArray* text1_Ptr) const;
|
||||
void GetNpcTextLocaleStrings0(uint32 entry, int32 loc_idx, std::string* text0_0_Ptr, std::string* text1_0_Ptr) const;
|
||||
|
||||
PageTextLocale const* GetPageTextLocale(uint32 entry) const
|
||||
{
|
||||
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
|
||||
if(itr==mPageTextLocaleMap.end()) return NULL;
|
||||
if (itr==mPageTextLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
|
||||
{
|
||||
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
|
||||
if(itr==mGossipMenuItemsLocaleMap.end()) return NULL;
|
||||
if (itr==mGossipMenuItemsLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
|
||||
{
|
||||
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
|
||||
if(itr==mPointOfInterestLocaleMap.end()) return NULL;
|
||||
if (itr==mPointOfInterestLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GameObjectDataPair const* GetGODataPair(uint32 guid) const
|
||||
{
|
||||
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
|
||||
if(itr==mGameObjectDataMap.end()) return NULL;
|
||||
if (itr==mGameObjectDataMap.end()) return NULL;
|
||||
return &*itr;
|
||||
}
|
||||
|
||||
|
|
@ -892,12 +893,12 @@ class ObjectMgr
|
|||
MangosStringLocale const* GetMangosStringLocale(int32 entry) const
|
||||
{
|
||||
MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry);
|
||||
if(itr==mMangosStringLocaleMap.end()) return NULL;
|
||||
if (itr==mMangosStringLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
const char *GetMangosString(int32 entry, int locale_idx) const;
|
||||
const char *GetMangosStringForDBCLocale(int32 entry) const { return GetMangosString(entry,DBCLocaleIndex); }
|
||||
const char* GetMangosString(int32 entry, int locale_idx) const;
|
||||
const char* GetMangosStringForDBCLocale(int32 entry) const { return GetMangosString(entry,DBCLocaleIndex); }
|
||||
int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; }
|
||||
void SetDBCLocaleIndex(uint32 lang) { DBCLocaleIndex = GetIndexForLocale(LocaleConstant(lang)); }
|
||||
|
||||
|
|
@ -921,9 +922,9 @@ class ObjectMgr
|
|||
bool IsReservedName(const std::string& name) const;
|
||||
|
||||
// name with valid structure and symbols
|
||||
static uint8 CheckPlayerName( const std::string& name, bool create = false );
|
||||
static PetNameInvalidReason CheckPetName( const std::string& name );
|
||||
static bool IsValidCharterName( const std::string& name );
|
||||
static uint8 CheckPlayerName(const std::string& name, bool create = false);
|
||||
static PetNameInvalidReason CheckPetName(const std::string& name);
|
||||
static bool IsValidCharterName(const std::string& name);
|
||||
|
||||
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
|
||||
|
||||
|
|
@ -934,7 +935,7 @@ class ObjectMgr
|
|||
uint16 GetConditionId(ConditionType condition, uint32 value1, uint32 value2);
|
||||
bool IsPlayerMeetToCondition(Player const* player, uint16 condition_id) const
|
||||
{
|
||||
if(condition_id >= mConditions.size())
|
||||
if (condition_id >= mConditions.size())
|
||||
return false;
|
||||
|
||||
return mConditions[condition_id].Meets(player);
|
||||
|
|
@ -946,7 +947,7 @@ class ObjectMgr
|
|||
GameTele const* GetGameTele(uint32 id) const
|
||||
{
|
||||
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
|
||||
if(itr==m_GameTeleMap.end()) return NULL;
|
||||
if (itr==m_GameTeleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -958,7 +959,7 @@ class ObjectMgr
|
|||
uint32 GetNpcGossip(uint32 entry) const
|
||||
{
|
||||
CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry);
|
||||
if(iter == m_mCacheNpcTextIdMap.end())
|
||||
if (iter == m_mCacheNpcTextIdMap.end())
|
||||
return 0;
|
||||
|
||||
return iter->second;
|
||||
|
|
@ -967,7 +968,7 @@ class ObjectMgr
|
|||
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
|
||||
{
|
||||
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry);
|
||||
if(iter == m_mCacheTrainerSpellMap.end())
|
||||
if (iter == m_mCacheTrainerSpellMap.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
|
|
@ -976,7 +977,7 @@ class ObjectMgr
|
|||
TrainerSpellData const* GetNpcTrainerTemplateSpells(uint32 entry) const
|
||||
{
|
||||
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerTemplateSpellMap.find(entry);
|
||||
if(iter == m_mCacheTrainerTemplateSpellMap.end())
|
||||
if (iter == m_mCacheTrainerTemplateSpellMap.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
|
|
@ -985,7 +986,7 @@ class ObjectMgr
|
|||
VendorItemData const* GetNpcVendorItemList(uint32 entry) const
|
||||
{
|
||||
CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry);
|
||||
if(iter == m_mCacheVendorItemMap.end())
|
||||
if (iter == m_mCacheVendorItemMap.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
|
|
@ -994,7 +995,7 @@ class ObjectMgr
|
|||
VendorItemData const* GetNpcVendorTemplateItemList(uint32 entry) const
|
||||
{
|
||||
CacheVendorItemMap::const_iterator iter = m_mCacheVendorTemplateItemMap.find(entry);
|
||||
if(iter == m_mCacheVendorTemplateItemMap.end())
|
||||
if (iter == m_mCacheVendorTemplateItemMap.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ void ObjectPosSelector::UpdateNextAreaStart(UsedAreaSide side)
|
|||
bool ObjectPosSelector::NextAngle(float& angle)
|
||||
{
|
||||
// loop until both side fail and leave 0..PI
|
||||
for(;;)
|
||||
for (;;)
|
||||
{
|
||||
// ++ direction less updated
|
||||
if (m_stepAngle[USED_POS_PLUS] < M_PI_F && m_stepAngle[USED_POS_PLUS] <= m_stepAngle[USED_POS_MINUS])
|
||||
|
|
@ -212,7 +212,7 @@ bool ObjectPosSelector::NextAngle(float& angle)
|
|||
* @return true, if angle found
|
||||
*
|
||||
*/
|
||||
bool ObjectPosSelector::NextSideAngle(UsedAreaSide side, float &angle )
|
||||
bool ObjectPosSelector::NextSideAngle(UsedAreaSide side, float& angle)
|
||||
{
|
||||
// next possible angle
|
||||
m_stepAngle[side] += (m_searcherHalfSize + 0.01);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue