Not use PLAYER_FIELD_ARENA_TEAM_INFO_1_1 directly. Big thx to TOM_RUS.
--HG-- branch : trunk
This commit is contained in:
+10
-10
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
+16
-16
@@ -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)
|
||||
|
||||
+8
-3
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user