public ViceVsVirtueSystem()
        {
            Instance = this;
            Battle   = new VvVBattle(this);

            GuildStats = new Dictionary <Guild, VvVGuildStats>();
        }
Example #2
0
        public override void OnDoubleClick(Mobile m)
        {
            if (IsChildOf(m.Backpack))
            {
                VvVBattle battle = ViceVsVirtueSystem.Instance.Battle;

                if (!ViceVsVirtueSystem.IsVvV(m))
                {
                    m.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                }
                else if (battle == null || !battle.OnGoing || !battle.IsInActiveBattle(m))
                {
                    m.SendLocalizedMessage(1155406); // This item can only be used in an active VvV battle region!
                }
                else if (battle.TurretCount > VvVBattle.MaxTurrets)
                {
                    m.SendLocalizedMessage(1155502); // The turret limit for this battle has been reached!
                }
                else
                {
                    CannonTurret t = new CannonTurret(m);
                    t.MoveToWorld(m.Location, m.Map);

                    battle.Turrets.Add(t);

                    Delete();
                }
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            HasGenerated = reader.ReadBool();

            GuildStats = new Dictionary <Guild, VvVGuildStats>();
            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;
                }
            }
        }
Example #4
0
        public VvVBattleStatusGump(PlayerMobile pm, VvVBattle battle) : base(50, 50)
        {
            User   = pm;
            Battle = battle;

            AddGumpLayout();
        }
Example #5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

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

            switch (version)
            {
            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);
            }
        }
Example #6
0
        public VvVSigil(VvVBattle battle, Point3D home)
            : base(0x99C7)
        {
            Battle  = battle;
            Visible = false;

            LootType = LootType.Cursed;
        }
        public ViceVsVirtueSystem()
        {
            Instance = this;
            Battle   = new VvVBattle(this);

            GuildStats   = new Dictionary <Guild, VvVGuildStats>();
            ExemptCities = new List <VvVCity>();
        }
Example #8
0
        public static void DoOccupy(object obj)
        {
            object[] objs = obj as object[];
            VvVBattle battle = objs[0] as VvVBattle;
            Guild g = objs[1] as Guild;

            if (battle != null && g != null)
                battle.OccupyAltar(g);
        }
Example #9
0
        public VvVSigil(VvVBattle battle)
            : base(0x99C7)
        {
            Battle  = battle;
            Visible = false;

            Hue = 2721;

            LootType = LootType.Cursed;
        }
Example #10
0
        public static bool UnderEffects(Mobile m)
        {
            VvVBattle battle = ViceVsVirtueSystem.Instance.Battle;

            if (battle != null && battle.OnGoing && battle.ManaSpikeEndEffects != DateTime.MinValue && battle.ManaSpikeEndEffects > DateTime.UtcNow)
            {
                m.PrivateOverheadMessage(Network.MessageType.Regular, 1154, 1155500, m.NetState); // *Your body is too charged with electrical energy to hide!*
                return(true);
            }

            return(false);
        }
Example #11
0
        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 (ShowNewRules == null)
                        {
                            ShowNewRules = new List <PlayerMobile>();
                        }

                        ShowNewRules.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)
            {
                Timer.DelayCall(() =>
                {
                    CreateSilverTraders();
                });
            }
            else if (!Enabled && enabled)
            {
                DeleteSilverTraders();
            }

            if (EnhancedRules && !enhanced)
            {
                OnEnhancedRulesEnabled();
            }
        }
Example #12
0
        public BattleStatsGump(PlayerMobile pm, VvVBattle battle)
            : base(50, 50)
        {
            Battle = battle;
            BattleTeam leader  = battle.GetLeader();
            Guild      myGuild = pm.Guild as Guild;

            if (leader == null || leader.Guild == null || myGuild == null)
            {
                return;
            }

            AddBackground(0, 0, 500, 500, 9380);

            AddHtmlLocalized(0, 40, 500, 20, 1154645, "#1154945", Color16, false, false); // The Battle between Vice and Virtue has ended!
            AddHtml(40, 65, 420, 20, string.Format("<basefont color=#B22222>{0} [{1}] has won the battle!", leader.Guild.Name, leader.Guild.Abbreviation), false, false);

            int y = 90;

            if (leader.Guild.Alliance != null)
            {
                AddHtml(40, y, 420, 20, string.Format("<basefont color=#B22222>The {0} Alliance has won the battle!", leader.Guild.Alliance.Name), false, false);
                y += 25;
            }

            BattleTeam team = Battle.GetTeam(myGuild);

            //TODO: Are totals the PLAYERS OVERALL totals, or the guild/alliance totals for that battle???  Or that players totals for that battle

            /*silver += (int)ViceVsVirtueSystem.Instance.GetPoints(pm);
             *
             * VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry<VvVPlayerEntry>(pm);
             *
             * if (entry != null)
             * {
             *  score = entry.Score;
             * }*/

            AddHtmlLocalized(40, y, 420, 20, 1154947, team.Silver.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false); // Total Silver Points: ~1_val~
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154948, team.Score.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false); // Total Score: ~1_val~
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154949, team.Kills.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154950, team.Assists.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154951, team.Deaths.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154952, team.Stolen.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154953, team.ReturnedSigils.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154954, team.ViceReturned.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154955, team.VirtueReturned.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154956, team.Disarmed.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;
        }
        public BattleStatsGump(PlayerMobile pm, VvVBattle battle)
            : base(50, 50)
        {
            Battle = battle;
            AddBackground(0, 0, 500, 500, 9380);

            Guild leader  = battle.GetLeader();
            Guild myGuild = pm.Guild as Guild;

            if (leader == null || myGuild == null)
            {
                return;
            }

            AddHtmlLocalized(0, 40, 500, 20, 1154645, "#1154945", Color16, false, false); // The Battle between Vice and Virtue has ended!
            AddHtml(40, 65, 420, 20, String.Format("<basefont color=#B22222>{0} [{1}] has won the battle!", leader.Name, leader.Abbreviation), false, false);

            int y = 90;

            if (leader.Alliance != null && Battle.HasAlliance(leader))
            {
                AddHtml(40, y, 420, 20, String.Format("<basefont color=#B22222>The {0} Alliance has won the battle!", leader.Alliance.Name), false, false);
                y += 25;
            }

            // TODO: Does score reflect everyone, alliance, or just that player! For now, it will be entire alliance

            int          silver = 0, score = 0, kills = 0, assists = 0, deaths = 0, stolen = 0, returned = 0, vicereturned = 0, virtuereturned = 0, disarmed = 0;
            List <Guild> alliance = Battle.GetAlliance(myGuild);

            foreach (Guild g in alliance)
            {
                VvVGuildBattleStats stats = Battle.GetGuildStats(g);

                kills          += stats.Kills;
                assists        += stats.Assists;
                deaths         += stats.Deaths;
                stolen         += stats.Stolen;
                returned       += stats.ReturnedSigils;
                vicereturned   += stats.ViceReturned;
                virtuereturned += stats.VirtueReturned;
                disarmed       += stats.Disarmed;
            }

            silver += (int)ViceVsVirtueSystem.Instance.GetPoints(pm);

            VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry <VvVPlayerEntry>(pm);

            if (entry != null)
            {
                score = entry.Score;
            }

            AddHtmlLocalized(40, y, 420, 20, 1154947, silver.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false); // Total Silver Points: ~1_val~
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154948, score.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false); // Total Score: ~1_val~
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154949, kills.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154950, assists.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154951, deaths.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154952, stolen.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154953, returned.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154954, vicereturned.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154955, virtuereturned.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;

            AddHtmlLocalized(40, y, 420, 20, 1154956, disarmed.ToString("N0", CultureInfo.GetCultureInfo("en-US")), Color16, false, false);
            y += 25;
        }
Example #14
0
        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;

            switch (version)
            {
            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();
            }
        }
Example #15
0
        public VvVAltar(VvVBattle battle)
        {
            Battle = battle;

            Braziers = new List <Item>();
            Torches  = new List <Item>();

            int virtue = Utility.Random(8);

            AddComponent(new AddonComponent(1822), -2, -2, 0);
            AddComponent(new AddonComponent(1822), -1, -2, 0);
            AddComponent(new AddonComponent(1822), 0, -2, 0);
            AddComponent(new AddonComponent(1822), 1, -2, 0);
            AddComponent(new AddonComponent(1822), 2, -2, 0);

            AddComponent(new AddonComponent(1822), -2, -1, 0);
            AddComponent(new AddonComponent(1822), -1, -1, 0);
            AddComponent(new AddonComponent(1822), 0, -1, 0);
            AddComponent(new AddonComponent(1822), 1, -1, 0);
            AddComponent(new AddonComponent(1822), 2, -1, 0);

            AddComponent(new AddonComponent(1822), -2, 0, 0);
            AddComponent(new AddonComponent(1822), -1, 0, 0);
            AddComponent(new AddonComponent(1822), 0, 0, 0);
            AddComponent(new AddonComponent(1822), 1, 0, 0);
            AddComponent(new AddonComponent(1822), 2, 0, 0);

            AddComponent(new AddonComponent(1822), -2, 1, 0);
            AddComponent(new AddonComponent(1822), -1, 1, 0);
            AddComponent(new AddonComponent(1822), 0, 1, 0);
            AddComponent(new AddonComponent(1822), 1, 1, 0);
            AddComponent(new AddonComponent(1822), 2, 1, 0);

            AddComponent(new AddonComponent(1822), -2, 2, 0);
            AddComponent(new AddonComponent(1822), -1, 2, 0);
            AddComponent(new AddonComponent(1822), 0, 2, 0);
            AddComponent(new AddonComponent(1822), 1, 2, 0);
            AddComponent(new AddonComponent(1822), 2, 2, 0);

            //NorthWest
            AddComponent(new AddonComponent(_Tiles[0][virtue]), -2, -2, 5);
            AddComponent(new AddonComponent(_Tiles[0][virtue] + 1), -2, -1, 5);
            AddComponent(new AddonComponent(_Tiles[0][virtue] + 2), -1, -1, 5);
            AddComponent(new AddonComponent(_Tiles[0][virtue] + 3), -1, -2, 5);

            // SouthEast
            AddComponent(new AddonComponent(_Tiles[0][virtue]), 1, 1, 5);
            AddComponent(new AddonComponent(_Tiles[0][virtue] + 1), 1, 2, 5);
            AddComponent(new AddonComponent(_Tiles[0][virtue] + 2), 2, 2, 5);
            AddComponent(new AddonComponent(_Tiles[0][virtue] + 3), 2, 1, 5);

            //SouthWest
            AddComponent(new AddonComponent(_Tiles[1][virtue]), -2, 1, 5);
            AddComponent(new AddonComponent(_Tiles[1][virtue] + 1), -1, 1, 5);
            AddComponent(new AddonComponent(_Tiles[1][virtue] + 2), -2, 2, 5);
            AddComponent(new AddonComponent(_Tiles[1][virtue] + 3), -1, 2, 5);

            //NorthEast
            AddComponent(new AddonComponent(_Tiles[1][virtue]), 1, -2, 5);
            AddComponent(new AddonComponent(_Tiles[1][virtue] + 1), 2, -2, 5);
            AddComponent(new AddonComponent(_Tiles[1][virtue] + 2), 1, -1, 5);
            AddComponent(new AddonComponent(_Tiles[1][virtue] + 3), 2, -1, 5);

            AddComponent(new AddonComponent(1866), -1, -3, 0);
            AddComponent(new AddonComponent(1847), 0, -3, 0);
            AddComponent(new AddonComponent(1868), 1, -3, 0);

            AddComponent(new AddonComponent(1868), 3, -1, 0);
            AddComponent(new AddonComponent(1846), 3, 0, 0);
            AddComponent(new AddonComponent(1867), 3, 1, 0);

            AddComponent(new AddonComponent(1869), -1, 3, 0);
            AddComponent(new AddonComponent(1823), 0, 3, 0);
            AddComponent(new AddonComponent(1867), 1, 3, 0);

            AddComponent(new AddonComponent(1866), -3, -1, 0);
            AddComponent(new AddonComponent(1865), -3, 0, 0);
            AddComponent(new AddonComponent(1869), -3, 1, 0);

            AddonComponent c = new AddonComponent(6570);

            AddComponent(c, 3, -3, 0);
            Braziers.Add(c);

            c = new AddonComponent(6570);
            AddComponent(c, 3, 3, 0);
            Braziers.Add(c);

            c = new AddonComponent(6570);
            AddComponent(c, -3, 3, 0);
            Braziers.Add(c);

            c = new AddonComponent(6570);
            AddComponent(c, -3, -3, 0);
            Braziers.Add(c);
        }
Example #16
0
        public override void OnDoubleClick(Mobile m)
        {
            if (IsChildOf(m.Backpack))
            {
                VvVBattle battle = ViceVsVirtueSystem.Instance.Battle;

                if (!ViceVsVirtueSystem.IsVvV(m))
                {
                    m.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                }
                else if (battle == null || battle.Region == null || !battle.OnGoing || !battle.IsInActiveBattle(m))
                {
                    m.SendLocalizedMessage(1155406); // This item can only be used in an active VvV battle region!
                }
                else if (battle.NextManaSpike > DateTime.UtcNow)
                {
                    m.SendLocalizedMessage(1155497); // The ground is too charged to use a mana spike!
                }
                else if (m.Mana < 50)
                {
                    m.SendLocalizedMessage(1155509); // You lack the mana required to use this.
                }
                else
                {
                    m.FixedParticles(0x37C4, 1, 8, 9916, 39, 3, EffectLayer.CenterFeet);
                    m.FixedParticles(0x37C4, 1, 8, 9502, 39, 4, EffectLayer.CenterFeet);
                    m.PlaySound(0x210);
                    m.PrivateOverheadMessage(Network.MessageType.Regular, 1154, 1155499, m.NetState); // *You drive the spike into the ground!*

                    Timer.DelayCall(TimeSpan.FromMilliseconds(250), () =>
                    {
                        if (m.Mana < 50)                     // Another mana check!
                        {
                            m.SendLocalizedMessage(1155509); // You lack the mana required to use this.
                            return;
                        }

                        m.Mana = 0;

                        battle.NextManaSpike       = DateTime.UtcNow + TimeSpan.FromMinutes(5);
                        battle.ManaSpikeEndEffects = DateTime.UtcNow + TimeSpan.FromMinutes(2); // TODO: Duration?

                        foreach (Mobile mobile in battle.Region.GetEnumeratedMobiles())
                        {
                            if (ViceVsVirtueSystem.IsEnemy(mobile, m))
                            {
                                mobile.RevealingAction();

                                mobile.BoltEffect(0);
                                AOS.Damage(mobile, m, Utility.RandomMinMax(50, 75), 0, 0, 0, 0, 100);

                                mobile.PrivateOverheadMessage(Network.MessageType.Regular, 1154, 1155498, mobile.NetState); // *Your body convulses as energy surges through it!*
                            }
                        }

                        Delete();
                    });
                }
            }
            else
            {
                m.SendLocalizedMessage(1042004); // That must be in your pack for you to use it.
            }
        }
Example #17
0
 public VvVPriest(VvVType type, VvVBattle battle) : base(type == VvVType.Vice ? "the Priest of Vice" : "the Priest of Virtue")
 {
     VvVType = type;
     Battle  = battle;
 }
Example #18
0
 public VvVBattleStatusGump(PlayerMobile pm, VvVBattle battle) : base(pm, 50, 50)
 {
     Battle = battle;
 }