Exemplo n.º 1
0
        public Item CreateArtifact(Type[] list)
        {
            if (list.Length == 0)
            {
                return(null);
            }

            int random = Utility.Random(list.Length);

            Type type = list[random];

            Item artifact = Loot.Construct(type);

            return(artifact);
        }
Exemplo n.º 2
0
        public Item FindDisplayItem(Type t)
        {
            var item = GetDisplayItem(t);

            if (item == null)
            {
                item = Loot.Construct(t);

                if (item != null)
                {
                    AddDisplayItem(item);
                }
            }

            return(item);
        }
Exemplo n.º 3
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            int drop = Utility.RandomMinMax(2, 5);

            for (int i = 0; i < drop; i++)
            {
                Type pieType = m_Pies[Utility.Random(m_Pies.Length)];

                Item pie = Loot.Construct(pieType);

                if (pie != null)
                {
                    c.DropItem(pie);
                }
            }

            drop = Utility.RandomMinMax(2, 5);

            for (int i = 0; i < drop; i++)
            {
                Type steakType = m_Steaks[Utility.Random(m_Steaks.Length)];

                Item steak = Loot.Construct(steakType);

                if (steak != null)
                {
                    c.DropItem(steak);
                }
            }

            c.DropItem(new MessageInABottle(c.Map));
            c.DropItem(new SpecialFishingNet());
            c.DropItem(new SpecialFishingNet());
            c.DropItem(new SpecialFishingNet());
            c.DropItem(new SpecialFishingNet());

            FishingPole pole = new FishingPole();

            BaseRunicTool.ApplyAttributesTo(pole, false, 0, Utility.RandomMinMax(2, 5), 50, 100);
            c.DropItem(pole);

            #region TOL
            //SkillMasteryPrimer.CheckPrimerDrop(this);
            #endregion
        }
