Skip to content

Commit

Permalink
[11349] Instead group online players use arena team full list for cla…
Browse files Browse the repository at this point in the history
…culate avg. personal rating.
  • Loading branch information
VladimirMangos committed Apr 14, 2011
1 parent 6fbe8b8 commit aae93a6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
9 changes: 9 additions & 0 deletions src/game/ArenaTeam.cpp
Expand Up @@ -540,6 +540,15 @@ bool ArenaTeam::HaveMember(ObjectGuid guid) const
return false;
}

uint32 ArenaTeam::GetAvgPersonalRating() const
{
uint32 rating = 0;
for(MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
rating += itr->personal_rating;

return rating / m_Type;
}

uint32 ArenaTeam::GetPoints(uint32 MemberRating)
{
// returns how many points would be awarded with this team type with this rating
Expand Down
1 change: 1 addition & 0 deletions src/game/ArenaTeam.h
Expand Up @@ -197,6 +197,7 @@ class ArenaTeam
void Stats(WorldSession *session);
void InspectStats(WorldSession *session, ObjectGuid guid);

uint32 GetAvgPersonalRating() const;
uint32 GetPoints(uint32 MemberRating);
float GetChanceAgainst(uint32 own_rating, uint32 enemy_rating);
int32 WonAgainst(uint32 againstRating);
Expand Down
12 changes: 1 addition & 11 deletions src/game/BattleGroundHandler.cpp
Expand Up @@ -699,17 +699,7 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
arenaRating = at->GetRating();
// the arena team id must match for everyone in the group
// get the personal ratings for queue
uint32 avg_pers_rating = 0;
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *member = itr->getSource();

// calc avg personal rating
avg_pers_rating += member->GetArenaPersonalRating(arenaslot);
}

if (arenatype)
avg_pers_rating /= arenatype;
uint32 avg_pers_rating = at->GetAvgPersonalRating();

// if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating
if (avg_pers_rating + 150 < arenaRating)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11348"
#define REVISION_NR "11349"
#endif // __REVISION_NR_H__

2 comments on commit aae93a6

@Heuristicks
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if this is a stupid question, but is you average rating calculation supposed to get the average personal rating out of all the team members? Because you divided by m_Type, when lets say a 2v2 team could really have 4 members on it. Then it would around double the actual average. Again, I might be misunderstanding your intention, sorry if I'm just being foolish

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that commit wrong. You provide correct points. I plan revert and rewrite it just yesterday not find time for this. Anyway, thank you for confirmation all problematic points ^^

Please sign in to comment.