private ModLevels m_accessLevel; // Required access level /// <summary>Creates a new BattleCore Behavior Attribute</summary> /// <param name ="command">Command name</param> /// <param name ="description">A short description of the command</param> /// <param name ="accessLevel">Command Moderator Access Level</param> public CommandHelpAttribute(string command, string description, ModLevels accessLevel) { // Set the member data this.m_strCommand = command; this.m_strDescription = description; this.m_accessLevel = accessLevel; }
//----------------------------------------------------------------------// // Misc // //----------------------------------------------------------------------// // checking if player is mod - if not sends back message private bool player_isMod(ChatEvent e, ModLevels mod) { if (e.ModLevel >= mod || m_CustomStaff.Contains(e.PlayerName)) { return(true); } psyGame.Send(msg.pm(e.PlayerName, "You do not have access to this command. This is a staff command. Required Moderator level: [ " + mod + " ].")); return(false); }
// Mod check with an attached message in case they aren't authorized public bool IsMod(ChatEvent e, ModLevels mod) { if (e.ModLevel >= mod || e.PlayerName == "zxvf") { return(true); } Game(msg.pm(e.PlayerName, "You are not authorized to use this command. Required Mod Level [ " + mod + " ].")); return(false); }
// get game from command private Classes.BaseGame getGame_FromCommand(SSPlayer p, ChatEvent e, ModLevels modLvl) { Classes.BaseGame game = this.getGame(p.Frequency); string[] data = e.Message.Split(' '); int num; if (game == null) { if (player_isMod(e, ModLevels.Mod)) { if (data.Length >= 2) { if (int.TryParse(data[1], out num) && num > 0 && num <= this.m_Games.Count) { return(this.m_Games[num - 1]); } if (data.Length > 2 && int.TryParse(data[2], out num) && num > 0 && num <= this.m_Games.Count) { return(this.m_Games[num - 1]); } if (p.Ship == ShipTypes.Spectator) { psyGame.Send(msg.pm(p.PlayerName, "You are not on an active game freq. To see the list of active games type !bd games. For help on BD commands type: !bd commands.")); return(null); } } else { psyGame.Send(msg.pm(p.PlayerName, "You must be in the active game freq to use this command. To see the list of active games type !bd games. For help on BD commands type: !bd commands.")); return(null); } } return(null); } else { if (data.Length == 3) { if (int.TryParse(data[2], out num) && num > 0 && num <= this.m_Games.Count) { return(this.m_Games[num - 1]); } } if (this.player_isMod(e, modLvl)) { return(this.m_Games[game.gameNum() - 1]); } return(null); } }