Exemplo n.º 4
0
    public virtual Item Construct()
    {
        var item = Loot.Construct(_types);

        if (item is Key key)
        {
            key.ItemID = Utility.RandomList(
                (int)KeyType.Copper,
                (int)KeyType.Gold,
                (int)KeyType.Iron,
                (int)KeyType.Rusty
                );
        }
        else if (item is Arrow or Bolt)
        {
            item.Amount = Utility.RandomMinMax(2, 6);
        }
Exemplo n.º 5
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (ViceVsVirtueSystem.IsVvV(from))
            {
                if (!(dropped is IOwnerRestricted) || ((IOwnerRestricted)dropped).Owner == from)
                {
                    if (dropped is IVvVItem && from.Race == Race.Gargoyle)
                    {
                        foreach (var t in _Table)
                        {
                            if (dropped.GetType() == t[0])
                            {
                                IDurability dur = dropped as IDurability;

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

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

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

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

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

            SayTo(from, 1157365); // I'm sorry, I cannot accept this item.
            return(false);
        }
Exemplo n.º 6
0
        private void TakeCommodities(Container c, Type type, ref int amount)
        {
            if (c == null)
            {
                return;
            }

            Item[]      items  = c.FindItemsByType(typeof(CommodityDeed));
            List <Item> toSell = new List <Item>();

            for (var index = 0; index < items.Length; index++)
            {
                Item item = items[index];

                if (item is CommodityDeed commodityDeed && commodityDeed.Commodity != null && commodityDeed.Commodity.GetType() == type)
                {
                    Item commodity = commodityDeed.Commodity;

                    if (commodity.Amount <= amount)
                    {
                        toSell.Add(item);
                        amount -= commodity.Amount;
                    }
                    else
                    {
                        CommodityDeed newDeed = new CommodityDeed();
                        Item          newItem = Loot.Construct(type);

                        newItem.Amount = amount;
                        newDeed.SetCommodity(newItem);

                        commodity.Amount -= amount;
                        commodityDeed.InvalidateProperties();
                        toSell.Add(newDeed);
                        amount = 0;
                    }
                }
            }

            for (var index = 0; index < toSell.Count; index++)
            {
                Item item = toSell[index];

                AddInventory(null, item);
            }
        }
Exemplo n.º 7
0
		public static Item CreateHeart()
		{			
			int count = ( m_DragonHeart.Length * 5 );
			int random = Utility.Random( count );
			Type type;
			
			if ( random < ( m_DragonHeart.Length * 5 ) )
			{
				type = m_DragonHeart[random / 5];
			}
			else
			{
				random -= m_DragonHeart.Length * 5;
				type = m_DragonHeart[random / 4];
			}
			
			return Loot.Construct( type );
		}
Exemplo n.º 8
0
        public Item CreateArtifact(Type[] list)
        {
            if (list.Length == 0)
            {
                return(null);
            }

            var type = list.RandomElement();

            var artifact = Loot.Construct(type);

            if (StatueTypes.Length > 0 && artifact is MonsterStatuette statuette)
            {
                statuette.Type     = StatueTypes.RandomElement();
                statuette.LootType = LootType.Regular;
            }

            return(artifact);
        }
Exemplo n.º 9
0
        public static void GiveArtifactTo(Mobile m)
        {
            Item item = Loot.Construct(m_Artifacts);

            if (item == null)
            {
                return;
            }

            // TODO: Confirm messages
            if (m.AddToBackpack(item))
            {
                m.SendMessage("As a reward for slaying the mighty leviathan, an artifact has been placed in your backpack.");
            }
            else
            {
                m.SendMessage("As your backpack is full, your reward for destroying the legendary leviathan has been placed at your feet.");
            }
        }
Exemplo n.º 10
0
        public UnknownMageSkeleton()
            : base(0xECA + Utility.Random(9))
        {
            Name   = "An Unknown Mage's Skeleton";
            Weight = 35.0;

            DropItem(new Robe(Utility.RandomNondyedHue()));
            DropItem(new Sandals());
            DropItem(Loot.RandomJewelry());

            if (Utility.RandomBool())
            {
                DropItem(new QuarterStaff());
            }
            else
            {
                DropItem(new GnarledStaff());
            }

            Item item;

            for (int i = 0; i < 3; i++)
            {
                item        = Loot.RandomReagent();
                item.Amount = Utility.RandomMinMax(15, 20);
                DropItem(item);
            }

            for (int i = 0; i < 3; i++)
            {
                if (0.25 >= Utility.RandomDouble())
                {
                    item = Loot.Construct(Loot.NecromancyScrollTypes);
                }
                else
                {
                    item = Loot.Construct(Loot.MageryScrollTypes);
                }

                item.Amount = Utility.RandomMinMax(1, 2);
                DropItem(item);
            }
        }
Exemplo n.º 11
0
        public virtual Item Construct()
        {
            Item item = Loot.Construct(m_Types);

            if (item is Key)
            {
                (item).ItemID = Utility.RandomList((int)KeyType.Copper, (int)KeyType.Gold, (int)KeyType.Iron, (int)KeyType.Rusty);
            }
            else if (item is Arrow || item is Bolt)
            {
                item.Amount = Utility.RandomMinMax(2, 6);
            }
            else if (item is Bandage || item is Lockpick)
            {
                item.Amount = Utility.RandomMinMax(1, 3);
            }

            return(item);
        }
Exemplo n.º 12
0
        public Item CreateArtifact(Type[] list)
        {
            if (list.Length == 0)
            {
                return(null);
            }

            int random = Utility.Random(list.Length);

            Type type = list[random];

            Item artifact = Loot.Construct(type);

            if (artifact is MonsterStatuette && StatueTypes.Length > 0)
            {
                ((MonsterStatuette)artifact).Type     = StatueTypes[Utility.Random(StatueTypes.Length)];
                ((MonsterStatuette)artifact).LootType = LootType.Regular;
            }
            return(artifact);
        }
Exemplo n.º 13
0
        private void TakeItems(Container c, Type type, ref int amount)
        {
            if (c == null)
            {
                return;
            }

            Item[]      items  = c.FindItemsByType(type);
            List <Item> toSell = new List <Item>();

            for (var index = 0; index < items.Length; index++)
            {
                Item item = items[index];

                if (amount <= 0)
                {
                    break;
                }

                if (item.Amount <= amount)
                {
                    toSell.Add(item);
                    amount -= item.Amount;
                }
                else
                {
                    Item newItem = Loot.Construct(type);
                    newItem.Amount = amount;
                    item.Amount   -= amount;
                    toSell.Add(newItem);
                    amount = 0;
                }
            }

            for (var index = 0; index < toSell.Count; index++)
            {
                Item item = toSell[index];

                AddInventory(null, item);
            }
        }
Exemplo n.º 14
0
        public override void OnDeath(Container c)
        {
            if (IsLastBoss)
            {
                List <DamageStore> rights = GetLootingRights();

                for (var index = 0; index < rights.Count; index++)
                {
                    DamageStore ds = rights[index];

                    if (ds.m_HasRight)
                    {
                        int luck = ds.m_Mobile is PlayerMobile mobile ? mobile.RealLuck : ds.m_Mobile.Luck;

                        int chance = 1000 + (luck / 15);

                        if (chance > Utility.Random(5000))
                        {
                            Mobile m        = ds.m_Mobile;
                            Item   artifact = Loot.Construct(ArtifactDrops[Utility.Random(ArtifactDrops.Length)]);

                            if (artifact != null)
                            {
                                if (m.Backpack == null || !m.Backpack.TryDropItem(m, artifact, false))
                                {
                                    m.BankBox.DropItem(artifact);
                                    m.SendMessage(
                                        "For your valor in combating the fallen beast, a special reward has been placed in your bank box.");
                                }
                                else
                                {
                                    m.SendLocalizedMessage(
                                        1062317); // For your valor in combating the fallen beast, a special reward has been bestowed on you.
                                }
                            }
                        }
                    }
                }
            }
            base.OnDeath(c);
        }
Exemplo n.º 15
0
        private bool GiveItems(Mobile from, Type type, int amt, StorageEntry entry)
        {
            int amount = amt;

            while (amount > 60000)
            {
                CommodityDeed deed = new CommodityDeed();
                Item          item = Loot.Construct(type);
                item.Amount = 60000;
                deed.SetCommodity(item);
                amount -= 60000;

                if (from.Backpack == null || !from.Backpack.TryDropItem(from, deed, false))
                {
                    deed.Delete();
                    return(false);
                }
                else
                {
                    entry.RemoveCommodity(type, 60000);
                }
            }

            CommodityDeed deed2 = new CommodityDeed();
            Item          item2 = Loot.Construct(type);

            item2.Amount = amount;
            deed2.SetCommodity(item2);

            if (from.Backpack == null || !from.Backpack.TryDropItem(from, deed2, false))
            {
                deed2.Delete();
                return(false);
            }
            else
            {
                entry.RemoveCommodity(type, amount);
            }

            return(true);
        }
Exemplo n.º 16
0
        public bool SubmitSolution(Mobile m, UnderworldPuzzleSolution solution)
        {
            if (m == null)
            {
                return(false);
            }

            if (solution.Matches(Solution))
            {
                Item item = Loot.Construct(m_Rewards[Utility.Random(m_Rewards.Length)]);

                if (item != null)
                {
                    if (item is VoidEssence || item is SilverSerpentVenom || item is ToxicVenomSac)
                    {
                        item.Amount = 30;
                    }

                    if (item is LuckyCoin)
                    {
                        item.Amount = Utility.RandomMinMax(2, 6);
                    }

                    if (m.Backpack == null || !m.Backpack.TryDropItem(m, item, false))
                    {
                        m.BankBox.DropItem(item);
                    }
                }

                m.PlaySound(0x3D);
                m.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1113579, m.NetState); // Correct Code Entered. Crystal Lock Disengaged.

                Delete();
                return(true);
            }
            else
            {
                PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1150177, m.NetState); // Incorrect Code Sequence. Access Denied.
                return(false);
            }
        }
Exemplo n.º 17
0
        public static Item Randomize()
        {
            Type[] types =
            {
                typeof(BrownDrakeCostume),      typeof(CyclopsCostume),           typeof(EvilWispCostume),
                typeof(GazerCostume),           typeof(LichCostume),
                typeof(LizardmanCostume),       typeof(MummyCostume),             typeof(OphidianMatriarchCostume),
                typeof(OphidianWarriorCostume), typeof(RatmanCostume),            typeof(RedDrakeCostume),
                typeof(ShadowWyrmCostume),      typeof(SkeletonCostume),          typeof(TerathanAvengerCostume),
                typeof(TerathanDroneCostume),   typeof(TerathanMatriarchCostume), typeof(TerathanWarriorCostume),
                typeof(TransgenderCostume),     typeof(WispCostume),              typeof(ZombieCostume)
            };
            var item = Loot.Construct(types);

            if (item.TypeEquals(typeof(BrownDrakeCostume)) || item.TypeEquals(typeof(RedDrakeCostume)) || item.TypeEquals(typeof(ShadowWyrmCostume)))
            {
                return(Utility.RandomDouble() < 0.4 ? item : Loot.Construct(types));
            }

            return(item);
        }
Exemplo n.º 18
0
            public override void OnResponse(NetState state, RelayInfo info)
            {
                if (Token != null && !Token.Deleted)
                {
                    int id = info.ButtonID - 1;

                    if (id >= 0 && id < Token.Titles.Count)
                    {
                        var tuple = Token.Titles[id];

                        Item item = Loot.Construct(tuple.Item2);

                        if (item != null)
                        {
                            User.AddToBackpack(item);
                            Token.Delete();

                            //TODO: Message?
                        }
                    }
                }
            }
Exemplo n.º 19
0
        public override void OnDeath(Container c)
        {
            List <DamageStore> rights = GetLootingRights();

            foreach (DamageStore ds in rights.Where(s => s.m_HasRight))
            {
                int luck   = ds.m_Mobile is PlayerMobile ? ((PlayerMobile)ds.m_Mobile).RealLuck : ds.m_Mobile.Luck;
                int chance = 75 + (luck / 15);

                if (chance > Utility.Random(5000))
                {
                    Mobile m        = ds.m_Mobile;
                    Item   artifact = Loot.Construct(ArtifactDrops[Utility.Random(ArtifactDrops.Length)]);

                    if (artifact != null)
                    {
                        if (m.Backpack == null || !m.Backpack.TryDropItem(m, artifact, false))
                        {
                            m.BankBox.DropItem(artifact);
                            m.SendMessage("For your valor in combating the fallen beast, a special reward has been placed in your bankbox.");
                        }
                        else
                        {
                            m.SendLocalizedMessage(1062317); // For your valor in combating the fallen beast, a special reward has been bestowed on you.
                        }
                    }
                }
            }

            foreach (var wisp in Wisps.Where(w => w != null && !w.Deleted))
            {
                wisp.Kill();
            }

            ColUtility.Free(Wisps);

            base.OnDeath(c);
        }
Exemplo n.º 20
0
        public override void OnConfirmed(CollectionItem citem, int index)
        {
            Item item = null;

            if (citem.Type == typeof(TreasuresOfDoomRewardDeed))
            {
                item = new TreasuresOfKotlRewardDeed(citem.Tooltip);
            }
            else
            {
                item = Loot.Construct(citem.Type);
            }

            if (item != null)
            {
                if (item is LanternOfLight light)
                {
                    light.OwnerName = User.Name;
                }

                if (User.Backpack == null || !User.Backpack.TryDropItem(User, item, false))
                {
                    User.SendLocalizedMessage(1074361); // The reward could not be given.  Make sure you have room in your pack.
                    item.Delete();
                }
                else
                {
                    User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
                    User.PlaySound(0x5A7);
                }
            }
            else
            {
                base.OnConfirmed(citem, index);
            }

            PointsSystem.TreasuresOfDoom.DeductPoints(User, citem.Points);
        }
Exemplo n.º 21
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Token == null || m_Token.Deleted ||
                m_User == null || m_User.Deleted)
            {
                return;
            }

            if (!m_Token.IsChildOf(m_User.Backpack))
            {
                sender.Mobile.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
                return;
            }

            switch (info.ButtonID)
            {
            case (int)Buttons.Okay:

                Item item = null;

                foreach (Type type in m_Selected)
                {
                    item = Loot.Construct(type);

                    if (item != null)
                    {
                        m_Token.Delete();
                        sender.Mobile.AddToBackpack(item);
                    }
                }

                break;

            case (int)Buttons.Cancel:
                sender.Mobile.SendGump(new HeritageTokenGump(m_Token, m_User));
                break;
            }
        }
Exemplo n.º 22
0
        public static Item CreateRandomArtifact()
        {
            if (!Core.AOS)
            {
                return(null);
            }

            var  count  = ArtifactRarity10.Length * 5 + ArtifactRarity11.Length * 4;
            var  random = Utility.Random(count);
            Type type;

            if (random < ArtifactRarity10.Length * 5)
            {
                type = ArtifactRarity10[random / 5];
            }
            else
            {
                random -= ArtifactRarity10.Length * 5;
                type    = ArtifactRarity11[random / 4];
            }

            return(Loot.Construct(type));
        }
Exemplo n.º 23
0
        public static Item CreateRandomArtifact()
        {
            if (!Core.AOS)
            {
                return(null);
            }

            int  count  = (m_ArtifactRarity10.Length * 5) + (m_ArtifactRarity11.Length * 4);
            int  random = Utility.Random(count);
            Type type;

            if (random < (m_ArtifactRarity10.Length * 5))
            {
                type = m_ArtifactRarity10[random / 5];
            }
            else
            {
                random -= m_ArtifactRarity10.Length * 5;
                type    = m_ArtifactRarity11[random / 4];
            }

            return(Loot.Construct(type));
        }
Exemplo n.º 24
0
        private void TakeItems(Container c, Type type, ref int amount)
        {
            if (c == null)
            {
                return;
            }

            Item[]      items  = c.FindItemsByType(type);
            List <Item> toSell = new List <Item>();

            foreach (Item item in items)
            {
                if (amount <= 0)
                {
                    break;
                }

                if (item.Amount <= amount)
                {
                    toSell.Add(item);
                    amount -= item.Amount;
                }
                else
                {
                    Item newItem = Loot.Construct(type);
                    newItem.Amount = amount;
                    item.Amount   -= amount;
                    toSell.Add(newItem);
                    amount = 0;
                }
            }

            foreach (Item item in toSell)
            {
                AddInventory(null, item);
            }
        }
Exemplo n.º 25
0
        public static Item RandomScroll(int index, int minCircle, int maxCircle)
        {
            --minCircle;
            --maxCircle;

            var scrollCount = (maxCircle - minCircle + 1) * 8;

            if (index == 0)
            {
                scrollCount += m_BlankTypes.Length;
            }

            if (Core.AOS)
            {
                scrollCount += m_NecroTypes[index].Length;
            }

            var rnd = Utility.Random(scrollCount);

            if (index == 0 && rnd < m_BlankTypes.Length)
            {
                return(Loot.Construct(m_BlankTypes));
            }

            if (index == 0)
            {
                rnd -= m_BlankTypes.Length;
            }

            if (Core.AOS && rnd < m_NecroTypes.Length)
            {
                return(Loot.Construct(m_NecroTypes[index]));
            }

            return(Loot.RandomScroll(minCircle * 8, maxCircle * 8 + 7, SpellbookType.Regular));
        }
Exemplo n.º 26
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            QuestSystem qs = player.Quest;

            if (qs is TerribleHatchlingsQuest)
            {
                if (qs.IsObjectiveInProgress(typeof(FirstKillObjective)))
                {
                    qs.AddConversation(new DirectionConversation());
                }
                else if (qs.IsObjectiveInProgress(typeof(SecondKillObjective)) ||
                         qs.IsObjectiveInProgress(typeof(ThirdKillObjective)))
                {
                    qs.AddConversation(new TakeCareConversation());
                }
                else
                {
                    QuestObjective obj = qs.FindObjective(typeof(ReturnObjective));

                    if (obj != null && !obj.Completed)
                    {
                        Container cont = GetNewContainer();

                        cont.DropItem(new Gold(Utility.RandomMinMax(100, 200)));

                        if (Utility.RandomBool())
                        {
                            BaseWeapon weapon = Loot.Construct(Loot.SEWeaponTypes) as BaseWeapon;

                            if (weapon != null)
                            {
                                BaseRunicTool.ApplyAttributesTo(weapon, 3, 10, 30);
                                cont.DropItem(weapon);
                            }
                        }
                        else
                        {
                            BaseArmor armor = Loot.Construct(Loot.SEArmorTypes) as BaseArmor;

                            if (armor != null)
                            {
                                BaseRunicTool.ApplyAttributesTo(armor, 1, 10, 20);
                                cont.DropItem(armor);
                            }
                        }

                        if (player.PlaceInBackpack(cont))
                        {
                            obj.Complete();
                        }
                        else
                        {
                            cont.Delete();
                            player.SendLocalizedMessage(1046260);                               // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                        }
                    }
                }
            }
            else
            {
                TerribleHatchlingsQuest newQuest = new TerribleHatchlingsQuest(player);
                bool inRestartPeriod             = false;

                if (qs != null)
                {
                    if (contextMenu)
                    {
                        SayTo(player, 1063322);                           // Before you can help me with the Terrible Hatchlings, you'll need to finish the quest you've already taken!
                    }
                }
                else if (QuestSystem.CanOfferQuest(player, typeof(TerribleHatchlingsQuest), out inRestartPeriod))
                {
                    newQuest.SendOffer();
                }
                else if (inRestartPeriod && contextMenu)
                {
                    SayTo(player, 1049357);                       // I have nothing more for you at this time.
                }
            }
        }
Exemplo n.º 27
0
 public void PackWeakPotion()
 {
     PackItem(Loot.Construct(m_WeakPotions));
 }
Exemplo n.º 28
0
        public static void CheckDrop(BaseCreature bc, Container c)
        {
            if (m_IngredientTable != null)
            {
                foreach (IngredientDropEntry entry in m_IngredientTable)
                {
                    if (entry == null)
                    {
                        continue;
                    }

                    if (entry.Region != null)
                    {
                        string reg = entry.Region;

                        if (reg == "TerMur" && c.Map != Map.TerMur)
                        {
                            continue;
                        }
                        else if (reg == "Abyss" && (c.Map != Map.TerMur || c.X < 235 || c.X > 1155 || c.Y < 40 || c.Y > 1040))
                        {
                            continue;
                        }
                        else if (reg != "TerMur" && reg != "Abyss")
                        {
                            Server.Region r = Server.Region.Find(c.Location, c.Map);

                            if (r == null || !r.IsPartOf(entry.Region))
                            {
                                continue;
                            }
                        }
                    }

                    if (bc.GetType() != entry.CreatureType && !bc.GetType().IsSubclassOf(entry.CreatureType))
                    {
                        continue;
                    }

                    double      toBeat = entry.Chance;
                    List <Item> drops  = new List <Item>();

                    if (bc is BaseVoidCreature)
                    {
                        toBeat *= ((BaseVoidCreature)bc).Stage + 1;
                    }

                    if (entry.DropMultiples)
                    {
                        foreach (Type type in entry.Ingredients)
                        {
                            if (toBeat >= Utility.RandomDouble())
                            {
                                Item drop = Loot.Construct(type);

                                if (drop != null)
                                {
                                    drops.Add(drop);
                                }
                            }
                        }
                    }
                    else if (toBeat >= Utility.RandomDouble())
                    {
                        Item drop = Loot.Construct(entry.Ingredients);

                        if (drop != null)
                        {
                            drops.Add(drop);
                        }
                    }

                    foreach (Item item in drops)
                    {
                        c.DropItem(item);
                    }

                    ColUtility.Free(drops);
                }
            }
        }
Exemplo n.º 29
0
        public static void Fill(LockableContainer cont, int luck, int level, bool isSos, Map map)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

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

                case 2:
                    cont.RequiredSkill = 45;
                    break;

                case 3:
                    cont.RequiredSkill = 65;
                    break;

                case 4:
                    cont.RequiredSkill = 75;
                    break;

                case 5:
                    cont.RequiredSkill = 75;
                    break;

                case 6:
                    cont.RequiredSkill = 80;
                    break;

                case 7:
                    cont.RequiredSkill = 80;
                    break;
                }

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

                cont.DropItem(new Gold(level * 5000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                double propsScale = 1.0;
                if (Core.SE)
                {
                    switch (level)
                    {
                    case 1:
                        numberItems = 32;
                        propsScale  = 0.5625;
                        break;

                    case 2:
                        numberItems = 40;
                        propsScale  = 0.6875;
                        break;

                    case 3:
                        numberItems = 48;
                        propsScale  = 0.875;
                        break;

                    case 4:
                        numberItems = 56;
                        break;

                    case 5:
                        numberItems = 64;
                        break;

                    case 6:
                        numberItems = 72;
                        break;

                    case 7:
                        numberItems = 80;
                        break;

                    default:
                        numberItems = 0;
                        break;
                    }
                }
                else
                {
                    numberItems = level * 6;
                }

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item != null && Core.HS && RandomItemGenerator.Enabled)
                    {
                        int min, max;
                        GetRandomItemStat(out min, out max, propsScale);

                        RunicReforging.GenerateRandomItem(item, luck, min, max, map);

                        cont.DropItem(item);
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level + 1;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = (level * 3) + 1;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level > 1)
            {
                Item item = Loot.Construct(m_ImbuingIngreds[Utility.Random(m_ImbuingIngreds.Length)]);

                item.Amount = level;
                cont.DropItem(item);
            }

            Item arty    = null;
            Item special = null;

            if (isSos)
            {
                if (0.004 * level > Utility.RandomDouble())
                {
                    arty = Loot.Construct(m_SOSArtifacts);
                }
                if (0.006 * level > Utility.RandomDouble())
                {
                    special = Loot.Construct(m_SOSDecor);
                }
                else if (0.009 * level > Utility.RandomDouble())
                {
                    special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), cont.Map);
                }
            }
            else
            {
                if (level >= 7)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelSevenOnly);
                    }
                    else if (0.10 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.25 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 6)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.10 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 5)
                {
                    if (0.05 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.25 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }
                }
                else if (.10 > Utility.RandomDouble())
                {
                    special = GetRandomSpecial(level, cont.Map);
                }
            }

            if (arty != null)
            {
                Container pack = new Backpack();
                pack.Hue = 1278;

                pack.DropItem(arty);
                cont.DropItem(pack);
            }

            if (special != null)
            {
                cont.DropItem(special);
            }

            if (Core.SA)
            {
                int rolls = 2;

                if (level >= 5)
                {
                    rolls += level - 2;
                }

                RefinementComponent.Roll(cont, rolls, 0.10);
            }
        }
