Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            reader.ReadInt();

            Owner          = reader.ReadMobile();
            DeploymentType = (DeploymentType)reader.ReadInt();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                if (Links == null)
                {
                    Links = new List <VvVTrap>();
                }

                VvVTrap link = reader.ReadItem() as VvVTrap;

                if (link != null)
                {
                    Links.Add(link);
                }
            }

            ParentTrap = reader.ReadItem() as VvVTrap;
        }
Ejemplo n.º 2
0
        public bool SetTripwire(VvVTrapKit deed, Point3D myLocation, Point3D wireLocation, Map map)
        {
            Links = new List <VvVTrap>();

            MovementPath path = new MovementPath(myLocation, wireLocation, map);
            int          x    = myLocation.X;
            int          y    = myLocation.Y;

            if (path.Success)
            {
                for (int i = 0; i < path.Directions.Length; ++i)
                {
                    Movement.Movement.Offset(path.Directions[i], ref x, ref y);

                    Point3D p = new Point3D(x, y, Map.GetAverageZ(x, y));

                    if (p == myLocation)
                    {
                        continue;
                    }

                    VvVTrap trap = deed.ConstructTrap(Owner);
                    Links.Add(trap);
                    trap.ParentTrap = this;

                    trap.MoveToWorld(p, map);
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        public void TryDeployTrap(Mobile m, Point3D trapLocation)
        {
            VvVTrap trap = null;

            if (DeploymentType == DeploymentType.Tripwire)
            {
                m.SendLocalizedMessage(1155410); // Target the location to run the tripwire...
                m.BeginTarget(5, true, TargetFlags.None, (from, targeted) =>
                {
                    IPoint3D p = targeted as IPoint3D;

                    if (p != null)
                    {
                        Point3D point = new Point3D(p);

                        //TODO: Rules?  For now, must be within 3 tiles of trap
                        if (!Utility.InRange(point, trapLocation, 3) || point == trapLocation)
                        {
                            m.SendLocalizedMessage(1011577); // This is an invalid location.
                        }
                        else
                        {
                            trap = ConstructTrap(m);

                            if (!trap.SetTripwire(this, trapLocation, point, m.Map))
                            {
                                trap.Delete();
                                m.SendLocalizedMessage(1042261); // You cannot place the trap there.
                                return;
                            }
                            else
                            {
                                m.PrivateOverheadMessage(Network.MessageType.Regular, 1154, 1155411, m.NetState); // *You successfully lay the tripwire*
                            }
                        }
                    }
                    else
                    {
                        m.SendLocalizedMessage(1042261); // You cannot place the trap there.
                    }
                });
            }
            else
            {
                m.PrivateOverheadMessage(Network.MessageType.Regular, 1154, 1155412, m.NetState); // *You successfully set the trap*
                trap = ConstructTrap(m);
            }

            if (trap != null)
            {
                trap.MoveToWorld(trapLocation, m.Map);
                Delete();

                ViceVsVirtueSystem.Instance.Battle.Traps.Add(trap);

                AddToCooldown(m);
            }
        }
Ejemplo n.º 4
0
        public VvVBattle(GenericReader reader, ViceVsVirtueSystem system)
        {
            int version = reader.ReadInt();

            System = system;

            Altars       = new List <VvVAltar>();
            GuildStats   = new Dictionary <Guild, VvVGuildBattleStats>();
            KillCooldown = new Dictionary <Mobile, DateTime>();
            Participants = new List <Guild>();
            Messages     = new List <string>();
            Traps        = new List <VvVTrap>();
            Warned       = new List <Mobile>();
            Turrets      = new List <CannonTurret>();

            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);
                    }
                }

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

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

                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();
                });
            }
        }