Base for birthday events is put inplace. Now to make all of the actual content.

This commit is contained in:
2018-09-18 22:35:36 -07:00
parent d6280b5c1b
commit 4887b38cde
3 changed files with 45 additions and 7 deletions

View File

@ -0,0 +1,35 @@
using StardewValley;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Omegasis.HappyBirthday
{
/// <summary>
/// TODO:Make all the events
/// Resources:https://stardewvalleywiki.com/Modding:Event_data
/// </summary>
public class BirthdayEvents
{
public Event communityCenterJunimoEvent;
public Event marriedNoKidsEvent;
public Event surpriseBirthdayPartyEvent;
public Event marriedWithOneKidEvent;
public Event marriedWithTwoKidsEvent;
public BirthdayEvents()
{
initializeEvents();
}
public void initializeEvents()
{
Event e = new Event("", -1, Game1.player);
Game1.player.currentLocation.currentEvent = new Event();
}
}
}

View File

@ -20,7 +20,7 @@ namespace Omegasis.HappyBirthday
/// <summary> /// <summary>
/// TODO: Make this. /// TODO: Make this.
/// </summary> /// </summary>
public Dictionary<string, string> defaultSpouseBirthdayWishes = new Dictionary<string, string>() private Dictionary<string, string> defaultSpouseBirthdayWishes = new Dictionary<string, string>()
{ {
["Alex"] = "", ["Alex"] = "",
["Elliott"] = "", ["Elliott"] = "",
@ -79,7 +79,7 @@ namespace Omegasis.HappyBirthday
/// <summary> /// <summary>
/// Used to load all of the default birthday greetings. /// Used to load all of the default birthday greetings.
/// </summary> /// </summary>
private void createBirthdayGreetings() public void createBirthdayGreetings()
{ {
var serializer = JsonSerializer.Create(); var serializer = JsonSerializer.Create();

View File

@ -69,6 +69,7 @@ namespace Omegasis.HappyBirthday
public static IModHelper ModHelper; public static IModHelper ModHelper;
public BirthdayMessages messages;
/********* /*********
@ -79,7 +80,7 @@ namespace Omegasis.HappyBirthday
public override void Entry(IModHelper helper) public override void Entry(IModHelper helper)
{ {
helper.Content.AssetLoaders.Add(new PossibleGifts()); helper.Content.AssetLoaders.Add(new PossibleGifts());
this.Config = helper.ReadConfig<ModConfig>(); Config = helper.ReadConfig<ModConfig>();
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted; TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
GameEvents.UpdateTick += this.GameEvents_UpdateTick; GameEvents.UpdateTick += this.GameEvents_UpdateTick;
@ -92,6 +93,8 @@ namespace Omegasis.HappyBirthday
StardewModdingAPI.Events.GraphicsEvents.OnPostRenderHudEvent += GraphicsEvents_OnPostRenderHudEvent; ; StardewModdingAPI.Events.GraphicsEvents.OnPostRenderHudEvent += GraphicsEvents_OnPostRenderHudEvent; ;
//MultiplayerSupport.initializeMultiplayerSupport(); //MultiplayerSupport.initializeMultiplayerSupport();
ModHelper = Helper; ModHelper = Helper;
messages = new BirthdayMessages();
} }
@ -199,7 +202,7 @@ namespace Omegasis.HappyBirthday
{ {
// show birthday selection menu // show birthday selection menu
if (Game1.activeClickableMenu != null) return; if (Game1.activeClickableMenu != null) return;
if (Context.IsPlayerFree && !this.HasChosenBirthday && e.KeyPressed.ToString() == this.Config.KeyBinding) if (Context.IsPlayerFree && !this.HasChosenBirthday && e.KeyPressed.ToString() == Config.KeyBinding)
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday); Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
} }
@ -220,7 +223,7 @@ namespace Omegasis.HappyBirthday
this.MigrateLegacyData(); this.MigrateLegacyData();
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData(); this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
createBirthdayGreetings(); messages.createBirthdayGreetings();
//this.SeenEvent = false; //this.SeenEvent = false;
//this.Dialogue = new Dictionary<string, Dialogue>(); //this.Dialogue = new Dictionary<string, Dialogue>();
} }
@ -280,9 +283,9 @@ namespace Omegasis.HappyBirthday
{ {
if (Game1.player.getFriendshipHeartLevelForNPC(npc.Name) >= Config.minimumFriendshipLevelForBirthdayWish) if (Game1.player.getFriendshipHeartLevelForNPC(npc.Name) >= Config.minimumFriendshipLevelForBirthdayWish)
{ {
Dialogue d = new Dialogue(Game1.content.Load<Dictionary<string, string>>("Data\\FarmerBirthdayDialogue")[npc.Name], npc); Dialogue d = new Dialogue(messages.birthdayWishes[npc.Name], npc);
npc.CurrentDialogue.Push(d); npc.CurrentDialogue.Push(d);
if (npc.CurrentDialogue.ElementAt(0) != d) npc.setNewDialogue(Game1.content.Load<Dictionary<string, string>>("Data\\FarmerBirthdayDialogue")[npc.Name]); if (npc.CurrentDialogue.ElementAt(0) != d) npc.setNewDialogue(messages.birthdayWishes[npc.Name]);
} }
} }
catch catch