Beispiel #1
0
            public DigTimer(Mobile from, TreasureMap treasureMap, Point3D p, Map map, int z, ChestThemeType m_type) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
            {
                m_From        = from;
                m_TreasureMap = treasureMap;
                m_Map         = map;
                m_Z           = z;
                type          = m_type;
                themed        = m_TreasureMap.m_Themed;

                if (themed == false)
                {
                    themed = TreasureTheme.GetIsThemed(m_TreasureMap.Level);
                }
                m_TreasureMap.m_Themed = themed;

                if (themed == true && type == ChestThemeType.None)
                {
                    type = (ChestThemeType)TreasureTheme.GetThemeType(m_TreasureMap.Level);
                }

                m_TreasureMap.m_type = type;
                m_Chest = new TreasureMapChest(from, m_TreasureMap.m_Level, themed, type);
                m_Chest.MoveToWorld(p, map);

                m_NextSkillTime  = from.NextSkillTime;
                m_NextSpellTime  = from.NextSpellTime;
                m_NextActionTime = from.NextActionTime;
                m_LastMoveTime   = from.LastMoveTime;
            }
Beispiel #2
0
        public OverlandTreasureHunter()
        {
            SpeechHue = Utility.RandomDyedHue();
            Title     = "the treasure hunter";

            SetStr(96, 115);
            SetDex(86, 105);
            SetInt(51, 65);

            SetDamage(23, 27);

            SetSkill(SkillName.Anatomy, 60.0, 82.5);
            SetSkill(SkillName.Wrestling, 88.5, 100.0);
            SetSkill(SkillName.MagicResist, 88.5, 100.0);
            SetSkill(SkillName.Tactics, 60.0, 82.5);

            Fame  = 2500;
            Karma = -2500;

            // Configure our treasuremap
            TreasureMap map = new TreasureMap(5, Map.Felucca);

            map.LootType = LootType.Newbied;
            map.Themed   = true;
            map.Theme    = TreasureTheme.RandomOverlandTheme();
            map.Decoder  = this;
            PackItem(map);

            // configure our distination (to the chest)
            Destination = new Point3D(map.ChestLocation, 0).ToString();

            Shovel shovel = new Shovel();

            shovel.LootType = LootType.Newbied;
            PackItem(shovel);

            Runebook book = new Runebook();

            book.LootType = LootType.Newbied;
            book.Name     = "Fromm's treasure hunting guide";
            AddItem(book);

            Item light = null;

            if (Utility.RandomBool())
            {
                light = new Lantern();
            }
            else
            {
                light = new Torch();
            }
            PackItem(light);

            // select a gem for payment
            m_GemIndex     = Utility.Random(TreasureMapChest.m_GemTypes.Length);
            m_GemsRequired = 50 * (2 + Utility.Random(9));             // 100-500

            PackItem(new Bandage(Utility.RandomMinMax(1, 15)));
        }
        private bool CheckLoot(Mobile m, bool criminalAction)
        {
            if (m_Owner == null || m == m_Owner)
            {
                return(true);
            }

            Party p = Party.Get(m_Owner);

            if (p != null && p.Contains(m))
            {
                return(true);
            }

            if (TreasureTheme.IsOverlandTheme(m_type) == true)
            {
                return(true);
            }

            Map map = this.Map;

            if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
            {
                if (criminalAction)
                {
                    m.CriminalAction(true);
                }
                else
                {
                    m.SendLocalizedMessage(1010630);                       // Taking someone else's treasure is a criminal offense!
                }
                return(true);
            }

            m.SendLocalizedMessage(1010631);               // You did not discover this chest!
            return(false);
        }
