コード例 #1
0
        static AutoPvP()
        {
            CMOptions = new AutoPvPOptions();

            Scenarios   = new PvPScenario[0];
            BattleTypes = typeof(PvPBattle).GetConstructableChildren();

            SeasonSchedule = new Schedule(CMOptions.ModuleName + " Seasons", false, DefaultSeasonSchedule);

            Seasons = new BinaryDataStore <int, PvPSeason>(VitaNexCore.SavesDirectory + "/AutoPvP", "Seasons")
            {
                OnSerialize   = SerializeSeasons,
                OnDeserialize = DeserializeSeasons
            };

            Battles = new BinaryDirectoryDataStore <PvPSerial, PvPBattle>(
                VitaNexCore.SavesDirectory + "/AutoPvP", "Battles", "pvp")
            {
                OnSerialize   = SerializeBattle,
                OnDeserialize = DeserializeBattle
            };

            Profiles = new BinaryDataStore <PlayerMobile, PvPProfile>(VitaNexCore.SavesDirectory + "/AutoPvP", "Profiles")
            {
                Async         = true,
                OnSerialize   = SerializeProfiles,
                OnDeserialize = DeserializeProfiles
            };
        }
コード例 #2
0
ファイル: AutoPvP_Init.cs プロジェクト: greeduomacro/RuneUO
		static AutoPvP()
		{
			CMOptions = new AutoPvPOptions();

			Scenarios = new PvPScenario[0];
			BattleTypes = typeof(PvPBattle).GetConstructableChildren();

			SeasonSchedule = new Schedule(CMOptions.ModuleName + " Seasons", false, DefaultSeasonSchedule);

			Seasons = new BinaryDataStore<int, PvPSeason>(VitaNexCore.SavesDirectory + "/AutoPvP", "Seasons")
			{
				OnSerialize = SerializeSeasons,
				OnDeserialize = DeserializeSeasons
			};

			Battles = new BinaryDirectoryDataStore<PvPSerial, PvPBattle>(
				VitaNexCore.SavesDirectory + "/AutoPvP", "Battles", "pvp")
			{
				OnSerialize = SerializeBattle,
				OnDeserialize = DeserializeBattle
			};

			Profiles = new BinaryDataStore<PlayerMobile, PvPProfile>(VitaNexCore.SavesDirectory + "/AutoPvP", "Profiles")
			{
				Async = true,
				OnSerialize = SerializeProfiles,
				OnDeserialize = DeserializeProfiles
			};
		}
コード例 #3
0
        private static void CMInvoke()
        {
            PvPBattle.Bind();
            BattleNotoriety.Enable();

            var scenarios = new List <PvPScenario>();

            foreach (var type in BattleTypes.Where(t => t != null))
            {
                VitaNexCore.TryCatch(
                    () =>
                {
                    var battle = type.CreateInstanceSafe <PvPBattle>();

                    if (battle == null)
                    {
                        throw new Exception("PvPBattle Type could not be constructed, requires a constructor with 0 arguments.");
                    }

                    PvPScenario scenario = battle;
                    scenarios.Add(scenario);
                    battle.Delete();

                    CMOptions.ToConsole("Created scenario ({0}) '{1}'", scenario.TypeOf.Name, scenario.Name);
                },
                    CMOptions.ToConsole);
            }

            Scenarios = scenarios.ToArray();
            scenarios.Clear();

            foreach (var battle in Battles.Values.Where(b => b != null && !b.Deleted).ToArray())
            {
                VitaNexCore.TryCatch(
                    battle.Init,
                    ex =>
                {
                    VitaNexCore.TryCatch(battle.Delete);

                    CMOptions.ToConsole("Failed to initialize battle #{0} '{1}'", battle.Serial, battle.Name);
                    CMOptions.ToConsole(ex);
                });
            }

            foreach (var profile in Profiles.Values.Where(p => p != null && !p.Deleted).ToArray())
            {
                VitaNexCore.TryCatch(
                    profile.Init,
                    ex =>
                {
                    VitaNexCore.TryCatch(profile.Delete);

                    CMOptions.ToConsole("Failed to initialize profile #{0} '{1}'", profile.Owner.Serial.Value, profile.Owner.RawName);
                    CMOptions.ToConsole(ex);
                });
            }
        }
コード例 #4
0
ファイル: AutoPvP.cs プロジェクト: LordEnigma/UO
        public static PvPBattle CreateBattle(PvPScenario scenario)
        {
            if (scenario == null)
            {
                return(null);
            }

            PvPBattle battle = scenario.CreateBattle();

            Battles.Add(battle.Serial, battle);
            battle.Init();

            return(battle);
        }
コード例 #5
0
        public static PvPBattle CreateBattle(PvPScenario scenario)
        {
            if (scenario == null)
            {
                return(null);
            }

            var battle = scenario.CreateBattle();

            Battles[battle.Serial] = battle;

            battle.Init();

            return(battle);
        }