private void drawNPCSlot(SpriteBatch b, int i) { if (isCharacterSlotClickable(i) && characterSlots[i].bounds.Contains(Game1.getMouseX(), Game1.getMouseY())) { b.Draw(Game1.staminaRect, new Rectangle(xPositionOnScreen + IClickableMenu.borderWidth - 4, sprites[i].bounds.Y - 4, characterSlots[i].bounds.Width, characterSlots[i].bounds.Height - 12), Color.White * 0.25f); } sprites[i].draw(b); string name = names[i] as string; int heartLevel = Game1.player.getFriendshipHeartLevelForNPC(name); bool datable = isDatable(name); Friendship friendship = getFriendship(name); bool spouse = friendship.IsMarried(); bool housemate = spouse && isRoommateOfAnyone(name); float lineHeight = Game1.smallFont.MeasureString("W").Y; float russianOffsetY = (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko) ? ((0f - lineHeight) / 2f) : 0f; b.DrawString(Game1.dialogueFont, npcNames[name], new Vector2((float)(xPositionOnScreen + IClickableMenu.borderWidth * 3 / 2 + 64 - 20 + 96) - Game1.dialogueFont.MeasureString(npcNames[name]).X / 2f, (float)(sprites[i].bounds.Y + 48) + russianOffsetY - (float)(datable ? 24 : 20)), Game1.textColor); for (int hearts = 0; hearts < Math.Max(Utility.GetMaximumHeartsForCharacter(Game1.getCharacterFromName(name)), 10); hearts++) { int xSource = (hearts < heartLevel) ? 211 : 218; if (datable && !friendship.IsDating() && !spouse && hearts >= 8) { xSource = 211; } if (hearts < 10) { b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 320 - 8 + hearts * 32, sprites[i].bounds.Y + 64 - 28), new Rectangle(xSource, 428, 7, 6), (datable && !friendship.IsDating() && !spouse && hearts >= 8) ? (Color.Black * 0.35f) : Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); } else { b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 320 - 8 + (hearts - 10) * 32, sprites[i].bounds.Y + 64), new Rectangle(xSource, 428, 7, 6), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); } } if (datable | housemate) { string text2 = (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.pt) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635") : ((getGender(name) == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635").Split('/').First() : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635").Split('/').Last()); if (housemate) { text2 = Game1.content.LoadString("Strings\\StringsFromCSFiles:Housemate"); } else if (spouse) { text2 = ((getGender(name) == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11636") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11637")); } else if (isMarriedToAnyone(name)) { text2 = ((getGender(name) == 0) ? Game1.content.LoadString("Strings\\UI:SocialPage_MarriedToOtherPlayer_MaleNPC") : Game1.content.LoadString("Strings\\UI:SocialPage_MarriedToOtherPlayer_FemaleNPC")); } else if (!Game1.player.isMarried() && friendship.IsDating()) { text2 = ((getGender(name) == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11639") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11640")); } else if (getFriendship(name).IsDivorced()) { text2 = ((getGender(name) == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11642") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11643")); } int width = (IClickableMenu.borderWidth * 3 + 128 - 40 + 192) / 2; text2 = Game1.parseText(text2, Game1.smallFont, width); Vector2 textSize = Game1.smallFont.MeasureString(text2); b.DrawString(Game1.smallFont, text2, new Vector2((float)(xPositionOnScreen + 192 + 8) - textSize.X / 2f, (float)sprites[i].bounds.Bottom - (textSize.Y - lineHeight)), Game1.textColor); } if (!getFriendship(name).IsMarried() && !kidsNames.Contains(name)) { b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 384 + 264, sprites[i].bounds.Y + 32 - 12), new Rectangle(229, 410, 14, 14), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 384 + 324, sprites[i].bounds.Y + 32), new Rectangle(227 + ((getFriendship(name).GiftsThisWeek >= 2) ? 9 : 0), 425, 9, 9), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); b.Draw(Game1.mouseCursors, new Vector2(xPositionOnScreen + 384 + 364, sprites[i].bounds.Y + 32), new Rectangle(227 + ((getFriendship(name).GiftsThisWeek >= 1) ? 9 : 0), 425, 9, 9), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.88f); } if (spouse) { b.Draw(Game1.objectSpriteSheet, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 7 / 4 + 192, sprites[i].bounds.Y), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, housemate ? 808 : 460, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.88f); } else if (friendship.IsDating()) { b.Draw(Game1.objectSpriteSheet, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 7 / 4 + 192, sprites[i].bounds.Y), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, housemate ? 808 : 458, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.88f); } }
private void drawFarmerSlot(SpriteBatch b, int i) { long farmerID = (long)names[i]; Farmer farmer = Game1.getFarmerMaybeOffline(farmerID); if (farmer != null) { int gender = (!farmer.IsMale) ? 1 : 0; ClickableTextureComponent clickableTextureComponent = sprites[i]; int x = clickableTextureComponent.bounds.X; int y = clickableTextureComponent.bounds.Y; Rectangle origClip = b.GraphicsDevice.ScissorRectangle; Rectangle newClip = origClip; newClip.Height = Math.Min(newClip.Bottom, rowPosition(i)) - newClip.Y - 4; b.GraphicsDevice.ScissorRectangle = newClip; FarmerRenderer.isDrawingForUI = true; try { farmer.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(farmer.bathingClothes ? 108 : 0, 0, secondaryArm: false, flip: false), farmer.bathingClothes ? 108 : 0, new Rectangle(0, farmer.bathingClothes ? 576 : 0, 16, 32), new Vector2(x, y), Vector2.Zero, 0.8f, 2, Color.White, 0f, 1f, farmer); } finally { b.GraphicsDevice.ScissorRectangle = origClip; } FarmerRenderer.isDrawingForUI = false; Friendship friendship = Game1.player.team.GetFriendship(Game1.player.UniqueMultiplayerID, farmerID); bool spouse = friendship.IsMarried(); float lineHeight = Game1.smallFont.MeasureString("W").Y; float russianOffsetY = (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru) ? ((0f - lineHeight) / 2f) : 0f; b.DrawString(Game1.dialogueFont, farmer.Name, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 3 / 2 + 96 - 20, (float)(sprites[i].bounds.Y + 48) + russianOffsetY - 24f), Game1.textColor); string text2 = (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.pt) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635") : ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635").Split('/').First() : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635").Split('/').Last()); if (spouse) { text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11636") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11637")); } else if (farmer.isMarried() && !farmer.hasRoommate()) { text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\UI:SocialPage_MarriedToOtherPlayer_MaleNPC") : Game1.content.LoadString("Strings\\UI:SocialPage_MarriedToOtherPlayer_FemaleNPC")); } else if (!Game1.player.isMarried() && friendship.IsDating()) { text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11639") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11640")); } else if (friendship.IsDivorced()) { text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11642") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11643")); } int width = (IClickableMenu.borderWidth * 3 + 128 - 40 + 192) / 2; text2 = Game1.parseText(text2, Game1.smallFont, width); Vector2 textSize = Game1.smallFont.MeasureString(text2); b.DrawString(Game1.smallFont, text2, new Vector2((float)(xPositionOnScreen + 192 + 8) - textSize.X / 2f, (float)sprites[i].bounds.Bottom - (textSize.Y - lineHeight)), Game1.textColor); if (spouse) { b.Draw(Game1.objectSpriteSheet, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 7 / 4 + 192, sprites[i].bounds.Y), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 801, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.88f); } else if (friendship.IsDating()) { b.Draw(Game1.objectSpriteSheet, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 7 / 4 + 192, sprites[i].bounds.Y), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 458, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.88f); } } }
private FarmEvent pickFarmEvent() { Random random = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 2); if (Game1.weddingToday) { return((FarmEvent)null); } foreach (Farmer onlineFarmer in Game1.getOnlineFarmers()) { Friendship spouseFriendship = onlineFarmer.GetSpouseFriendship(); if (spouseFriendship != null && spouseFriendship.IsMarried() && spouseFriendship.WeddingDate == Game1.Date) { return((FarmEvent)null); } } if (Game1.stats.DaysPlayed == 31U) { return((FarmEvent) new SoundInTheNightEvent(4)); } if (Game1.player.mailForTomorrow.Contains("jojaPantry%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaPantry")) { return((FarmEvent) new WorldChangeEvent(0)); } if (Game1.player.mailForTomorrow.Contains("ccPantry%&NL&%") || Game1.player.mailForTomorrow.Contains("ccPantry")) { return((FarmEvent) new WorldChangeEvent(1)); } if (Game1.player.mailForTomorrow.Contains("jojaVault%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaVault")) { return((FarmEvent) new WorldChangeEvent(6)); } if (Game1.player.mailForTomorrow.Contains("ccVault%&NL&%") || Game1.player.mailForTomorrow.Contains("ccVault")) { return((FarmEvent) new WorldChangeEvent(7)); } if (Game1.player.mailForTomorrow.Contains("jojaBoilerRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaBoilerRoom")) { return((FarmEvent) new WorldChangeEvent(2)); } if (Game1.player.mailForTomorrow.Contains("ccBoilerRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("ccBoilerRoom")) { return((FarmEvent) new WorldChangeEvent(3)); } if (Game1.player.mailForTomorrow.Contains("jojaCraftsRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaCraftsRoom")) { return((FarmEvent) new WorldChangeEvent(4)); } if (Game1.player.mailForTomorrow.Contains("ccCraftsRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("ccCraftsRoom")) { return((FarmEvent) new WorldChangeEvent(5)); } if (Game1.player.mailForTomorrow.Contains("jojaFishTank%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaFishTank")) { return((FarmEvent) new WorldChangeEvent(8)); } if (Game1.player.mailForTomorrow.Contains("ccFishTank%&NL&%") || Game1.player.mailForTomorrow.Contains("ccFishTank")) { return((FarmEvent) new WorldChangeEvent(9)); } if (Game1.player.mailForTomorrow.Contains("ccMovieTheaterJoja%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaMovieTheater")) { return((FarmEvent) new WorldChangeEvent(10)); } if (Game1.player.mailForTomorrow.Contains("ccMovieTheater%&NL&%") || Game1.player.mailForTomorrow.Contains("ccMovieTheater")) { return((FarmEvent) new WorldChangeEvent(11)); } if (Game1.MasterPlayer.eventsSeen.Contains(191393) && (Game1.isRaining || Game1.isLightning) && (!Game1.MasterPlayer.mailReceived.Contains("abandonedJojaMartAccessible") && !Game1.MasterPlayer.mailReceived.Contains("ccMovieTheater"))) { return((FarmEvent) new WorldChangeEvent(12)); } if (random.NextDouble() < 0.01 && !Game1.currentSeason.Equals("winter")) { return((FarmEvent) new FairyEvent()); } if (random.NextDouble() < 0.01) { return((FarmEvent) new WitchEvent()); } if (random.NextDouble() < 0.01) { return((FarmEvent) new SoundInTheNightEvent(1)); } if (random.NextDouble() < 0.01 && Game1.year > 1) { return((FarmEvent) new SoundInTheNightEvent(0)); } if (random.NextDouble() < 0.01) { return((FarmEvent) new SoundInTheNightEvent(3)); } return((FarmEvent)null); }