public override Item getOne() { if ((bool)bigCraftable) { return(new Torch(tileLocation, parentSheetIndex, bigCraftable: true) { IsRecipe = isRecipe }); } Torch torch = new Torch(tileLocation, 1); torch.IsRecipe = isRecipe; torch._GetOneFrom(this); return(torch); }
public override Item getOne() { if (this.bigCraftable) { Torch torch = new Torch(this.tileLocation, this.parentSheetIndex, true); int num = this.isRecipe ? 1 : 0; torch.isRecipe = num != 0; return((Item)torch); } Torch torch1 = new Torch(this.tileLocation, 1); int num1 = this.isRecipe ? 1 : 0; torch1.isRecipe = num1 != 0; return((Item)torch1); }
public override bool placementAction(GameLocation location, int x, int y, Farmer who) { Vector2 placementTile = new Vector2(x / 64, y / 64); Torch toPlace = bigCraftable ? new Torch(placementTile, parentSheetIndex, bigCraftable: true) : new Torch(placementTile, 1, parentSheetIndex); if ((bool)bigCraftable) { toPlace.isOn.Value = false; } toPlace.tileLocation.Value = placementTile; toPlace.initializeLightSource(placementTile); location.objects.Add(placementTile, toPlace); if (who != null) { Game1.playSound("woodyStep"); } return(true); }
public override bool placementAction(GameLocation location, int x, int y, Farmer who) { Vector2 vector = new Vector2((float)(x / Game1.tileSize), (float)(y / Game1.tileSize)); Torch torch = this.bigCraftable ? new Torch(vector, this.parentSheetIndex, true) : new Torch(vector, 1, this.parentSheetIndex); if (this.bigCraftable) { torch.isOn = false; } torch.tileLocation = vector; torch.initializeLightSource(vector); location.objects.Add(vector, torch); if (who != null) { Game1.playSound("woodyStep"); } return(true); }
// Token: 0x0600018E RID: 398 RVA: 0x00011DF8 File Offset: 0x0000FFF8 public bool updateChunks(GameTime time) { this.timeSinceDoneBouncing += (float)time.ElapsedGameTime.Milliseconds; if (this.timeSinceDoneBouncing >= (this.floppingFish ? 2500f : ((this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) ? 1800f : 600f))) { if (this.debrisType == Debris.DebrisType.LETTERS || this.debrisType == Debris.DebrisType.NUMBERS || this.debrisType == Debris.DebrisType.SQUARES || this.debrisType == Debris.DebrisType.SPRITECHUNKS || (this.debrisType == Debris.DebrisType.CHUNKS && this.chunks[0].debrisType - this.chunks[0].debrisType % 2 != 8)) { return(true); } if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT || this.debrisType == Debris.DebrisType.RESOURCE || this.debrisType == Debris.DebrisType.CHUNKS) { this.chunksMoveTowardPlayer = true; } this.timeSinceDoneBouncing = 0f; } for (int i = this.chunks.Count - 1; i >= 0; i--) { if (this.chunks[i].alpha > 0.1f && (this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) && this.timeSinceDoneBouncing > 600f) { this.chunks[i].alpha = (1800f - this.timeSinceDoneBouncing) / 1000f; } if (this.chunks[i].position.X < (float)(-(float)Game1.tileSize * 2) || this.chunks[i].position.Y < (float)(-(float)Game1.tileSize) || this.chunks[i].position.X >= (float)(Game1.currentLocation.map.DisplayWidth + Game1.tileSize) || this.chunks[i].position.Y >= (float)(Game1.currentLocation.map.DisplayHeight + Game1.tileSize)) { this.chunks.RemoveAt(i); } else { bool canMoveTowardPlayer = Math.Abs(this.chunks[i].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= (float)Game1.player.MagneticRadius && Math.Abs(this.chunks[i].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= (float)Game1.player.MagneticRadius; if (canMoveTowardPlayer) { switch (this.debrisType) { case Debris.DebrisType.ARCHAEOLOGY: case Debris.DebrisType.OBJECT: if (this.item != null) { canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisItem(this.item); goto IL_338; } canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisObject(this.chunks[i].debrisType, 1, this.itemQuality); if (this.chunks[i].debrisType == 102 && Game1.activeClickableMenu != null) { canMoveTowardPlayer = false; goto IL_338; } goto IL_338; case Debris.DebrisType.RESOURCE: canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisObject(this.chunks[i].debrisType - this.chunks[i].debrisType % 2, 1, 0); goto IL_338; } canMoveTowardPlayer = true; } IL_338: if ((this.chunksMoveTowardPlayer || this.isFishable) & canMoveTowardPlayer) { if (this.chunks[i].position.X < Game1.player.position.X - 12f) { this.chunks[i].xVelocity = Math.Min(this.chunks[i].xVelocity + 0.8f, 8f); } else if (this.chunks[i].position.X > Game1.player.position.X + 12f) { this.chunks[i].xVelocity = Math.Max(this.chunks[i].xVelocity - 0.8f, -8f); } if (this.chunks[i].position.Y + (float)(Game1.tileSize / 2) < (float)(Game1.player.getStandingY() - 12)) { this.chunks[i].yVelocity = Math.Max(this.chunks[i].yVelocity - 0.8f, -8f); } else if (this.chunks[i].position.Y + (float)(Game1.tileSize / 2) > (float)(Game1.player.getStandingY() + 12)) { this.chunks[i].yVelocity = Math.Min(this.chunks[i].yVelocity + 0.8f, 8f); } Chunk expr_4EA_cp_0_cp_0 = this.chunks[i]; expr_4EA_cp_0_cp_0.position.X = expr_4EA_cp_0_cp_0.position.X + this.chunks[i].xVelocity; Chunk expr_515_cp_0_cp_0 = this.chunks[i]; expr_515_cp_0_cp_0.position.Y = expr_515_cp_0_cp_0.position.Y - this.chunks[i].yVelocity; if (Math.Abs(this.chunks[i].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= 64f && Math.Abs(this.chunks[i].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= 64f) { int switcher = (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT) ? this.chunks[i].debrisType : (this.chunks[i].debrisType - this.chunks[i].debrisType % 2); if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY) { Game1.farmerFindsArtifact(this.chunks[i].debrisType); } else if (this.item != null) { if (!Game1.player.addItemToInventoryBool(this.item, false)) { goto IL_1077; } } else if (this.debrisType != Debris.DebrisType.CHUNKS || switcher != 8) { if (switcher <= -10000) { if (!Game1.player.addItemToInventoryBool(new MeleeWeapon(switcher), false)) { goto IL_1077; } } else if (switcher <= 0) { if (!Game1.player.addItemToInventoryBool(new Object(Vector2.Zero, -switcher, false), false)) { goto IL_1077; } } else { Farmer arg_6C2_0 = Game1.player; Object arg_6C2_1; if (switcher != 93 && switcher != 94) { (arg_6C2_1 = new Object(Vector2.Zero, switcher, 1)).quality = this.itemQuality; } else { arg_6C2_1 = new Torch(Vector2.Zero, 1, switcher); } if (!arg_6C2_0.addItemToInventoryBool(arg_6C2_1, false)) { goto IL_1077; } } } if (Game1.debrisSoundInterval <= 0f) { Game1.debrisSoundInterval = 10f; Game1.playSound("coin"); } if (Game1.IsMultiplayer) { MultiplayerUtility.broadcastDebrisPickup(this.uniqueID, Game1.currentLocation.name, Game1.player.uniqueMultiplayerID); } this.chunks.RemoveAt(i); } } else { if (this.debrisType == Debris.DebrisType.NUMBERS && this.toHover != null) { this.relativeXPosition += this.chunks[i].xVelocity; this.chunks[i].position.X = this.toHover.position.X + (float)(Game1.tileSize / 2) + this.relativeXPosition; this.chunks[i].scale = Math.Min(2f, Math.Max(1f, 0.9f + Math.Abs(this.chunks[i].position.Y - (float)this.chunkFinalYLevel) / ((float)Game1.tileSize * 2f))); this.chunkFinalYLevel = this.toHover.getStandingY() + 8; if (this.timeSinceDoneBouncing > 250f) { this.chunks[i].alpha = Math.Max(0f, this.chunks[i].alpha - 0.033f); } if (!this.toHover.Equals(Game1.player) && !this.nonSpriteChunkColor.Equals(Color.Yellow) && !this.nonSpriteChunkColor.Equals(Color.Green)) { this.nonSpriteChunkColor.R = (byte)Math.Max((double)Math.Min(255, 200 + this.chunkType), Math.Min((double)Math.Min(255, 220 + this.chunkType), 400.0 * Math.Sin((double)this.timeSinceDoneBouncing / 804.247719318987 + 0.26179938779914941))); this.nonSpriteChunkColor.G = (byte)Math.Max((double)(150 - this.chunkType), Math.Min((double)(255 - this.chunkType), (this.nonSpriteChunkColor.R > 220) ? (300.0 * Math.Sin((double)this.timeSinceDoneBouncing / 804.247719318987 + 0.26179938779914941)) : 0.0)); this.nonSpriteChunkColor.B = (byte)Math.Max(0, Math.Min(255, (int)((this.nonSpriteChunkColor.G > 200) ? (this.nonSpriteChunkColor.G - 20) : 0))); } } Chunk expr_9B4_cp_0_cp_0 = this.chunks[i]; expr_9B4_cp_0_cp_0.position.X = expr_9B4_cp_0_cp_0.position.X + this.chunks[i].xVelocity; Chunk expr_9DF_cp_0_cp_0 = this.chunks[i]; expr_9DF_cp_0_cp_0.position.Y = expr_9DF_cp_0_cp_0.position.Y - this.chunks[i].yVelocity; if (this.movingFinalYLevel) { this.chunkFinalYLevel -= (int)Math.Ceiling((double)(this.chunks[i].yVelocity / 2f)); if (this.chunkFinalYLevel <= this.chunkFinalYTarget) { this.chunkFinalYLevel = this.chunkFinalYTarget; this.movingFinalYLevel = false; } } if (this.debrisType == Debris.DebrisType.SQUARES && this.chunks[i].position.Y < (float)(this.chunkFinalYLevel - Game1.tileSize * 3 / 2) && Game1.random.NextDouble() < 0.1) { this.chunks[i].position.Y = (float)(this.chunkFinalYLevel - Game1.random.Next(1, Game1.tileSize / 3)); this.chunks[i].yVelocity = (float)Game1.random.Next(30, 80) / 40f; this.chunks[i].position.X = (float)Game1.random.Next((int)(this.chunks[i].position.X - this.chunks[i].position.X % (float)Game1.tileSize + 1f), (int)(this.chunks[i].position.X - this.chunks[i].position.X % (float)Game1.tileSize + 64f)); } if (this.debrisType != Debris.DebrisType.SQUARES) { this.chunks[i].yVelocity -= 0.4f; } bool destroyThisChunk = false; if (this.chunks[i].position.Y >= (float)this.chunkFinalYLevel && this.chunks[i].hasPassedRestingLineOnce && this.chunks[i].bounces <= (this.floppingFish ? 65 : 2)) { if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.NUMBERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && (this.debrisType != Debris.DebrisType.CHUNKS || this.chunks[i].debrisType - this.chunks[i].debrisType % 2 == 8)) { Game1.playSound("shiny4"); } this.chunks[i].bounces++; if (this.floppingFish) { this.chunks[i].yVelocity = Math.Abs(this.chunks[i].yVelocity) * ((this.movingUp && this.chunks[i].bounces < 2) ? 0.6f : 0.9f); this.chunks[i].xVelocity = (float)Game1.random.Next(-250, 250) / 100f; } else { this.chunks[i].yVelocity = Math.Abs(this.chunks[i].yVelocity * 2f / 3f); this.chunks[i].rotationVelocity = ((Game1.random.NextDouble() < 0.5) ? (this.chunks[i].rotationVelocity / 2f) : (-this.chunks[i].rotationVelocity * 2f / 3f)); this.chunks[i].xVelocity -= this.chunks[i].xVelocity / 2f; } if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && this.debrisType != Debris.DebrisType.NUMBERS && Game1.currentLocation.doesTileHaveProperty((int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), "Water", "Back") != null) { Game1.currentLocation.TemporarySprites.Add(new TemporaryAnimatedSprite(28, 300f, 2, 1, this.chunks[i].position, false, false)); Game1.playSound("dropItemInWater"); destroyThisChunk = true; } } if ((!this.chunks[i].hitWall && Game1.currentLocation.Map.GetLayer("Buildings").Tiles[(int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize)] != null) || Game1.currentLocation.Map.GetLayer("Back").Tiles[(int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize)] == null) { this.chunks[i].xVelocity = -this.chunks[i].xVelocity; this.chunks[i].hitWall = true; } if (this.chunks[i].position.Y < (float)this.chunkFinalYLevel) { this.chunks[i].hasPassedRestingLineOnce = true; } if (this.chunks[i].bounces > (this.floppingFish ? 65 : 2)) { this.chunks[i].yVelocity = 0f; this.chunks[i].xVelocity = 0f; this.chunks[i].rotationVelocity = 0f; } this.chunks[i].rotation += this.chunks[i].rotationVelocity; if (destroyThisChunk) { this.chunks.RemoveAt(i); } } } IL_1077 :; } return(this.chunks.Count == 0); }