本文整理汇总了C++中ArenaTeam::GetMember方法的典型用法代码示例。如果您正苦于以下问题:C++ ArenaTeam::GetMember方法的具体用法?C++ ArenaTeam::GetMember怎么用?C++ ArenaTeam::GetMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArenaTeam
的用法示例。
在下文中一共展示了ArenaTeam::GetMember方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleArenaTeamRemoveOpcode
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_REMOVE");
#endif
uint32 arenaTeamId;
std::string name;
recvData >> arenaTeamId;
recvData >> name;
// Check for valid arena team
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Only captain can remove members
if (arenaTeam->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
// Check if team member exists
ArenaTeamMember* member = arenaTeam->GetMember(name);
if (!member)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
// Captain cannot be removed
if (arenaTeam->GetCaptain() == member->Guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
// Player cannot be removed during fights
if (arenaTeam->IsFighting())
return;
arenaTeam->DelMember(member->Guid, true);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
}
示例2: HandleArenaTeamRemoveFromTeamOpcode
void WorldSession::HandleArenaTeamRemoveFromTeamOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM");
CHECK_PACKET_SIZE(recv_data, 4+1);
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptain() == member->guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
Player *player = ObjectAccessor::FindPlayer(member->guid);
if (player && player->InArena())
return;
at->DelMember(member->guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_REMOVE_SSS, 3, name, at->GetName(), _player->GetName());
at->BroadcastPacket(&data);
}
示例3: HandleArenaTeamLeaderOpcode
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER");
time_t now = time(NULL);
if (now - timeLastArenaTeamCommand < 5)
return;
else
timeLastArenaTeamCommand = now;
uint32 arenaTeamId;
std::string name;
recvData >> arenaTeamId;
recvData >> name;
// Check for valid arena team
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Only captain can pass leadership
if (arenaTeam->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
// Check if team member exists
ArenaTeamMember* member = arenaTeam->GetMember(name);
if (!member)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
// Check if the target is already team captain
if (arenaTeam->GetCaptain() == member->Guid)
return;
arenaTeam->SetCaptain(member->Guid);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName(), name, arenaTeam->GetName());
}
示例4: HandleArenaTeamRemoveOpcode
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
{
SF_LOG_DEBUG("network", "CMSG_ARENA_TEAM_REMOVE");
uint32 arenaTeamId;
std::string name;
recvData >> arenaTeamId;
recvData >> name;
// Check for valid arena team
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Only captain can remove members
if (arenaTeam->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
// Check if team member exists
ArenaTeamMember* member = arenaTeam->GetMember(name);
if (!member)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
// Captain cannot be removed
if (arenaTeam->GetCaptain() == member->Guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
arenaTeam->DelMember(member->Guid, true);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
}
示例5: HandleArenaTeamPromoteToCaptainOpcode
void WorldSession::HandleArenaTeamPromoteToCaptainOpcode(WorldPacket & recv_data)
{
sLog.outDebug("CMSG_ARENA_TEAM_PROMOTE_TO_CAPTAIN");
CHECK_PACKET_SIZE(recv_data, 4+1);
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptain() == member->guid) // target player already captain
return;
at->SetCaptain(member->guid);
// event
WorldPacket data;
BuildArenaTeamEventPacket(&data, ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 3, _player->GetName(), name, at->GetName());
at->BroadcastPacket(&data);
}
示例6: HandleArenaTeamLeaderOpcode
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEADER");
uint32 arenaTeamId;
std::string name;
recvData >> arenaTeamId;
recvData >> name;
// Check for valid arena team
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
return;
// Only captain can pass leadership
if (arenaTeam->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
// Check if team member exists
ArenaTeamMember* member = arenaTeam->GetMember(name);
if (!member)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
// Check if the target is already team captain
if (arenaTeam->GetCaptain() == member->Guid)
return;
arenaTeam->SetCaptain(member->Guid);
// Broadcast event
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ObjectGuid::Empty, 3, _player->GetName(), name, arenaTeam->GetName());
}
示例7: HandleArenaTeamRemoveOpcode
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
{
DEBUG_LOG("CMSG_ARENA_TEAM_REMOVE");
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptainGuid() != _player->GetObjectGuid())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptainGuid() == member->guid)
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_LEADER_LEAVE_S);
return;
}
at->DelMember(member->guid);
// event
at->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, name.c_str(), at->GetName().c_str(), _player->GetName());
}
示例8: HandleArenaTeamLeaderOpcode
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER");
uint32 ArenaTeamId;
std::string name;
recv_data >> ArenaTeamId;
recv_data >> name;
ArenaTeam *at = sObjectMgr->GetArenaTeamById(ArenaTeamId);
if (!at) // arena team not found
return;
if (at->GetCaptain() != _player->GetGUID())
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
return;
}
if (!normalizePlayerName(name))
return;
ArenaTeamMember* member = at->GetMember(name);
if (!member) // member not found
{
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", name, ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
return;
}
if (at->GetCaptain() == member->guid) // target player already captain
return;
at->SetCaptain(member->guid);
// event
at->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName(), name, at->GetName());
}
示例9: HandleBattlemasterJoinArena
void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
// recv_data.hexlike();
uint8 arenaslot; // 2v2, 3v3 or 5v5
recv_data >> arenaslot;
// ignore if we already in BG or BG queue
if (_player->InBattleGround())
return;
ArenaType arenatype = ArenaTeam::GetTypeBySlot(arenaslot);
uint32 arenaRating = 0;
if (!IsArenaTypeValid(arenatype))
{
sLog.outError("Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot);
return;
}
// check existence
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA);
if (!bg)
{
sLog.outError("Battleground: template bg (all arenas) not found");
return;
}
BattleGroundTypeId bgTypeId = bg->GetTypeID();
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
return;
Group* grp = _player->GetGroup();
// no group found, error
if (!grp)
return;
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
return;
uint32 ateamId = _player->GetArenaTeamId(arenaslot);
// check real arena team existence only here (if it was moved to group->CanJoin .. () then we would have to get it twice)
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ateamId);
if (!at)
{
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
return;
}
// get the team rating for queue
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 (Group::member_citerator citr = grp->GetMemberSlots().begin(); citr != grp->GetMemberSlots().end(); ++citr)
{
ArenaTeamMember const* at_member = at->GetMember(citr->guid);
if (!at_member) // group member joining to arena must be in leader arena team
return;
// calc avg personal rating
avg_pers_rating += at_member->personal_rating;
}
avg_pers_rating /= grp->GetMembersCount();
// 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)
arenaRating = avg_pers_rating;
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
uint32 avgTime = 0;
// may be Group::CanJoinBattleGroundQueue should be moved to player class...
GroupJoinBattlegroundResult err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, arenatype, arenatype, true, arenaslot);
if (!err)
{
DEBUG_LOG("Battleground: arena join as group start");
DEBUG_LOG("Battleground: arena team id %u, leader %s queued with rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName(), arenaRating, arenatype);
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, true, false, arenaRating, ateamId);
avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
}
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* member = itr->getSource();
if (!member)
continue;
WorldPacket data;
if (err)
{
sBattleGroundMgr.BuildBattleGroundStatusFailedPacket(&data, bg, member, 0, err);
member->GetSession()->SendPacket(&data);
continue;
//.........这里部分代码省略.........
示例10: HandleBattlemasterJoinArena
//.........这里部分代码省略.........
if (!_player->HasFreeBattleGroundQueueId())
return;
}
else
{
grp = _player->GetGroup();
// no group found, error
if (!grp)
return;
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
if (err != BG_JOIN_ERR_OK)
{
SendBattleGroundOrArenaJoinError(err);
return;
}
}
uint32 ateamId = 0;
if (isRated)
{
ateamId = _player->GetArenaTeamId(arenaslot);
// check real arena team existence only here (if it was moved to group->CanJoin .. () then we would have to get it twice)
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ateamId);
if (!at)
{
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
return;
}
// get the team rating for queue
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 (Group::member_citerator citr = grp->GetMemberSlots().begin(); citr != grp->GetMemberSlots().end(); ++citr)
{
ArenaTeamMember const* at_member = at->GetMember(citr->guid);
if (!at_member) // group member joining to arena must be in leader arena team
return;
// calc avg personal rating
avg_pers_rating += at_member->personal_rating;
}
avg_pers_rating /= grp->GetMembersCount();
// 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)
arenaRating = avg_pers_rating;
}
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
if (asGroup)
{
DEBUG_LOG("Battleground: arena join as group start");
if (isRated)
DEBUG_LOG("Battleground: arena team id %u, leader %s queued with rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName(), arenaRating, arenatype);
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bgBracketId, arenatype, isRated, false, arenaRating, ateamId);
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundBracketIdFromLevel(bgTypeId));
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* member = itr->getSource();
if (!member)
continue;
// add to queue
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);
// store entry point coords (same as leader entry point)
member->SetBattleGroundEntryPoint(_player);
WorldPacket data;
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
member->GetSession()->SendPacket(&data);
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId);
member->GetSession()->SendPacket(&data);
DEBUG_LOG("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName());
}
DEBUG_LOG("Battleground: arena join as group end");
}
else
{
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bgBracketId, arenatype, isRated, false, arenaRating, ateamId);
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundBracketIdFromLevel(bgTypeId));
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
// store entry point coords
_player->SetBattleGroundEntryPoint();
WorldPacket data;
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
SendPacket(&data);
DEBUG_LOG("Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName());
}
sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, _player->GetBattleGroundBracketIdFromLevel(bgTypeId));
}
示例11: OnAddPlayer
void Arena::OnAddPlayer(Player * plr)
{
if( !m_started )
{
/* cast arena readyness buff */
if(plr->isDead())
plr->ResurrectPlayer();
plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
plr->SetUInt32Value(UNIT_FIELD_POWER1, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
plr->SetUInt32Value(UNIT_FIELD_POWER4, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER4));
sEventMgr.AddEvent(plr, &Player::FullHPMP, EVENT_PLAYER_UPDATE, 500, 1, 0);
sEventMgr.AddEvent(plr, &Player::ResetAllCooldowns, EVENT_PLAYER_UPDATE, 500, 1, 0);
}
plr->m_deathVision = true;
// remove all buffs (exclude talents, include flasks)
for(uint32 x=0;x<MAX_AURAS;x++)
{
if(plr->m_auras[x])
{
if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->Flags4 & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
continue;
else
{
plr->m_auras[x]->Remove();
}
}
}
plr->GetItemInterface()->RemoveAllConjured();
plr->ResetAllCooldowns();
if( !m_started )
plr->CastSpell(plr, ARENA_PREPARATION, true);
UpdatePlayerCounts();
/* Add the green/gold team flag */
Aura * aura = new Aura(dbcSpell.LookupEntry(32725-plr->m_bgTeam), -1, plr, plr);
plr->AddAura(aura);
/* Set FFA PvP Flag */
if(!plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP))
plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP);
/* update arena team stats */
if(rated_match && plr->m_arenaTeams[m_arenateamtype] != NULL)
{
ArenaTeam * t = plr->m_arenaTeams[m_arenateamtype];
if ( t != NULL && inscribe_teams[plr->m_bgTeam] == 0 )
{
t->m_stat_gamesplayedseason++;
t->m_stat_gamesplayedweek++;
inscribe_teams[plr->m_bgTeam] = t->m_id;
}
ArenaTeamMember * tp = t->GetMember(plr->m_playerInfo);
if(tp != NULL)
{
tp->Played_ThisWeek++;
tp->Played_ThisSeason++;
}
t->SaveToDB();
}
}
示例12: Finish
void Arena::Finish()
{
m_ended = true;
m_nextPvPUpdateTime = 0;
UpdatePvPData();
PlaySoundToAll(m_winningteam ? SOUND_ALLIANCEWINS : SOUND_HORDEWINS);
sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_CLOSE);
sEventMgr.AddEvent(((CBattleground*)this), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120000, 1,0);
/* update arena team stats */
if(rated_match)
{
ArenaTeam *teams[2];
teams[0] = objmgr.GetArenaTeamById(inscribe_teams[0]);
teams[1] = objmgr.GetArenaTeamById(inscribe_teams[1]);
if ( teams[0] == NULL || teams[1] == NULL )
return;
for (uint32 i = 0; i < 2; ++i)
{
uint32 j = i ? 0 : 1; // opposing side
bool outcome;
outcome = (i == m_winningteam);
double power = (int)( teams[j]->m_stat_rating - teams[i]->m_stat_rating ) / 400.0f;
double divisor = pow(((double)(10.0)), power);
divisor += 1.0;
double winChance = 1.0 / divisor;
if (outcome)
{
teams[i]->m_stat_gameswonseason++;
teams[i]->m_stat_gameswonweek++;
}
double multiplier = (outcome ? 1.0 : 0.0) - winChance;
double deltaRating = 32.0 * multiplier;
if ( deltaRating < 0 && (-1.0 * deltaRating) > teams[i]->m_stat_rating )
teams[i]->m_stat_rating = 0;
else
teams[i]->m_stat_rating += long2int32(deltaRating);
objmgr.UpdateArenaTeamRankings();
teams[i]->SaveToDB();
for(set<uint32>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
{
Player *plr = objmgr.GetPlayer(*itr);
if( plr != NULL && plr->m_arenaTeams[m_arenateamtype] != NULL )
{
ArenaTeam * t = plr->m_arenaTeams[m_arenateamtype];
ArenaTeamMember * tp = t->GetMember(plr->m_playerInfo);
if( tp != NULL && outcome )
{
tp->Won_ThisWeek++;
tp->Won_ThisSeason++;
}
}
}
}
}
for(int i = 0; i < 2; i++)
{
bool victorious = (i == m_winningteam);
for(set<uint32>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); itr++)
{
Player *plr = objmgr.GetPlayer(*itr);
if (plr != NULL)
sHookInterface.OnArenaFinish(plr, plr->m_arenaTeams[m_arenateamtype], victorious, rated_match);
}
}
}