示例#1
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);
        }
示例#2
0
            public InternalEntry(VvVTrapKit deed, Mobile m)
                : base(1155514, -1)
            {
                Deed    = deed;
                Clicker = m;

                if (!Deed.IsChildOf(m.Backpack))
                {
                    Enabled = false;
                }
            }
示例#3
0
        public override void OnConfirmed(CollectionItem citem, int index)
        {
            Item item;

            if (citem.Type == typeof(VvVPotionKeg))
            {
                PotionType type;

                switch (index)
                {
                default:
                case 0: type = PotionType.GreaterStamina; break;

                case 1: type = PotionType.Supernova; break;

                case 2: type = PotionType.StatLossRemoval; break;

                case 3: type = PotionType.AntiParalysis; break;
                }

                item = new VvVPotionKeg(type);
            }
            else if (citem.Type == typeof(VvVSteedStatuette))
            {
                SteedType type = index == 5 || index == 6 ? SteedType.WarHorse : SteedType.Ostard;

                item = new VvVSteedStatuette(type, citem.Hue);
            }
            else if (citem.Type == typeof(VvVTrapKit))
            {
                TrapType type;

                switch (index - 11)
                {
                default:
                case 0: type = TrapType.Poison; break;

                case 1: type = TrapType.Cold; break;

                case 2: type = TrapType.Energy; break;

                case 3: type = TrapType.Blade; break;

                case 4: type = TrapType.Explosion; break;
                }

                item = new VvVTrapKit(type);
            }
            else if (citem.Type == typeof(VvVRobe) || citem.Type == typeof(VvVHairDye))
            {
                item = Activator.CreateInstance(citem.Type, citem.Hue) as Item;
            }
            else if (citem.Type == typeof(ScrollofTranscendence))
            {
                item = ScrollofTranscendence.CreateRandom(10, 10);
            }
            else
            {
                item = Activator.CreateInstance(citem.Type) as Item;
            }

            if (item != null)
            {
                if (item is IOwnerRestricted)
                {
                    ((IOwnerRestricted)item).Owner = User;
                }

                if (item is IAccountRestricted && User.Account != null)
                {
                    ((IAccountRestricted)item).Account = User.Account.Username;
                }

                NegativeAttributes neg = RunicReforging.GetNegativeAttributes(item);

                if (neg != null)
                {
                    neg.Antique = 1;

                    if (item is IDurability && ((IDurability)item).MaxHitPoints == 0)
                    {
                        ((IDurability)item).MaxHitPoints = 255;
                        ((IDurability)item).HitPoints    = 255;
                    }
                }

                ViceVsVirtueSystem.Instance.AddVvVItem(item);

                if (User.Backpack == null || !User.Backpack.TryDropItem(User, item, false))
                {
                    User.SendLocalizedMessage(1074361); // The reward could not be given.  Make sure you have room in your pack.
                    item.Delete();
                }
                else
                {
                    if (User.AccessLevel == AccessLevel.Player)
                    {
                        PointsSystem.ViceVsVirtue.DeductPoints(User, citem.Points);
                    }

                    User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
                    User.PlaySound(0x5A7);
                }
            }
        }
示例#4
0
        public override void OnConfirmed(CollectionItem citem, int index)
        {
            Item item;

            if (citem.Type == typeof(VvVPotionKeg))
            {
                PotionType type;

                switch (index)
                {
                default:
                case 0: type = PotionType.GreaterStamina; break;

                case 1: type = PotionType.Supernova; break;

                case 2: type = PotionType.StatLossRemoval; break;

                case 3: type = PotionType.AntiParalysis; break;
                }

                item = new VvVPotionKeg(type);
            }
            else if (citem.Type == typeof(VvVSteedStatuette))
            {
                SteedType type = index == 5 || index == 6 ? SteedType.WarHorse : SteedType.Ostard;

                item = new VvVSteedStatuette(type, citem.Hue);
            }
            else if (citem.Type == typeof(VvVTrapKit))
            {
                VvVTrapType type;

                switch (index - 11)
                {
                default:
                case 0: type = VvVTrapType.Poison; break;

                case 1: type = VvVTrapType.Cold; break;

                case 2: type = VvVTrapType.Energy; break;

                case 3: type = VvVTrapType.Blade; break;

                case 4: type = VvVTrapType.Explosion; break;
                }

                item = new VvVTrapKit(type);
            }
            else if (citem.Type == typeof(VvVRobe) || citem.Type == typeof(VvVHairDye))
            {
                item = Activator.CreateInstance(citem.Type, citem.Hue) as Item;
            }
            else if (citem.Type == typeof(ScrollOfTranscendence))
            {
                item = ScrollOfTranscendence.CreateRandom(10, 10);
            }
            else
            {
                item = Activator.CreateInstance(citem.Type) as Item;
            }

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

                if (User.Backpack == null || !User.Backpack.TryDropItem(User, item, false))
                {
                    User.SendLocalizedMessage(1074361); // The reward could not be given.  Make sure you have room in your pack.
                    item.Delete();
                }
                else
                {
                    if (User.AccessLevel == AccessLevel.Player)
                    {
                        PointsSystem.ViceVsVirtue.DeductPoints(User, citem.Points);
                    }

                    User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
                    User.PlaySound(0x5A7);
                }
            }
        }