Example #1
0
void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
    // Called for offline player after ending rated arena match!
    for (MemberList::iterator itr = Members.begin(); itr !=  Members.end(); ++itr)
    {
        if (itr->Guid == guid)
        {
            // update personal rating
            int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, false);
            itr->ModifyPersonalRating(NULL, mod, GetType());

            // update matchmaker rating
            itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());

            // update personal played stats
            itr->WeekGames += 1;
            itr->SeasonGames += 1;
            return;
        }
    }
}
Example #2
0
void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 teamratingchange)
{
    // called for offline player after ending rated arena match!
    for (MemberList::iterator itr = m_members.begin(); itr !=  m_members.end(); ++itr)
    {
        if (itr->guid == guid)
        {
            // update personal rating
            int32 mod = GetPersonalRatingMod(teamratingchange, itr->personal_rating, (m_stats.rating - teamratingchange));
            itr->ModifyPersonalRating(NULL, mod, GetSlot());

            // update matchmaker rating
            mod = GetRatingMod(itr->matchmaker_rating, againstMatchmakerRating, false, true);
            itr->ModifyMatchmakerRating(mod, GetSlot());

            // update personal played stats
            itr->games_week +=1;
            itr->games_season +=1;
            return;
        }
    }
}
Example #3
0
void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
{
    // called for each participant of a match after losing
    for(MemberList::iterator itr = m_members.begin(); itr !=  m_members.end(); ++itr)
    {
        if (itr->guid == plr->GetObjectGuid())
        {
            // update personal rating
            float chance = GetChanceAgainst(itr->personal_rating, againstRating);
            float K = (itr->personal_rating < 1000) ? 48.0f : 32.0f;
            // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
            int32 mod = (int32)ceil(K * (0.0f - chance));
            
            if(againstRating <= sWorld.getConfig(CONFIG_UINT32_LOSERNOCHANGE) || itr->personal_rating <= sWorld.getConfig(CONFIG_UINT32_LOSERNOCHANGE))
                mod = 0;
            else if (itr->personal_rating <= sWorld.getConfig(CONFIG_UINT32_LOSERHALFCHANGE))
                mod /= 2;

            itr->ModifyPersonalRating(plr, mod, GetSlot());

            // update matchmaker rating 
            chance = GetChanceAgainst(itr->matchmaker_rating, againstRating);
            K = (itr->matchmaker_rating < 1000) ? 48.0f : 32.0f;
            // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
            mod = (int32)ceil(K * (0.0f - chance));
            itr->ModifyMatchmakerRating(plr,mod,GetType());

            // update personal played stats
            itr->games_week += 1;
            itr->games_season += 1;
            // update the unit fields
            plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK,  itr->games_week);
            plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON,  itr->games_season);
            return;
        }
    }
}
Example #4
0
void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
{
    // called for each participant after winning a match
    for (MemberList::iterator itr = Members.begin(); itr !=  Members.end(); ++itr)
    {
        if (itr->Guid == player->GetGUID())
        {
            // update personal rating
            int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, true);
            itr->ModifyPersonalRating(player, mod, GetSlot());

            // update matchmaker rating
            itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot());

            // update personal stats
            itr->WeekGames +=1;
            itr->SeasonGames +=1;
            itr->SeasonWins += 1;
            itr->WeekWins += 1;
            // update unit fields
            player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
            player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
            return;

            //////////////////////////////////////////////////////
            //                                                  //
            //               CATACLYSM ARENA SYSTEM             //
            //  Winners receive fixed amount of Conquest Points //
            //                                                  //
            //                Losers, only Shame                //
            //                                                  //
            //////////////////////////////////////////////////////

            bool CapReached;

            switch (player->GetCurrency(390))     // Checks if Soft Cap has been reached, if yes, do not earn anymore points.
            {
                case 1343:
                case 1940:
                case 2533:
                case 2849:
                case 2964:
                case 3000:
                    CapReached = true;
                default:
                    CapReached = false;
            }

            if (CapReached == false)       // if not go ahead.
            {
                player->ModifyCurrency(390, 268.6f);

                // Conquest Point Soft Cap System - based on Personal Rating
                uint32 OldPoints = player->GetCurrency(390);
                uint32 OldRating = player->GetArenaPersonalRating(GetSlot());
                uint32 NewPoints = OldPoints;
                uint32 NewRating = OldRating;

                // First Check, points - Total Conquest Points cannot exceed the Soft Cap, So:
                if (OldRating <=1500 && OldPoints >= 1343)         // If this happens..
                {
                    NewPoints = 1343;                              // ..set points = Soft Cap, and set CapReached=1,
                                                                   // so player cannot earn anymore points until next week

                    // Second Check, rating - Rating has to remain the same
                    // for all the week, when a new week starts, rating can raise
                    // THIS IS TO AVOID RATING RAISING IN THE SAME WEEK.
                    // TODO: RATING RAISE WITHOUT EARNING POINTS.
                    if (Stats.WeekGames != 0 && OldRating > 1500)
                        NewRating = 1500;
                }

                // The same happens for all other brackets
                if ((OldRating > 1500 && OldRating < 1800) && OldPoints > 1940)
                {
                    NewPoints=1940;

                    if (Stats.WeekGames != 0 && OldRating > 1800)
                        NewRating = 1800;
                }

                if ((OldRating > 1800 && OldRating < 2100) && OldPoints > 2533)
                {
                    NewPoints = 2533;

                    if (Stats.WeekGames != 0 && OldRating > 2100)
                        NewRating = 2100;
                }
                if ((OldRating > 2100 && OldRating < 2400) && OldPoints > 2849)
                {
                    NewPoints = 2849;

                    if (Stats.WeekGames != 0 && OldRating > 2400)
                        NewRating = 2400;
                }
                if ((OldRating > 2400 && OldRating < 2700) && OldPoints > 2964)
                {
                    NewPoints = 2964;

                    if (Stats.WeekGames != 0 && OldRating > 3000)
                        NewRating = 3000;
                }
                if (OldRating >= 3000)
                    NewPoints = 3000;

                player->SetCurrency(390, NewPoints);
                itr->ModifyPersonalRating(player, NewRating, GetSlot());
            }
        }
    }
}