Esempio n. 1
0
        private bool CheckForAction(SFarmer farmer, CrabPot pot, CrabNetStats stats)
        {
            if (!this.CanAfford(farmer, this.CostPerCheck, stats))
            {
                return(false);
            }

            if (pot.tileIndexToShow == 714)
            {
                if (farmer.IsMainPlayer && !this.AddItemToInventory(pot.heldObject.Value, farmer, Game1.getFarm()))
                {
                    Game1.addHUDMessage(new HUDMessage("Inventory Full", Color.Red, 3500f));
                    return(false);
                }
                Dictionary <int, string> dictionary = this.Helper.Content.Load <Dictionary <int, string> >("Data\\Fish", ContentSource.GameContent);
                if (dictionary.ContainsKey(pot.heldObject.Value.ParentSheetIndex))
                {
                    string[] strArray = dictionary[pot.heldObject.Value.ParentSheetIndex].Split('/');
                    int      minValue = strArray.Length > 5 ? Convert.ToInt32(strArray[5]) : 1;
                    int      num      = strArray.Length > 5 ? Convert.ToInt32(strArray[6]) : 10;
                    farmer.caughtFish(pot.heldObject.Value.ParentSheetIndex, Game1.random.Next(minValue, num + 1));
                }
                pot.readyForHarvest.Value = false;
                pot.heldObject.Value      = null;
                pot.tileIndexToShow       = 710;
                pot.bait.Value            = null;
                farmer.gainExperience(1, 5);

                return(true);
            }
            return(false);
        }