Пример #1
0
        public RemoveTrapTimer(Mobile from, TreasureMapChest chest, bool gmRemover)
            : base(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10))
        {
            From      = from;
            Chest     = chest;
            GMRemover = gmRemover;

            if (gmRemover)
            {
                TimeSpan duration;

                switch ((TreasureLevel)chest.Level)
                {
                default:
                case TreasureLevel.Stash: duration = TimeSpan.FromSeconds(20); break;

                case TreasureLevel.Supply: duration = TimeSpan.FromSeconds(60); break;

                case TreasureLevel.Cache: duration = TimeSpan.FromSeconds(180); break;

                case TreasureLevel.Hoard: duration = TimeSpan.FromSeconds(420); break;

                case TreasureLevel.Trove: duration = TimeSpan.FromSeconds(540); break;
                }

                SafetyEndTime = Chest.DigTime + duration;
            }

            Start();
        }
Пример #2
0
        protected override void BeginLockpick(Mobile from, ILockpickable item)
        {
            if (from is PlayerMobile &&
                item.Locked &&
                QuestHelper.HasQuest <TheTreasureChaseQuest>((PlayerMobile)from) &&
                item is TreasureMapChest &&
                ((TreasureMapChest)item).TreasureMap is BuriedRichesTreasureMap)
            {
                TreasureMapChest chest = (TreasureMapChest)item;

                from.PlaySound(0x241);

                Timer.DelayCall(TimeSpan.FromMilliseconds(200), () =>
                {
                    if (item.Locked && from.InRange(chest.GetWorldLocation(), 1))
                    {
                        from.CheckTargetSkill(SkillName.Lockpicking, item, 0, 100);

                        // Success! Pick the lock!
                        from.PrivateOverheadMessage(MessageType.Regular, 1154, 1158252, from.NetState); // *Your recent study of Treasure Hunting helps you pick the lock...*
                        chest.SendLocalizedMessageTo(from, 502076);                                     // The lock quickly yields to your skill.
                        from.PlaySound(0x4A);
                        item.LockPick(from);
                    }
                });
            }
            else
            {
                base.BeginLockpick(from, item);
            }
        }
Пример #3
0
            public RemoveGump(Mobile from, TreasureMapChest chest) : base(15, 15)
            {
                m_From  = from;
                m_Chest = chest;

                Closable   = false;
                Disposable = false;

                AddPage(0);

                AddBackground(30, 0, 240, 240, 2620);

                AddHtmlLocalized(
                    45,
                    15,
                    200,
                    80,
                    1048125,
                    0xFFFFFF
                    );                                                // When this treasure chest is removed, any items still inside of it will be lost.
                AddHtmlLocalized(45, 95, 200, 60, 1048126, 0xFFFFFF); // Are you certain you're ready to remove this chest?

                AddButton(40, 153, 4005, 4007, 1);
                AddHtmlLocalized(75, 155, 180, 40, 1048127, 0xFFFFFF); // Remove the Treasure Chest

                AddButton(40, 195, 4005, 4007, 2);
                AddHtmlLocalized(75, 197, 180, 35, 1006045, 0xFFFFFF); // Cancel
            }
Пример #4
0
        public void Target(TrapableContainer item)
        {
            if (!Caster.CanSee(item))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (item.TrapType != TrapType.None && item.TrapType != TrapType.MagicTrap)
            {
                base.DoFizzle();
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, item);

                Point3D loc = item.GetWorldLocation();

                Effects.SendLocationParticles(EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5015);
                Effects.PlaySound(loc, item.Map, 0x1F0);

                TreasureMapChest chest = item as TreasureMapChest;

                double skill = Caster.Skills[SkillName.Magery].Value;

                if ((chest != null && skill >= 100.0 && chest.TrapLevel <= 2) || (chest == null && ((item.TrapCreator == null && item.TrapLevel <= (int)(skill / 33.3)) || (item.TrapCreator != null && item.TrapLevel <= (int)(skill / 20.0)))))
                {
                    //Treasure Chests: Must be GM, up to level 2
                    //Non Treasure Chests:  Up to level 3, Player constructed, up to level 5.
                    item.TrapType  = TrapType.None;
                    item.TrapPower = 0;
                    item.TrapLevel = 0;
                }
            }

            FinishSequence();
        }
Пример #5
0
        public override void AddComponents()
        {
            IronGate gate = new IronGate(DoorFacing.EastCCW);

            m_Gate = gate;

            gate.KeyValue = Key.RandomValue();
            gate.Locked   = true;

            AddItem(gate, -2, 1, 0);

            MetalChest chest = new MetalChest();

            chest.ItemID = 0xE7C;
            chest.DropItem(new Key(KeyType.Iron, gate.KeyValue));
            chest.LiftOverride = true;

            TreasureMapChest.FillOld(chest, 2);

            AddItem(chest, 4, 4, 0);

            AddMobile(new Orc(), 15, 0, -2, 0);
            AddMobile(new Orc(), 15, 0, 1, 0);
            AddMobile(new OrcishMage(), 15, 0, -1, 0);
            AddMobile(new OrcCaptain(), 15, 0, 0, 0);

            m_Prisoner = new Engines.Quests.BaseEscort();

            m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);

            AddMobile(m_Prisoner, 2, -2, 0, 0);
        }
Пример #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            Chest = reader.ReadItem() as TreasureMapChest;
        }
Пример #7
0
            public RemoveEntry(Mobile from, TreasureMapChest chest) : base(6149, 3)
            {
                m_From  = from;
                m_Chest = chest;

                Enabled = from == chest.Owner;
            }
Пример #8
0
        public override void OnChestOpened(Mobile from, TreasureMapChest chest)
        {
            if (from is PlayerMobile)
            {
                var quest = QuestHelper.GetQuest <TheTreasureChaseQuest>((PlayerMobile)from);

                if (quest != null)
                {
                    if (Level == 0)
                    {
                        TownCryerSystem.CompleteQuest((PlayerMobile)from, 1158239, 1158251, 0x655);

                        /*Your eyes widen as you pry open the old chest and reveal the treasure within! Even this small cache
                         * excites you as the thought of bigger and better treasure looms on the horizon! The map is covered
                         * in ancient runes and marks the location of another treasure hoard. You carefully furl the map and
                         * set off on your next adventure!*/

                        from.SendLocalizedMessage(1158245, "", 0x23); // You have found the first zealot treasure! As you dig up the chest a leather bound case appears to contain an additional map. You place it in your backpack for later examination.
                        chest.DropItem(new BuriedRichesTreasureMap(1));
                    }
                    else
                    {
                        from.SendLocalizedMessage(1158246, "", 0x23); // You have found the second zealot treasure! As you dig up the chest a leather bound case appears to contain an additional map. You place it in your backpack for later examination.
                        quest.CompleteQuest();
                    }
                }
            }
        }
