Merge pull request #47 from janavarro95/Development

Merge branches.
This commit is contained in:
Joshua Navarro 2018-12-17 10:38:19 -08:00 committed by GitHub
commit 79c2965ae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
882 changed files with 15734 additions and 2158 deletions

View File

@ -87,15 +87,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -85,15 +85,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
{
"Name": "Auto Speed",
"Author": "Alpha_Omegasis",
"Version": "1.5.0",
"Version": "1.6.0",
"Description": "Got to go fast!",
"UniqueID": "Omegasis.AutoSpeed",
"EntryDll": "AutoSpeed.dll",

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -87,15 +87,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
{
"Name": "Billboard Anywhere",
"Author": "Alpha_Omegasis",
"Version": "1.5.0",
"Version": "1.6.0",
"Description": "Lets you view the billboard from anywhere.",
"UniqueID": "Omegasis.BillboardAnywhere",
"EntryDll": "BillboardAnywhere.dll",

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -99,7 +99,7 @@ namespace Omegasis.BuildEndurance
}
// give XP when exhausted
if (!this.WasExhausted && Game1.player.exhausted)
if (!this.WasExhausted && Game1.player.exhausted.Value)
{
this.PlayerData.CurrentExp += this.Config.ExpForExhaustion;
this.WasExhausted = true;
@ -107,8 +107,9 @@ namespace Omegasis.BuildEndurance
}
// give XP when player stays up too late or collapses
if (!this.WasCollapsed && Game1.farmerShouldPassOut)
if (!this.WasCollapsed && shouldFarmerPassout())
{
this.PlayerData.CurrentExp += this.Config.ExpForCollapsing;
this.WasCollapsed = true;
//this.Monitor.Log("The player has collapsed!");
@ -180,7 +181,7 @@ namespace Omegasis.BuildEndurance
}
}
this.PlayerData.ClearModEffects = false;
this.PlayerData.NightlyStamina = Game1.player.maxStamina;
this.PlayerData.NightlyStamina = Game1.player.MaxStamina;
// save data
this.Helper.WriteJsonFile(this.DataFilePath, this.PlayerData);
@ -219,5 +220,15 @@ namespace Omegasis.BuildEndurance
this.Monitor.Log($"Error migrating data from the legacy 'PlayerData' folder for the current player. Technical details:\n {ex}", LogLevel.Error);
}
}
/// <summary>
/// Try and emulate the old Game1.shouldFarmerPassout logic.
/// </summary>
/// <returns></returns>
public bool shouldFarmerPassout()
{
if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true;
else return false;
}
}
}

View File

@ -86,15 +86,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
{
"Name": "Build Endurance",
"Author": "Alpha_Omegasis",
"Version": "1.5.0",
"Version": "1.6.0",
"Description": "Increase your health as you play.",
"UniqueID": "Omegasis.BuildEndurance",
"EntryDll": "BuildEndurance.dll",

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -103,11 +103,10 @@ namespace Omegasis.BuildHealth
this.LastHealth = player.health;
// give XP when player stays up too late or collapses
if (!this.WasCollapsed && Game1.farmerShouldPassOut)
if (!this.WasCollapsed && shouldFarmerPassout())
{
this.PlayerData.CurrentExp += this.Config.ExpForCollapsing;
this.WasCollapsed = true;
this.Monitor.Log("The player has collapsed!");
}
}
@ -210,5 +209,11 @@ namespace Omegasis.BuildHealth
this.Monitor.Log($"Error migrating data from the legacy 'PlayerData' folder for the current player. Technical details:\n {ex}", LogLevel.Error);
}
}
public bool shouldFarmerPassout()
{
if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true;
else return false;
}
}
}

View File

@ -86,15 +86,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
{
"Name": "Build Health",
"Author": "Alpha_Omegasis",
"Version": "1.5.0",
"Version": "1.6.0",
"Description": "Increase your health as you play.",
"UniqueID": "Omegasis.BuildHealth",
"EntryDll": "BuildHealth.dll",

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -88,15 +88,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -109,25 +109,25 @@
<Compile Include="Framework\Utilities\NPCTracker.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StardustCore\StardustCore.csproj">
<Project>{0756D36A-95C8-480D-8EA6-4584C03010C6}</Project>
<Name>StardustCore</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -190,7 +190,7 @@ namespace CustomNPCFramework.Framework.NPCS
this.Sprite.standAndFaceDirection(this.defaultFacingDirection);
if (this.isMarried())
this.marriageDuties(true);
this.marriageDuties();
bool flag = Utility.isFestivalDay(Game1.dayOfMonth, Game1.currentSeason);
try
{
@ -597,7 +597,7 @@ namespace CustomNPCFramework.Framework.NPCS
bool flag = Utility.isFestivalDay(dayOfMonth, Game1.currentSeason);
if (!this.isMarried())
return;
this.marriageDuties(true);
this.marriageDuties();
//Friendship f=Game1.player.GetSpouseFriendship();
//this.daysMarried = this.daysMarried + 1;
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -87,15 +87,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net461" />
</packages>

View File

@ -86,15 +86,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -91,14 +91,14 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net461" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net461" />
</packages>

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

@ -0,0 +1,175 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Omegasis.HappyBirthday
{
public class BirthdayMessages
{
/// <summary>
/// The actual birthday wishes given by an npc.
/// </summary>
public Dictionary<string, string> birthdayWishes;
public Dictionary<string, string> spouseBirthdayWishes;
/// <summary>
/// TODO: Make this.
/// </summary>
public Dictionary<string, string> defaultSpouseBirthdayWishes = new Dictionary<string, string>()
{
["Alex"] = "",
["Elliott"] = "",
["Harvey"] = "",
["Sam"] = "",
["Sebastian"] = "",
["Shane"] = "",
["Abigail"] = "",
["Emily"] = "",
["Haley"] = "",
["Leah"] = "",
["Maru"] = "",
["Penny"] = "",
};
/// <summary>
/// Used to contain
/// </summary>
public Dictionary<string, string> defaultBirthdayWishes = new Dictionary<string, string>()
{
["Robin"] = "Hey @, happy birthday! I'm glad you choose this town to move here to. ",
["Demetrius"] = "Happy birthday @! Make sure you take some time off today to enjoy yourself. $h",
["Maru"] = "Happy birthday @. I tried to make you an everlasting candle for you, but sadly that didn't work out. Maybe next year right? $h",
["Sebastian"] = "Happy birthday @. Here's to another year of chilling. ",
["Linus"] = "Happy birthday @. Thanks for visiting me even on your birthday. It makes me really happy. ",
["Pierre"] = "Hey @, happy birthday! Hopefully this next year for you will be a great one! ",
["Caroline"] = "Happy birthday @. Thank you for all that you've done for our community. I'm sure your parents must be proud of you.$h",
["Abigail"] = "Happy birthday @! Hopefully this year we can go on even more adventures together $h!",
["Alex"] = "Yo @, happy birthday! Maybe this will be your best year yet.$h",
["George"] = "When you get to my age birthdays come and go. Still happy birthday @.",
["Evelyn"] = "Happy birthday @. You have grown up to be such a fine individual and I'm sure you'll continue to grow. ",
["Lewis"] = "Happy birthday @! I'm thankful for what you have done for the town and I'm sure your grandfather would be proud of you.",
["Clint"] = "Hey happy birthday @. I'm sure this year is going to be great for you.",
["Penny"] = "Happy birthday @. May you enjoy all of life's blessings this year. ",
["Pam"] = "Happy birthday kid. We should have a drink to celebrate another year of life for you! $h",
["Emily"] = "I'm sensing a strong positive life energy about you, so it must be your birthday. Happy birthday @!$h",
["Haley"] = "Happy birthday @. Hopefully this year you'll get some good presents!$h",
["Jas"] = "Happy birthday @. I hope you have a good birthday.",
["Vincent"] = "Hey @ have you come to pl...oh it's your birthday? Happy birthday! ",
["Jodi"] = "Hello there @. Rumor has it that today is your birthday. In that case, happy birthday!$h",
["Kent"] = "Jodi told me that it was your birthday today @. Happy birthday and make sure to cherish every single day.",
["Sam"] = "Yo @ happy birthday! We'll have to have a birthday jam session for you some time!$h ",
["Leah"] = "Hey @ happy birthday! We should go to the saloon tonight and celebrate!$h ",
["Shane"] = "Happy birthday @. Keep working hard and I'm sure this next year for you will be a great one.",
["Marnie"] = "Hello there @. Everyone is talking about your birthday today and I wanted to make sure that I wished you a happy birthday as well, so happy birthday! $h ",
["Elliott"] = "What a wonderful day isn't it @? Especially since today is your birthday. I tried to make you a poem but I feel like the best way of putting it is simply, happy birthday. $h ",
["Gus"] = "Hey @ happy birthday! Hopefully you enjoy the rest of the day and make sure you aren't a stranger at the saloon!",
["Dwarf"] = "Happy birthday @. I hope that what I got you is acceptable for humans as well. ",
["Wizard"] = "The spirits told me that today is your birthday. In that case happy birthday @. May your year shine bright! ",
["Harvey"] = "Hey @, happy birthday! Make sure to come in for a checkup some time to make sure you live many more years! ",
["Sandy"] = "Hello there @. I heard that today was your birthday and I didn't want you feeling left out, so happy birthday!",
["Willy"] = "Aye @ happy birthday. Looking at you reminds me of ye days when I was just a guppy swimming out to sea. Continue to enjoy them youngin.$h",
["Krobus"] = "I have heard that it is tradition to give a gift to others on their birthday. In that case, happy birthday @."
};
/// <summary>
/// Used to load all of the default birthday greetings.
/// </summary>
public void createBirthdayGreetings()
{
var serializer = JsonSerializer.Create();
serializer.Formatting = Formatting.Indented;
//English logic.
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( "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, birthdayFileDict);
//Handle normal birthday wishes.
if (!File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath,path)))
{
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(path, defaultBirthdayWishes);
this.birthdayWishes = defaultBirthdayWishes;
}
else
{
birthdayWishes = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(path);
}
//handle spouse birthday wishes.
string spouseBirthdayFileDict = HappyBirthday.Config.translationInfo.getjsonForTranslation("SpouseBirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation);
string spousePath = Path.Combine("Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, spouseBirthdayFileDict);
if (!File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath,spousePath)))
{
HappyBirthday.ModMonitor.Log("Creating Spouse Messages", StardewModdingAPI.LogLevel.Alert);
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(spousePath, defaultSpouseBirthdayWishes);
this.spouseBirthdayWishes = defaultSpouseBirthdayWishes;
}
else
{
spouseBirthdayWishes = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(spousePath);
}
//Non-english logic for creating templates.
foreach(var translation in HappyBirthday.Config.translationInfo.translationCodes)
{
if (translation.Key == "English") continue;
string basePath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath,"Content", "Dialogue", translation.Key);
if (!Directory.Exists(basePath)) Directory.CreateDirectory(basePath);
string tempBirthdayFile =Path.Combine("Content", "Dialogue", translation.Key, HappyBirthday.Config.translationInfo.getjsonForTranslation("BirthdayWishes", translation.Key));
string tempSpouseBirthdayFile =Path.Combine("Content", "Dialogue", translation.Key, HappyBirthday.Config.translationInfo.getjsonForTranslation("SpouseBirthdayWishes", translation.Key));
Dictionary<string, string> tempBirthdayDict = new Dictionary<string, string>();
if (!File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath, tempBirthdayFile)))
{
foreach (var pair in defaultBirthdayWishes)
{
tempBirthdayDict.Add(pair.Key, "");
}
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(tempBirthdayFile, tempBirthdayDict);
}
else
{
tempBirthdayDict = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(tempBirthdayFile);
}
Dictionary<string, string> tempSpouseBirthdayDict = new Dictionary<string, string>();
if (!File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath, tempSpouseBirthdayFile)))
{
foreach (var pair in defaultSpouseBirthdayWishes)
{
tempSpouseBirthdayDict.Add(pair.Key, "");
}
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(tempSpouseBirthdayFile, tempSpouseBirthdayDict);
}
else
{
tempBirthdayDict = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(tempSpouseBirthdayFile);
}
//Set translated birthday info.
if (HappyBirthday.Config.translationInfo.currentTranslation == translation.Key)
{
this.birthdayWishes = tempBirthdayDict;
this.spouseBirthdayWishes = tempSpouseBirthdayDict;
HappyBirthday.ModMonitor.Log("Language set to: " + translation);
}
}
}
}
}

View File

