Updated HappyBirthday with some requested fixes.

This commit is contained in:
Joshua Navarro 2016-11-08 01:19:56 -08:00
parent 5e0f9eea3d
commit 61e41be188
7 changed files with 96 additions and 52 deletions

View File

@ -37,6 +37,8 @@ namespace StardewValley.Menus
public List<ClickableComponent> seasonButtons = new List<ClickableComponent>();
public List<ClickableComponent> seasonTitleButtons = new List<ClickableComponent>();
public ClickableTextureComponent okButton;
public ClickableTextureComponent skipIntroButton;
@ -87,10 +89,10 @@ namespace StardewValley.Menus
//new ClickableComponent(new Rectangle(x2, y, Game1.tileSize * 3 / 4 - 4, Game1.tileSize * 3 / 4 - 4), string.Concat((object) (index * 5))) //allows you to make numbers into buttons: Taken from elevator menu
this.labels.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4 + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 + 8, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder - Game1.tileSize / 8, 1, 1),"Birthday Season: "+ HappyBirthday.Class1.player_birthday_season));
this.labels.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4 + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 + 8, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + Game1.tileSize, Game1.tileSize * 2, Game1.tileSize), "Birthday Date: " + HappyBirthday.Class1.player_birthday_date));
this.seasonButtons.Add(new ClickableTextureComponent("Spring", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 1 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.10) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(188, 438, 32, 9), (float)Game1.pixelZoom, false));
this.seasonButtons.Add(new ClickableTextureComponent("Summer", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.10) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(220, 438, 32, 8), (float)Game1.pixelZoom, false));
this.seasonButtons.Add(new ClickableTextureComponent("Fall", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 5 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.1) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(188, 447, 32, 10), (float)Game1.pixelZoom, false));
this.seasonButtons.Add(new ClickableTextureComponent("Winter", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 7 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.1) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(220, 448, 32, 8), (float)Game1.pixelZoom, false));
this.seasonTitleButtons.Add(new ClickableTextureComponent("Spring", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 1 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.10) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(188, 438, 32, 9), (float)Game1.pixelZoom, false));
this.seasonTitleButtons.Add(new ClickableTextureComponent("Summer", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 3 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.10) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(220, 438, 32, 8), (float)Game1.pixelZoom, false));
this.seasonTitleButtons.Add(new ClickableTextureComponent("Fall", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 5 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.1) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(188, 447, 32, 10), (float)Game1.pixelZoom, false));
this.seasonTitleButtons.Add(new ClickableTextureComponent("Winter", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 7 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + (int)(Game1.tileSize * 3.1) - Game1.tileSize / 4, Game1.tileSize*2, Game1.tileSize), "", "", Game1.mouseCursors, new Rectangle(220, 448, 32, 8), (float)Game1.pixelZoom, false));
this.seasonButtons.Add(new ClickableTextureComponent("1", new Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth + Game1.tileSize * 1 - Game1.tileSize / 4, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + Game1.tileSize * 4 - Game1.tileSize / 4, Game1.tileSize * 1, Game1.tileSize), "", "", Game1.content.Load<Texture2D>("LooseSprites\\font_bold"), new Rectangle(8, 16, 8, 12), (float)Game1.pixelZoom, false));
@ -176,8 +178,9 @@ namespace StardewValley.Menus
}
else if (name == "OK")
else if (name == "OK" && (HappyBirthday.Class1.player_birthday_date >= 1 || HappyBirthday.Class1.player_birthday_date <= 28))
{
if (!this.canLeaveMenu())
{
return;
@ -216,34 +219,6 @@ namespace StardewValley.Menus
{
if (name != null)
{
if (name == "Skin")
{
Game1.player.changeSkinColor(Game1.player.skin + change);
Game1.playSound("skeletonStep");
return;
}
if (name == "Hair")
{
Game1.player.changeHairStyle(Game1.player.hair + change);
Game1.playSound("grassyStep");
return;
}
if (name == "Shirt")
{
Game1.player.changeShirt(Game1.player.shirt + change);
Game1.playSound("coin");
return;
}
if (name == "Acc")
{
Game1.player.changeAccessory(Game1.player.accessory + change);
Game1.playSound("purchase");
return;
}
if (!(name == "Direction"))
{
return;
}
Game1.player.faceDirection((Game1.player.facingDirection - change + 4) % 4);
Game1.player.FarmerSprite.StopAnimation();
Game1.player.completelyStopAnimatingOrDoingAction();
@ -263,7 +238,15 @@ namespace StardewValley.Menus
current2.scale = Math.Max(3.5f, current2.scale);
}
}
foreach (ClickableComponent current2 in this.seasonTitleButtons)
{
if (current2.containsPoint(x, y))
{
this.optionButtonClick(current2.name);
current2.scale -= 0.5f;
current2.scale = Math.Max(3.5f, current2.scale);
}
}
if (this.okButton.containsPoint(x, y) && this.canLeaveMenu())
{
@ -320,6 +303,22 @@ namespace StardewValley.Menus
}
}
}
using (List<ClickableComponent>.Enumerator enumerator4 = this.seasonTitleButtons.GetEnumerator())
{
while (enumerator4.MoveNext())
{
ClickableTextureComponent clickableTextureComponent4 = (ClickableTextureComponent)enumerator4.Current;
if (clickableTextureComponent4.containsPoint(x, y))
{
clickableTextureComponent4.scale = Math.Min(clickableTextureComponent4.scale + 0.02f, clickableTextureComponent4.baseScale + 0.1f);
}
else
{
clickableTextureComponent4.scale = Math.Max(clickableTextureComponent4.scale - 0.02f, clickableTextureComponent4.baseScale);
}
}
}
}
if (this.okButton.containsPoint(x, y) && this.canLeaveMenu())
{
@ -345,10 +344,17 @@ namespace StardewValley.Menus
if (!this.wizardSource)
{
foreach (ClickableTextureComponent textureComponent in this.seasonButtons)
if(HappyBirthday.Class1.player_birthday_season=="spring" || HappyBirthday.Class1.player_birthday_season == "summer" || HappyBirthday.Class1.player_birthday_season == "fall" || HappyBirthday.Class1.player_birthday_season == "winter"){
foreach (ClickableTextureComponent textureComponent in this.seasonButtons)
{
textureComponent.draw(b);
// b.Draw(Game1.mouseCursors, textureComponent.bounds, new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 34, -1, -1)), Color.White);
}
}
foreach (ClickableTextureComponent textureComponent in this.seasonTitleButtons)
{
textureComponent.draw(b);
// b.Draw(Game1.mouseCursors, textureComponent.bounds, new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 34, -1, -1)), Color.White);
// b.Draw(Game1.mouseCursors, textureComponent.bounds, new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 34, -1, -1)), Color.White);
}
foreach (ClickableComponent clickableComponent in this.labels)
{
@ -406,7 +412,7 @@ namespace StardewValley.Menus
if (this.canLeaveMenu())
{
this.okButton.draw(b);
if(HappyBirthday.Class1.player_birthday_date!=0 && HappyBirthday.Class1.player_birthday_season!="") this.okButton.draw(b);
}
else
{

View File

@ -19,6 +19,9 @@ namespace HappyBirthday
bool once;
bool has_input_birthday;
Dictionary<string, Dialogue> popedDialogue;
bool seenEvent;
public string folder_name ="Player_Birthdays";
public string birthdays_path;
@ -43,15 +46,9 @@ namespace HappyBirthday
public void TimeEvents_DayOfMonthChanged(object sender, StardewModdingAPI.Events.EventArgsIntChanged e)
{
//Log.AsyncC("I cant tell");
if (isplayersbirthday() == true)
{
//Log.AsyncC("YES");
//Game1.mailbox.Enqueue("\n Dear @,^ Happy birthday sweetheart. It's been amazing watching you grow into the kind, hard working person that I've always dreamed that you would become. I hope you continue to make many more fond memories with the ones you love. ^ Love, Mom ^ P.S. Here's a little something that I made for you. %item object 221 1 %");
//Game1.mailbox.Enqueue("\n Dear @,^ Happy birthday kiddo. It's been a little quiet around here on your birthday since you aren't around, but your mother and I know that you are making both your grandpa and us proud. We both know that living on your own can be tough but we believe in you one hundred percent, just keep following your dreams.^ Love, Dad ^ P.S. Here's some spending money to help you out on the farm. Good luck! %item money 5000 5001 %");
}
// Log.AsyncC("Maybe?");
if (Game1.player == null) return;
if (has_input_birthday == true) MyWritter_Birthday();
MyWritter_Settings();
@ -77,6 +74,8 @@ namespace HappyBirthday
game_loaded = true;
DataLoader_Birthday();
DataLoader_Settings();
seenEvent = false;
popedDialogue = new Dictionary<string, Dialogue>();
}
public void GameEvents_UpdateTick(object sender, EventArgs e)
@ -104,7 +103,9 @@ namespace HappyBirthday
{
if (npc is StardewValley.Characters.Cat || npc is StardewValley.Characters.Child || npc is StardewValley.Characters.Dog || npc is StardewValley.Characters.Horse || npc is StardewValley.Characters.Junimo || npc is StardewValley.Characters.Pet) continue;
if (npc is StardewValley.Monsters.Bat || npc is StardewValley.Monsters.BigSlime || npc is StardewValley.Monsters.Bug || npc is StardewValley.Monsters.Cat || npc is StardewValley.Monsters.Crow || npc is StardewValley.Monsters.Duggy || npc is StardewValley.Monsters.DustSpirit || npc is StardewValley.Monsters.Fireball || npc is StardewValley.Monsters.Fly || npc is StardewValley.Monsters.Ghost || npc is StardewValley.Monsters.GoblinPeasant || npc is StardewValley.Monsters.GoblinWizard || npc is StardewValley.Monsters.GreenSlime || npc is StardewValley.Monsters.Grub || npc is StardewValley.Monsters.LavaCrab || npc is StardewValley.Monsters.MetalHead || npc is StardewValley.Monsters.Monster || npc is StardewValley.Monsters.Mummy || npc is StardewValley.Monsters.RockCrab || npc is StardewValley.Monsters.RockGolem || npc is StardewValley.Monsters.Serpent || npc is StardewValley.Monsters.ShadowBrute || npc is StardewValley.Monsters.ShadowGirl || npc is StardewValley.Monsters.ShadowGuy || npc is StardewValley.Monsters.ShadowShaman || npc is StardewValley.Monsters.Skeleton || npc is StardewValley.Monsters.SkeletonMage || npc is StardewValley.Monsters.SkeletonWarrior || npc is StardewValley.Monsters.Spiker || npc is StardewValley.Monsters.SquidKid) continue;
npc.CurrentDialogue.Push(new Dialogue(Game1.content.Load<Dictionary<string, string>>("Data\\FarmerBirthdayDialogue")[npc.name], npc));
Dialogue d =new Dialogue(Game1.content.Load<Dictionary<string, string>>("Data\\FarmerBirthdayDialogue")[npc.name], npc);
npc.CurrentDialogue.Push(d);
if (npc.CurrentDialogue.ElementAt(0) != d) npc.setNewDialogue(Game1.content.Load<Dictionary<string, string>>("Data\\FarmerBirthdayDialogue")[npc.name]);
}
// npc.setNewDialogue(Game1.content.Load<Dictionary<string, string>>("Data\\FarmerBirthdayDialogue")[npc.name], true, false);
catch
@ -112,7 +113,9 @@ namespace HappyBirthday
if (npc is StardewValley.Characters.Cat || npc is StardewValley.Characters.Child || npc is StardewValley.Characters.Dog || npc is StardewValley.Characters.Horse || npc is StardewValley.Characters.Junimo || npc is StardewValley.Characters.Pet) continue;
if (npc is StardewValley.Monsters.Bat || npc is StardewValley.Monsters.BigSlime || npc is StardewValley.Monsters.Bug || npc is StardewValley.Monsters.Cat || npc is StardewValley.Monsters.Crow || npc is StardewValley.Monsters.Duggy || npc is StardewValley.Monsters.DustSpirit || npc is StardewValley.Monsters.Fireball || npc is StardewValley.Monsters.Fly || npc is StardewValley.Monsters.Ghost || npc is StardewValley.Monsters.GoblinPeasant || npc is StardewValley.Monsters.GoblinWizard || npc is StardewValley.Monsters.GreenSlime || npc is StardewValley.Monsters.Grub || npc is StardewValley.Monsters.LavaCrab || npc is StardewValley.Monsters.MetalHead || npc is StardewValley.Monsters.Monster || npc is StardewValley.Monsters.Mummy || npc is StardewValley.Monsters.RockCrab || npc is StardewValley.Monsters.RockGolem || npc is StardewValley.Monsters.Serpent || npc is StardewValley.Monsters.ShadowBrute || npc is StardewValley.Monsters.ShadowGirl || npc is StardewValley.Monsters.ShadowGuy || npc is StardewValley.Monsters.ShadowShaman || npc is StardewValley.Monsters.Skeleton || npc is StardewValley.Monsters.SkeletonMage || npc is StardewValley.Monsters.SkeletonWarrior || npc is StardewValley.Monsters.Spiker || npc is StardewValley.Monsters.SquidKid) continue;
// npc.setNewDialogue("Happy birthday @!", true, false);
npc.CurrentDialogue.Push(new Dialogue("Happy Birthday @!", npc));
Dialogue d = new Dialogue("Happy Birthday @!", npc);
npc.CurrentDialogue.Push(d);
if (npc.CurrentDialogue.ElementAt(0) != d) npc.setNewDialogue("Happy Birthday @!");
}
}
}
@ -124,14 +127,41 @@ namespace HappyBirthday
Game1.activeClickableMenu = new StardewValley.Menus.Birthday_Menu();
once = false;
}
}
if (Game1.eventUp == true)
{
foreach(string npcName in npc_name_list)
{
NPC npc = Game1.getCharacterFromName(npcName);
try {
popedDialogue.Add(npcName, npc.CurrentDialogue.Pop());
}
catch (Exception err)
{
popedDialogue.Add(npcName, npc.CurrentDialogue.ElementAt(0));
npc.loadSeasonalDialogue();
}
seenEvent = true;
}
}
if (Game1.eventUp == false && seenEvent == true)
{
foreach (KeyValuePair<string,Dialogue> v in popedDialogue)
{
NPC npc = Game1.getCharacterFromName(v.Key);
npc.CurrentDialogue.Push(v.Value);
}
popedDialogue.Clear();
seenEvent = false;
}
if (Game1.currentSpeaker != null)
{
if (isplayersbirthday()==true)
{
try
{
//Game1.currentSpeaker.setNewDialogue(Game1.content.Load<Dictionary<string, string>>("Data\\FarmerBirthdayDialogue")[Game1.currentSpeaker.name], true, false);
@ -156,12 +186,14 @@ namespace HappyBirthday
}
}
}
}
}
if (birthday_gift_to_receive != null && Game1.currentSpeaker==null)
{
while (birthday_gift_to_receive.Name=="Error Item"|| birthday_gift_to_receive.Name=="Rock"|| birthday_gift_to_receive.Name == "???")
{
birthday_gift();
}
Game1.player.addItemByMenuIfNecessaryElseHoldUp(birthday_gift_to_receive);
birthday_gift_to_receive = null;
}

View File

@ -1,10 +1,10 @@
Happy Birthday
Version:1.1.0
Version:1.1.1
Published: 8/18/16 11:21 AM
Updated: 10/20/16 12:09 AM
Updated: 11/8/16 1:17 AM
Compatability:
@ -43,6 +43,12 @@ Note: This mod was built with custom NPCs in mind. You can either add in your cu
Have fun!
Update Info:
1.1.1
-Balanced some gifts to be a bit less op. (Like 25 rabit foots);
-Fixed the birthday menu to force you to choose a season and date before you are allowed to exit the menu.
-Hopefully fixed the ???, Error Item, and useless rocks from showing up as possible gifts.
-Implemented a cheep fix to hopefully prevent the game from crashing when inside an event. It gives priority to the event over your birthday in worst case scenario.
1.1.0
-Updated to SDV 1.1
-Added a popup that wishes you happy birthday on your birthday