Пример #9
0
        private Item GiveAward()
        {
            if (0.05 > Utility.RandomDouble())
            {
                switch (Utility.Random(4))
                {
                case 0: return(new ExpiredVoucher());

                case 1: return(new ForgedArtwork());

                case 2: return(new LittleBlackBook());

                case 3: return(new SlimsShadowVeil());
                }
            }

            switch (Utility.Random(3))
            {
            default:
            case 0:
                return(new Skeletonkey());

            case 1:
                Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, false, true);

                int min, max;
                TreasureMapChest.GetRandomItemStat(out min, out max, 1.0);

                RunicReforging.GenerateRandomItem(item, 0, min, max, Map);
                return(item);

            case 2:
                return(ScrollOfTranscendence.CreateRandom(1, 10));
            }
        }
Пример #10
0
        public override void AddComponents()          /// In this section you can define any item and have it place in the camp x,y,z location.
        {
            ChestLevel1 chest    = new ChestLevel1(); ////Chest level 1-6 This is gonna decide what it looks like.
            FirePit     firepit  = new FirePit();     //// Camps firepit.
            Campfire    campfire = new Campfire();    //// The fire in the pit.

            firepit.ItemID  = 0xFAC;
            campfire.ItemID = 0xDE3;

            TreasureMapChest.Fill(chest, 1);      //// Chest level 1-6 This decides what kinda loot inside.

            AddItem(chest, 4, 4, 0);              //// Adding items to the ground around the spawner. (x,y,z)
            AddItem(firepit, 0, 0, 0);
            AddItem(campfire, 0, 0, 1);

            AddMobile(new Orc(), 15, 2, -2, 0);              /// Adding mobs to the area around the spawner.  (WanderRange,x,y,z)
            AddMobile(new Orc(), 15, -2, -2, 0);
            AddMobile(new OrcCaptain(), 15, 2, 2, 0);
            AddMobile(new OrcishLord(), 15, -2, 2, 0);

            switch (Utility.Random(2))                ////  This is used for adding random mobs to the camp.
            {
            case 0: m_mob = new Ogre(); break;

            case 1: m_mob = new Ettin(); break;
            }

            AddMobile(m_mob, 15, -2, 0, 0);               /// This decides where to place the random mob. (WanderRange,x,y,z)
        }
        public override void AddComponents()
        {
            ChestLevel5 chest = new ChestLevel5();

            TreasureMapChest.Fill(chest, 5);      // Treasure level 5

            AddItem(chest, 0, 0, 0);              // This is where the box will spawn away from center if you like
        }
Пример #12
0
        private void AddCampChests(IronGate gate)
        {
            LockableContainer chest = null;

            chest = new MetalChest();

            chest.ItemID       = 3708;
            chest.LiftOverride = true;

            TreasureMapChest.Fill(chest, 1);
            chest.DropItem(new Key(KeyType.Iron, gate.KeyValue));

            AddItem(chest, 4, 4, 1);

            LockableContainer crates = null;

            switch (Utility.Random(4))
            {
            case 0: crates = new SmallCrate(); break;

            case 1: crates = new MediumCrate(); break;

            case 2: crates = new LargeCrate(); break;

            default: crates = new LockableBarrel(); break;
            }

            crates.TrapType  = TrapType.ExplosionTrap;
            crates.TrapPower = Utility.RandomMinMax(30, 40);
            crates.TrapLevel = 2;

            crates.RequiredSkill = 76;
            crates.LockLevel     = 66;
            crates.MaxLockLevel  = 116;
            crates.Locked        = true;

            crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
            crates.DropItem(new Arrow(10));
            crates.DropItem(new Bolt(10));

            crates.LiftOverride = true;

            if (Utility.RandomDouble() < 0.8)
            {
                switch (Utility.Random(4))
                {
                case 0: crates.DropItem(new LesserCurePotion()); break;

                case 1: crates.DropItem(new LesserExplosionPotion()); break;

                case 2: crates.DropItem(new LesserHealPotion()); break;

                default: crates.DropItem(new LesserPoisonPotion()); break;
                }
            }

            AddItem(crates, 2, 2, 0);
        }
Пример #13
0
        public static void StartChestDisarmTimer(Mobile from, TreasureMapChest chest)
        {
            if (_Table == null)
            {
                _Table = new Dictionary <Mobile, RemoveTrapTimer>();
            }

            _Table[from] = new RemoveTrapTimer(from, chest, from.Skills[SkillName.RemoveTrap].Value >= 100);
        }
Пример #14
0
        public static bool IsDisarming(Mobile from, TreasureMapChest chest)
        {
            if (_Table == null)
            {
                return(false);
            }

            return(_Table.ContainsKey(from));
        }
Пример #15
0
        public static bool IsBeingDisarmed(TreasureMapChest chest)
        {
            if (_Table == null)
            {
                return(false);
            }

            return(_Table.Values.Any(timer => timer.Chest == chest));
        }
Пример #16
0
    private void AddCampChests()
    {
      var chest = Utility.Random(3) switch
      {
        0 => (LockableContainer)new MetalChest(),
        1 => new MetalGoldenChest(),
        _ => new WoodenChest()
      };

      chest.LiftOverride = true;

      TreasureMapChest.Fill(chest, 1);

      AddItem(chest, 2, -2, 0);

      var crates = Utility.Random(4) switch
      {
        0 => (LockableContainer)new SmallCrate(),
        1 => new MediumCrate(),
        2 => new LargeCrate(),
        _ => new LockableBarrel()
      };

      crates.TrapType = TrapType.ExplosionTrap;
      crates.TrapPower = Utility.RandomMinMax(30, 40);
      crates.TrapLevel = 2;

      crates.RequiredSkill = 76;
      crates.LockLevel = 66;
      crates.MaxLockLevel = 116;
      crates.Locked = true;

      crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
      crates.DropItem(new Arrow(10));
      crates.DropItem(new Bolt(10));

      crates.LiftOverride = true;

      if (Utility.RandomDouble() < 0.8)
        switch (Utility.Random(4))
        {
          case 0:
            crates.DropItem(new LesserCurePotion());
            break;
          case 1:
            crates.DropItem(new LesserExplosionPotion());
            break;
          case 2:
            crates.DropItem(new LesserHealPotion());
            break;
          default:
            crates.DropItem(new LesserPoisonPotion());
            break;
        }

      AddItem(crates, -2, 2, 0);
    }
