KPsN / TrinityCore (http://trinitycore.org/)

Trinity Core has moved to http://trinitycore.googlecode.com please check us out there. Thank you to Bitcuket.org and Jesper Noehr for all his help along the way.

Clone this repository (size: 158.1 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/KPsN/trinitycore
commit 7875: fa9dc31561f2
parent 7874: 119f83a3c1c1
branch: trunk
Not use PLAYER_FIELD_ARENA_TEAM_INFO_1_1 directly. Big thx to TOM_RUS.
n0n4m3
5 months ago

Changed (Δ1.4 KB):

raw changeset »

src/game/ArenaTeam.cpp (10 lines added, 10 lines removed)

src/game/ArenaTeamHandler.cpp (2 lines added, 2 lines removed)

src/game/BattleGroundHandler.cpp (1 lines added, 1 lines removed)

src/game/Player.cpp (16 lines added, 16 lines removed)

src/game/Player.h (8 lines added, 3 lines removed)

Up to file-list src/game/ArenaTeam.cpp:

@@ -29,7 +29,7 @@ void ArenaTeamMember::ModifyPersonalRati
29
29
        else
30
30
            personal_rating += mod;
31
31
        if (plr)
32
            plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, personal_rating);
32
            plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
33
33
}
34
34
35
35
ArenaTeam::ArenaTeam()
@@ -166,11 +166,11 @@ bool ArenaTeam::AddMember(const uint64&
166
166
    {
167
167
        pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType());
168
168
        pl->SetArenaTeamIdInvited(0);
169
        pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating);
169
        pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating);
170
170
171
171
        // hide promote/remove buttons
172
172
        if (m_CaptainGuid != PlayerGuid)
173
            pl->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1);
173
            pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
174
174
        sLog.outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", pl->GetName(), pl->GetGUIDLow(), GetType(), GetId());
175
175
    }
176
176
    return true;
@@ -268,7 +268,7 @@ void ArenaTeam::SetCaptain(const uint64&
268
268
    // disable remove/promote buttons
269
269
    Player *oldcaptain = objmgr.GetPlayer(GetCaptain());
270
270
    if (oldcaptain)
271
        oldcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 1);
271
        oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
272
272
273
273
    // set new captain
274
274
    m_CaptainGuid = guid;
@@ -280,7 +280,7 @@ void ArenaTeam::SetCaptain(const uint64&
280
280
    Player *newcaptain = objmgr.GetPlayer(guid);
281
281
    if (newcaptain)
282
282
    {
283
        newcaptain->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_MEMBER, 0);
283
        newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
284
284
        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());
285
285
    }
286
286
}
@@ -301,7 +301,7 @@ void ArenaTeam::DelMember(uint64 guid)
301
301
        player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
302
302
        // delete all info regarding this team
303
303
        for (uint32 i = 0; i < ARENA_TEAM_END; ++i)
304
            player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + i, 0);
304
            player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
305
305
        sLog.outArena("Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
306
306
    }
307
307
    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,
647
647
            itr->games_week +=1;
648
648
            itr->games_season +=1;
649
649
            // update the unit fields
650
            plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK, itr->games_week);
651
            plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON, itr->games_season);
650
            plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK,  itr->games_week);
651
            plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON,  itr->games_season);
652
652
            return;
653
653
        }
654
654
    }
@@ -697,8 +697,8 @@ void ArenaTeam::MemberWon(Player * plr,
697
697
            itr->wins_season += 1;
698
698
            itr->wins_week += 1;
699
699
            // update unit fields
700
            plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK, itr->games_week);
701
            plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (GetSlot() * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON, itr->games_season);
700
            plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week);	
701
            plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season);
702
702
            return;
703
703
        }
704
704
    }

Up to file-list src/game/ArenaTeamHandler.cpp:

@@ -332,10 +332,10 @@ void WorldSession::HandleArenaTeamLeader
332
332
void WorldSession::SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id)
333
333
{
334
334
    WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+team.length()+1+player.length()+1+4);
335
    data << team_action;
335
    data << uint32(team_action);
336
336
    data << team;
337
337
    data << player;
338
    data << error_id;
338
    data << uint32(error_id);
339
339
    SendPacket(&data);
340
340
}
341
341

Up to file-list src/game/BattleGroundHandler.cpp:

@@ -682,7 +682,7 @@ void WorldSession::HandleBattlemasterJoi
682
682
            Player *member = itr->getSource();
683
683
684
684
            // calc avg personal rating
685
            avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING);
685
            avg_pers_rating += member->GetArenaPersonalRating(arenaslot);
686
686
        }
687
687
688
688
        if (arenatype)

Up to file-list src/game/Player.cpp:

@@ -15414,13 +15414,13 @@ void Player::_LoadArenaTeamInfo(QueryRes
15414
15414
        }
15415
15415
        uint8  arenaSlot = aTeam->GetSlot();
15416
15416
15417
        m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_ID]                 = arenateamid;      // TeamID
