コード例 #1
0
ファイル: BountyQuestSpawner.cs プロジェクト: Crome696/ServUO
        public static void FillHold(BaseGalleon galleon)
        {
            if (galleon == null)
                return;

            Container hold = galleon.GalleonHold;

            if (hold != null)
            {
                int cnt = Utility.RandomMinMax(7, 14);

                for (int i = 0; i < cnt; i++)
                {
                    Item item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();

                    if (item is BaseWeapon)
                        BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, 0, Utility.RandomMinMax(1, 6), 10, 100);
                    else if (item is BaseArmor)
                        BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, 0, Utility.RandomMinMax(1, 6), 10, 100);
                    else if (item is BaseHat)
                        BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, 0, Utility.RandomMinMax(1, 6), 10, 100);
                    else if (item is BaseJewel)
                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, 0, Utility.RandomMinMax(1, 6), 10, 100);
                    else
                        item.Delete();

                    hold.DropItem(item);
                }

                hold.DropItem(new Swab());
                hold.DropItem(new Ramrod());
                hold.DropItem(new Matches(Utility.RandomMinMax(25, 30)));
                hold.DropItem(new HeavyCannonball(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new LightCannonball(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new HeavyGrapeshot(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new LightGrapeshot(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new HeavyPowderCharge(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new LightPowderCharge(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new Fusecord(Utility.RandomMinMax(7, 10)));

                if (.10 >= Utility.RandomDouble())
                    hold.DropItem(new SmugglersCache());

                if (.10 >= Utility.RandomDouble())
                {
                    FishSteak steaks = new FishSteak(5);
                    switch (Utility.Random(5))
                    {
                        case 0:
                            steaks.Name = "Spiced Salmon";
                            steaks.Hue = 1759;
                            break;
                        case 1:
                            steaks.Name = "Dried Tuna";
                            steaks.Hue = 2108;
                            break;
                        case 2:
                            steaks.Name = "Salted Snapper";
                            steaks.Hue = 1864;
                            break;
                        case 3:
                            steaks.Name = "Salted Herring";
                            steaks.Hue = 2302;
                            break;
                        case 4:
                            steaks.Name = "Spiced Salmon";
                            steaks.Hue = 1637;
                            break;
                    }

                    hold.DropItem(steaks);
                }

                /*if (0.10 > Utility.RandomDouble())
                {
                    Item item = null;
                    switch (Utility.Random(6))
                    {
                        case 0: item = new LightScatterShot(); break;
                        case 1: item = new HeavyScatterShot(); break;
                        case 2: item = new LightFragShot(); break;
                        case 3: item = new HeavyFragShot(); break;
                        case 4: item = new LightHotShot(); break;
                        case 5: item = new HeavyHotShot(); break;
                    }

                    if (item != null)
                    {
                        item.Amount = Utility.RandomMinMax(2, 10);
                        hold.DropItem(item);
                    }
                }*/

                hold.DropItem(new Gold(Utility.RandomMinMax(5000, 25000)));

                if (0.50 > Utility.RandomDouble())
                {
                    switch (Utility.Random(4))
                    {
                        case 0:
                        case 1:
                        case 2: hold.DropItem(new IronWire(Utility.RandomMinMax(1, 5))); break;
                        case 3:
                        case 4:
                        case 5: hold.DropItem(new CopperWire(Utility.RandomMinMax(1, 5))); break;
                        case 6:
                        case 7: hold.DropItem(new SilverWire(Utility.RandomMinMax(1, 5))); break;
                        case 8: hold.DropItem(new GoldWire(Utility.RandomMinMax(1, 5))); break;
                    }
                }

                switch (Utility.Random(8))
                {
                    case 0:
                        if (Utility.RandomBool())
                            hold.DropItem(new IronOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new IronIngot(Utility.RandomMinMax(40, 50)));
                        break;
                    case 1:
                        if (Utility.RandomBool())
                            hold.DropItem(new DullCopperOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new DullCopperIngot(Utility.RandomMinMax(40, 50)));
                        break;
                    case 2:
                        if (Utility.RandomBool())
                            hold.DropItem(new ShadowIronOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new ShadowIronIngot(Utility.RandomMinMax(40, 50)));
                        break;
                    case 3:
                        if (Utility.RandomBool())
                            hold.DropItem(new CopperOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new CopperIngot(Utility.RandomMinMax(40, 50)));
                        break;
                    case 4:
                        if (Utility.RandomBool())
                            hold.DropItem(new BronzeOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new BronzeIngot(Utility.RandomMinMax(40, 50)));
                        break;
                    case 5:
                        if (Utility.RandomBool())
                            hold.DropItem(new AgapiteOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new AgapiteIngot(Utility.RandomMinMax(40, 50)));
                        break;
                    case 6:
                        if (Utility.RandomBool())
                            hold.DropItem(new VeriteOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new VeriteIngot(Utility.RandomMinMax(40, 50)));
                        break;
                    case 7:
                        if (Utility.RandomBool())
                            hold.DropItem(new ValoriteOre(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new ValoriteIngot(Utility.RandomMinMax(40, 50)));
                        break;
                }

                switch (Utility.Random(5))
                {
                    case 0:
                        if (Utility.RandomBool())
                            hold.DropItem(new Board(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new Log(Utility.RandomMinMax(40, 50)));
                        break;
                    case 1:
                        if (Utility.RandomBool())
                            hold.DropItem(new OakBoard(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new OakLog(Utility.RandomMinMax(40, 50)));
                        break;
                    case 2:
                        if (Utility.RandomBool())
                            hold.DropItem(new AshBoard(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new AshLog(Utility.RandomMinMax(40, 50)));
                        break;
                    case 3:
                        if (Utility.RandomBool())
                            hold.DropItem(new YewBoard(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new YewLog(Utility.RandomMinMax(40, 50)));
                        break;
                    case 4:
                        if (Utility.RandomBool())
                            hold.DropItem(new BloodwoodBoard(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new BloodwoodLog(Utility.RandomMinMax(40, 50)));
                        break;
                }

                switch (Utility.Random(4))
                {
                    case 0:
                        if (Utility.RandomBool())
                            hold.DropItem(new Leather(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new Hides(Utility.RandomMinMax(40, 50)));
                        break;
                    case 1:
                        if (Utility.RandomBool())
                            hold.DropItem(new SpinedLeather(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new SpinedHides(Utility.RandomMinMax(40, 50)));
                        break;
                    case 2:
                        if (Utility.RandomBool())
                            hold.DropItem(new HornedLeather(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new HornedHides(Utility.RandomMinMax(40, 50)));
                        break;
                    case 3:
                        if (Utility.RandomBool())
                            hold.DropItem(new BarbedLeather(Utility.RandomMinMax(40, 50)));
                        else
                            hold.DropItem(new BarbedHides(Utility.RandomMinMax(40, 50)));
                        break;
                }

                switch (Utility.Random(4))
                {
                    case 0: hold.DropItem(new HeavyCannonball(Utility.RandomMinMax(5, 10))); break;
                    case 1: hold.DropItem(new LightCannonball(Utility.RandomMinMax(5, 10))); break;
                    case 2: hold.DropItem(new HeavyGrapeshot(Utility.RandomMinMax(5, 10))); break;
                    case 3: hold.DropItem(new LightGrapeshot(Utility.RandomMinMax(5, 10))); break;
                }


                //Rares
                if (0.8 > Utility.RandomDouble())
                {
                    if (Utility.RandomBool())
                        hold.DropItem(new HeavyShipCannonDeed());
                    else
                        hold.DropItem(new LightShipCannonDeed());
                }

                if (0.025 > Utility.RandomDouble())
                {
                    if(Utility.RandomBool())
                        hold.DropItem(new WhiteClothDyeTub());
                    else
                        hold.DropItem(PermanentBoatPaint.DropRandom());
                }

                RefinementComponent.Roll(hold, 3, 0.25);
            }
        }
コード例 #2
0
ファイル: StartingQuest.cs プロジェクト: Ravenwolfe/xrunuo
        private void Restock_Callback()
        {
            if ( TotalItems < ItemsMax )
            {
                for ( int i = TotalItems; i < ItemsMax; i++ )
                {
                    Item item = null;

                    switch ( Utility.RandomMinMax( 1, 11 ) )
                    {
                        default:
                        case 1: item = new Grapes(); break;
                        case 2: item = new Ham(); break;
                        case 3: item = new CheeseWedge(); break;
                        case 4: item = new Muffins(); break;
                        case 5: item = new FishSteak(); break;
                        case 6: item = new Ribs(); break;
                        case 7: item = new CookedBird(); break;
                        case 8: item = new Sausage(); break;
                        case 9: item = new Apple(); break;
                        case 10: item = new Peach(); break;
                        case 11: item = new Bandage(); break;
                    }

                    if ( item != null )
                        DropItem( item );
                }
            }
        }