Пример #17
0
        protected override void OnExpansionChanged(Expansion old)
        {
            base.OnExpansionChanged(old);

            if (m_Chest == null || m_Filled)
            {
                return;
            }

            TreasureMapChest.Fill(m_Chest, 2, Expansion);
            m_Filled = true;
        }
Пример #18
0
        private void AddCampChests()
        {
            LockableContainer chest = Utility.Random(3) switch
            {
                0 => new MetalChest(),
                1 => new MetalGoldenChest(),
                _ => new WoodenChest()
            };

            chest.LiftOverride = true;

            TreasureMapChest.Fill(chest, 1);

            AddItem(chest, -2, -2, 0);

            LockableContainer crates = Utility.Random(4) switch
            {
                0 => new SmallCrate(),
                1 => new MediumCrate(),
                2 => new LargeCrate(),
                _ => new LockableBarrel()
            };

            crates.TrapType  = TrapType.ExplosionTrap;
            crates.TrapPower = Utility.RandomMinMax(30, 40);
            crates.TrapLevel = 2;

            crates.RequiredSkill = 76;
            crates.LockLevel     = 66;
            crates.MaxLockLevel  = 116;
            crates.Locked        = true;

            crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
            crates.DropItem(new Arrow(10));
            crates.DropItem(new Bolt(10));

            crates.LiftOverride = true;

            crates.DropItem(
                Utility.Random(5) switch
            {
                0 => new LesserCurePotion(),
                1 => new LesserExplosionPotion(),
                2 => new LesserHealPotion(),
                3 => new LesserPoisonPotion(),
                _ => null     // 4
            }
Пример #19
0
        public override void AddComponents()
        {
            BaseCreature bc;

            IronGate gate = new IronGate(DoorFacing.EastCCW);

            m_Gate = gate;

            gate.KeyValue = Key.RandomValue();
            gate.Locked   = true;

            AddItem(gate, -2, 1, 0);

            MetalChest chest = new MetalChest();

            chest.ItemID       = 0xE7C;
            chest.LiftOverride = true;
            chest.DropItem(new Key(KeyType.Iron, gate.KeyValue));

            TreasureMapChest.Fill(chest, 2);

            AddItem(chest, 4, 4, 1);

            AddMobile(new Orc(), 15, 0, -2, 0);
            AddMobile(new Orc(), 15, 0, 1, 0);
            AddMobile(new OrcishMage(), 15, 0, -1, 0);
            AddMobile(new OrcCaptain(), 15, 0, 0, 0);

            switch (Utility.Random(2))
            {
            case 0: m_Prisoner = new BaseEscortable(); break;

            case 1: m_Prisoner = new BaseEscortable(); break;
            }

            bc                 = (BaseCreature)m_Prisoner;
            bc.IsPrisoner      = true;
            m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);

            AddMobile(m_Prisoner, 2, -2, 0, 0);
        }
Пример #20
0
        public override void AddComponents()
        {
            IronGate gate = new IronGate(DoorFacing.EastCCW);

            m_Gate = gate;

            gate.KeyValue = Key.RandomValue();
            gate.Locked   = true;

            AddItem(gate, -2, 1, 0);

            MetalChest chest = new MetalChest();

            chest.ItemID = 0xE7C;
            chest.DropItem(new Key(KeyType.Iron, gate.KeyValue));
            chest.LiftOverride = true;

            TreasureMapChest.Fill(chest, 2);

            AddItem(chest, 4, 4, 0);

            AddMobile(new Ratman(), 15, 0, -2, 0);
            AddMobile(new Ratman(), 15, 0, 1, 0);
            AddMobile(new RatmanMage(), 15, 0, -1, 0);
            AddMobile(new RatmanArcher(), 15, 0, 0, 0);

            switch (Utility.Random(2))
            {
            case 0:
                m_Prisoner = new Noble();
                break;

            case 1:
                m_Prisoner = new SeekerOfAdventure();
                break;
            }

            m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);

            AddMobile(m_Prisoner, 2, -2, 0, 0);
        }
Пример #21
0
        public virtual void Fill()
        {
            Reset();

            List <Item> contains = new List <Item>(Items);

            foreach (Item item in contains)
            {
                item.Delete();
            }

            ColUtility.Free(contains);

            for (int i = 0; i < Utility.RandomMinMax(6, 12); i++)
            {
                DropItem(Loot.RandomGem());
            }

            DropItem(new Gold(Utility.RandomMinMax(800, 1100)));

            if (0.1 > Utility.RandomDouble())
            {
                DropItem(new StasisChamberPowerCore());
            }

            if (0.1 > Utility.RandomDouble())
            {
                DropItem(new CardOfSemidar((CardOfSemidar.CardType)Utility.RandomMinMax(0, 5)));
            }

            if (0.25 > Utility.RandomDouble())
            {
                DropItem(new InoperativeAutomatonHead());
            }

            if (0.1 > Utility.RandomDouble() && Server.Engines.Points.PointsSystem.TreasuresOfKotlCity.Enabled)
            {
                Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(this), LootPackEntry.IsMondain(this), LootPackEntry.IsStygian(this));

                if (item != null)
                {
                    int min, max;

                    TreasureMapChest.GetRandomItemStat(out min, out max, 1.0);

                    RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(min, max), 0, ReforgedPrefix.None, ReforgedSuffix.Kotl, Map);

                    DropItem(item);
                }
            }

            if (0.25 > Utility.RandomDouble())
            {
                Item item;

                switch (Utility.Random(8))
                {
                default:
                case 0: item = new JournalDrSpector1(); break;

                case 1: item = new JournalDrSpector2(); break;

                case 2: item = new JournalDrSpector3(); break;

                case 3: item = new JournalDrSpector4(); break;

                case 4: item = new HistoryOfTheGreatWok1(); break;

                case 5: item = new HistoryOfTheGreatWok2(); break;

                case 6: item = new HistoryOfTheGreatWok3(); break;

                case 7: item = new HistoryOfTheGreatWok4(); break;
                }

                DropItem(item);
            }
        }