@ -0,0 +1,26 @@
Happy Birthday Change Log
~~~~~~~~~~~~~~~~
1.8.0 Changelog
~~~~~~~~~~~~~~~~
General Changes
-Added support for birthday messages to be in .json files for easier editing.
-Added support for birthday messages to be in multiple supported languages
-English
-Spanish
-German
-Chinese
-Japanese
-Brazillian Portuguese
-Added in spouse specific birthday dialogue messages which can be selected by the players.
-Added in multiple langages for spouse birthday messages.
-Added in birthday gifts to be in .json files.
-Added in a new pool of spouse specific gifts that can be set by the player located in SpouseBirthdayGifts.json
-Added in support for loading legacy birthday gift.xnb info from StardewValley/Content/Data/PossibleBirthdayGifts.xnb
-Added in support for loading legacy birthday messages from StardewValley/Content/Data/BirthdayMessages.xnb
-Added in player portraits to be shown on the callendar.
Multiplayer changes:
-Added in multiplayer portraits to be shown on the callendar.
-Added in a hud message that displays when another player has a birthday.

View File

@ -154,6 +154,7 @@ namespace Omegasis.HappyBirthday.Framework
// OK button
case "OK":
if (this.BirthdayDay >= 1 || this.BirthdayDay <= 28)
MultiplayerSupport.SendBirthdayInfoToOtherPlayers(); //Send updated info to others.
Game1.exitActiveMenu();
break;

View File

@ -1,9 +1,58 @@
namespace Omegasis.HappyBirthday.Framework
{
/// <summary>The mod configuration.</summary>
internal class ModConfig
public class ModConfig
{
/// <summary>The key which shows the menu.</summary>
public string KeyBinding { get; set; } = "O";
/// <summary>
/// The minimum amount of friendship needed to get a birthday gift.
/// </summary>
public int minNeutralFriendshipGiftLevel = 3;
/// <summary>
/// The max amount of friendship needed to get a neutral gift from an npc.
/// </summary>
public int maxNeutralFriendshipGiftLevel = 4;
/// <summary>
///The minimum amount of friendship to get a like gift from an npc.
/// </summary>
public int minLikeFriendshipLevel = 5;
/// <summary>
/// The max amount of friendship needed to get a liked gift from an npc.
/// </summary>
public int maxLikeFriendshipLevel = 6;
/// <summary>
/// The minimum amount of friendship needed to get a loved gift from an npc.
/// </summary>
public int minLoveFriendshipLevel = 7;
/// <summary>
/// The minimum amount of friendship needed to get a happy birthday greeting from an npc.
/// </summary>
public int minimumFriendshipLevelForBirthdayWish=2;
/// <summary>
/// Handles different translations of files.
/// </summary>
public TranslationInfo translationInfo;
/// <summary>
/// Whether or not to load from the old BirthdayGifts.xnb located in StardewValley/Data or from the new BirthdayGifts.json located in the mod directory.
/// </summary>
public bool useLegacyBirthdayFiles;
/// <summary>
/// Constructor.
/// </summary>
public ModConfig()
{
this.translationInfo = new TranslationInfo();
this.useLegacyBirthdayFiles = true;
}
}
}

View File

@ -1,5 +1,4 @@

using StardewValley;
using StardewValley;
using System;
using System.Collections.Generic;
using System.Linq;
@ -10,47 +9,39 @@ namespace Omegasis.HappyBirthday.Framework
{
public class MultiplayerSupport
{
/*
public static string FSTRING_SendBirthdayMessageToOthers = "Omegasis.HappyBirthday.Framework.Messages.SendBirthdayMessageToOtherPlayers";
public static string FSTRING_SendBirthdayInfoToOthers = "Omegasis.HappyBirthday.Framework.Messages.SendBirthdayInfoToOtherPlayers";
public static void initializeMultiplayerSupport()
{
ModdedUtilitiesNetworking.ModCore.possibleVoidFunctions.Add(FSTRING_SendBirthdayMessageToOthers,new voidFunc(ShowStarMessage));
}
public static void ShowStarMessage(object obj)
{
//IEnumerable<Farmer> players= Game1.getAllFarmers();
DataInfo info = (DataInfo)obj;
HUDMessage message = (HUDMessage)info.data;
Game1.addHUDMessage(message);
if (!message.message.Contains("Inventory"))
{
Game1.playSound("cancel");
return;
}
if (!Game1.player.mailReceived.Contains("BackpackTip"))
{
Game1.player.mailReceived.Add("BackpackTip");
Game1.addMailForTomorrow("pierreBackpack", false, false);
}
}
public static void SendBirthdayMessageToOtherPlayers()
{
HUDMessage message = new HUDMessage("It's " + Game1.player.Name + "'s birthday! Happy birthday to them!", 1);
List<Farmer> farmers =ModdedUtilitiesNetworking.Framework.CustomMultiplayer.getAllFarmersExceptThisOne();
foreach (Farmer f in farmers)
foreach (KeyValuePair<long,Farmer> f in Game1.otherFarmers)
{
ModdedUtilitiesNetworking.ModCore.multiplayer.sendMessage(FSTRING_SendBirthdayMessageToOthers, ModdedUtilitiesNetworking.Framework.Extentions.StrardewValleyExtentions.MessagesExtentions.HUDMessageIconIdentifier, message, ModdedUtilitiesNetworking.Framework.Enums.MessageTypes.messageTypes.SendToSpecific, f);
HappyBirthday.ModHelper.Multiplayer.SendMessage<string>(message.message, FSTRING_SendBirthdayMessageToOthers,new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { f.Key });
//ModdedUtilitiesNetworking.ModCore.multiplayer.sendMessage(FSTRING_SendBirthdayMessageToOthers, ModdedUtilitiesNetworking.Framework.Extentions.StrardewValleyExtentions.MessagesExtentions.HUDMessageIconIdentifier, message, ModdedUtilitiesNetworking.Framework.Enums.MessageTypes.messageTypes.SendToSpecific, f);
}
}
*/
public static void SendBirthdayInfoToOtherPlayers()
{
foreach (KeyValuePair<long, Farmer> f in Game1.otherFarmers)
{
HappyBirthday.ModHelper.Multiplayer.SendMessage<KeyValuePair<long,PlayerData>>(new KeyValuePair<long, PlayerData>(Game1.player.uniqueMultiplayerID, HappyBirthday.PlayerBirthdayData), FSTRING_SendBirthdayInfoToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { f.Key });
//ModdedUtilitiesNetworking.ModCore.multiplayer.sendMessage(FSTRING_SendBirthdayMessageToOthers, ModdedUtilitiesNetworking.Framework.Extentions.StrardewValleyExtentions.MessagesExtentions.HUDMessageIconIdentifier, message, ModdedUtilitiesNetworking.Framework.Enums.MessageTypes.messageTypes.SendToSpecific, f);
}
}
public static void SendBirthdayInfoToConnectingPlayer(long id)
{
HappyBirthday.ModHelper.Multiplayer.SendMessage<KeyValuePair<long, PlayerData>>(new KeyValuePair<long, PlayerData>(Game1.player.uniqueMultiplayerID, HappyBirthday.PlayerBirthdayData), FSTRING_SendBirthdayInfoToOthers, new string[] { HappyBirthday.ModHelper.Multiplayer.ModID }, new long[] { id });
//ModdedUtilitiesNetworking.ModCore.multiplayer.sendMessage(FSTRING_SendBirthdayMessageToOthers, ModdedUtilitiesNetworking.Framework.Extentions.StrardewValleyExtentions.MessagesExtentions.HUDMessageIconIdentifier, message, ModdedUtilitiesNetworking.Framework.Enums.MessageTypes.messageTypes.SendToSpecific, f);
}
}
}

View File

@ -1,7 +1,7 @@
namespace Omegasis.HappyBirthday.Framework
{
/// <summary>The data for the current player.</summary>
internal class PlayerData
public class PlayerData
{
/// <summary>The player's current birthday day.</summary>
public int BirthdayDay;

View File

@ -0,0 +1,252 @@
using StardewValley;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Omegasis.HappyBirthday.Framework
{
/// <summary>
/// A class which deals with handling different translations for Vocalization should other voice teams ever wish to voice act for that language.
/// </summary>
public class TranslationInfo
{
/// <summary>
/// The list of all supported translations by this mod.
/// </summary>
public List<string> translations;
/// <summary>
/// The current translation mode for the mod, so that it knows what files to load at the beginning of the game.
/// </summary>
public string currentTranslation;
/// <summary>
/// Holds the info for what translation has what file extension.
/// </summary>
public Dictionary<string, string> translationFileInfo;
public Dictionary<string, LocalizedContentManager.LanguageCode> translationCodes;
/// <summary>
/// Default constructor.
/// </summary>
public TranslationInfo()
{
translations = new List<string>();
translationFileInfo = new Dictionary<string, string>();
translationCodes = new Dictionary<string, LocalizedContentManager.LanguageCode>();
translations.Add("English");
translations.Add("Spanish");
translations.Add("Chinese");
translations.Add("Japanese");
translations.Add("Russian");
translations.Add("German");
translations.Add("Brazillian Portuguese");
currentTranslation = "English";
translationFileInfo.Add("English", ".json");
translationFileInfo.Add("Spanish", ".es-ES.json");
translationFileInfo.Add("Chinese", ".zh-CN.json");
translationFileInfo.Add("Japanese", ".ja-JP.json");
translationFileInfo.Add("Russian", ".ru-RU.json");
translationFileInfo.Add("German", ".de-DE.json");
translationFileInfo.Add("Brazillian Portuguese", ".pt-BR.json");
translationCodes.Add("English", LocalizedContentManager.LanguageCode.en);
translationCodes.Add("Spanish", LocalizedContentManager.LanguageCode.es);
translationCodes.Add("Chinese", LocalizedContentManager.LanguageCode.zh);
translationCodes.Add("Japanese", LocalizedContentManager.LanguageCode.ja);
translationCodes.Add("Russian", LocalizedContentManager.LanguageCode.ru);
translationCodes.Add("German", LocalizedContentManager.LanguageCode.de);
translationCodes.Add("Brazillian Portuguese", LocalizedContentManager.LanguageCode.pt);
}
public string getTranslationNameFromPath(string fullPath)
{
return Path.GetFileName(fullPath);
}
public void changeLocalizedContentManagerFromTranslation(string translation)
{
string tra = getTranslationNameFromPath(translation);
bool f = translationCodes.TryGetValue(tra, out LocalizedContentManager.LanguageCode code);
if (f == false) LocalizedContentManager.CurrentLanguageCode = LocalizedContentManager.LanguageCode.en;
else LocalizedContentManager.CurrentLanguageCode = code;
return;
}
public void resetLocalizationCode()
{
LocalizedContentManager.CurrentLanguageCode = LocalizedContentManager.LanguageCode.en;
}
/// <summary>
/// Gets the proper file extension for the current translation.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public string getFileExtentionForTranslation(string path)
{
/*
bool f = translationFileInfo.TryGetValue(translation, out string value);
if (f == false) return ".json";
else return value;
*/
string translation = Path.GetFileName(path);
try
{
return translationFileInfo[translation];
}
catch (Exception err)
{
HappyBirthday.ModMonitor.Log("WTF SOMETHING IS WRONG!", StardewModdingAPI.LogLevel.Warn);
//Vocalization.ModMonitor.Log(err.ToString());
//Vocalization.ModMonitor.Log("Attempted to get translation: " + translation);
return ".json";
}
}
/// <summary>
/// Gets the proper json for Buildings (aka Blueprints) from the data folder.
/// </summary>
/// <param name="translation"></param>
/// <returns></returns>
public string getBuildingjsonForTranslation(string translation)
{
string buildings = "Blueprints";
return buildings + getFileExtentionForTranslation(translation);
}
/// <summary>
/// Gets the proper json file for the name passed in. Combines the file name with it's proper translation extension.
/// </summary>
/// <param name="jsonFileName"></param>
/// <param name="translation"></param>
/// <returns></returns>
public string getjsonForTranslation(string jsonFileName, string translation)
{
return jsonFileName + getFileExtentionForTranslation(translation);
}
/// <summary>
/// Loads an json file from StardewValley/Content
/// </summary>
/// <param name="jsonFileName"></param>
/// <param name="key"></param>
/// <param name="translation"></param>
/// <returns></returns>
public string LoadjsonFile(string jsonFileName, string key, string translation)
{
string json = jsonFileName + getFileExtentionForTranslation(translation);
Dictionary<string, string> loadedDict = Game1.content.Load<Dictionary<string, string>>(json);
string loaded;
bool f = loadedDict.TryGetValue(key, out loaded);
if (f == false)
{
//Vocalization.ModMonitor.Log("Big issue: Key not found in file:" + json + " " + key);
return "";
}
else return loaded;
}
/// <summary>
/// Loads a string dictionary from a json file.
/// </summary>
/// <param name="jsonFileName"></param>
/// <param name="translation"></param>
/// <returns></returns>
public Dictionary<string,string> LoadJsonFileDictionary(string jsonFileName, string translation)
{
string json = jsonFileName + getFileExtentionForTranslation(translation);
Dictionary<string, string> loadedDict = Game1.content.Load<Dictionary<string, string>>(json);
return loadedDict;
}
public virtual string LoadString(string path, string translation, object sub1, object sub2, object sub3)
{
string format = this.LoadString(path, translation);
try
{
return string.Format(format, sub1, sub2, sub3);
}
catch (Exception ex)
{
}
return format;
}
public virtual string LoadString(string path, string translation, object sub1, object sub2)
{
string format = this.LoadString(path, translation);
try
{
return string.Format(format, sub1, sub2);
}
catch (Exception ex)
{
}
return format;
}
public virtual string LoadString(string path, string translation, object sub1)
{
string format = this.LoadString(path, translation);
try
{
return string.Format(format, sub1);
}
catch (Exception ex)
{
}
return format;
}
public virtual string LoadString(string path, string translation)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
return LoadjsonFile(assetName, key, translation);
}
public virtual string LoadString(string path, string translation, params object[] substitutions)
{
string format = this.LoadString(path, translation);
if (substitutions.Length != 0)
{
try
{
return string.Format(format, substitutions);
}
catch (Exception ex)
{
}
}
return format;
}
private void parseStringPath(string path, out string assetName, out string key)
{
int length = path.IndexOf(':');
assetName = path.Substring(0, length);
key = path.Substring(length + 1, path.Length - length - 1);
}
}
}

View File

@ -0,0 +1,404 @@
using Omegasis.HappyBirthday.Framework;
using StardewModdingAPI;
using StardewValley;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using SObject = StardewValley.Object;
namespace Omegasis.HappyBirthday
{
public class GiftManager
{
public ModConfig Config
{
get
{
return HappyBirthday.Config;
}
}
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",
["Robin"] = " BestGifts/224 1 426 1 636 1/GoodGift/-6 5 -79 5 424 1 709 1/NeutralGift//",
["Demetrius"] = " Best Gifts/207 1 232 1 233 1 400 1/Good Gifts/-5 3 -79 5 422 1/NeutralGift/-4 3/",
["Maru"] = " BestGift/72 1 197 1 190 1 215 1 222 1 243 1 336 1 337 1 400 1 787 1/Good Gift/-260 1 62 1 64 1 66 1 68 1 70 1 334 1 335 1 725 1 726 1/NeutralGift/",
["Sebastian"] = " Best/84 1 227 1 236 1 575 1 305 1 /Good/267 1 276 1/Neutral/-4 3/",
["Linus"] = " Best/88 1 90 1 234 1 242 1 280 1/Good/-5 3 -6 5 -79 5 -81 10/Neutral/-4 3/",
["Pierre"] = " Best/202 1/Good/-5 3 -6 5 -7 1 18 1 22 1 402 1 418 1 259 1/Neutral//",
["Caroline"] = " Best/213 1 593 1/Good/-7 1 18 1 402 1 418 1/Neutral// ",
["Abigail"] = " Best/66 1 128 1 220 1 226 1 276 1 611 1/Good//Neutral// ",
["Alex"] = " Best/201 1 212 1 662 1 664 1/Good/-5 3/Neutral// ",
["George"] = " Best/20 1 205 1/Good/18 1 195 1 199 1 200 1 214 1 219 1 223 1 231 1 233 1/Neutral// ",
["Evelyn"] = " Best/72 1 220 1 239 1 284 1 591 1 595 1/Good/-6 5 18 1 402 1 418 1/Neutral// ",
["Lewis"] = " Best/200 1 208 1 235 1 260 1/Good/-80 5 24 1 88 1 90 1 192 1 258 1 264 1 272 1 274 1 278 1/Neutral// ",
["Clint"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 336 1 337 1 605 1 649 1 749 1 337 5/Good/334 20 335 10 336 5/Neutral// ",
["Penny"] = " Best/60 1 376 1 651 1 72 1 164 1 218 1 230 1 244 1 254 1/Good/-6 5 20 1 22 1/Neutral// ",
["Pam"] = " Best/24 1 90 1 199 1 208 1 303 1 346 1/Good/-6 5 -75 5 -79 5 18 1 227 1 228 1 231 1 232 1 233 1 234 1 235 1 236 1 238 1 402 1 418 1/Neutral/-4 3/ ",
["Emily"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 241 1 428 1 440 1 /Good/18 1 82 1 84 1 86 1 196 1 200 1 207 1 230 1 235 1 402 1 418 1/Neutral// ",
["Haley"] = " Best/221 1 421 1 610 1 88 1 /Good/18 1 60 1 62 1 64 1 70 1 88 1 222 1 223 1 232 1 233 1 234 1 402 1 418 1 /Neutral// ",
["Jas"] = " Best/221 1 595 1 604 1 /Good/18 1 60 1 64 1 70 1 88 1 232 1 233 1 234 1 222 1 223 1 340 1 344 1 402 1 418 1 /Neutral// ",
["Vincent"] = " Best/221 1 398 1 612 1 /Good/18 1 60 1 64 1 70 1 88 1 232 1 233 1 234 1 222 1 223 1 340 1 344 1 402 1 418 1 /Neutral// ",
["Jodi"] = " Best/72 1 200 1 211 1 214 1 220 1 222 1 225 1 231 1 /Good/-5 3 -6 5 -79 5 18 1 402 1 418 1 /Neutral// ",
["Kent"] = " Best/607 1 649 1 /Good/-5 3 -79 5 18 1 402 1 418 1 /Neutral// ",
["Sam"] = " Best/90 1 206 1 655 1 658 1 562 1 731 1/Good/167 1 210 1 213 1 220 1 223 1 224 1 228 1 232 1 233 1 239 1 -5 3/Neutral// ",
["Leah"] = " Best/196 1 200 1 348 1 606 1 651 1 650 1 426 1 430 1 /Good/-5 3 -6 5 -79 5 -81 10 18 1 402 1 406 1 408 1 418 1 86 1 /Neutral// ",
["Shane"] = " Best/206 1 215 1 260 1 346 1 /Good/-5 3 -79 5 303 1 /Neutral// ",
["Marnie"] = " Best/72 1 221 1 240 1 608 1 /Good/-5 3 -6 5 402 1 418 1 /Neutral// ",
["Elliott"] = " Best/715 1 732 1 218 1 444 1 /Good/727 1 728 1 -79 5 60 1 80 1 82 1 84 1 149 1 151 1 346 1 348 1 728 1 /Neutral/-4 3 / ",
["Gus"] = " Best/72 1 213 1 635 1 729 1 /Good/348 1 303 1 -7 1 18 1 /Neutral// ",
["Dwarf"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 749 1 /Good/82 1 84 1 86 1 96 1 97 1 98 1 99 1 121 1 122 1 /Neutral/-28 20 / ",
["Wizard"] = " Best/107 1 155 1 422 1 769 1 768 1 /Good/-12 3 72 1 82 1 84 1/Neutral// ",
["Harvey"] = " Best/348 1 237 1 432 1 395 1 342 1 /Good/-81 10 -79 5 -7 1 402 1 418 1 422 1 436 1 438 1 442 1 444 1 422 1 /Neutral// ",
["Sandy"] = " Best/18 1 402 1 418 1 /Good/-75 5 -79 5 88 1 428 1 436 1 438 1 440 1 /Neutral// ",
["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// "
};
public Dictionary<string, string> defaultSpouseBirthdayGifts = new Dictionary<string, string>() {
["Universal_Gifts"] = "74 1 446 1 204 1 446 5 773 1",
["Alex"] = "",
["Elliott"] = "",
["Harvey"] = "",
["Sam"] = "",
["Sebastian"] = "",
["Shane"] = "",
["Abigail"] = "",
["Emily"] = "",
["Haley"] = "",
["Leah"] = "",
["Maru"] = "",
["Penny"] = "",
};
public List<Item> BirthdayGifts;
/// <summary>The next birthday gift the player will receive.</summary>
public Item BirthdayGiftToReceive;
public GiftManager()
{
this.BirthdayGifts = new List<Item>();
this.loadVillagerBirthdayGifts();
this.loadSpouseBirthdayGifts();
}
/// <summary>
/// Load birthday gift information from disk. Preferably from BirthdayGift.json in the mod's directory.
/// </summary>
/// <returns></returns>
public void loadVillagerBirthdayGifts()
{
if (HappyBirthday.Config.useLegacyBirthdayFiles == false)
{
string villagerGifts = Path.Combine("Content", "Gifts", "BirthdayGifts.json");
if (File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath, villagerGifts)))
{
this.defaultBirthdayGifts = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(villagerGifts);
}
else
{
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(villagerGifts, this.defaultBirthdayGifts);
}
}
else
{
if (File.Exists(Path.Combine(Game1.content.RootDirectory, "Data", "PossibleBirthdayGifts.xnb"))){
HappyBirthday.ModMonitor.Log("Legacy loading detected. Attempting to load from StardewValley/Content/Data/PossibleBirthdayGifts.xnb");
this.defaultBirthdayGifts = Game1.content.Load<Dictionary<string, string>>(Path.Combine("Data", "PossibleBirthdayGifts"));
}
else
{
HappyBirthday.ModMonitor.Log("No birthday gift information found. Loading from internal birthday list");
}
}
}
/// <summary>
/// Used to load spouse birthday gifts from disk.
/// </summary>
/// <returns></returns>
public void loadSpouseBirthdayGifts()
{
string spouseGifts = Path.Combine("Content", "Gifts", "SpouseBirthdayGifts.json");
if (File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath, spouseGifts)))
{
HappyBirthday.ModMonitor.Log("Load from SpouseBirthdayGifts.json");
this.defaultSpouseBirthdayGifts = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(spouseGifts);
}
else
{
HappyBirthday.ModMonitor.Log("SpouseBirthdayGifts.json created from default spouse birthday gift information and can be overridden.");
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(spouseGifts, this.defaultSpouseBirthdayGifts);
}
}
/// <summary>Get the default gift items.</summary>
/// <param name="name">The villager's name.</param>
private IEnumerable<SObject> GetDefaultBirthdayGifts(string name)
{
List<SObject> gifts = new List<SObject>();
try
{
// read from birthday gifts file
IDictionary<string, string> data = defaultBirthdayGifts;
data.TryGetValue(name, out string text);
if (text != null)
{
string[] fields = text.Split('/');
// love
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minLoveFriendshipLevel)
{
string[] loveFields = fields[1].Split(' ');
for (int i = 0; i < loveFields.Length; i += 2)
{
try
{
gifts.AddRange(this.GetItems(Convert.ToInt32(loveFields[i]), Convert.ToInt32(loveFields[i + 1])));
}
catch { }
}
}
// like
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minLikeFriendshipLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxLikeFriendshipLevel)
{
string[] likeFields = fields[3].Split(' ');
for (int i = 0; i < likeFields.Length; i += 2)
{
try
{
gifts.AddRange(this.GetItems(Convert.ToInt32(likeFields[i]), Convert.ToInt32(likeFields[i + 1])));
}
catch { }
}
}
// neutral
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minNeutralFriendshipGiftLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxNeutralFriendshipGiftLevel)
{
string[] neutralFields = fields[5].Split(' ');
for (int i = 0; i < neutralFields.Length; i += 2)
{
try
{
gifts.AddRange(this.GetItems(Convert.ToInt32(neutralFields[i]), Convert.ToInt32(neutralFields[i + 1])));
}
catch { }
}
}
}
// get NPC's preferred gifts
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minLoveFriendshipLevel)
gifts.AddRange(this.GetUniversalItems("Love", true));
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minLikeFriendshipLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxLikeFriendshipLevel)
this.BirthdayGifts.AddRange(this.GetUniversalItems("Like", true));
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minNeutralFriendshipGiftLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxNeutralFriendshipGiftLevel)
this.BirthdayGifts.AddRange(this.GetUniversalItems("Neutral", true));
}
catch
{
// get NPC's preferred gifts
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minLoveFriendshipLevel)
{
this.BirthdayGifts.AddRange(this.GetUniversalItems("Love", false));
this.BirthdayGifts.AddRange(this.GetLovedItems(name));
}
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minLikeFriendshipLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxLikeFriendshipLevel)
{
this.BirthdayGifts.AddRange(this.GetLikedItems(name));
this.BirthdayGifts.AddRange(this.GetUniversalItems("Like", false));
}
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minNeutralFriendshipGiftLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxNeutralFriendshipGiftLevel)
this.BirthdayGifts.AddRange(this.GetUniversalItems("Neutral", false));
}
//Add in spouse specific birthday gifts.
if (Game1.player.isMarried())
{
if (name == Game1.player.spouse)
{
this.BirthdayGifts.AddRange(getSpouseBirthdayGifts(name));
this.BirthdayGifts.AddRange(getSpouseBirthdayGifts("Universal_Gifts"));
}
}
return gifts;
}
/// <summary>
/// Get
/// </summary>
/// <param name="group"></param>
/// <param name=""></param>
/// <returns></returns>
private IEnumerable<Item> getSpouseBirthdayGifts(string npcName)
{
Dictionary<string, string> data = this.defaultSpouseBirthdayGifts;
data.TryGetValue(npcName, out string text);
if (String.IsNullOrEmpty(text))
yield break;
// parse
string[] array = text.Split(' ');
for (int i = 0; i < array.Length; i += 2)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(array[i]), Convert.ToInt32(array[i + 1])))
yield return obj;
}
}
/// <summary>Get the items loved by all villagers.</summary>
/// <param name="group">The group to get (one of <c>Like</c>, <c>Love</c>, <c>Neutral</c>).</param>
/// <param name="isBirthdayGiftList">Whether to get data from <c>Data\BirthdayGifts.xnb</c> instead of the game data.</param>
private IEnumerable<SObject> GetUniversalItems(string group, bool isBirthdayGiftList)
{
if (!isBirthdayGiftList)
{
// get raw data
Game1.NPCGiftTastes.TryGetValue($"Universal_{group}", out string text);
if (text == null)
yield break;
// parse
string[] neutralIDs = text.Split(' ');
foreach (string neutralID in neutralIDs)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(neutralID)))
yield return obj;
}
}
else
{
// get raw data
Dictionary<string, string> data = Game1.content.Load<Dictionary<string, string>>("Data\\BirthdayGifts");
data.TryGetValue($"Universal_{group}_Gift", out string text);
if (text == null)
yield break;
// parse
string[] array = text.Split(' ');
for (int i = 0; i < array.Length; i += 2)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(array[i]), Convert.ToInt32(array[i + 1])))
yield return obj;
}
}
}
/// <summary>Get a villager's loved items.</summary>
/// <param name="name">The villager's name.</param>
private IEnumerable<SObject> GetLikedItems(string name)
{
// get raw data
Game1.NPCGiftTastes.TryGetValue(name, out string text);
if (text == null)
yield break;
// parse
string[] data = text.Split('/');
string[] likedIDs = data[3].Split(' ');
foreach (string likedID in likedIDs)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(likedID)))
yield return obj;
}
}
/// <summary>Get a villager's loved items.</summary>
/// <param name="name">The villager's name.</param>
private IEnumerable<SObject> GetLovedItems(string name)
{
// get raw data
Game1.NPCGiftTastes.TryGetValue(name, out string text);
if (text == null)
yield break;
// parse
string[] data = text.Split('/');
string[] lovedIDs = data[1].Split(' ');
foreach (string lovedID in lovedIDs)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(lovedID)))
yield return obj;
}
}
/// <summary>Get the items matching the given ID.</summary>
/// <param name="id">The category or item ID.</param>
private IEnumerable<SObject> GetItems(int id)
{
return id < 0
? ObjectUtility.GetObjectsInCategory(id)
: new[] { new SObject(id, 1) };
}
/// <summary>Get the items matching the given ID.</summary>
/// <param name="id">The category or item ID.</param>
/// <param name="stack">The stack size.</param>
private IEnumerable<SObject> GetItems(int id, int stack)
{
foreach (SObject obj in this.GetItems(id))
yield return new SObject(obj.ParentSheetIndex, stack);
}
/// <summary>Set the next birthday gift the player will receive.</summary>
/// <param name="name">The villager's name who's giving the gift.</param>
/// <remarks>This returns gifts based on the speaker's heart level towards the player: neutral for 3-4, good for 5-6, and best for 7-10.</remarks>
public void SetNextBirthdayGift(string name)
{
Item gift;
if (this.BirthdayGifts.Count > 0)
{
Random random = new Random();
int index = random.Next(this.BirthdayGifts.Count);
gift = this.BirthdayGifts[index];
if (Game1.player.isInventoryFull())
Game1.createItemDebris(gift, Game1.player.getStandingPosition(), Game1.player.getDirection());
else
this.BirthdayGiftToReceive = gift;
return;
}
this.BirthdayGifts.AddRange(this.GetDefaultBirthdayGifts(name));
Random rnd2 = new Random();
int r2 = rnd2.Next(this.BirthdayGifts.Count);
gift = this.BirthdayGifts.ElementAt(r2);
//Attempt to balance sapplings from being too OP as a birthday gift.
if (gift.Name.Contains("Sapling"))
{
gift.Stack = 1; //A good investment?
}
if (gift.Name.Contains("Rare Seed"))
{
gift.Stack = 2; //Still a little op but less so than 5.
}
if (Game1.player.isInventoryFull())
Game1.createItemDebris(gift, Game1.player.getStandingPosition(), Game1.player.getDirection());
else
this.BirthdayGiftToReceive = gift;
this.BirthdayGifts.Clear();
}
}
}

