コード例 #1
0
        public void Create(ForceFieldUser player, List <string> args)
        {
            if (!player.HasProperty("LastHealthRecovered"))
            {
                player.SetProperty("LastHealthRecovered", DateTime.UtcNow);
            }
            if (!player.HasProperty("HealthRecoveryAmount"))
            {
                player.SetProperty("HealthRecoveryAmount", 10);
            }
            if (!player.HasProperty("TimeBetweenHeals"))
            {
                player.SetProperty("TimeBetweenHeals", 5);
            }

            if (args.Count > 0)
            {
                int recover;
                if (Int32.TryParse(args[0], out recover))
                {
                    player.SetProperty("HealthRecoveryAmount", recover);
                }
            }
            if (args.Count > 1)
            {
                int timeBetweenHeals;
                if (Int32.TryParse(args[1], out timeBetweenHeals))
                {
                    player.SetProperty("TimeBetweenHeals", timeBetweenHeals);
                }
            }
        }
コード例 #2
0
ファイル: Manafield.cs プロジェクト: bippity/Forcefield
        public void Create(ForceFieldUser player, List<string> args)
        {
            if (!player.HasProperty("LastManaRecovered"))
            {
                player.SetProperty("LastManaRecovered", DateTime.UtcNow);
            }
            if (!player.HasProperty("ManaRecoveryAmount"))
            {
                player.SetProperty("ManaRecoveryAmount", 10);
            }
            if (!player.HasProperty("TimeBetweenRestores"))
            {
                player.SetProperty("TimeBetweenRestores", 5);
            }

            if (args.Count > 0)
            {
                int recover;
                if (Int32.TryParse(args[0], out recover))
                {
                    player.SetProperty("HealthRecoveryAmount", recover);
                }
            }
            if (args.Count > 1)
            {
                int timeBetweenRestores;
                if (Int32.TryParse(args[1], out timeBetweenRestores))
                {
                    player.SetProperty("TimeBetweenRestores", timeBetweenRestores);
                }
            }
        }
コード例 #3
0
ファイル: BuffField.cs プロジェクト: bippity/Forcefield
        public void Create(ForceFieldUser player, List<string> args)
        {
            if (!player.HasProperty("LastBuffSet"))
            {
                player.SetProperty("LastBuffSet", DateTime.UtcNow);
            }
            if (!player.HasProperty("BuffList"))
            {
                player.SetProperty("BuffList", new List<int>());
            }

            foreach (string arg in args)
            {
                int buff;
                if (!Int32.TryParse(arg, out buff) && (buff < 0 || buff >= Main.maxBuffTypes))
                {
                    continue;
                }

                ((List<int>) player["BuffList"]).Add(buff);
            }
        }
コード例 #4
0
ファイル: BuffField.cs プロジェクト: Survap/Forcefield
        public void Create(ForceFieldUser player, List <string> args)
        {
            if (!player.HasProperty("LastBuffSet"))
            {
                player.SetProperty("LastBuffSet", DateTime.UtcNow);
            }
            if (!player.HasProperty("BuffList"))
            {
                player.SetProperty("BuffList", new List <int>());
            }

            foreach (string arg in args)
            {
                int buff;
                if (!Int32.TryParse(arg, out buff) && (buff < 0 || buff >= Main.maxBuffTypes))
                {
                    continue;
                }

                ((List <int>)player["BuffList"]).Add(buff);
            }
        }