Пример #22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from.Region is UOACZRegion)
                {
                    if (targeted is UOACZScavengeContainer || targeted is UOACZScavengeDebris)
                    {
                        UOACZBaseScavengeObject scavengeObject = targeted as UOACZBaseScavengeObject;

                        scavengeObject.RemoveTrap(from);
                    }

                    else
                    {
                        from.SendMessage("That cannot be trapped.");
                    }

                    return;
                }

                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x4D3); //0x241

                    if (targ is BaseTreasureChest)
                    {
                        BaseTreasureChest tchest = targ as BaseTreasureChest;

                        double minSkill = 35.0 + ((int)tchest.Level * 10.0); // 45, 55, 65, 75, 85, 95
                        double maxSkill = 60.0 + ((int)tchest.Level * 10.0); // 70, 80, 90, 100, 110, 120

                        // chance to open l5 at gm: 60%
                        // chance to open l6 at gm: 20%

                        if (from.Skills.RemoveTrap.Value < minSkill && (int)tchest.Level == 1)
                        {
                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);

                            from.CheckTargetSkill(SkillName.RemoveTrap, targ, 0, 100, 1.0);
                            from.SendMessage("You fail to safely remove the trap.");

                            return;
                        }

                        else if (from.Skills.RemoveTrap.Value < minSkill)
                        {
                            from.SendMessage("You do not have sufficient skill to attempt the removal of that trap.");
                            return;
                        }

                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);

                        if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minSkill, maxSkill, 1.0))
                        {
                            RemoveTrap(from, targ);
                        }

                        else
                        {
                            from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                        }
                    }


                    else if (targ is TreasureMapChest)
                    {
                        TreasureMapChest tchest = targ as TreasureMapChest;

                        double minSkill = TreasureMapChest.RemoveTrapSkillRequiredPerLevel[tchest.Level];
                        double maxSkill = TreasureMapChest.RemoveTrapSkillMaxPerLevel[tchest.Level];

                        if (from.Skills.RemoveTrap.Value < minSkill)
                        {
                            from.SendMessage("You do not have sufficient skill to attempt the removal of that trap.");
                            return;
                        }

                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);

                        if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minSkill, maxSkill, 1.0))
                        {
                            RemoveTrap(from, targ);
                        }

                        else
                        {
                            from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                        }
                    }

                    else if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 40, 1.0))
                    {
                        RemoveTrap(from, targ);
                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);
                    }

                    else
                    {
                        from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.RemoveTrapCooldown * 1000);
                    }
                }

                else
                {
                    from.SendLocalizedMessage(502373);                       // That does'nt appear to be trapped
                }
            }
Пример #23
0
        public override void GenerateLoot()
        {
            if (Core.UOAI || Core.UOAR)
            {
                PackGold(350, 500);
                PackGem();

                // TODO: jewelry, dungeon chest, healthy gland

                // Category 3 MID
                PackMagicItem(1, 2, 0.10);
                PackMagicItem(1, 2, 0.05);
            }
            else
            {
                if (Core.UOSP || Core.UOMO)
                {                       // page not found for 02 2002
                                        // http://web.archive.org/web/20021015005145/uo.stratics.com/hunters/plaguebeast.shtml
                                        // 600 - 1000 Gold, Gem, Armor, Magic Jewelry, Lootable Dungeon Chest, a healthy gland
                    if (Spawning)
                    {
                        PackGold(600, 1000);
                    }
                    else
                    {
                        PackGem(Utility.Random(1, 3));

                        PackArmor(1, 2, 0.10);

                        PackMagicJewelry(1, 2, 0.10);

                        // http://web.archive.org/web/20021015005145/uo.stratics.com/hunters/plaguebeast.shtml
                        // "and in the chest i got 2 vanqs, one durable supreme acc silver broad of vanq, and a dur/vanq mace."
                        // In the later docs we see that it's a metal chest
                        // http://uo.stratics.com/database/view.php?db_content=hunters&id=276
                        // "When killed, its corpse may contain a metal chest if it has devoured enough corpses."

                        /* General Information
                         * This hideous creature will strike with poisonous attacks, and other slimy creatures will spawn out of it,
                         * in the form of purple colored earth elementals, headless ones, people, gorillas, serpents and slimes,
                         * all known as "plague spawn".
                         * It will devour the corpses of the ones it slayed, and will turn human corpses into a pile of bones instantly.
                         * When killed, it's corpse may contain a dungeon chest, which can be looted, but not removed.
                         */

                        // we still need to verify the dopp rate and loot. For now just give a level 3 chest
                        // we will make this really rare since we need to verify so much
                        // note, the chest is not supposed to be movable, yet making it non movable prevents it from dropping
                        //	from the plaguebeast. *sigh*
                        //	also this chest is supposed to be related to the corpses eaten - more corpses, better loot
                        if (0.001 > Utility.RandomDouble() && false)
                        {
                            Container chest = new MetalGoldenChest();
                            TreasureMapChest.Fill((chest as LockableContainer), 3);
                            chest.Movable = true;
                            PackItem(chest);
                        }

                        // TODO: dungeon chest, healthy gland
                    }
                }
                else
                {                       // Standard RunUO
                    AddLoot(LootPack.FilthyRich);
                    AddLoot(LootPack.Gems, Utility.Random(1, 3));
                    // TODO: dungeon chest, healthy gland
                }
            }
        }
