コード例 #1
0
ファイル: RegionFlags.cs プロジェクト: Jewsus/Region-Flags
        private void SetTempGroup(CommandArgs args)
        {
            if (args.Parameters.Count < 2)
            {
                args.Player.SendMessage("Invalid usage: /regtemp[/rt] [region name] [group name]", Color.Red);
            }
            else
            {
                string region = args.Parameters[0];
                string group  = args.Parameters[1];
                Group  g      = TShock.Groups.GetGroupByName(group);
                if (g == null)
                {
                    args.Player.SendErrorMessage("Group '{0}' does not exist.", group);
                    return;
                }

                FlaggedRegion reg = regions.getRegion(region);
                if (reg == null)
                {
                    args.Player.SendMessage("Invalid region", Color.Red);
                    return;
                }

                args.Player.SendMessage(String.Format("Temp Group for {0} is now {1}", region, g.Name), Color.Green);
                reg.setTempGroup(g);
                regions.UpdateRegion(reg.getRegion().Name);
            }
        }
コード例 #2
0
ファイル: RegionFlags.cs プロジェクト: Jewsus/Region-Flags
        private void SetHPS(CommandArgs args)
        {
            if (args.Parameters.Count < 2)
            {
                args.Player.SendMessage("Invalid usage: /regheal[/rh] [region name] [heal]", Color.Red);
            }
            else
            {
                string region = args.Parameters[0];
                int    health = 0;
                if (!int.TryParse(args.Parameters[1], out health))
                {
                    args.Player.SendMessage("You must specify health as a number of seconds between heart drops.", Color.Red);
                    return;
                }

                FlaggedRegion reg = regions.getRegion(region);
                if (reg == null)
                {
                    args.Player.SendMessage("Invalid region", Color.Red);
                    return;
                }

                args.Player.SendMessage(String.Format("HPS for {0} is now {1}", region, health), Color.Green);
                reg.setHPS(health);
                regions.UpdateRegion(reg.getRegion().Name);
            }
        }
コード例 #3
0
ファイル: RegionFlags.cs プロジェクト: Jewsus/Region-Flags
        private void SetDPS(CommandArgs args)
        {
            if (args.Parameters.Count < 2)
            {
                args.Player.SendMessage("Invalid usage: /regdamage[/rd] [region name] [damage]", Color.Red);
            }
            else
            {
                string region = args.Parameters[0];
                int    damage = 0;
                if (!int.TryParse(args.Parameters[1], out damage))
                {
                    args.Player.SendMessage("You must specify damage as a number.", Color.Red);
                    return;
                }

                FlaggedRegion reg = regions.getRegion(region);
                if (reg == null)
                {
                    args.Player.SendMessage("Invalid region", Color.Red);
                    return;
                }

                args.Player.SendMessage(String.Format("DPS for {0} is now {1}", region, damage), Color.Green);
                reg.setDPS(damage);
                regions.UpdateRegion(reg.getRegion().Name);
            }
        }
コード例 #4
0
        private void SetHPS(CommandArgs args)
        {
            if (args.Parameters.Count < 2)
            {
                args.Player.SendMessage("Invalid usage: /reghps(/rh) [region name] <hps>", Color.Red);
            }
            else
            {
                string region = args.Parameters[0];
                int    health = 0;
                if (!int.TryParse(args.Parameters[1], out health))
                {
                    args.Player.SendMessage("You must specify heart-drop period as a number.", Color.Red);
                    return;
                }

                FlaggedRegion reg = regions.getRegion(region);
                if (reg == null)
                {
                    args.Player.SendMessage("Invalid region", Color.Red);
                    return;
                }

                args.Player.SendMessage(String.Format("HPS for Region '{0}' is now {1}.", region, health), Color.Green);
                reg.setHPS(health);
                regions.UpdateRegion(reg.getRegion().Name);
            }
        }
コード例 #5
0
        private void SetDPS(CommandArgs args)
        {
            if (args.Parameters.Count < 2)
            {
                args.Player.SendMessage("Invalid usage: /regdps(/rd) [region name] <dps>", Color.Red); // param) region name: 0, damage: 1, total count: 2
            }
            else
            {
                string region = args.Parameters[0];
                int    damage = 0;
                if (!int.TryParse(args.Parameters[1], out damage))
                {
                    args.Player.SendMessage("You must specify damage as a number.", Color.Red);
                    return;
                }

                FlaggedRegion reg = regions.getRegion(region);
                if (reg == null)
                {
                    args.Player.SendMessage("Invalid region", Color.Red);
                    return;
                }

                args.Player.SendMessage(String.Format("DPS for Region '{0}' is now '{1}'.", region, damage), Color.Green); // reference
                reg.setDPS(damage);
                regions.UpdateRegion(reg.getRegion().Name);
            }
        }
コード例 #6
0
ファイル: RegionFlags.cs プロジェクト: Jewsus/Region-Flags
        private void ViewFlags(CommandArgs args)
        {
            if (args.Parameters.Count == 1)
            {
                FlaggedRegion region = regions.getRegion(args.Parameters[0]);
                if (region == null)
                {
                    args.Player.SendErrorMessage("Region '{0}' is not a region flag defined region.", args.Parameters[0]);
                    return;
                }

                string flags = string.Join(", ", region.getFlags().Select(f => f.ToString()));
                args.Player.SendInfoMessage("Flags for '{0} are: {1}", region.getRegion().Name, flags);
                return;
            }

            args.Player.SendErrorMessage("Usage: /regview[/rv] [region name] - Views the flags on a given region.");
        }