static bool HandleArenaCaptainCommand(StringArguments args, CommandHandler handler) { if (args.Empty()) { return(false); } string idStr; string nameStr; handler.extractOptFirstArg(args, out idStr, out nameStr); if (string.IsNullOrEmpty(idStr)) { return(false); } if (!uint.TryParse(idStr, out uint teamId) || teamId == 0) { return(false); } Player target; ObjectGuid targetGuid; if (!handler.extractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid)) { return(false); } ArenaTeam arena = Global.ArenaTeamMgr.GetArenaTeamById(teamId); if (arena == null) { handler.SendSysMessage(CypherStrings.ArenaErrorNotFound, teamId); return(false); } if (!target) { handler.SendSysMessage(CypherStrings.PlayerNotExistOrOffline, nameStr); return(false); } if (arena.IsFighting()) { handler.SendSysMessage(CypherStrings.ArenaErrorCombat); return(false); } if (!arena.IsMember(targetGuid)) { handler.SendSysMessage(CypherStrings.ArenaErrorNotMember, nameStr, arena.GetName()); return(false); } if (arena.GetCaptain() == targetGuid) { handler.SendSysMessage(CypherStrings.ArenaErrorCaptain, nameStr, arena.GetName()); return(false); } arena.SetCaptain(targetGuid); CharacterInfo oldCaptainNameData = Global.WorldMgr.GetCharacterInfo(arena.GetCaptain()); if (oldCaptainNameData == null) { return(false); } handler.SendSysMessage(CypherStrings.ArenaCaptain, arena.GetName(), arena.GetId(), oldCaptainNameData.Name, target.GetName()); if (handler.GetSession() != null) { Log.outDebug(LogFilter.Arena, "GameMaster: {0} [GUID: {1}] promoted player: {2} [GUID: {3}] to leader of arena team \"{4}\"[Id: {5}]", handler.GetSession().GetPlayer().GetName(), handler.GetSession().GetPlayer().GetGUID().ToString(), target.GetName(), target.GetGUID().ToString(), arena.GetName(), arena.GetId()); } else { Log.outDebug(LogFilter.Arena, "Console: promoted player: {0} [GUID: {1}] to leader of arena team \"{2}\"[Id: {3}]", target.GetName(), target.GetGUID().ToString(), arena.GetName(), arena.GetId()); } return(true); }