More work to come. Needs content, AssetLoaders, and consistency

This commit is contained in:
2018-09-19 01:37:51 -07:00
parent 4887b38cde
commit 7e40cb2583
4 changed files with 57 additions and 28 deletions

View File

@ -86,11 +86,11 @@ namespace Omegasis.HappyBirthday
serializer.Formatting = Formatting.Indented;
//English logic.
string defaultPath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", "English");
string defaultPath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation);
if (!Directory.Exists(defaultPath)) Directory.CreateDirectory(defaultPath);
string birthdayFileDict=HappyBirthday.Config.translationInfo.getjsonForTranslation("BirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation);
string path = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue","English", birthdayFileDict);
string path = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, birthdayFileDict);
//Handle normal birthday wishes.
if (!File.Exists(path))
@ -109,7 +109,7 @@ namespace Omegasis.HappyBirthday
//handle spouse birthday wishes.
string spouseBirthdayFileDict = HappyBirthday.Config.translationInfo.getjsonForTranslation("SpouseBirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation);
string spousePath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue","English",spouseBirthdayFileDict);
string spousePath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, spouseBirthdayFileDict);
if (!File.Exists(path))
{

View File

@ -79,7 +79,7 @@ namespace Omegasis.HappyBirthday
/// <param name="helper">Provides simplified APIs for writing mods.</param>
public override void Entry(IModHelper helper)
{
helper.Content.AssetLoaders.Add(new PossibleGifts());
//helper.Content.AssetLoaders.Add(new PossibleGifts());
Config = helper.ReadConfig<ModConfig>();
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
@ -523,20 +523,29 @@ namespace Omegasis.HappyBirthday
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minNeutralFriendshipGiftLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxNeutralFriendshipGiftLevel)
this.PossibleBirthdayGifts.AddRange(this.GetUniversalItems("Neutral", false));
}
if (Game1.player.isMarried())
{
if (name == Game1.player.spouse)
{
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(198, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(204, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(220, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(221, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(223, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(233, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(234, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(286, 5));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(368, 5));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(608, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(612, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(773, 1));
}
}
//TODO: Make different tiers of gifts depending on the friendship, and if it is the spouse.
/*
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(198, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(204, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(220, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(221, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(223, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(233, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(234, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(286, 5));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(368, 5));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(608, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(612, 1));
this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(773, 1));
*/
return gifts;

View File

@ -81,10 +81,13 @@
<Compile Include="..\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="BirthdayEvents.cs" />
<Compile Include="BirthdayMessages.cs" />
<Compile Include="Framework\BirthdayMenu.cs" />
<Compile Include="Framework\ModConfig.cs" />
<Compile Include="Framework\MultiplayerSupport.cs" />
<Compile Include="Framework\PlayerData.cs" />
<Compile Include="Framework\TranslationInfo.cs" />
<Compile Include="HappyBirthday.cs" />
<Compile Include="Framework\Messages.cs" />
<Compile Include="Framework\ObjectUtility.cs" />

View File

@ -3,19 +3,9 @@ using System.Collections.Generic;
namespace Omegasis.HappyBirthday
{
class PossibleGifts : IAssetLoader
public class PossibleGifts
{
public bool CanLoad<T>(IAssetInfo asset)
{
return asset.AssetNameEquals(@"Data\PossibleBirthdayGifts");
}
/// <summary>Load a matched asset.</summary>
/// <param name="asset">Basic metadata about the asset being loaded.</param>
public T Load<T>(IAssetInfo asset)
{
return (T)(object)new Dictionary<string, string> // (T)(object) is a trick to cast anything to T if we know it's compatible
{
private Dictionary<string,string> defaultBirthdayGifts=new Dictionary<string, string>() {
["Universal_Love_Gift"] = "74 1 446 1 204 1 446 5 773 1",
["Universal_Like_Gift"] = "-2 3 -7 1 -26 2 -75 5 -80 3 72 1 220 1 221 1 395 1 613 1 634 1 635 1 636 1 637 1 638 1 724 1 233 1 223 1 465 20 -79 5",
["Universal_Neutral_Gift"] = "194 1 262 5 -74 5 -75 3 334 5 335 1 390 20 388 20 -81 5 -79 3",
@ -53,6 +43,33 @@ namespace Omegasis.HappyBirthday
["Willy"] = " Best/72 1 143 1 149 1 154 1 276 1 337 1 698 1 /Good/66 1 336 1 340 1 699 1 707 1 /Neutral/-4 3 / ",
["Krobus"] = " Best/72 1 16 1 276 1 337 1 305 1 /Good/66 1 336 1 340 1 /Neutral// "
};
private Dictionary<string, string> defaultSpouseBirthdayGifts = new Dictionary<string, string>() {
["Universal_Love_Gift"] = "74 1 446 1 204 1 446 5 773 1",
["Universal_Like_Gift"] = "-2 3 -7 1 -26 2 -75 5 -80 3 72 1 220 1 221 1 395 1 613 1 634 1 635 1 636 1 637 1 638 1 724 1 233 1 223 1 465 20 -79 5",
["Universal_Neutral_Gift"] = "194 1 262 5 -74 5 -75 3 334 5 335 1 390 20 388 20 -81 5 -79 3",
["Alex"] = "",
["Elliott"] = "",
["Harvey"] = "",
["Sam"] = "",
["Sebastian"] = "",
["Shane"] = "",
["Abigail"] = "",
["Emily"] = "",
["Haley"] = "",
["Leah"] = "",
["Maru"] = "",
["Penny"] = "",
};
public Dictionary<string, string> BirthdayGifts;
public PossibleGifts()
{
}
}
}