diff --git a/src/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/game/AuctionHouseBot/AuctionHouseBot.cpp index 73442ef4a..ac6868754 100644 --- a/src/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -828,7 +828,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice, { Chance = MaxChance - (ratio * (MaxChance / 10)); } - else { Chance = 1; } + else + { + Chance = 1; + } } } } @@ -847,7 +850,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice, { Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); } - else { Chance = 1; } + else + { + Chance = 1; + } } } } @@ -862,9 +868,15 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice, { Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); } - else { Chance = 0; } + else + { + Chance = 0; + } + } + else + { + Chance = 0; } - else { Chance = 0; } } uint32 RandNum = urand(1, ChanceRatio); if (RandNum <= Chance) @@ -1056,8 +1068,14 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config) if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, minBuyPrice, MaxChance, config.FactionChance)) { if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance / 2, config.FactionChance)) - if (urand(0, 5) == 0) { PlaceBidToEntry(auction, bidPrice); } - else { BuyEntry(auction); } + if (urand(0, 5) == 0) + { + PlaceBidToEntry(auction, bidPrice); + } + else + { + BuyEntry(auction); + } else { BuyEntry(auction); } } @@ -1093,7 +1111,10 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType) } return true; } - else { return false; } + else + { + return false; + } } //== AuctionBotSeller functions ============================ @@ -1898,7 +1919,10 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config) items = sAuctionBotConfig.GetItemPerCycleBoost(); BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used to fill AH! (if this happens often adjust both ItemsPerCycle in ahbot.conf)"); } - else { items = sAuctionBotConfig.GetItemPerCycleNormal(); } + else + { + items = sAuctionBotConfig.GetItemPerCycleNormal(); + } uint32 houseid; switch (config.GetHouseType()) diff --git a/src/game/BattleGround/BattleGround.cpp b/src/game/BattleGround/BattleGround.cpp index d45febfb8..cb5a02f7f 100644 --- a/src/game/BattleGround/BattleGround.cpp +++ b/src/game/BattleGround/BattleGround.cpp @@ -607,7 +607,10 @@ void BattleGround::SendPacketToTeam(Team teamId, WorldPacket* packet, Player* se } Team team = itr->second.PlayerTeam; - if (!team) { team = plr->GetTeam(); } + if (!team) + { + team = plr->GetTeam(); + } if (team == teamId) { @@ -651,7 +654,10 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId) } Team team = itr->second.PlayerTeam; - if (!team) { team = plr->GetTeam(); } + if (!team) + { + team = plr->GetTeam(); + } if (team == teamId) { @@ -684,7 +690,10 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId) } Team team = itr->second.PlayerTeam; - if (!team) { team = plr->GetTeam(); } + if (!team) + { + team = plr->GetTeam(); + } if (team == teamId) { @@ -716,7 +725,10 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId) } Team team = itr->second.PlayerTeam; - if (!team) { team = plr->GetTeam(); } + if (!team) + { + team = plr->GetTeam(); + } if (team == teamId) { @@ -756,7 +768,10 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, } Team team = itr->second.PlayerTeam; - if (!team) { team = plr->GetTeam(); } + if (!team) + { + team = plr->GetTeam(); + } if (team == teamId) { @@ -1286,7 +1301,10 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen { plr->ClearAfkReports(); - if (!team) { team = plr->GetTeam(); } + if (!team) + { + team = plr->GetTeam(); + } // if arena, remove the specific arena auras if (isArena()) diff --git a/src/game/BattleGround/BattleGroundMgr.cpp b/src/game/BattleGround/BattleGroundMgr.cpp index 91e55ac7c..2c46a7301 100644 --- a/src/game/BattleGround/BattleGroundMgr.cpp +++ b/src/game/BattleGround/BattleGroundMgr.cpp @@ -1915,7 +1915,7 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA // add bg to update list AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg); - + #ifdef ENABLE_ELUNA sEluna->OnBGCreate(bg, bgTypeId, bg->GetInstanceID()); #endif /* ENABLE_ELUNA */ diff --git a/src/game/ChatCommands/Level1.cpp b/src/game/ChatCommands/Level1.cpp index 7fe53a1e1..d39ecf469 100644 --- a/src/game/ChatCommands/Level1.cpp +++ b/src/game/ChatCommands/Level1.cpp @@ -179,8 +179,8 @@ bool ChatHandler::HandleGMCommand(char* args) if (!*args) { if (m_session->GetPlayer()->isGameMaster()) - { - m_session->SendNotification(LANG_GM_ON); + { + m_session->SendNotification(LANG_GM_ON); } else { @@ -363,7 +363,10 @@ bool ChatHandler::HandleGPSCommand(char* args) else { PSendSysMessage("You are INdoor"); } } - else { PSendSysMessage("no VMAP available for area info"); } + else + { + PSendSysMessage("no VMAP available for area info"); + } PSendSysMessage(LANG_MAP_POSITION, obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : ""), diff --git a/src/game/ChatCommands/Level3.cpp b/src/game/ChatCommands/Level3.cpp index d1ce035ba..197814e05 100644 --- a/src/game/ChatCommands/Level3.cpp +++ b/src/game/ChatCommands/Level3.cpp @@ -5045,7 +5045,7 @@ bool ChatHandler::HandleLevelUpCommand(char* args) return true; } } - + return false; } } @@ -5464,7 +5464,10 @@ bool ChatHandler::HandleListAurasCommand(char* /*args*/) for (int i = 0; i < TOTAL_AURAS; ++i) { Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i)); - if (uAuraList.empty()) { continue; } + if (uAuraList.empty()) + { + continue; + } PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) { @@ -7226,7 +7229,10 @@ bool ChatHandler::HandleCastSelfCommand(char* args) bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/) { Player* player = getSelectedPlayer(); - if (!player) { player = m_session->GetPlayer(); } + if (!player) + { + player = m_session->GetPlayer(); + } uint32 counter = 0; for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { diff --git a/src/game/ChatCommands/debugcmds.cpp b/src/game/ChatCommands/debugcmds.cpp index f9a905dfe..3d9c7d8fc 100644 --- a/src/game/ChatCommands/debugcmds.cpp +++ b/src/game/ChatCommands/debugcmds.cpp @@ -447,7 +447,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) { return false; } Player* player = getSelectedPlayer(); - if (!player) { player = m_session->GetPlayer(); } + if (!player) + { + player = m_session->GetPlayer(); + } if (!list_queue && !check_all) { @@ -461,7 +464,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) } Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (!item) { continue; } + if (!item) + { + continue; + } if (!item->IsBag()) { if (item->GetState() == state) @@ -489,7 +495,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) for (size_t i = 0; i < updateQueue.size(); ++i) { Item* item = updateQueue[i]; - if (!item) { continue; } + if (!item) + { + continue; + } Bag* container = item->GetContainer(); uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); @@ -524,7 +533,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) } Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (!item) { continue; } + if (!item) + { + continue; + } if (item->GetSlot() != i) { @@ -587,7 +599,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) for (uint8 j = 0; j < bag->GetBagSize(); ++j) { Item* item2 = bag->GetItemByPos(j); - if (!item2) { continue; } + if (!item2) + { + continue; + } if (item2->GetSlot() != j) { @@ -658,7 +673,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) for (size_t i = 0; i < updateQueue.size(); ++i) { Item* item = updateQueue[i]; - if (!item) { continue; } + if (!item) + { + continue; + } if (item->GetOwnerGuid() != player->GetObjectGuid()) { @@ -675,7 +693,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) error = true; continue; } - if (item->GetState() == ITEM_REMOVED) { continue; } + if (item->GetState() == ITEM_REMOVED) + { + continue; + } Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); if (test == NULL) diff --git a/src/game/Object/Creature.cpp b/src/game/Object/Creature.cpp index d81b2ffeb..ec89c7e75 100644 --- a/src/game/Object/Creature.cpp +++ b/src/game/Object/Creature.cpp @@ -2173,7 +2173,10 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) break; } } - if (bcontinue) { continue; } + if (bcontinue) + { + continue; + } if(spellInfo->GetManaCost() > GetPower(POWER_MANA)) { diff --git a/src/game/Object/Creature.h b/src/game/Object/Creature.h index cff7b2077..f199cf521 100644 --- a/src/game/Object/Creature.h +++ b/src/game/Object/Creature.h @@ -379,7 +379,10 @@ struct VendorItemData VendorItem* GetItem(uint32 slot) const { - if (slot >= m_items.size()) { return NULL; } + if (slot >= m_items.size()) + { + return NULL; + } return m_items[slot]; } bool Empty() const { return m_items.empty(); } @@ -714,7 +717,7 @@ class Creature : public Unit /** * function indicating whether the recipient is a group. - * + * * \return boolean true if the creature's recipient is a group, false otherwise. */ bool IsGroupLootRecipient() const { return m_lootGroupRecipientId; } diff --git a/src/game/Object/CreatureAI.cpp b/src/game/Object/CreatureAI.cpp index 3a1dd8d3a..875697749 100644 --- a/src/game/Object/CreatureAI.cpp +++ b/src/game/Object/CreatureAI.cpp @@ -131,7 +131,7 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 CanCastResult castResult = CanCastSpell(pTarget, pSpell, uiCastFlags & CAST_TRIGGERED); if (castResult != CAST_OK) - { + { return castResult; } } @@ -142,7 +142,7 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 pCaster->InterruptNonMeleeSpells(false); } - // Creature should always stop before it will cast a non-instant spell + // Creature should always stop before it will cast a non-instant spell if (GetSpellCastTime(pSpell)) pCaster->StopMoving(); diff --git a/src/game/Object/Formulas.h b/src/game/Object/Formulas.h index 1bb788d58..294aa9b18 100644 --- a/src/game/Object/Formulas.h +++ b/src/game/Object/Formulas.h @@ -74,17 +74,50 @@ namespace MaNGOS inline uint32 GetZeroDifference(uint32 pl_level) { - if (pl_level < 8) { return 5; } - if (pl_level < 10) { return 6; } - if (pl_level < 12) { return 7; } - if (pl_level < 16) { return 8; } - if (pl_level < 20) { return 9; } - if (pl_level < 30) { return 11; } - if (pl_level < 40) { return 12; } - if (pl_level < 45) { return 13; } - if (pl_level < 50) { return 14; } - if (pl_level < 55) { return 15; } - if (pl_level < 60) { return 16; } + if (pl_level < 8) + { + return 5; + } + if (pl_level < 10) + { + return 6; + } + if (pl_level < 12) + { + return 7; + } + if (pl_level < 16) + { + return 8; + } + if (pl_level < 20) + { + return 9; + } + if (pl_level < 30) + { + return 11; + } + if (pl_level < 40) + { + return 12; + } + if (pl_level < 45) + { + return 13; + } + if (pl_level < 50) + { + return 14; + } + if (pl_level < 55) + { + return 15; + } + if (pl_level < 60) + { + return 16; + } return 17; } diff --git a/src/game/Object/GMTicketMgr.cpp b/src/game/Object/GMTicketMgr.cpp index 1e0c231f6..c6c3d7f3c 100644 --- a/src/game/Object/GMTicketMgr.cpp +++ b/src/game/Object/GMTicketMgr.cpp @@ -43,7 +43,7 @@ void GMTicketMgr::LoadGMTickets() "SELECT guid, ticket_text, response_text, UNIX_TIMESTAMP(ticket_lastchange), ticket_id " "FROM character_ticket " "ORDER BY ticket_id ASC"); - + if (!result) { BarGoLink bar(1); diff --git a/src/game/Object/GMTicketMgr.h b/src/game/Object/GMTicketMgr.h index 5e2d39cc8..8eb6c3fb5 100644 --- a/src/game/Object/GMTicketMgr.h +++ b/src/game/Object/GMTicketMgr.h @@ -97,7 +97,7 @@ class GMTicket m_lastUpdate = update; } - /** + /** * Gets the \ref Player s \ref ObjectGuid which asked the question and created the ticket * @return the \ref ObjectGuid for the \ref Player that asked the question */ @@ -121,7 +121,7 @@ class GMTicket return m_lastUpdate; } - /** + /** * Changes the tickets question text. * @param text the text to change the question to */ @@ -214,7 +214,7 @@ class GMTicketMgr return *itr; } - /** + /** * This will delete a \ref GMTicket from this manager of tickets so that we don't * need to handle it anymore, this should be used in conjunction with setting * resolved = 1 in the character_ticket table. @@ -236,7 +236,7 @@ class GMTicketMgr void DeleteAll(); - /** + /** * This will create a new \ref GMTicket and fill it with the given question so that * a GM can find it and answer it. Should only be called if we've already checked * that there are no open tickets already, as this function will close any other diff --git a/src/game/Object/GameObject.cpp b/src/game/Object/GameObject.cpp index 78a38c357..cff545554 100644 --- a/src/game/Object/GameObject.cpp +++ b/src/game/Object/GameObject.cpp @@ -815,7 +815,10 @@ bool GameObject::IsTransport() const { // If something is marked as a transport, don't transmit an out of range packet for it. GameObjectInfo const* gInfo = GetGOInfo(); - if (!gInfo) { return false; } + if (!gInfo) + { + return false; + } return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT; } diff --git a/src/game/Object/Item.cpp b/src/game/Object/Item.cpp index 3313b0925..2de6f36c0 100644 --- a/src/game/Object/Item.cpp +++ b/src/game/Object/Item.cpp @@ -474,7 +474,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff) #ifdef ENABLE_ELUNA sEluna->OnExpire(owner, GetProto()); #endif /* ENABLE_ELUNA */ - + if (uint32 newItemId = sObjectMgr.GetItemExpireConvert(GetEntry())) owner->ConvertItem(this, newItemId); else @@ -941,7 +941,10 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) if (state != ITEM_UNCHANGED) { // new items must stay in new state until saved - if (uState != ITEM_NEW) { uState = state; } + if (uState != ITEM_NEW) + { + uState = state; + } if (forplayer || GetOwnerGuid()) { diff --git a/src/game/Object/ItemEnchantmentMgr.cpp b/src/game/Object/ItemEnchantmentMgr.cpp index 1830ad591..348ef7f4e 100644 --- a/src/game/Object/ItemEnchantmentMgr.cpp +++ b/src/game/Object/ItemEnchantmentMgr.cpp @@ -104,7 +104,10 @@ void LoadRandomEnchantmentsTable() uint32 GetItemEnchantMod(int32 entry) { - if (!entry) { return 0; } + if (!entry) + { + return 0; + } EnchantmentStore::const_iterator tab; if (entry > 0) @@ -134,7 +137,10 @@ uint32 GetItemEnchantMod(int32 entry) { fCount += ench_iter->chance; - if (fCount > dRoll) { return ench_iter->ench; } + if (fCount > dRoll) + { + return ench_iter->ench; + } } // we could get here only if sum of all enchantment chances is lower than 100% @@ -145,7 +151,10 @@ uint32 GetItemEnchantMod(int32 entry) { fCount += ench_iter->chance; - if (fCount > dRoll) { return ench_iter->ench; } + if (fCount > dRoll) + { + return ench_iter->ench; + } } return 0; diff --git a/src/game/Object/LootMgr.cpp b/src/game/Object/LootMgr.cpp index 15995a5b1..9df3e460c 100644 --- a/src/game/Object/LootMgr.cpp +++ b/src/game/Object/LootMgr.cpp @@ -670,7 +670,10 @@ QuestItemList* Loot::FillFFALoot(Player* player) QuestItemList* Loot::FillQuestLoot(Player* player) { - if (items.size() == MAX_NR_LOOT_ITEMS) { return NULL; } + if (items.size() == MAX_NR_LOOT_ITEMS) + { + return NULL; + } QuestItemList* ql = new QuestItemList(); for (uint8 i = 0; i < m_questItems.size(); ++i) diff --git a/src/game/Object/Object.cpp b/src/game/Object/Object.cpp index 589f38810..5747f6383 100644 --- a/src/game/Object/Object.cpp +++ b/src/game/Object/Object.cpp @@ -782,7 +782,10 @@ void Object::ClearUpdateMask(bool remove) bool Object::LoadValues(const char* data) { - if (!m_uint32Values) { _InitValues(); } + if (!m_uint32Values) + { + _InitValues(); + } Tokens tokens = StrSplit(data, " "); @@ -1318,7 +1321,10 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const { - if (!IsInMap(obj)) { return false; } + if (!IsInMap(obj)) + { + return false; + } float ox, oy, oz; obj->GetPosition(ox, oy, oz); return(IsWithinLOS(ox, oy, oz)); diff --git a/src/game/Object/ObjectMgr.cpp b/src/game/Object/ObjectMgr.cpp index e4a98d206..95e2067c0 100644 --- a/src/game/Object/ObjectMgr.cpp +++ b/src/game/Object/ObjectMgr.cpp @@ -3909,8 +3909,8 @@ void ObjectMgr::LoadQuests() // 29 30 31 32 "RewXPId, SrcItemId, SrcItemCount, SrcSpell," // 33 34 35 36 37 38 39 40 41 42 43 - "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, PortraitGiverName, PortraitGiverText, PortraitTurnInName, PortraitTurnInText," - // 44 45 46 47 + "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, PortraitGiverName, PortraitGiverText, PortraitTurnInName, PortraitTurnInText," + // 44 45 46 47 "ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4," // 48 49 50 51 52 53 54 55 56 57 58 59 "ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6," @@ -3929,12 +3929,12 @@ void ObjectMgr::LoadQuests() // 95 96 97 98 99 100 "RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6," // 101 102 103 104 105 106 107 108 - "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4," + "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4," // 109 110 111 112 "RewCurrencyId1, RewCurrencyId2, RewCurrencyId3, RewCurrencyId4," // 113 114 115 116 - "RewCurrencyCount1, RewCurrencyCount2, RewCurrencyCount3, RewCurrencyCount4," - // 117 118 + "RewCurrencyCount1, RewCurrencyCount2, RewCurrencyCount3, RewCurrencyCount4," + // 117 118 "RewSkill, RewSkillValue," // 119 120 121 122 123 "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5," @@ -11050,4 +11050,4 @@ void ObjectMgr::LoadHotfixData() sLog.outString(); sLog.outString(">> Loaded %u hotfix info entries.", count); -} +} diff --git a/src/game/Object/ObjectMgr.h b/src/game/Object/ObjectMgr.h index f1bfe0052..d1fec1b09 100644 --- a/src/game/Object/ObjectMgr.h +++ b/src/game/Object/ObjectMgr.h @@ -617,10 +617,19 @@ class ObjectMgr 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; @@ -963,7 +972,10 @@ 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; } @@ -992,7 +1004,10 @@ 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; } @@ -1001,14 +1016,20 @@ 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; } @@ -1017,7 +1038,10 @@ 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; } @@ -1026,7 +1050,10 @@ 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; } @@ -1037,28 +1064,40 @@ class ObjectMgr 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; } @@ -1087,7 +1126,10 @@ 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; } uint32 GetLoadedStringsCount(int32 minEntry) const @@ -1142,7 +1184,10 @@ 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; } diff --git a/src/game/Object/Pet.cpp b/src/game/Object/Pet.cpp index cdca62b60..c37b5bb51 100644 --- a/src/game/Object/Pet.cpp +++ b/src/game/Object/Pet.cpp @@ -903,7 +903,7 @@ void Pet::InitStatsForLevel(uint32 petlevel) case HUNTER_PET: { CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family); - + if (cFamily && cFamily->minScale > 0.0f) { float scale; @@ -1028,7 +1028,7 @@ void Pet::InitStatsForLevel(uint32 petlevel) float dMinLevel = cInfo->MinMeleeDmg / cInfo->MinLevel; float dMaxLevel = cInfo->MaxMeleeDmg / cInfo->MaxLevel; float mDmg = (dMaxLevel - ((dMaxLevel - dMinLevel) / 2)) * petlevel; - + // Set damage SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(mDmg - mDmg / 4)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float((mDmg - mDmg / 4) * 1.5)); @@ -1044,7 +1044,7 @@ void Pet::InitStatsForLevel(uint32 petlevel) health = 1; mana = 1; armor = 1; - + // Set damage SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 1); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 1); diff --git a/src/game/Object/Pet.h b/src/game/Object/Pet.h index 0d81b4423..7e8571205 100644 --- a/src/game/Object/Pet.h +++ b/src/game/Object/Pet.h @@ -151,7 +151,7 @@ class Pet : public Creature void setPetType(PetType type) { m_petType = type; } bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; } bool isTemporarySummoned() const { return m_duration > 0; } - + bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, uint32 pet_number); bool CreateBaseAtCreature(Creature* creature); bool LoadPetFromDB(Player* owner, uint32 petentry = 0, uint32 petnumber = 0, bool current = false); diff --git a/src/game/Object/PetAI.cpp b/src/game/Object/PetAI.cpp index 314c49221..83f41c4ad 100644 --- a/src/game/Object/PetAI.cpp +++ b/src/game/Object/PetAI.cpp @@ -368,7 +368,7 @@ void PetAI::UpdateAI(const uint32 diff) DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "PetAI (guid = %u) is stopping attack.", m_creature->GetGUIDLow()); m_creature->CombatStop(); inCombat = false; - + return; } diff --git a/src/game/Object/Player.cpp b/src/game/Object/Player.cpp index eb17bc8d7..e4dda7730 100644 --- a/src/game/Object/Player.cpp +++ b/src/game/Object/Player.cpp @@ -1218,7 +1218,7 @@ DrunkenState Player::GetDrunkenstateByValue(uint8 value) return DRUNKEN_SMASHED; if (value >= 50) return DRUNKEN_DRUNK; - if (value) + if (value) return DRUNKEN_TIPSY; return DRUNKEN_SOBER; } @@ -1235,7 +1235,7 @@ void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/) SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue); - uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue); + uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue); // special drunk invisibility detection if (newDrunkenState >= DRUNKEN_DRUNK) @@ -7045,7 +7045,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) #ifdef ENABLE_ELUNA sEluna->OnUpdateZone(this, newZone, newArea); #endif - + m_zoneUpdateId = newZone; m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL; @@ -15619,7 +15619,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32()); SetByteValue(PLAYER_BYTES_3, 0, gender); - SetByteValue(PLAYER_BYTES_3, 1, fields[45].GetUInt8()); + SetByteValue(PLAYER_BYTES_3, 1, fields[45].GetUInt8()); SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32()); SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[44].GetInt32()); @@ -15855,7 +15855,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder) if (time_diff < uint32(GetDrunkValue()) * 9) newDrunkValue = GetDrunkValue() - time_diff / 9; - SetDrunkValue(newDrunkValue); + SetDrunkValue(newDrunkValue); m_cinematic = fields[18].GetUInt32(); m_Played_time[PLAYED_TIME_TOTAL] = fields[19].GetUInt32(); @@ -20503,7 +20503,7 @@ void Player::SendInitialPacketsBeforeAddToMap() data << uint32(sWorld.GetNextWeeklyQuestsResetTime() - WEEK); // LastWeeklyReset (not instance reset) data << uint32(GetMap()->GetDifficulty()); - GetSession()->SendPacket(&data); + GetSession()->SendPacket(&data); SendInitialSpells(); @@ -22956,7 +22956,7 @@ void Player::UnsummonPetIfAny() Pet* pet = GetPet(); if (!pet) return; - + pet->Unsummon(PET_SAVE_NOT_IN_SLOT, this); } diff --git a/src/game/Object/Player.h b/src/game/Object/Player.h index 4e3187b9c..2f9b47933 100644 --- a/src/game/Object/Player.h +++ b/src/game/Object/Player.h @@ -1173,8 +1173,14 @@ class Player : public Unit void SetGMVisible(bool on); void SetPvPDeath(bool on) { - if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; } - else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } + if (on) + { + m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; + } + else + { + m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; + } } // 0 = own auction, -1 = enemy auction, 1 = goblin auction @@ -1223,7 +1229,7 @@ class Player : public Unit return m_rest_bonus; } void SetRestBonus(float rest_bonus_new); - + /** * \brief: compute rest bonus * \param: time_t timePassed > time from last check @@ -1589,7 +1595,7 @@ class Player : public Unit void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); } void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); } - + /// Return collision height sent to client float GetCollisionHeight(bool mounted) const; @@ -2574,7 +2580,7 @@ class Player : public Unit GridReference& GetGridRef() { return m_gridRef; } MapReference& GetMapRef() { return m_mapRef; } - + bool IsTappedByMeOrMyGroup(Creature* creature); bool isAllowedToLoot(Creature* creature); diff --git a/src/game/Object/SpellMgr.cpp b/src/game/Object/SpellMgr.cpp index 4bb4545c9..270c03732 100644 --- a/src/game/Object/SpellMgr.cpp +++ b/src/game/Object/SpellMgr.cpp @@ -1402,7 +1402,7 @@ struct DoSpellProcEvent else ++count; } - + bool HasEntry(uint32 spellId) { return spe_map.find(spellId) != spe_map.end(); } bool SetStateToEntry(uint32 spellId) { return (state = spe_map.find(spellId)) != spe_map.end(); } SpellProcEventMap& spe_map; diff --git a/src/game/Object/SpellMgr.h b/src/game/Object/SpellMgr.h index 0f8fc1cfc..bb3a0a9e8 100644 --- a/src/game/Object/SpellMgr.h +++ b/src/game/Object/SpellMgr.h @@ -752,7 +752,7 @@ enum ProcFlagsEx /// If set trigger always but only one time (not used) PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, /// For periodic heal - PROC_EX_PERIODIC_POSITIVE = 0x0040000, + PROC_EX_PERIODIC_POSITIVE = 0x0040000, PROC_EX_CAST_END = 0x0080000 // procs on end of cast }; @@ -1127,7 +1127,7 @@ class SpellMgr return 0; } - + bool IsHighRankOfSpell(uint32 spell1, uint32 spell2) const { SpellChainMap::const_iterator itr = mSpellChains.find(spell1); diff --git a/src/game/Object/TemporarySummon.cpp b/src/game/Object/TemporarySummon.cpp index 6f7729ca3..a8dd50cb1 100644 --- a/src/game/Object/TemporarySummon.cpp +++ b/src/game/Object/TemporarySummon.cpp @@ -213,7 +213,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff) default: break; } - + Creature::Update(update_diff, diff); } diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index e8e2992ea..43dfda04d 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -100,7 +100,7 @@ void MovementInfo::Read(ByteBuffer& data, uint16 opcode) MovementStatusElements element = sequence[i]; if (element == MSEEnd) break; - + if (element >= MSEGuidBit0 && element <= MSEGuidBit7) { guid[element - MSEGuidBit0] = data.ReadBit(); @@ -2197,7 +2197,10 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) { - if (damageInfo == 0) { return; } + if (damageInfo == 0) + { + return; + } Unit* pVictim = damageInfo->target; if (!this || !pVictim) @@ -9851,7 +9854,7 @@ bool Unit::SelectHostileTarget() m_ThreatManager.modifyThreatPercent(target, -101); // remove target from current attacker, do not exit combat settings - AttackStop(true); + AttackStop(true); } return false; @@ -12562,7 +12565,7 @@ Unit* Unit::TakePossessOf(SpellEntry const* spellEntry, SummonPropertiesEntry co // initialize AI pCreature->AIM_Initialize(); - + if (player) { // Initialize pet bar diff --git a/src/game/Object/Unit.h b/src/game/Object/Unit.h index 3d24d1295..b289d8cc4 100644 --- a/src/game/Object/Unit.h +++ b/src/game/Object/Unit.h @@ -367,7 +367,7 @@ enum AuraRemoveMode AURA_REMOVE_BY_STACK, ///< at replace by similar aura AURA_REMOVE_BY_CANCEL, ///< It was cancelled by the user (needs confirmation) AURA_REMOVE_BY_DISPEL, ///< It was dispelled by ie Remove Magic - AURA_REMOVE_BY_DEATH, ///< The \ref Unit died and there for it was removed + AURA_REMOVE_BY_DEATH, ///< The \ref Unit died and there for it was removed AURA_REMOVE_BY_DELETE, ///< use for speedup and prevent unexpected effects at player logout/pet unsummon (must be used _only_ after save), delete. AURA_REMOVE_BY_SHIELD_BREAK, ///< when absorb shield is removed by damage AURA_REMOVE_BY_EXPIRE, ///< at duration end @@ -802,8 +802,8 @@ class MovementInfo // used only for SMSG_PLAYER_MOVE currently struct StatusInfo { - StatusInfo() : hasFallData(false), hasFallDirection(false), hasOrientation(false), - hasPitch(false), hasSpline(false), hasSplineElevation(false), + StatusInfo() : hasFallData(false), hasFallDirection(false), hasOrientation(false), + hasPitch(false), hasSpline(false), hasSplineElevation(false), hasTimeStamp(false), hasTransportTime2(false), hasTransportTime3(false) { } bool hasFallData : 1; bool hasFallDirection : 1; @@ -993,7 +993,7 @@ struct CalcDamageInfo /// Used only for rage calculation uint32 cleanDamage; /// (Old comment) TODO: remove this field (need use TargetState) - MeleeHitOutcome hitOutCome; + MeleeHitOutcome hitOutCome; }; /** @@ -1167,7 +1167,7 @@ enum ActionBarIndex /** * This structure/class is used when someone is charming (ie: mind control spell and the like) * someone else, to get the charmed ones action bar, the spells and such. It also takes care - * of pets the charmed one has etc. + * of pets the charmed one has etc. */ struct CharmInfo { @@ -1299,20 +1299,20 @@ class Unit : public WorldObject return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS]; } - /** + /** * Gets the current DiminishingLevels for the given group * @param group The group that you would like to know the current diminishing return level for * @return The current diminishing level, up to DIMINISHING_LEVEL_IMMUNE */ DiminishingLevels GetDiminishing(DiminishingGroup group); - /** + /** * Increases the level of the DiminishingGroup by one level up until * DIMINISHING_LEVEL_IMMUNE where the target becomes immune to spells of * that DiminishingGroup * @param group The group to increase the level for by one */ void IncrDiminishing(DiminishingGroup group); - /** + /** * Calculates how long the duration of a spell should be considering * diminishing returns, ie, if the Level passed in is DIMINISHING_LEVEL_IMMUNE * then the duration will be zeroed out. If it is DIMINISHING_LEVEL_1 then a full @@ -1325,51 +1325,51 @@ class Unit : public WorldObject * @param isReflected Whether the spell was reflected or not, used to determine if we should do any calculations at all. */ void ApplyDiminishingToDuration(DiminishingGroup group, int32& duration, Unit* caster, DiminishingLevels Level, int32 limitduration, bool isReflected); - /** + /** * Applies a diminishing return to the given group if apply is true, * otherwise lowers the level by one (?) * @param group The group to affect * @param apply whether this aura is being added/removed */ void ApplyDiminishingAura(DiminishingGroup group, bool apply); - /** + /** * Clears all the current diminishing returns for this Unit. */ void ClearDiminishings() { m_Diminishing.clear(); } void Update(uint32 update_diff, uint32 time) override; - /** + /** * Updates the attack time for the given WeaponAttackType * @param type The type of weapon that we want to update the time for * @param time the remaining time until we can attack with the WeaponAttackType again */ void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; } - /** + /** * Resets the attack timer to the base value decided by Unit::m_modAttackSpeedPct and * Unit::GetAttackTime * @param type The weapon attack type to reset the attack timer for. */ void resetAttackTimer(WeaponAttackType type = BASE_ATTACK); - /** + /** * Get's the remaining time until we can do an attack * @param type The weapon type to check the remaining time for * @return The remaining time until we can attack with this weapon type. */ uint32 getAttackTimer(WeaponAttackType type) const { return m_attackTimer[type]; } - /** + /** * Checks whether the unit can do an attack. Does this by checking the attacktimer for the * WeaponAttackType, can probably be thought of as a cooldown for each swing/shot * @param type What weapon should we check for * @return true if the Unit::m_attackTimer is zero for the given WeaponAttackType */ bool isAttackReady(WeaponAttackType type = BASE_ATTACK) const { return m_attackTimer[type] == 0; } - /** + /** * Checks if the current Unit has an offhand weapon * @return True if there is a offhand weapon. */ bool haveOffhandWeapon() const; - /** + /** * Does an attack if any of the timers allow it and resets them, if the user * isn't in range or behind the target an error is sent to the client. * Also makes sure to not make and offhand and mainhand attack at the same @@ -1377,7 +1377,7 @@ class Unit : public WorldObject * @return True if an attack was made and no error happened, false otherwise */ bool UpdateMeleeAttackingState(); - /** + /** * Check is a given equipped weapon can be used, ie the mainhand, offhand etc. * @param attackType The attack type to check, ie: main/offhand/ranged * @return True if the weapon can be used, true except for shapeshifts and if disarmed. @@ -1399,7 +1399,7 @@ class Unit : public WorldObject } } - /** + /** * Returns the combined combat reach of two mobs. Can be seen as a radius. * @param pVictim The other unit to add the range for * @param forMeleeRange Whether we should return the combined reach for melee or not @@ -1409,7 +1409,7 @@ class Unit : public WorldObject * \see GetFloatValue */ float GetCombatReach(Unit const* pVictim, bool forMeleeRange = true, float flat_mod = 0.0f) const; - /** + /** * Returns the remaining combat distance between two mobs (CombatReach substracted). * Does this by getting the radius of combat/aggro between them and then subtracting their * actual distance between them. Ie: dist between - radius for aggro. If this becomes less @@ -1419,7 +1419,7 @@ class Unit : public WorldObject * @return The reach between them left until one of the creatures could/should aggro */ float GetCombatDistance(Unit const* target, bool forMeleeRange) const; - /** + /** * Returns if the Unit can reach a victim with Melee Attack. Does so by using * Unit::GetCombatReach for melee and checking if the distance from the target is less than * the reach. @@ -1430,7 +1430,7 @@ class Unit : public WorldObject bool CanReachWithMeleeAttack(Unit const* pVictim, float flat_mod = 0.0f) const; uint32 m_extraAttacks; - /** + /** * Internal function, must only be called from Unit::Attack(Unit*) * @param pAttacker The attacker to add to current attackers. */ @@ -1440,15 +1440,15 @@ class Unit : public WorldObject if (itr == m_attackers.end()) m_attackers.insert(pAttacker); } - /** + /** * Internal function, must only be called from Unit::AttackStop() - * @param pAttacker + * @param pAttacker */ void _removeAttacker(Unit* pAttacker) // must be called only from Unit::AttackStop() { m_attackers.erase(pAttacker); } - /** + /** * If another mob/unit want to help this mob this function will return a * possible Unit to attack. * @return A Unit to attack if this one is being attacked by anyone, NULL otherwise @@ -1463,7 +1463,7 @@ class Unit : public WorldObject return NULL; } - /** + /** * Tries to attack a Unit/Player, also makes sure to stop attacking the current target * if we're already attacking someone. * @param victim The Unit to attack @@ -1471,19 +1471,19 @@ class Unit : public WorldObject * @return True if an attack was initiated, false otherwise */ bool Attack(Unit* victim, bool meleeAttack); - /** + /** * Called when we are attack by someone in someway, might be when a fear runs out and * we want to notify AI to attack again or when a spell hits. * @param attacker Who's attacking us */ void AttackedBy(Unit* attacker); - /** + /** * Stop all spells from casting except the one give by except_spellid * @param except_spellid This spell id will not be stopped from casting, defaults to 0 * \see Unit::InterruptSpell */ void CastStop(uint32 except_spellid = 0); - /** + /** * Stops attacking whatever we are attacking at the moment and tells the Unit we are attacking * that we are not doing that anymore, ie: removes it from the attacker list * @param targetSwitch if we are switching targets or not, defaults to false @@ -1491,18 +1491,18 @@ class Unit : public WorldObject * \see Unit::m_attacking */ bool AttackStop(bool targetSwitch = false); - /** + /** * Removes all attackers from the Unit::m_attackers set and logs it if someone that * wasn't attacking it was in the list. Does this check by checking if Unit::AttackStop() * returned false. * \see Unit::AttackStop */ void RemoveAllAttackers(); - /** + /** * @return The Unit::m_attackers, ie. the units that are attacking you */ AttackerSet const& getAttackers() const { return m_attackers; } - /** + /** * Checks if we are attacking a player, also, pets/minions etc attacking a player counts * towards you attacking a player. * @return true if you and/or your pets/minions etc are attacking a player. @@ -1513,16 +1513,16 @@ class Unit : public WorldObject * @return true if vehicle can attack itself. */ bool CanAttackByItself() const; - /** + /** * @return The victim that you are currently attacking */ Unit* getVictim() const { return m_attacking; } - /** + /** * Stops a unit from combat, removes all attackers and stops attacking. * @param includingCast if we should stop the currently casting spell aswell */ void CombatStop(bool includingCast = false); - /** + /** * Calls Unit::CombatStop to stop combat, also calls Unit::CombatStop for pets etc. by using * Unit::CallForAllControlledUnits * @param includingCast if we should stop the currently casting spell aswell @@ -1530,7 +1530,7 @@ class Unit : public WorldObject * \see Unit::CheckForAllControlledUnits */ void CombatStopWithPets(bool includingCast = false); - /** + /** * Stops attacking a certain faction. If we are attacking something and are a player we * are forcefully stopped from attacking the target aswell. * @param faction_id The faction to stop attacking @@ -1539,7 +1539,7 @@ class Unit : public WorldObject * \see Unit::getAttackers */ void StopAttackFaction(uint32 faction_id); - /** + /** * Selects a random unfriendly target, takes care of LOS and such aswell * @param except select any target but this one, usually your current target * @param radius how big the radius for our search should be @@ -1549,7 +1549,7 @@ class Unit : public WorldObject * \see Cell::VisitAllObjects */ Unit* SelectRandomUnfriendlyTarget(Unit* except = NULL, float radius = ATTACK_DISTANCE) const; - /** + /** * Same as Unit::SelectRandomUnfriendlyTarget except it selects a friendly target * @param except select any target but this one, usually your current target * @param radius how big the radius for our search should be @@ -1559,45 +1559,45 @@ class Unit : public WorldObject * \see Cell::VisitAllObjects */ Unit* SelectRandomFriendlyTarget(Unit* except = NULL, float radius = ATTACK_DISTANCE) const; - /** + /** * Checks if we have a negative aura with the given interrupt flag/s * @param flag The interrupt flag/s to check for, see SpellAuraInterruptFlags * @return true if we have a negative aura with the given flag, false otherwise * \see SpellAuraInterruptFlags */ bool hasNegativeAuraWithInterruptFlag(uint32 flag); - /** + /** * Sends a packet to the client informing it that melee attacks are stopping * @param victim The unit we stopped attacking * \see OpcodesList */ void SendMeleeAttackStop(Unit* victim); - /** + /** * Sends a packet to the client informing it that melee attacks are starting * @param pVictim the target that we attack with melee */ void SendMeleeAttackStart(Unit* pVictim); - /** + /** * Adds a state to this unit * @param f the state to add, see UnitState for possible values * \see UnitState */ void addUnitState(uint32 f) { m_state |= f; } - /** + /** * Checks if a certain unit state is set * @param f the state to check for * @return true if the state is set, false otherwise * \see UnitState */ bool hasUnitState(uint32 f) const { return (m_state & f); } - /** + /** * Unsets a certain unit state * @param f the state to remove * \see UnitState */ void clearUnitState(uint32 f) { m_state &= ~f; } - /** + /** * Checks if the client/mob is in control or no * @return true if the client can move by client control, false otherwise * \see UnitState @@ -1607,33 +1607,33 @@ class Unit : public WorldObject return !hasUnitState(UNIT_STAT_NO_FREE_MOVE) && !GetOwnerGuid(); } - /** + /** * Gets the level for this unit * @return The current level for this unit * \see GetUInt32Value * \see EUnitFields */ uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); } - /** + /** * TODO: What does it actually do? Is overwritten by others that derive from Unit? * @return The level it would seem */ virtual uint32 GetLevelForTarget(Unit const* /*target*/) const { return getLevel(); } - /** + /** * Updates the level for the current Unit. Also updates the group to know about this. * @param lvl The level to change to * \see EUnitFields * \see SetUInt32Value */ void SetLevel(uint32 lvl); - /** + /** * Gets the race of this Unit, not to be confused with the Creature type or such * @return returns the race of this Unit * \see CreatureTypeFlags * \see Races */ virtual uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); } - /** + /** * Returns a bitmask representation of the current race given by Races, not to be * confused with the Creature type or such * @return the racemask for the current race @@ -1641,79 +1641,79 @@ class Unit : public WorldObject * \see Races */ uint32 getRaceMask() const { return getRace() ? 1 << (getRace() - 1) : 0; } - /** + /** * Returns the class of this Unit * @return the class of the Unit * \see Classes */ uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); } - /** + /** * Returns a bitmask representation of the current class given by Classes * @return the classmask for the class * \see Classes */ uint32 getClassMask() const { return 1 << (getClass() - 1); } - /** + /** * Gives you the current gender of this Unit * @return The current gender * \see Gender */ uint8 getGender() const { return GetByteValue(UNIT_FIELD_BYTES_0, 2); } - /** + /** * Gets a stat for the current Unit * @param stat The stat you want to get, ie: Stats::STAT_STRENGTH * @return the value the given stat has * \see Stats */ float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0 + stat)); } - /** + /** * Sets a stat for this Unit * @param stat the stat to change * @param val the value to change it to * \see Stats */ void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0 + stat, val); } - /** + /** * Gets the armor for this Unit * @return the current armor * \see SpellSchools */ uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL) ; } - /** + /** * Sets the armor for this Unit * @param val the value to set the armor to * \see SpellSchools */ void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); } - /** + /** * Gets the resistance against a certain spell school, ie: fire, frost, nature etc * @param school the type of resistance you want to get * @return the current resistance against the given school */ uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES + school); } - /** + /** * Sets a resistance for this Unit * @param school the type of resistance you want to set * @param val the value to set it to */ void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES + school, val); } - /** + /** * Gets the health of this Unit * @return the current health for this unit * \see EUnitFields * \see GetUInt32Value */ uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); } - /** + /** * Gets the maximum health of this Unit * @return the max health this Unit can have * \see EUnitFields * \see GetUInt32Value */ - bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); } + bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); } uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); } @@ -1730,12 +1730,12 @@ class Unit : public WorldObject float GetHealthPercent() const { return (GetHealth() * 100.0f) / GetMaxHealth(); } uint32 CountPctFromMaxHealth(int32 pct) const { return (GetMaxHealth() * static_cast(pct) / 100.0f); } uint32 CountPctFromCurHealth(int32 pct) const { return (GetHealth() * static_cast(pct) / 100.0f); } - /** + /** * Sets the health to the given value, it cant be higher than Unit::GetMaxHealth though * @param val the value to set the health to */ void SetHealth(uint32 val); - /** + /** * Sets the max health for this Unit, also makes sure to update the party with the new * value * @param val the new max value for the health @@ -1743,21 +1743,21 @@ class Unit : public WorldObject * \see GetMaxHealth */ void SetMaxHealth(uint32 val); - /** + /** * Sets the health to a certain percentage * @param percent the new percent to change it to, ie: 50.0f, not 0.5f for 50% */ void SetHealthPercent(float percent); - /** + /** * Modifies the health by the difference given. If the character had 100 health and we sent in * -150 as the amount to decrease it would return -100 as that is how much it decreased since - * we cant be under 0 health. + * we cant be under 0 health. * @param val the difference to apply to the health, ie: -100 would decrease the life by 100 * @return how much the Unit gained/lost in health. */ int32 ModifyHealth(int32 val); - /** + /** * Gets the power type for this Unit * @return The type of power this Unit uses */ @@ -1772,7 +1772,7 @@ class Unit : public WorldObject void SetPower(Powers power, int32 val); void SetMaxPower(Powers power, int32 val); int32 ModifyPower(Powers power, int32 val); - /** + /** * Mods a power by increasing or decreasing it's value * @param power which power to mod * @param val how much to increase/decrease the given power @@ -1780,7 +1780,7 @@ class Unit : public WorldObject * \see ApplyModUInt32Value */ void ApplyPowerMod(Powers power, uint32 val, bool apply); - /** + /** * Changes the possible max value of the given Powers power. * @param power increase max for this power * @param val what to add/remove to/from the current max @@ -1795,7 +1795,7 @@ class Unit : public WorldObject uint32 GetPowerIndex(Powers power) const { return GetPowerIndexByClass(power, getClass()); } Powers getPowerType(uint32 index) const { return GetPowerTypeByIndex(index, getClass()); } - /** + /** * TODO: Is the time returned in seconds * @param att what attack type we want to get attacktime for * @return the current attack time, which takes mods of attack speed into account @@ -1803,7 +1803,7 @@ class Unit : public WorldObject * \see EUnitFields */ uint32 GetAttackTime(WeaponAttackType att) const { return (uint32)(GetFloatValue(UNIT_FIELD_BASEATTACKTIME + att) / m_modAttackSpeedPct[att]); } - /** + /** * Changes the attack time for a certain weapon type. * @param att what attack type we want to change the time for * @param val what to set it to @@ -1811,7 +1811,7 @@ class Unit : public WorldObject * \see EUnitFields */ void SetAttackTime(WeaponAttackType att, uint32 val) { SetFloatValue(UNIT_FIELD_BASEATTACKTIME + att, val * m_modAttackSpeedPct[att]); } - /** + /** * Applies a percentage change to a given attack type * @param att attack type to mod * @param val how many percent to add/remove, ie: 90.0f = 90% @@ -1820,7 +1820,7 @@ class Unit : public WorldObject * \see ApplyPercentModFloatValue */ void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply); - /** + /** * Same as ApplyAttackTimePercentMod but for the casting time of spells * instead. * @param val how many percent to add/remove, ie: 90.0f = 90% @@ -1835,14 +1835,14 @@ class Unit : public WorldObject * @return The current sheath state */ SheathState GetSheath() const { return SheathState(GetByteValue(UNIT_FIELD_BYTES_2, 0)); } - /** + /** * Changes the current sheath state. * @param sheathed The new weapon or none of them to show * \see Unit::GetSheath */ virtual void SetSheath(SheathState sheathed) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); } - - /** + + /** * Gets the faction that this unit currently belongs to, also * called faction template id it seems. More data probably to * be found in the DBC files. @@ -1854,7 +1854,7 @@ class Unit : public WorldObject * \see FactionEntry */ uint32 getFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); } - /** + /** * Changes the faction a unit belongs to. * @param faction Faction to change to * \see EUnitFields @@ -1865,17 +1865,17 @@ class Unit : public WorldObject */ void setFaction(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); } FactionTemplateEntry const* getFactionTemplateEntry() const; - /** - * + /** + * */ void RestoreOriginalFaction(); - /** + /** * Are we hostile towards the given Unit? * @param unit the unit we want to check against * @return true if the Unit is considered hostile, false otherwise */ bool IsHostileTo(Unit const* unit) const override; - /** + /** * Is this Unit hostile towards players? * @return true if the Unit is hostile towards players, false otherwise */ @@ -1886,12 +1886,12 @@ class Unit : public WorldObject * @return true if the Unit is considered friendly to us, false otherwise */ bool IsFriendlyTo(Unit const* unit) const override; - /** + /** * Is this Unit neutral to everyone? * @return True if considered neutral to everyone, false otherwise. */ bool IsNeutralToAll() const; - /** + /** * Check if this Unit is a guardian of a contested territory, this is * useful when we want to know if we should attack all players or only * players not belonging to our "side" ally/horde. @@ -1904,19 +1904,19 @@ class Unit : public WorldObject return false; } - /** + /** * Is PVP enabled? * @return true if this Unit is eligible for PVP fighting */ bool IsPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); } - /** + /** * Put the Unit into our out of PVP * @param state true if we want to set PVP on, false otherwise */ void SetPvP(bool state); bool IsFFAPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); } void SetFFAPvP(bool state); - /** + /** * Returns the CreatureType for this Unit. For players this most often is * CREATURE_TYPE_HUMANOID unless he/she has shapeshifted or something like that. * Ie: Bear form probably wouldn't yield the same return value. @@ -1926,7 +1926,7 @@ class Unit : public WorldObject * \see CreatureType */ uint32 GetCreatureType() const; - /** + /** * Returns a bitmask representation of CreatureType for this Unit. * @return A bitmask representation of GetCreatureType() */ @@ -1935,27 +1935,27 @@ class Unit : public WorldObject uint32 creatureType = GetCreatureType(); return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0; } - - /** + + /** * Gets the current stand state for this Unit as described by UnitStandStateType. * @return The current stand state * \see UnitStandStateType * \see MAX_UNIT_STAND_STATE */ uint8 getStandState() const { return GetByteValue(UNIT_FIELD_BYTES_1, 0); } - /** + /** * Is this Unit sitting down in some way? * @return true if the Unit is sitting down, false otherwise */ bool IsSitState() const; - /** + /** * Is this Unit just standing normally? This method will return false * even if you would consider the state as standing, ie: when the Unit * has the state UNIT_STAND_STATE_SLEEP it is considered not standing. * @return true if the Unit is standing normally, false otherwise */ bool IsStandState() const; - /** + /** * Change the stand state for this Unit. For possible values check * UnitStandStateType. * @param state @@ -1966,18 +1966,18 @@ class Unit : public WorldObject void SetStandFlags(uint8 flags) { SetByteFlag(UNIT_FIELD_BYTES_1, 2, flags); } void RemoveStandFlags(uint8 flags) { RemoveByteFlag(UNIT_FIELD_BYTES_1, 2, flags); } - /** - * Is this Unit mounted? + /** + * Is this Unit mounted? * @return true if it's mounted, false otherwise * \see EUnitFields */ bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT); } - /** + /** * Gets the currently used mount id. * @return id of the currently used mount */ uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); } - /** + /** * Mounts this Unit by setting the UNIT_FIELD_MOUNTDISPLAYID to the given mount * id and setting the bitflag UNIT_FLAG_MOUNT in UNIT_FIELD_FLAGS. If this Unit * is a player pets and such are despawned or not depending on the config option @@ -1987,7 +1987,7 @@ class Unit : public WorldObject * as a GM command or the Taxi service mounting the Player. */ void Mount(uint32 mount, uint32 spellId = 0); - /** + /** * Unmounts this Unit by sending the SMSG_DISMOUNT to the client if it was a dismount * not issued by a GM / the Taxi service. Also changes the UNIT_FIELD_MOUNTDISPLAYID * back to 0 and removes the flag UNIT_FLAG_MOUNT from UNIT_FIELD_FLAGS. @@ -2004,7 +2004,7 @@ class Unit : public WorldObject bool IsVehicle() const { return m_vehicleInfo != NULL; } void SetVehicleId(uint32 entry, uint32 overwriteNpcEntry); - /** + /** * Returns the maximum skill value the given Unit can have. Ie: the sword skill can * be maxed to 300 at level 60. And when you start a level 1 character you maximum * skill with swords (given that you know them) is 5. The formula used is: @@ -2016,11 +2016,11 @@ class Unit : public WorldObject * with it's arguments. */ uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? GetLevelForTarget(target) : getLevel()) * 5; } - /** + /** * Deals damage mods to the given victim. If the victim is dead, flying or in evade * mode (for creatures) then the damage is absorbed into absorb and no damage - * is done. - * @param pVictim + * is done. + * @param pVictim * @param damage how much damage we want to try to make, will be updated to how * much was actually made * @param absorb if this is != NULL it will be updated with how much more from @@ -2029,8 +2029,8 @@ class Unit : public WorldObject * TODO: Fix this comment, doesn't really seem correct. */ void DealDamageMods(Unit* pVictim, uint32& damage, uint32* absorb); - /** - * Generally deals damage to a Unit. + /** + * Generally deals damage to a Unit. * @param pVictim victim that will take damage * @param damage the damage to make * @param cleanDamage melee damage to make @@ -2043,7 +2043,7 @@ class Unit : public WorldObject * TODO: Cleanup this function and split into smaller functions for readability */ uint32 DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const* spellProto, bool durabilityLoss); - /** + /** * Generally heals a target for addhealth health * @param pVictim the victim to heal * @param addhealth how much health to add, modified by Unit::ModifyHealth @@ -2053,7 +2053,7 @@ class Unit : public WorldObject */ int32 DealHeal(Unit* pVictim, uint32 addhealth, SpellEntry const* spellProto, bool critical = false, uint32 absorb = 0); - /** + /** * Calls CallForAllControlledUnits with CONTROLLED_MINIPET and CONTROLLED_GUARDIAN * to make them do something if they should when their owner kills someone/thing * @param pVictim the target that was killed @@ -2062,32 +2062,32 @@ class Unit : public WorldObject */ void PetOwnerKilledUnit(Unit* pVictim); - /** + /** * Hard to figure out what this does, TODO: Document this. * @param pVictim possible victim of the proc - * @param procAttacker - * @param procVictim - * @param procEx - * @param amount - * @param attType + * @param procAttacker + * @param procVictim + * @param procEx + * @param amount + * @param attType * @param procSpell * \see ProcFlagsEx */ void ProcDamageAndSpell(Unit* pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const* procSpell = NULL); - /** + /** * Same as for Unit::ProcDamageAndSpell * @param isVictim whether the target is considered the victim or not - * @param pTarget - * @param procFlag - * @param procExtra - * @param attType - * @param procSpell + * @param pTarget + * @param procFlag + * @param procExtra + * @param attType + * @param procSpell * @param damage * \see ProcFlagsEx */ void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const* procSpell, uint32 damage); - /** + /** * Handles an emote, for example /charge would write something * along the lines: "NAME begins to charge" in orange text. This * method checks if it's a command or state, a command usually doesn't @@ -2098,19 +2098,19 @@ class Unit : public WorldObject * TODO: Is this accurate? */ void HandleEmote(uint32 emote_id); // auto-select command/state - /** + /** * Sends a packet to the client SMSG_CLIENT with the emote_id given * which in turn probably makes the client show some sort of animation * for the given emote_id * @param emote_id id of the emote to show */ void HandleEmoteCommand(uint32 emote_id); - /** + /** * Just updates the UNIT_NPC_EMOTESTATE field to the given emote_id. * @param emote_id the emote to show */ void HandleEmoteState(uint32 emote_id); - /** + /** * Seems to do some damage to pVictim and also does extra attacks if the Unit * has any by recursively calling itself up to Unit::m_extraAttacks times with * the extra parameter set to true instead of the default false. @@ -2118,14 +2118,14 @@ class Unit : public WorldObject * Also calculates melee damage using Unit::CalculateMeleeDamage, deals damage and * such using Unit::DealDamageMods and also procs any spell that might be interesting * (TODO: Is that actually what ProcDamageAndSpell does?) using Unit::ProcDamageAndSpell - * + * * @param pVictim the victim to hit * @param attType what hand (main/off) we were using * @param extra whether this was called recursively as an extra attack (true) or not (false) */ void AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false); - /** + /** * Calculates the chance that a melee attack will miss the given victim. * The cap for miss chance is 0-60%, ie: you can't have a higher miss chance * than 60% and not lower than 0%. @@ -2135,7 +2135,7 @@ class Unit : public WorldObject */ float MeleeMissChanceCalc(const Unit* pVictim, WeaponAttackType attType) const; - /** + /** * Fills the CalcDamageInfo structure with data about how much damage was done, in what way, * how much was absorbed etc. Also checks for different procs and inserts these flags into * the structure. Also calculates bonus damage with Unit::MeleeDamageBonusDone and the damage @@ -2146,20 +2146,20 @@ class Unit : public WorldObject * @param attackType type of attack, base/off/ranged */ void CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, WeaponAttackType attackType = BASE_ATTACK); - /** - * Deals melee damage, if the attack was parried we reduce the victims time until next hit + /** + * Deals melee damage, if the attack was parried we reduce the victims time until next hit * instead of the weapons normal time by 20 or 60%. * Also, if this is a NPC behind a (usually fleeing) player we have a chance to daze the * target. Will update the Judgement aura duration too, and check if the victim given from * CalcDamageInfo has any shields up and do damage to them in that case. - * @param damageInfo used to deal the damage + * @param damageInfo used to deal the damage * @param durabilityLoss whether or not durability loss should happen */ void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss); bool IsAllowedDamageInArea(Unit* pVictim) const; - /** + /** * Calculates how much damage a spell should do, it will do some bonus damage according * to which SpellNonMeleeDamage::DmgClass it belongs to, ie: SPELL_DAMAGE_CLASS_RANGED * or SPELL_DAMAGE_CLASS_MELEE does bonus melee damage while the others make bonus spell @@ -2169,7 +2169,7 @@ class Unit : public WorldObject * @param damageInfo info about attacker, target etc * @param damage how much damage to try to do * @param spellInfo info about the spell, needed by the helper functions - * @param attackType what we were attacking with + * @param attackType what we were attacking with * \see Unit::IsSpellCrit * \see Unit::CalcArmorReducedDamage * \see SpellDmgClass @@ -2238,10 +2238,10 @@ class Unit : public WorldObject * @param destinationPositionX is the in game ordinate that we wish to check against the creature's current X ordinate (are they the same, or very close?) * @param destinationPositionY is the in game ordinate that we wish to check against the creature's current Y ordinate (are they the same, or very close?) * @param destinationPositionZ is the in game ordinate that we wish to check against the creature's current Z ordinate (are they the same, or very close?) - * @param distanceX is the distance from the creature's current X ordinate to the destination X ordinate - * @param distanceY is the distance from the creature's current Y ordinate to the destination Y ordinate - * @param distanceZ is the distance from the creature's current Z ordinate to the destination Z ordinate - * + * @param distanceX is the distance from the creature's current X ordinate to the destination X ordinate + * @param distanceY is the distance from the creature's current Y ordinate to the destination Y ordinate + * @param distanceZ is the distance from the creature's current Z ordinate to the destination Z ordinate + * */ bool IsNearWaypoint(float currentPositionX, float currentPositionY, float currentPositionZ, float destinationPositionX, float destinationPositionY, float destinationPositionZ, float distanceX, float distanceY, float distanceZ); @@ -2568,7 +2568,7 @@ class Unit : public WorldObject * \todo What's the swingtype for? */ void SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); - void SendAttackStateUpdate(uint32 HitInfo, Unit* target, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); + void SendAttackStateUpdate(uint32 HitInfo, Unit* target, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); /** * Used to send a update to the combat log for all \ref Player/\ref Unit s in the vicinity. * @param log Info about who/what did damage to who and how etc, data needed for the packet @@ -2766,12 +2766,12 @@ class Unit : public WorldObject Pet* GetMiniPet() const; void SetMiniPet(Unit* pet) { SetCritterGuid(pet ? pet->GetObjectGuid() : ObjectGuid()); } - /** + /** * Gets either the current charmer (ie mind control) or the owner of this \ref Unit * @return the \ref ObjectGuid of either the charmer of this \ref Unit or the owner of it */ ObjectGuid const& GetCharmerOrOwnerGuid() const { return GetCharmerGuid() ? GetCharmerGuid() : GetOwnerGuid(); } - /** + /** * Same thing as \ref Unit::GetCharmerOrOwnerGuid but with the exception that it returns * it's own \ref ObjectGuid if it has no owner or charmer. * @return either the charmers, owners or it's own \ref ObjectGuid @@ -2784,14 +2784,14 @@ class Unit : public WorldObject } return GetObjectGuid(); } - /** + /** * Checks if the charmer or owner is a \ref Player * @return true if the charmer or owner is a \ref Player, false otherwise * \see ObjectGuid::IsPlayer */ bool isCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGuid().IsPlayer(); } - /** + /** * Get's the \ref Player that owns the \ref SpellModifier for this \ref Unit, if this * \ref Unit is a \ref Player it's the owner, but if it's a \ref Pet och \ref Totem then * then owner of the totem is returned if it's a \ref Player @@ -2799,29 +2799,29 @@ class Unit : public WorldObject */ Player* GetSpellModOwner() const; - /** + /** * Returns the \ref Unit that owns this \ref Unit if any * @return the \ref Unit that owns this one, NULL if there is no owner * \see Unit::GetOwnerGuid */ Unit* GetOwner() const; - /** + /** * Returns the \ref Pet for this \ref Unit if any * @return the \ref Pet that is associated with this \ref Unit if any, NULL if there is none * \see Unit::GetPetGuid */ Pet* GetPet() const; - /** + /** * Returns the \ref Unit that's currently charming this one if any. * @return the \ref Unit that's charming this one, NULL if there is none */ Unit* GetCharmer() const; - /** + /** * Returns the \ref Unit that this one is currently charming * @return the \ref Unit that this one is charming, NULL if there is none */ Unit* GetCharm() const; - /** + /** * Removes all \ref Aura s causing this \ref Unit to be charmed/possessed, the \ref Aura s * that cause this are: * - \ref AuraType::SPELL_AURA_MOD_CHARM @@ -2829,12 +2829,12 @@ class Unit : public WorldObject * - \ref AuraType::SPELL_AURA_MOD_POSSESS_PET */ virtual void Uncharm(); - /** + /** * Does the same as \ref Unit::GetCharmerOrOwnerGuid but returns the \ref Unit for that instead * @return the \ref Unit that's charming this one or owning it, NULL if there is none */ Unit* GetCharmerOrOwner() const { return GetCharmerGuid() ? GetCharmer() : GetOwner(); } - /** + /** * Does the same a \ref Unit::GetCharmerOrOwner but if there is none of those it returns itself * @return a \ref Unit that's either owning or charming this one or just itself. */ @@ -2851,35 +2851,35 @@ class Unit : public WorldObject Player* GetCharmerOrOwnerPlayerOrPlayerItself(); Player const* GetCharmerOrOwnerPlayerOrPlayerItself() const; - /** + /** * Set's the current \ref Pet for this \ref Unit * @param pet The \ref Pet to add to this \ref Unit */ void SetPet(Pet* pet); - /** + /** * Set's who we're currently charming * @param pet The \ref Unit to set as charmed by us */ void SetCharm(Unit* pet); - /** + /** * Adds a guardian to this \ref Unit which will generally defend this \ref Unit when on a * threat list. * @param pet the guardian to add * \see Unit::m_guardianPets */ void AddGuardian(Pet* pet); - /** + /** * Removes a guardian from this \ref Unit * @param pet the guardian to remove * \see Unit::m_guardianPets */ void RemoveGuardian(Pet* pet); - /** + /** * Removes all current guardians from this \ref Unit */ void RemoveGuardians(); - /** + /** * Finds a guardian by it's entry, this is the entry in character.character_pet * @param entry the entry to find * @return the guardian/\ref Pet found or NULL if there's no such entry in the db @@ -2888,19 +2888,19 @@ class Unit : public WorldObject Pet* FindGuardianWithEntry(uint32 entry); Pet* GetProtectorPet(); // expected single case in guardian list - /** + /** * Is this \ref Unit charmed? * @return true if the \ref Unit has a charmer, false otherwise * \see Unit::GetCharmerGuid */ bool IsCharmed() const { return !GetCharmerGuid().IsEmpty(); } - /** + /** * There's only \ref CharmInfo available if this \ref Unit is in fact charmed by someone * @return The \ref CharmInfo for this \ref Unit if any, NULL otherwise */ CharmInfo* GetCharmInfo() { return m_charmInfo; } - /** + /** * Init the \ref CharmInfo struct with data about the \ref Unit that will be charmed * @param charm the \ref Unit that is to be charmed * @return the created \ref CharmInfo @@ -2908,38 +2908,38 @@ class Unit : public WorldObject */ CharmInfo* InitCharmInfo(Unit* charm); - /** + /** * Get's the \ref ObjectGuid for a certain totem type that this \ref Unit has spawned * @param slot the slot to get the \ref ObjectGuid for * @return the \ref ObjectGuid for the given totem slot */ ObjectGuid const& GetTotemGuid(TotemSlot slot) const { return m_TotemSlot[slot]; } - /** + /** * Gets a certain \ref Totem that this \ref Unit has spawned * @param slot the slot to get the \ref Totem for * @return The requested totem if there is any spawned, NULL otherwise */ Totem* GetTotem(TotemSlot slot) const; - /** + /** * @return True if all totems slots are used (spawned), false otherwise */ bool IsAllTotemSlotsUsed() const; - /** + /** * This is internal code that should only be called from the \ref Totem summon code - * @param slot + * @param slot * @param totem * \internal */ void _AddTotem(TotemSlot slot, Totem* totem); // only for call from Totem summon code - /** + /** * This is internal code that should only be called from the \ref Totem class. * @param totem * \internal */ void _RemoveTotem(Totem* totem); // only for call from Totem class - /** + /** * This will call the given function for all controlled \ref Unit s, for an example of * how one such function could look please have a look at \ref CallForAllControlledUnitsExample * @@ -2954,7 +2954,7 @@ class Unit : public WorldObject */ template void CallForAllControlledUnits(Func const& func, uint32 controlledMask); - /** + /** * Works pretty much the same way as \ref Unit::CallForAllControlledUnits but instead * the functors operator() should have the following signature: * \code{.cpp} @@ -2971,29 +2971,29 @@ class Unit : public WorldObject template bool CheckAllControlledUnits(Func const& func, uint32 controlledMask) const; - /** + /** * Adds a \ref SpellAuraHolder * @param holder the holder to add * @return true if the holder was added, false otherwise */ bool AddSpellAuraHolder(SpellAuraHolder* holder); - /** + /** * Adds a \ref Aura to \ref Unit::m_modAuras * @param aura the \ref Aura to add */ void AddAuraToModList(Aura* aura); - - - /** + + + /** * Removes an \ref Aura and sets the reason for removal inside the \ref Aura. - * + * * removing specific aura stack (From old comment) * @param aura the \ref Aura to remove * @param mode the reason why it is being removed * \see Aura::SetRemoveMode */ void RemoveAura(Aura* aura, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - /** + /** * Removes an \ref Aura by spell id and the effect index for that spell to find out * which \ref Aura to remove. * @param spellId id of the spell which has the sought \ref Aura somewhere @@ -3001,14 +3001,14 @@ class Unit : public WorldObject * @param except if != NULL we will not remove this \ref Aura if found */ void RemoveAura(uint32 spellId, SpellEffectIndex effindex, Aura* except = NULL); - /** + /** * Removes a \ref SpellAuraHolder from this \ref Unit. This will remove all the effects that * are currently stored in the \ref SpellAuraHolder. * @param holder holder to be removed * @param mode reason for removal */ void RemoveSpellAuraHolder(SpellAuraHolder* holder, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - /** + /** * Removes a single \ref Aura from a \ref SpellAuraHolder to cancel out just one effect of a * \ref Spell. * @param holder the holder to remove the \ref Aura from @@ -3016,7 +3016,7 @@ class Unit : public WorldObject * @param mode the reason for removing it */ void RemoveSingleAuraFromSpellAuraHolder(SpellAuraHolder* holder, SpellEffectIndex index, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - /** + /** * Does the same thing as \ref Unit::RemoveSingleAuraFromSpellAuraHolder but with spell id * instead of a \ref SpellAuraHolder * @param id id of the spell to find the \ref Aura in @@ -3026,10 +3026,10 @@ class Unit : public WorldObject */ void RemoveSingleAuraFromSpellAuraHolder(uint32 id, SpellEffectIndex index, ObjectGuid casterGuid, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - /** + /** * Removes all \ref Aura s that a certain spell would cause via it's effects (up to 3 of them * per \ref Aura). - * + * * From old doc: removing specific aura stacka by diff reasons and selections * @param spellId id of the spell causing the \ref Aura s you would like to remove * @param except a spell that shouldn't be included in the removal @@ -3037,14 +3037,14 @@ class Unit : public WorldObject * \see SpellEntry::Effect */ void RemoveAurasDueToSpell(uint32 spellId, SpellAuraHolder* except = NULL, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - /** + /** * Removes all \ref Aura s that a certain spell cast by a certain \ref Item would cause via * it's effects (up to 3 of them per \ref Aura). * @param castItem the \ref Item that cast the spell * @param spellId id of the spell causing the \ref Aura s you would like to remove */ void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId); - /** + /** * Removes all \ref Aura s that a certain spell cast by a certain \ref Player / \ref Unit * would cause via it's effects (up to 3 of them per \ref Aura) * @param spellId id of the \ref Spell causing the \ref Aura s you would like to remove @@ -3053,7 +3053,7 @@ class Unit : public WorldObject */ void RemoveAurasByCasterSpell(uint32 spellId, ObjectGuid casterGuid, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGuid, Unit* stealer); - /** + /** * Removes all \ref Aura s caused by a certain spell because it was canceled. * @param spellId id of the \ref Spell causing the \ref Aura s you would like to remove */ @@ -3065,7 +3065,7 @@ class Unit : public WorldObject * \todo Document and find out what it does */ void RemoveNotOwnTrackedTargetAuras(uint32 newPhase = 0x0); - /** + /** * Removes all \ref SpellAuraHolder s that have the given \ref Mechanics mask which is created * by doing something like the following if we want a mask for \ref Mechanics::MECHANIC_SAPPED: * \code{.cpp} @@ -3077,68 +3077,68 @@ class Unit : public WorldObject * @param non_positive if we should remove non positive \ref Aura s or not, defaults to false */ void RemoveAurasAtMechanicImmunity(uint32 mechMask, uint32 exceptSpellId, bool non_positive = false); - /** + /** * Removes all \ref Spell s that cause the given \ref AuraType * @param auraType the type of auras we would like to remove spells for */ void RemoveSpellsCausingAura(AuraType auraType); - /** + /** * Same as \ref Unit::RemoveSpellsCausingAura but with an exception * for a \ref SpellAuraHolder that shouldn't be removed * @param auraType the type of auras we would like to remove spells for * @param except this will be excepted from removal */ void RemoveSpellsCausingAura(AuraType auraType, SpellAuraHolder* except); - /** + /** * Same as \ref Unit::RemoveSpellsCausingAura but for a matching caster aswell. * @param auraType the type of auras we would like to remove spells for * @param casterGuid remove the aura only if the caster is equal to this guid */ void RemoveSpellsCausingAura(AuraType auraType, ObjectGuid casterGuid); - /** + /** * Removes all ranks of the given \ref Spell, ie: if the spellid of rank 1 inner fire is * given all the ranks of it will be removed. * @param spellId id of the spell we want to remove all ranks for */ void RemoveRankAurasDueToSpell(uint32 spellId); - /** - * - * @param holder + /** + * + * @param holder * @return true if we could remove something (and did), false otherwise * \todo Document what this does and break into smaller functions! */ bool RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder* holder); - /** + /** * Removes all \ref Aura s that have the given interrupt flags * @param flags see \ref AuraInterruptFlags for possible flags */ void RemoveAurasWithInterruptFlags(uint32 flags); - /** + /** * Removes all \ref Aura s that have the given attributes * @param flags see \ref SpellAttributes for possible values */ void RemoveAurasWithAttribute(uint32 flags); - /** + /** * Removes all \ref Aura s which can be dispelled by the given \ref DispelType * @param type the given type that you want to remove all \ref Aura s for * @param casterGuid if this isn't 0 it will be checked that the caster of the \ref Spell is * the same as the given guid before removal. */ void RemoveAurasWithDispelType(DispelType type, ObjectGuid casterGuid = ObjectGuid()); - /** + /** * Removes all \ref Aura s. * @param mode the reason for removal */ void RemoveAllAuras(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveArenaAuras(bool onleave = false); - /** + /** * Removes all \ref Aura s on this \ref Unit s death. Removes all visible \ref Aura s and * disabled the mods for the passive ones (taken from old docs). The reason used is * \ref AuraRemoveMode::AURA_REMOVE_BY_DEATH * \todo Where does it remove the passive ones? */ void RemoveAllAurasOnDeath(); - /** + /** * used when evading to remove all auras except some special auras. Linked and flying * \ref Aura s shouldn't be removed on evade. * \todo Are linked and flying auras really not removed on evade? @@ -3147,7 +3147,7 @@ class Unit : public WorldObject // remove specific aura on cast void RemoveAurasOnCast(SpellEntry const* castedSpellEntry); - + // removing specific aura FROM stack by diff reasons and selections void RemoveAuraHolderFromStack(uint32 spellId, uint32 stackAmount = 1, ObjectGuid casterGuid = ObjectGuid(), AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount, ObjectGuid casterGuid, Unit* dispeller); diff --git a/src/game/References/MapReference.h b/src/game/References/MapReference.h index c6f2709a0..bf13fceb0 100644 --- a/src/game/References/MapReference.h +++ b/src/game/References/MapReference.h @@ -40,7 +40,10 @@ class MapReference : public Reference void targetObjectDestroyLink() override { // called from unlink() - if (isValid()) { getTarget()->m_mapRefManager.decSize(); } + if (isValid()) + { + getTarget()->m_mapRefManager.decSize(); + } } void sourceObjectDestroyLink() override { diff --git a/src/game/Server/DB2Stores.cpp b/src/game/Server/DB2Stores.cpp index 5db852e39..89dc5c078 100644 --- a/src/game/Server/DB2Stores.cpp +++ b/src/game/Server/DB2Stores.cpp @@ -137,7 +137,7 @@ void LoadDB2Stores(const std::string& dataPath) sLog.outError("Please extract correct db2 files from build %s", AcceptableClientBuildsListStr().c_str()); exit(1); } - + sLog.outString(); sLog.outString( ">> Initialized %d db2 stores", DB2FileCount ); } diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 7566c7ce9..c487a8105 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -297,7 +297,7 @@ int ReadDBCLocale(const std::string sDataPath) { std::string sDBCpath = sDataPath + "dbc/"; std::string sFilename; - + for (int uLocaleIndex = 0; uLocaleIndex < MAX_LOCALE; ++uLocaleIndex) { sFilename = sDBCpath + "component.wow-" + fullLocaleNameList[uLocaleIndex].name + ".txt"; @@ -848,7 +848,7 @@ void LoadDBCStores(const std::string& dataPath) } LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc"); - + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTransportAnimationStore, dbcPath,"TransportAnimation.dbc"); for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i) if (TransportAnimationEntry const* entry = sTransportAnimationStore.LookupEntry(i)) diff --git a/src/game/Server/DBCStores.h b/src/game/Server/DBCStores.h index 84f18aa49..e249b85a4 100644 --- a/src/game/Server/DBCStores.h +++ b/src/game/Server/DBCStores.h @@ -35,7 +35,7 @@ bool IsAcceptableClientBuild(uint32 build); std::string AcceptableClientBuildsListStr(); /** - * This function checks to see if there is a valid locale file (component.wow-.txt) + * This function checks to see if there is a valid locale file (component.wow-.txt) * and returns an index to the locale or -1 if not found * @PARAM dataPath full path to the data directory * @RETURN index number representing the location of the locale in the its structure, diff --git a/src/game/Server/DBCfmt.h b/src/game/Server/DBCfmt.h index 303b6abae..001e83045 100644 --- a/src/game/Server/DBCfmt.h +++ b/src/game/Server/DBCfmt.h @@ -127,7 +127,7 @@ const char SpellCastingRequirementsEntryfmt[]="dixxixi"; const char SpellCategoriesEntryfmt[]="diiiiii"; const char SpellClassOptionsEntryfmt[]="dxiiiix"; const char SpellCooldownsEntryfmt[]="diii"; -// 1 10 20 30 +// 1 10 20 30 const char SpellEffectEntryfmt[]="difiiiffiiiiiifiifiiiiiiiix"; const char SpellEquippedItemsEntryfmt[]="diii"; const char SpellInterruptsEntryfmt[]="dixixi"; diff --git a/src/game/Server/Opcodes.cpp b/src/game/Server/Opcodes.cpp index 7b308e5ba..ef9fef09c 100644 --- a/src/game/Server/Opcodes.cpp +++ b/src/game/Server/Opcodes.cpp @@ -429,7 +429,7 @@ void InitializeOpcodes() OPCODE(CMSG_REPOP_REQUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRepopRequestOpcode ); OPCODE(SMSG_RESURRECT_REQUEST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); OPCODE(CMSG_RESURRECT_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleResurrectResponseOpcode ); - OPCODE(CMSG_RETURN_TO_GRAVEYARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReturnToGraveyard ); + OPCODE(CMSG_RETURN_TO_GRAVEYARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReturnToGraveyard ); OPCODE(CMSG_LOOT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootOpcode ); OPCODE(CMSG_LOOT_MONEY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootMoneyOpcode ); OPCODE(CMSG_LOOT_RELEASE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLootReleaseOpcode ); diff --git a/src/game/Server/Opcodes.h b/src/game/Server/Opcodes.h index b337cdbaa..87d9ce4ba 100644 --- a/src/game/Server/Opcodes.h +++ b/src/game/Server/Opcodes.h @@ -1324,7 +1324,7 @@ enum Opcodes SMSG_BATTLEFIELD_MANAGER_ENTERING = 0x14E1, SMSG_BATTLEFIELD_MANAGER_QUEUE_INVITE = 0x14E2, CMSG_BATTLEFIELD_MANAGER_QUEUE_INVITE_RESPONSE = 0x14E3, - CMSG_BATTLEFIELD_MANAGER_QUEUE_REQUEST = 0x710C, // 4.3.4 15595 + CMSG_BATTLEFIELD_MANAGER_QUEUE_REQUEST = 0x710C, // 4.3.4 15595 SMSG_BATTLEFIELD_MANAGER_QUEUE_REQUEST_RESPONSE = 0x14E5, SMSG_BATTLEFIELD_MANAGER_EJECT_PENDING = 0x14E6, SMSG_BATTLEFIELD_MANAGER_EJECTED = 0x14E7, diff --git a/src/game/Server/WorldSession.cpp b/src/game/Server/WorldSession.cpp index 6a7b096c3..42c252beb 100644 --- a/src/game/Server/WorldSession.cpp +++ b/src/game/Server/WorldSession.cpp @@ -390,7 +390,7 @@ bool WorldSession::Update(PacketFilter& updater) { LogoutPlayer(true); } -// WARDEN ISSUE - commented out to stop crash +// WARDEN ISSUE - commented out to stop crash // if (m_Socket && GetPlayer() && _warden) // _warden->Update(); diff --git a/src/game/Server/WorldSession.h b/src/game/Server/WorldSession.h index 5ae7243cf..35cbc0c5e 100644 --- a/src/game/Server/WorldSession.h +++ b/src/game/Server/WorldSession.h @@ -541,7 +541,7 @@ class WorldSession void HandleLogoutRequestOpcode(WorldPacket& recvPacket); void HandlePlayerLogoutOpcode(WorldPacket& recvPacket); void HandleLogoutCancelOpcode(WorldPacket& recvPacket); - + void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); void HandleGMTicketCreateOpcode(WorldPacket& recvPacket); void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); @@ -962,7 +962,7 @@ class WorldSession // Hotfix handlers void HandleRequestHotfix(WorldPacket& recv_data); void SendItemDb2Reply(uint32 entry); - void SendItemSparseDb2Reply(uint32 entry); + void SendItemSparseDb2Reply(uint32 entry); void HandleObjectUpdateFailedOpcode(WorldPacket& recv_data); diff --git a/src/game/Tools/PlayerDump.cpp b/src/game/Tools/PlayerDump.cpp index 11add1c18..b8952d3c3 100644 --- a/src/game/Tools/PlayerDump.cpp +++ b/src/game/Tools/PlayerDump.cpp @@ -485,7 +485,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); delete result; } - else { incHighest = false; } + else + { + incHighest = false; + } } else { guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); } @@ -528,7 +531,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s { if (!fgets(buf, 32000, fin)) { - if (feof(fin)) { break; } + if (feof(fin)) + { + break; + } ROLLBACK(DUMP_FILE_BROKEN); } diff --git a/src/game/WorldHandlers/Chat.cpp b/src/game/WorldHandlers/Chat.cpp index 06935f5b1..e2bbf4b86 100644 --- a/src/game/WorldHandlers/Chat.cpp +++ b/src/game/WorldHandlers/Chat.cpp @@ -235,7 +235,7 @@ ChatCommand* ChatHandler::getCommandTable() { "equiperror", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendEquipErrorCommand, "", NULL }, { "largepacket", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendLargePacketCommand, "", NULL }, { "opcode", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendOpcodeCommand, "", NULL }, - { "phase", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugPhaseCommand, "", NULL }, + { "phase", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugPhaseCommand, "", NULL }, { "poi", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendPoiCommand, "", NULL }, { "qpartymsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestPartyMsgCommand, "", NULL }, { "qinvalidmsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestInvalidMsgCommand, "", NULL }, @@ -1471,8 +1471,8 @@ bool ChatHandler::isValidChatMessage(const char* message) /* valid examples: - |cff00aa00|Hcurrency:391|h[Ðåêîìåíäàòåëüíûé çíà÷îê Òîë Áàðàäà]|h|r - |cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[Êàðàæàí]|h|r NYI + |cff00aa00|Hcurrency:391|h[���������������� ������ ��� ������]|h|r + |cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[�������]|h|r NYI |cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r |cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r |cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r diff --git a/src/game/WorldHandlers/ChatHandler.cpp b/src/game/WorldHandlers/ChatHandler.cpp index dcc0bca04..50e122303 100644 --- a/src/game/WorldHandlers/ChatHandler.cpp +++ b/src/game/WorldHandlers/ChatHandler.cpp @@ -570,7 +570,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data) if (!sEluna->OnChat(GetPlayer(), type, lang, msg, chn)) return; #endif /* ENABLE_ELUNA */ - chn->Say(_player, msg.c_str(), lang); + chn->Say(_player, msg.c_str(), lang); } } diff --git a/src/game/WorldHandlers/GossipDef.cpp b/src/game/WorldHandlers/GossipDef.cpp index f097616a3..cc1b9b29e 100644 --- a/src/game/WorldHandlers/GossipDef.cpp +++ b/src/game/WorldHandlers/GossipDef.cpp @@ -457,7 +457,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid if (ql->PortraitTurnInText.size() > (size_t)loc_idx && !ql->PortraitTurnInText[loc_idx].empty()) PortraitTurnInText = ql->PortraitTurnInText[loc_idx]; } - } + } WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size data << guid; @@ -519,7 +519,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid data << pQuest->GetBonusTalents(); // bonus talents data << uint32(0); // unk, unused bonus arena points? data << uint32(0); // rep reward show mask? - + for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids data << pQuest->RewRepFaction[i]; @@ -553,7 +553,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid GetMenuSession()->SendPacket(&data); DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS - for %s of %s, questid = %u", GetMenuSession()->GetPlayer()->GetGuidStr().c_str(), guid.GetString().c_str(), pQuest->GetQuestId()); -} +} // send only static data in this packet! void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest) @@ -652,8 +652,8 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest) data << uint32(pQuest->GetRewSkill()); // Rewarded skill id data << uint32(pQuest->GetRewSkillValue()); // Rewarded skill bonus points data << uint32(0); // rew rep show mask? - data << uint32(pQuest->GetPortraitGiver()); - data << uint32(pQuest->GetPortraitTurnIn()); + data << uint32(pQuest->GetPortraitGiver()); + data << uint32(pQuest->GetPortraitTurnIn()); int iI; diff --git a/src/game/WorldHandlers/GridMap.h b/src/game/WorldHandlers/GridMap.h index 9a09ece4b..db0fa1204 100644 --- a/src/game/WorldHandlers/GridMap.h +++ b/src/game/WorldHandlers/GridMap.h @@ -128,7 +128,7 @@ struct GridMapLiquidData class GridMap { private: - + uint16 m_holes[16][16]; uint32 m_flags; diff --git a/src/game/WorldHandlers/GridNotifiers.h b/src/game/WorldHandlers/GridNotifiers.h index 41b627aa7..af19fbacc 100644 --- a/src/game/WorldHandlers/GridNotifiers.h +++ b/src/game/WorldHandlers/GridNotifiers.h @@ -243,7 +243,7 @@ namespace MaNGOS /* template struct WorldObjectLastSearcher - { + { WorldObject*& i_object; Check& i_check; diff --git a/src/game/WorldHandlers/Group.h b/src/game/WorldHandlers/Group.h index eccbfe3ba..a9e853497 100644 --- a/src/game/WorldHandlers/Group.h +++ b/src/game/WorldHandlers/Group.h @@ -406,7 +406,7 @@ class Group void _setLeader(ObjectGuid guid); void _removeRolls(ObjectGuid guid); - + void _updateLeaderFlag(const bool remove = false); bool _setMembersGroup(ObjectGuid guid, uint8 group); diff --git a/src/game/WorldHandlers/GuildHandler.cpp b/src/game/WorldHandlers/GuildHandler.cpp index 85196b3e9..d07592a8b 100644 --- a/src/game/WorldHandlers/GuildHandler.cpp +++ b/src/game/WorldHandlers/GuildHandler.cpp @@ -535,7 +535,7 @@ void WorldSession::HandleGuildSetRankOpcode(WorldPacket& recvPacket) if (promote) { // allow to promote only to lower rank than member's rank - // and only to rank not higher that invoker's + // and only to rank not higher that invoker's if (GetPlayer()->GetRank() + 1 >= slot->RankId || newRankId <= GetPlayer()->GetRank()) { SendGuildCommandResult(GUILD_INVITE_S, plName, ERR_GUILD_RANK_TOO_HIGH_S); diff --git a/src/game/WorldHandlers/LFGMgr.cpp b/src/game/WorldHandlers/LFGMgr.cpp index a4cf2cdf2..3aa1f8d2a 100644 --- a/src/game/WorldHandlers/LFGMgr.cpp +++ b/src/game/WorldHandlers/LFGMgr.cpp @@ -48,19 +48,19 @@ LFGMgr::~LFGMgr() m_dailyTBCHeroic.clear(); m_dailyLKNormal.clear(); m_dailyLKHeroic.clear(); - + m_playerData.clear(); m_queueSet.clear(); - + m_playerStatusMap.clear(); m_groupStatusMap.clear(); m_groupSet.clear(); m_proposalMap.clear(); - + m_roleCheckMap.clear(); - + m_bootStatusMap.clear(); - + m_tankWaitTime.clear(); m_healerWaitTime.clear(); m_dpsWaitTime.clear(); @@ -70,26 +70,26 @@ LFGMgr::~LFGMgr() void LFGMgr::Update() { //todo: remove old queues, proposals & boot votes - + // remove old role checks RemoveOldRoleChecks(); - + // go through a waitTimeMap::iterator for each wait map and update times based on player count for (waitTimeMap::iterator tankItr = m_tankWaitTime.begin(); tankItr != m_tankWaitTime.end(); ++tankItr) - { + { LFGWait waitInfo = tankItr->second; if (waitInfo.doAverage) { int32 lastTime = waitInfo.previousTime; int32 thisTime = waitInfo.time; - + // average of the two join times waitInfo.time = (thisTime + lastTime) / 2; - + // now set what was just the current wait time to the previous time for a later calculation waitInfo.previousTime = thisTime; waitInfo.doAverage = false; - + tankItr->second = waitInfo; } } @@ -100,14 +100,14 @@ void LFGMgr::Update() { int32 lastTime = waitInfo.previousTime; int32 thisTime = waitInfo.time; - + // average of the two join times waitInfo.time = (thisTime + lastTime) / 2; - + // now set what was just the current wait time to the previous time for a later calculation waitInfo.previousTime = thisTime; waitInfo.doAverage = false; - + healItr->second = waitInfo; } } @@ -118,14 +118,14 @@ void LFGMgr::Update() { int32 lastTime = waitInfo.previousTime; int32 thisTime = waitInfo.time; - + // average of the two join times waitInfo.time = (thisTime + lastTime) / 2; - + // now set what was just the current wait time to the previous time for a later calculation waitInfo.previousTime = thisTime; waitInfo.doAverage = false; - + dpsItr->second = waitInfo; } } @@ -136,19 +136,19 @@ void LFGMgr::Update() { int32 lastTime = waitInfo.previousTime; int32 thisTime = waitInfo.time; - + // average of the two join times waitInfo.time = (thisTime + lastTime) / 2; - + // now set what was just the current wait time to the previous time for a later calculation waitInfo.previousTime = thisTime; waitInfo.doAverage = false; - + avgItr->second = waitInfo; } } - - // Queue System + + // Queue System FindQueueMatches(); SendQueueStatus(); } @@ -161,14 +161,14 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen Group* pGroup = plr->GetGroup(); ObjectGuid guid = (pGroup) ? pGroup->GetObjectGuid() : plr->GetObjectGuid(); uint32 randomDungeonID; // used later if random dungeon has been chosen - + LFGPlayers* currentInfo = GetPlayerOrPartyData(guid); - + // check if we actually have info on the player/group right now if (currentInfo) { bool groupCurrentlyInDungeon = pGroup && pGroup->isLFGGroup() && currentInfo->currentState != LFG_STATE_FINISHED_DUNGEON; - + // are they already queued? if (currentInfo->currentState == LFG_STATE_QUEUED) { @@ -178,22 +178,22 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen m_queueSet.erase(qItr); // note: do we need to send a packet telling them the current queue is over? } - + // are they already in a dungeon? if (groupCurrentlyInDungeon) { std::set currentDungeon = currentInfo->dungeonList; - + dungeons.clear(); dungeons.insert(*currentDungeon.begin()); // they should only have 1 dungeon in the map } } - + // used for upcoming checks bool isRandom = false; bool isRaid = false; bool isDungeon = false; - + LfgJoinResult result = GetJoinResult(plr); if (result == ERR_LFG_OK) { @@ -219,13 +219,13 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen result = ERR_LFG_MISMATCHED_SLOTS; isRaid = true; break; - default: // one of the other types + default: // one of the other types result = ERR_LFG_INVALID_SLOT; break; } } } - + // since our join result may have just changed, check it again if (result == ERR_LFG_OK) { @@ -235,11 +235,11 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen randomDungeonID = *dungeons.begin(); // fetch all dungeons with our groupID and add to set LfgDungeonsEntry const* dungeon = sLfgDungeonsStore.LookupEntry(*dungeons.begin()); - + if (dungeon) { uint32 group = dungeon->group_id; - + for (uint32 id = 0; id < sLfgDungeonsStore.GetNumRows(); ++id) { LfgDungeonsEntry const* dungeonList = sLfgDungeonsStore.LookupEntry(id); @@ -254,7 +254,7 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen result = ERR_LFG_NO_LFG_OBJECT; } } - + partyForbidden partyLockedDungeons; if (result == ERR_LFG_OK) { @@ -266,14 +266,14 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen if (Player* pGroupPlr = itr->getSource()) { ObjectGuid plrGuid = pGroupPlr->GetObjectGuid(); - + dungeonForbidden lockedDungeons = FindRandomDungeonsNotForPlayer(pGroupPlr); partyLockedDungeons[plrGuid] = lockedDungeons; - + for (dungeonForbidden::iterator it = lockedDungeons.begin(); it != lockedDungeons.end(); ++it) { uint32 dungeonID = (it->first & 0x00FFFFFF); - + std::set::iterator setItr = dungeons.find(dungeonID); if (setItr != dungeons.end()) dungeons.erase(*setItr); @@ -282,37 +282,37 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen } } else - { + { dungeonForbidden lockedDungeons = FindRandomDungeonsNotForPlayer(plr); partyLockedDungeons[guid] = lockedDungeons; - + for (dungeonForbidden::iterator it = lockedDungeons.begin(); it != lockedDungeons.end(); ++it) { uint32 dungeonID = (it->first & 0x00FFFFFF); - + std::set::iterator setItr = dungeons.find(dungeonID); if (setItr != dungeons.end()) dungeons.erase(*setItr); } } - + if (!dungeons.empty()) partyLockedDungeons.clear(); else result = (pGroup) ? ERR_LFG_NO_SLOTS_PARTY : ERR_LFG_NO_SLOTS_PLAYER; } - + // If our result is not ERR_LFG_OK, send join result now with err message if (result != ERR_LFG_OK) { plr->GetSession()->SendLfgJoinResult(result, LFG_STATE_NONE, partyLockedDungeons); return; } - + if (pGroup) { ObjectGuid leaderGuid = pGroup->GetLeaderGuid(); - + LFGRoleCheck roleCheck; roleCheck.state = LFG_ROLECHECK_INITIALITING; roleCheck.dungeonList = dungeons; @@ -321,33 +321,33 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen roleCheck.waitForRoleTime = time_t(time(NULL) + LFG_TIME_ROLECHECK); m_roleCheckMap[guid] = roleCheck; - + // place original dungeon ID back in the set if (isRandom) { dungeons.clear(); dungeons.insert(randomDungeonID); } - + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { if (Player* pGroupPlr = itr->getSource()) { LFGPlayerStatus overallStatus(LFG_STATE_NONE, LFG_UPDATE_JOIN, dungeons, comments); - + pGroupPlr->GetSession()->SendLfgUpdate(true, overallStatus); overallStatus.state = LFG_STATE_ROLECHECK; - + ObjectGuid plrGuid = pGroupPlr->GetObjectGuid(); roleCheck.currentRoles[plrGuid] = 0; - + m_playerStatusMap[plrGuid] = overallStatus; } } // used later if they enter the queue LFGPlayers groupInfo(LFG_STATE_NONE, dungeons, roleCheck.currentRoles, comments, false, time(NULL), 0, 0, 0); m_playerData[guid] = groupInfo; - + PerformRoleCheck(plr, pGroup, (uint8)roles); } else @@ -358,25 +358,25 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen dungeons.clear(); dungeons.insert(randomDungeonID); } - + // set up a role map and then an lfgplayer struct roleMap playerRole; playerRole[guid] = (uint8)roles; - + LFGPlayers playerInfo(LFG_STATE_QUEUED, dungeons, playerRole, comments, false, time(NULL), 0, 0, 0); m_playerData[guid] = playerInfo; - + // set up a status struct for client requests/updates LFGPlayerStatus plrStatus; plrStatus.updateType = LFG_UPDATE_JOIN; plrStatus.state = LFG_STATE_NONE; plrStatus.dungeonList = dungeons; plrStatus.comment = comments; - + // Send information back to the client plr->GetSession()->SendLfgJoinResult(result, LFG_STATE_NONE, partyLockedDungeons); plr->GetSession()->SendLfgUpdate(false, plrStatus); - + plrStatus.state = LFG_STATE_QUEUED; m_playerStatusMap[guid] = plrStatus; AddToQueue(guid); @@ -384,18 +384,18 @@ void LFGMgr::JoinLFG(uint32 roles, std::set dungeons, std::string commen } void LFGMgr::LeaveLFG(Player* plr, bool isGroup) -{ +{ if (isGroup) { Group* pGroup = plr->GetGroup(); ObjectGuid grpGuid = pGroup->GetObjectGuid(); - + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { if (Player* pGroupPlr = itr->getSource()) { ObjectGuid grpPlrGuid = pGroupPlr->GetObjectGuid(); - + LFGPlayerStatus grpPlrStatus = GetPlayerStatus(grpPlrGuid); switch (grpPlrStatus.state) { @@ -410,19 +410,19 @@ void LFGMgr::LeaveLFG(Player* plr, bool isGroup) break; //todo: other state cases after they get implemented } - + m_playerData.erase(grpPlrGuid); m_playerStatusMap.erase(grpPlrGuid); } } - + m_queueSet.erase(grpGuid); m_playerData.erase(grpGuid); } else { ObjectGuid plrGuid = plr->GetObjectGuid(); - + LFGPlayerStatus plrStatus = GetPlayerStatus(plrGuid); switch (plrStatus.state) { @@ -434,12 +434,12 @@ void LFGMgr::LeaveLFG(Player* plr, bool isGroup) break; // do other states after being implemented, if applicable for a single plr } - + m_queueSet.erase(plrGuid); m_playerData.erase(plrGuid); m_playerStatusMap.erase(plrGuid); } - + } LFGPlayers* LFGMgr::GetPlayerOrPartyData(ObjectGuid guid) @@ -464,10 +464,10 @@ LfgJoinResult LFGMgr::GetJoinResult(Player* plr) { LfgJoinResult result; Group* pGroup = plr->GetGroup(); - + /* Reasons for not entering: * Deserter spell - * Dungeon finder cooldown + * Dungeon finder cooldown * In a battleground * In an arena * Queued for battleground @@ -483,9 +483,9 @@ LfgJoinResult LFGMgr::GetJoinResult(Player* plr) result = ERR_LFG_CANT_USE_DUNGEONS; else if (plr->HasAura(LFG_COOLDOWN_SPELL)) result = ERR_LFG_RANDOM_COOLDOWN_PLAYER; - + if (pGroup) - { + { if (pGroup->GetMembersCount() > 5) result = ERR_LFG_TOO_MANY_MEMBERS; else @@ -506,29 +506,29 @@ LfgJoinResult LFGMgr::GetJoinResult(Player* plr) result = ERR_LFG_RANDOM_COOLDOWN_PARTY; else result = ERR_LFG_OK; - + ++currentMemberCount; } } - + if (result == ERR_LFG_OK && currentMemberCount != pGroup->GetMembersCount()) result = ERR_LFG_MEMBERS_NOT_PRESENT; } } else result = ERR_LFG_OK; - + return result; } LFGPlayerStatus LFGMgr::GetPlayerStatus(ObjectGuid guid) { LFGPlayerStatus status; - + playerStatusMap::iterator it = m_playerStatusMap.find(guid); if (it != m_playerStatusMap.end()) status = it->second; - + return status; } @@ -536,7 +536,7 @@ void LFGMgr::SetPlayerComment(ObjectGuid guid, std::string comment) { LFGPlayerStatus status = GetPlayerStatus(guid); status.comment = comment; - + m_playerStatusMap[guid] = status; } @@ -544,7 +544,7 @@ void LFGMgr::SetPlayerState(ObjectGuid guid, LFGState state) { LFGPlayerStatus status = GetPlayerStatus(guid); status.state = state; - + m_playerStatusMap[guid] = status; } @@ -552,7 +552,7 @@ void LFGMgr::SetPlayerUpdateType(ObjectGuid guid, LfgUpdateType updateType) { LFGPlayerStatus status = GetPlayerStatus(guid); status.updateType = updateType; - + m_playerStatusMap[guid] = status; } @@ -565,7 +565,7 @@ ItemRewards LFGMgr::GetDungeonItemRewards(uint32 dungeonId, DungeonTypes type) uint32 minLevel = dungeon->minLevel; uint32 maxLevel = dungeon->maxLevel; uint32 avgLevel = (minLevel+maxLevel)/2; // otherwise there are issues - + DungeonFinderItemsMap const& itemBuffer = sObjectMgr.GetDungeonFinderItemsMap(); for (DungeonFinderItemsMap::const_iterator it = itemBuffer.begin(); it != itemBuffer.end(); ++it) { @@ -685,7 +685,7 @@ bool LFGMgr::IsSeasonActive(uint32 dungeonId) dungeonEntries LFGMgr::FindRandomDungeonsForPlayer(uint32 level, uint8 expansion) { dungeonEntries randomDungeons; - + // go through the dungeon dbc and select the applicable dungeons for (uint32 id = 0; id < sLfgDungeonsStore.GetNumRows(); ++id) { @@ -706,7 +706,7 @@ dungeonForbidden LFGMgr::FindRandomDungeonsNotForPlayer(Player* plr) { uint32 level = plr->getLevel(); uint8 expansion = plr->GetSession()->Expansion(); - + dungeonForbidden randomDungeons; for (uint32 id = 0; id < sLfgDungeonsStore.GetNumRows(); ++id) @@ -715,7 +715,7 @@ dungeonForbidden LFGMgr::FindRandomDungeonsNotForPlayer(Player* plr) if (dungeon) { uint32 forbiddenReason = 0; - + if ((uint8)dungeon->expansionLevel > expansion) forbiddenReason = (uint32)LFG_FORBIDDEN_EXPANSION; else if (dungeon->typeID == LFG_TYPE_RAID) @@ -745,7 +745,7 @@ dungeonForbidden LFGMgr::FindRandomDungeonsNotForPlayer(Player* plr) else if (req->item2 && !plr->HasItemCount(req->item2, 1)) forbiddenReason = LFG_FORBIDDEN_MISSING_ITEM; } - + if (forbiddenReason) randomDungeons[dungeon->Entry()] = forbiddenReason; } @@ -760,7 +760,7 @@ void LFGMgr::UpdateNeededRoles(ObjectGuid guid, LFGPlayers* information) { uint8 withoutLeader = it->second; withoutLeader &= ~PLAYER_ROLE_LEADER; - + switch (withoutLeader) { case PLAYER_ROLE_TANK: @@ -776,7 +776,7 @@ void LFGMgr::UpdateNeededRoles(ObjectGuid guid, LFGPlayers* information) } std::set::iterator itr = information->dungeonList.begin(); - + // check dungeon type for max of each role [normal heroic etc.] LfgDungeonsEntry const* dungeon = sLfgDungeonsStore.LookupEntry(*itr); if (dungeon) @@ -789,7 +789,7 @@ void LFGMgr::UpdateNeededRoles(ObjectGuid guid, LFGPlayers* information) information->neededDps = NORMAL_DAMAGE_COUNT - dpsCount; } } - + m_playerData[guid] = *information; } @@ -798,14 +798,14 @@ void LFGMgr::AddToQueue(ObjectGuid guid) LFGPlayers* information = GetPlayerOrPartyData(guid); if (!information) return; - + // This will be necessary for finding matches in the queue UpdateNeededRoles(guid, information); - + // put info into wait time maps for starters for (roleMap::iterator it = information->currentRoles.begin(); it != information->currentRoles.end(); ++it) AddToWaitMap(it->second, information->dungeonList); - + // just in case someone's already been in the queue. queueSet::iterator qItr = m_queueSet.find(guid); if (qItr == m_queueSet.end()) @@ -815,7 +815,7 @@ void LFGMgr::AddToQueue(ObjectGuid guid) void LFGMgr::RemoveFromQueue(ObjectGuid guid) { m_queueSet.erase(guid); - + //todo - might need to implement a removefromwaitmap function } @@ -824,7 +824,7 @@ void LFGMgr::AddToWaitMap(uint8 role, std::set dungeons) // use withoutLeader for switch operator uint8 withoutLeader = role; withoutLeader &= ~PLAYER_ROLE_LEADER; - + switch (withoutLeader) { case PLAYER_ROLE_TANK: @@ -881,7 +881,7 @@ void LFGMgr::AddToWaitMap(uint8 role, std::set dungeons) default: break; } - + // insert the average time regardless of role for (std::set::iterator itr = dungeons.begin(); itr != dungeons.end(); ++itr) { @@ -916,7 +916,7 @@ void LFGMgr::FindSpecificQueueMatches(ObjectGuid guid) { if (*itr == guid) continue; - + LFGPlayers* matchInfo = GetPlayerOrPartyData(*itr); if (matchInfo) { @@ -927,13 +927,13 @@ void LFGMgr::FindSpecificQueueMatches(ObjectGuid guid) // 3. Regardless of outcome, after the end of calculations send a LFGQueueStatus packet bool fullyCompatible = false; std::set compatibleDungeons; - + for (std::set::iterator dItr = matchInfo->dungeonList.begin(); dItr != matchInfo->dungeonList.end(); ++itr) { if (queueInfo->dungeonList.find(*dItr) != queueInfo->dungeonList.end()) compatibleDungeons.insert(*dItr); } - + if (!compatibleDungeons.empty()) { // check for player / role count and also team compatibility @@ -973,46 +973,46 @@ bool LFGMgr::MatchesAreOfSameTeam(LFGPlayers* groupOne, LFGPlayers* groupTwo) // determine compatibility roleMap::iterator it1 = groupOne->currentRoles.begin(); roleMap::iterator it2 = groupTwo->currentRoles.begin(); - + // now we find the players from the maps Player* pPlayer1 = ObjectAccessor::FindPlayer(it1->first); Player* pPlayer2 = ObjectAccessor::FindPlayer(it2->first); - + // todo: disable this if a config option is set if (pPlayer1->GetTeamId() == pPlayer2->GetTeamId()) return true; - + return false; } void LFGMgr::MergeGroups(ObjectGuid guidOne, ObjectGuid guidTwo, std::set compatibleDungeons) -{ +{ // merge into the entry for rawGuidOne, then see if they are // able to enter the dungeon at this point or not LFGPlayers* mainGroup = GetPlayerOrPartyData(guidOne); LFGPlayers* bufferGroup = GetPlayerOrPartyData(guidTwo); - + if (!mainGroup || !bufferGroup) return; - + // update the dungeon selection with the compatible ones mainGroup->dungeonList.clear(); mainGroup->dungeonList = compatibleDungeons; - + // move players / roles into a single roleMap for (roleMap::iterator it = bufferGroup->currentRoles.begin(); it != bufferGroup->currentRoles.end(); ++it) mainGroup->currentRoles[it->first] = it->second; - + // update the role count / needed role info UpdateNeededRoles(guidOne, mainGroup); - + // being safe //mainGroup = GetPlayerOrPartyData(rawGuidOne); - + // Then do the following: if ((mainGroup->neededTanks == 0) && (mainGroup->neededHealers == 0) && (mainGroup->neededDps == 0)) SendDungeonProposal(mainGroup); - + m_playerData.erase(guidTwo); } @@ -1020,7 +1020,7 @@ void LFGMgr::SendQueueStatus() { // First we should get the current time time_t timeNow = time(0); - + // Check who is listed as being in the queue for (queueSet::iterator itr = m_queueSet.begin(); itr != m_queueSet.end(); ++itr) { @@ -1033,20 +1033,20 @@ void LFGMgr::SendQueueStatus() if (Player* pPlayer = ObjectAccessor::FindPlayer(rItr->first)) { uint32 dungeonId = *queueInfo->dungeonList.begin(); - + LFGQueueStatus status; status.dungeonID = dungeonId; status.neededTanks = queueInfo->neededTanks; status.neededHeals = queueInfo->neededHealers; status.neededDps = queueInfo->neededDps; status.timeSpentInQueue = uint32(timeNow - queueInfo->joinedTime); - + int32 playerWaitTime; - + // strip leader flag from role uint8 withoutLeader = rItr->second; withoutLeader &= ~PLAYER_ROLE_LEADER; - + switch (withoutLeader) { case PLAYER_ROLE_TANK: @@ -1059,13 +1059,13 @@ void LFGMgr::SendQueueStatus() playerWaitTime = m_dpsWaitTime[dungeonId].time; break; } - + status.playerAvgWaitTime = playerWaitTime; status.dpsAvgWaitTime = m_dpsWaitTime[dungeonId].time; status.healerAvgWaitTime = m_healerWaitTime[dungeonId].time; status.tankAvgWaitTime = m_tankWaitTime[dungeonId].time; status.avgWaitTime = m_avgWaitTime[dungeonId].time; - + // Send packet to client pPlayer->GetSession()->SendLfgQueueStatus(status); } @@ -1088,14 +1088,14 @@ void LFGMgr::PerformRoleCheck(Player* pPlayer, Group* pGroup, uint8 roles) { ObjectGuid groupGuid = pGroup->GetObjectGuid(); ObjectGuid plrGuid = pPlayer->GetObjectGuid(); - + roleCheckMap::iterator it = m_roleCheckMap.find(groupGuid); if (it == m_roleCheckMap.end()) return; // no role check map found - + LFGRoleCheck roleCheck = it->second; bool roleChosen = roleCheck.state != LFG_ROLECHECK_DEFAULT && plrGuid; - + if (!plrGuid) roleCheck.state = LFG_ROLECHECK_ABORTED; // aborted if anyone cancels during role check else if (roles < PLAYER_ROLE_TANK) // kind of a sanity check- the client shouldn't allow this to happen @@ -1103,35 +1103,35 @@ void LFGMgr::PerformRoleCheck(Player* pPlayer, Group* pGroup, uint8 roles) else { roleCheck.currentRoles[plrGuid] = roles; - + roleMap::iterator rItr = roleCheck.currentRoles.begin(); do { if (rItr->second != PLAYER_ROLE_NONE) ++rItr; } while (rItr != roleCheck.currentRoles.end()); - + if (rItr == roleCheck.currentRoles.end()) // meaning that everyone confirmed their roles roleCheck.state = ValidateGroupRoles(roleCheck.currentRoles) ? LFG_ROLECHECK_FINISHED : LFG_ROLECHECK_MISSING_ROLE; } - + std::set dungeonBuff; if (roleCheck.randomDungeonID) dungeonBuff.insert(roleCheck.randomDungeonID); else dungeonBuff = roleCheck.dungeonList; - + partyForbidden nullForbidden; - + for (roleMap::iterator itr = roleCheck.currentRoles.begin(); itr != roleCheck.currentRoles.end(); ++itr) { ObjectGuid guidBuff = itr->first; if (roleChosen) SendRoleChosen(guidBuff, plrGuid, roles); // send SMSG_LFG_ROLE_CHOSEN to each player - + // send SMSG_LFG_ROLE_CHECK_UPDATE SendRoleCheckUpdate(guidBuff, roleCheck); - + switch (roleCheck.state) { case LFG_ROLECHECK_INITIALITING: @@ -1151,30 +1151,30 @@ void LFGMgr::PerformRoleCheck(Player* pPlayer, Group* pGroup, uint8 roles) break; } } - + if (roleCheck.state == LFG_ROLECHECK_FINISHED) { LFGPlayers* queueInfo = GetPlayerOrPartyData(groupGuid); queueInfo->currentState = LFG_STATE_QUEUED; queueInfo->currentRoles = roleCheck.currentRoles; queueInfo->joinedTime = time(NULL); - + m_playerData[groupGuid] = *queueInfo; - + AddToQueue(groupGuid); } else if (roleCheck.state != LFG_ROLECHECK_INITIALITING) { // todo: add players back to individual queues if applicable roleCheck.state = LFG_ROLECHECK_NO_ROLE; - + for (roleMap::iterator roleMapItr = roleCheck.currentRoles.begin(); roleMapItr != roleCheck.currentRoles.end(); ++roleMapItr) { ObjectGuid plrGuid = roleMapItr->first; - + SetPlayerState(plrGuid, LFG_STATE_NONE); - - SendRoleCheckUpdate(plrGuid, roleCheck); // role check failed + + SendRoleCheckUpdate(plrGuid, roleCheck); // role check failed SendLfgUpdate(plrGuid, GetPlayerStatus(plrGuid), true); // not in lfg system anymore } m_roleCheckMap.erase(groupGuid); @@ -1185,14 +1185,14 @@ bool LFGMgr::ValidateGroupRoles(roleMap groupMap) { if (groupMap.empty()) // sanity check return false; - + uint8 tankCount = 0, dpsCount = 0, healCount = 0; - + for (roleMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it) { uint8 withoutLeader = it->second; withoutLeader &= ~PLAYER_ROLE_LEADER; - + switch (withoutLeader) { case PLAYER_ROLE_TANK: @@ -1206,7 +1206,7 @@ bool LFGMgr::ValidateGroupRoles(roleMap groupMap) break; } } - + return (tankCount + dpsCount + healCount == groupMap.size()) ? true : false; } @@ -1214,9 +1214,9 @@ bool LFGMgr::ValidateGroupRoles(roleMap groupMap) void LFGMgr::SendDungeonProposal(LFGPlayers* lfgGroup) { ++m_proposalId; // increment number to make a new proposal id - + std::set::iterator dItr = lfgGroup->dungeonList.begin(); - + // note: group create function's parameters are leader guid & leader name LFGProposal newProposal; newProposal.id = m_proposalId; @@ -1226,9 +1226,9 @@ void LFGMgr::SendDungeonProposal(LFGPlayers* lfgGroup) newProposal.dungeonID = *dItr; newProposal.isNew = true; newProposal.joinedQueue = lfgGroup->joinedTime; - + bool premadeGroup = IsProposalSameGroup(newProposal); - + // iterate through role map just so get everyone's guid for (roleMap::iterator it = lfgGroup->currentRoles.begin(); it != lfgGroup->currentRoles.end(); ++it) { @@ -1236,21 +1236,21 @@ void LFGMgr::SendDungeonProposal(LFGPlayers* lfgGroup) SetPlayerState(plrGuid, LFG_STATE_PROPOSAL); Player* pPlayer = ObjectAccessor::FindPlayer(plrGuid); - + if (Group* pGroup = pPlayer->GetGroup()) { ObjectGuid grpGuid = pGroup->GetObjectGuid(); - + SetPlayerUpdateType(plrGuid, LFG_UPDATE_PROPOSAL_BEGIN); - + if (premadeGroup && pGroup->IsLeader(plrGuid)) newProposal.groupLeaderGuid = plrGuid.GetRawValue(); - + if (premadeGroup && !newProposal.groupRawGuid) newProposal.groupRawGuid = grpGuid.GetRawValue(); newProposal.groups[plrGuid] = grpGuid; - + SendLfgUpdate(plrGuid, GetPlayerStatus(plrGuid), true); } else @@ -1259,24 +1259,24 @@ void LFGMgr::SendDungeonProposal(LFGPlayers* lfgGroup) //SetPlayerUpdateType(plrGuid, LFG_UPDATE_GROUP_FOUND); //SendLfgUpdate(plrGuid, GetPlayerStatus(plrGuid), false); - + SetPlayerUpdateType(plrGuid, LFG_UPDATE_PROPOSAL_BEGIN); SendLfgUpdate(plrGuid, GetPlayerStatus(plrGuid), false); } - + newProposal.answers[plrGuid] = LFG_ANSWER_PENDING; - + // then send SMSG_LFG_PROPOSAL_UPDATE pPlayer->GetSession()->SendLfgProposalUpdate(newProposal); } - + // then if group guid is set, call Group::SetAsLfgGroup() if (premadeGroup) { Player* pGroupLeader = ObjectAccessor::FindPlayer(ObjectGuid(newProposal.groupLeaderGuid)); pGroupLeader->GetGroup()->SetAsLfgGroup(); } - + // also save the proposal m_proposalMap[newProposal.id] = newProposal; } @@ -1285,19 +1285,19 @@ bool LFGMgr::IsProposalSameGroup(LFGProposal const& proposal) { bool firstLoop = true; bool isSameGroup = true; - + ObjectGuid priorGroupGuid; - + // when this is called we don't have the groups part filled, so iterate via role map for (roleMap::const_iterator it = proposal.currentRoles.begin(); it != proposal.currentRoles.end(); ++it) { ObjectGuid plrGuid = it->first; - + Player* pPlayer = ObjectAccessor::FindPlayer(plrGuid); if (Group* pGroup = pPlayer->GetGroup()) { ObjectGuid grpGuid = pGroup->GetObjectGuid(); - + if (firstLoop) priorGroupGuid = grpGuid; else @@ -1318,26 +1318,26 @@ void LFGMgr::ProposalUpdate(uint32 proposalID, ObjectGuid plrGuid, bool accepted { //note: create a group here if it doesn't exist and everyone accepted proposal LFGProposal* proposal = GetProposalData(proposalID); - + if (!proposal) return; - + bool allOkay = true; // true if everyone answered LFG_ANSWER_AGREE - + // Update answer map to given value LFGProposalAnswer plrAnswer = (LFGProposalAnswer)accepted; proposal->answers[plrGuid] = plrAnswer; - + // If the player declined, the proposal is over if (plrAnswer == LFG_ANSWER_DENY) ProposalDeclined(plrGuid, proposal); - + for (proposalAnswerMap::iterator it = proposal->answers.begin(); it != proposal->answers.end(); ++it) { if (it->second != LFG_ANSWER_AGREE) allOkay = false; } - + // if !allOkay, send proposal updates to all if (!allOkay) { @@ -1347,15 +1347,15 @@ void LFGMgr::ProposalUpdate(uint32 proposalID, ObjectGuid plrGuid, bool accepted Player* pProposalPlayer = ObjectAccessor::FindPlayer(proposalPlrGuid); pProposalPlayer->GetSession()->SendLfgProposalUpdate(*proposal); } - + return; } - + // at this point everyone's good to join the dungeon! - + time_t joinedTime = time(NULL); bool sendProposalUpdate = proposal->state != LFG_PROPOSAL_SUCCESS; - + // now update the proposal's state to successful and inform the players proposal->state = LFG_PROPOSAL_SUCCESS; for (roleMap::iterator rItr = proposal->currentRoles.begin(); rItr != proposal->currentRoles.end(); ++rItr) @@ -1363,23 +1363,23 @@ void LFGMgr::ProposalUpdate(uint32 proposalID, ObjectGuid plrGuid, bool accepted // get the player's role uint8 proposalPlrRole = rItr->second; proposalPlrRole &= ~PLAYER_ROLE_LEADER; - + ObjectGuid proposalPlrGuid = rItr->first; Player* pProposalPlayer = ObjectAccessor::FindPlayer(proposalPlrGuid); - + if (sendProposalUpdate) pProposalPlayer->GetSession()->SendLfgProposalUpdate(*proposal); - + // amount of time spent in queue int32 timeWaited = (joinedTime - proposal->joinedQueue) / IN_MILLISECONDS; - + // tell the lfg system to update the average wait times on the next tick UpdateWaitMap(LFGRoles(proposalPlrRole), proposal->dungeonID, timeWaited); - + // send some updates to the player, depending on group status LFGPlayerStatus proposalPlrStatus = GetPlayerStatus(proposalPlrGuid); proposalPlrStatus.updateType = LFG_UPDATE_GROUP_FOUND; - + if (pProposalPlayer->GetGroup()) { SendLfgUpdate(proposalPlrGuid, proposalPlrStatus, true); @@ -1394,10 +1394,10 @@ void LFGMgr::ProposalUpdate(uint32 proposalID, ObjectGuid plrGuid, bool accepted proposalPlrStatus.updateType = LFG_UPDATE_LEAVE; SendLfgUpdate(proposalPlrGuid, proposalPlrStatus, false); SendLfgUpdate(proposalPlrGuid, proposalPlrStatus, true); - + proposalPlrStatus.state = LFG_STATE_IN_DUNGEON; } - + CreateDungeonGroup(proposal); m_proposalMap.erase(proposal->id); } @@ -1416,27 +1416,27 @@ void LFGMgr::CreateDungeonGroup(LFGProposal* proposal) { if (!proposal) return; - + Group* pGroup; - + if (!proposal->groupRawGuid) { bool leaderIsSet = false; bool leaderRoleIsSet = HasLeaderFlag(proposal->currentRoles); ObjectGuid leaderGuid; - + pGroup = new Group(); - + for (playerGroupMap::iterator it = proposal->groups.begin(); it != proposal->groups.end(); ++it) { // remove plr from group w/ guid it->second // set leader on first loop, then set leaderisset to true ObjectGuid pGroupPlrGuid = it->first; Player* pGroupPlr = ObjectAccessor::FindPlayer(pGroupPlrGuid); - + if (it->second) pGroupPlr->GetGroup()->RemoveMember(pGroupPlrGuid, 0); - + if (!leaderIsSet) { bool currentPlrIsLeader = false; @@ -1448,9 +1448,9 @@ void LFGMgr::CreateDungeonGroup(LFGProposal* proposal) { leaderGuid = itr->first; Player* leaderRef = ObjectAccessor::FindPlayer(leaderGuid); - + pGroup->Create(leaderRef->GetObjectGuid(), leaderRef->GetName()); - + if (pGroupPlrGuid == leaderGuid) currentPlrIsLeader = true; } @@ -1458,10 +1458,10 @@ void LFGMgr::CreateDungeonGroup(LFGProposal* proposal) } else pGroup->Create(pGroupPlrGuid, pGroupPlr->GetName()); - + if (!currentPlrIsLeader) pGroup->AddMember(pGroupPlrGuid, pGroupPlr->GetName()); - + leaderIsSet = true; } else if (leaderIsSet && pGroupPlrGuid != leaderGuid) @@ -1474,39 +1474,39 @@ void LFGMgr::CreateDungeonGroup(LFGProposal* proposal) Player* pGroupLeader = ObjectAccessor::FindPlayer(ObjectGuid(proposal->groupLeaderGuid)); pGroup = pGroupLeader->GetGroup(); } - + // set dungeon difficulty for group LfgDungeonsEntry const* dungeon = sLfgDungeonsStore.LookupEntry(proposal->dungeonID); if (!dungeon) return; - + pGroup->SetDungeonDifficulty(Difficulty(dungeon->difficulty)); //todo: check for raids and if so call setraiddifficulty - + // Add group to our group set and group map, then teleport to the dungeon ObjectGuid groupGuid = pGroup->GetObjectGuid(); LFGGroupStatus groupStatus(LFG_STATE_IN_DUNGEON, dungeon->ID, proposal->currentRoles, pGroup->GetLeaderGuid()); - + m_groupSet.insert(groupGuid); m_groupStatusMap[groupGuid] = groupStatus; TeleportToDungeon(dungeon->ID, pGroup); - + pGroup->SendUpdate(); } void LFGMgr::TeleportToDungeon(uint32 dungeonID, Group* pGroup) { // if the group's leader is already in the dungeon, teleport anyone not in dungeon to them - // if nobody is in the dungeon, teleport all to beginning of dungeon (sObjectMgr.GetMapEntranceTrigger(mapid [not dungeonid])) + // if nobody is in the dungeon, teleport all to beginning of dungeon (sObjectMgr.GetMapEntranceTrigger(mapid [not dungeonid])) LfgDungeonsEntry const* dungeon = sLfgDungeonsStore.LookupEntry(dungeonID); if (!dungeon || !pGroup) return; - + uint32 mapID = (uint32)dungeon->mapID; float x, y, z, o; LFGTeleportError err = LFG_TELEPORTERROR_OK; - + Player* pGroupLeader = ObjectAccessor::FindPlayer(pGroup->GetLeaderGuid()); - + if (pGroupLeader && pGroupLeader->GetMapId() == mapID) // Already in the dungeon { // set teleport location to that of the group leader @@ -1527,7 +1527,7 @@ void LFGMgr::TeleportToDungeon(uint32 dungeonID, Group* pGroup) else err = LFG_TELEPORTERROR_INVALID_LOCATION; } - + dungeonForbidden lockedDungeons; for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { @@ -1535,27 +1535,27 @@ void LFGMgr::TeleportToDungeon(uint32 dungeonID, Group* pGroup) { // further checks: player is dead, in vehicle, in battleground, on taxi, etc LFGTeleportError plrErr = LFG_TELEPORTERROR_OK; - + if (pGroupPlr->IsDead()) plrErr = LFG_TELEPORTERROR_PLAYER_DEAD; if (pGroupPlr->IsFalling()) plrErr = LFG_TELEPORTERROR_FALLING; if (pGroupPlr->GetVehicleInfo()) plrErr = LFG_TELEPORTERROR_IN_VEHICLE; - + lockedDungeons = FindRandomDungeonsNotForPlayer(pGroupPlr); if (lockedDungeons.find(dungeon->Entry()) != lockedDungeons.end()) plrErr = LFG_TELEPORTERROR_INVALID_LOCATION; - + if (err == LFG_TELEPORTERROR_OK && plrErr == LFG_TELEPORTERROR_OK && pGroupPlr->GetMapId() != mapID) { if (pGroupPlr->GetMap() && !pGroupPlr->GetMap()->IsDungeon() && !pGroupPlr->GetMap()->IsRaid() && !pGroupPlr->InBattleGround()) pGroupPlr->SetBattleGroundEntryPoint(); // store current position and such - + if (!pGroupPlr->TeleportTo(mapID, x, y, z, o)) plrErr = LFG_TELEPORTERROR_INVALID_LOCATION; } - + if (err != LFG_TELEPORTERROR_OK) pGroupPlr->GetSession()->SendLfgTeleportError(err); else if (plrErr != LFG_TELEPORTERROR_OK) @@ -1571,13 +1571,13 @@ void LFGMgr::TeleportPlayer(Player* pPlayer, bool out) // Fetch necessary data first Group* pGroup = pPlayer->GetGroup(); LFGGroupStatus* status = GetGroupStatus(pGroup->GetObjectGuid()); - + if (!pGroup || !status) { pPlayer->GetSession()->SendLfgTeleportError((uint8)LFG_TELEPORTERROR_INVALID_LOCATION); return; } - + // Get dungeon info and then teleport the player out if applicable if (out) { @@ -1599,29 +1599,29 @@ LFGGroupStatus* LFGMgr::GetGroupStatus(ObjectGuid guid) void LFGMgr::ProposalDeclined(ObjectGuid guid, LFGProposal* proposal) { Player* pPlayer = ObjectAccessor::FindPlayer(guid); - + if (!pPlayer) return; - + bool leaveGroupLFG = false; - + for (roleMap::iterator it = proposal->currentRoles.begin(); it != proposal->currentRoles.end(); ++it) { ObjectGuid groupPlrGuid = it->first; - - // update each player with a LFG_UPDATE_PROPOSAL_DECLINED + + // update each player with a LFG_UPDATE_PROPOSAL_DECLINED SetPlayerUpdateType(groupPlrGuid, LFG_UPDATE_PROPOSAL_DECLINED); Player* pGroupPlayer = ObjectAccessor::FindPlayer(groupPlrGuid); Group* pGroup = pGroupPlayer->GetGroup(); - + // if player was in a premade group and declined, remove the group. if (groupPlrGuid == guid) { //LeaveLFG(pGroupPlayer, true); if (pGroup && (pGroup->GetObjectGuid().GetRawValue() == proposal->groupRawGuid)) leaveGroupLFG = true; - + SendLfgUpdate(groupPlrGuid, GetPlayerStatus(groupPlrGuid), false); } else @@ -1632,7 +1632,7 @@ void LFGMgr::ProposalDeclined(ObjectGuid guid, LFGProposal* proposal) SendLfgUpdate(groupPlrGuid, GetPlayerStatus(groupPlrGuid), false); } } - + if (!leaveGroupLFG) { proposal->currentRoles.erase(guid); @@ -1643,7 +1643,7 @@ void LFGMgr::ProposalDeclined(ObjectGuid guid, LFGProposal* proposal) { m_proposalMap.erase(proposal->id); } - + LeaveLFG(pPlayer, leaveGroupLFG); } @@ -1651,7 +1651,7 @@ void LFGMgr::UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime) { if (!role || !dungeonID || !waitTime) return; - + switch (role) { case PLAYER_ROLE_TANK: @@ -1660,11 +1660,11 @@ void LFGMgr::UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime) if (it != m_tankWaitTime.end()) { LFGWait wait = it->second; - + wait.previousTime = wait.time; wait.time = waitTime; wait.doAverage = true; - + m_tankWaitTime[dungeonID] = wait; } } @@ -1675,11 +1675,11 @@ void LFGMgr::UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime) if (hIt != m_healerWaitTime.end()) { LFGWait wait = hIt->second; - + wait.previousTime = wait.time; wait.time = waitTime; wait.doAverage = true; - + m_healerWaitTime[dungeonID] = wait; } } @@ -1690,11 +1690,11 @@ void LFGMgr::UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime) if (dIt != m_dpsWaitTime.end()) { LFGWait wait = dIt->second; - + wait.previousTime = wait.time; wait.time = waitTime; wait.doAverage = true; - + m_dpsWaitTime[dungeonID] = wait; } } @@ -1705,61 +1705,61 @@ void LFGMgr::UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime) if (aIt != m_avgWaitTime.end()) { LFGWait wait = aIt->second; - + wait.previousTime = wait.time; wait.time = waitTime; wait.doAverage = true; - + m_avgWaitTime[dungeonID] = wait; } } break; } - + } void LFGMgr::HandleBossKilled(Player* pPlayer) { Group* pGroup = pPlayer->GetGroup(); - + ObjectGuid groupGuid = pGroup->GetObjectGuid(); LFGGroupStatus* status = GetGroupStatus(groupGuid); - + if (!pGroup || !status) return; - + // set each player's lfgstate to LFG_STATE_FINISHED_DUNGEON // fetch reward info, and if it's the first dungeon of the day (per player), // give them 2x the xp (or 1x if it's not the first), and the reward item // (special case for 2nd wotlk heroic and +). If no room in inventory, send // via ingame mail. status->state = LFG_STATE_FINISHED_DUNGEON; - + DungeonTypes type = GetDungeonType(status->dungeonID); for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) //todo: check if we will need to use mail or not { if (Player* pGroupPlr = itr->getSource()) { SetPlayerState(pGroupPlr->GetObjectGuid(), LFG_STATE_FINISHED_DUNGEON); - + // check if player did a random dungeon uint32 randomDungeonId = 0; LfgDungeonsEntry const* dungeon = sLfgDungeonsStore.LookupEntry(status->dungeonID); if (dungeon->typeID == LFG_TYPE_RANDOM_DUNGEON || IsSeasonal(dungeon->flags)) randomDungeonId = dungeon->ID; - + // get rewards uint32 groupPlrLevel = pGroupPlr->getLevel(); const DungeonFinderRewards* rewards = sObjectMgr.GetDungeonFinderRewards(groupPlrLevel); // Fetch base xp/money reward ItemRewards itemRewards = GetDungeonItemRewards(status->dungeonID, type); // fetch item reward - + int32 multiplier; // base reward modifier bool hasDoneDaily = HasPlayerDoneDaily(pGroupPlr->GetGUIDLow(), type); // first dungeon of the day? (hasDoneDaily) ? multiplier = 1 : multiplier = 2; - + uint32 xpReward = multiplier*rewards->baseXPReward; // player's xp reward uint32 moneyReward = uint32(multiplier*rewards->baseMonetaryReward); // player's money reward - + uint32 itemReward = 0; // reward item uint32 itemAmount = 0; // amount of item if (hasDoneDaily && (type == DUNGEON_WOTLK_HEROIC)) @@ -1772,14 +1772,14 @@ void LFGMgr::HandleBossKilled(Player* pPlayer) itemReward = itemRewards.itemId; itemAmount = itemRewards.itemAmount; } - + // and then fill a structure corresponding to SMSG_LFG_PLAYER_REWARD and // send one of these to each player LFGRewards reward(randomDungeonId, status->dungeonID, hasDoneDaily, moneyReward, xpReward, itemReward, itemAmount); pGroupPlr->GetSession()->SendLfgRewards(reward); } } - + // now we can remove the group from our maps m_groupStatusMap.erase(groupGuid); m_groupSet.erase(groupGuid); @@ -1789,39 +1789,39 @@ void LFGMgr::AttemptToKickPlayer(Group* pGroup, ObjectGuid guid, ObjectGuid kick { ObjectGuid groupGuid = pGroup->GetObjectGuid(); LFGGroupStatus* status = GetGroupStatus(groupGuid); - + bootStatusMap::iterator bIt = m_bootStatusMap.find(groupGuid); if (!status) return; - + status->state = LFG_STATE_BOOT; m_groupStatusMap[groupGuid] = *status; - + // This function is only called when a group is set/in a dungeon so we can go straight to the boot packets time_t now = time(NULL); proposalAnswerMap votes; - + // safe to say the person attempting to kick them will vote yes, the kick-ee will vote no votes[guid] = LFG_ANSWER_DENY; votes[kicker] = LFG_ANSWER_AGREE; - + // set group state to boot vote, same for player states until it's over for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) //todo: check if we will need to use mail or not { if (Player* pGroupPlr = itr->getSource()) { ObjectGuid pGroupPlrGuid = pGroupPlr->GetObjectGuid(); - + SetPlayerState(pGroupPlrGuid, LFG_STATE_BOOT); - + if ( (pGroupPlrGuid != guid) && (pGroupPlrGuid != kicker) ) votes[pGroupPlrGuid] = LFG_ANSWER_PENDING; } } - + LFGBoot boot(true, guid, reason, votes, now); m_bootStatusMap[groupGuid] = boot; - + for (GroupReference* it = pGroup->GetFirstMember(); it != NULL; it = it->next()) { if (Player* groupPlr = it->getSource()) @@ -1833,22 +1833,22 @@ void LFGMgr::CastVote(Player* pPlayer, bool vote) { if (!pPlayer) return; - + Group* pGroup = pPlayer->GetGroup(); ObjectGuid groupGuid = pGroup->GetObjectGuid(); - + LFGGroupStatus* status = GetGroupStatus(groupGuid); - + if (!status || status->state != LFG_STATE_BOOT) return; - + bootStatusMap::iterator it = m_bootStatusMap.find(groupGuid); if (it == m_bootStatusMap.end()) return; - + LFGBoot boot = it->second; boot.answers[pPlayer->GetObjectGuid()] = LFGProposalAnswer(vote); - + int32 yay = 0, nay = 0; // keep a count of votes for (proposalAnswerMap::iterator pIt = boot.answers.begin(); pIt != boot.answers.end(); ++pIt) { @@ -1858,26 +1858,26 @@ void LFGMgr::CastVote(Player* pPlayer, bool vote) else if (answer == LFG_ANSWER_DENY) ++nay; } - + if (yay < REQUIRED_VOTES_FOR_BOOT && nay < REQUIRED_VOTES_FOR_BOOT) { m_bootStatusMap[groupGuid] = boot; return; } - + // if we dont have enough votes to kick or keep plr, don't send packet update // if else, set boot.inProgress to false, set plr + group states back to lfg-state-dungeon, // send packet update to group, kick plr if we had the votes, and then erase entry from boot map - + boot.inProgress = false; status->state = LFG_STATE_IN_DUNGEON; - + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { if (Player* pGroupPlr = itr->getSource()) { ObjectGuid plrGuid = pGroupPlr->GetObjectGuid(); - + if (plrGuid != boot.playerVotedOn) { SetPlayerState(plrGuid, LFG_STATE_IN_DUNGEON); @@ -1885,7 +1885,7 @@ void LFGMgr::CastVote(Player* pPlayer, bool vote) } } } - + if (yay == REQUIRED_VOTES_FOR_BOOT) { // kick player from group @@ -1902,7 +1902,7 @@ void LFGMgr::CastVote(Player* pPlayer, bool vote) void LFGMgr::SendRoleChosen(ObjectGuid plrGuid, ObjectGuid confirmedGuid, uint8 roles) { Player* pPlayer = ObjectAccessor::FindPlayer(plrGuid); - + if (pPlayer) pPlayer->GetSession()->SendLfgRoleChosen(confirmedGuid.GetRawValue(), roles); } @@ -1910,7 +1910,7 @@ void LFGMgr::SendRoleChosen(ObjectGuid plrGuid, ObjectGuid confirmedGuid, uint8 void LFGMgr::SendRoleCheckUpdate(ObjectGuid plrGuid, LFGRoleCheck const& roleCheck) { Player* pPlayer = ObjectAccessor::FindPlayer(plrGuid); - + if (pPlayer) pPlayer->GetSession()->SendLfgRoleCheckUpdate(roleCheck); } @@ -1918,7 +1918,7 @@ void LFGMgr::SendRoleCheckUpdate(ObjectGuid plrGuid, LFGRoleCheck const& roleChe void LFGMgr::SendLfgUpdate(ObjectGuid plrGuid, LFGPlayerStatus status, bool isGroup) { Player* pPlayer = ObjectAccessor::FindPlayer(plrGuid); - + if (pPlayer) pPlayer->GetSession()->SendLfgUpdate(isGroup, status); } @@ -1926,7 +1926,7 @@ void LFGMgr::SendLfgUpdate(ObjectGuid plrGuid, LFGPlayerStatus status, bool isGr void LFGMgr::SendLfgJoinResult(ObjectGuid plrGuid, LfgJoinResult result, LFGState state, partyForbidden const& lockedDungeons) { Player* pPlayer = ObjectAccessor::FindPlayer(plrGuid); - + if (pPlayer) pPlayer->GetSession()->SendLfgJoinResult(result, state, lockedDungeons); } @@ -1936,22 +1936,22 @@ void LFGMgr::RemoveOldRoleChecks() for (roleCheckMap::iterator roleItr = m_roleCheckMap.begin(); roleItr != m_roleCheckMap.end(); ++roleItr) { ObjectGuid groupGuid = roleItr->first; - + LFGRoleCheck roleCheck = roleItr->second; if ((roleCheck.waitForRoleTime - time(NULL)) <= 0) // no time left { roleCheck.state = LFG_ROLECHECK_NO_ROLE; - + for (roleMap::iterator roleMapItr = roleCheck.currentRoles.begin(); roleMapItr != roleCheck.currentRoles.end(); ++roleMapItr) { ObjectGuid plrGuid = roleMapItr->first; - + SetPlayerState(plrGuid, LFG_STATE_NONE); - - SendRoleCheckUpdate(plrGuid, roleCheck); // role check failed + + SendRoleCheckUpdate(plrGuid, roleCheck); // role check failed SendLfgUpdate(plrGuid, GetPlayerStatus(plrGuid), true); // not in lfg system anymore } - + m_roleCheckMap.erase(groupGuid); } } diff --git a/src/game/WorldHandlers/LFGMgr.h b/src/game/WorldHandlers/LFGMgr.h index 67f5a3007..857cf3932 100644 --- a/src/game/WorldHandlers/LFGMgr.h +++ b/src/game/WorldHandlers/LFGMgr.h @@ -178,7 +178,7 @@ enum LFGRoleCheckState LFG_ROLECHECK_NO_ROLE = 6 // Someone didn't select a role }; -/// Role types +/// Role types enum LFGRoles { PLAYER_ROLE_NONE = 0x00, @@ -260,7 +260,7 @@ struct ItemRewards { uint32 itemId; uint32 itemAmount; - + ItemRewards() : itemId(0), itemAmount(0) {} ItemRewards(uint32 ItemId, uint32 ItemAmount) : itemId(ItemId), itemAmount(ItemAmount) {} }; @@ -273,12 +273,12 @@ struct LFGPlayers //TODO: rename to LFGQueueData roleMap currentRoles; // tank, dps, healer, etc.. std::string comments; bool isGroup; - + time_t joinedTime; uint8 neededTanks; uint8 neededHealers; uint8 neededDps; - + LFGPlayers() : currentState(LFG_STATE_NONE), currentRoles(0), isGroup(false) {} LFGPlayers(LFGState state, std::set dungeonSelection, roleMap CurrentRoles, std::string comment, bool IsGroup, time_t JoinedTime, uint8 NeededTanks, uint8 NeededHealers, uint8 NeededDps) : currentState(state), dungeonList(dungeonSelection), @@ -290,7 +290,7 @@ struct LFGRoleCheck { LFGRoleCheckState state; // current status of the role check roleMap currentRoles; // map of players to roles - std::set dungeonList; // The dungeons this player or group are queued for + std::set dungeonList; // The dungeons this player or group are queued for uint32 randomDungeonID; // The random dungeon ID uint64 leaderGuidRaw; // ObjectGuid(raw) of leader time_t waitForRoleTime; // How long we'll wait for the players to confirm their roles @@ -302,7 +302,7 @@ struct LFGWait int32 previousTime; // how long it took for the last person to go from queue to instance uint32 playerCount; // amount of players in x queue for calculations [not sure if needed when finished implementing system] bool doAverage; // tells the lfgmgr during a world update whether or not to recalculate waiting time - + LFGWait() : time(-1), previousTime(-1), playerCount(0), doAverage(false) {} LFGWait(int32 currentTime, int32 lastTime, uint32 currentPlayerCount, bool shouldRecalculate) : time(currentTime), previousTime(lastTime), playerCount(currentPlayerCount), doAverage(shouldRecalculate) {} @@ -330,7 +330,7 @@ struct LFGPlayerStatus LfgUpdateType updateType; std::set dungeonList; std::string comment; - + LFGPlayerStatus() { } LFGPlayerStatus(LFGState State, LfgUpdateType UpdateType, std::set DungeonList, std::string Comment) : state(State), updateType(UpdateType), dungeonList(DungeonList), comment(Comment) { } @@ -343,7 +343,7 @@ struct LFGGroupStatus //todo: check for this in joinlfg function, not lfgplayers uint32 dungeonID; // ID of the dungeon the group should be in roleMap playerRoles; // Container holding each player's objectguid and their roles ObjectGuid leaderGuid; // The group leader's object guid - + LFGGroupStatus() { } LFGGroupStatus(LFGState State, uint32 DungeonID, roleMap PlayerRoles, ObjectGuid LeaderGuid) : state(State), dungeonID(DungeonID), playerRoles(PlayerRoles), leaderGuid(LeaderGuid) { } @@ -375,7 +375,7 @@ struct LFGRewards uint32 expReward; // Amount of experience rewarded uint32 itemID; // ID of item reward uint32 itemAmount; // How many of x item is rewarded - + LFGRewards() { } LFGRewards(uint32 RandomDungeonEntry, uint32 GroupDungeonEntry, bool HasDoneDaily, uint32 MoneyReward, uint32 ExpReward, uint32 ItemID, uint32 ItemAmount) : @@ -392,7 +392,7 @@ struct LFGBoot std::string reason; // Reason stated for the vote proposalAnswerMap answers; // Player's votes time_t startTime; // When the vote started - + LFGBoot() { } LFGBoot(bool InProgress, ObjectGuid PlayerVotedOn, std::string Reason, proposalAnswerMap Answers, time_t StartTime) : inProgress(InProgress), playerVotedOn(PlayerVotedOn), reason(Reason), answers(Answers), startTime(StartTime) { } @@ -405,291 +405,291 @@ class LFGMgr public: LFGMgr(); ~LFGMgr(); - + /// Update queue information and such void Update(); - + /** * @brief Attempt to join the dungeon finder queue, as long as the player(s) * fit the criteria. - * + * * @param roles Roles selected in lfg window * @param dungeons List of dungeon(s) selected * @param comments Comments made by the player * @param plr Pointer to the player sending the packet */ void JoinLFG(uint32 roles, std::set dungeons, std::string comments, Player* plr); - + /** * @brief Leave the lfg/dungeon finder system. - * + * * @param plr The pointer to the player sending the request * @param isGroup Whether or not they are the leader of a group / in a group */ void LeaveLFG(Player* plr, bool isGroup); - + /** * @brief Go through a number of checks to see if the player/group can join * the LFG queue - * + * * @param plr The pointer to the player */ LfgJoinResult GetJoinResult(Player* plr); - + /** * @brief Fetch the playerstatus struct of a player on request, if existant - * + * * @param guid the player's objectguid */ LFGPlayerStatus GetPlayerStatus(ObjectGuid guid); - + /** * @brief Set the player's comment string - * + * * @param guid The player's objectguid * @param comment Their comments */ void SetPlayerComment(ObjectGuid guid, std::string comment); - + /** * @brief Set the player's LFG state - * + * * @param guid The player's objectguid * @param state the LFGState value */ void SetPlayerState(ObjectGuid guid, LFGState state); - + /** * @brief Set the player's LFG update type - * + * * @param guid The player's objectguid * @param updateType The LfgUpdateType value */ void SetPlayerUpdateType(ObjectGuid guid, LfgUpdateType updateType); - + /** * @brief Used to fetch the item rewards of a dungeon from the database - * + * * @param dungeonId the dungeon ID used in the DBCs * @param type the type of dungeon */ ItemRewards GetDungeonItemRewards(uint32 dungeonId, DungeonTypes type); - + /** * @brief Used to determine the type of dungeon for ease of use. - * + * * @param dungeonId the dungeon ID used in the DBCs */ DungeonTypes GetDungeonType(uint32 dungeonId); - + /** * @brief Used to record the first time a player has entered x type of dungeon in the day. - * + * * @param guidLow the player's guidLow * @param dungeon the specific type/expansion of dungeon */ void RegisterPlayerDaily(uint32 guidLow, DungeonTypes dungeon); - + /** * @brief Used to find whether or not the player has done x type of dungeon today. - * + * * @param guidLow the player's guidLow * @param dungeon the specific type/expansion of dungeon */ bool HasPlayerDoneDaily(uint32 guidLow, DungeonTypes dungeon); - + /// Reset accounts of players completing a/any dungeon for the day for new rewards void ResetDailyRecords(); /** - * @brief Find out whether or not a special dungeon is available for that season - * + * @brief Find out whether or not a special dungeon is available for that season + * * @param dungeonId the ID of the dungeon in question */ bool IsSeasonActive(uint32 dungeonId); - + /** - * @brief Find the random dungeons applicable for a player - * + * @brief Find the random dungeons applicable for a player + * * @param level The level of said player * @param expansion The player's expansion */ dungeonEntries FindRandomDungeonsForPlayer(uint32 level, uint8 expansion); - + /** * @brief Find the random dungeons not applicable for a player - * + * * @param level The level of said player * @param expansion The player's expansion */ dungeonForbidden FindRandomDungeonsNotForPlayer(Player* plr); - + /// Given the ID of a dungeon, spit out its entry uint32 GetDungeonEntry(uint32 ID); - + /// Teleports a player out of a dungeon (called by CMSG_LFG_TELEPORT) void TeleportPlayer(Player* pPlayer, bool out); - + /// Queue Functions Below - + /** * Find the player's or group's information and update the system with * the amount of each role they need to find. - * + * * @param guid The guid assigned to the structure * @param information The LFGPlayers structure containing their information */ void UpdateNeededRoles(ObjectGuid guid, LFGPlayers* information); - + /** * @brief Add the player or group to the Dungeon Finder queue - * + * * @param guid the player/group's ObjectGuid */ void AddToQueue(ObjectGuid guid); - + /** * @brief Remove the player or group from the Dungeon Finder queue - * + * * @param guid the player/group's ObjectGuid */ void RemoveFromQueue(ObjectGuid guid); - + /// Search the queue for compatible matches void FindQueueMatches(); - + /** * @brief Search the queue for matches based off of one's guid - * + * * @param guid The player or group's guid */ void FindSpecificQueueMatches(ObjectGuid guid); - + /// Send a periodic status update for queued players void SendQueueStatus(); - + /// Role-Related Functions - + /** * @brief Set and/or confirm roles for a group. - * + * * @param pPlayer The pointer to the player issuing the request * @param pGroup The pointer to that player's group * @param roles The group leader's role(s) */ void PerformRoleCheck(Player* pPlayer, Group* pGroup, uint8 roles); - + /// Make sure role selections are okay bool ValidateGroupRoles(roleMap groupMap); - + /// Proposal-Related Functions - + void ProposalUpdate(uint32 proposalID, ObjectGuid plrGuid, bool accepted); - + /// Handles reward hooks -- called by achievement manager void HandleBossKilled(Player* pPlayer); - + /// Group kick hook void AttemptToKickPlayer(Group* pGroup, ObjectGuid guid, ObjectGuid kicker, std::string reason); - + // Called when a player votes yes or no on a boot vote void CastVote(Player* pPlayer, bool vote); - + protected: bool IsSeasonal(uint32 dbcFlags) { return ((dbcFlags & LFG_FLAG_SEASONAL) != 0) ? true : false; } - + /// Check if player/party is already in the system, return that data LFGPlayers* GetPlayerOrPartyData(ObjectGuid guid); - + /// Get a proposal structure given its id LFGProposal* GetProposalData(uint32 proposalID); - + /// Get information on a group currently in a dungeon LFGGroupStatus* GetGroupStatus(ObjectGuid guid); - + /// Add the player to their respective waiting map for their dungeon void AddToWaitMap(uint8 role, std::set dungeons); - + /// Checks if any players have the leader flag for their roles bool HasLeaderFlag(roleMap const& roles); - + /// Compares two groups/players to see if their role combinations are compatible bool RoleMapsAreCompatible(LFGPlayers* groupOne, LFGPlayers* groupTwo); - + /// Checks whether or not two combinations of players/groups are on the same team (alliance/horde) bool MatchesAreOfSameTeam(LFGPlayers* groupOne, LFGPlayers* groupTwo); - + /// Are the players in a proposal already grouped up? bool IsProposalSameGroup(LFGProposal const& proposal); - + /// Update a proposal after a player refused to join void ProposalDeclined(ObjectGuid guid, LFGProposal* proposal); - + /// Updates a wait map with the amount of time it took the last player to join void UpdateWaitMap(LFGRoles role, uint32 dungeonID, time_t waitTime); - + /// Creates a group so they can enter a dungeon together void CreateDungeonGroup(LFGProposal* proposal); - + /// Sends a group to the dungeon assigned to them void TeleportToDungeon(uint32 dungeonID, Group* pGroup); - + /** * @brief Merges two players/groups/etc into one for dungeon assignment. - * + * * @param guidOne The guid assigned to the first group in m_playerData * @param guidTwo The guid assigned to the second group in m_playerData * @param compatibleDungeons The dungeons that both players or groups agreed to doing */ void MergeGroups(ObjectGuid guidOne, ObjectGuid guidTwo, std::set compatibleDungeons); - + /// Send a proposal to each member of a group void SendDungeonProposal(LFGPlayers* lfgGroup); - + /// Tell a group member that someone else just confirmed their role void SendRoleChosen(ObjectGuid plrGuid, ObjectGuid confirmedGuid, uint8 roles); - + /// Send SMSG_LFG_ROLE_CHECK_UPDATE to a specific player void SendRoleCheckUpdate(ObjectGuid plrGuid, LFGRoleCheck const& roleCheck); - + /// Send SMSG_LFG_UPDATE_PARTY or SMSG_LFG_UPDATE_PLAYER void SendLfgUpdate(ObjectGuid plrGuid, LFGPlayerStatus status, bool isGroup); - + /// Send SMSG_LFG_JOIN_RESULT void SendLfgJoinResult(ObjectGuid plrGuid, LfgJoinResult result, LFGState state, partyForbidden const& lockedDungeons); - + /// Get rid of expired role checks void RemoveOldRoleChecks(); - + private: /// Daily occurences of a player doing X type dungeon dailyEntries m_dailyAny; dailyEntries m_dailyTBCHeroic; dailyEntries m_dailyLKNormal; dailyEntries m_dailyLKHeroic; - + /// General info related to joining / leaving the dungeon finder playerData m_playerData; queueSet m_queueSet; - + /// Dungeon Finder Status for players playerStatusMap m_playerStatusMap; - + groupSet m_groupSet; groupStatusMap m_groupStatusMap; - + /// Role check information roleCheckMap m_roleCheckMap; - + /// Boot vote information bootStatusMap m_bootStatusMap; - + /// Wait times for the queue waitTimeMap m_tankWaitTime; waitTimeMap m_healerWaitTime; waitTimeMap m_dpsWaitTime; waitTimeMap m_avgWaitTime; - + /// Proposal information uint32 m_proposalId; proposalMap m_proposalMap; diff --git a/src/game/WorldHandlers/Map.h b/src/game/WorldHandlers/Map.h index db4fd95f5..dd4ec6f12 100644 --- a/src/game/WorldHandlers/Map.h +++ b/src/game/WorldHandlers/Map.h @@ -114,8 +114,14 @@ class Map : public GridRefManager // currently unused for normal maps bool CanUnload(uint32 diff) { - if (!m_unloadTimer) { return false; } - if (m_unloadTimer <= diff) { return true; } + if (!m_unloadTimer) + { + return false; + } + if (m_unloadTimer <= diff) + { + return true; + } m_unloadTimer -= diff; return false; } @@ -492,4 +498,4 @@ Map::Visit(const Cell& cell, TypeContainerVisitor& visitor) getNGrid(x, y)->Visit(cell_x, cell_y, visitor); } } -#endif \ No newline at end of file +#endif diff --git a/src/game/WorldHandlers/PetHandler.cpp b/src/game/WorldHandlers/PetHandler.cpp index f72e66a14..fbaf8fa35 100644 --- a/src/game/WorldHandlers/PetHandler.cpp +++ b/src/game/WorldHandlers/PetHandler.cpp @@ -240,7 +240,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data) const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); - if (unit_target && !(pet->IsWithinDistInMap(unit_target, sRange->maxRange) && pet->IsWithinLOSInMap(unit_target)) + if (unit_target && !(pet->IsWithinDistInMap(unit_target, sRange->maxRange) && pet->IsWithinLOSInMap(unit_target)) && !(GetPlayer()->IsFriendlyTo(unit_target) || pet->HasAuraType(SPELL_AURA_MOD_POSSESS))) { ((Pet*)pet)->SetSpellOpener(spellid, sRange->minRange, sRange->maxRange); @@ -805,4 +805,4 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) if (pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->IsTemporarySummon()) ((TemporarySummon*)pet)->UnSummon(); } -} \ No newline at end of file +} diff --git a/src/game/WorldHandlers/QuestDef.cpp b/src/game/WorldHandlers/QuestDef.cpp index b37e74c28..1b7d717b1 100644 --- a/src/game/WorldHandlers/QuestDef.cpp +++ b/src/game/WorldHandlers/QuestDef.cpp @@ -52,7 +52,7 @@ Quest::Quest(Field* questRecord) CharTitleId = questRecord[20].GetUInt32(); PlayersSlain = questRecord[21].GetUInt32(); BonusTalents = questRecord[22].GetUInt32(); - + PortraitGiver = questRecord[23].GetUInt32(); PortraitTurnIn = questRecord[24].GetUInt32(); @@ -71,7 +71,7 @@ Quest::Quest(Field* questRecord) RequestItemsText = questRecord[37].GetCppString(); EndText = questRecord[38].GetCppString(); CompletedText = questRecord[39].GetCppString(); - + PortraitGiverName = questRecord[40].GetCppString(); PortraitGiverText = questRecord[41].GetCppString(); PortraitTurnInName = questRecord[42].GetCppString(); @@ -97,12 +97,12 @@ Quest::Quest(Field* questRecord) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) ReqCreatureOrGOCount[i] = questRecord[72 + i].GetUInt32(); - + for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) ReqCurrencyId[i] = questRecord[76 + i].GetUInt32(); for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) ReqCurrencyCount[i] = questRecord[80 + i].GetUInt32(); - + for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) ReqSpell[i] = questRecord[84 + i].GetUInt32(); @@ -119,8 +119,8 @@ Quest::Quest(Field* questRecord) RewItemId[i] = questRecord[101 + i].GetUInt32(); for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewItemCount[i] = questRecord[105 + i].GetUInt32(); - + RewItemCount[i] = questRecord[105 + i].GetUInt32(); + for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) RewCurrencyId[i] = questRecord[109 + i].GetUInt32(); for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) @@ -164,7 +164,7 @@ Quest::Quest(Field* questRecord) OfferRewardEmote[i] = questRecord[156 + i].GetInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - OfferRewardEmoteDelay[i] = questRecord[160 + i].GetInt32(); + OfferRewardEmoteDelay[i] = questRecord[160 + i].GetInt32(); SoundAcceptId = questRecord[164].GetUInt32(); SoundTurnInId = questRecord[165].GetUInt32(); diff --git a/src/game/WorldHandlers/ScriptMgr.cpp b/src/game/WorldHandlers/ScriptMgr.cpp index 60283bb55..3c334dc7c 100644 --- a/src/game/WorldHandlers/ScriptMgr.cpp +++ b/src/game/WorldHandlers/ScriptMgr.cpp @@ -2713,7 +2713,7 @@ bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex ef return false; #endif } - + bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget, ObjectGuid originalCasterGuid) { // Used by Eluna @@ -2728,7 +2728,7 @@ bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex ef return false; #endif } - + bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget, ObjectGuid originalCasterGuid) { // Used by Eluna diff --git a/src/game/WorldHandlers/ScriptMgr.h b/src/game/WorldHandlers/ScriptMgr.h index e40513088..fb9663149 100644 --- a/src/game/WorldHandlers/ScriptMgr.h +++ b/src/game/WorldHandlers/ScriptMgr.h @@ -709,7 +709,7 @@ class ScriptMgr ScriptNameMap m_scriptNames; DBScripts m_dbScripts; #ifdef _DEBUG - // mutex allowing to reload the script binding table; TODO just do it AWAY from any map update, e.g. right after sessions update + // mutex allowing to reload the script binding table; TODO just do it AWAY from any map update, e.g. right after sessions update ACE_RW_Thread_Mutex m_bindMutex; #endif /* _DEBUG */ // atomic op counter for active scripts amount diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index 180cf1ff2..3cd29d24e 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -247,7 +247,7 @@ void SpellCastTargets::read(ByteBuffer& data, Unit* caster) // TARGET_FLAG_UNK2 is used for non-combat pets, maybe other? if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNK2)) data >> m_unitTargetGUID.ReadAsPacked(); - + if (m_targetMask & (TARGET_FLAG_OBJECT | TARGET_FLAG_GAMEOBJECT_ITEM)) data >> m_GOTargetGUID.ReadAsPacked(); @@ -1692,7 +1692,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& uint32 unMaxTargets = m_spellInfo->GetMaxAffectedTargets(); float radius; - GetSpellRangeAndRadius(spellEffect, radius, EffectChainTarget, unMaxTargets); + GetSpellRangeAndRadius(spellEffect, radius, EffectChainTarget, unMaxTargets); std::list tempTargetGOList; @@ -6387,7 +6387,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_NO_MOUNTS_ALLOWED; if (spellEffect->EffectMiscValueB && !m_caster->GetMountCapability(spellEffect->EffectMiscValueB)) - return SPELL_FAILED_NOT_HERE; + return SPELL_FAILED_NOT_HERE; // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells if (m_caster->GetTypeId() == TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->GetAreaGroupId()) diff --git a/src/game/WorldHandlers/SpellAuras.cpp b/src/game/WorldHandlers/SpellAuras.cpp index 35ab7ec88..694c05f33 100644 --- a/src/game/WorldHandlers/SpellAuras.cpp +++ b/src/game/WorldHandlers/SpellAuras.cpp @@ -1236,7 +1236,7 @@ void Aura::TriggerSpell() // // Haunted // case 18347: break; // // Ranshalla Waiting -// case 18953: break; +// case 18953: break; case 19695: // Inferno { @@ -3535,7 +3535,7 @@ void Aura::HandleAuraMounted(bool apply, bool Real) if (apply) { - // Running Wild + // Running Wild if (GetId() == 87840) target->Mount(target->getGender() == GENDER_MALE ? 29422 : 29423, GetId()); @@ -4497,7 +4497,7 @@ void Aura::HandleModCharm(bool apply, bool Real) { //remove any existing charm just in case caster->Uncharm(); - + //pets should be removed when possesing a target if somehow check was bypassed ((Player*)caster)->UnsummonPetIfAny(); } @@ -6395,7 +6395,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) { // Special case with temporary increase max/current health // Cases where we need to manually calculate the amount for the spell (by percentage) - // recalculate to full amount at apply for proper remove + // recalculate to full amount at apply for proper remove case 54443: // Demonic Empowerment (Voidwalker) case 55233: // Vampiric Blood case 61254: // Will of Sartharion (Obsidian Sanctum) @@ -6404,7 +6404,7 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) // no break here // Cases where m_amount already has the correct value (spells cast with CastCustomSpell or absolute values) - + case 12976: // Warrior Last Stand triggered spell case 28726: // Nightmare Seed ( Nightmare Seed ) case 31616: // Nature's Guardian @@ -7121,8 +7121,14 @@ void Aura::HandleShapeshiftBoosts(bool apply) const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { - if (itr->second.state == PLAYERSPELL_REMOVED) { continue; } - if (itr->first == spellId1 || itr->first == spellId2) { continue; } + if (itr->second.state == PLAYERSPELL_REMOVED) + { + continue; + } + if (itr->first == spellId1 || itr->first == spellId2) + { + continue; + } SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form)) { @@ -7900,7 +7906,7 @@ void Aura::PeriodicTick() { spell->cancel(); } - + if (Player* modOwner = pCaster->GetSpellModOwner()) { modOwner->ApplySpellMod(GetId(), SPELLMOD_ALL_EFFECTS, new_damage); @@ -8125,7 +8131,7 @@ void Aura::PeriodicTick() pdamage = target->GetMaxPower(POWER_MANA) * 5 / 100; drain_amount = target->GetPower(POWER_MANA) > pdamage ? pdamage : target->GetPower(POWER_MANA); target->ModifyPower(POWER_MANA, -drain_amount); - + SpellPeriodicAuraLogInfo info(this, drain_amount, 0, 0, 0, 0.0f); target->SendPeriodicAuraLog(&info); } diff --git a/src/game/WorldHandlers/SpellAuras.h b/src/game/WorldHandlers/SpellAuras.h index 6e6ccfb64..ffe072e18 100644 --- a/src/game/WorldHandlers/SpellAuras.h +++ b/src/game/WorldHandlers/SpellAuras.h @@ -439,7 +439,7 @@ class Aura Modifier const* GetModifier() const { return &m_modifier; } int32 GetMiscValue() const { return m_spellEffect ? m_spellEffect->EffectMiscValue : 0; } int32 GetMiscBValue() const { return m_spellEffect ? m_spellEffect->EffectMiscValueB : 0; } - + SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } SpellEffectEntry const* GetSpellEffect() const { return m_spellEffect; } uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } diff --git a/src/game/WorldHandlers/SpellEffects.cpp b/src/game/WorldHandlers/SpellEffects.cpp index 0d9f2a915..5f3d826dc 100644 --- a/src/game/WorldHandlers/SpellEffects.cpp +++ b/src/game/WorldHandlers/SpellEffects.cpp @@ -309,7 +309,7 @@ void Spell::EffectInstaKill(SpellEffectEntry const* /*effect*/) data << unitTarget->GetObjectGuid(); // Victim GUID data << uint32(m_spellInfo->Id); m_caster->SendMessageToSet(&data, true); - + m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, m_spellInfo, false); } @@ -5390,7 +5390,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect) Unit* responsibleCaster = m_originalCaster; if (realCaster->GetTypeId() == TYPEID_GAMEOBJECT) - responsibleCaster = ((GameObject*)realCaster)->GetOwner(); + responsibleCaster = ((GameObject*)realCaster)->GetOwner(); // Expected Level (Totem, Pet and Critter may not use this) uint32 level = responsibleCaster ? responsibleCaster->getLevel() : m_caster->getLevel(); @@ -5429,7 +5429,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect) { realCaster->GetRandomPoint(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z, radius, itr->x, itr->y, itr->z); if (realCaster->GetMap()->GetHitPosition(summonPositions[0].x, summonPositions[0].y, summonPositions[0].z, itr->x, itr->y, itr->z, m_caster->GetPhaseMask(), -0.5f)) - realCaster->UpdateAllowedPositionZ(itr->x, itr->y, itr->z); + realCaster->UpdateAllowedPositionZ(itr->x, itr->y, itr->z); } else // Get a point near the caster { @@ -5548,7 +5548,7 @@ void Spell::EffectSummonType(SpellEffectEntry const* effect) if (!summonResult) return; // No further handling required - + for (itr = summonPositions.begin(); itr != summonPositions.end(); ++itr) { MANGOS_ASSERT(itr->creature || itr != summonPositions.begin()); @@ -10322,7 +10322,7 @@ void Spell::EffectActivateObject(SpellEffectEntry const* effect) uint32 templars[] = {15209, 15211, 15212, 15307}; uint32 dukes[] = {15206, 15207, 15208, 15220}; uint32 royals[] = {15203, 15204, 15205, 15305}; - + switch (m_spellInfo->Id) { case 24734: npcEntry = templars[urand(0, 3)]; break; @@ -10533,7 +10533,7 @@ void Spell::EffectInebriate(SpellEffectEntry const* /*effect*/) if (roll_chance_i(25)) player->CastSpell(player, 67468, false); // Drunken Vomit } - player->SetDrunkValue(drunkValue, m_CastItem ? m_CastItem->GetEntry() : 0); + player->SetDrunkValue(drunkValue, m_CastItem ? m_CastItem->GetEntry() : 0); } void Spell::EffectFeedPet(SpellEffectEntry const* effect) @@ -11723,7 +11723,7 @@ void Spell::EffectBind(SpellEffectEntry const* effect) { player->GetPosition(loc); if (!area_id) - area_id = player->GetAreaId(); + area_id = player->GetAreaId(); } player->SetHomebindToLocation(loc, area_id); diff --git a/src/game/WorldHandlers/UnitAuraProcHandler.cpp b/src/game/WorldHandlers/UnitAuraProcHandler.cpp index 5d1f5755d..ebee627c2 100644 --- a/src/game/WorldHandlers/UnitAuraProcHandler.cpp +++ b/src/game/WorldHandlers/UnitAuraProcHandler.cpp @@ -3034,13 +3034,25 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d { float stat = 0.0f; // strength - if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); } + if (GetStat(STAT_STRENGTH) > stat) + { + trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); + } // agility - if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); } + if (GetStat(STAT_AGILITY) > stat) + { + trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); + } // intellect - if (GetStat(STAT_INTELLECT) > stat) { trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);} + if (GetStat(STAT_INTELLECT) > stat) + { + trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT); + } // spirit - if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; } + if (GetStat(STAT_SPIRIT) > stat) + { + trigger_spell_id = 60235; + } break; } // case 55580: break: // Mana Link @@ -3093,18 +3105,30 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d { float stat = 0.0f; // strength - if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); } + if (GetStat(STAT_STRENGTH) > stat) + { + trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); + } // agility - if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; } + if (GetStat(STAT_AGILITY) > stat) + { + trigger_spell_id = 67703; + } break; } case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket { float stat = 0.0f; // strength - if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); } + if (GetStat(STAT_STRENGTH) > stat) + { + trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); + } // agility - if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; } + if (GetStat(STAT_AGILITY) > stat) + { + trigger_spell_id = 67772; + } break; } case 69023: // Mirrored Soul diff --git a/src/game/WorldHandlers/VehicleHandler.cpp b/src/game/WorldHandlers/VehicleHandler.cpp index cc1c5ffb2..9156d165e 100644 --- a/src/game/WorldHandlers/VehicleHandler.cpp +++ b/src/game/WorldHandlers/VehicleHandler.cpp @@ -106,7 +106,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvPacket) ObjectGuid destVehicleGuid; uint8 seat; - recvPacket >> movementInfo; + recvPacket >> movementInfo; srcVehicleGuid = movementInfo.GetGuid(); destVehicleGuid = movementInfo.GetGuid2(); @@ -194,13 +194,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket& recvPacket) void WorldSession::HandleRequestVehiclePrevSeat(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_PREV_SEAT"); - + // ToDo } void WorldSession::HandleRequestVehicleNextSeat(WorldPacket& recv_data) { DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_NEXT_SEAT"); - + // ToDo } diff --git a/src/game/movement/MoveSpline.cpp b/src/game/movement/MoveSpline.cpp index bcd378fa1..6f4b62290 100644 --- a/src/game/movement/MoveSpline.cpp +++ b/src/game/movement/MoveSpline.cpp @@ -184,7 +184,7 @@ namespace Movement time_passed = 0; vertical_acceleration = 0.f; effect_start_time = 0; - + // detect Stop command if (splineflags.done) { diff --git a/src/game/movement/MoveSplineInit.h b/src/game/movement/MoveSplineInit.h index 4e139410a..d17477643 100644 --- a/src/game/movement/MoveSplineInit.h +++ b/src/game/movement/MoveSplineInit.h @@ -60,10 +60,10 @@ namespace Movement * @return int32 duration - estimated travel time */ int32 Launch(); - + /** * @brief Stop any creature movement - * + * */ void Stop(); @@ -113,7 +113,7 @@ namespace Movement * @param destination * @param generatePath * @param forceDestination - * @param maxPathRange + * @param maxPathRange */ void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false); /** diff --git a/src/game/vmap/BIH.h b/src/game/vmap/BIH.h index c8dbbb60f..060cc919f 100644 --- a/src/game/vmap/BIH.h +++ b/src/game/vmap/BIH.h @@ -298,7 +298,10 @@ class BIH while (n > 0) { bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst); - if (stopAtFirst && hit) { return; } + if (stopAtFirst && hit) + { + return; + } --n; ++offset; } diff --git a/src/game/vmap/BIHWrap.h b/src/game/vmap/BIHWrap.h index 0fa9e827d..efca47d4e 100644 --- a/src/game/vmap/BIHWrap.h +++ b/src/game/vmap/BIHWrap.h @@ -66,7 +66,7 @@ class BIHWrap */ bool operator()(const Ray& r, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) { - if (Idx >= objects_size) + if (Idx >= objects_size) { return false; } @@ -86,7 +86,7 @@ class BIHWrap */ void operator()(const Vector3& p, uint32 Idx) { - if (Idx >= objects_size) + if (Idx >= objects_size) { return; } diff --git a/src/game/vmap/MapTree.cpp b/src/game/vmap/MapTree.cpp index 17f9664f5..16139e49c 100644 --- a/src/game/vmap/MapTree.cpp +++ b/src/game/vmap/MapTree.cpp @@ -313,20 +313,35 @@ namespace VMAP { char chunk[8]; // general info - if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { success = false; } + if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) + { + success = false; + } char tiled=0; - if (success && fread(&tiled, sizeof(char), 1, rf) != 1) { success = false; } + if (success && fread(&tiled, sizeof(char), 1, rf) != 1) + { + success = false; + } iIsTiled = bool(tiled); // Nodes - if (success && !readChunk(rf, chunk, "NODE", 4)) { success = false; } - if (success) { success = iTree.readFromFile(rf); } + if (success && !readChunk(rf, chunk, "NODE", 4)) + { + success = false; + } + if (success) + { + success = iTree.readFromFile(rf); + } if (success) { iNTreeValues = iTree.primCount(); iTreeValues = new ModelInstance[iNTreeValues]; } - if (success && !readChunk(rf, chunk, "GOBJ", 4)) { success = false; } + if (success && !readChunk(rf, chunk, "GOBJ", 4)) + { + success = false; + } // global model spawns // only non-tiled maps have them, and if so exactly one (so far at least...) ModelSpawn spawn; diff --git a/src/game/vmap/ModelInstance.cpp b/src/game/vmap/ModelInstance.cpp index f756edee6..cf4acd8ce 100644 --- a/src/game/vmap/ModelInstance.cpp +++ b/src/game/vmap/ModelInstance.cpp @@ -229,9 +229,15 @@ namespace VMAP } uint32 nameLen = spawn.name.length(); check += fwrite(&nameLen, sizeof(uint32), 1, wf); - if (check != uint32(has_bound ? 17 : 11)) { return false; } + if (check != uint32(has_bound ? 17 : 11)) + { + return false; + } check = fwrite(spawn.name.c_str(), sizeof(char), nameLen, wf); - if (check != nameLen) { return false; } + if (check != nameLen) + { + return false; + } return true; } } diff --git a/src/game/vmap/TileAssembler.cpp b/src/game/vmap/TileAssembler.cpp index 043af0903..0ccaed72a 100644 --- a/src/game/vmap/TileAssembler.cpp +++ b/src/game/vmap/TileAssembler.cpp @@ -46,7 +46,10 @@ namespace VMAP { bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len) { - if (fread(dest, sizeof(char), len, rf) != len) { return false; } + if (fread(dest, sizeof(char), len, rf) != len) + { + return false; + } return memcmp(dest, compare, len) == 0; } @@ -130,16 +133,31 @@ namespace VMAP } // general info - if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8) { success = false; } + if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8) + { + success = false; + } uint32 globalTileID = StaticMapTree::packTileID(65, 65); pair globalRange = map_iter->second->TileEntries.equal_range(globalTileID); char isTiled = globalRange.first == globalRange.second; // only maps without terrain (tiles) have global WMO - if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1) { success = false; } + if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1) + { + success = false; + } // Nodes - if (success && fwrite("NODE", 4, 1, mapfile) != 1) { success = false; } - if (success) { success = pTree.writeToFile(mapfile); } + if (success && fwrite("NODE", 4, 1, mapfile) != 1) + { + success = false; + } + if (success) + { + success = pTree.writeToFile(mapfile); + } // global map spawns (WDT), if any (most instances) - if (success && fwrite("GOBJ", 4, 1, mapfile) != 1) { success = false; } + if (success && fwrite("GOBJ", 4, 1, mapfile) != 1) + { + success = false; + } for (TileMap::iterator glob = globalRange.first; glob != globalRange.second && success; ++glob) { @@ -169,9 +187,15 @@ namespace VMAP tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile"; FILE* tilefile = fopen(tilefilename.str().c_str(), "wb"); // file header - if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) { success = false; } + if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) + { + success = false; + } // write number of tile spawns - if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) { success = false; } + if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) + { + success = false; + } // write tile spawns for (uint32 s = 0; s < nSpawns; ++s) { @@ -183,7 +207,10 @@ namespace VMAP success = success && ModelSpawn::writeToFile(tilefile, spawn2); // MapTree nodes to update when loading tile: std::map::iterator nIdx = modelNodeIdx.find(spawn2.ID); - if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1) { success = false; } + if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1) + { + success = false; + } } fclose(tilefile); } @@ -250,7 +277,10 @@ namespace VMAP printf("spawning Map %d\n", mapID); mapData[mapID] = current = new MapSpawns(); } - else { current = (*map_iter).second; } + else + { + current = (*map_iter).second; + } current->UniqueEntries.insert(pair(spawn.ID, spawn)); current->TileEntries.insert(pair(StaticMapTree::packTileID(tileX, tileY), spawn.ID)); } diff --git a/src/game/vmap/WorldModel.cpp b/src/game/vmap/WorldModel.cpp index 66e19ac41..215c2c13f 100644 --- a/src/game/vmap/WorldModel.cpp +++ b/src/game/vmap/WorldModel.cpp @@ -229,14 +229,32 @@ namespace VMAP bool WmoLiquid::writeToFile(FILE* wf) { bool result = true; - if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1) { result = false; } - if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1) { result = false; } - if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1) { result = false; } - if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1) { result = false; } + if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1) + { + result = false; + } uint32 size = (iTilesX + 1) * (iTilesY + 1); - if (result && fwrite(iHeight, sizeof(float), size, wf) != size) { result = false; } + if (result && fwrite(iHeight, sizeof(float), size, wf) != size) + { + result = false; + } size = iTilesX * iTilesY; - if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size) { result = false; } + if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size) + { + result = false; + } return result; } @@ -244,16 +262,34 @@ namespace VMAP { bool result = true; WmoLiquid* liquid = new WmoLiquid(); - if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1) { result = false; } - if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1) { result = false; } - if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1) { result = false; } - if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1) { result = false; } + if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1) + { + result = false; + } + if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1) + { + result = false; + } + if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1) + { + result = false; + } + if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1) + { + result = false; + } uint32 size = (liquid->iTilesX + 1) * (liquid->iTilesY + 1); liquid->iHeight = new float[size]; - if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size) { result = false; } + if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size) + { + result = false; + } size = liquid->iTilesX * liquid->iTilesY; liquid->iFlags = new uint8[size]; - if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size) { result = false; } + if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size) + { + result = false; + } if (!result) { delete liquid; @@ -290,41 +326,89 @@ namespace VMAP bool result = true; uint32 chunkSize, count; - if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1) { result = false; } - if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1) { result = false; } - if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1) { result = false; } + if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1) + { + result = false; + } // write vertices - if (result && fwrite("VERT", 1, 4, wf) != 4) { result = false; } + if (result && fwrite("VERT", 1, 4, wf) != 4) + { + result = false; + } count = vertices.size(); chunkSize = sizeof(uint32) + sizeof(Vector3) * count; - if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } - if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; } + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) + { + result = false; + } if (!count) // models without (collision) geometry end here, unsure if they are useful { return result; } - if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count) { result = false; } + if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count) + { + result = false; + } // write triangle mesh - if (result && fwrite("TRIM", 1, 4, wf) != 4) { result = false; } + if (result && fwrite("TRIM", 1, 4, wf) != 4) + { + result = false; + } count = triangles.size(); chunkSize = sizeof(uint32) + sizeof(MeshTriangle) * count; - if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } - if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; } + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) + { + result = false; + } if (count) - if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count) { result = false; } + if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count) + { + result = false; + } // write mesh BIH - if (result && fwrite("MBIH", 1, 4, wf) != 4) { result = false; } - if (result) { result = meshTree.writeToFile(wf); } + if (result && fwrite("MBIH", 1, 4, wf) != 4) + { + result = false; + } + if (result) + { + result = meshTree.writeToFile(wf); + } // write liquid data - if (result && fwrite("LIQU", 1, 4, wf) != 4) { result = false; } + if (result && fwrite("LIQU", 1, 4, wf) != 4) + { + result = false; + } chunkSize = iLiquid ? iLiquid->GetFileSize() : 0; - if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) + { + result = false; + } if (chunkSize) - if (result) { result = iLiquid->writeToFile(wf); } + if (result) + { + result = iLiquid->writeToFile(wf); + } return result; } @@ -340,38 +424,89 @@ namespace VMAP delete iLiquid; iLiquid = 0; - if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) { result = false; } - if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) { result = false; } - if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1) { result = false; } + if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) + { + result = false; + } + if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) + { + result = false; + } + if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1) + { + result = false; + } // read vertices - if (result && !readChunk(rf, chunk, "VERT", 4)) { result = false; } - if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } - if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; } + if (result && !readChunk(rf, chunk, "VERT", 4)) + { + result = false; + } + if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) + { + result = false; + } + if (result && fread(&count, sizeof(uint32), 1, rf) != 1) + { + result = false; + } if (!count) // models without (collision) geometry end here, unsure if they are useful { return result; } - if (result) { vertices.resize(count); } - if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count) { result = false; } + if (result) + { + vertices.resize(count); + } + if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count) + { + result = false; + } // read triangle mesh - if (result && !readChunk(rf, chunk, "TRIM", 4)) { result = false; } - if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } - if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; } + if (result && !readChunk(rf, chunk, "TRIM", 4)) + { + result = false; + } + if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) + { + result = false; + } + if (result && fread(&count, sizeof(uint32), 1, rf) != 1) + { + result = false; + } if (count) { - if (result) { triangles.resize(count); } - if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count) { result = false; } + if (result) + { + triangles.resize(count); + } + if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count) + { + result = false; + } } // read mesh BIH - if (result && !readChunk(rf, chunk, "MBIH", 4)) { result = false; } - if (result) { result = meshTree.readFromFile(rf); } + if (result && !readChunk(rf, chunk, "MBIH", 4)) + { + result = false; + } + if (result) + { + result = meshTree.readFromFile(rf); + } // read liquid data - if (result && !readChunk(rf, chunk, "LIQU", 4)) { result = false; } - if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } + if (result && !readChunk(rf, chunk, "LIQU", 4)) + { + result = false; + } + if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) + { + result = false; + } if (result && chunkSize > 0) { result = WmoLiquid::readFromFile(rf, iLiquid); @@ -386,7 +521,10 @@ namespace VMAP bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*pStopAtFirstHit*/) { bool result = IntersectTriangle(triangles[entry], vertices, ray, distance); - if (result) { hit = true; } + if (result) + { + hit = true; + } return hit; } std::vector::const_iterator vertices; @@ -455,7 +593,10 @@ namespace VMAP bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit) { bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit); - if (result) { hit = true; } + if (result) + { + hit = true; + } return hit; } std::vector::const_iterator models; @@ -561,25 +702,46 @@ namespace VMAP uint32 chunkSize, count; bool result = fwrite(VMAP_MAGIC, 1, 8, wf) == 8; - if (result && fwrite("WMOD", 1, 4, wf) != 4) { result = false; } + if (result && fwrite("WMOD", 1, 4, wf) != 4) + { + result = false; + } chunkSize = sizeof(uint32) + sizeof(uint32); - if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; } - if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1) { result = false; } + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) + { + result = false; + } + if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1) + { + result = false; + } // write group models count = groupModels.size(); if (count) { - if (result && fwrite("GMOD", 1, 4, wf) != 4) { result = false; } + if (result && fwrite("GMOD", 1, 4, wf) != 4) + { + result = false; + } // chunkSize = sizeof(uint32)+ sizeof(GroupModel)*count; // if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; - if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; } + if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) + { + result = false; + } for (uint32 i = 0; i < groupModels.size() && result; ++i) { result = groupModels[i].writeToFile(wf); } // write group BIH - if (result && fwrite("GBIH", 1, 4, wf) != 4) { result = false; } - if (result) { result = groupTree.writeToFile(wf); } + if (result && fwrite("GBIH", 1, 4, wf) != 4) + { + result = false; + } + if (result) + { + result = groupTree.writeToFile(wf); + } } fclose(wf); @@ -598,26 +760,50 @@ namespace VMAP uint32 chunkSize = 0; uint32 count = 0; char chunk[8]; // Ignore the added magic header - if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { result = false; } + if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) + { + result = false; + } - if (result && !readChunk(rf, chunk, "WMOD", 4)) { result = false; } - if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; } - if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1) { result = false; } + if (result && !readChunk(rf, chunk, "WMOD", 4)) + { + result = false; + } + if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) + { + result = false; + } + if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1) + { + result = false; + } // read group models if (result && readChunk(rf, chunk, "GMOD", 4)) { // if (fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false; - if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; } - if (result) { groupModels.resize(count); } + if (result && fread(&count, sizeof(uint32), 1, rf) != 1) + { + result = false; + } + if (result) + { + groupModels.resize(count); + } // if (result && fread(&groupModels[0], sizeof(GroupModel), count, rf) != count) result = false; for (uint32 i = 0; i < count && result; ++i) { result = groupModels[i].readFromFile(rf); } // read group BIH - if (result && !readChunk(rf, chunk, "GBIH", 4)) { result = false; } - if (result) { result = groupTree.readFromFile(rf); } + if (result && !readChunk(rf, chunk, "GBIH", 4)) + { + result = false; + } + if (result) + { + result = groupTree.readFromFile(rf); + } } fclose(rf); diff --git a/src/shared/Auth/BigNumber.cpp b/src/shared/Auth/BigNumber.cpp index 8bf413d85..2b2216fa2 100644 --- a/src/shared/Auth/BigNumber.cpp +++ b/src/shared/Auth/BigNumber.cpp @@ -48,7 +48,10 @@ BigNumber::BigNumber(uint32 val) BigNumber::~BigNumber() { BN_free(_bn); - if (_array) { delete[] _array; } + if (_array) + { + delete[] _array; + } } void BigNumber::SetDword(uint32 val) diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 10e0851ab..faffebac5 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -210,7 +210,10 @@ void Database::InitDelayThread() void Database::HaltDelayThread() { - if (!m_threadBody || !m_delayThread) { return; } + if (!m_threadBody || !m_delayThread) + { + return; + } m_threadBody->Stop(); // Stop event m_delayThread->wait(); // Wait for flush to DB @@ -329,7 +332,10 @@ bool Database::PExecuteLog(const char* format, ...) QueryResult* Database::PQuery(const char* format, ...) { - if (!format) { return NULL; } + if (!format) + { + return NULL; + } va_list ap; char szQuery [MAX_QUERY_LEN]; @@ -348,7 +354,10 @@ QueryResult* Database::PQuery(const char* format, ...) QueryNamedResult* Database::PQueryNamed(const char* format, ...) { - if (!format) { return NULL; } + if (!format) + { + return NULL; + } va_list ap; char szQuery [MAX_QUERY_LEN]; @@ -522,7 +531,7 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database) // db_version table does not exist or is empty if (!result) - { + { sLog.outErrorDb("The table `db_version` in your [%s] database is missing or corrupt.", dbversion.dbname.c_str()); sLog.outErrorDb(); sLog.outErrorDb(" [A] You have database Version: MaNGOS can not verify your database version or its existence!"); @@ -571,7 +580,7 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database) sLog.outErrorDb("Current DB content is %u, core expects %u", content, dbversion.expected_content); sLog.outErrorDb("This is ok for now but should not last long."); } - else if (content != dbversion.expected_content) + else if (content != dbversion.expected_content) { sLog.outErrorDb("The table `db_version` indicates that your [%s] database does not match the expected version!", dbversion.dbname.c_str()); sLog.outErrorDb(); diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index a25cc108d..7a8100a18 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -625,7 +625,7 @@ class Database /** * @brief Function to check that the database version matches expected core version * - * @param DatabaseTypes + * @param DatabaseTypes * @return bool */ bool CheckDatabaseVersion(DatabaseTypes database); diff --git a/src/shared/Database/SqlOperations.cpp b/src/shared/Database/SqlOperations.cpp index 8ba3f179a..64a880ef1 100644 --- a/src/shared/Database/SqlOperations.cpp +++ b/src/shared/Database/SqlOperations.cpp @@ -234,7 +234,10 @@ bool SqlQueryHolderEx::Execute(SqlConnection* conn) { /// execute all queries in the holder and pass the results char const* sql = queries[i].first; - if (sql) { m_holder->SetResult(i, conn->Query(sql)); } + if (sql) + { + m_holder->SetResult(i, conn->Query(sql)); + } } /// sync with the caller thread diff --git a/src/shared/Log/Log.cpp b/src/shared/Log/Log.cpp index c502b7884..f231de81a 100644 --- a/src/shared/Log/Log.cpp +++ b/src/shared/Log/Log.cpp @@ -73,9 +73,9 @@ enum LogType const int LogType_count = int(LogError) + 1; Log::Log() : - raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), dberLogfile(NULL), + raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), dberLogfile(NULL), #ifdef ENABLE_ELUNA - elunaErrLogfile(NULL), + elunaErrLogfile(NULL), #endif /* ENABLE_ELUNA */ eventAiErLogfile(NULL), scriptErrLogFile(NULL), worldLogfile(NULL), wardenLogfile(NULL), m_colored(false), m_includeTime(false), m_gmlog_per_account(false), m_scriptLibName(NULL) diff --git a/src/shared/Threading/DelayExecutor.cpp b/src/shared/Threading/DelayExecutor.cpp index 26bbdfc2e..e69629b38 100644 --- a/src/shared/Threading/DelayExecutor.cpp +++ b/src/shared/Threading/DelayExecutor.cpp @@ -132,4 +132,4 @@ bool DelayExecutor::activated() void DelayExecutor::activated(bool s) { activated_ = s; -} \ No newline at end of file +} diff --git a/src/shared/Threading/Threading.cpp b/src/shared/Threading/Threading.cpp index d406f2474..b7566e676 100644 --- a/src/shared/Threading/Threading.cpp +++ b/src/shared/Threading/Threading.cpp @@ -221,7 +221,7 @@ ACE_THR_FUNC_RETURN Thread::ThreadTask(void* param) { Runnable* _task = static_cast(param); _task->incReference(); - + _task->run(); // task execution complete, free referecne added at diff --git a/src/shared/Utilities/ProgressBar.cpp b/src/shared/Utilities/ProgressBar.cpp index 1235db56c..cb51df37c 100644 --- a/src/shared/Utilities/ProgressBar.cpp +++ b/src/shared/Utilities/ProgressBar.cpp @@ -87,7 +87,10 @@ void BarGoLink::step() int i, n; - if (num_rec == 0) { return; } + if (num_rec == 0) + { + return; + } ++rec_no; n = rec_no * indic_len / num_rec; if (n != rec_pos) diff --git a/src/shared/Utilities/Util.cpp b/src/shared/Utilities/Util.cpp index 22120d62f..7b218e86e 100644 --- a/src/shared/Utilities/Util.cpp +++ b/src/shared/Utilities/Util.cpp @@ -133,7 +133,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep) { if (sep.find(*i) != std::string::npos) { - if (s.length()) { r.push_back(s); } + if (s.length()) + { + r.push_back(s); + } s = ""; } else @@ -141,7 +144,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep) s += *i; } } - if (s.length()) { r.push_back(s); } + if (s.length()) + { + r.push_back(s); + } return r; } diff --git a/src/shared/Win/ServiceWin32.cpp b/src/shared/Win/ServiceWin32.cpp index 99310be55..9ddac2d00 100644 --- a/src/shared/Win/ServiceWin32.cpp +++ b/src/shared/Win/ServiceWin32.cpp @@ -238,7 +238,10 @@ void WINAPI ServiceMain(DWORD argc, char* argv[]) for (i = 0; i < std::strlen(path); ++i) { - if (path[i] == '\\') { last_slash = i; } + if (path[i] == '\\') + { + last_slash = i; + } } path[last_slash] = 0;