15418
        m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_TYPE]               = aTeam->GetType(); // team type
15419
        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
15420
        m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_WEEK]         = played_week;      // Played Week
15421
        m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_GAMES_SEASON]       = played_season;    // Played Season
15422
        m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_WINS_SEASON]        = wons_season;      // wins season
15423
        m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING]    = personal_rating;  // Personal Rating
15417
        SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_ID, arenateamid);
15418
        SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_TYPE, aTeam->GetType());
15419
        SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_MEMBER, (aTeam->GetCaptain() == GetGUID()) ? 0 : 1);
15420
        SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_GAMES_WEEK, played_week);	
15421
        SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_GAMES_SEASON, played_season);
15422
        SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_WINS_SEASON, wons_season);	
15423
        SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
15424
15424
15425
15425
    }while (result->NextRow());
15426
15426
}
@@ -15673,7 +15673,7 @@ bool Player::LoadFromDB(uint32 guid, Sql
15673
15673
15674
15674
        // arena team not exist or not member, cleanup fields
15675
15675
        for (int j = 0; j < 6; ++j)
15676
            SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arena_slot * ARENA_TEAM_END) + j, 0);
15676
            SetArenaTeamInfoField(arena_slot, ArenaTeamInfoType(j), 0);
15677
15677
    }
15678
15678
15679
15679
    SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, fields[40].GetUInt32());
@@ -17914,8 +17914,8 @@ void Player::SendAutoRepeatCancel(Unit *
17914
17914
void Player::SendExplorationExperience(uint32 Area, uint32 Experience)
17915
17915
{
17916
17916
    WorldPacket data(SMSG_EXPLORATION_EXPERIENCE, 8);
17917
    data << Area;
17918
    data << Experience;
17917
    data << uint32(Area);
17918
    data << uint32(Experience);
17919
17919
    GetSession()->SendPacket(&data);
17920
17920
}
17921
17921
@@ -17998,7 +17998,7 @@ void Player::ResetInstances(uint8 method
17998
17998
void Player::SendResetInstanceSuccess(uint32 MapId)
17999
17999
{
18000
18000
    WorldPacket data(SMSG_INSTANCE_RESET, 4);
18001
    data << MapId;
18001
    data << uint32(MapId);
18002
18002
    GetSession()->SendPacket(&data);
18003
18003
}
18004
18004
@@ -18006,8 +18006,8 @@ void Player::SendResetInstanceFailed(uin
18006
18006
{
18007
18007
    // TODO: find what other fail reasons there are besides players in the instance
18008
18008
    WorldPacket data(SMSG_INSTANCE_RESET_FAILED, 4);
18009
    data << reason;
18010
    data << MapId;
18009
    data << uint32(reason);
18010
    data << uint32(MapId);
18011
18011
    GetSession()->SendPacket(&data);
18012
18012
}
18013
18013
@@ -18669,7 +18669,7 @@ void Player::SetSpellModTakingSpell(Spel
18669
18669
void Player::SendProficiency(uint8 pr1, uint32 pr2)
18670
18670
{
18671
18671
    WorldPacket data(SMSG_SET_PROFICIENCY, 8);
18672
    data << pr1 << pr2;
18672
    data << uint8(pr1) << uint32(pr2);
18673
18673
    GetSession()->SendPacket (&data);
18674
18674
}
18675
18675
@@ -19090,7 +19090,7 @@ void Player::ProhibitSpellScholl(SpellSc
19090
19090
{
19091
19091
                                                            // last check 2.0.10
19092
19092
    WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8);
19093
    data << GetGUID();
19093
    data << uint64(GetGUID());
19094
19094
    data << uint8(0x0);                                     // flags (0x1, 0x2)
19095
19095
    time_t curTime = time(NULL);
19096
19096
    for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
@@ -19441,7 +19441,7 @@ uint32 Player::GetMaxPersonalArenaRating
19441
19441
    {
19442
19442
        if (ArenaTeam * at = objmgr.GetArenaTeamById(GetArenaTeamId(i)))
19443
19443
        {
19444
            uint32 p_rating = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (i * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING);
19444
            uint32 p_rating = GetArenaPersonalRating(i);
19445
19445
            uint32 t_rating = at->GetRating();
19446
19446
            p_rating = p_rating < t_rating ? p_rating : t_rating;
19447
19447
            if (max_personal_rating < p_rating)

Up to file-list src/game/Player.h:

@@ -1712,10 +1712,15 @@ class Player : public Unit, public GridO
1712
1712
        // Arena Team
1713
1713
        void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type)
1714
1714
        {
1715
            SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID, ArenaTeamId);
1716
            SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_TYPE, type);
1715
            SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId);
1716
            SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type);
1717
1717
        }
1718
        uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END)); }
1718
        void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)	
1719
        {
1720
            SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value);
1721
        }
1722
        uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); }
1723
        uint32 GetArenaPersonalRating(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); }
1719
1724
        static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
1720
1725
        void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
1721
1726
        uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }