diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index ff4b3fe3c..5e946d215 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -313,7 +313,7 @@ void ArenaTeam::DelMember(ObjectGuid guid) } } - if(Player *player = sObjectMgr.GetPlayer(guid)) + if (Player* player = sObjectMgr.GetPlayer(guid)) { player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); // delete all info regarding this team diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index 541c756ee..e1c0f0028 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -152,7 +152,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data) void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/) { - DEBUG_LOG("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode + DEBUG_LOG("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode ArenaTeam *at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited()); if (!at) @@ -186,7 +186,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/) void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recv_data*/) { - DEBUG_LOG("CMSG_ARENA_TEAM_DECLINE"); // empty opcode + DEBUG_LOG("CMSG_ARENA_TEAM_DECLINE"); // empty opcode _player->SetArenaTeamIdInvited(0); // no more invited } diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index 410ea5b7c..f395e0e04 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -160,7 +160,6 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !! auction->itemGuidLow = 0; // pending list will not use guid data - // will delete item or place to receiver mail list MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str()) .AddItem(pItem) @@ -908,11 +907,13 @@ AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHou sAuctionMgr.AddAItem(newItem); CharacterDatabase.BeginTransaction(); + newItem->SaveToDB(); AH->SaveToDB(); if (pl) pl->SaveInventoryAndGoldToDB(); + CharacterDatabase.CommitTransaction(); return AH; @@ -1019,7 +1020,6 @@ bool AuctionEntry::UpdateBid(uint32 newbid, Player* newbidder /*=NULL*/) if ((newbid < buyout) || (buyout == 0)) // bid { - if (auction_owner) auction_owner->GetSession()->SendAuctionOwnerNotification(this); diff --git a/src/game/AuctionHouseMgr.h b/src/game/AuctionHouseMgr.h index 541a38c00..8e3707734 100644 --- a/src/game/AuctionHouseMgr.h +++ b/src/game/AuctionHouseMgr.h @@ -81,7 +81,6 @@ struct AuctionEntry void SaveToDB() const; void AuctionBidWinning(Player* bidder = NULL); - // -1,0,+1 order result int CompareAuctionEntry(uint32 column, const AuctionEntry *auc, Player* viewPlayer) const; diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index ede987374..74ddaa047 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -104,7 +104,6 @@ enum BattleGroundSpells enum BattleGroundTimeIntervals { RESURRECTION_INTERVAL = 30000, // ms - //REMIND_INTERVAL = 10000, // ms INVITATION_REMIND_TIME = 20000, // ms INVITE_ACCEPT_WAIT_TIME = 40000, // ms TIME_TO_AUTOREMOVE = 120000, // ms diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 64ef17a45..d8ffd5013 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -236,6 +236,7 @@ void BattleGroundAV::UpdateScore(BattleGroundTeamIndex teamIdx, int32 points ) void BattleGroundAV::Update(uint32 diff) { BattleGround::Update(diff); + if (GetStatus() != STATUS_IN_PROGRESS) return; diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index e355aedca..8ce5b1e9a 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -39,7 +39,6 @@ BattleGroundBE::BattleGroundBE() BattleGroundBE::~BattleGroundBE() { - } void BattleGroundBE::Update(uint32 diff) diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index a3e4504f2..04c6f8b4a 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -515,6 +515,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i); if (!bgQueueTypeId) continue; + BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId); ArenaType arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId); if (bgTypeId == _player->GetBattleGroundTypeId()) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index a56dc9672..85bf947a6 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1581,7 +1581,7 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA case BATTLEGROUND_RV: bg = new BattleGroundRV; break; case BATTLEGROUND_IC: bg = new BattleGroundIC; break; case BATTLEGROUND_RB: bg = new BattleGroundRB; break; - default:bg = new BattleGround; break; // placeholder for non implemented BG + default: bg = new BattleGround; break; // placeholder for non implemented BG } bg->SetMapId(MapID); diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index b20ede6bd..0db6bc4d3 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -39,7 +39,6 @@ BattleGroundRL::BattleGroundRL() BattleGroundRL::~BattleGroundRL() { - } void BattleGroundRL::Update(uint32 diff) diff --git a/src/game/ChannelHandler.cpp b/src/game/ChannelHandler.cpp index 905ef3e0b..94d2948ce 100644 --- a/src/game/ChannelHandler.cpp +++ b/src/game/ChannelHandler.cpp @@ -90,6 +90,7 @@ void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket) { DEBUG_LOG("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); + std::string channelname, newp; recvPacket >> channelname; diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index e5fa4372d..671c4f521 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -259,8 +259,9 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) WorldPacket data; ChatHandler::FillMessageData(&data, this, type, lang, msg.c_str()); group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetObjectGuid())); - } break; + break; + } case CHAT_MSG_GUILD: { std::string msg; @@ -281,8 +282,9 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if (GetPlayer()->GetGuildId()) if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId())) guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); - } break; + break; + } case CHAT_MSG_OFFICER: { std::string msg; @@ -303,8 +305,9 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) if (GetPlayer()->GetGuildId()) if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId())) guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL); - } break; + break; + } case CHAT_MSG_RAID: { std::string msg; diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 14545b829..d8f4cde68 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -132,7 +132,7 @@ void GameEventMgr::LoadFromDB() uint16 event_id = fields[0].GetUInt16(); if (event_id == 0) { - sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.",event_id); + sLog.outErrorDb("`game_event` game event id (%i) is reserved and can't be used.", event_id); continue; } @@ -145,7 +145,6 @@ void GameEventMgr::LoadFromDB() pGameEvent.length = fields[4].GetUInt32(); pGameEvent.holiday_id = HolidayIds(fields[5].GetUInt32()); - if (pGameEvent.length == 0) // length>0 is validity check { sLog.outErrorDb("`game_event` game event id (%i) have length 0 and can't be used.", event_id); @@ -173,7 +172,7 @@ void GameEventMgr::LoadFromDB() delete result; sLog.outString(); - sLog.outString( ">> Loaded %u game events", count ); + sLog.outString(">> Loaded %u game events", count); } std::map pool2event; // for check unique spawn event associated with pool diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index c13bb761e..9401a60e2 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1169,7 +1169,6 @@ void GameObject::Use(Unit* user) } player->RewardPlayerAndGroupAtCast(this); - } if (scriptReturnValue) diff --git a/src/game/Group.cpp b/src/game/Group.cpp index dfa22d35a..93f3e463d 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -146,6 +146,7 @@ bool Group::Create(ObjectGuid guid, const char * name) CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id); CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id); + CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) " "VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')", m_Id, m_leaderGuid.GetCounter(), m_mainTankGuid.GetCounter(), m_mainAssistantGuid.GetCounter(), uint32(m_lootMethod), diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 700248cf4..e75052be8 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -388,7 +388,7 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data ) ObjectGuid lootedTarget; uint32 itemSlot; uint8 rollType; - recv_data >> lootedTarget; //guid of the item rolled + recv_data >> lootedTarget; //guid of the item rolled recv_data >> itemSlot; recv_data >> rollType; diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 341c41f61..150883be9 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -602,7 +602,7 @@ struct ItemPrototype uint32 GemProperties; // id from GemProperties.dbc int32 RequiredDisenchantSkill; float ArmorDamageModifier; - uint32 Duration; // negative = realtime, positive = ingame time + uint32 Duration; uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc uint32 HolidayId; // id from Holidays.dbc uint32 ScriptId; diff --git a/src/game/Language.h b/src/game/Language.h index 0cbfd2896..582d37dd0 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -788,9 +788,7 @@ enum MangosStrings LANG_BG_AV_H_NEAR_LOSE = 788, LANG_BG_AV_H_GENERAL_DEAD = 789, LANG_BG_AV_A_GENERAL_DEAD = 790, - - - // Room for batleground/arena strings 791-799 not used + // Room for battleground/arena strings 791-799 not used // in game strings // = 800, not used diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 561bd2481..fd075a1cb 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -245,8 +245,6 @@ bool ChatHandler::HandleGMVisibleCommand(char* args) return true; } - - bool ChatHandler::HandleGPSCommand(char* args) { WorldObject *obj = NULL; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index d1760b093..2b595dbfb 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1739,7 +1739,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(char* args) { pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); pCreature->GetMotionMaster()->Initialize(); - if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn { pCreature->SetDeathState(JUST_DIED); pCreature->Respawn(); @@ -1925,7 +1925,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args) } pCreature->GetMap()->CreatureRelocation(pCreature,x, y, z,o); pCreature->GetMotionMaster()->Initialize(); - if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn { pCreature->SetDeathState(JUST_DIED); pCreature->Respawn(); @@ -2019,7 +2019,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args) { pCreature->SetDefaultMovementType(move_type); pCreature->GetMotionMaster()->Initialize(); - if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn { pCreature->SetDeathState(JUST_DIED); pCreature->Respawn(); @@ -2128,7 +2128,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args) pCreature->SetRespawnRadius((float)option); pCreature->SetDefaultMovementType(mtype); pCreature->GetMotionMaster()->Initialize(); - if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn { pCreature->SetDeathState(JUST_DIED); pCreature->Respawn(); @@ -2221,10 +2221,11 @@ bool ChatHandler::HandleNpcUnFollowCommand(char* /*args*/) bool ChatHandler::HandleNpcTameCommand(char* /*args*/) { Creature *creatureTarget = getSelectedCreature (); - if (!creatureTarget || creatureTarget->IsPet ()) + + if (!creatureTarget || creatureTarget->IsPet()) { - PSendSysMessage (LANG_SELECT_CREATURE); - SetSentErrorMessage (true); + PSendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); return false; } @@ -2987,7 +2988,7 @@ bool ChatHandler::HandleWpAddCommand(char* args) { target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); target->GetMotionMaster()->Initialize(); - if (target->isAlive()) // dead creature will reset movement generator at respawn + if (target->isAlive()) // dead creature will reset movement generator at respawn { target->SetDeathState(JUST_DIED); target->Respawn(); @@ -3207,7 +3208,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) if (npcCreature) { npcCreature->GetMotionMaster()->Initialize(); - if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn + if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn { npcCreature->SetDeathState(JUST_DIED); npcCreature->Respawn(); @@ -3287,7 +3288,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) delete result2; } npcCreature->GetMotionMaster()->Initialize(); - if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn + if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn { npcCreature->SetDeathState(JUST_DIED); npcCreature->Respawn(); @@ -3351,7 +3352,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) if (npcCreature) { npcCreature->GetMotionMaster()->Initialize(); - if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn + if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn { npcCreature->SetDeathState(JUST_DIED); npcCreature->Respawn(); @@ -3385,7 +3386,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) { npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); npcCreature->GetMotionMaster()->Initialize(); - if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn + if (npcCreature->isAlive()) // dead creature will reset movement generator at respawn { npcCreature->SetDeathState(JUST_DIED); npcCreature->Respawn(); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index bc5e0170c..3a11d8e23 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -4365,7 +4365,7 @@ bool ChatHandler::HandleExploreCheatCommand(char* args) ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING,GetNameLink().c_str()); } - for (uint8 i=0; i= PLAYER_EXPLORED_ZONES_SIZE) + if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); @@ -5076,6 +5076,7 @@ bool ChatHandler::HandleResetSpecsCommand(char* args) { target->resetTalents(true,true); target->SendTalentsInfoData(false); + ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS); if (!m_session || m_session->GetPlayer() != target) PSendSysMessage(LANG_RESET_TALENTS_ONLINE,GetNameLink(target).c_str()); @@ -6119,6 +6120,7 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/) case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break; case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break; case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break; + case CHASE_MOTION_TYPE: { Unit* target = NULL; @@ -6510,7 +6512,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(char* args) ++itr; continue; } - if(itr->first != player->GetMapId()) + if (itr->first != player->GetMapId()) { DungeonPersistentState *save = itr->second.state; std::string timeleft = secsToTimeString(save->GetResetTime() - time(NULL), true); @@ -6531,6 +6533,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(char* args) } } PSendSysMessage("instances unbound: %d", counter); + return true; } diff --git a/src/game/MailHandler.cpp b/src/game/MailHandler.cpp index 1897b51f8..782086f75 100644 --- a/src/game/MailHandler.cpp +++ b/src/game/MailHandler.cpp @@ -293,8 +293,8 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) pl->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true); CharacterDatabase.BeginTransaction(); - item->DeleteFromInventoryDB(); // deletes item from character's inventory - item->SaveToDB(); // recursive and not have transaction guard into self, item not in inventory and can be save standalone + item->DeleteFromInventoryDB(); // deletes item from character's inventory + item->SaveToDB(); // recursive and not have transaction guard into self, item not in inventory and can be save standalone // owner in data will set at mail receive and item extracting CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", rc.GetCounter(), item->GetGUIDLow()); CharacterDatabase.CommitTransaction(); @@ -556,6 +556,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) else pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg); } + /** * Handles the packet sent by the client when taking money from the mail. */ diff --git a/src/game/Map.cpp b/src/game/Map.cpp index e7b2b13ec..f7ef79b2f 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1325,9 +1325,9 @@ bool DungeonMap::Add(Player *player) if (groupBind) sLog.outError("DungeonMap::Add: the group (Id: %d) is bound to instance %d,%d,%d,%d,%d,%d", - pGroup->GetId(), - groupBind->state->GetMapId(), groupBind->state->GetInstanceId(), groupBind->state->GetDifficulty(), - groupBind->state->GetPlayerCount(), groupBind->state->GetGroupCount(), groupBind->state->CanReset()); + pGroup->GetId(), + groupBind->state->GetMapId(), groupBind->state->GetInstanceId(), groupBind->state->GetDifficulty(), + groupBind->state->GetPlayerCount(), groupBind->state->GetGroupCount(), groupBind->state->CanReset()); // no reason crash if we can fix state player->UnbindInstance(GetId(), GetDifficulty()); diff --git a/src/game/MapPersistentStateMgr.h b/src/game/MapPersistentStateMgr.h index f0af4459d..6f6c375b4 100644 --- a/src/game/MapPersistentStateMgr.h +++ b/src/game/MapPersistentStateMgr.h @@ -319,7 +319,6 @@ class DungeonResetScheduler private: // fields MapPersistentStateManager& m_InstanceSaves; - // fast lookup for reset times (always use existing functions for access/set) typedef UNORDERED_MAP ResetTimeByMapDifficultyMap; ResetTimeByMapDifficultyMap m_resetTimeByMapDifficulty; diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index c81487223..4aad269c5 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -296,6 +296,7 @@ void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket &recv_data) { uint32 opcode = recv_data.GetOpcode(); DEBUG_LOG("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); + /* extract packet */ ObjectGuid guid; MovementInfo movementInfo; diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index a167e258c..23916e9ad 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -122,6 +122,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid) static void SendTrainerSpellHelper(WorldPacket& data, TrainerSpell const* tSpell, TrainerSpellState state, float fDiscountMod, bool can_learn_primary_prof, uint32 reqLevel) { bool primary_prof_first_rank = sSpellMgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell); + SpellChainNode const* chain_node = sSpellMgr.GetSpellChainNode(tSpell->learnedSpell); data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index a5d9742c7..6fc02a984 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -959,7 +959,7 @@ void WorldObject::Relocate(float x, float y, float z, float orientation) m_position.z = z; m_position.o = orientation; - if(isType(TYPEMASK_UNIT)) + if (isType(TYPEMASK_UNIT)) ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, orientation); } @@ -969,7 +969,7 @@ void WorldObject::Relocate(float x, float y, float z) m_position.y = y; m_position.z = z; - if(isType(TYPEMASK_UNIT)) + if (isType(TYPEMASK_UNIT)) ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, GetOrientation()); } @@ -977,7 +977,7 @@ void WorldObject::SetOrientation(float orientation) { m_position.o = orientation; - if(isType(TYPEMASK_UNIT)) + if (isType(TYPEMASK_UNIT)) ((Unit*)this)->m_movementInfo.ChangeOrientation(orientation); } diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 8331e7467..0a48efe9b 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -207,7 +207,7 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia) // remove resurrectable corpse from grid object registry (loaded state checked into call) // do not load the map if it's not loaded Map *map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId()); - if(map) + if (map) map->Remove(corpse, false); // remove corpse from DB diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 933516903..75c7d30d0 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -441,7 +441,7 @@ void ObjectMgr::LoadPointOfInterestLocales() delete result; sLog.outString(); - sLog.outString( ">> Loaded %lu points_of_interest locale strings", (unsigned long)mPointOfInterestLocaleMap.size() ); + sLog.outString(">> Loaded " SIZEFMTD " points_of_interest locale strings", mPointOfInterestLocaleMap.size()); } struct SQLCreatureLoader : public SQLStorageLoaderBase @@ -850,10 +850,9 @@ void ObjectMgr::LoadEquipmentTemplates() for(uint8 j = 0; j < 3; ++j) { if (!eqInfo->equipentry[j]) - continue; + continue; ItemEntry const *dbcitem = sItemStore.LookupEntry(eqInfo->equipentry[j]); - if (!dbcitem) { sLog.outErrorDb("Unknown item (entry=%u) in creature_equip_template.equipentry%u for entry = %u, forced to 0.", eqInfo->equipentry[j], j+1, i); @@ -877,6 +876,7 @@ void ObjectMgr::LoadEquipmentTemplates() } } } + sLog.outString( ">> Loaded %u equipment template", sEquipmentStorage.RecordCount ); sLog.outString(); } @@ -3396,7 +3396,7 @@ void ObjectMgr::LoadArenaTeams() // 0 1 2 3 4 5 QueryResult *result = CharacterDatabase.Query( "SELECT arena_team.arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle," - // 6 7 8 9 10 11 12 13 14 + // 6 7 8 9 10 11 12 13 14 "EmblemColor,BorderStyle,BorderColor, rating,games_week,wins_week,games_season,wins_season,rank " "FROM arena_team LEFT JOIN arena_team_stats ON arena_team.arenateamid = arena_team_stats.arenateamid ORDER BY arena_team.arenateamid ASC" ); @@ -5667,14 +5667,14 @@ void ObjectMgr::PackGroupIds() void ObjectMgr::SetHighestGuids() { - QueryResult *result = CharacterDatabase.Query( "SELECT MAX(guid) FROM characters" ); + QueryResult *result = CharacterDatabase.Query("SELECT MAX(guid) FROM characters"); if( result ) { m_CharGuids.Set((*result)[0].GetUInt32()+1); delete result; } - result = WorldDatabase.Query( "SELECT MAX(guid) FROM creature" ); + result = WorldDatabase.Query("SELECT MAX(guid) FROM creature"); if( result ) { m_FirstTemporaryCreatureGuid = (*result)[0].GetUInt32()+1; diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index b9dcf19d4..2c45d041a 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -25,7 +25,7 @@ /// Correspondence between opcodes and their names OpcodeHandler opcodeTable[NUM_MSG_TYPES] = -{ /*thread-safe*/ +{ /*0x000*/ { "MSG_NULL_ACTION", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x001*/ { "CMSG_BOOTME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x002*/ { "CMSG_DBLOOKUP", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 6c3cfef7a..2c521b058 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -440,7 +440,6 @@ void Pet::SavePetToDB(PetSaveMode mode) savePet.Execute(); CharacterDatabase.CommitTransaction(); } - // delete else { RemoveAllAuras(AURA_REMOVE_BY_DELETE); @@ -1692,7 +1691,6 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab) return true; } - void Pet::CleanupActionBar() { for(int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 4cf65573a..a73de9bef 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -460,6 +460,7 @@ Player::Player (WorldSession *session): Unit(), m_mover(this), m_camera(this), m m_MirrorTimerFlags = UNDERWATER_NONE; m_MirrorTimerFlagsLast = UNDERWATER_NONE; + m_isInWater = false; m_drunkTimer = 0; m_drunk = 0; @@ -1011,7 +1012,7 @@ void Player::HandleDrowning(uint32 time_diff) m_MirrorTimer[BREATH_TIMER] = getMaxTimer(BREATH_TIMER); SendMirrorTimer(BREATH_TIMER, m_MirrorTimer[BREATH_TIMER], m_MirrorTimer[BREATH_TIMER], -1); } - else // If activated - do tick + else { m_MirrorTimer[BREATH_TIMER]-=time_diff; // Timer limit - need deal damage @@ -9767,7 +9768,7 @@ InventoryResult Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, I if (res != EQUIP_ERR_OK) continue; - // descrease at current stacksize + // decrease at current stacksize need_space -= pItem2->GetCount(); } @@ -11102,6 +11103,7 @@ Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update ) Item* lastItem = pItem; uint32 entry = pItem->GetEntry(); + for(ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ) { uint16 pos = itr->pos; @@ -11117,6 +11119,7 @@ Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update ) lastItem = _StoreItem(pos,pItem,count,true,update); } + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, entry); return lastItem; } @@ -12599,6 +12602,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply); break; case ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL: + { if (enchant_spell_id) { if (apply) @@ -12631,6 +12635,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool RemoveAurasDueToItemSpell(item, enchant_spell_id); } break; + } case ITEM_ENCHANTMENT_TYPE_RESISTANCE: if (!enchant_amount) { @@ -13248,6 +13253,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me PlayerTalkClass->CloseGossip(); TalkedToCreature(pSource->GetEntry(), pSource->GetObjectGuid()); } + break; } case GOSSIP_OPTION_SPIRITHEALER: @@ -14831,6 +14837,7 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid ) { uint32 addkillcount = 1; GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, entry, addkillcount); + for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i ) { uint32 questid = GetQuestSlotQuestId(i); @@ -19490,7 +19497,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it { if (ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemId)) { - for(int idx = 0; idx < 5; ++idx) + for(int idx = 0; idx < MAX_ITEM_PROTO_SPELLS; ++idx) { if (proto->Spells[idx].SpellId == spellInfo->Id) { @@ -20271,7 +20278,7 @@ void Player::SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg) { WorldPacket data(SMSG_TRANSFER_ABORTED, 4+2); data << uint32(mapid); - data << uint8(reason); // transfer abort reason + data << uint8(reason); // transfer abort reason switch(reason) { case TRANSFER_ABORT_INSUF_EXPAN_LVL: diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 424c70606..c11c7ed78 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -702,6 +702,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s break; } case DTT_EQSET_TABLE: + { if (!changenth(line, 1, newguid)) // character_equipmentsets.guid update ROLLBACK(DUMP_FILE_BROKEN); if (!changeGuid(line, 2, eqsets, sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed())) @@ -710,7 +711,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s if(!changeGuid(line, 6+i, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed())) ROLLBACK(DUMP_FILE_BROKEN); break; - + } default: sLog.outError("Unknown dump table type: %u",type); break; diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp index 9b36bd20e..2a2202cc6 100644 --- a/src/game/ReputationMgr.cpp +++ b/src/game/ReputationMgr.cpp @@ -124,12 +124,12 @@ void ReputationMgr::SendState(FactionState const* faction) { uint32 count = 1; - WorldPacket data(SMSG_SET_FACTION_STANDING, (16)); // last check 2.4.0 - data << (float) 0; // unk 2.4.0 - data << (uint8) 0; // wotlk 8634 + WorldPacket data(SMSG_SET_FACTION_STANDING, (16)); // last check 2.4.0 + data << (float) 0; // unk 2.4.0 + data << (uint8) 0; // wotlk 8634 size_t p_count = data.wpos(); - data << (uint32) count; // placeholder + data << (uint32) count; // placeholder data << (uint32) faction->ReputationListID; data << (uint32) faction->Standing; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 2f6f20d67..5cb696b36 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -609,7 +609,7 @@ void Spell::FillTargetMap() default: SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetA[i], tmpUnitLists[i /*==effToIndex[i]*/]); SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetB[i], tmpUnitLists[i /*==effToIndex[i]*/]); - break; + break; } break; case TARGET_SELF2: @@ -657,7 +657,7 @@ void Spell::FillTargetMap() } break; } - } // End new target combination fill + } if (m_caster->GetTypeId() == TYPEID_PLAYER) { @@ -834,7 +834,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) if (targetGUID == ihit->targetGUID) // Found in list { if (!immuned) - ihit->effectMask |= (1 << effIndex); // Add only effect mask if not immuned + ihit->effectMask |= 1 << effIndex; // Add only effect mask if not immuned return; } } @@ -1997,6 +1997,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& MaNGOS::UnitListSearcher searcher(tempTargetUnitMap, u_check); Cell::VisitAllObjects(m_caster, searcher, max_range); } + if (tempTargetUnitMap.empty()) break; @@ -2012,18 +2013,21 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& while (t && next != tempTargetUnitMap.end()) { - if (!prev->IsWithinDist (*next,CHAIN_SPELL_JUMP_RADIUS)) + if (!prev->IsWithinDist(*next,CHAIN_SPELL_JUMP_RADIUS)) break; - if (!prev->IsWithinLOSInMap (*next)) + + if (!prev->IsWithinLOSInMap(*next)) { ++next; continue; } + prev = *next; targetUnitMap.push_back(prev); tempTargetUnitMap.erase(next); tempTargetUnitMap.sort(TargetDistanceOrderNear(prev)); next = tempTargetUnitMap.begin(); + --t; } } @@ -2906,7 +2910,6 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap.push_back(owner); } break; - default: break; } @@ -4066,7 +4069,7 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) break; } - if(ammoDisplayID) + if (ammoDisplayID) break; } } @@ -4549,7 +4552,7 @@ void Spell::TakeReagents() return; Player* p_caster = (Player*)m_caster; - if (p_caster->CanNoReagentCast(m_spellInfo) ) + if (p_caster->CanNoReagentCast(m_spellInfo)) return; for(uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x) @@ -5012,7 +5015,7 @@ SpellCastResult Spell::CheckCast(bool strict) //Must be behind the target. if (m_spellInfo->AttributesEx2 == SPELL_ATTR_EX2_UNK20 && m_spellInfo->HasAttribute(SPELL_ATTR_EX_UNK9) && target->HasInArc(M_PI_F, m_caster)) { - // Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags + // Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags // Exclusion for Mutilate:Facing Limitation was removed in 2.0.1 and 3.0.3, but they still use the same, old Ex-Flags // Exclusion for Throw: Facing limitation was added in 3.2.x, but that shouldn't be if (!m_spellInfo->IsFitToFamily(SPELLFAMILY_DRUID, UI64LIT(0x0000000000020000)) && @@ -5251,7 +5254,7 @@ SpellCastResult Spell::CheckCast(bool strict) return castResult; } - if(!m_IsTriggeredSpell) // triggered spell not affected by stun/etc + if(!m_IsTriggeredSpell) // triggered spell not affected by stun/etc { SpellCastResult castResult = CheckCasterAuras(); if(castResult != SPELL_CAST_OK) @@ -6296,6 +6299,7 @@ SpellCastResult Spell::CheckPower() return SPELL_FAILED_CASTER_AURASTATE; return SPELL_CAST_OK; } + // Check valid power type if (m_spellInfo->powerType >= MAX_POWERS) { diff --git a/src/game/Spell.h b/src/game/Spell.h index a22a9cfab..284312bae 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -343,7 +343,6 @@ class Spell void EffectKillCreditGroup(SpellEffectIndex eff_idx); void EffectQuestFail(SpellEffectIndex eff_idx); void EffectActivateRune(SpellEffectIndex eff_idx); - void EffectTeachTaxiNode(SpellEffectIndex eff_idx); void EffectTitanGrip(SpellEffectIndex eff_idx); void EffectEnchantItemPrismatic(SpellEffectIndex eff_idx); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 89cd2fe42..13a5a58b2 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -761,7 +761,7 @@ void AreaAura::Update(uint32 diff) // or caster is (no longer) friendly bool needFriendly = (m_areaAuraType == AREA_AURA_ENEMY ? false : true); if( !caster || caster->hasUnitState(UNIT_STAT_ISOLATED) || - !caster->IsWithinDistInMap(target, m_radius) || + !caster->IsWithinDistInMap(target, m_radius) || !caster->HasAura(GetId(), GetEffIndex()) || caster->IsFriendlyTo(target) != needFriendly ) @@ -1047,6 +1047,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) entry->EffectSpellClassMask[GetEffIndex()].Flags = UI64LIT(0x0000000000200000); } } + ((Player*)GetTarget())->AddSpellMod(this, apply); ReapplyAffectedPassiveAuras(); @@ -3067,6 +3068,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } break; case SPELLFAMILY_HUNTER: + { switch(GetId()) { case 34477: // Misdirection, main spell @@ -3083,6 +3085,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } } break; + } case SPELLFAMILY_PALADIN: switch(GetId()) { @@ -4935,7 +4938,7 @@ void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) if(!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (apply) { @@ -5437,10 +5440,10 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Rip if (spellProto->SpellFamilyFlags & UI64LIT(0x000000000000800000)) { - // 0.01*$AP*cp if (caster->GetTypeId() != TYPEID_PLAYER) break; + // 0.01*$AP*cp uint8 cp = ((Player*)caster)->GetComboPoints(); // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs @@ -8865,7 +8868,8 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() break; } } - // this was last holder + + // this has been last aura if(!found) m_target->ModifyAuraState(AuraState(removeState), false); } diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index bfd8a1642..440f80f4d 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -243,7 +243,6 @@ class MANGOS_DLL_SPEC Aura void HandleAuraFeatherFall(bool Apply, bool Real); void HandleAuraHover(bool Apply, bool Real); void HandleAddModifier(bool Apply, bool Real); - void HandleAuraModStun(bool Apply, bool Real); void HandleModDamageDone(bool Apply, bool Real); void HandleAuraUntrackable(bool Apply, bool Real); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 681e8212b..5f648563c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -590,6 +590,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) // Lookup for Deadly poison (only attacker applied) Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + { if ((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE && ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x10000)) && (*itr)->GetCasterGuid() == m_caster->GetObjectGuid()) @@ -597,6 +598,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) poison = *itr; break; } + } // count consumed deadly poison doses at target if (poison) { @@ -2699,7 +2701,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (!unitTarget) return; - m_caster->CastSpell(unitTarget, 21887, true);// spell mod + m_caster->CastSpell(unitTarget, 21887, true); // spell mod return; } // Last Stand @@ -3175,6 +3177,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (!unitTarget || unitTarget->getPowerType() != POWER_MANA) return; + // Glyph of Mana Tide if (Unit *owner = m_caster->GetOwner()) if (Aura *dummy = owner->GetDummyAura(55441)) @@ -4204,10 +4207,10 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) ItemPosCountVec dest; uint32 no_space = 0; InventoryResult msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space ); - if( msg != EQUIP_ERR_OK ) + if (msg != EQUIP_ERR_OK) { // convert to possible store amount - if( msg == EQUIP_ERR_INVENTORY_FULL || msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS ) + if (msg == EQUIP_ERR_INVENTORY_FULL || msg == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) num_to_add -= no_space; else { @@ -4234,7 +4237,7 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) } // set the "Crafted by ..." property of the item - if( pItem->GetProto()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetProto()->Class != ITEM_CLASS_QUEST) + if (pItem->GetProto()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetProto()->Class != ITEM_CLASS_QUEST) pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetObjectGuid()); // send info to the client @@ -6544,7 +6547,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // check presence for(int j = 0; j < 4; ++j) - if(unitTarget->HasAura(spells[j], EFFECT_INDEX_0)) + if (unitTarget->HasAura(spells[j], EFFECT_INDEX_0)) return; // cast @@ -7946,6 +7949,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; } + break; } case SPELLFAMILY_POTION: { @@ -8593,10 +8597,10 @@ void Spell::EffectLeapForward(SpellEffectIndex eff_idx) void Spell::EffectLeapBack(SpellEffectIndex eff_idx) { - if(unitTarget->IsTaxiFlying()) + if (unitTarget->IsTaxiFlying()) return; - m_caster->KnockBackFrom(unitTarget,float(m_spellInfo->EffectMiscValue[eff_idx])/10,float(damage)/10); + m_caster->KnockBackFrom(unitTarget, float(m_spellInfo->EffectMiscValue[eff_idx])/10, float(damage)/10); } void Spell::EffectReputation(SpellEffectIndex eff_idx) @@ -8827,10 +8831,10 @@ void Spell::DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction) void Spell::EffectKnockBack(SpellEffectIndex eff_idx) { - if(!unitTarget) + if (!unitTarget) return; - unitTarget->KnockBackFrom(m_caster,float(m_spellInfo->EffectMiscValue[eff_idx])/10,float(damage)/10); + unitTarget->KnockBackFrom(m_caster, float(m_spellInfo->EffectMiscValue[eff_idx])/10, float(damage)/10); } void Spell::EffectSendTaxi(SpellEffectIndex eff_idx) @@ -8843,14 +8847,14 @@ void Spell::EffectSendTaxi(SpellEffectIndex eff_idx) void Spell::EffectPlayerPull(SpellEffectIndex eff_idx) { - if(!unitTarget) + if (!unitTarget) return; float dist = unitTarget->GetDistance2d(m_caster); if (damage && dist > damage) dist = float(damage); - unitTarget->KnockBackFrom(m_caster,-dist,float(m_spellInfo->EffectMiscValue[eff_idx])/10); + unitTarget->KnockBackFrom(m_caster, -dist, float(m_spellInfo->EffectMiscValue[eff_idx])/10); } void Spell::EffectDispelMechanic(SpellEffectIndex eff_idx) diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 9b7dfca2e..6c0525566 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -285,7 +285,6 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) return; GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid); - if(!obj) return; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 1d13b7a80..b8b7ae199 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1309,7 +1309,7 @@ void SpellMgr::LoadSpellProcEvents() spe.schoolMask = fields[1].GetUInt32(); spe.spellFamilyName = fields[2].GetUInt32(); - for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { spe.spellFamilyMask[i] = ClassFamilyMask( (uint64)fields[i+3].GetUInt32() | ((uint64)fields[i+6].GetUInt32()<<32), @@ -1594,7 +1594,7 @@ void SpellMgr::LoadSpellBonuses() // also add to high ranks DoSpellBonuses worker(mSpellBonusMap, sbe); - doForHighRanks(entry,worker); + doForHighRanks(entry, worker); ++count; @@ -1920,7 +1920,6 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if (spellInfo_1->SpellIconID == 3176 && spellInfo_2->SpellIconID == 3176) return false; - // Brood Affliction: Bronze if ((spellInfo_1->Id == 23170 && spellInfo_2->Id == 23171) || (spellInfo_2->Id == 23170 && spellInfo_1->Id == 23171)) @@ -2175,6 +2174,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000))) || ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000)))) return false; + // Dispersion if ((spellInfo_1->Id == 47585 && spellInfo_2->Id == 60069) || (spellInfo_2->Id == 47585 && spellInfo_1->Id == 60069)) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 73117a0a3..89e70849f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1420,8 +1420,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da // Add melee damage bonus damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType); damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType); - // Calculate armor reduction + // Calculate armor reduction uint32 armor_affected_damage = CalcNotIgnoreDamageReduction(damage, damageInfo->damageSchoolMask); damageInfo->damage = damage - armor_affected_damage + CalcArmorReducedDamage(damageInfo->target, armor_affected_damage); damageInfo->cleanDamage += damage - damageInfo->damage; @@ -2032,8 +2032,8 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM reflectTriggeredBy->SetInUse(true); // lock aura from final deletion until processing break; } - if (spellProto->Id == 39228 || // Argussian Compass - spellProto->Id == 60218) // Essence of Gossamer + if (spellProto->Id == 39228 || // Argussian Compass + spellProto->Id == 60218) // Essence of Gossamer { // Max absorb stored in 1 dummy effect int32 max_absorb = spellProto->CalculateSimpleValue(EFFECT_INDEX_1); @@ -2069,9 +2069,9 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM if (spellProto->SpellIconID == 2109) { if (!preventDeathSpell && - GetTypeId()==TYPEID_PLAYER && // Only players + GetTypeId()==TYPEID_PLAYER && // Only players !((Player*)this)->HasSpellCooldown(31231) && - // Only if no cooldown + // Only if no cooldown roll_chance_i((*i)->GetModifier()->m_amount)) // Only if roll { @@ -2222,11 +2222,10 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM // Cast back reflect damage spell if (canReflect && reflectSpell) { - CastCustomSpell(pCaster, reflectSpell, &reflectDamage, NULL, NULL, true, NULL, reflectTriggeredBy); + CastCustomSpell(pCaster, reflectSpell, &reflectDamage, NULL, NULL, true, NULL, reflectTriggeredBy); reflectTriggeredBy->SetInUse(false); // free lock from deletion } - // absorb by mana cost AuraList const& vManaShield = GetAurasByType(SPELL_AURA_MANA_SHIELD); for(AuraList::const_iterator i = vManaShield.begin(), next; i != vManaShield.end() && RemainingDamage > 0; i = next) @@ -4052,7 +4051,6 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) if(stop) break; - } } @@ -4365,7 +4363,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount { SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId); - // Custom dispel cases + // Custom dispel case // Unstable Affliction if(spellEntry->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellEntry->SpellFamilyFlags & UI64LIT(0x010000000000))) { @@ -6250,13 +6248,13 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for(AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if( ((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto)) && + if (((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto)) && (*i)->GetSpellProto()->EquippedItemClass == -1 && // -1 == any item class (not wand then) - (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 ) + (*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0) // 0 == any inventory type (not wand then) { - DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; + DoneTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; } } @@ -6942,7 +6940,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama */ uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack) { - // For totems get healing bonus from owner (statue isn't totem in fact) + // For totems get healing bonus from owner (statue isn't totem in fact) if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE) if(Unit* owner = GetOwner()) return owner->SpellHealingBonusDone(pVictim, spellProto, healamount, damagetype, stack); @@ -7170,13 +7168,13 @@ int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask) { - //If m_immuneToSchool type contain this school type, IMMUNE damage. + // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) if (itr->type & shoolMask) return true; - //If m_immuneToDamage type contain magic, IMMUNE damage. + // If m_immuneToDamage type contain magic, IMMUNE damage. SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE]; for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr) if (itr->type & shoolMask) @@ -7233,7 +7231,7 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i if (itr->type == effect) return true; - if(uint32 mechanic = spellInfo->EffectMechanic[index]) + if (uint32 mechanic = spellInfo->EffectMechanic[index]) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) @@ -7246,7 +7244,7 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i return true; } - if(uint32 aura = spellInfo->EffectApplyAuraName[index]) + if (uint32 aura = spellInfo->EffectApplyAuraName[index]) { SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE]; for(SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr) @@ -8749,6 +8747,7 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt case 0: // not used case 1: basePoints += 1; break; // range 1..1 default: + { // range can have positive (1..rand) and negative (rand..1) values, so order its for irand int32 randvalue = (randomPoints >= 1) ? irand(1, randomPoints) @@ -8756,6 +8755,7 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt basePoints += randvalue; break; + } } int32 value = basePoints; @@ -9050,14 +9050,14 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f case UNIT_MOD_ENERGY: case UNIT_MOD_HAPPINESS: case UNIT_MOD_RUNE: - case UNIT_MOD_RUNIC_POWER: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break; + case UNIT_MOD_RUNIC_POWER: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break; case UNIT_MOD_RESISTANCE_HOLY: case UNIT_MOD_RESISTANCE_FIRE: case UNIT_MOD_RESISTANCE_NATURE: case UNIT_MOD_RESISTANCE_FROST: case UNIT_MOD_RESISTANCE_SHADOW: - case UNIT_MOD_RESISTANCE_ARCANE: UpdateResistances(GetSpellSchoolByAuraGroup(unitMod)); break; + case UNIT_MOD_RESISTANCE_ARCANE: UpdateResistances(GetSpellSchoolByAuraGroup(unitMod)); break; case UNIT_MOD_ATTACK_POWER: UpdateAttackPowerAndDamage(); break; case UNIT_MOD_ATTACK_POWER_RANGED: UpdateAttackPowerAndDamage(true); break; @@ -10216,6 +10216,7 @@ void Unit::ClearAllReactives() ModifyAuraState(AURA_STATE_DEFENSE, false); if (getClass() == CLASS_HUNTER && HasAuraState( AURA_STATE_HUNTER_PARRY)) ModifyAuraState(AURA_STATE_HUNTER_PARRY, false); + if(getClass() == CLASS_WARRIOR && GetTypeId() == TYPEID_PLAYER) ((Player*)this)->ClearComboPoints(); } @@ -10304,6 +10305,7 @@ Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= NULL*/, float radius /*= MaNGOS::UnitListSearcher searcher(targets, u_check); Cell::VisitAllObjects(this, searcher, radius); + // remove current target if(except) targets.remove(except); diff --git a/src/game/Unit.h b/src/game/Unit.h index e118e070b..113590dc3 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -815,7 +815,7 @@ struct CalcDamageInfo uint32 blocked_amount; uint32 HitInfo; uint32 TargetState; -// Helper + // Helper WeaponAttackType attackType; // uint32 procAttacker; uint32 procVictim; @@ -1089,7 +1089,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject typedef std::map VisibleAuraMap; typedef std::map SingleCastSpellTargetMap; - virtual ~Unit ( ); void AddToWorld(); diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index f0c6bed50..342508e49 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -2851,6 +2851,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d CastSpell(pVictim, 27526, true, castItem, triggeredByAura); return SPELL_AURA_PROC_OK; case 31255: // Deadly Swiftness (Rank 1) + { // whenever you deal damage to a target who is below 20% health. if (pVictim->GetHealth() > pVictim->GetMaxHealth() / 5) return SPELL_AURA_PROC_FAILED; @@ -2858,6 +2859,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d target = this; trigger_spell_id = 22588; break; + } //case 33207: break; // Gossip NPC Periodic - Fidget case 33896: // Desperate Defense (Stonescythe Whelp, Stonescythe Alpha, Stonescythe Ambusher) trigger_spell_id = 33898; @@ -3286,7 +3288,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d case 48821: originalSpellId = 48825; break; default: sLog.outError("Unit::HandleProcTriggerSpellAuraProc: Spell %u not handled in HShock",procSpell->Id); - return SPELL_AURA_PROC_FAILED; + return SPELL_AURA_PROC_FAILED; } } SpellEntry const *originalSpell = sSpellStore.LookupEntry(originalSpellId); @@ -3376,7 +3378,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d trigger_spell_id = 49279; break; default: sLog.outError("Unit::HandleProcTriggerSpellAuraProc: Spell %u not handled in LShield", auraSpellInfo->Id); - return SPELL_AURA_PROC_FAILED; + return SPELL_AURA_PROC_FAILED; } } // Lightning Shield (The Ten Storms set) @@ -3453,7 +3455,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d break; } default: - break; + break; } // All ok. Check current trigger spell @@ -3696,21 +3698,21 @@ SpellAuraProcResult Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint3 { case 836: // Improved Blizzard (Rank 1) { - if (!procSpell || procSpell->SpellVisual[0]!=9487) + if (!procSpell || procSpell->SpellVisual[0] != 9487) return SPELL_AURA_PROC_FAILED; triggered_spell_id = 12484; break; } case 988: // Improved Blizzard (Rank 2) { - if (!procSpell || procSpell->SpellVisual[0]!=9487) + if (!procSpell || procSpell->SpellVisual[0] != 9487) return SPELL_AURA_PROC_FAILED; triggered_spell_id = 12485; break; } case 989: // Improved Blizzard (Rank 3) { - if (!procSpell || procSpell->SpellVisual[0]!=9487) + if (!procSpell || procSpell->SpellVisual[0] != 9487) return SPELL_AURA_PROC_FAILED; triggered_spell_id = 12486; break; @@ -3870,8 +3872,8 @@ SpellAuraProcResult Unit::HandleModPowerCostSchoolAuraProc(Unit* /*pVictim*/, ui SpellAuraProcResult Unit::HandleMechanicImmuneResistanceAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // Compare mechanic - return !(procSpell==NULL || int32(procSpell->Mechanic) != triggeredByAura->GetModifier()->m_miscvalue) - ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; + return !(procSpell==NULL || int32(procSpell->Mechanic) != triggeredByAura->GetModifier()->m_miscvalue) + ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; } SpellAuraProcResult Unit::HandleModDamageFromCasterAuraProc(Unit* pVictim, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) diff --git a/src/game/World.cpp b/src/game/World.cpp index a72ec8d71..0ca3ed3c7 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -453,7 +453,7 @@ void World::LoadConfigSettings(bool reload) setConfigPos(CONFIG_FLOAT_RATE_POWER_RAGE_LOSS, "Rate.Rage.Loss", 1.0f); setConfig(CONFIG_FLOAT_RATE_POWER_RUNICPOWER_INCOME, "Rate.RunicPower.Income", 1.0f); setConfigPos(CONFIG_FLOAT_RATE_POWER_RUNICPOWER_LOSS,"Rate.RunicPower.Loss", 1.0f); - setConfig(CONFIG_FLOAT_RATE_POWER_FOCUS, "Rate.Focus", 1.0f); + setConfig(CONFIG_FLOAT_RATE_POWER_FOCUS, "Rate.Focus", 1.0f); setConfig(CONFIG_FLOAT_RATE_POWER_ENERGY, "Rate.Energy", 1.0f); setConfigPos(CONFIG_FLOAT_RATE_SKILL_DISCOVERY, "Rate.Skill.Discovery", 1.0f); setConfigPos(CONFIG_FLOAT_RATE_DROP_ITEM_POOR, "Rate.Drop.Item.Poor", 1.0f); diff --git a/src/game/World.h b/src/game/World.h index 6e0cc08ca..aa443b1a3 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -628,7 +628,6 @@ class World uint32 m_maxActiveSessionCount; uint32 m_maxQueuedSessionCount; - uint32 m_configUint32Values[CONFIG_UINT32_VALUE_COUNT]; int32 m_configInt32Values[CONFIG_INT32_VALUE_COUNT]; float m_configFloatValues[CONFIG_FLOAT_VALUE_COUNT]; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 8ade62ab6..e745648f9 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -283,7 +283,7 @@ bool WorldSession::Update(PacketFilter& updater) packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); if (sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) { - sLog.outDebug("Dumping error causing packet:"); + DEBUG_LOG("Dumping error causing packet:"); packet->hexlike(); } diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index c2dabc356..641ebc595 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -823,7 +823,6 @@ class MANGOS_DLL_SPEC WorldSession void HandleGuildBankDepositMoney(WorldPacket& recv_data); void HandleGuildBankWithdrawMoney(WorldPacket& recv_data); void HandleGuildBankSwapItems(WorldPacket& recv_data); - void HandleGuildBankUpdateTab(WorldPacket& recv_data); void HandleGuildBankBuyTab(WorldPacket& recv_data); void HandleQueryGuildBankTabText(WorldPacket& recv_data); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 5384bf826..62beec037 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -721,7 +721,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1); if (sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) { - sLog.outDebug("Dumping error-causing packet:"); + DEBUG_LOG("Dumping error-causing packet:"); new_pct->hexlike(); } @@ -983,7 +983,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) if (m_Session && m_Session->GetSecurity () == SEC_PLAYER) { sLog.outError ("WorldSocket::HandlePing: Player kicked for " - "over-speed pings address = %s", + "overspeeded pings address = %s", GetRemoteAddress ().c_str ()); return -1; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 56cc2b28b..0f714e7e6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11972" + #define REVISION_NR "11973" #endif // __REVISION_NR_H__