Пример #24
0
        public override Item Construct(Type type, Mobile from, Item tool)
        {
            // Searing Weapon Support, handled elsewhere
            if (type == typeof(BaseWeapon))
            {
                return(null);
            }

            if (type == typeof(TreasureMap))
            {
                return(new TreasureMap(0, from.Map == Map.Felucca ? Map.Felucca : Map.Trammel));
            }
            else if (type == typeof(MessageInABottle))
            {
                return(new MessageInABottle(from.Map == Map.Felucca ? Map.Felucca : Map.Trammel));
            }
            else if (type == typeof(WhitePearl))
            {
                return(new WhitePearl());
            }

            Container pack = from.Backpack;

            if (pack != null)
            {
                List <SOS> messages = pack.FindItemsByType <SOS>();

                for (int i = 0; i < messages.Count; ++i)
                {
                    SOS sos = messages[i];

                    if ((from.Map == Map.Felucca || from.Map == Map.Trammel) && from.InRange(sos.TargetLocation, 60))
                    {
                        Item preLoot = null;
                        bool dredge  = HasTypeHook(tool, HookType.Dredging);

                        switch (Utility.Random(17))
                        {
                        case 0:     // Body parts
                        case 1:
                        {
                            int[] list = new int[]
                            {
                                0x1CDD, 0x1CE5,        // arm
                                0x1CE0, 0x1CE8,        // torso
                                0x1CE1, 0x1CE9,        // head
                                0x1CE2, 0x1CEC         // leg
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list), dredge);
                            break;
                        }

                        case 2:     // Bone parts
                        case 3:
                        {
                            int[] list = new int[]
                            {
                                0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4,                         // skulls
                                0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles
                                0x1B15, 0x1B16                                                  // pelvis bones
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list), dredge);
                            break;
                        }

                        case 4:     // Paintings and portraits
                        case 5:
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10), dredge);
                            break;
                        }

                        case 6:     // Pillows
                        case 7:
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11), dredge);
                            break;
                        }

                        case 8:     // Shells
                        case 9:
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9), dredge);
                            break;
                        }

                        case 10:     //Hats
                        case 11:
                        {
                            if (Utility.RandomBool())
                            {
                                preLoot = new SkullCap();
                            }
                            else
                            {
                                preLoot = new TricorneHat();
                            }

                            break;
                        }

                        case 12:     // Misc
                        case 13:
                        {
                            int[] list = new int[]
                            {
                                0x1EB5,                        // unfinished barrel
                                0xA2A,                         // stool
                                0xC1F,                         // broken clock
                                0x1047, 0x1048,                // globe
                                0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4 // barrel staves
                            };

                            if (Utility.Random(list.Length + 1) == 0)
                            {
                                preLoot = new Candelabra();
                            }
                            else
                            {
                                preLoot = new ShipwreckedItem(Utility.RandomList(list), dredge);
                            }

                            break;
                        }

                            #region High Seas
                        case 14:
                        {
                            int[] list = new int[]
                            {
                                0x1E19, 0x1E1A, 0x1E1B,         //Fish heads
                                0x1E2A, 0x1E2B,                 //Oars
                                0x1E71, 0x1E7A,                 //Unfinished drawers
                                0x1E75,                         //Unfinished legs
                            };

                            double ran = Utility.RandomDouble();

                            if (ran < 0.05)
                            {
                                preLoot = new YellowPolkaDotBikini();
                            }
                            else if (ran < 0.25)
                            {
                                preLoot = new ShipwreckedItem(list[Utility.RandomMinMax(3, 7)], dredge);
                            }
                            else
                            {
                                preLoot = new ShipwreckedItem(list[Utility.Random(3)], dredge);
                            }
                            break;
                        }
                            #endregion
                        }

                        if (preLoot != null)
                        {
                            if (preLoot is IShipwreckedItem)
                            {
                                ((IShipwreckedItem)preLoot).IsShipwreckedItem = true;
                            }

                            return(preLoot);
                        }

                        LockableContainer chest;

                        if (0.01 > Utility.RandomDouble())
                        {
                            chest = new ShipsStrongbox(sos.Level);
                        }
                        else
                        {
                            switch (sos.Level)
                            {
                            case 0: chest = new SOSChest(Utility.RandomBool() ? 0xE43 : 0xE41); break;

                            case 1: chest = new SOSChest(0xA306); break;

                            case 2: chest = new SOSChest(Utility.RandomBool() ? 0xE43 : 0xE41); break;

                            case 3: chest = new SOSChest(0xA308); break;

                            default:
                                if (.33 > Utility.RandomDouble())
                                {
                                    chest = new SOSChest(0xA30A);
                                }
                                else
                                {
                                    chest     = new SOSChest(Utility.RandomBool() ? 0xE41 : 0xE43);
                                    chest.Hue = 0x481;
                                }
                                break;
                            }
                        }

                        TreasureMapChest.Fill(from, chest, Math.Max(1, Math.Min(4, sos.Level)), true);
                        sos.OnSOSComplete(chest);

                        if (sos.IsAncient)
                        {
                            chest.DropItem(new FabledFishingNet());
                        }
                        else
                        {
                            chest.DropItem(new SpecialFishingNet());
                        }

                        chest.Movable   = true;
                        chest.Locked    = false;
                        chest.TrapType  = TrapType.None;
                        chest.TrapPower = 0;
                        chest.TrapLevel = 0;

                        chest.IsShipwreckedItem = true;

                        sos.Delete();

                        return(chest);
                    }
                }
            }

            return(base.Construct(type, from, tool));
        }
Пример #25
0
        public override Item Construct(Type type, Mobile from)
        {
            if (type == typeof(TreasureMap))
            {
                int level;
                if (from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland(from))
                {
                    level = 0;
                }
                else
                {
                    level = 1;
                }

                return(new TreasureMap(level, from.Map == Map.Felucca ? Map.Felucca : Map.Trammel));
            }
            else if (type == typeof(MessageInABottle))
            {
                return(new MessageInABottle(SafeMap(from.Map)));
            }

            Container pack = from.Backpack;

            if (pack != null)
            {
                Item[] messages = pack.FindItemsByType(typeof(SOS));

                for (int i = 0; i < messages.Length; ++i)
                {
                    SOS sos = (SOS)messages[i];

                    if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60))
                    {
                        Item preLoot = null;

                        switch (Utility.Random(7))
                        {
                        case 0:                                 // Body parts
                        {
                            int[] list = new int[]
                            {
                                0x1CDD, 0x1CE5,                                                // arm
                                0x1CE0, 0x1CE8,                                                // torso
                                0x1CE1, 0x1CE9,                                                // head
                                0x1CE2, 0x1CEC                                                 // leg
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 1:                                 // Bone parts
                        {
                            int[] list = new int[]
                            {
                                0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4,                         // skulls
                                0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles
                                0x1B15, 0x1B16                                                  // pelvis bones
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 2:                                 // Paintings and portraits
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10));
                            break;
                        }

                        case 3:                                 // Pillows
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11));
                            break;
                        }

                        case 4:                                 // Shells
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9));
                            break;
                        }

                        case 5:                                 // Misc
                        {
                            int[] list = new int[]
                            {
                                0x1EB5,                                                // unfinished barrel
                                0xA2A,                                                 // stool
                                0xC1F,                                                 // broken clock
                                0x1047, 0x1048,                                        // globe
                                0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4                         // barrel staves
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }
                        }

                        if (preLoot != null)
                        {
                            return(preLoot);
                        }

                        sos.Delete();

                        WoodenChest chest = new WoodenChest();

                        TreasureMapChest.Fill(chest, Utility.RandomMinMax(1, 3));

                        // TODO: Are there chances on this? All MIB's I've done had nets..
                        chest.DropItem(new SpecialFishingNet());

                        chest.Movable   = true;
                        chest.Locked    = false;
                        chest.TrapType  = TrapType.None;
                        chest.TrapPower = 0;

                        return(chest);
                    }
                }
            }

            return(base.Construct(type, from));
        }
