diff options
author | n0n4m3 <none@none> | 2010-04-11 11:08:26 +0400 |
---|---|---|
committer | n0n4m3 <none@none> | 2010-04-11 11:08:26 +0400 |
commit | 36e13c1d1c615d89c1e18add73411c0525ecbf08 (patch) | |
tree | 45bf3fa7314fd44272acb25a6da8015d53e47ab2 | |
parent | 93f7e2796c62f8838764ed9f0a33b40f8c30433a (diff) |
Not use PLAYER_FIELD_ARENA_TEAM_INFO_1_1 directly. Big thx to TOM_RUS.
--HG--
branch : trunk
-rw-r--r-- | src/game/ArenaTeam.cpp | 20 | ||||
-rw-r--r-- | src/game/ArenaTeamHandler.cpp | 4 | ||||
-rw-r--r-- | src/game/BattleGroundHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 32 | ||||
-rw-r--r-- | src/game/Player.h | 11 |
5 files changed, 37 insertions, 32 deletions
diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index ab6d6df4a0f..7d9130f26ee 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -29,7 +29,7 @@ void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot) 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); } ArenaTeam::ArenaTeam() @@ -166,11 +166,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); sLog.outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", pl->GetName(), pl->GetGUIDLow(), GetType(), GetId()); } return true; @@ -268,7 +268,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) // disable remove/promote buttons Player *oldcaptain = objmgr.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; @@ -280,7 +280,7 @@ void ArenaTeam::SetCaptain(const uint64& guid) Player *newcaptain = objmgr.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); sLog.outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUIDLow(), newcaptain->GetName(), newcaptain->GetGUIDLow(), GetId(), GetType()); } } @@ -301,7 +301,7 @@ void ArenaTeam::DelMember(uint64 guid) player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); // delete all info regarding this team for (uint32 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); sLog.outArena("Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), GUID_LOPART(guid)); @@ -647,8 +647,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; } } @@ -697,8 +697,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/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index ac35acc0fac..3a9a14524f9 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -332,10 +332,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 96af183b258..dc7fd519182 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 5c938400080..a8d719b25da 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -15414,13 +15414,13 @@ void Player::_LoadArenaTeamInfo(QueryResult_AutoPtr 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()); } @@ -15673,7 +15673,7 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder) // arena team not exist or not member, cleanup fields for (int j = 0; j < 6; ++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[40].GetUInt32()); @@ -17914,8 +17914,8 @@ void Player::SendAutoRepeatCancel(Unit *target) void Player::SendExplorationExperience(uint32 Area, uint32 Experience) { WorldPacket data(SMSG_EXPLORATION_EXPERIENCE, 8); - data << Area; - data << Experience; + data << uint32(Area); + data << uint32(Experience); GetSession()->SendPacket(&data); } @@ -17998,7 +17998,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); } @@ -18006,8 +18006,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); } @@ -18669,7 +18669,7 @@ void Player::SetSpellModTakingSpell(Spell * spell, bool apply) void Player::SendProficiency(uint8 pr1, uint32 pr2) { WorldPacket data(SMSG_SET_PROFICIENCY, 8); - data << pr1 << pr2; + data << uint8(pr1) << uint32(pr2); GetSession()->SendPacket (&data); } @@ -19090,7 +19090,7 @@ void Player::ProhibitSpellScholl(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) @@ -19441,7 +19441,7 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) { if (ArenaTeam * at = objmgr.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 3a5f88548e9..4e92c6e0774 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1712,10 +1712,15 @@ class Player : public Unit, public GridObject<Player> // 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; } |