View File

@ -2,18 +2,22 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Newtonsoft.Json;
using Omegasis.HappyBirthday.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Characters;
using StardewValley.Menus;
using StardewValley.Monsters;
using SObject = StardewValley.Object;
namespace Omegasis.HappyBirthday
{
/// <summary>The mod entry point.</summary>
public class HappyBirthday : Mod, IAssetEditor, IAssetLoader
public class HappyBirthday : Mod, IAssetEditor
{
/*********
** Properties
@ -25,10 +29,25 @@ namespace Omegasis.HappyBirthday
private string LegacyDataFilePath => Path.Combine(this.Helper.DirectoryPath, "Player_Birthdays", $"HappyBirthday_{Game1.player.Name}.txt");
/// <summary>The mod configuration.</summary>
private ModConfig Config;
public static ModConfig Config;
/// <summary>The data for the current player.</summary>
private PlayerData PlayerData;
public static PlayerData PlayerBirthdayData;
/// <summary>
/// Wrapper for static field PlayerBirthdayData;
/// </summary>
public PlayerData PlayerData
{
get
{
return PlayerBirthdayData;
}
set
{
PlayerBirthdayData = value;
}
}
/// <summary>Whether the player has chosen a birthday.</summary>
private bool HasChosenBirthday => !string.IsNullOrEmpty(this.PlayerData.BirthdaySeason) && this.PlayerData.BirthdayDay != 0;
@ -36,62 +55,11 @@ namespace Omegasis.HappyBirthday
/// <summary>The queue of villagers who haven't given a gift yet.</summary>
private List<string> VillagerQueue;
/// <summary>The gifts that villagers can give.</summary>
private List<Item> PossibleBirthdayGifts;
/// <summary>The next birthday gift the player will receive.</summary>
private Item BirthdayGiftToReceive;
/// <summary>Whether we've already checked for and (if applicable) set up the player's birthday today.</summary>
private bool CheckedForBirthday;
//private Dictionary<string, Dialogue> Dialogue;
//private bool SeenEvent;
public bool CanLoad<T>(IAssetInfo asset)
{
return asset.AssetNameEquals(@"Data\FarmerBirthdayDialogue");
}
/// <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
{
["Robin"] = "Hey @, happy birthday! I'm glad you choose this town to move here to. ",
["Demetrius"] = "Happy birthday @! Make sure you take some time off today to enjoy yourself. $h",
["Maru"] = "Happy birthday @. I tried to make you an everlasting candle for you, but sadly that didn't work out. Maybe next year right? $h",
["Sebastian"] = "Happy birthday @. Here's to another year of chilling. ",
["Linus"] = "Happy birthday @. Thanks for visiting me even on your birthday. It makes me really happy. ",
["Pierre"] = "Hey @, happy birthday! Hopefully this next year for you will be a great one! ",
["Caroline"] = "Happy birthday @. Thank you for all that you've done for our community. I'm sure your parents must be proud of you.$h",
["Abigail"] = "Happy birthday @! Hopefully this year we can go on even more adventures together $h!",
["Alex"] = "Yo @, happy birthday! Maybe this will be your best year yet.$h",
["George"] = "When you get to my age birthdays come and go. Still happy birthday @.",
["Evelyn"] = "Happy birthday @. You have grown up to be such a fine individual and I'm sure you'll continue to grow. ",
["Lewis"] = "Happy birthday @! I'm thankful for what you have done for the town and I'm sure your grandfather would be proud of you.",
["Clint"] = "Hey happy birthday @. I'm sure this year is going to be great for you.",
["Penny"] = "Happy birthday @. May you enjoy all of life's blessings this year. ",
["Pam"] = "Happy birthday kid. We should have a drink to celebrate another year of life for you! $h",
["Emily"] = "I'm sensing a strong positive life energy about you, so it must be your birthday. Happy birthday @!$h",
["Haley"] = "Happy birthday @. Hopefully this year you'll get some good presents!$h",
["Jas"] = "Happy birthday @. I hope you have a good birthday.",
["Vincent"] = "Hey @ have you come to pl...oh it's your birthday? Happy birthday! ",
["Jodi"] = "Hello there @. Rumor has it that today is your birthday. In that case, happy birthday!$h",
["Kent"] = "Jodi told me that it was your birthday today @. Happy birthday and make sure to cherish every single day.",
["Sam"] = "Yo @ happy birthday! We'll have to have a birthday jam session for you some time!$h ",
["Leah"] = "Hey @ happy birthday! We should go to the saloon tonight and celebrate!$h ",
["Shane"] = "Happy birthday @. Keep working hard and I'm sure this next year for you will be a great one.",
["Marnie"] = "Hello there @. Everyone is talking about your birthday today and I wanted to make sure that I wished you a happy birthday as well, so happy birthday! $h ",
["Elliott"] = "What a wonderful day isn't it @? Especially since today is your birthday. I tried to make you a poem but I feel like the best way of putting it is simply, happy birthday. $h ",
["Gus"] = "Hey @ happy birthday! Hopefully you enjoy the rest of the day and make sure you aren't a stranger at the saloon!",
["Dwarf"] = "Happy birthday @. I hope that what I got you is acceptable for humans as well. ",
["Wizard"] = "The spirits told me that today is your birthday. In that case happy birthday @. ",
["Harvey"] = "Hey @, happy birthday! Make sure to come in for a checkup some time to make sure you live many more years! ",
["Sandy"] = "Hello there @. I heard that today was your birthday and I didn't want you feeling left out, so happy birthday!",
["Willy"] = "Aye @ happy birthday. Looking at you reminds me of ye days when I was just a guppy swimming out to sea. Continue to enjoy them youngin.$h",
["Krobus"] = "I have heard that it is tradition to give a gift to others on their birthday. In that case, happy birthday @."
};
}
public bool CanEdit<T>(IAssetInfo asset)
{
@ -109,6 +77,27 @@ namespace Omegasis.HappyBirthday
.Set("birthdayDad", "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 %%");
}
public static IModHelper ModHelper;
public static IMonitor ModMonitor;
/// <summary>
/// Class to handle all birthday messages for this mod.
/// </summary>
public BirthdayMessages messages;
/// <summary>
/// Class to handle all birthday gifts for this mod.
/// </summary>
public GiftManager giftManager;
/// <summary>
/// Checks if the current billboard is the daily quest screen or not.
/// </summary>
bool isDailyQuestBoard;
Dictionary<long,PlayerData> othersBirthdays;
/*********
** Public methods
@ -117,16 +106,228 @@ 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());
this.Config = helper.ReadConfig<ModConfig>();
//helper.Content.AssetLoaders.Add(new PossibleGifts());
Config = helper.ReadConfig<ModConfig>();
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
GameEvents.UpdateTick += this.GameEvents_UpdateTick;
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
ControlEvents.KeyPressed += this.ControlEvents_KeyPressed;
MenuEvents.MenuChanged += MenuEvents_MenuChanged;
MenuEvents.MenuClosed += MenuEvents_MenuClosed;
GraphicsEvents.OnPostRenderGuiEvent += GraphicsEvents_OnPostRenderGuiEvent;
StardewModdingAPI.Events.GraphicsEvents.OnPostRenderHudEvent += GraphicsEvents_OnPostRenderHudEvent;
//MultiplayerSupport.initializeMultiplayerSupport();
ModHelper = Helper;
ModMonitor = Monitor;
messages = new BirthdayMessages();
giftManager = new GiftManager();
isDailyQuestBoard = false;
ModHelper.Events.Multiplayer.ModMessageReceived += Multiplayer_ModMessageReceived;
ModHelper.Events.Multiplayer.PeerDisconnected += Multiplayer_PeerDisconnected;
this.othersBirthdays = new Dictionary<long, PlayerData>();
}
/// <summary>
/// Used to check for player disconnections.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Multiplayer_PeerDisconnected(object sender, PeerDisconnectedEventArgs e)
{
this.othersBirthdays.Remove(e.Peer.PlayerID);
}
private void Multiplayer_ModMessageReceived(object sender, ModMessageReceivedEventArgs e)
{
if (e.FromModID == ModHelper.Multiplayer.ModID && e.Type==MultiplayerSupport.FSTRING_SendBirthdayMessageToOthers)
{
string message = e.ReadAs<string>();
Game1.hudMessages.Add(new HUDMessage(message,1));
}
if (e.FromModID == ModHelper.Multiplayer.ModID && e.Type == MultiplayerSupport.FSTRING_SendBirthdayInfoToOthers)
{
KeyValuePair<long,PlayerData> message = e.ReadAs<KeyValuePair<long,PlayerData>>();
if (!this.othersBirthdays.ContainsKey(message.Key))
{
this.othersBirthdays.Add(message.Key,message.Value);
MultiplayerSupport.SendBirthdayInfoToConnectingPlayer(e.FromPlayerID);
Monitor.Log("Got other player's birthday data from: "+ Game1.getFarmer(e.FromPlayerID).name);
}
else
{
//Brute force update birthday info if it has already been recevived but dont send birthday info again.
this.othersBirthdays.Remove(message.Key);
this.othersBirthdays.Add(message.Key, message.Value);
Monitor.Log("Got other player's birthday data from: " + Game1.getFarmer(e.FromPlayerID).name);
}
}
}
/// <summary>
/// Used to check when a menu is closed.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MenuEvents_MenuClosed(object sender, EventArgsClickableMenuClosed e)
{
this.isDailyQuestBoard = false;
}
/// <summary>
/// Used to properly display hovertext for all events happening on a calendar day.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GraphicsEvents_OnPostRenderHudEvent(object sender, EventArgs e)
{
if (Game1.activeClickableMenu == null) return;
if (PlayerData == null) return;
if (PlayerData.BirthdaySeason == null) return;
if (PlayerData.BirthdaySeason.ToLower() != Game1.currentSeason.ToLower()) return;
if (Game1.activeClickableMenu is Billboard)
{
if (isDailyQuestBoard) return;
if ((Game1.activeClickableMenu as Billboard).calendarDays == null) return;
//Game1.player.FarmerRenderer.drawMiniPortrat(Game1.spriteBatch, new Vector2(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 230 + (index - 1) / 7 * 32 * 4), 1f, 4f, 2, Game1.player);
string hoverText = "";
List<string> texts = new List<string>();
foreach (var clicky in (Game1.activeClickableMenu as Billboard).calendarDays)
{
if (clicky.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{
if (!String.IsNullOrEmpty(clicky.hoverText))
{
texts.Add(clicky.hoverText); //catches npc birhday names.
}
else if (!String.IsNullOrEmpty(clicky.name))
{
texts.Add(clicky.name); //catches festival dates.
}
}
}
for(int i = 0; i< texts.Count; i++)
{
hoverText += texts[i]; //Append text.
if (i == texts.Count - 1) continue;
else
{
hoverText += Environment.NewLine; //Append new line.
}
}
if (!String.IsNullOrEmpty(hoverText))
{
var oldText = Helper.Reflection.GetField<string>(Game1.activeClickableMenu, "hoverText", true);
oldText.SetValue(hoverText);
}
}
}
/// <summary>
/// Used to show the farmer's portrait on the billboard menu.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GraphicsEvents_OnPostRenderGuiEvent(object sender, EventArgs e)
{
if (Game1.activeClickableMenu == null) return;
//Don't do anything if birthday has not been chosen yet.
if (PlayerData == null) return;
if (Game1.activeClickableMenu is Billboard)
{
if (isDailyQuestBoard) return;
if (!String.IsNullOrEmpty(PlayerData.BirthdaySeason))
{
if (PlayerData.BirthdaySeason.ToLower() == Game1.currentSeason.ToLower())
{
int index = PlayerData.BirthdayDay;
Game1.player.FarmerRenderer.drawMiniPortrat(Game1.spriteBatch, new Vector2(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 230 + (index - 1) / 7 * 32 * 4), 0.5f, 4f, 2, Game1.player);
}
}
foreach(var pair in this.othersBirthdays)
{
int index = pair.Value.BirthdayDay;
if (pair.Value.BirthdaySeason != Game1.currentSeason.ToLower()) continue; //Hide out of season birthdays.
index = pair.Value.BirthdayDay;
Game1.player.FarmerRenderer.drawMiniPortrat(Game1.spriteBatch, new Vector2(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 230 + (index - 1) / 7 * 32 * 4), 0.5f, 4f, 2, Game1.getFarmer(pair.Key));
}
}
}
/// <summary>
/// Functionality to display the player's birthday on the billboard.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void MenuEvents_MenuChanged(object sender, EventArgsClickableMenuChanged e)
{
if (Game1.activeClickableMenu == null)
{
isDailyQuestBoard = false;
return;
}
if(Game1.activeClickableMenu is Billboard)
{
isDailyQuestBoard = ModHelper.Reflection.GetField<bool>((Game1.activeClickableMenu as Billboard), "dailyQuestBoard", true).GetValue();
if (isDailyQuestBoard) return;
Texture2D text = new Texture2D(Game1.graphics.GraphicsDevice,1,1);
Color[] col = new Color[1];
col[0] = new Color(0, 0, 0, 1);
text.SetData<Color>(col);
//players birthdy position rect=new ....
if (!String.IsNullOrEmpty(PlayerData.BirthdaySeason))
{
if (PlayerData.BirthdaySeason.ToLower() == Game1.currentSeason.ToLower())
{
int index = PlayerData.BirthdayDay;
Rectangle birthdayRect = new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 200 + (index - 1) / 7 * 32 * 4, 124, 124);
(Game1.activeClickableMenu as Billboard).calendarDays.Add(new ClickableTextureComponent("", birthdayRect, "", Game1.player.name + "'s Birthday", text, new Rectangle(0, 0, 124, 124), 1f, false));
}
}
foreach (var pair in this.othersBirthdays)
{
if (pair.Value.BirthdaySeason != Game1.currentSeason.ToLower()) continue;
int index = pair.Value.BirthdayDay;
Rectangle otherBirthdayRect = new Rectangle(Game1.activeClickableMenu.xPositionOnScreen + 152 + (index - 1) % 7 * 32 * 4, Game1.activeClickableMenu.yPositionOnScreen + 200 + (index - 1) / 7 * 32 * 4, 124, 124);
(Game1.activeClickableMenu as Billboard).calendarDays.Add(new ClickableTextureComponent("", otherBirthdayRect, "", Game1.getFarmer(pair.Key).name + "'s Birthday", text, new Rectangle(0, 0, 124, 124), 1f, false));
}
}
}
@ -147,7 +348,8 @@ namespace Omegasis.HappyBirthday
private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
{
// show birthday selection menu
if (Context.IsPlayerFree && !this.HasChosenBirthday && e.KeyPressed.ToString() == this.Config.KeyBinding)
if (Game1.activeClickableMenu != null) return;
if (Context.IsPlayerFree && !this.HasChosenBirthday && e.KeyPressed.ToString() == Config.KeyBinding)
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
}
@ -160,14 +362,19 @@ namespace Omegasis.HappyBirthday
// reset state
this.VillagerQueue = new List<string>();
this.PossibleBirthdayGifts = new List<Item>();
this.BirthdayGiftToReceive = null;
this.CheckedForBirthday = false;
// load settings
this.MigrateLegacyData();
this.PlayerData = this.Helper.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
this.PlayerData = this.Helper.Data.ReadJsonFile<PlayerData>(this.DataFilePath) ?? new PlayerData();
messages.createBirthdayGreetings();
if (PlayerBirthdayData != null)
{
ModMonitor.Log("Send all birthday information from " + Game1.player.name);
MultiplayerSupport.SendBirthdayInfoToOtherPlayers();
}
//this.SeenEvent = false;
//this.Dialogue = new Dictionary<string, Dialogue>();
}
@ -178,7 +385,7 @@ namespace Omegasis.HappyBirthday
private void SaveEvents_BeforeSave(object sender, EventArgs e)
{
if (this.HasChosenBirthday)
this.Helper.WriteJsonFile(this.DataFilePath, this.PlayerData);
this.Helper.Data.WriteJsonFile(this.DataFilePath, this.PlayerData);
}
/// <summary>The method invoked when the game updates (roughly 60 times per second).</summary>
@ -188,8 +395,13 @@ namespace Omegasis.HappyBirthday
{
if (!Context.IsWorldReady || Game1.eventUp || Game1.isFestival())
return;
if (!this.HasChosenBirthday && Game1.activeClickableMenu == null && Game1.player.Name.ToLower()!="unnamed farmhand")
{
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
this.CheckedForBirthday = false;
}
if (!this.CheckedForBirthday)
if (!this.CheckedForBirthday && Game1.activeClickableMenu==null)
{
this.CheckedForBirthday = true;
@ -197,7 +409,9 @@ namespace Omegasis.HappyBirthday
if (this.IsBirthday())
{
Messages.ShowStarMessage("It's your birthday today! Happy birthday!");
//MultiplayerSupport.SendBirthdayMessageToOtherPlayers();
MultiplayerSupport.SendBirthdayMessageToOtherPlayers();
Game1.player.mailbox.Add("birthdayMom");
@ -218,69 +432,66 @@ namespace Omegasis.HappyBirthday
if (npc is Child || npc is Horse || npc is Junimo || npc is Monster || npc is Pet)
continue;
//Add in birthday dialogues for npc.
try
{
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]);
if (Game1.player.getFriendshipHeartLevelForNPC(npc.Name) >= Config.minimumFriendshipLevelForBirthdayWish)
{
bool spouseMessage = false; //Used to determine if there is a valid spouse message for the player. If false load in the generic birthday wish.
//Check if npc name is spouse's name. If no spouse then add in generic dialogue.
if (messages.spouseBirthdayWishes.ContainsKey(npc.Name) && Game1.player.isMarried())
{
Monitor.Log("Spouse Checks out");
//Check to see if spouse message exists.
if (!String.IsNullOrEmpty(messages.spouseBirthdayWishes[npc.Name]))
{
spouseMessage = true;
Dialogue d = new Dialogue(messages.spouseBirthdayWishes[npc.Name], npc);
npc.CurrentDialogue.Push(d);
if (npc.CurrentDialogue.ElementAt(0) != d) npc.setNewDialogue(messages.spouseBirthdayWishes[npc.Name]);
}
else
{
Monitor.Log("No spouse message???", LogLevel.Warn);
}
}
if (spouseMessage == false)
{
//Load in
Dialogue d = new Dialogue(messages.birthdayWishes[npc.Name], npc);
npc.CurrentDialogue.Push(d);
if (npc.CurrentDialogue.ElementAt(0) != d) npc.setNewDialogue(messages.birthdayWishes[npc.Name]);
}
}
}
catch
{
Dialogue d = new Dialogue("Happy Birthday @!", npc);
npc.CurrentDialogue.Push(d);
if (npc.CurrentDialogue.ElementAt(0) != d)
npc.setNewDialogue("Happy Birthday @!");
if (Game1.player.getFriendshipHeartLevelForNPC(npc.Name) >= Config.minimumFriendshipLevelForBirthdayWish)
{
Dialogue d = new Dialogue("Happy Birthday @!", npc);
npc.CurrentDialogue.Push(d);
if (npc.CurrentDialogue.ElementAt(0) != d)
npc.setNewDialogue("Happy Birthday @!");
}
}
}
}
}
//Don't constantly set the birthday menu.
if (Game1.activeClickableMenu != null)
{
if (Game1.activeClickableMenu.GetType() == typeof(BirthdayMenu)) return;
}
// ask for birthday date
if (!this.HasChosenBirthday)
if (!this.HasChosenBirthday && Game1.activeClickableMenu==null)
{
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
this.CheckedForBirthday = false;
}
}
// unreachable since we exit early if Game1.eventUp
//if (Game1.eventUp)
//{
// foreach (string npcName in this.VillagerQueue)
// {
// NPC npc = Game1.getCharacterFromName(npcName);
// try
// {
// this.Dialogue.Add(npcName, npc.CurrentDialogue.Pop());
// }
// catch (Exception ex)
// {
// this.Monitor.Log(ex.ToString(), LogLevel.Error);
// this.Dialogue.Add(npcName, npc.CurrentDialogue.ElementAt(0));
// npc.loadSeasonalDialogue();
// }
// this.SeenEvent = true;
// }
//}
//if (!Game1.eventUp && this.SeenEvent)
//{
// foreach (KeyValuePair<string, Dialogue> v in this.Dialogue)
// {
// NPC npc = Game1.getCharacterFromName(v.Key);
// npc.CurrentDialogue.Push(v.Value);
// }
// this.Dialogue.Clear();
// this.SeenEvent = false;
//}
// set birthday gift
// Set birthday gift for the player to recieve from the npc they are currently talking with.
if (Game1.currentSpeaker != null)
{
string name = Game1.currentSpeaker.Name;
@ -288,7 +499,7 @@ namespace Omegasis.HappyBirthday
{
try
{
this.SetNextBirthdayGift(Game1.currentSpeaker.Name);
giftManager.SetNextBirthdayGift(Game1.currentSpeaker.Name);
this.VillagerQueue.Remove(Game1.currentSpeaker.Name);
}
catch (Exception ex)
@ -296,17 +507,20 @@ namespace Omegasis.HappyBirthday
this.Monitor.Log(ex.ToString(), LogLevel.Error);
}
}
//Validate the gift and give it to the player.
if (giftManager.BirthdayGiftToReceive != null)
{
while (giftManager.BirthdayGiftToReceive.Name == "Error Item" || giftManager.BirthdayGiftToReceive.Name == "Rock" || giftManager.BirthdayGiftToReceive.Name == "???")
giftManager.SetNextBirthdayGift(Game1.currentSpeaker.Name);
Game1.player.addItemByMenuIfNecessaryElseHoldUp(giftManager.BirthdayGiftToReceive);
giftManager.BirthdayGiftToReceive = null;
}
}
if (this.BirthdayGiftToReceive != null && Game1.currentSpeaker != null)
{
while (this.BirthdayGiftToReceive.Name == "Error Item" || this.BirthdayGiftToReceive.Name == "Rock" || this.BirthdayGiftToReceive.Name == "???")
this.SetNextBirthdayGift(Game1.currentSpeaker.Name);
Game1.player.addItemByMenuIfNecessaryElseHoldUp(this.BirthdayGiftToReceive);
this.BirthdayGiftToReceive = null;
}
}
/// <summary>Set the player's birtday/</summary>
/// <summary>Set the player's birthday/</summary>
/// <param name="season">The birthday season.</param>
/// <param name="day">The birthday day.</param>
private void SetBirthday(string season, int day)
@ -333,232 +547,6 @@ namespace Omegasis.HappyBirthday
}
}
/// <summary>Set the next birthday gift the player will receive.</summary>
/// <param name="name">The villager's name who's giving the gift.</param>
/// <remarks>This returns gifts based on the speaker's heart level towards the player: neutral for 0-3, good for 4-6, and best for 7-10.</remarks>
private void SetNextBirthdayGift(string name)
{
Item gift;
if (this.PossibleBirthdayGifts.Count > 0)
{
Random random = new Random();
int index = random.Next(this.PossibleBirthdayGifts.Count);
gift = this.PossibleBirthdayGifts[index];
if (Game1.player.isInventoryFull())
Game1.createItemDebris(gift, Game1.player.getStandingPosition(), Game1.player.getDirection());
else
this.BirthdayGiftToReceive = gift;
return;
}
this.PossibleBirthdayGifts.AddRange(this.GetDefaultBirthdayGifts(name));
Random rnd2 = new Random();
int r2 = rnd2.Next(this.PossibleBirthdayGifts.Count);
gift = this.PossibleBirthdayGifts.ElementAt(r2);
if (Game1.player.isInventoryFull())
Game1.createItemDebris(gift, Game1.player.getStandingPosition(), Game1.player.getDirection());
else
this.BirthdayGiftToReceive = gift;
this.PossibleBirthdayGifts.Clear();
}
/// <summary>Get the default gift items.</summary>
/// <param name="name">The villager's name.</param>
private IEnumerable<SObject> GetDefaultBirthdayGifts(string name)
{
List<SObject> gifts = new List<SObject>();
try
{
// read from birthday gifts file
IDictionary<string, string> data = Game1.content.Load<Dictionary<string, string>>("Data\\PossibleBirthdayGifts");
data.TryGetValue(name, out string text);
if (text != null)
{
string[] fields = text.Split('/');
// love
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 7)
{
string[] loveFields = fields[1].Split(' ');
for (int i = 0; i < loveFields.Length; i += 2)
{
try
{
gifts.AddRange(this.GetItems(Convert.ToInt32(loveFields[i]), Convert.ToInt32(loveFields[i + 1])));
}
catch { }
}
}
// like
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 4 && Game1.player.getFriendshipHeartLevelForNPC(name) <= 6)
{
string[] likeFields = fields[3].Split(' ');
for (int i = 0; i < likeFields.Length; i += 2)
{
try
{
gifts.AddRange(this.GetItems(Convert.ToInt32(likeFields[i]), Convert.ToInt32(likeFields[i + 1])));
}
catch { }
}
}
// neutral
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 0 && Game1.player.getFriendshipHeartLevelForNPC(name) <= 3)
{
string[] neutralFields = fields[5].Split(' ');
for (int i = 0; i < neutralFields.Length; i += 2)
{
try
{
gifts.AddRange(this.GetItems(Convert.ToInt32(neutralFields[i]), Convert.ToInt32(neutralFields[i + 1])));
}
catch { }
}
}
}
// get NPC's preferred gifts
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 7)
gifts.AddRange(this.GetUniversalItems("Love", true));
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 4 && Game1.player.getFriendshipHeartLevelForNPC(name) <= 6)
this.PossibleBirthdayGifts.AddRange(this.GetUniversalItems("Like", true));
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 0 && Game1.player.getFriendshipHeartLevelForNPC(name) <= 3)
this.PossibleBirthdayGifts.AddRange(this.GetUniversalItems("Neutral", true));
}
catch
{
// get NPC's preferred gifts
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 7)
{
this.PossibleBirthdayGifts.AddRange(this.GetUniversalItems("Love", false));
this.PossibleBirthdayGifts.AddRange(this.GetLovedItems(name));
}
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 4 && Game1.player.getFriendshipHeartLevelForNPC(name) <= 6)
{
this.PossibleBirthdayGifts.AddRange(this.GetLikedItems(name));
this.PossibleBirthdayGifts.AddRange(this.GetUniversalItems("Like", false));
}
if (Game1.player.getFriendshipHeartLevelForNPC(name) >= 0 && Game1.player.getFriendshipHeartLevelForNPC(name) <= 3)
this.PossibleBirthdayGifts.AddRange(this.GetUniversalItems("Neutral", false));
}
//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;
}
/// <summary>Get the items loved by all villagers.</summary>
/// <param name="group">The group to get (one of <c>Like</c>, <c>Love</c>, <c>Neutral</c>).</param>
/// <param name="isBirthdayGiftList">Whether to get data from <c>Data\PossibleBirthdayGifts.xnb</c> instead of the game data.</param>
private IEnumerable<SObject> GetUniversalItems(string group, bool isBirthdayGiftList)
{
if (!isBirthdayGiftList)
{
// get raw data
Game1.NPCGiftTastes.TryGetValue($"Universal_{group}", out string text);
if (text == null)
yield break;
// parse
string[] neutralIDs = text.Split(' ');
foreach (string neutralID in neutralIDs)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(neutralID)))
yield return obj;
}
}
else
{
// get raw data
Dictionary<string, string> data = Game1.content.Load<Dictionary<string, string>>("Data\\PossibleBirthdayGifts");
data.TryGetValue($"Universal_{group}_Gift", out string text);
if (text == null)
yield break;
// parse
string[] array = text.Split(' ');
for (int i = 0; i < array.Length; i += 2)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(array[i]), Convert.ToInt32(array[i + 1])))
yield return obj;
}
}
}
/// <summary>Get a villager's loved items.</summary>
/// <param name="name">The villager's name.</param>
private IEnumerable<SObject> GetLikedItems(string name)
{
// get raw data
Game1.NPCGiftTastes.TryGetValue(name, out string text);
if (text == null)
yield break;
// parse
string[] data = text.Split('/');
string[] likedIDs = data[3].Split(' ');
foreach (string likedID in likedIDs)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(likedID)))
yield return obj;
}
}
/// <summary>Get a villager's loved items.</summary>
/// <param name="name">The villager's name.</param>
private IEnumerable<SObject> GetLovedItems(string name)
{
// get raw data
Game1.NPCGiftTastes.TryGetValue(name, out string text);
if (text == null)
yield break;
// parse
string[] data = text.Split('/');
string[] lovedIDs = data[1].Split(' ');
foreach (string lovedID in lovedIDs)
{
foreach (SObject obj in this.GetItems(Convert.ToInt32(lovedID)))
yield return obj;
}
}
/// <summary>Get the items matching the given ID.</summary>
/// <param name="id">The category or item ID.</param>
private IEnumerable<SObject> GetItems(int id)
{
return id < 0
? ObjectUtility.GetObjectsInCategory(id)
: new[] { new SObject(id, 1) };
}
/// <summary>Get the items matching the given ID.</summary>
/// <param name="id">The category or item ID.</param>
/// <param name="stack">The stack size.</param>
private IEnumerable<SObject> GetItems(int id, int stack)
{
foreach (SObject obj in this.GetItems(id))
yield return new SObject(obj.ParentSheetIndex, stack);
}
/// <summary>Get whether today is the player's birthday.</summary>
private bool IsBirthday()
{
@ -584,7 +572,7 @@ namespace Omegasis.HappyBirthday
try
{
string[] text = File.ReadAllLines(this.LegacyDataFilePath);
this.Helper.WriteJsonFile(this.DataFilePath, new PlayerData
this.Helper.Data.WriteJsonFile(this.DataFilePath, new PlayerData
{
BirthdaySeason = text[3],
BirthdayDay = Convert.ToInt32(text[5])
@ -603,5 +591,7 @@ namespace Omegasis.HappyBirthday
}
}
}

View File

@ -71,6 +71,9 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup>
@ -78,14 +81,17 @@
<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" />
<Compile Include="PossibleGifts.cs" />
<Compile Include="GiftManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@ -96,15 +102,18 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Content Include="Changelog.txt" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,58 +0,0 @@
using StardewModdingAPI;
using System.Collections.Generic;
namespace Omegasis.HappyBirthday
{
class PossibleGifts : IAssetLoader
{
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
{
["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",
["Robin"] = " BestGifts/224 1 426 1 636 1/GoodGift/-6 5 -79 5 424 1 709 1/NeutralGift//",
["Demetrius"] = " Best Gifts/207 1 232 1 233 1 400 1/Good Gifts/-5 3 -79 5 422 1/NeutralGift/-4 3/",
["Maru"] = " BestGift/72 1 197 1 190 1 215 1 222 1 243 1 336 1 337 1 400 1 787 1/Good Gift/-260 1 62 1 64 1 66 1 68 1 70 1 334 1 335 1 725 1 726 1/NeutralGift/",
["Sebastian"] = " Best/84 1 227 1 236 1 575 1 305 1 /Good/267 1 276 1/Neutral/-4 3/",
["Linus"] = " Best/88 1 90 1 234 1 242 1 280 1/Good/-5 3 -6 5 -79 5 -81 10/Neutral/-4 3/",
["Pierre"] = " Best/202 1/Good/-5 3 -6 5 -7 1 18 1 22 1 402 1 418 1 259 1/Neutral//",
["Caroline"] = " Best/213 1 593 1/Good/-7 1 18 1 402 1 418 1/Neutral// ",
["Abigail"] = " Best/66 1 128 1 220 1 226 1 276 1 611 1/Good//Neutral// ",
["Alex"] = " Best/201 1 212 1 662 1 664 1/Good/-5 3/Neutral// ",
["George"] = " Best/20 1 205 1/Good/18 1 195 1 199 1 200 1 214 1 219 1 223 1 231 1 233 1/Neutral// ",
["Evelyn"] = " Best/72 1 220 1 239 1 284 1 591 1 595 1/Good/-6 5 18 1 402 1 418 1/Neutral// ",
["Lewis"] = " Best/200 1 208 1 235 1 260 1/Good/-80 5 24 1 88 1 90 1 192 1 258 1 264 1 272 1 274 1 278 1/Neutral// ",
["Clint"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 336 1 337 1 605 1 649 1 749 1 337 5/Good/334 20 335 10 336 5/Neutral// ",
["Penny"] = " Best/60 1 376 1 651 1 72 1 164 1 218 1 230 1 244 1 254 1/Good/-6 5 20 1 22 1/Neutral// ",
["Pam"] = " Best/24 1 90 1 199 1 208 1 303 1 346 1/Good/-6 5 -75 5 -79 5 18 1 227 1 228 1 231 1 232 1 233 1 234 1 235 1 236 1 238 1 402 1 418 1/Neutral/-4 3/ ",
["Emily"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 241 1 428 1 440 1 /Good/18 1 82 1 84 1 86 1 196 1 200 1 207 1 230 1 235 1 402 1 418 1/Neutral// ",
["Haley"] = " Best/221 1 421 1 610 1 88 1 /Good/18 1 60 1 62 1 64 1 70 1 88 1 222 1 223 1 232 1 233 1 234 1 402 1 418 1 /Neutral// ",
["Jas"] = " Best/221 1 595 1 604 1 /Good/18 1 60 1 64 1 70 1 88 1 232 1 233 1 234 1 222 1 223 1 340 1 344 1 402 1 418 1 /Neutral// ",
["Vincent"] = " Best/221 1 398 1 612 1 /Good/18 1 60 1 64 1 70 1 88 1 232 1 233 1 234 1 222 1 223 1 340 1 344 1 402 1 418 1 /Neutral// ",
["Jodi"] = " Best/72 1 200 1 211 1 214 1 220 1 222 1 225 1 231 1 /Good/-5 3 -6 5 -79 5 18 1 402 1 418 1 /Neutral// ",
["Kent"] = " Best/607 1 649 1 /Good/-5 3 -79 5 18 1 402 1 418 1 /Neutral// ",
["Sam"] = " Best/90 1 206 1 655 1 658 1 562 1 731 1/Good/167 1 210 1 213 1 220 1 223 1 224 1 228 1 232 1 233 1 239 1 -5 3/Neutral// ",
["Leah"] = " Best/196 1 200 1 348 1 606 1 651 1 650 1 426 1 430 1 /Good/-5 3 -6 5 -79 5 -81 10 18 1 402 1 406 1 408 1 418 1 86 1 /Neutral// ",
["Shane"] = " Best/206 1 215 1 260 1 346 1 /Good/-5 3 -79 5 303 1 /Neutral// ",
["Marnie"] = " Best/72 1 221 1 240 1 608 1 /Good/-5 3 -6 5 402 1 418 1 /Neutral// ",
["Elliott"] = " Best/715 1 732 1 218 1 444 1 /Good/727 1 728 1 -79 5 60 1 80 1 82 1 84 1 149 1 151 1 346 1 348 1 728 1 /Neutral/-4 3 / ",
["Gus"] = " Best/72 1 213 1 635 1 729 1 /Good/348 1 303 1 -7 1 18 1 /Neutral// ",
["Dwarf"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 749 1 /Good/82 1 84 1 86 1 96 1 97 1 98 1 99 1 121 1 122 1 /Neutral/-28 20 / ",
["Wizard"] = " Best/107 1 155 1 422 1 769 1 768 1 /Good/-12 3 72 1 82 1 84 1/Neutral// ",
["Harvey"] = " Best/348 1 237 1 432 1 395 1 342 1 /Good/-81 10 -79 5 -7 1 402 1 418 1 422 1 436 1 438 1 442 1 444 1 422 1 /Neutral// ",
["Sandy"] = " Best/18 1 402 1 418 1 /Good/-75 5 -79 5 88 1 428 1 436 1 438 1 440 1 /Neutral// ",
["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// "
};
}
}
}

View File

@ -3,7 +3,7 @@
"Author": "Alpha_Omegasis",
"Version": {
"MajorVersion": 1,
"MinorVersion": 6,
"MinorVersion": 8,
"PatchVersion": 0,
"Build": null
},

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -95,15 +95,15 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -79,27 +79,16 @@ namespace Omegasis.MoreRain
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("It will rain tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_sunny;
this.VerboseLog("It will not rain tomorrow.");
return;
}
// set storm
if (Game1.weatherForTomorrow == Game1.weather_rain)
if (chance <= this.Config.SpringThunderChance)
{
if (chance <= this.Config.SpringThunderChance)
{
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("There will be no lightning tomorrow.");
}
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
return;
}
break;
case "summer":
@ -108,26 +97,15 @@ namespace Omegasis.MoreRain
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("It will rain tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_sunny;
this.VerboseLog("It will not rain tomorrow.");
return;
}
// set storm
if (Game1.weatherForTomorrow == Game1.weather_rain)
if (chance <= this.Config.SummerThunderChance)
{
if (chance <= this.Config.SummerThunderChance)
{
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("There will be no lightning tomorrow.");
}
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
return;
}
break;
@ -138,26 +116,14 @@ namespace Omegasis.MoreRain
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("It will rain tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_sunny;
this.VerboseLog("It will not rain tomorrow.");
return;
}
// set storm
if (Game1.weatherForTomorrow == Game1.weather_rain)
if (chance <= this.Config.FallThunderChance)
{
if (chance <= this.Config.FallThunderChance)
{
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
}
else
{
Game1.weatherForTomorrow = Game1.weather_rain;
this.VerboseLog("There will be no lightning tomorrow.");
}
Game1.weatherForTomorrow = Game1.weather_lightning;
this.VerboseLog("It will be stormy tomorrow.");
return;
}
break;

View File

@ -85,15 +85,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
{
"Name": "More Rain",
"Author": "Alpha_Omegasis",
"Version": "1.6.0",
"Version": "1.6.1",
"Description": "Change how much it rains in the game.",
"UniqueID": "Omegasis.MoreRain",
"EntryDll": "MoreRain.dll",

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -88,15 +88,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
{
"Name": "Museum Rearranger",
"Author": "Alpha_Omegasis",
"Version": "1.5.0",
"Version": "1.6.0",
"Description": "Lets you rearrange the museum without needing to donate something.",
"UniqueID": "Omegasis.MuseumRearranger",
"EntryDll": "MuseumRearranger.dll",

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -23,5 +23,11 @@
/// <summary>Whether to keep stamina as-is after the player collapses.</summary>
public bool KeepStaminaAfterCollapse { get; set; } = true;
/// <summary>
/// Whether or not to use the internal NightFish asset editor. When false, it will just use the Fish.xnb file.
/// </summary>
public bool UseInternalNightFishAssetEditor { get; set; } = true;
}
}

View File

@ -0,0 +1,91 @@
using StardewModdingAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Omegasis.NightOwl.Framework
{
class NightFishing : IAssetEditor
{
public bool CanEdit<T>(IAssetInfo asset)
{
return asset.AssetNameEquals(@"Data\Fish");
}
public void Edit<T>(IAssetData asset)
{
Dictionary<int,string> nightFish=new Dictionary<int, string> // (T)(object) is a trick to cast anything to T if we know it's compatible
{
[128] = "Pufferfish/80/floater/1/36/1200 1600/summer/sunny/690 .4 685 .1/4/.3/.5/0",
[129] = "Anchovy/30/dart/1/16/600 3000/spring fall/both/682 .2/1/.25/.3/0",
[130] = "Tuna/70/smooth/12/60/600 1900/summer winter/both/689 .35 681 .1/3/.15/.55/0",
[131] = "Sardine/30/dart/1/12/600 1900/spring summer fall winter/both/683 .3/1/.65/.1/0",
[132] = "Bream/35/smooth/12/30/1800 3000/spring summer fall winter/both/684 .35/1/.45/.1/0",
[136] = "Largemouth Bass/50/mixed/11/30/600 1900/spring summer fall winter/both/685 .35/3/.4/.2/0",
[137] = "Smallmouth Bass/28/mixed/12/24/600 3000/spring fall/both/682 .2/1/.45/.1/0",
[138] = "Rainbow Trout/45/mixed/10/25/600 1900/summer/sunny/684 .35/2/.35/.3/0",
[139] = "Salmon/50/mixed/24/65/600 1900/fall/both/684 .35/3/.4/.2/0",
[140] = "Walleye/45/smooth/10/40/1200 3000/fall winter/rainy/680 .35/2/.4/.15/0",
[141] = "Perch/35/dart/10/24/600 3000/winter/both/683 .2/1/.45/.1/0",
[142] = "Carp/15/mixed/15/50/600 3000/spring summer fall/both/682 .2/1/.45/.1/0",
[143] = "Catfish/75/mixed/12/72/600 2400/spring fall winter/rainy/689 .4 680 .1/4/.4/.1/0",
[144] = "Pike/60/dart/15/60/600 3000/summer winter/both/690 .3 681 .1/3/.4/.15/0",
[145] = "Sunfish/30/mixed/5/15/600 1900/spring summer/sunny/683 .2/1/.45/.1/0",
[146] = "Red Mullet/55/smooth/8/22/600 1900/summer winter/both/680 .25/2/.4/.15/0",
[147] = "Herring/25/dart/8/20/600 3000/spring winter/both/685 .2/1/.45/.1/0",
[148] = "Eel/70/smooth/12/80/1600 3000/spring fall/rainy/689 .35 680 .1/3/.55/.1/0",
[149] = "Octopus/95/sinker/12/48/600 1300/summer/both/688 .6 684 .1/5/.1/.08/0",
[150] = "Red Snapper/40/mixed/8/25/600 1900/summer fall winter/rainy/682 .25/2/.45/.1/0",
[151] = "Squid/75/sinker/12/48/1800 3000/winter/both/690 .35 680 .1/3/.35/.3/0",
[152] = "Seaweed/5/floater/5/30/600 3000/spring summer fall winter/both/-1/0/.3/0/0",
[153] = "Green Algae/5/floater/5/30/600 3000/spring summer fall winter/both/-1/0/.3/0/0",
[154] = "Sea Cucumber/40/sinker/3/20/600 1900/fall winter/both/683 .2 689 .4/3/.25/.25/0",
[155] = "Super Cucumber/80/sinker/12/36/1800 3000/summer winter/both/683 .2 689 .4/4/.1/.25/0",
[156] = "Ghostfish/50/mixed/10/35/600 3000/spring summer fall winter/both/684 .35/2/.3/.3/0",
[157] = "White Algae/5/floater/5/30/600 3000/spring summer fall winter/both/-1/0/.3/0/0",
[158] = "Stonefish/65/sinker/15/15/600 3000/spring summer fall winter/both/689 .2/2/.1/.1/3",
[159] = "Crimsonfish/95/mixed/20/20/600 2000/winter/both/690 .15/4/.1/.1/5",
[160] = "Angler/85/smooth/18/18/600 3000/spring summer fall winter/both/690 .1/4/.05/.1/3",
[161] = "Ice Pip/85/dart/8/8/600 3000/spring summer fall winter/both/682 .1/2/.05/.1/5",
[162] = "Lava Eel/90/mixed/32/32/600 3000/spring summer fall winter/both/684 .1/2/.05/.1/7",
[163] = "Legend/110/mixed/50/50/600 2000/spring summer fall winter/rainy/688 .05/5/0/.1/10",
[164] = "Sandfish/65/mixed/8/24/600 2000/spring summer fall winter/both/682 .2/1/.65/.1/0",
[165] = "Scorpion Carp/90/dart/12/32/600 2000/spring summer fall winter/both/683 .4/2/.15/.1/4",
[372] = "Clam/trap/.15/681 .35/ocean/1/5",
[682] = "Mutant Carp/80/dart/36/36/600 3000/spring summer fall winter/both/688 .1/5/0/.02/0",
[698] = "Sturgeon/78/mixed/12/60/600 1900/summer winter/both/689 .35 682 .1/3/.35/.2/0",
[699] = "Tiger Trout/60/dart/10/20/600 1900/spring summer fall winter/both/688 .45 685 .2/3/.2/.1/0",
[700] = "Bullhead/46/smooth/12/30/600 3000/spring summer fall winter/both/681 .25/2/.35/.2/0",
[701] = "Tilapia/50/mixed/11/30/600 1400/summer fall/both/683 .35/3/.4/.2/0",
[702] = "Chub/35/dart/12/24/600 3000/spring summer fall winter/both/684 .35/1/.45/.1/0",
[704] = "Dorado/78/mixed/24/32/600 1900/summer/both/689 .35 681 .1/3/.15/.1/0",
[705] = "Albacore/60/mixed/20/40/600 1100 1800 3000/fall winter/both/685 .35/3/.3/.15/0",
[706] = "Shad/45/smooth/20/48/900 3000/spring summer fall/rainy/684 .35/2/.35/.2/0",
[707] = "Lingcod/85/mixed/30/50/600 3000/winter/both/690 .4 685 .2/3/.3/.05/0",
[708] = "Halibut/50/sinker/10/33/600 1100 1900 3000/spring summer winter/both/681 .35/3/.4/.2/0",
[715] = "Lobster/trap/.05/688 .45 689 .35 690 .35/ocean/2/20",
[716] = "Crayfish/trap/.35/682 .4/freshwater/1/8",
[717] = "Crab/trap/.1/684 .45/ocean/1/20",
[718] = "Cockle/trap/.3/680 .2/ocean/1/5",
[719] = "Mussel/trap/.35/683 .15/ocean/1/5",
[720] = "Shrimp/trap/.2/681 .35/ocean/1/3",
[721] = "Snail/trap/.25/680 .35/freshwater/1/5",
[722] = "Periwinkle/trap/.55/681 .35/freshwater/1/3",
[723] = "Oyster/trap/.15/682 .35/ocean/1/5",
[734] = "Woodskip/50/mixed/11/30/600 3000/spring summer fall winter/both/685 .35/3/.2/.1/0",
[775] = "Glacierfish/100/mixed/27/27/600 2000/winter/sunny/688 .1/5/0/.02/7",
[795] = "Void Salmon/80/mixed/24/65/600 3000/spring summer fall winter/both/685 .35/2/.33/.1/0",
[796] = "Slimejack/55/dart/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
[798] = "Midnight Squid/55/sinker/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
[799] = "Spook Fish/60/dart/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
[800] = "Blobfish/75/floater/8/25/600 3000/spring summer fall winter/both/685 .35/3/.4/.1/0",
};
foreach (KeyValuePair<int, string> pair in nightFish) {
asset.AsDictionary<int, string>().Set(pair.Key, pair.Value);
}
}
}
}

View File

@ -1,11 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework;
using Netcode;
using Omegasis.NightOwl.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Characters;
using StardewValley.Locations;
/*TODO:
Issues:
@ -60,6 +64,33 @@ namespace Omegasis.NightOwl
/// <summary>The player's health before they collapsed.</summary>
private int PreCollapseHealth;
/// <summary>
/// Checks if the player was bathing or not before passing out.
/// </summary>
private bool isBathing;
/// <summary>
/// Checks if the player was in their swimsuit before passing out.
/// </summary>
private bool isInSwimSuit;
/// <summary>
/// The horse the player was riding before they collapsed.
/// </summary>
private Horse horse;
/// <summary>
/// Determines whehther or not to rewarp the player's horse to them.
/// </summary>
private bool shouldWarpHorse;
/// <summary>
/// Event in the night taht simulates the earthquake event that should happen.
/// </summary>
StardewValley.Events.SoundInTheNightEvent eve;
private List<NetByte> oldAnimalHappiness;
/*********
@ -69,18 +100,42 @@ namespace Omegasis.NightOwl
/// <param name="helper">Provides simplified APIs for writing mods.</param>
public override void Entry(IModHelper helper)
{
this.oldAnimalHappiness = new List<NetByte>();
this.Config = helper.ReadConfig<ModConfig>();
if (Config.UseInternalNightFishAssetEditor)
{
this.Helper.Content.AssetEditors.Add(new NightFishing());
}
TimeEvents.TimeOfDayChanged += this.TimeEvents_TimeOfDayChanged;
TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted;
SaveEvents.AfterLoad += this.SaveEvents_AfterLoad;
SaveEvents.BeforeSave += this.SaveEvents_BeforeSave;
GameEvents.FourthUpdateTick += this.GameEvents_FourthUpdateTick;
GameEvents.UpdateTick += GameEvents_UpdateTick;
shouldWarpHorse = false;
}
/*********
** Private methods
*********/
/// <summary>
/// Updates the earthquake event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GameEvents_UpdateTick(object sender, EventArgs e)
{
if (eve == null) return;
else
{
eve.tickUpdate(Game1.currentGameTime);
}
}
/// <summary>The method invoked every fourth game update (roughly 15 times per second).</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
@ -105,6 +160,28 @@ namespace Omegasis.NightOwl
this.WriteErrorLog();
}
}
/// <summary>The method invoked before the game saves.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
public void SaveEvents_BeforeSave(object sender, EventArgs e)
{
int collapseFee = 0;
string[] passOutFees = Game1.player.mailbox
.Where(p => p.Contains("passedOut"))
.ToArray();
for (int idx=0; idx< passOutFees.Length; idx++)
{
string[] msg = passOutFees[idx].Split(' ');
collapseFee += Int32.Parse(msg[1]);
}
if (this.Config.KeepMoneyAfterCollapse)
{
Game1.player.money += collapseFee;
}
}
/// <summary>The method invoked after the player loads a save.</summary>
/// <param name="sender">The event sender.</param>
@ -125,7 +202,6 @@ namespace Omegasis.NightOwl
{
// reset data
this.IsUpLate = false;
Game1.farmerShouldPassOut = false;
// transition to the next day
if (this.ShouldResetPlayerAfterCollapseNow)
@ -136,10 +212,51 @@ namespace Omegasis.NightOwl
Game1.player.stamina = this.PreCollapseStamina;
if (this.Config.KeepHealthAfterCollapse)
Game1.player.health = this.PreCollapseHealth;
if (this.Config.KeepMoneyAfterCollapse)
Game1.player.money = this.PreCollapseMoney;
if (this.Config.KeepPositionAfterCollapse)
Game1.warpFarmer(this.PreCollapseMap, this.PreCollapseTile.X, this.PreCollapseTile.Y, false);
if (Game1.weddingToday == false)
{
Game1.warpFarmer(this.PreCollapseMap, this.PreCollapseTile.X, this.PreCollapseTile.Y, false);
}
if (horse != null && shouldWarpHorse==true)
{
Game1.warpCharacter(horse, Game1.player.currentLocation, Game1.player.position);
shouldWarpHorse = false;
}
if (isInSwimSuit)
{
Game1.player.changeIntoSwimsuit();
}
if (isBathing)
{
Game1.player.swimming.Value = true;
}
//Reflction to ensure that the railroad becomes properly unblocked.
if (Game1.dayOfMonth == 1 && Game1.currentSeason == "summer" && Game1.year == 1)
{
Mountain mountain = (Mountain)Game1.getLocationFromName("Mountain");
var reflect2 = Helper.Reflection.GetField<NetBool>(mountain, "railroadAreaBlocked", true);
var netBool2 = reflect2.GetValue();
netBool2.Value = false;
reflect2.SetValue(netBool2);
var reflect3 = Helper.Reflection.GetField<Rectangle>(mountain, "railroadBlockRect", true);
var netBool3 = reflect3.GetValue();
netBool3 = new Rectangle(0, 0, 0, 0);
reflect3.SetValue(netBool3);
eve = new StardewValley.Events.SoundInTheNightEvent(4);
eve.setUp();
eve.makeChangesToLocation();
}
}
if(Game1.currentSeason!="spring" && Game1.year >= 1)
{
clearRailRoadBlock();
}
// delete annoying charge messages (if only I could do this with mail IRL)
@ -163,6 +280,25 @@ namespace Omegasis.NightOwl
}
}
/// <summary>
/// If the user for this mod never gets the event that makes the railroad blok go away we will always force it to go away if they have met the conditions for it. I.E not being in spring of year 1.
/// </summary>
private void clearRailRoadBlock()
{
Mountain mountain = (Mountain)Game1.getLocationFromName("Mountain");
var reflect2 = Helper.Reflection.GetField<NetBool>(mountain, "railroadAreaBlocked", true);
var netBool2 = reflect2.GetValue();
netBool2.Value = false;
reflect2.SetValue(netBool2);
var reflect3 = Helper.Reflection.GetField<Rectangle>(mountain, "railroadBlockRect", true);
var netBool3 = reflect3.GetValue();
netBool3 = new Rectangle(0, 0, 0, 0);
reflect3.SetValue(netBool3);
}
/// <summary>The method invoked when <see cref="Game1.timeOfDay"/> changes.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
@ -186,6 +322,11 @@ namespace Omegasis.NightOwl
Game1.isRaining = false; // remove rain, otherwise lighting gets screwy
Game1.updateWeatherIcon();
Game1.timeOfDay = 150; //change it from 1:50 am late, to 1:50 am early
foreach(FarmAnimal animal in Game1.getFarm().getAllFarmAnimals())
{
this.oldAnimalHappiness.Add(animal.happiness);
}
}
// collapse player at 6am to save & reset
@ -193,6 +334,26 @@ namespace Omegasis.NightOwl
this.IsUpLate = true;
if (this.IsUpLate && Game1.timeOfDay == 600 && !this.JustCollapsed)
{
if (Game1.player.isRidingHorse())
{
foreach (var character in Game1.player.currentLocation.characters)
{
try
{
if (character is Horse)
{
(character as Horse).dismount();
horse = (character as Horse);
shouldWarpHorse = true;
}
}
catch (Exception err)
{
}
}
}
this.JustCollapsed = true;
this.ShouldResetPlayerAfterCollapseNow = true;
@ -201,10 +362,27 @@ namespace Omegasis.NightOwl
this.PreCollapseStamina = Game1.player.stamina;
this.PreCollapseHealth = Game1.player.health;
this.PreCollapseMoney = Game1.player.money;
this.isInSwimSuit = Game1.player.bathingClothes.Value;
this.isBathing = Game1.player.swimming.Value;
if (Game1.currentMinigame != null)
Game1.currentMinigame = null;
Game1.farmerShouldPassOut = true;
if (Game1.activeClickableMenu != null) Game1.activeClickableMenu.exitThisMenu(true); //Exit menus.
Game1.timeOfDay += 2400; //Recalculate for the sake of technically being up a whole day.
//Reset animal happiness since it drains over night.
for(int i=0; i < oldAnimalHappiness.Count; i++)
{
Game1.getFarm().getAllFarmAnimals()[i].happiness.Value = oldAnimalHappiness[i].Value;
}
Game1.player.startToPassOut();
}
}
catch (Exception ex)
@ -233,5 +411,15 @@ namespace Omegasis.NightOwl
string path = Path.Combine(this.Helper.DirectoryPath, "Error_Logs", "Mod_State.json");
this.Helper.WriteJsonFile(path, state);
}
/// <summary>
/// Try and emulate the old Game1.shouldFarmerPassout logic.
/// </summary>
/// <returns></returns>
public bool shouldFarmerPassout()
{
if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true;
else return false;
}
}
}

