diff options
author | Spp <none@none> | 2010-04-07 19:14:10 +0200 |
---|---|---|
committer | Spp <none@none> | 2010-04-07 19:14:10 +0200 |
commit | d19e12708001fbef2308be0e8cb5375a2ac7af48 (patch) | |
tree | 09fc8f67a6197802e0512950f0b0a3438a9834e8 /src/game/PetitionsHandler.cpp | |
parent | 2e127f7a30706dc1d40c65de22ff02851732da24 (diff) |
Code style (game + scripts only):
"if(" --> "if ("
--HG--
branch : trunk
Diffstat (limited to 'src/game/PetitionsHandler.cpp')
-rw-r--r-- | src/game/PetitionsHandler.cpp | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 76582672adb..cc6775ea65d 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -90,17 +90,17 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); uint32 charterid = 0; uint32 cost = 0; uint32 type = 0; - if(pCreature->isTabardDesigner()) + if (pCreature->isTabardDesigner()) { // if tabard designer, then trying to buy a guild charter. // do not let if already in guild. - if(_player->GetGuildId()) + if (_player->GetGuildId()) return; charterid = GUILD_CHARTER; @@ -110,7 +110,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) else { // TODO: find correct opcode - if(_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) + if (_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { SendNotification(LANG_ARENA_ONE_TOOLOW, sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)); return; @@ -138,21 +138,21 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) return; } - if(_player->GetArenaTeamId(clientIndex - 1)) // arenaSlot+1 as received from client + if (_player->GetArenaTeamId(clientIndex - 1)) // arenaSlot+1 as received from client { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ALREADY_IN_ARENA_TEAM); return; } } - if(type == 9) + if (type == 9) { - if(objmgr.GetGuildByName(name)) + if (objmgr.GetGuildByName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS); return; } - if(objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) + if (objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_INVALID); return; @@ -160,12 +160,12 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } else { - if(objmgr.GetArenaTeamByName(name)) + if (objmgr.GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } - if(objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) + if (objmgr.IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_INVALID); return; @@ -173,13 +173,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } ItemPrototype const *pProto = objmgr.GetItemPrototype(charterid); - if(!pProto) + if (!pProto) { _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0); return; } - if(_player->GetMoney() < cost) + if (_player->GetMoney() < cost) { //player hasn't got enough money _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0); return; @@ -187,7 +187,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) ItemPosCountVec dest; uint8 msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount ); - if(msg != EQUIP_ERR_OK) + if (msg != EQUIP_ERR_OK) { _player->SendBuyError(msg, pCreature, charterid, 0); return; @@ -195,7 +195,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) _player->ModifyMoney(-(int32)cost); Item *charter = _player->StoreNewItem(dest, charterid, true); - if(!charter) + if (!charter) return; charter->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1, charter->GetGUIDLow()); @@ -247,7 +247,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) uint32 petitionguid_low = GUID_LOPART(petitionguid); QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low); - if(!result) + if (!result) { sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName()); return; @@ -256,13 +256,13 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) uint32 type = fields[0].GetUInt32(); // if guild petition and has guild => error, return; - if(type==9 && _player->GetGuildId()) + if (type==9 && _player->GetGuildId()) return; result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionguid_low); // result==NULL also correct in case no sign yet - if(result) + if (result) signs = result->GetRowCount(); sLog.outDebug("CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid_low); @@ -313,7 +313,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) " type " "FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid), GUID_LOPART(petitionguid)); - if(result) + if (result) { Field* fields = result->Fetch(); ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -332,7 +332,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) data << uint64(ownerguid); // charter owner guid data << name; // name (guild/arena team) data << uint8(0); // some string - if(type == 9) + if (type == 9) { data << uint32(9); data << uint32(9); @@ -358,7 +358,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) data << uint32(0); // 14 - if(type == 9) + if (type == 9) data << uint32(0); // 15 0 - guild, 1 - arena team else data << uint32(1); @@ -379,12 +379,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) recv_data >> newname; // new name Item *item = _player->GetItemByGuid(petitionguid); - if(!item) + if (!item) return; QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); - if(result) + if (result) { Field* fields = result->Fetch(); type = fields[0].GetUInt32(); @@ -395,14 +395,14 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) return; } - if(type == 9) + if (type == 9) { - if(objmgr.GetGuildByName(newname)) + if (objmgr.GetGuildByName(newname)) { SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_EXISTS); return; } - if(objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) + if (objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) { SendGuildCommandResult(GUILD_CREATE_S, newname, GUILD_NAME_INVALID); return; @@ -410,12 +410,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) } else { - if(objmgr.GetArenaTeamByName(newname)) + if (objmgr.GetArenaTeamByName(newname)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; } - if(objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) + if (objmgr.IsReservedName(newname) || !ObjectMgr::IsValidCharterName(newname)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, newname, "", ERR_ARENA_TEAM_NAME_INVALID); return; @@ -451,7 +451,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) " type " "FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid), GUID_LOPART(petitionguid)); - if(!result) + if (!result) { sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName()); return; @@ -463,38 +463,38 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) uint32 type = fields[2].GetUInt32(); uint32 plguidlo = _player->GetGUIDLow(); - if(GUID_LOPART(ownerguid) == plguidlo) + if (GUID_LOPART(ownerguid) == plguidlo) return; // not let enemies sign guild charter - if(!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != objmgr.GetPlayerTeamByGUID(ownerguid)) + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != objmgr.GetPlayerTeamByGUID(ownerguid)) { - if(type != 9) + if (type != 9) SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); else SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_NOT_ALLIED); return; } - if(type != 9) + if (type != 9) { - if(_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) + if (_player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_PLAYER_TO_LOW); return; } uint8 slot = ArenaTeam::GetSlotByType(type); - if(slot >= MAX_ARENA_SLOT) + if (slot >= MAX_ARENA_SLOT) return; - if(_player->GetArenaTeamId(slot)) + if (_player->GetArenaTeamId(slot)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S); return; } - if(_player->GetArenaTeamIdInvited()) + if (_player->GetArenaTeamIdInvited()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); return; @@ -502,26 +502,26 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) } else { - if(_player->GetGuildId()) + if (_player->GetGuildId()) { SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_IN_GUILD); return; } - if(_player->GetGuildIdInvited()) + if (_player->GetGuildIdInvited()) { SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_INVITED_TO_GUILD); return; } } - if(++signs > type) // client signs maximum + if (++signs > type) // client signs maximum return; //client doesn't allow to sign petition two times by one character, but not check sign by another character from same account //not allow sign another player from already sign player account result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE player_account = '%u' AND petitionguid = '%u'", GetAccountId(), GUID_LOPART(petitionguid)); - if(result) + if (result) { WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4)); data << petitionguid; @@ -532,7 +532,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) SendPacket(&data); // update for owner if online - if(Player *owner = objmgr.GetPlayer(ownerguid)) + if (Player *owner = objmgr.GetPlayer(ownerguid)) owner->GetSession()->SendPacket(&data); return; } @@ -551,11 +551,11 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) // update signs count on charter, required testing... //Item *item = _player->GetItemByGuid(petitionguid)); - //if(item) + //if (item) // item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs); // update for owner if online - if(Player *owner = objmgr.GetPlayer(ownerguid)) + if (Player *owner = objmgr.GetPlayer(ownerguid)) owner->GetSession()->SendPacket(&data); } @@ -570,14 +570,14 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) sLog.outDebug("Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT ownerguid FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); - if(!result) + if (!result) return; Field *fields = result->Fetch(); ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); Player *owner = objmgr.GetPlayer(ownerguid); - if(owner) // petition owner online + if (owner) // petition owner online { WorldPacket data(MSG_PETITION_DECLINE, 8); data << _player->GetGUID(); @@ -613,16 +613,16 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam() ) { - if(type != 9) + if (type != 9) SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); else SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_NOT_ALLIED); return; } - if(type != 9) + if (type != 9) { - if(player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) + if (player->getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)) { // player is too low level to join an arena team SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ARENA_TEAM_PLAYER_TO_LOW); @@ -630,17 +630,17 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) } uint8 slot = ArenaTeam::GetSlotByType(type); - if(slot >= MAX_ARENA_SLOT) + if (slot >= MAX_ARENA_SLOT) return; - if(player->GetArenaTeamId(slot)) + if (player->GetArenaTeamId(slot)) { // player is already in an arena team SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM_S); return; } - if(player->GetArenaTeamIdInvited()) + if (player->GetArenaTeamIdInvited()) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); return; @@ -648,13 +648,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) } else { - if(player->GetGuildId()) + if (player->GetGuildId()) { SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_IN_GUILD); return; } - if(player->GetGuildIdInvited()) + if (player->GetGuildIdInvited()) { SendGuildCommandResult(GUILD_INVITE_S, _player->GetName(), ALREADY_INVITED_TO_GUILD); return; @@ -663,7 +663,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); // result==NULL also correct charter without signs - if(result) + if (result) signs = result->GetRowCount(); WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12)); @@ -704,7 +704,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) // data QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); - if(result) + if (result) { Field *fields = result->Fetch(); ownerguidlo = fields[0].GetUInt32(); @@ -717,9 +717,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) return; } - if(type == 9) + if (type == 9) { - if(_player->GetGuildId()) + if (_player->GetGuildId()) { data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild @@ -730,10 +730,10 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) else { uint8 slot = ArenaTeam::GetSlotByType(type); - if(slot >= MAX_ARENA_SLOT) + if (slot >= MAX_ARENA_SLOT) return; - if(_player->GetArenaTeamId(slot)) + if (_player->GetArenaTeamId(slot)) { //data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); //data << (uint32)PETITION_TURN_ALREADY_IN_GUILD; // already in guild @@ -743,24 +743,24 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } } - if(_player->GetGUIDLow() != ownerguidlo) + if (_player->GetGUIDLow() != ownerguidlo) return; // signs uint8 signs; result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid)); - if(result) + if (result) signs = result->GetRowCount(); else signs = 0; uint32 count; - //if(signs < sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS)) - if(type == 9) + //if (signs < sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS)) + if (type == 9) count = sWorld.getConfig(CONFIG_MIN_PETITION_SIGNS); else count = type-1; - if(signs < count) + if (signs < count) { data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_NEED_MORE_SIGNATURES; // need more signatures... @@ -768,9 +768,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) return; } - if(type == 9) + if (type == 9) { - if(objmgr.GetGuildByName(name)) + if (objmgr.GetGuildByName(name)) { SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS); return; @@ -778,7 +778,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } else { - if(objmgr.GetArenaTeamByName(name)) + if (objmgr.GetArenaTeamByName(name)) { SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S); return; @@ -787,7 +787,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) // and at last charter item check Item *item = _player->GetItemByGuid(petitionguid); - if(!item) + if (!item) return; // OK! @@ -795,10 +795,10 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) // delete charter item _player->DestroyItem(item->GetBagSlot(),item->GetSlot(), true); - if(type == 9) // create guild + if (type == 9) // create guild { Guild* guild = new Guild; - if(!guild->Create(_player, name)) + if (!guild->Create(_player, name)) { delete guild; return; @@ -818,7 +818,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) else // or arena team { ArenaTeam* at = new ArenaTeam; - if(!at->Create(_player->GetGUID(), type, name)) + if (!at->Create(_player->GetGUID(), type, name)) { sLog.outError("PetitionsHandler: arena team create failed."); delete at; @@ -879,11 +879,11 @@ void WorldSession::SendPetitionShowList(uint64 guid) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); uint8 count = 0; - if(pCreature->isTabardDesigner()) + if (pCreature->isTabardDesigner()) count = 1; else count = 3; @@ -891,7 +891,7 @@ void WorldSession::SendPetitionShowList(uint64 guid) WorldPacket data(SMSG_PETITION_SHOWLIST, 8+1+4*6); data << guid; // npc guid data << count; // count - if(count == 1) + if (count == 1) { data << uint32(1); // index data << uint32(GUILD_CHARTER); // charter entry |