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/NPCHandler.cpp | |
parent | 2e127f7a30706dc1d40c65de22ff02851732da24 (diff) |
Code style (game + scripts only):
"if(" --> "if ("
--HG--
branch : trunk
Diffstat (limited to 'src/game/NPCHandler.cpp')
-rw-r--r-- | src/game/NPCHandler.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 085ab57f6a1..cc20f57e562 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -51,7 +51,7 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendTabardVendorActivate(guid); @@ -80,7 +80,7 @@ void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendShowBank(guid); @@ -119,11 +119,11 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // trainer list loaded at check; - if(!unit->isCanTrainingOf(_player,true)) + if (!unit->isCanTrainingOf(_player,true)) return; CreatureInfo const *ci = unit->GetCreatureInfo(); @@ -135,7 +135,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) } TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); - if(!trainer_spells) + if (!trainer_spells) { sLog.outDebug( "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry()); @@ -164,7 +164,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) { if (!tSpell->learnedSpell[i]) continue; - if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i])) + if (!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell[i])) { valid = false; break; @@ -243,31 +243,31 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if(!unit->isCanTrainingOf(_player,true)) + if (!unit->isCanTrainingOf(_player,true)) return; // check present spell in trainer spell list TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); - if(!trainer_spells) + if (!trainer_spells) return; // not found, cheat? TrainerSpell const* trainer_spell = trainer_spells->Find(spellId); - if(!trainer_spell) + if (!trainer_spell) return; // can't be learn, cheat? Or double learn with lags... - if(_player->GetTrainerSpellState(trainer_spell) != TRAINER_SPELL_GREEN) + if (_player->GetTrainerSpellState(trainer_spell) != TRAINER_SPELL_GREEN) return; // apply reputation discount 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) ); @@ -281,7 +281,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) SendPacket(&data); // learn explicitly or cast explicitly - if(trainer_spell->IsCastable()) + if (trainer_spell->IsCastable()) //FIXME: prof. spell entry in trainer list not marked gray until list re-open. _player->CastSpell(_player,trainer_spell->spell,true); else @@ -308,10 +308,10 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK); // remove fake death - //if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + //if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) // GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider()) + if ( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider()) { unit->StopMoving(); } @@ -320,7 +320,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) if (unit->isSpiritGuide()) { BattleGround *bg = _player->GetBattleGround(); - if(bg) + if (bg) { bg->AddPlayerToResurrectQueue(unit->GetGUID(), _player->GetGUID()); sBattleGroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID()); @@ -328,7 +328,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) } } - if(!sScriptMgr.GossipHello(_player, unit)) + if (!sScriptMgr.GossipHello(_player, unit)) { _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID()); _player->PrepareGossipMenu(unit, unit->GetCreatureInfo()->GossipMenuId); @@ -347,7 +347,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) recv_data >> guid >> unk >> option; - if(_player->PlayerTalkClass->GossipOptionCoded( option )) + if (_player->PlayerTalkClass->GossipOptionCoded( option )) { sLog.outDebug("reading string"); recv_data >> code; @@ -362,10 +362,10 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if(!code.empty()) + if (!code.empty()) { if (!Script->GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str())) unit->OnGossipSelect (_player, option); @@ -393,7 +393,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendSpiritResurrect(); @@ -408,7 +408,7 @@ void WorldSession::SendSpiritResurrect() // get corpse nearest graveyard WorldSafeLocsEntry const *corpseGrave = NULL; Corpse *corpse = _player->GetCorpse(); - if(corpse) + if (corpse) corpseGrave = objmgr.GetClosestGraveYard( corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam() ); @@ -416,12 +416,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 = objmgr.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 @@ -437,7 +437,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) uint64 npcGUID; recv_data >> npcGUID; - if(!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive()) + if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive()) return; Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID,UNIT_NPC_FLAG_INNKEEPER); @@ -448,7 +448,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendBindPoint(unit); @@ -457,7 +457,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) void WorldSession::SendBindPoint(Creature *npc) { // prevent set homebind to instances in any case - if(GetPlayer()->GetMap()->Instanceable()) + if (GetPlayer()->GetMap()->Instanceable()) return; uint32 bindspell = 3286; @@ -518,11 +518,11 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // remove mounts this fix bug where getting pet from stable while mounted deletes pet. - if(GetPlayer()->IsMounted()) + if (GetPlayer()->IsMounted()) GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED); SendStablePet(npcGUID); @@ -545,7 +545,7 @@ void WorldSession::SendStablePet(uint64 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()); @@ -559,7 +559,7 @@ void WorldSession::SendStablePet(uint64 guid ) QueryResult_AutoPtr 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 { @@ -586,7 +586,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) recv_data >> npcGUID; - if(!GetPlayer()->isAlive()) + if (!GetPlayer()->isAlive()) return; Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER); @@ -597,13 +597,13 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); 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) { WorldPacket data(SMSG_STABLE_RESULT, 1); data << uint8(0x06); @@ -615,7 +615,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) QueryResult_AutoPtr 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 { @@ -624,7 +624,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) 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 @@ -633,7 +633,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) } WorldPacket data(SMSG_STABLE_RESULT, 1); - if( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots) + if ( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots) { _player->RemovePet(pet,PetSaveMode(free_slot)); data << uint8(0x08); @@ -660,7 +660,7 @@ void WorldSession::HandleUnstablePet( 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 creature_id = 0; @@ -668,14 +668,14 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) { QueryResult_AutoPtr 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(); creature_id = fields[0].GetUInt32(); } } - if(!creature_id) + if (!creature_id) { WorldPacket data(SMSG_STABLE_RESULT, 1); data << uint8(0x06); @@ -684,7 +684,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) } CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id); - if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) + if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { WorldPacket data(SMSG_STABLE_RESULT, 1); data << uint8(0x06); @@ -693,7 +693,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) } Pet* pet = _player->GetPet(); - if(pet && pet->isAlive()) + if (pet && pet->isAlive()) { WorldPacket data(SMSG_STABLE_RESULT, 1); data << uint8(0x06); @@ -702,11 +702,11 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) } // delete dead pet - if(pet) + if (pet) _player->RemovePet(pet,PET_SAVE_AS_DELETED); Pet *newpet = new Pet(_player, HUNTER_PET); - if(!newpet->LoadPetFromDB(_player,creature_id,petnumber)) + if (!newpet->LoadPetFromDB(_player,creature_id,petnumber)) { delete newpet; newpet = NULL; @@ -736,15 +736,15 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); WorldPacket data(SMSG_STABLE_RESULT, 200); - 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) + if (_player->GetMoney() >= SlotPrice->Price) { ++GetPlayer()->m_stableSlots; _player->ModifyMoney(-int32(SlotPrice->Price)); @@ -780,20 +780,20 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); WorldPacket data(SMSG_STABLE_RESULT, 200); // guess size Pet* pet = _player->GetPet(); - if(!pet || pet->getPetType()!=HUNTER_PET) + if (!pet || pet->getPetType()!=HUNTER_PET) return; // find swapped pet slot in stable QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(),pet_number); - if(!result) + if (!result) return; Field *fields = result->Fetch(); @@ -801,7 +801,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) uint32 slot = fields[0].GetUInt32(); uint32 creature_id = fields[1].GetUInt32(); - if(!creature_id) + if (!creature_id) { WorldPacket data(SMSG_STABLE_RESULT, 1); data << uint8(0x06); @@ -810,7 +810,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) } CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(creature_id); - if(!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) + if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { WorldPacket data(SMSG_STABLE_RESULT, 1); data << uint8(0x06); @@ -823,7 +823,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) // summon unstabled pet Pet *newpet = new Pet(_player); - if(!newpet->LoadPetFromDB(_player,creature_id,pet_number)) + if (!newpet->LoadPetFromDB(_player,creature_id,pet_number)) { delete newpet; data << uint8(0x06); @@ -851,7 +851,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data ) } // remove fake death - if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // reputation discount @@ -864,7 +864,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?true:false); } else |