mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9358] Not use PLAYER_FIELD_ARENA_TEAM_INFO_1_1 directly.
This commit is contained in:
parent
c3bc0aedbe
commit
2151704669
7 changed files with 51 additions and 44 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
@ -16821,8 +16821,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);
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
@ -17328,8 +17328,12 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
|
|||
{
|
||||
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,7 +17390,7 @@ 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);
|
||||
}
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9357"
|
||||
#define REVISION_NR "9358"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue