コード例 #1
0
        public override void OnDoubleClick(Mobile from)
        {
            CheckCooldown();

            if (IsChildOf(from.Backpack))
            {
                ViceVsVirtueSystem sys = ViceVsVirtueSystem.Instance;

                if (sys != null)
                {
                    if (!ViceVsVirtueSystem.IsVvV(from))
                    {
                        from.SendLocalizedMessage(1155415); // Only participants in Vice vs Virtue may use this item.
                    }
                    else if (!sys.Battle.OnGoing || !from.Region.IsPartOf(sys.Battle.Region))
                    {
                        from.SendLocalizedMessage(1155406); // This item can only be used in an active VvV battle region!
                    }
                    else if (sys.Battle.TrapCount >= VvVBattle.MaxTraps)
                    {
                        from.SendLocalizedMessage(1155407); // The trap limit for this battle has been reached!
                    }
                    else if (_Cooldown != null && _Cooldown.ContainsKey(from))
                    {
                        from.SendLocalizedMessage(1155408); // You must wait a few moments before attempting to place another trap.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1155409); // Where do you want to place the trap?
                        from.BeginTarget(2, true, Server.Targeting.TargetFlags.None, (m, targeted) =>
                        {
                            IPoint3D p = targeted as IPoint3D;

                            if (p != null)
                            {
                                if (!sys.Battle.OnGoing || !m.Region.IsPartOf(sys.Battle.Region))
                                {
                                    m.SendLocalizedMessage(1155406); // This item can only be used in an active VvV battle region!
                                }
                                else if (sys.Battle.Traps.Count >= VvVBattle.MaxTraps)
                                {
                                    m.SendLocalizedMessage(1155407); // The trap limit for this battle has been reached!
                                }
                                else if (!from.InLOS(p))
                                {
                                    m.SendLocalizedMessage(1042261); // You cannot place the trap there.
                                }
                                else
                                {
                                    TryDeployTrap(m, new Point3D(p));
                                }
                            }
                            else
                            {
                                m.SendLocalizedMessage(1042261); // You cannot place the trap there.
                            }
                        });
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1042004); // That must be in your pack for you to use it
            }
        }
コード例 #2
0
        public VvVBattle(GenericReader reader, ViceVsVirtueSystem system)
        {
            int version = reader.ReadInt();

            System = system;

            Altars       = new List <VvVAltar>();
            KillCooldown = new Dictionary <Mobile, DateTime>();
            Messages     = new List <string>();
            Traps        = new List <VvVTrap>();
            Warned       = new List <Mobile>();
            Turrets      = new List <CannonTurret>();
            Teams        = new List <BattleTeam>();

            OnGoing = reader.ReadBool();

            if (reader.ReadInt() == 0)
            {
                StartTime           = reader.ReadDateTime();
                CooldownEnds        = reader.ReadDateTime();
                LastOccupationCheck = reader.ReadDateTime();
                NextSigilSpawn      = reader.ReadDateTime();
                NextAnnouncement    = reader.ReadDateTime();
                NextAltarActivate   = reader.ReadDateTime();
                City         = (VvVCity)reader.ReadInt();
                Sigil        = reader.ReadItem() as VvVSigil;
                VicePriest   = reader.ReadMobile() as VvVPriest;
                VirtuePriest = reader.ReadMobile() as VvVPriest;

                if (Sigil != null)
                {
                    Sigil.Battle = this;
                }

                if (VicePriest != null)
                {
                    VicePriest.Battle = this;
                }

                if (VirtuePriest != null)
                {
                    VirtuePriest.Battle = this;
                }

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    VvVAltar altar = reader.ReadItem() as VvVAltar;
                    if (altar != null)
                    {
                        altar.Battle = this;
                        Altars.Add(altar);
                    }
                }

                if (version == 1)
                {
                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        BattleTeam team = new BattleTeam(reader);
                        Teams.Add(team);
                    }
                }
                else
                {
                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        Guild g = reader.ReadGuild() as Guild;
                        VvVGuildBattleStats stats = new VvVGuildBattleStats(reader, g);
                    }
                }

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    VvVTrap t = reader.ReadItem() as VvVTrap;

                    if (t != null)
                    {
                        Traps.Add(t);
                    }
                }

                Timer.DelayCall(TimeSpan.FromSeconds(10), () =>
                {
                    if (Region is GuardedRegion)
                    {
                        GuardedRegion.Disable((GuardedRegion)Region);
                    }

                    BeginTimer();

                    ActivateArrows();
                });
            }
        }
コード例 #3
0
 public VvVBattle(ViceVsVirtueSystem sys)
 {
     System = sys;
 }
コード例 #4
0
ファイル: SilverTrader.cs プロジェクト: travismills82/TrueUO
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped.GetSocket <HonestyItemSocket>() != null)
            {
                return(base.OnDragDrop(from, dropped));
            }

            if (ViceVsVirtueSystem.IsVvV(from))
            {
                if (!(dropped is IOwnerRestricted) || ((IOwnerRestricted)dropped).Owner == from)
                {
                    if (dropped is IVvVItem && from.Race == Race.Gargoyle)
                    {
                        for (var index = 0; index < _Table.Length; index++)
                        {
                            Type[] t = _Table[index];

                            if (dropped.GetType() == t[0] && dropped is IDurability dur && dur.MaxHitPoints == 255 && dur.HitPoints == 255)
                            {
                                Item item = Loot.Construct(t[1]);

                                if (item != null)
                                {
                                    VvVRewards.OnRewardItemCreated(from, item);

                                    if (item is GargishCrimsonCincture cincture)
                                    {
                                        cincture.Attributes.BonusDex = 10;
                                    }

                                    if (item is GargishMaceAndShieldGlasses glasses)
                                    {
                                        glasses.Attributes.WeaponDamage = 10;
                                    }

                                    if (item is GargishFoldedSteelGlasses steelGlasses)
                                    {
                                        steelGlasses.Attributes.DefendChance = 25;
                                    }

                                    if (item is GargishWizardsCrystalGlasses crystalGlasses)
                                    {
                                        crystalGlasses.PhysicalBonus = 5;
                                        crystalGlasses.FireBonus     = 5;
                                        crystalGlasses.ColdBonus     = 5;
                                        crystalGlasses.PoisonBonus   = 5;
                                        crystalGlasses.EnergyBonus   = 5;
                                    }

                                    from.AddToBackpack(item);
                                    dropped.Delete();

                                    return(true);
                                }
                            }
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            SayTo(from, 1157365); // I'm sorry, I cannot accept this item.
            return(false);
        }
コード例 #5
0
 public override void OnMovement(Mobile m, Point3D oldLocation)
 {
     if (IsEnemy(m) && DeploymentType == DeploymentType.Proximaty && m.InRange(Location, 3) && ViceVsVirtueSystem.IsEnemy(m, Owner))
     {
         Detonate(m);
     }
 }
コード例 #6
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.
            }
        }
コード例 #7
0
ファイル: VvVPotions.cs プロジェクト: lishuoipad/ServUO
        public override void OnDoubleClick(Mobile m)
        {
            if (!Movable)
            {
                return;
            }

            if (IsChildOf(m.Backpack))
            {
                DateTime dt = DateTime.UtcNow;

                if (m.AccessLevel < AccessLevel.Counselor && ViceVsVirtueSystem.Enabled && !ViceVsVirtueSystem.IsVvV(m))
                {
                    m.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                }
                else if (!BasePotion.HasFreeHand(m))
                {
                    m.SendLocalizedMessage(502172); // You must have a free hand to drink a potion.
                }
                else if (IsInCooldown(m, ref dt))
                {
                    TimeSpan left = dt - DateTime.UtcNow;

                    if (left.TotalMinutes > 2)
                    {
                        m.SendLocalizedMessage(1114110, ((int)left.TotalMinutes).ToString()); // You must wait ~1_minutes~ minutes before using another one of these.
                    }
                    else
                    {
                        m.SendLocalizedMessage(1114109, ((int)left.TotalSeconds).ToString()); // You must wait ~1_seconds~ seconds before using another one of these.
                    }
                }
                else if (CheckUse(m))
                {
                    UseEffects(m);
                    Use(m);
                }
            }
            else
            {
                m.SendLocalizedMessage(1042004); // That must be in your pack for you to use it
            }
        }
コード例 #8
0
        public void CheckOccupation()
        {
            if (!OnGoing)
            {
                return;
            }

            if (Teams.Count == 1)
            {
                BattleTeam team = Teams[0];

                team.Score += (int)OccupyPoints;
                UpdateAllGumps();
                CheckScore();

                if (OnGoing && NextAnnouncement < DateTime.UtcNow)
                {
                    if (ViceVsVirtueSystem.EnhancedRules)
                    {
                        System.SendVvVMessage(string.Format("{0} is occupying {1}!", team.Guild.Name, City == VvVCity.SkaraBrae ? "Skara Brae" : City.ToString()));
                    }
                    else
                    {
                        System.SendVvVMessage(1154957, team.Guild.Name); // ~1_NAME~ is occupying the city!
                    }

                    NextAnnouncement = DateTime.UtcNow + TimeSpan.FromMinutes(Announcement);
                }
            }
            else // Is this a bug?  Verified on EA this is how it behaves
            {
                if (NextAnnouncement < DateTime.UtcNow)
                {
                    if (ViceVsVirtueSystem.EnhancedRules)
                    {
                        System.SendVvVMessage(1050039, string.Format("#{0}\tis unoccupied! Slay opposing forces to claim the city for your guild!", ViceVsVirtueSystem.GetCityLocalization(City).ToString()));
                    }
                    else
                    {
                        System.SendVvVMessage(1154958); // The City is unoccupied! Slay opposing forces to claim the city for your guild!
                    }

                    NextAnnouncement = DateTime.UtcNow + TimeSpan.FromMinutes(Announcement);
                }
            }
        }
コード例 #9
0
ファイル: SilverTrader.cs プロジェクト: Tauriella/ServUO-1
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (ViceVsVirtueSystem.IsVvV(from))
            {
                if (!(dropped is IOwnerRestricted) || ((IOwnerRestricted)dropped).Owner == from)
                {
                    if (dropped is IVvVItem && from.Race == Race.Gargoyle)
                    {
                        foreach (var t in _Table)
                        {
                            if (dropped.GetType() == t[0])
                            {
                                IDurability dur = dropped as IDurability;

                                if (dur != null && dur.MaxHitPoints == 255 && dur.HitPoints == 255)
                                {
                                    var item = Loot.Construct(t[1]);

                                    if (item != null)
                                    {
                                        VvVRewards.OnRewardItemCreated(from, item);

                                        if (item is GargishCrimsonCincture)
                                        {
                                            ((GargishCrimsonCincture)item).Attributes.BonusDex = 10;
                                        }

                                        if (item is GargishMaceAndShieldGlasses)
                                        {
                                            ((GargishMaceAndShieldGlasses)item).Attributes.WeaponDamage = 10;
                                        }

                                        if (item is GargishFoldedSteelGlasses)
                                        {
                                            ((GargishFoldedSteelGlasses)item).Attributes.DefendChance = 25;
                                        }

                                        if (item is GargishWizardsCrystalGlasses)
                                        {
                                            ((GargishWizardsCrystalGlasses)item).PhysicalBonus = 5;
                                            ((GargishWizardsCrystalGlasses)item).FireBonus     = 5;
                                            ((GargishWizardsCrystalGlasses)item).ColdBonus     = 5;
                                            ((GargishWizardsCrystalGlasses)item).PoisonBonus   = 5;
                                            ((GargishWizardsCrystalGlasses)item).EnergyBonus   = 5;
                                        }

                                        from.AddToBackpack(item);
                                        dropped.Delete();

                                        return(true);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            SayTo(from, 1157365); // I'm sorry, I cannot accept this item.
            return(false);
        }
コード例 #10
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            if (IsEnemy(m) && DeploymentType == DeploymentType.Proximaty && m.InRange(this.Location, 3) && ViceVsVirtueSystem.IsEnemy(m, Owner))
            {
                Detonate(m);
            }
            else if (m.InRange(this.Location, 8))
            {
                int skill = (int)m.Skills[SkillName.DetectHidden].Value;

                if (skill >= 80 && Utility.Random(600) < skill)
                {
                    this.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x21, 500813, m.NetState); // [trapped]
                }
            }
        }