Exemplo n.º 30
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null || !InRange(from.Location, 3))
            {
                return;
            }

            WhosMostHumbleQuest quest = QuestHelper.GetQuest(pm, typeof(WhosMostHumbleQuest)) as WhosMostHumbleQuest;

            if (quest != null && pm.Backpack != null && !quest.HasGivenTo(this))
            {
                Item item = from.FindItemOnLayer(Layer.Cloak);

                if (item is GreyCloak && ((GreyCloak)item).Owner == null)
                {
                    int idx = HumilityQuestMobileInfo.GetNPCIndex(GetType());

                    if (idx > -1 && quest.Infos.ContainsKey(idx) && idx < quest.Infos.Count)
                    {
                        Type needs = quest.Infos[idx].Needs;

                        Item need = from.Backpack.FindItemByType(needs);

                        // Found needed item
                        if (need != null)
                        {
                            need.Delete();
                            quest.RemoveQuestItem(need);

                            Item nextItem = Loot.Construct(quest.Infos[idx].Gives);

                            if (nextItem != null)
                            {
                                from.Backpack.DropItem(nextItem);
                                quest.AddQuestItem(nextItem, this);

                                if (this is Sean)
                                {
                                    SayTo(from, Greeting + 3, string.Format("#{0}", quest.Infos[idx].NeedsLoc));
                                }
                                else
                                {
                                    SayTo(from, Greeting + 4, string.Format("#{0}\t#{1}", quest.Infos[idx].NeedsLoc, quest.Infos[idx].GivesLoc));
                                }
                            }
                        }
                        else //Didn't find needed item
                        {
                            from.SendGump(new HumilityItemQuestGump(this, quest, idx));
                        }
                    }
                    else
                    {
                        Console.WriteLine("Error finding index for {0}", this);
                    }
                }
                else
                {
                    base.OnDoubleClick(from);
                }
            }
        }