View File

@ -76,6 +76,7 @@
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Framework\ModConfig.cs" />
<Compile Include="Framework\NightFishing.cs" />
<Compile Include="NightOwl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
@ -90,15 +91,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,7 +1,7 @@
{
"Name": "Night Owl",
"Author": "Alpha_Omegasis",
"Version": "1.5.0",
"Version": "1.7.1",
"Description": "Lets you stay up all night.",
"UniqueID": "Omegasis.NightOwl",
"EntryDll": "NightOwl.dll",

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -86,15 +86,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -100,15 +100,15 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Input;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Menus;
using StardustCore.Objects.Tools;
using StardustCore.Serialization;
using System;
using System.Collections.Generic;

View File

@ -501,9 +501,6 @@ namespace AdditionalCropsFramework
this.locationsName = "";
return true;
}
return false;
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -96,15 +96,15 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\deploy.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0" targetFramework="net45" />
</packages>

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using DebugSandBoxAndReferences.Framework.Commands;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
using System;
@ -9,7 +10,7 @@ using System.Threading.Tasks;
namespace DebugSandBoxAndReferences
{
public class DebugSandBox
public class DebugSandBox : Mod
{
/*
* Notes:
@ -17,13 +18,13 @@ namespace DebugSandBoxAndReferences
* Game1.MainPlayer will always target the host player.
*
*/
public void Main()
public override void Entry(IModHelper helper)
{
TimeCommands.registerCommands(helper);
}
/*
/// <summary>
/// This is how you will iterate across a new dictionary in stardew valley
/// </summary>
@ -36,5 +37,7 @@ namespace DebugSandBoxAndReferences
}
}
*/
}
}

