static bool HandleArenaInfoCommand(StringArguments args, CommandHandler handler) { if (args.Empty()) { return(false); } uint teamId = args.NextUInt32(); if (teamId == 0) { return(false); } ArenaTeam arena = Global.ArenaTeamMgr.GetArenaTeamById(teamId); if (arena == null) { handler.SendSysMessage(CypherStrings.ArenaErrorNotFound, teamId); return(false); } handler.SendSysMessage(CypherStrings.ArenaInfoHeader, arena.GetName(), arena.GetId(), arena.GetRating(), arena.GetArenaType(), arena.GetArenaType()); foreach (var member in arena.GetMembers()) { handler.SendSysMessage(CypherStrings.ArenaInfoMembers, member.Name, member.Guid, member.PersonalRating, (arena.GetCaptain() == member.Guid ? "- Captain" : "")); } return(true); }
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); }
static bool HandleArenaCreateCommand(StringArguments args, CommandHandler handler) { if (args.Empty()) { return(false); } Player target; if (!handler.extractPlayerTarget(args[0] != '"' ? args : null, out target)) { return(false); } string name = handler.extractQuotedArg(args.NextString()); if (string.IsNullOrEmpty(name)) { return(false); } byte type = args.NextByte(); if (type == 0) { return(false); } if (Global.ArenaTeamMgr.GetArenaTeamByName(name) != null) { handler.SendSysMessage(CypherStrings.ArenaErrorNameExists, name); return(false); } if (type == 2 || type == 3 || type == 5) { if (Player.GetArenaTeamIdFromDB(target.GetGUID(), type) != 0) { handler.SendSysMessage(CypherStrings.ArenaErrorSize, target.GetName()); return(false); } ArenaTeam arena = new ArenaTeam(); if (!arena.Create(target.GetGUID(), type, name, 4293102085, 101, 4293253939, 4, 4284049911)) { handler.SendSysMessage(CypherStrings.BadValue); return(false); } Global.ArenaTeamMgr.AddArenaTeam(arena); handler.SendSysMessage(CypherStrings.ArenaCreate, arena.GetName(), arena.GetId(), arena.GetArenaType(), arena.GetCaptain()); } else { handler.SendSysMessage(CypherStrings.BadValue); return(false); } return(true); }
static bool HandleArenaRenameCommand(StringArguments args, CommandHandler handler) { if (args.Empty()) { return(false); } string oldArenaStr = handler.extractQuotedArg(args.NextString()); if (string.IsNullOrEmpty(oldArenaStr)) { handler.SendSysMessage(CypherStrings.BadValue); return(false); } string newArenaStr = handler.extractQuotedArg(args.NextString()); if (string.IsNullOrEmpty(newArenaStr)) { handler.SendSysMessage(CypherStrings.BadValue); return(false); } ArenaTeam arena = Global.ArenaTeamMgr.GetArenaTeamByName(oldArenaStr); if (arena == null) { handler.SendSysMessage(CypherStrings.AreanErrorNameNotFound, oldArenaStr); return(false); } if (Global.ArenaTeamMgr.GetArenaTeamByName(newArenaStr) != null) { handler.SendSysMessage(CypherStrings.ArenaErrorNameExists, oldArenaStr); return(false); } if (arena.IsFighting()) { handler.SendSysMessage(CypherStrings.ArenaErrorCombat); return(false); } if (!arena.SetName(newArenaStr)) { handler.SendSysMessage(CypherStrings.BadValue); return(false); } handler.SendSysMessage(CypherStrings.ArenaRename, arena.GetId(), oldArenaStr, newArenaStr); if (handler.GetSession() != null) { Log.outDebug(LogFilter.Arena, "GameMaster: {0} [GUID: {1}] rename arena team \"{2}\"[Id: {3}] to \"{4}\"", handler.GetSession().GetPlayer().GetName(), handler.GetSession().GetPlayer().GetGUID().ToString(), oldArenaStr, arena.GetId(), newArenaStr); } else { Log.outDebug(LogFilter.Arena, "Console: rename arena team \"{0}\"[Id: {1}] to \"{2}\"", oldArenaStr, arena.GetId(), newArenaStr); } return(true); }