Пример #26
0
        public override void AddComponents()
        {
            IronGate gate = new IronGate(DoorFacing.EastCCW);

            m_Gate = gate;

            gate.KeyValue = Key.RandomValue();
            gate.Locked   = true;

            AddItem(gate, -2, 1, 0);

            MetalChest chest = new MetalChest();

            chest.ItemID       = 0xE7C;
            chest.LiftOverride = true;
            chest.DropItem(new Key(KeyType.Iron, gate.KeyValue));

            TreasureMapChest.Fill(chest, 3); //<---------Loot

            AddItem(chest, 4, 4, 1);         //<------z +1 to hover over static
            switch (Utility.Random(4))
            {
            case 0:
            {
                AddMobile(new Orc(), 15, 0, -2, 0);
                AddMobile(new OrcishMage(), 15, 0, 1, 0);
                AddMobile(new OrcishLord(), 15, 0, -2, 0);
                AddMobile(new OrcCaptain(), 15, 0, 1, 0);
                AddMobile(new Orc(), 15, 0, -1, 0);
                AddMobile(new OrcChopper(), 15, 0, -2, 0);
            } break;

            case 1:
            {
                AddMobile(new Ratman(), 15, 0, -2, 0);
                AddMobile(new Ratman(), 15, 0, 1, 0);
                AddMobile(new RatmanMage(), 15, 0, -2, 0);
                AddMobile(new Ratman(), 15, 0, 1, 0);
                AddMobile(new RatmanArcher(), 15, 0, -1, 0);
                AddMobile(new Ratman(), 15, 0, -2, 0);
            } break;

            case 2:
            {
                AddMobile(new Lizardman(), 15, 0, -2, 0);
                AddMobile(new Lizardman(), 15, 0, 1, 0);
                AddMobile(new Lizardman(), 15, 0, -2, 0);
                AddMobile(new Lizardman(), 15, 0, 1, 0);
                AddMobile(new Lizardman(), 15, 0, -1, 0);
                AddMobile(new Lizardman(), 15, 0, -2, 0);
            } break;

            case 3:
            {
                AddMobile(new Brigand(), 15, 0, -2, 0);
                AddMobile(new Brigand(), 15, 0, 1, 0);
                AddMobile(new Brigand(), 15, 0, -2, 0);
                AddMobile(new Brigand(), 15, 0, 1, 0);
                AddMobile(new Brigand(), 15, 0, -1, 0);
                AddMobile(new Brigand(), 15, 0, -2, 0);
            } break;
            }

            switch (Utility.Random(2))
            {
            case 0: m_Prisoner = new Noble(); break;

            case 1: m_Prisoner = new SeekerOfAdventure(); break;
            }

            m_Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);

            AddMobile(m_Prisoner, 2, -2, 0, 0);
        }
Пример #27
0
        private void AddCampChests()
        {
            LockableContainer chest = null;

            switch (Utility.Random(3))
            {
            case 0:
                chest = new MetalChest();
                break;

            case 1:
                chest = new MetalGoldenChest();
                break;

            default:
                chest = new WoodenChest();
                break;
            }

            chest.LiftOverride = true;

            TreasureMapChest.Fill(chest, Utility.Random(10, 40), Utility.Random(1, 2), false, Map.SerpentIsle); //UOSI draws random values for level and luck

            this.AddItem(chest, -2, 2, 0);

            LockableContainer crates = null;

            switch (Utility.Random(4))
            {
            case 0:
                crates = new SmallCrate();
                break;

            case 1:
                crates = new MediumCrate();
                break;

            case 2:
                crates = new LargeCrate();
                break;

            default:
                crates = new LockableBarrel();
                break;
            }

            crates.TrapType  = TrapType.ExplosionTrap;
            crates.TrapPower = Utility.RandomMinMax(30, 40);
            crates.TrapLevel = 2;

            crates.RequiredSkill = 76;
            crates.LockLevel     = 66;
            crates.MaxLockLevel  = 116;
            crates.Locked        = true;

            crates.DropItem(new Gold(Utility.RandomMinMax(100, 400)));
            crates.DropItem(new Arrow(10));
            crates.DropItem(new Bolt(10));

            crates.LiftOverride = true;

            if (Utility.RandomDouble() < 0.8)
            {
                switch (Utility.Random(4))
                {
                case 0:
                    crates.DropItem(new LesserCurePotion());
                    break;

                case 1:
                    crates.DropItem(new LesserExplosionPotion());
                    break;

                case 2:
                    crates.DropItem(new LesserHealPotion());
                    break;

                default:
                    crates.DropItem(new LesserPoisonPotion());
                    break;
                }
            }

            this.AddItem(crates, 2, -2, 0);
        }
