示例#1
0
 public TSIrcPlayer(string name, Group group, IIrcMessageTarget target)
     : base(name)
 {
     Group = group;
     Target = target;
     UserAccountName = name;
 }
示例#2
0
 public TSPlayer(int index)
 {
     TilesDestroyed = new Dictionary<Vector2, Tile>();
     Index = index;
     TPlayer = Main.player[index];
     Group = new Group("null");
 }
示例#3
0
文件: Group.cs 项目: CoderCow/TShock
 public Group(string groupname, Group parentgroup = null, string chatcolor = "255,255,255", string permissions = null)
 {
     Name = groupname;
     Parent = parentgroup;
     ChatColor = chatcolor;
     Permissions = permissions;
 }
示例#4
0
 public TSIrcPlayer(string name, Group group, IIrcMessageTarget target)
     : base(name)
 {
     Group = group;
     Target = target;
     User = TShock.Users.GetUserByName(name); //Not sure if this is the correct way
 }
示例#5
0
 protected TSPlayer(String playerName)
 {
     TilesDestroyed = new Dictionary<Vector2, Tile>();
     Index = -1;
     FakePlayer = new Player { name = playerName, whoAmi = -1 };
     Group = new Group("null");
 }
 public RegionPlayer( TSPlayer ply, FlaggedRegionManager regionManager )
 {
     player = ply;
     positions = new PositionQueue();
     this.regionManager = regionManager;
     OriginalGroup = ply.Group;
 }
示例#7
0
文件: Group.cs 项目: vharonftw/TShock
 public Group(string groupname, Group parentgroup = null, string chatcolor = "255,255,255")
 {
     Name = groupname;
     Parent = parentgroup;
     byte.TryParse(chatcolor.Split(',')[0], out R);
     byte.TryParse(chatcolor.Split(',')[1], out G);
     byte.TryParse(chatcolor.Split(',')[2], out B);
 }
示例#8
0
 public TSIrcPlayer(string name, Group group, IIrcMessageTarget target)
     : base(name)
 {
     Group = group;
     Target = target;
     if (User != null)
         User.Name = name;
 }
示例#9
0
        public TShockAPI.Group TShockGroup(object Group)
        {
            TShockAPI.Group g = null;
            if (Group == null)
            {
                return(null);
            }

            g = TShockAPI.TShock.Groups.FirstOrDefault(i => i.Name.Equals(Group.ToString(), StringComparison.CurrentCultureIgnoreCase));
            return(g);
        }
 public void ImportRegion( string name, int flags, int d, int h, List<string> items, Group tempGroup )
 {
     var reg = TShock.Regions.GetRegionByName(name);
     if( reg == null )
     {
         Console.WriteLine( "{0} was not found in tshocks region list.", name);
         return;
     }
     FlaggedRegion f = new FlaggedRegion(reg, flags);
     f.setDPS( d );
     f.setHPS(h);
     f.setBannedItems(items);
     f.setTempGroup(tempGroup);
     regions.Add( name, f );
 }
