aboutsummaryrefslogtreecommitdiff
path: root/src/game/CharacterHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/CharacterHandler.cpp')
-rw-r--r--src/game/CharacterHandler.cpp174
1 files changed, 87 insertions, 87 deletions
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index 3b0981422c8..58952daaa72 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -84,7 +84,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid));
- if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
+ if (sWorld.getConfig(CONFIG_DECLINED_NAMES_USED))
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'",GUID_LOPART(m_guid));
// in other case still be dummy query
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", GUID_LOPART(m_guid));
@@ -111,7 +111,7 @@ class CharacterHandler
void HandleCharEnumCallback(QueryResult_AutoPtr result, uint32 account)
{
WorldSession * session = sWorld.FindSession(account);
- if(!session)
+ if (!session)
return;
session->HandleCharEnum(result);
}
@@ -119,7 +119,7 @@ class CharacterHandler
{
if (!holder) return;
WorldSession *session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
- if(!session)
+ if (!session)
{
delete holder;
return;
@@ -136,13 +136,13 @@ void WorldSession::HandleCharEnum(QueryResult_AutoPtr result)
data << num;
- if( result )
+ if ( result )
{
do
{
uint32 guidlow = (*result)[0].GetUInt32();
sLog.outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId());
- if(Player::BuildEnumData(result, &data))
+ if (Player::BuildEnumData(result, &data))
++num;
}
while ( result->NextRow() );
@@ -195,9 +195,9 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
- if(GetSecurity() == SEC_PLAYER)
+ if (GetSecurity() == SEC_PLAYER)
{
- if(uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
+ if (uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
{
bool disabled = false;
@@ -208,7 +208,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
case HORDE: disabled = mask & (1<<1); break;
}
- if(disabled)
+ if (disabled)
{
data << (uint8)CHAR_CREATE_DISABLED;
SendPacket( &data );
@@ -220,7 +220,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
- if( !classEntry || !raceEntry )
+ if ( !classEntry || !raceEntry )
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket( &data );
@@ -309,7 +309,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// speedup check for heroic class disabled case
uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
- if(heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
+ if (heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -318,7 +318,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// speedup check for heroic class disabled case
uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING);
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
{
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
SendPacket( &data );
@@ -333,26 +333,26 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// if 0 then allowed creating without any characters
bool have_req_level_for_heroic = (req_level_for_heroic==0);
- if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
+ if (!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
{
QueryResult_AutoPtr result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s",
GetAccountId(), (skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
- if(result2)
+ if (result2)
{
uint32 team_= Player::TeamForRace(race_);
Field* field = result2->Fetch();
uint8 acc_race = field[1].GetUInt32();
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
uint8 acc_class = field[2].GetUInt32();
- if(acc_class == CLASS_DEATH_KNIGHT)
+ if (acc_class == CLASS_DEATH_KNIGHT)
{
- if(heroic_free_slots > 0)
+ if (heroic_free_slots > 0)
--heroic_free_slots;
- if(heroic_free_slots==0)
+ if (heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -360,10 +360,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
- if(!have_req_level_for_heroic)
+ if (!have_req_level_for_heroic)
{
uint32 acc_level = field[0].GetUInt32();
- if(acc_level >= req_level_for_heroic)
+ if (acc_level >= req_level_for_heroic)
have_req_level_for_heroic = true;
}
}
@@ -373,10 +373,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
if (!AllowTwoSideAccounts)
{
uint32 acc_team=0;
- if(acc_race > 0)
+ if (acc_race > 0)
acc_team = Player::TeamForRace(acc_race);
- if(acc_team != team_)
+ if (acc_team != team_)
{
data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION;
SendPacket( &data );
@@ -388,24 +388,24 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
// TODO: check if cinematic already shown? (already logged in?; cinematic field)
while ((skipCinematics == 1 && !have_same_race) || class_ == CLASS_DEATH_KNIGHT)
{
- if(!result2->NextRow())
+ if (!result2->NextRow())
break;
field = result2->Fetch();
acc_race = field[1].GetUInt32();
- if(!have_same_race)
+ if (!have_same_race)
have_same_race = race_ == acc_race;
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
uint8 acc_class = field[2].GetUInt32();
- if(acc_class == CLASS_DEATH_KNIGHT)
+ if (acc_class == CLASS_DEATH_KNIGHT)
{
- if(heroic_free_slots > 0)
+ if (heroic_free_slots > 0)
--heroic_free_slots;
- if(heroic_free_slots==0)
+ if (heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
@@ -413,10 +413,10 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
- if(!have_req_level_for_heroic)
+ if (!have_req_level_for_heroic)
{
uint32 acc_level = field[0].GetUInt32();
- if(acc_level >= req_level_for_heroic)
+ if (acc_level >= req_level_for_heroic)
have_req_level_for_heroic = true;
}
}
@@ -424,7 +424,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
}
- if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
+ if (GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
{
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
SendPacket( &data );
@@ -436,7 +436,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
recv_data >> gender >> skin >> face;
recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
- if(recv_data.rpos() < recv_data.wpos())
+ if (recv_data.rpos() < recv_data.wpos())
{
uint8 unk;
recv_data >> unk;
@@ -444,7 +444,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
}
Player * pNewChar = new Player(this);
- if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
+ if (!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
{
// Player not create (race/class problem?)
pNewChar->CleanupsBeforeDelete();
@@ -485,14 +485,14 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
recv_data >> guid;
// can't delete loaded character
- if(objmgr.GetPlayer(guid))
+ if (objmgr.GetPlayer(guid))
return;
uint32 accountId = 0;
std::string name;
// is guild leader
- if(objmgr.GetGuildByLeader(guid))
+ if (objmgr.GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
@@ -501,7 +501,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
// is arena team captain
- if(objmgr.GetArenaTeamByCaptain(guid))
+ if (objmgr.GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
@@ -510,7 +510,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", GUID_LOPART(guid));
- if(result)
+ if (result)
{
Field *fields = result->Fetch();
accountId = fields[0].GetUInt32();
@@ -518,14 +518,14 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
}
// prevent deleting other players' characters using cheating tools
- if(accountId != GetAccountId())
+ if (accountId != GetAccountId())
return;
std::string IP_str = GetRemoteAddress();
sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid));
- if(sLog.IsOutCharDump()) // optimize GetPlayerDump call
+ if (sLog.IsOutCharDump()) // optimize GetPlayerDump call
{
std::string dump = PlayerDumpWriter().GetDump(GUID_LOPART(guid));
sLog.outCharDump(dump.c_str(),GetAccountId(),GUID_LOPART(guid),name.c_str());
@@ -540,7 +540,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
{
- if(PlayerLoading() || GetPlayer() != NULL)
+ if (PlayerLoading() || GetPlayer() != NULL)
{
sLog.outError("Player tryes to login again, AccountId = %d",GetAccountId());
return;
@@ -554,7 +554,7 @@ void WorldSession::HandlePlayerLoginOpcode( WorldPacket & recv_data )
recv_data >> playerGuid;
LoginQueryHolder *holder = new LoginQueryHolder(GetAccountId(), playerGuid);
- if(!holder->Initialize())
+ if (!holder->Initialize())
{
delete holder; // delete all unprocessed queries
m_playerLoading = false;
@@ -573,7 +573,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
ChatHandler chH = ChatHandler(pCurrChar);
// "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
- if(!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
+ if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
{
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
delete pCurrChar; // delete it manually
@@ -637,7 +637,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" );
// send server info
- if(sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
+ if (sWorld.getConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION);
DEBUG_LOG( "WORLD: Sent server info" );
@@ -646,22 +646,22 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
QueryResult_AutoPtr resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
- if(resultGuild)
+ if (resultGuild)
{
Field *fields = resultGuild->Fetch();
pCurrChar->SetInGuild(fields[0].GetUInt32());
pCurrChar->SetRank(fields[1].GetUInt32());
}
- else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
+ else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
{
pCurrChar->SetInGuild(0);
pCurrChar->SetRank(0);
}
- if(pCurrChar->GetGuildId() != 0)
+ if (pCurrChar->GetGuildId() != 0)
{
Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId());
- if(guild)
+ if (guild)
{
data.Initialize(SMSG_GUILD_EVENT, (2+guild->GetMOTD().size()+1));
data << uint8(GE_MOTD);
@@ -696,11 +696,11 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SendInitialPacketsBeforeAddToMap();
//Show cinematic at the first time that player login
- if( !pCurrChar->getCinematic() )
+ if ( !pCurrChar->getCinematic() )
{
pCurrChar->setCinematic(1);
- if(ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
+ if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
{
if (cEntry->CinematicSequence)
pCurrChar->SendCinematicStart(cEntry->CinematicSequence);
@@ -716,7 +716,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if (!pCurrChar->GetMap()->Add(pCurrChar))
{
AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId());
- if(at)
+ if (at)
pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation());
else
pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation());
@@ -732,7 +732,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SetInGameTime( getMSTime() );
// announce group about member online (must be after add to player list to receive announce to self)
- if(Group *group = pCurrChar->GetGroup())
+ if (Group *group = pCurrChar->GetGroup())
{
//pCurrChar->groupInfo.group->SendInit(this); // useless
group->SendUpdate();
@@ -748,7 +748,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
if (pCurrChar->m_deathState != ALIVE)
{
// not blizz like, we must correctly save and load player instead...
- if(pCurrChar->getRace() == RACE_NIGHTELF)
+ if (pCurrChar->getRace() == RACE_NIGHTELF)
pCurrChar->CastSpell(pCurrChar, 20584, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
@@ -758,27 +758,27 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->ContinueTaxiFlight();
// reset for all pets before pet loading
- if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
+ if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
Pet::resetTalentsForAllPetsOf(pCurrChar);
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
pCurrChar->LoadPet();
// Set FFA PvP for non GM in non-rest mode
- if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
+ if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
- if(pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
+ if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
pCurrChar->SetContestedPvP();
// Apply at_login requests
- if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
+ if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
{
pCurrChar->resetSpells();
SendNotification(LANG_RESET_SPELLS);
}
- if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
+ if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS))
{
pCurrChar->resetTalents(true);
pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state
@@ -789,20 +789,20 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
// show time before shutdown if shutdown planned.
- if(sWorld.IsShutdowning())
+ if (sWorld.IsShutdowning())
sWorld.ShutdownMsg(true,pCurrChar);
- if(sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
+ if (sWorld.getConfig(CONFIG_ALL_TAXI_PATHS))
pCurrChar->SetTaxiCheater(true);
- if(pCurrChar->isGameMaster())
+ if (pCurrChar->isGameMaster())
SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)",
GetAccountId(),IP_str.c_str(),pCurrChar->GetName() ,pCurrChar->GetGUIDLow());
- if(!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
+ if (!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
m_playerLoading = false;
@@ -840,7 +840,7 @@ void WorldSession::HandleSetFactionCheat( WorldPacket & /*recv_data*/ )
for (itr = GetPlayer()->factions.begin(); itr != GetPlayer()->factions.end(); ++itr)
{
- if(itr->ReputationListID == FactionID)
+ if (itr->ReputationListID == FactionID)
{
itr->Standing += Standing;
itr->Flags = (itr->Flags | 1);
@@ -970,7 +970,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string newname)
{
WorldSession * session = sWorld.FindSession(accountId);
- if(!session)
+ if (!session)
return;
if (!result)
@@ -1005,7 +1005,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
// not accept declined names for unsupported languages
std::string name;
- if(!objmgr.GetPlayerNameByGUID(guid, name))
+ if (!objmgr.GetPlayerNameByGUID(guid, name))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1015,7 +1015,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
}
std::wstring wname;
- if(!Utf8toWStr(name, wname))
+ if (!Utf8toWStr(name, wname))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1024,7 +1024,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
return;
}
- if(!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
+ if (!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1038,7 +1038,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
recv_data >> name2;
- if(name2 != name) // character have different name
+ if (name2 != name) // character have different name
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1050,7 +1050,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
recv_data >> declinedname.name[i];
- if(!normalizePlayerName(declinedname.name[i]))
+ if (!normalizePlayerName(declinedname.name[i]))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1060,7 +1060,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
}
}
- if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
+ if (!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
data << uint32(1);
@@ -1093,17 +1093,17 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
- if(!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
+ if (!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
return;
BarberShopStyleEntry const* bs_facialHair = sBarberShopStyleStore.LookupEntry(FacialHair);
- if(!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
+ if (!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
return;
BarberShopStyleEntry const* bs_skinColor = sBarberShopStyleStore.LookupEntry(SkinColor);
- if( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
+ if ( bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
return;
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
@@ -1111,7 +1111,7 @@ void WorldSession::HandleAlterAppearance( WorldPacket & recv_data )
// 0 - ok
// 1,3 - not enough money
// 2 - you have to seat on barber chair
- if(_player->GetMoney() < Cost)
+ if (_player->GetMoney() < Cost)
{
WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
data << uint32(1); // no money
@@ -1144,15 +1144,15 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data )
uint32 slot;
recv_data >> slot;
- if(slot >= MAX_GLYPH_SLOT_INDEX)
+ if (slot >= MAX_GLYPH_SLOT_INDEX)
{
sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot);
return;
}
- if(uint32 glyph = _player->GetGlyph(slot))
+ if (uint32 glyph = _player->GetGlyph(slot))
{
- if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
+ if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
{
_player->RemoveAurasDueToSpell(gp->SpellId);
_player->SetGlyph(slot, 0);
@@ -1232,7 +1232,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
}
CharacterDatabase.escape_string(newname);
- if(QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
+ if (QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
{
std::string oldname = result->Fetch()[0].GetCppString();
std::string IP_str = GetRemoteAddress();
@@ -1260,12 +1260,12 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
sLog.outDebug("CMSG_EQUIPMENT_SET_SAVE");
uint64 setGuid;
- if(!recv_data.readPackGUID(setGuid))
+ if (!recv_data.readPackGUID(setGuid))
return;
uint32 index;
recv_data >> index;
- if(index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
+ if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
return;
std::string name;
@@ -1284,15 +1284,15 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
- if(!recv_data.readPackGUID(itemGuid))
+ if (!recv_data.readPackGUID(itemGuid))
return;
Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if(!item && itemGuid) // cheating check 1
+ if (!item && itemGuid) // cheating check 1
return;
- if(item && item->GetGUID() != itemGuid) // cheating check 2
+ if (item && item->GetGUID() != itemGuid) // cheating check 2
return;
eqSet.Items[i] = GUID_LOPART(itemGuid);
@@ -1306,7 +1306,7 @@ void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data)
sLog.outDebug("CMSG_EQUIPMENT_SET_DELETE");
uint64 setGuid;
- if(!recv_data.readPackGUID(setGuid))
+ if (!recv_data.readPackGUID(setGuid))
return;
_player->DeleteEquipmentSet(setGuid);
@@ -1320,7 +1320,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
- if(!recv_data.readPackGUID(itemGuid))
+ if (!recv_data.readPackGUID(itemGuid))
return;
uint8 srcbag, srcslot;
@@ -1332,15 +1332,15 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
- if(!item)
+ if (!item)
{
Item *uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
- if(!uItem)
+ if (!uItem)
continue;
ItemPosCountVec sDest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sDest, uItem, false );
- if(msg == EQUIP_ERR_OK)
+ if (msg == EQUIP_ERR_OK)
{
_player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true);
_player->StoreItem( sDest, uItem, true );
@@ -1351,7 +1351,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
continue;
}
- if(item->GetPos() == dstpos)
+ if (item->GetPos() == dstpos)
continue;
_player->SwapItem(item->GetPos(), dstpos);