Beispiel #4
0
            protected override void OnTick()
            {
                if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime)
                {
                    Stop();
                    m_From.EndAction(typeof(TreasureMap));
                    m_Chest.Delete();
                }
                else if (m_LastMoveTime != m_From.LastMoveTime)
                {
                    m_From.SendLocalizedMessage(503023);                       // You cannot move around while digging up treasure. You will need to start digging anew.

                    Stop();
                    m_From.EndAction(typeof(TreasureMap));
                    m_Chest.Delete();
                }

                /*else if ( !m_Map.CanFit( m_Chest.X, m_Chest.Y, m_Z, 16, true, true ) )
                 * {
                 *      m_From.SendLocalizedMessage( 503024 ); // You stop digging because something is directly on top of the treasure chest.
                 *
                 *      Stop();
                 *      m_From.EndAction( typeof( TreasureMap ) );
                 *      m_Chest.Delete();
                 * }*/
                else
                {
                    m_From.RevealingAction();

                    m_Count++;

                    m_Chest.Location = new Point3D(m_Chest.Location.X, m_Chest.Location.Y, m_Chest.Location.Z + 1);
                    m_From.Direction = m_From.GetDirectionTo(m_Chest.GetWorldLocation());

                    if (m_Count == 14)
                    {
                        Stop();
                        m_From.EndAction(typeof(TreasureMap));

                        m_TreasureMap.Completed = true;


                        // checks to see if the map is a themed map and if so gets the theme type based on level of map
                        // and sends appropriate theme message/warning


                        // checks to see if the map is a themed map and already has a theme set
                        // and sends appropriate theme message/warning
                        if (themed == true && type != ChestThemeType.None)
                        {
                            m_From.SendMessage(TreasureTheme.GetThemeMessage(type));
                        }



                        if (m_TreasureMap.Level >= 2)
                        {
                            //generates 1 of the highest mobs for pirate or undead iob chests
                            TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, true);
                            //generates guardian spawn numbers based on if themed or not
                            for (int i = 0; i < TreasureTheme.GetGuardianSpawn(themed, type); ++i)
                            {
                                if (type == ChestThemeType.Undead || type == ChestThemeType.Pirate)
                                {
                                    //spawns rest of pirate or undead initial guardian spawn with out highest rank mobs appereing
                                    TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, false);
                                }
                                else
                                {
                                    //not pirate or undead chest spawn as per normal random guardians
                                    TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, false, false);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (m_From.Body.IsHuman && !m_From.Mounted)
                        {
                            m_From.Animate(11, 5, 1, true, false, 0);
                        }

                        new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start();
                    }
                }
            }
Beispiel #5
0
            protected override void OnTick()
            {
                if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime)
                {
                    Stop();
                    m_From.EndAction(typeof(TreasureMap));
                    m_Chest.Delete();
                }
                else if (m_LastMoveTime != m_From.LastMoveTime)
                {
                    m_From.SendLocalizedMessage(503023);                     // You cannot move around while digging up treasure. You will need to start digging anew.

                    Stop();
                    m_From.EndAction(typeof(TreasureMap));
                    m_Chest.Delete();
                }

                /*else if ( !m_Map.CanFit( m_Chest.X, m_Chest.Y, m_Z, 16, true, true ) )
                 * {
                 *      m_From.SendLocalizedMessage( 503024 ); // You stop digging because something is directly on top of the treasure chest.
                 *
                 *      Stop();
                 *      m_From.EndAction( typeof( TreasureMap ) );
                 *      m_Chest.Delete();
                 * }*/
                else
                {
                    m_From.RevealingAction();

                    m_Count++;

                    m_Chest.Location = new Point3D(m_Chest.Location.X, m_Chest.Location.Y, m_Chest.Location.Z + 1);
                    m_From.Direction = m_From.GetDirectionTo(m_Chest.GetWorldLocation());

                    if (m_Count == 14)
                    {
                        Stop();
                        m_From.EndAction(typeof(TreasureMap));

                        m_TreasureMap.Completed = true;

                        // checks to see if the map is a themed map and if so gets the theme type based on level of map
                        // and sends appropriate theme message/warning

                        // checks to see if the map is a themed map and already has a theme set
                        // and sends appropriate theme message/warning
                        if (themed == true && type != ChestThemeType.None)
                        {
                            m_From.SendMessage(TreasureTheme.GetThemeMessage(type));
                        }

                        if (m_TreasureMap.Level >= 2)
                        {
                            //generates 1 of the highest mobs for pirate or undead iob chests
                            TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, true);
                            //generates guardian spawn numbers based on if themed or not
                            for (int i = 0; i < TreasureTheme.GetGuardianSpawn(themed, type); ++i)
                            {
                                if (type == ChestThemeType.Undead || type == ChestThemeType.Pirate)
                                {
                                    //spawns rest of pirate or undead initial guardian spawn with out highest rank mobs appereing
                                    TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, false);
                                }
                                else
                                {
                                    //not pirate or undead chest spawn as per normal random guardians
                                    TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, false, false);
                                }
                            }

                            // 25% chance to spawn a a tax collector on a regular chest, 100% on themed chests
                            if (m_TreasureMap.Level > 3 && (Utility.RandomChance(25) || themed == true))
                            {
                                TaxCollector tc = new TaxCollector(m_Chest);
                                Point3D      px = Spawner.GetSpawnPosition(m_Chest.Map, m_Chest.Location, 25, false, true, Spawner.SpawnFlags.SpawnFar, tc);
                                if (px != m_Chest.Location)
                                {                                       // got a good location
                                    tc.MoveToWorld(px, m_Chest.Map);
                                }

                                // if we get a tax collector, add a chance to get an additional rare. The chance is calc in the rare drop code
                                // this chest 'hides' another treasure
                                m_Chest.SetFlag(TreasureMapChest.iFlags.Hides, true);
                            }
                        }
                    }
                    else
                    {
                        if (m_From.Body.IsHuman && !m_From.Mounted)
                        {
                            m_From.Animate(11, 5, 1, true, false, 0);
                        }

                        new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start();
                    }
                }
            }
        public override void OnItemLifted(Mobile from, Item item)
        {
            bool notYetLifted = !m_Lifted.Contains(item);

            from.RevealingAction();

            // prevent the player from milking the chest by removing 'one from a stack'
            if (notYetLifted)
            {
                ArrayList tx = new ArrayList(FindItemsByType(item.GetType(), true));
                tx.Remove(item);
                if (tx.Count > 0)
                {
                    foreach (Item ix in tx)
                    {
                        if (ix.Amount > 1)
                        {   // player looks to be removing one from a stack
                            // disqualify the one they lifted
                            m_Lifted.Add(item);
                            notYetLifted = false;
                            break;
                        }
                    }

                    // if they lifted >= 1, and left 1 disqualify the one they lifted
                    if (notYetLifted)
                    {
                        if (item.Amount > 1)
                        {
                            m_Lifted.Add(item);
                            notYetLifted = false;
                        }
                    }
                }
            }

            if (notYetLifted)
            {
                m_Lifted.Add(item);
                double chance = 0.1 * (Level * .5);

                if (IsThemed == true && 0.1 >= Utility.RandomDouble())
                {
                    // 10% chance to spawn 2 monsters as is a Themed chest
                    TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false);
                    TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false);
                }
                else if (IsThemed == false && chance >= Utility.RandomDouble())
                {
                    TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false);
                }

                // Adam: Insure IOB wearers are not stealing from their kin
                BaseCreature witness = null;
                if (CheckThief(from, out witness))
                {
                    from.SendMessage("You have been discovered stealing from your kin!");
                    if (from.Hidden)
                    {
                        from.RevealingAction();
                    }

                    // attack kin to make them come after you
                    from.DoHarmful(witness);
                }
            }

            base.OnItemLifted(from, item);
        }
        public static void Fill(LockableContainer cont, int level, bool IsThemed, ChestThemeType type)
        {
            cont.Movable = false;

            // the speial Overland Treasure Hunter NPC 'unlocks' the chest for you!
            if (TreasureTheme.IsOverlandTheme(type) == false)
            {
                cont.TrapType  = Utility.RandomBool() ? TrapType.PoisonTrap : TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.Locked    = true;
            }

            switch (level)
            {
            case 1: cont.RequiredSkill = 36; break;

            case 2: cont.RequiredSkill = 76; break;

            case 3: cont.RequiredSkill = 84; break;

            case 4: cont.RequiredSkill = 92; break;

            case 5: cont.RequiredSkill = 100; break;
            }

            cont.LockLevel    = cont.RequiredSkill - 10;
            cont.MaxLockLevel = cont.RequiredSkill + 40;

            // add theme loot
            AddThemeLoot(cont, level, type);

            // now for the gold
            cont.DropItem(new Gold(level * 1000));

            //if not a undead or pirate chest add scrolls
            if (type != ChestThemeType.Pirate || type != ChestThemeType.Undead)
            {
                // adam: Changed to drop scrolls appropriatre for the level.
                for (int i = 0; i < level * 5; ++i)
                {
                    int minCircle = level;
                    int maxCircle = (level + 3);
                    PackScroll(cont, minCircle, maxCircle);
                }
            }

            // magic armor and weapons
            int count = MagicArmsThrottle(level);                       // calc amount of magic armor and weapons to drop

            if (IsThemed == true)
            {
                count /= 2;                                                     // adam: Less loot if a themed chest because they get other goodies.
            }
            for (int i = 0; i < count; ++i)
            {
                Item item;
                item = Loot.RandomArmorOrShieldOrWeapon();
                item = Loot.ImbueWeaponOrArmor(item, level, 0.05, false);

                // erl: SDrop chance
                // ..
                if (Server.Engines.SDrop.SDropTest(item, CoreAI.EScrollChance))
                {
                    // Drop a scroll instead
                    EnchantedScroll escroll = Loot.GenEScroll((object)item);

                    // Delete the original item
                    item.Delete();

                    // Re-reference item to escroll and continue
                    item = (Item)escroll;
                }
                // ..

                cont.DropItem(item);
            }

            PackRegs(cont, level * 20);
            PackGems(cont, level * 10);
        }