示例#11
0
        void OnChannelMessage(object sender, IrcMessageEventArgs e)
        {
            if (Config.IgnoredIRCNicks.Contains(((IrcUser)e.Source).NickName) ||
                Config.IgnoredIRCChatRegexes.Any(s => Regex.IsMatch(e.Text, s)))
            {
                return;
            }

            var ircChannel = ((IrcChannel)e.Targets[0]);
            var ircUser    = (IrcUser)e.Source;

            if (e.Text.StartsWith(Config.BotPrefix))
            {
                IRCCommands.Execute(e.Text.Substring(Config.BotPrefix.Length), ircUser, (IIrcMessageTarget)sender);
            }
            else if (String.Equals(ircChannel.Name, Config.Channel, StringComparison.OrdinalIgnoreCase))
            {
                IrcChannelUser ircChannelUser = ircChannel.GetChannelUser(ircUser);
                if (!String.IsNullOrEmpty(Config.IRCChatModesRequired) && ircChannelUser != null &&
                    !ircChannelUser.Modes.Intersect(Config.IRCChatModesRequired).Any())
                {
                    return;
                }

                string text = e.Text;
                text = System.Text.RegularExpressions.Regex.Replace(text, "\u0003[0-9]{1,2}(,[0-9]{1,2})?", "");
                text = text.Replace("\u0002", "");
                text = text.Replace("\u000f", "");
                text = text.Replace("\u001d", "");
                text = text.Replace("\u001f", "");

                if (text.StartsWith("\u0001ACTION") && text.EndsWith("\u0001"))
                {
                    if (!String.IsNullOrEmpty(Config.IRCActionMessageFormat))
                    {
                        TShock.Utils.Broadcast(String.Format(Config.IRCActionMessageFormat, e.Source.Name, text.Substring(8, text.Length - 9)), 205, 133, 63);
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(Config.IRCChatMessageFormat))
                    {
                        Group group = IrcUsers[ircUser];
                        TShock.Utils.Broadcast(String.Format(Config.IRCChatMessageFormat, group.Prefix, e.Source.Name, text), group.R, group.G, group.B);
                    }
                }
            }
        }
        private object GroupInfo(RestRequestArgs args)
        {
            var ret = GroupFind(args.Parameters);

            if (ret is RestObject)
            {
                return(ret);
            }

            TShockAPI.Group group = (TShockAPI.Group)ret;
            return(new RestObject()
            {
                { "name", group.Name },
                { "parent", group.ParentName },
                { "chatcolor", string.Format("{0},{1},{2}", group.R, group.G, group.B) },
                { "permissions", group.permissions },
                { "prefix", group.Prefix },
                { "suffix", group.Suffix },
                { "negatedpermissions", group.negatedpermissions },
                { "totalpermissions", group.TotalPermissions }
            });
        }
示例#13
0
 public RegionStorage(Region region, List<string> flags, int healinterval, int healamount, int manainterval, int damageinterval, int damageamount, Group tempgroup, List<string> bannedItems, List<int> bannedNPCs, List<int> bannedTiles, List<int> bannedProjectiles, string command, string fromgroup, string togroup, List<string> groupOnly, string message, bool effectOwner, bool effectAllowed)
 {
     this.region = region;
     this.flags = flags;
     this.healinterval = healinterval;
     this.healamount = healamount;
     this.manainterval = manainterval;
     this.damageinterval = damageinterval;
     this.damageamount = damageamount;
     this.tempgroup = tempgroup;
     this.bannedItems = bannedItems;
     this.bannedNPCs = bannedNPCs;
     this.bannedTiles = bannedTiles;
     this.command = command;
     this.fromgroup = fromgroup;
     this.togroup = togroup;
     this.groupOnly = groupOnly;
     this.message = message;
     this.bannedProjectiles = bannedProjectiles;
     this.effectOwner = effectOwner;
     this.effectAllowed = effectAllowed;
 }
示例#14
0
 protected TSPlayer(String playerName)
 {
     TilesDestroyed = new Dictionary<Vector2, TileData>();
     TilesCreated = new Dictionary<Vector2, TileData>();
     Index = -1;
     FakePlayer = new Player { name = playerName, whoAmi = -1 };
     Group = new Group(TShock.Config.DefaultGuestGroupName);
 }
示例#15
0
 public TSPlayer(int index)
 {
     TilesDestroyed = new Dictionary<Vector2, TileData>();
     TilesCreated = new Dictionary<Vector2, TileData>();
     Index = index;
     Group = new Group(TShock.Config.DefaultGuestGroupName);
 }
 public void setTempGroup(Group group)
 {
     tempGroup = group;
 }
示例#17
0
 public TSPlayer(int index)
 {
     TilesDestroyed = new Dictionary<Vector2, TileData>();
     Index = index;
     Group = new Group("null");
 }
示例#18
0
文件: Group.cs 项目: Luigifan/TShock
 public Group(string groupname, Group parentgroup = null)
 {
     Name = groupname;
     Parent = parentgroup;
 }
