private void SetBirthdayGift(GARBAGE_CANS can, Item favItem)
        {
            birthdayCan = can;
            bool foundItem = false;

            foreach (TrashTreasure item in garbageCans[can].treasureList)
            {
                if (item.Id == favItem.ParentSheetIndex)
                {
                    item.Chance            += config.birthdayGiftChancePercent;
                    preBirthdayStartTime    = item.AvailableStartTime;
                    preBirthdayEndTime      = item.AvailableEndTime;
                    item.AvailableStartTime = 600;
                    item.AvailableEndTime   = 2600;
                    foundItem = true;
                    break;
                }
            }

            if (!foundItem)
            {
                garbageCans[can].treasureList.Add(new TrashTreasure(favItem.ParentSheetIndex, favItem.Name, config.birthdayGiftChancePercent));
                preBirthdayStartTime = 600;
                preBirthdayEndTime   = 2600;
            }
        }
Example #2
0
        private static bool CanCheckGarbageCan(GARBAGE_CANS can)
        {
            bool canCheckForItems = false;

            //Has the garbage can been checked today?
            if (BetterGarbageCansMod.Instance.garbageCans[can].LastTimeChecked == -1) //LastTimeChecked defaults per day to -1
            {
                // You have never checked that can...
                canCheckForItems = true;
            }
            else if (BetterGarbageCansMod.Instance.config.allowGarbageCanRecheck) //You have check the garbage can before.... and you can recheck it
            {
                //See if enough time has pasted since last check
                if (CanCheckBasedOnLastCheckTime(can))
                {
                    if (BetterGarbageCansMod.Instance.garbageCans[can].LastTimeFoundItem == -1)
                    {
                        //Enough time has passed, and never found anything...
                        canCheckForItems = true;
                    }
                    else if (BetterGarbageCansMod.Instance.config.allowMultipleItemsPerDay) // So you have found at least something before
                    {
                        //See if enough time has pasted since last found item
                        canCheckForItems = CanCheckBasedOnLastFoundTime(can);
                    }
                }
            }

            return(canCheckForItems);
        }
        private static List <TrashTreasure> GetTreasureList(GARBAGE_CANS id)
        {
            switch (id)
            {
            case GARBAGE_CANS.JODI_SAM:
                return(GetJodiSamTreasureList());

            case GARBAGE_CANS.EMILY_HALEY:
                return(GetEmilyHaleyTreasureList());

            case GARBAGE_CANS.MAYOR_LEWIS:
                return(GetMayorLewisTreasureList());

            case GARBAGE_CANS.GUNTHER:
                return(GetGuntherTreasureList());

            case GARBAGE_CANS.CLINT:
                return(GetClintTreasureList());

            case GARBAGE_CANS.STARDROP_SALOON:
                return(GetSaloonTreasureList());

            case GARBAGE_CANS.EVELYN_GEORGE:
                return(GetEvelynGeorgeTreasureList());

            case GARBAGE_CANS.JOJA_MART:
                return(GetJojaMartTreasureList());

            default:
                return(new List <TrashTreasure>());
            }
        }
        private static GarbageCan CreateGarbageCan(GARBAGE_CANS id)
        {
            GarbageCan newGroup = new GarbageCan(id);

            newGroup.treasureList = GetTreasureList(id);
            return(newGroup);
        }
Example #5
0
        private static Item GetCustomTrashTreasure(GARBAGE_CANS index)
        {
            GarbageCan garbageCan = BetterGarbageCansMod.Instance.garbageCans[index];

            // Possible treasure based on selected treasure group selected above.
            List <TrashTreasure> possibleLoot = new List <TrashTreasure>(garbageCan.treasureList)
                                                .Where(loot => loot.Enabled && loot.IsValid())
                                                .OrderBy(loot => loot.Chance)
                                                .ThenBy(loot => loot.Id)
                                                .ToList();

            if (possibleLoot.Count == 0)
            {
                BetterGarbageCansMod.Instance.Monitor.Log($"   Group: {garbageCan.GarbageCanID}, No Possible Loot Found... check the logic");
            }

            TrashTreasure treasure = possibleLoot.ChooseItem(Game1.random);
            int           id       = treasure.Id;

            // Lost books have custom handling  -- No default lost books... but someonw might configure them
            if (id == 102) // LostBook Item ID
            {
                if (Game1.player.archaeologyFound == null || !Game1.player.archaeologyFound.ContainsKey(102) || Game1.player.archaeologyFound[102][0] >= 21)
                {
                    possibleLoot.Remove(treasure);
                }
                Game1.showGlobalMessage("You found a lost book. The library has been expanded.");
            }

            // Create reward item
            Item reward;

            if ((id >= 516 && id <= 534) || id == 810 || id == 811)
            {
                reward = new Ring(id);
            }
            else if ((id >= 504 && id <= 515) || id == 804 || id == 806)
            {
                reward = new Boots(id);
            }
            else
            {
                int count = Game1.random.Next(treasure.MinAmount, treasure.MaxAmount);
                reward = (Item) new StardewValley.Object(id, count);
            }

            if (Game1.random.NextDouble() <= 0.25 && Game1.player.team.SpecialOrderRuleActive("DROP_QI_BEANS", (SpecialOrder)null))
            {
                reward = (Item) new StardewValley.Object(890, 1);
            }

            return(reward);
        }
Example #6
0
 private static bool CanCheckBasedOnLastFoundTime(GARBAGE_CANS can)
 {
     return(Game1.timeOfDay >= GetWaitTime(BetterGarbageCansMod.Instance.garbageCans[can].LastTimeFoundItem,
                                           BetterGarbageCansMod.Instance.config.WaitTimeIfFoundSomething));
 }
Example #7
0
 public GarbageCan(GARBAGE_CANS id)
 {
     this.GarbageCanID      = id;
     this.LastTimeChecked   = -1;
     this.LastTimeFoundItem = -1;
 }