View File

@ -86,20 +86,21 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Framework\Commands\TimeCommands.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.2.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target>
</Project>

View File

@ -0,0 +1,45 @@
using StardewValley;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DebugSandBoxAndReferences.Framework.Commands
{
class TimeCommands
{
/// <summary>
/// Registers all time modifying commands.
/// </summary>
/// <param name="helper"></param>
public static void registerCommands(StardewModdingAPI.IModHelper helper)
{
helper.ConsoleCommands.Add("debug_world_settime", "Sets the in-game time to be any valid int. Allows for setting time to be early in the morning, i.e. 3 A.M", world_settime);
helper.ConsoleCommands.Add("debug_world_modifytimetick", "Sets the time interval in seconds between 10-minute in-game update ticks.", world_modifyTimeTick);
}
/// <summary>
/// Sets the time of day to the first argument passed into this command. This argument should be an integer value.
/// </summary>
/// <param name="name">The name of the command.</param>
/// <param name="args">The parameters to pass in. Only the first one is read as that should be the integer valuve for time.</param>
public static void world_settime(string name, string[] args)
{
Game1.timeOfDay = Convert.ToInt32(args[0]);
}
/// <summary>
/// Sets the time interval in seconds between 10-minute in-game update ticks.
/// </summary>
/// <param name="name"></param>
/// <param name="args"></param>
public static void world_modifyTimeTick(string name, string[] args)
{
Game1.gameTimeInterval = Convert.ToInt32(args[0]);
}
}
}

Some files were not shown because too many files have changed in this diff Show More