コード例 #1
0
 public override void DoFunction(GameLocation location, int x, int y, int power, Farmer who)
 {
     base.DoFunction(location, x, y, power, who);
     who.Stamina -= 4f;
     Shears.playSnip(who);
     this.currentParentTileIndex = 7;
     this.indexOfMenuItemView    = 7;
     if (this.animal != null && this.animal.currentProduce > 0 && (this.animal.age >= (int)this.animal.ageWhenMature && this.animal.toolUsedForHarvest.Equals(this.name)))
     {
         Farmer farmer = who;
         StardewValley.Object @object = new StardewValley.Object(Vector2.Zero, this.animal.currentProduce, (string)null, false, true, false, false);
         @object.quality = this.animal.produceQuality;
         int num = 0;
         if (farmer.addItemToInventoryBool((Item)@object, num != 0))
         {
             this.animal.currentProduce = -1;
             Game1.playSound("coin");
             this.animal.friendshipTowardFarmer = Math.Min(1000, this.animal.friendshipTowardFarmer + 5);
             if (this.animal.showDifferentTextureWhenReadyForHarvest)
             {
                 this.animal.sprite.Texture = Game1.content.Load <Texture2D>("Animals\\Sheared" + this.animal.type);
             }
             who.gainExperience(0, 5);
         }
     }
     else
     {
         string dialogue = "";
         if (this.animal != null && !this.animal.toolUsedForHarvest.Equals(this.name))
         {
             dialogue = Game1.content.LoadString("Strings\\StringsFromCSFiles:Shears.cs.14245", (object)this.animal.displayName);
         }
         if (this.animal != null && this.animal.isBaby() && this.animal.toolUsedForHarvest.Equals(this.name))
         {
             dialogue = Game1.content.LoadString("Strings\\StringsFromCSFiles:Shears.cs.14246", (object)this.animal.displayName);
         }
         if (this.animal != null && this.animal.age >= (int)this.animal.ageWhenMature && this.animal.toolUsedForHarvest.Equals(this.name))
         {
             dialogue = Game1.content.LoadString("Strings\\StringsFromCSFiles:Shears.cs.14247", (object)this.animal.displayName);
         }
         if (dialogue.Length > 0)
         {
             Game1.drawObjectDialogue(dialogue);
         }
     }
     this.animal = (FarmAnimal)null;
     if (Game1.activeClickableMenu == null)
     {
         who.CanMove = true;
     }
     else
     {
         who.Halt();
     }
     who.usingTool      = false;
     who.canReleaseTool = true;
 }
コード例 #2
0
 // Token: 0x06000921 RID: 2337 RVA: 0x000C6CA0 File Offset: 0x000C4EA0
 public override void DoFunction(GameLocation location, int x, int y, int power, Farmer who)
 {
     base.DoFunction(location, x, y, power, who);
     who.Stamina -= 4f;
     Shears.playSnip(who);
     this.currentParentTileIndex = 7;
     this.indexOfMenuItemView    = 7;
     if (this.animal != null && this.animal.currentProduce > 0 && this.animal.age >= (int)this.animal.ageWhenMature && this.animal.toolUsedForHarvest.Equals(this.name))
     {
         if (who.addItemToInventoryBool(new Object(Vector2.Zero, this.animal.currentProduce, null, false, true, false, false)
         {
             quality = this.animal.produceQuality
         }, false))
         {
             this.animal.currentProduce = -1;
             Game1.playSound("coin");
             this.animal.friendshipTowardFarmer = Math.Min(1000, this.animal.friendshipTowardFarmer + 5);
             if (this.animal.showDifferentTextureWhenReadyForHarvest)
             {
                 this.animal.sprite.Texture = Game1.content.Load <Texture2D>("Animals\\Sheared" + this.animal.type);
             }
             who.gainExperience(0, 5);
         }
     }
     else
     {
         string toSay = "";
         if (this.animal != null && !this.animal.toolUsedForHarvest.Equals(this.name))
         {
             toSay = this.animal.name + " doesn't produce wool.";
         }
         if (this.animal != null && this.animal.isBaby() && this.animal.toolUsedForHarvest.Equals(this.name))
         {
             toSay = this.animal.name + " is too young to be sheared.";
         }
         if (this.animal != null && this.animal.age >= (int)this.animal.ageWhenMature && this.animal.toolUsedForHarvest.Equals(this.name))
         {
             toSay = this.animal.name + " has no wool right now.";
         }
         if (toSay.Length > 0)
         {
             Game1.drawObjectDialogue(toSay);
         }
     }
     this.animal = null;
     if (Game1.activeClickableMenu == null)
     {
         who.CanMove = true;
     }
     else
     {
         who.Halt();
     }
     who.usingTool      = false;
     who.canReleaseTool = true;
 }