rendered paste body[tod@gw2]:~/src/mangos/src/game> head -n 120 Level2.cpp | tail -n 80
bool ChatHandler::HandleUnlockArena2v2Command(const char* args)
{
if(!*args)
return false;
char *charname = strtok((char *) args, " ");
if(!charname)
return false;
std::string cname = charname;
normalizePlayerName(cname);
uint64 guid = objmgr.GetPlayerGUIDByName(cname.c_str());
if(!guid)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
return true;
}
Player *chr = objmgr.GetPlayer(guid);
// check security
uint32 account_id = 0;
uint32 security = 0;
if (chr)
{
account_id = chr->GetSession()->GetAccountId();
security = chr->GetSession()->GetSecurity();
}
else
{
account_id = objmgr.GetPlayerAccountIdByGUID(guid);
security = objmgr.GetSecurityByAccount(account_id);
}
if(security >= m_session->GetSecurity())
{
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
return true;
}
/*
MemberList::iterator itr;
for (itr = members.begin(); itr != members.end(); itr++)
{
if (itr->guid == guid)
{
members.erase(itr);
break;
}
}
*/
if(chr)
{
chr->SetInArenaTeam(0, 0);
// chr->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, G etName(), "", 0);
// delete all info regarding this team
for(int i = 0; i < 6; ++i)
{
chr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (0 * 6) + i, 0);
Player::SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (0 * 6 ) + i, 0, guid);
}
}
else
{
// delete all info regarding this team
for(int i = 0; i < 6; ++i)
Player::SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (0 * 6 ) + i, 0, guid);
}
if(chr)
ChatHandler(chr).PSendSysMessage("Your arena's has been unlocked");
PSendSysMessage("%s arena's has been unlocked.", cname.c_str());
return true;
}