コード例 #1
0
ファイル: ViceVsVirtueSystem.cs プロジェクト: asplogic/ServUO
        public static void OnLogin(LoginEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm != null && Instance != null)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1), Instance.CheckResignation, pm);
                Timer.DelayCall(TimeSpan.FromSeconds(2), Instance.CheckBattleStatus, pm);

                if (EnhancedRules && AutoKicked != null && AutoKicked.Contains(pm))
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(1), player =>
                    {
                        player.SendGump(new BasicInfoGump(_EnhancedRulesNotice));

                        AutoKicked.Remove(player);

                        if (AutoKicked.Count == 0)
                        {
                            AutoKicked = null;
                        }
                    }, pm);
                }
            }
        }
コード例 #2
0
ファイル: ViceVsVirtueSystem.cs プロジェクト: asplogic/ServUO
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            GuildStats   = new Dictionary <Guild, VvVGuildStats>();
            ExemptCities = new List <VvVCity>();

            bool enabled  = false;
            bool enhanced = false;

            switch (version)
            {
            case 4:
                int c = reader.ReadInt();
                for (int i = 0; i < c; i++)
                {
                    var pm = reader.ReadMobile() as PlayerMobile;

                    if (pm != null)
                    {
                        if (AutoKicked == null)
                        {
                            AutoKicked = new List <PlayerMobile>();
                        }

                        AutoKicked.Add(pm);
                    }
                }

                enhanced = reader.ReadBool();
                goto case 3;

            case 3:
                enabled = reader.ReadBool();
                goto case 2;

            case 2:
            case 1:
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    ExemptCities.Add((VvVCity)reader.ReadInt());
                }

                goto case 0;
            }

            case 0:
            {
                HasGenerated = reader.ReadBool();

                Battle = new VvVBattle(reader, this);

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Item item = reader.ReadItem();

                    if (item != null)
                    {
                        AddVvVItem(item);
                    }
                }

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Guild         g     = reader.ReadGuild() as Guild;
                    VvVGuildStats stats = new VvVGuildStats(g, reader);

                    if (g != null)
                    {
                        GuildStats[g] = stats;
                    }
                }
            }
            break;
            }

            if (version == 1)
            {
                Timer.DelayCall(FixVvVItems);
            }

            if (Enabled && !enabled)
            {
                CreateSilverTraders();
                Server.Factions.Generator.RemoveFactions();
            }
            else if (!Enabled && enabled)
            {
                DeleteSilverTraders();
            }

            if (EnhancedRules && !enhanced)
            {
                OnEnhancedRulesEnabled();
            }
        }