Beispiel #1
0
        private static void ItemGrabMenu_Prefix(ref IList <Item> inventory, object context)
        {
            if (!(context is FishingRod))
            {
                return;
            }

            FishingRod fr       = context as FishingRod;
            int        fish     = SHelper.Reflection.GetField <int>(fr, "whichFish").GetValue();
            bool       treasure = false;

            foreach (Item item in inventory)
            {
                if (item.parentSheetIndex != fish)
                {
                    treasure = true;
                }
            }
            if (!treasure)
            {
                return;
            }

            Dictionary <int, string> data = Game1.content.Load <Dictionary <int, string> >("Data\\Fish");
            int difficulty = 5;

            if (data.ContainsKey(fish))
            {
                int.TryParse(data[fish].Split('/')[1], out difficulty);
            }

            int coins = advancedLootFrameworkApi.GetChestCoins(difficulty, Config.IncreaseRate, Config.CoinBaseMin, Config.CoinBaseMax);

            IList <Item> items = advancedLootFrameworkApi.GetChestItems(treasuresList, Config.ItemListChances, Config.MaxItems, Config.MinItemValue, Config.MaxItemValue, difficulty, Config.IncreaseRate, Config.ItemsBaseMaxValue);

            bool vanilla = Game1.random.NextDouble() < Config.VanillaLootChance / 100f;

            foreach (Item item in inventory)
            {
                if (item.parentSheetIndex == fish || vanilla)
                {
                    items.Add(item);
                }
            }

            if (Game1.random.NextDouble() <= 0.33 && Game1.player.team.SpecialOrderRuleActive("DROP_QI_BEANS", null))
            {
                items.Add(new Object(890, Game1.random.Next(1, 3) + ((Game1.random.NextDouble() < 0.25) ? 2 : 0), false, -1, 0));
            }

            inventory           = items;
            Game1.player.Money += coins;
            SMonitor.Log($"chest contains {coins} gold");
        }
        private static void ItemGrabMenu_Prefix(ref IList <Item> inventory, object context)
        {
            if (!(context is FishingRod))
            {
                return;
            }

            FishingRod fr       = context as FishingRod;
            int        fish     = SHelper.Reflection.GetField <int>(fr, "whichFish").GetValue();
            bool       treasure = false;

            foreach (Item item in inventory)
            {
                if (item.parentSheetIndex != fish)
                {
                    treasure = true;
                }
            }
            if (!treasure)
            {
                return;
            }

            Dictionary <int, string> data = Game1.content.Load <Dictionary <int, string> >("Data\\Fish");
            int difficulty = 5;

            if (data.ContainsKey(fish))
            {
                int.TryParse(data[fish].Split('/')[1], out difficulty);
            }

            int coins = advancedLootFrameworkApi.GetChestCoins(Config.Mult, Config.IncreaseRate, Config.CoinBaseMin, Config.CoinBaseMax);

            IList <Item> items = advancedLootFrameworkApi.GetChestItems(treasuresList, Config.MaxItems, Config.MinItemValue, Config.MaxItemValue, difficulty, Config.IncreaseRate, Config.ItemsBaseMaxValue);

            foreach (Item item in inventory)
            {
                if (item.parentSheetIndex == fish)
                {
                    items.Add(item);
                }
            }
            inventory           = items;
            Game1.player.Money += coins;
            SMonitor.Log($"chest contains {coins} gold");
        }
Beispiel #3
0
 private static Item GetRandomParrotGift(Object obj)
 {
     return(advancedLootFrameworkApi.GetChestItems(giftList, possibleGifts, 1, 1, 100, obj.Price > 0 ? obj.Price : 1, 0.2f, 100)[0]);
 }