diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index 564510e99..7f1827865 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -153,11 +153,11 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid) { pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType()); pl->SetArenaTeamIdInvited(0); - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating ); + pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating); // hide promote/remove buttons if(m_CaptainGuid != PlayerGuid) - pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1); + pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } return true; } @@ -253,7 +253,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) // disable remove/promote buttons Player *oldcaptain = sObjectMgr.GetPlayer(GetCaptain()); if(oldcaptain) - oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1); + oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); // set new captain m_CaptainGuid = guid; @@ -264,7 +264,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) // enable remove/promote buttons Player *newcaptain = sObjectMgr.GetPlayer(guid); if(newcaptain) - newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 0); + newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); } void ArenaTeam::DelMember(uint64 guid) @@ -283,7 +283,7 @@ void ArenaTeam::DelMember(uint64 guid) player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); // delete all info regarding this team for(int i = 0; i < ARENA_TEAM_END; ++i) - player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + i, 0); + player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); } CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), GUID_LOPART(guid)); @@ -617,8 +617,8 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating) itr->games_week += 1; itr->games_season += 1; // update the unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK, itr->games_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON, itr->games_season); + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week); + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season); return; } } @@ -667,8 +667,8 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstRating) itr->wins_season += 1; itr->wins_week += 1; // update unit fields - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK, itr->games_week); - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON, itr->games_season); + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week); + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season); return; } } diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index 03c3c1e1b..cbca14ba1 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -103,7 +103,7 @@ struct ArenaTeamMember else personal_rating += mod; if(plr) - plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, personal_rating); + plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating); } }; diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index f73b666b4..aa0cfc558 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -329,10 +329,10 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data) void WorldSession::SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id) { WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+team.length()+1+player.length()+1+4); - data << team_action; + data << uint32(team_action); data << team; data << player; - data << error_id; + data << uint32(error_id); SendPacket(&data); } diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index da6c943fc..7c6bdf831 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -682,7 +682,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) Player *member = itr->getSource(); // calc avg personal rating - avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); + avg_pers_rating += member->GetArenaPersonalRating(arenaslot); } if (arenatype) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 68f8b8eb5..8c0be777a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14453,13 +14453,13 @@ void Player::_LoadArenaTeamInfo(QueryResult *result) } uint8 arenaSlot = aTeam->GetSlot(); - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_ID] = arenateamid; // TeamID - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_TYPE] = aTeam->GetType(); // team type - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_MEMBER] = ((aTeam->GetCaptain() == GetGUID()) ? (uint32)0 : (uint32)1); // Captain 0, member 1 - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK] = played_week; // Played Week - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON] = played_season; // Played Season - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_WINS_SEASON] = wons_season; // wins season - m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING] = personal_rating; // Personal Rating + SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_ID, arenateamid); + SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_TYPE, aTeam->GetType()); + SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_MEMBER, (aTeam->GetCaptain() == GetGUID()) ? 0 : 1); + SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_GAMES_WEEK, played_week); + SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_GAMES_SEASON, played_season); + SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_WINS_SEASON, wons_season); + SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_PERSONAL_RATING, personal_rating); } while (result->NextRow()); delete result; @@ -14733,7 +14733,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // arena team not exist or not member, cleanup fields for(int j = 0; j < ARENA_TEAM_END; ++j) - SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arena_slot * ARENA_TEAM_END) + j, 0); + SetArenaTeamInfoField(arena_slot, ArenaTeamInfoType(j), 0); } SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, fields[41].GetUInt32()); @@ -16724,13 +16724,13 @@ void Player::SaveDataFieldToDB() bool Player::SaveValuesArrayInDB(Tokens const& tokens, uint64 guid) { std::ostringstream ss2; - ss2<<"UPDATE characters SET data='"; - int i=0; + ss2 << "UPDATE characters SET data='"; + int i = 0; for (Tokens::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter, ++i) { - ss2<SendPacket(&data); } @@ -16830,7 +16830,7 @@ void Player::SendDungeonDifficulty(bool IsInGroup) { uint8 val = 0x00000001; WorldPacket data(MSG_SET_DUNGEON_DIFFICULTY, 12); - data << (uint32)GetDungeonDifficulty(); + data << uint32(GetDungeonDifficulty()); data << uint32(val); data << uint32(IsInGroup); GetSession()->SendPacket(&data); @@ -16901,7 +16901,7 @@ void Player::ResetInstances(uint8 method, bool isRaid) void Player::SendResetInstanceSuccess(uint32 MapId) { WorldPacket data(SMSG_INSTANCE_RESET, 4); - data << MapId; + data << uint32(MapId); GetSession()->SendPacket(&data); } @@ -16909,8 +16909,8 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId) { // TODO: find what other fail reasons there are besides players in the instance WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4); - data << reason; - data << MapId; + data << uint32(reason); + data << uint32(MapId); GetSession()->SendPacket(&data); } @@ -17324,12 +17324,16 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) { uint16 Opcode= (mod->type == SPELLMOD_FLAT) ? SMSG_SET_FLAT_SPELL_MODIFIER : SMSG_SET_PCT_SPELL_MODIFIER; - for(int eff=0;eff<96;++eff) + for(int eff = 0; eff < 96; ++eff) { uint64 _mask = 0; uint32 _mask2= 0; - if (eff<64) _mask = uint64(1) << (eff- 0); - else _mask2= uint32(1) << (eff-64); + + if (eff < 64) + _mask = uint64(1) << (eff - 0); + else + _mask2= uint32(1) << (eff - 64); + if ( mod->mask & _mask || mod->mask2 & _mask2) { int32 val = 0; @@ -17386,14 +17390,14 @@ void Player::RemoveSpellMods(Spell const* spell) void Player::SendProficiency(uint8 pr1, uint32 pr2) { WorldPacket data(SMSG_SET_PROFICIENCY, 8); - data << pr1 << pr2; + data << uint8(pr1) << uint32(pr2); GetSession()->SendPacket (&data); } void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) { QueryResult *result = NULL; - if(type==10) + if(type == 10) result = CharacterDatabase.PQuery("SELECT ownerguid,petitionguid FROM petition_sign WHERE playerguid = '%u'", GUID_LOPART(guid)); else result = CharacterDatabase.PQuery("SELECT ownerguid,petitionguid FROM petition_sign WHERE playerguid = '%u' AND type = '%u'", GUID_LOPART(guid), type); @@ -17801,7 +17805,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) { // last check 2.0.10 WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8); - data << GetGUID(); + data << uint64(GetGUID()); data << uint8(0x0); // flags (0x1, 0x2) time_t curTime = time(NULL); for(PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) @@ -18114,7 +18118,7 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) { if(ArenaTeam * at = sObjectMgr.GetArenaTeamById(GetArenaTeamId(i))) { - uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); + uint32 p_rating = GetArenaPersonalRating(i); uint32 t_rating = at->GetRating(); p_rating = p_rating < t_rating ? p_rating : t_rating; if(max_personal_rating < p_rating) diff --git a/src/game/Player.h b/src/game/Player.h index 28ec7ab48..eba64d79f 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -777,8 +777,6 @@ enum ArenaTeamInfoType ARENA_TEAM_END = 7 }; - - enum RestType { REST_TYPE_NO = 0, @@ -1664,10 +1662,15 @@ class MANGOS_DLL_SPEC Player : public Unit // Arena Team void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type) { - SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID, ArenaTeamId); - SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_TYPE, type); + SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId); + SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type); } - uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END)); } + void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value) + { + SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value); + } + uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); } + uint32 GetArenaPersonalRating(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); } static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; } uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index affbb379f..7f38585b2 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 "9357" + #define REVISION_NR "9358" #endif // __REVISION_NR_H__