Пример #28
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
                }
                else if (targeted is IRemoveTrapTrainingKit)
                {
                    ((IRemoveTrapTrainingKit)targeted).OnRemoveTrap(from);
                }
                else if (targeted is LockableContainer && ((LockableContainer)targeted).Locked)
                {
                    from.SendLocalizedMessage(501283); // That is locked.
                }
                else if (targeted is TrapableContainer)
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == Server.Items.TrapType.None)
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                    }
                    else if (targ is TreasureMapChest && TreasureMapInfo.NewSystem)
                    {
                        TreasureMapChest tChest = (TreasureMapChest)targ;

                        if (tChest.Owner != from)
                        {
                            from.SendLocalizedMessage(1159010); // That is not your chest!
                        }
                        else if (IsDisarming(from, tChest))
                        {
                            from.SendLocalizedMessage(1159059); // You are already manipulating the trigger mechanism...
                        }
                        else if (IsBeingDisarmed(tChest))
                        {
                            from.SendLocalizedMessage(1159063); // That trap is already being disarmed.
                        }
                        else if (tChest.AncientGuardians.Any(g => !g.Deleted))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, 1150, 1159060, from.NetState); // *Your attempt fails as the the mechanism jams and you are attacked by an Ancient Chest Guardian!*
                        }
                        else
                        {
                            from.PlaySound(0x241);

                            from.PrivateOverheadMessage(MessageType.Regular, 1150, 1159057, from.NetState); // *You delicately manipulate the trigger mechanism...*

                            StartChestDisarmTimer(from, tChest);
                        }
                    }
                    else
                    {
                        from.PlaySound(0x241);

                        if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower - 10, targ.TrapPower + 10))
                        {
                            targ.TrapPower = 0;
                            targ.TrapLevel = 0;
                            targ.TrapType  = TrapType.None;
                            targ.InvalidateProperties();
                            from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                        }
                    }
                }
                else if (targeted is VvVTrap)
                {
                    VvVTrap trap = targeted as VvVTrap;

                    if (!ViceVsVirtueSystem.IsVvV(from))
                    {
                        from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants!
                    }
                    else
                    {
                        if (from == trap.Owner || ((from.Skills[SkillName.RemoveTrap].Value - 80.0) / 20.0) > Utility.RandomDouble())
                        {
                            VvVTrapKit kit = new VvVTrapKit(trap.TrapType);
                            trap.Delete();

                            if (!from.AddToBackpack(kit))
                            {
                                kit.MoveToWorld(from.Location, from.Map);
                            }

                            if (trap.Owner != null && from != trap.Owner)
                            {
                                Guild fromG  = from.Guild as Guild;
                                Guild ownerG = trap.Owner.Guild as Guild;

                                if (fromG != null && fromG != ownerG && !fromG.IsAlly(ownerG) && ViceVsVirtueSystem.Instance != null &&
                                    ViceVsVirtueSystem.Instance.Battle != null && ViceVsVirtueSystem.Instance.Battle.OnGoing)
                                {
                                    ViceVsVirtueSystem.Instance.Battle.Update(from, UpdateType.Disarm);
                                }
                            }

                            from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1155413, from.NetState);
                        }
                        else if (.1 > Utility.RandomDouble())
                        {
                            trap.Detonate(from);
                        }
                    }
                }
                else if (targeted is GoblinFloorTrap)
                {
                    GoblinFloorTrap targ = (GoblinFloorTrap)targeted;

                    if (from.InRange(targ.Location, 3))
                    {
                        from.Direction = from.GetDirectionTo(targ);

                        if (targ.Owner == null)
                        {
                            Item item = new FloorTrapComponent();

                            if (from.Backpack == null || !from.Backpack.TryDropItem(from, item, false))
                            {
                                item.MoveToWorld(from.Location, from.Map);
                            }
                        }

                        targ.Delete();
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373); // That does'nt appear to be trapped
                }
            }
Пример #29
0
        public override Item Construct(Type type, Mobile from)
        {
            if (type == typeof(TreasureMap))
            {
                int level;
                if (from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland(from))
                {
                    level = 0;
                }
                else
                {
                    level = 1;
                }

                return(new TreasureMap(level, from.Map == Map.Felucca ? Map.Felucca : Map.Trammel));
            }
            else if (type == typeof(MessageInABottle))
            {
                return(new MessageInABottle(from.Map == Map.Felucca ? Map.Felucca : Map.Trammel));
            }

            Container pack = from.Backpack;

            if (pack != null)
            {
                List <SOS> messages = pack.FindItemsByType <SOS>();

                for (int i = 0; i < messages.Count; ++i)
                {
                    SOS sos = messages[i];

                    if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60))
                    {
                        Item preLoot = null;

                        switch (Utility.Random(8))
                        {
                        case 0:                                 // Body parts
                        {
                            int[] list = new int[]
                            {
                                0x1CDD, 0x1CE5,                                                // arm
                                0x1CE0, 0x1CE8,                                                // torso
                                0x1CE1, 0x1CE9,                                                // head
                                0x1CE2, 0x1CEC                                                 // leg
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 1:                                 // Bone parts
                        {
                            int[] list = new int[]
                            {
                                0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4,                         // skulls
                                0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles
                                0x1B15, 0x1B16                                                  // pelvis bones
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 2:                                 // Paintings and portraits
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10));
                            break;
                        }

                        case 3:                                 // Pillows
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11));
                            break;
                        }

                        case 4:                                 // Shells
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9));
                            break;
                        }

                        case 5:                                 //Hats
                        {
                            if (Utility.RandomBool())
                            {
                                preLoot = new SkullCap();
                            }
                            else
                            {
                                preLoot = new TricorneHat();
                            }

                            break;
                        }

                        case 6:                                 // Misc
                        {
                            int[] list = new int[]
                            {
                                0x1EB5,                                                // unfinished barrel
                                0xA2A,                                                 // stool
                                0xC1F,                                                 // broken clock
                                0x1047, 0x1048,                                        // globe
                                0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4                         // barrel staves
                            };

                            if (Utility.Random(list.Length + 1) == 0)
                            {
                                preLoot = new Candelabra();
                            }
                            else
                            {
                                preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            }

                            break;
                        }
                        }

                        if (preLoot != null)
                        {
                            if (preLoot is IShipwreckedItem)
                            {
                                ((IShipwreckedItem)preLoot).IsShipwreckedItem = true;
                            }

                            return(preLoot);
                        }

                        LockableContainer chest;

                        if (Utility.RandomBool())
                        {
                            chest = new MetalGoldenChest();
                        }
                        else
                        {
                            chest = new WoodenChest();
                        }

                        if (sos.IsAncient)
                        {
                            chest.Hue = 0x481;
                        }

                        TreasureMapChest.Fill(chest, Math.Max(1, Math.Max(4, sos.Level)));

                        if (sos.IsAncient)
                        {
                            chest.DropItem(new FabledFishingNet());
                        }
                        else
                        {
                            chest.DropItem(new SpecialFishingNet());
                        }

                        chest.Movable   = true;
                        chest.Locked    = false;
                        chest.TrapType  = TrapType.None;
                        chest.TrapPower = 0;
                        chest.TrapLevel = 0;

                        sos.Delete();

                        return(chest);
                    }
                }
            }

            return(base.Construct(type, from));
        }