示例#19
0
文件: Group.cs 项目: CoderCow/TShock
 /// <summary>
 /// Assigns all fields of this instance to another.
 /// </summary>
 /// <param name="otherGroup">The other instance.</param>
 public void AssignTo(Group otherGroup)
 {
     otherGroup.Name = Name;
     otherGroup.Parent = Parent;
     otherGroup.Prefix = Prefix;
     otherGroup.Suffix = Suffix;
     otherGroup.R = R;
     otherGroup.G = G;
     otherGroup.B = B;
     otherGroup.Permissions = Permissions;
 }
示例#20
0
文件: Group.cs 项目: CoderCow/TShock
 public Group(string groupname, Group parentgroup, string chatcolor)
     : this(groupname, parentgroup, chatcolor, null)
 {
 }
示例#21
0
文件: Group.cs 项目: Elezoz/TShock
 public Group(string groupName, Group parentGroup = null)
 {
     name = groupName;
     parent = parentGroup;
 }
示例#22
0
文件: Group.cs 项目: Elezoz/TShock
 public SuperAdminGroup(string groupName, Group parentGroup = null)
     : base(groupName, parentGroup)
 {
 }
示例#23
0
文件: TSPlayer.cs 项目: Ijwu/TShock
 public TSRestPlayer(string playerName, Group playerGroup)
     : base(playerName)
 {
     Group = playerGroup;
     AwaitingResponse = new Dictionary<string, Action<object>>();
 }
示例#24
0
文件: TSPlayer.cs 项目: Ijwu/TShock
        public void TempGroupTimerElapsed(object sender, ElapsedEventArgs args)
        {
            SendWarningMessage("Your temporary group access has expired.");

            tempGroup = null;
            if (sender != null)
            {
                ((Timer)sender).Stop();
            }
        }
        public void CreateHouseRegion(User user, Group group, Rectangle area, bool checkOverlaps = true, bool checkPermissions = false, bool checkDefinePermission = false)
        {
            Contract.Requires<ArgumentNullException>(user != null);
              Contract.Requires<ArgumentNullException>(group != null);
              Contract.Requires<ArgumentException>(area.Width > 0 && area.Height > 0);

              int maxHouses = int.MaxValue;
              if (checkPermissions) {
            if (!group.HasPermission(HouseRegionsPlugin.Define_Permission))
              throw new MissingPermissionException(HouseRegionsPlugin.Define_Permission);

            if (!group.HasPermission(HouseRegionsPlugin.NoLimits_Permission)) {
              if (this.Config.MaxHousesPerUser > 0)
            maxHouses = this.Config.MaxHousesPerUser;

              Configuration.HouseSizeConfig restrictingSizeConfig;
              if (!this.CheckHouseRegionValidSize(area, out restrictingSizeConfig))
            throw new InvalidHouseSizeException(restrictingSizeConfig);
            }
              }

              if (checkOverlaps && this.CheckHouseRegionOverlap(user.Name, area))
            throw new HouseOverlapException();

              // Find a free house index.
              int houseIndex;
              string houseName = null;
              for (houseIndex = 1; houseIndex <= maxHouses; houseIndex++) {
            houseName = this.ToHouseRegionName(user.Name, houseIndex);
            if (TShock.Regions.GetRegionByName(houseName) == null)
              break;
              }
              if (houseIndex == maxHouses)
            throw new LimitEnforcementException("Max amount of houses reached.");

              if (!TShock.Regions.AddRegion(
            area.X, area.Y, area.Width, area.Height, houseName, user.Name, Main.worldID.ToString(),
            this.Config.DefaultZIndex
              ))
            throw new InvalidOperationException();
        }
示例#26
0
 public TSPlayer(int index)
 {
     TilesDestroyed = new Dictionary<PointF, Tile>();
     Index = index;
     Group = new Group("null");
 }
示例#27
0
 public TSPlayer(int index)
 {
     TilesDestroyed = new Dictionary<Vector2, TileData>();
     TilesCreated = new Dictionary<Vector2, TileData>();
     Index = index;
     Group = new Group(TShock.Config.DefaultGuestGroupName);
     IceTiles = new List<Point>();
     AwaitingResponse = new Dictionary<string, Action<object>>();
 }