本文整理汇总了C++中memberlist::iterator::ModifyPersonalRating方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::ModifyPersonalRating方法的具体用法?C++ iterator::ModifyPersonalRating怎么用?C++ iterator::ModifyPersonalRating使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memberlist::iterator
的用法示例。
在下文中一共展示了iterator::ModifyPersonalRating方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MemberWon
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, GetType());
// 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;
}
}
}
示例2: MemberWon
void ArenaTeam::MemberWon(Player * plr, uint32 againstMatchmakerRating, int32 teamratingchange)
{
// called for each participant after winning a match
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if (itr->guid == plr->GetGUID())
{
// update personal rating
int32 mod = GetPersonalRatingMod(teamratingchange, (m_stats.rating - teamratingchange), itr->personal_rating);
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update matchmaker rating
mod = GetRatingMod(itr->matchmaker_rating, againstMatchmakerRating, true, true);
itr->ModifyMatchmakerRating(mod, GetSlot());
// update personal stats
itr->games_week +=1;
itr->games_season +=1;
itr->wins_season += 1;
itr->wins_week += 1;
// update unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season);
return;
}
}
}
示例3: MemberWon
void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
{
// called for each participant after winning a match
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)floor(K* (1.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal stats
itr->games_week += 1;
itr->games_season += 1;
itr->wins_season += 1;
itr->wins_week += 1;
// update unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season);
return;
}
}
}
示例4: MemberLost
void ArenaTeam::MemberLost(Player* plr, uint32 againstMatchmakerRating, int32 teamratingchange)
{
// Called for each participant of a match after losing
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
{
if (itr->Guid == plr->GetGUID())
{
// Update personal rating
int32 mod = GetPersonalRatingMod(teamratingchange, itr->PersonalRating, (Stats.Rating - teamratingchange));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// Update matchmaker rating
mod = GetRatingMod(itr->MatchMakerRating, againstMatchmakerRating, false, true);
itr->ModifyMatchmakerRating(mod, GetSlot());
// Update personal played stats
itr->WeekGames +=1;
itr->SeasonGames +=1;
// update the unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames);
return;
}
}
}
示例5: LostAgainst
int32 ArenaTeam::LostAgainst(uint32 againstRating, uint32 SoloQueueRating)
{
// called when the team has lost
// 'chance' calculation - to loose to the opponent
float chance = GetChanceAgainst(SoloQueueRating > 0 ? SoloQueueRating : m_stats.rating, againstRating);
// calculate the rating modification (ELO system with k=32)
int32 mod = (int32)ceil((SoloQueueRating > 0 ? 16.0f : 32.0f) * (0.0f - chance));
// Smolderforge rating adjustments
if (GetType() == ARENA_TEAM_5v5) // solo queue
{
if (mod <= -15)
mod = -14;
// called for each participant of a match after losing
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Player *plr = sObjectMgr->GetPlayer(itr->guid);
if (plr)
itr->ModifyPersonalRating(plr, mod, GetSlot());
}
}
else if (GetType() == ARENA_TEAM_2v2)
{
if (mod <= -25)
mod = -24;
}
// modify the team stats accordingly
if (int32(m_stats.rating) + mod < 0)
m_stats.rating = 0;
else
m_stats.rating += mod;
// SOLOQUEUE - Don't track stats for lost games
if (GetType() < ARENA_TEAM_5v5)
{
m_stats.games_week += 1;
m_stats.games_season += 1;
}
// update team's rank
m_stats.rank = 1;
ObjectMgr::ArenaTeamMap::const_iterator i = sObjectMgr->GetArenaTeamMapBegin();
for (; i != sObjectMgr->GetArenaTeamMapEnd(); ++i)
{
if (i->second->GetType() == m_Type && i->second->GetStats().rating > m_stats.rating)
++m_stats.rank;
}
// return the rating change, used to display it on the results screen
return mod;
}
示例6: WonAgainst
int32 ArenaTeam::WonAgainst(uint32 againstRating, uint32 SoloQueueRating)
{
// called when the team has won
// 'chance' calculation - to beat the opponent
float chance = GetChanceAgainst(SoloQueueRating > 0 ? SoloQueueRating : m_stats.rating, againstRating);
// calculate the rating modification (ELO system with k=32)
int32 mod = (int32)floor((SoloQueueRating > 0 ? 16.0f : 32.0f) * (1.0f - chance));
// Smolderforge rating adjustments
if (GetType() == ARENA_TEAM_5v5) // solo queue
{
if (mod < 1)
mod = 1;
// called for each participant of a match after losing
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
Player *plr = sObjectMgr->GetPlayer(itr->guid);
if (plr)
{
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal stats
itr->games_week +=1;
itr->games_season +=1;
itr->wins_season += 1;
itr->wins_week += 1;
// update unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season);
}
}
}
else if (GetType() == ARENA_TEAM_2v2)
{
if (m_stats.rating < 1850)
mod += 2;
if (mod == 30)
mod++;
if (mod < 3)
mod = 3;
}
// modify the team stats accordingly
FinishGame(mod);
m_stats.wins_week += 1;
m_stats.wins_season += 1;
// return the rating change, used to display it on the results screen
return mod;
}
示例7: MemberWon
void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
{
// called for each participant after winning a match
for(MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if (itr->guid == plr->GetObjectGuid())
{
// FG: attempt to prevent "win trading" - dont give reward to winner if player with same IP is in opposite team
Map::PlayerList const& plist = plr->GetMap()->GetPlayers();
for(Map::PlayerList::const_iterator pit = plist.begin(); pit != plist.end(); ++pit)
{
Player *pp = pit->getSource();
if( !(pp && pp->IsSessionValid() && plr->IsSessionValid()) )
return; // something wrong
if(pp->GetSession()->GetIP() == plr->GetSession()->GetIP() && pp->IsHostileTo(plr))
{
ChatHandler(plr).PSendSysMessage(11110, pp->GetName());
return;
}
}
// FG: -end-
// 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)floor(K* (1.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal stats
itr->games_week += 1;
itr->games_season += 1;
itr->wins_season += 1;
itr->wins_week += 1;
// update unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season);
return;
}
}
}
示例8: OfflineMemberLost
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;
}
}
}
示例9: MemberLost
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->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
int32 mod = (int32)ceil(32.0f * (0.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal played stats
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);
return;
}
}
}
示例10: OfflineMemberLost
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;
}
}
}
示例11: MemberWon
void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
{
// We handle personal rating for Solo Queue in Arena Team win or lost function
if (GetType() == ARENA_TEAM_5v5)
return;
// called for each participant after winning a match
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if (itr->guid == plr->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
int32 mod = (int32)floor(32.0f * (1.0f - chance));
if (GetType() == ARENA_TEAM_2v2)
{
if (m_stats.rating < 1850)
mod += 2;
if (mod == 30)
mod++;
if (mod < 3)
mod = 3;
}
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal stats
itr->games_week +=1;
itr->games_season +=1;
itr->wins_season += 1;
itr->wins_week += 1;
// update unit fields
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week);
plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season);
return;
}
}
}
示例12: MemberLost
void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
{
// We handle personal rating for Solo Queue in Arena Team win or lost function
if (GetType() == ARENA_TEAM_5v5)
return;
// 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->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
int32 mod = (int32)ceil(32.0f) * (0.0f - chance);
// Smolderforge rating adjustments
if (GetType() == ARENA_TEAM_2v2)
{
if (mod <= -25)
mod = -24;
}
itr->ModifyPersonalRating(plr, mod, GetSlot());
// SOLOQUEUE - Don't track stats for lost games
if (GetType() < ARENA_TEAM_5v5)
{
// 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;
}
}
}
示例13: MemberWon
void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
{
// called for each participant after winning a match
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
{
if(itr->guid == plr->GetGUID())
{
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
int32 mod = (int32)floor(32.0f * (1.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update personal stats
itr->games_week +=1;
itr->games_season +=1;
itr->wins_season += 1;
itr->wins_week += 1;
// update unit fields
plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 2, itr->games_week);
plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 6 * GetSlot() + 3, itr->games_season);
return;
}
}
}
示例14: MemberLost
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;
}
}
}
示例15: MemberDraw
int32 ArenaTeam::MemberDraw(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->GetGUID())
{
// update personal rating
// chance is always 0.5
float chance = 0.5f;
float K = (itr->personal_rating < 1500) ? 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());
return mod;
}
}return 0;
}