Пример #30
0
        public override Item Construct(Type type, Mobile from)
        {
            if (type == typeof(TreasureMap))
            {
                int level;
                //if ( from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland( from ) )
                //	level = 0;
                //else
                level = 1;

                return(new TreasureMap(level, /*from.Map == Map.Felucca ?*/ Map.Felucca /* : Map.Trammel*/));
            }
            else if (type == typeof(MessageInABottle))
            {
                return(new MessageInABottle(/*from.Map == Map.Felucca ?*/ Map.Felucca /* : Map.Trammel*/));
            }

            Container pack = from.Backpack;

            if (pack != null)
            {
                List <SOS> messages = pack.FindItemsByType <SOS>();

                for (int i = 0; i < messages.Count; ++i)
                {
                    SOS sos = messages[i];

                    if (from.Map == sos.TargetMap && from.InRange(sos.TargetLocation, 60))
                    {
                        Item preLoot = null;

                        switch (Utility.Random(8))
                        {
                        case 0:                                 // Body parts
                        {
                            int[] list = new int[]
                            {
                                0x1CDD, 0x1CE5,                                                // arm
                                0x1CE0, 0x1CE8,                                                // torso
                                0x1CE1, 0x1CE9,                                                // head
                                0x1CE2, 0x1CEC                                                 // leg
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 1:                                 // Bone parts
                        {
                            int[] list = new int[]
                            {
                                0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4,                         // skulls
                                0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles
                                0x1B15, 0x1B16                                                  // pelvis bones
                            };

                            preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            break;
                        }

                        case 2:                                 // Paintings and portraits
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10));
                            break;
                        }

                        case 3:                                 // Pillows
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11));
                            break;
                        }

                        case 4:                                 // Shells
                        {
                            preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9));
                            break;
                        }

                        case 5:                                 //Hats
                        {
                            if (Utility.RandomBool())
                            {
                                preLoot = new SkullCap();
                            }
                            else
                            {
                                preLoot = new TricorneHat();
                            }

                            break;
                        }

                        case 6:                                 // Misc
                        {
                            int[] list = new int[]
                            {
                                0x1EB5,                                                // unfinished barrel
                                0xA2A,                                                 // stool
                                0xC1F,                                                 // broken clock
                                0x1047, 0x1048,                                        // globe
                                0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4                         // barrel staves
                            };

                            if (Utility.Random(list.Length + 1) == 0)
                            {
                                preLoot = new Candelabra();
                            }
                            else
                            {
                                preLoot = new ShipwreckedItem(Utility.RandomList(list));
                            }

                            break;
                        }
                        }

                        if (preLoot != null)
                        {
                            if (preLoot is IShipwreckedItem)
                            {
                                ((IShipwreckedItem)preLoot).IsShipwreckedItem = true;
                            }

                            return(preLoot);
                        }

                        LockableContainer chest = null;

                        switch (Utility.Random(3))
                        {
                        case 0: chest = new MetalGoldenChest(); break;

                        case 1: chest = new MetalChest(); break;

                        default:
                        case 2: chest = new WoodenChest(); break;
                        }

                        if (sos.IsAncient)
                        {
                            int hue = 1150;

                            if (0.20 > Utility.RandomDouble())
                            {
                                switch (Utility.Random((chest is WoodenChest) ? 6 : 14))
                                {
                                case 0: hue = 1193; break;

                                case 1: hue = 1281; break;

                                case 2: hue = 1190; break;

                                case 3: hue = 1165; break;

                                case 4: hue = 1160; break;

                                case 5: hue = 1126; break;

                                case 6: hue = CraftResources.GetInfo(CraftResource.Valorite).Hue; break;

                                case 7: hue = CraftResources.GetInfo(CraftResource.Verite).Hue; break;

                                case 8: hue = CraftResources.GetInfo(CraftResource.Agapite).Hue; break;

                                case 9: hue = CraftResources.GetInfo(CraftResource.Gold).Hue; break;

                                case 10: hue = CraftResources.GetInfo(CraftResource.Bronze).Hue; break;

                                case 11: hue = CraftResources.GetInfo(CraftResource.Copper).Hue; break;

                                case 12: hue = CraftResources.GetInfo(CraftResource.ShadowIron).Hue; break;

                                case 13: hue = CraftResources.GetInfo(CraftResource.DullCopper).Hue; break;
                                }
                            }

                            chest.Hue = hue;
                        }
                        else if ((chest is MetalChest || chest is MetalGoldenChest) && (0.5 * sos.Level) >= Utility.RandomDouble())
                        {
                            int           randhue  = Utility.Random(120);
                            CraftResource resource = CraftResource.None;

                            if (randhue >= 118)
                            {
                                resource = CraftResource.Valorite;
                            }
                            else if (randhue >= 115)
                            {
                                resource = CraftResource.Verite;
                            }
                            else if (randhue >= 110)
                            {
                                resource = CraftResource.Agapite;
                            }
                            else if (randhue >= 100)
                            {
                                resource = CraftResource.Gold;
                            }
                            else if (randhue >= 90)
                            {
                                resource = CraftResource.Bronze;
                            }
                            else if (randhue >= 70)
                            {
                                resource = CraftResource.Copper;
                            }
                            else if (randhue >= 40)
                            {
                                resource = CraftResource.ShadowIron;
                            }
                            else
                            {
                                resource = CraftResource.DullCopper;
                            }

                            chest.Hue = CraftResources.GetInfo(resource).Hue;
                        }

                        int soslevel = Math.Max(1, Math.Max(4, sos.Level));

                        TreasureMapChest.Fill(chest, soslevel);

                        if (sos.IsAncient)
                        {
                            chest.DropItem(new FabledFishingNet());
                        }
                        else
                        {
                            chest.DropItem(new SpecialFishingNet());
                        }

                        chest.Movable           = true;
                        chest.Locked            = false;
                        chest.Name              = "treasure chest";
                        chest.IsShipwreckedItem = true;

                        if (sos.Level > 0)
                        {
                            chest.TrapType  = TrapType.ExplosionTrap;
                            chest.TrapPower = soslevel * Utility.RandomMinMax(5, 15);
                            chest.TrapLevel = 0;
                        }
                        else
                        {
                            chest.TrapType  = TrapType.None;
                            chest.TrapPower = 0;
                            chest.TrapLevel = 0;
                        }

                        sos.Delete();

                        return(chest);
                    }
                }
            }

            return(base.Construct(type, from));
        }