forked from aedenthorn/StardewValleyMods
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
044d440
commit 7c178f1
Showing
26 changed files
with
811 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CustomFixedDialogue</RootNamespace> | ||
<AssemblyName>CustomFixedDialogue</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="0Harmony"> | ||
<HintPath>G:\ga\Stardew Valley\smapi-internal\0Harmony.dll</HintPath> | ||
</Reference> | ||
<Reference Include="StardewModdingAPI"> | ||
<HintPath>G:\ga\Stardew Valley\StardewModdingAPI.exe</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="DialoguePatches.cs" /> | ||
<Compile Include="ModConfig.cs" /> | ||
<Compile Include="ModEntry.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="manifest.json" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.3.1.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.3.1.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.3.1.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.3.1.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using StardewModdingAPI; | ||
using StardewValley; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace CustomFixedDialogue | ||
{ | ||
internal class DialoguePatches | ||
{ | ||
private static IMonitor Monitor; | ||
private static IModHelper Helper; | ||
private static string prefix = "CustomFixedDialogue"; | ||
public static void Initialize(IMonitor monitor, IModHelper helper) | ||
{ | ||
Monitor = monitor; | ||
Helper = helper; | ||
} | ||
public static void LocalizedContentManager_LoadString_Postfix(string path, ref string __result) | ||
{ | ||
try | ||
{ | ||
if (path.StartsWith("Data\\ExtraDialogue")) | ||
{ | ||
__result = $"{prefix}{path.Replace("Data\\ExtraDialogue:", "ExtraDialogue_")}^{__result}"; | ||
Monitor.Log($"edited dialogue: {__result}"); | ||
} | ||
else if (path.StartsWith("Strings\\StringsFromCSFiles:NPC.cs.")) | ||
{ | ||
__result = $"{prefix}{path.Replace("Strings\\StringsFromCSFiles:", "")}^{__result}"; | ||
Monitor.Log($"edited dialogue: {__result}"); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Monitor.Log($"Failed in {nameof(LocalizedContentManager_LoadString_Postfix)}:\n{ex}", LogLevel.Error); | ||
} | ||
} | ||
|
||
|
||
public static void LocalizedContentManager_LoadString_Postfix2(string path, ref string __result) | ||
{ | ||
try | ||
{ | ||
if (path.StartsWith("Data\\ExtraDialogue")) | ||
{ | ||
__result = $"{prefix}{path.Replace("Data\\ExtraDialogue:", "ExtraDialogue_")}^{__result}"; | ||
} | ||
else if (path.StartsWith("Strings\\StringsFromCSFiles:NPC.cs.")) | ||
{ | ||
__result = $"{prefix}{path.Replace("Strings\\StringsFromCSFiles:", "")}^{__result}"; | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Monitor.Log($"Failed in {nameof(LocalizedContentManager_LoadString_Postfix2)}:\n{ex}", LogLevel.Error); | ||
} | ||
} | ||
|
||
public static void Dialogue_parseDialogueString_Prefix(Dialogue __instance, ref string masterString) | ||
{ | ||
try | ||
{ | ||
if (masterString.StartsWith(prefix)) | ||
{ | ||
Dictionary<string, string> dialogueDic = Helper.Content.Load<Dictionary<string, string>>($"Characters/Dialogue/{__instance.speaker.Name}", ContentSource.GameContent); | ||
string key = masterString.Substring(prefix.Length).Split('^')[0]; | ||
if (dialogueDic.ContainsKey(key)) | ||
{ | ||
Monitor.Log($"{__instance.speaker.Name} has dialogue for {key}", LogLevel.Debug); | ||
masterString = dialogueDic[key]; | ||
} | ||
else | ||
{ | ||
masterString = string.Join("^", masterString.Split('^').Skip(1)); | ||
} | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Monitor.Log($"Failed in {nameof(Dialogue_parseDialogueString_Prefix)}:\n{ex}", LogLevel.Error); | ||
} | ||
} | ||
public static void Dialogue_CTOR_Prefix() | ||
{ | ||
Monitor.Log($"WORKING NOW", LogLevel.Error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace CustomFixedDialogue | ||
{ | ||
public class ModConfig | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Harmony; | ||
using StardewModdingAPI; | ||
using StardewValley; | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace CustomFixedDialogue | ||
{ | ||
public class ModEntry : Mod | ||
{ | ||
public static ModEntry context; | ||
|
||
internal static ModConfig Config; | ||
|
||
|
||
/// <summary>The mod entry point, called after the mod is first loaded.</summary> | ||
/// <param name="helper">Provides simplified APIs for writing mods.</param> | ||
public override void Entry(IModHelper helper) | ||
{ | ||
context = this; | ||
Config = Helper.ReadConfig<ModConfig>(); | ||
|
||
DialoguePatches.Initialize(Monitor, helper); | ||
|
||
var harmony = HarmonyInstance.Create(ModManifest.UniqueID); | ||
HarmonyInstance.DEBUG = true; | ||
|
||
/* | ||
harmony.Patch( | ||
original: AccessTools.Constructor(typeof(Dialogue), new Type[] { typeof(string), typeof(NPC) }), | ||
prefix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.Dialogue_CTOR_Prefix)), | ||
postfix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.Dialogue_CTOR_Prefix)) | ||
); | ||
*/ | ||
harmony.Patch( | ||
original: AccessTools.Method(typeof(Dialogue), "parseDialogueString"), | ||
prefix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.Dialogue_parseDialogueString_Prefix)) | ||
); | ||
|
||
harmony.Patch( | ||
original: AccessTools.Method(typeof(LocalizedContentManager), nameof(LocalizedContentManager.LoadString), new Type[] { typeof(string) }), | ||
postfix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.LocalizedContentManager_LoadString_Postfix)) | ||
); | ||
harmony.Patch( | ||
original: AccessTools.Method(typeof(LocalizedContentManager), nameof(LocalizedContentManager.LoadString), new Type[] { typeof(string), typeof(object) }), | ||
postfix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.LocalizedContentManager_LoadString_Postfix2)) | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("CustomFixedDialogue")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("CustomFixedDialogue")] | ||
[assembly: AssemblyCopyright("Copyright © 2020")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("5cfbc975-48dc-40a0-9478-e81f76d7c8c2")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"Name": "Custom Fixed Dialogue", | ||
"Author": "aedenthorn", | ||
"Version": "0.1.1", | ||
"Description": "Customize fixed dialogue for each NPC.", | ||
"UniqueID": "aedenthorn.CustomFixedDialogue", | ||
"EntryDll": "CustomFixedDialogue.dll", | ||
"MinimumApiVersion": "3.4.0", | ||
"ModUpdater": { | ||
"Repository": "StardewValleyMods", | ||
"User": "aedenthorn", | ||
"Directory": "_releases", | ||
"ModFolder": "CustomFixedDialogue" | ||
}, | ||
"UpdateKeys": ["Nexus:6358"], | ||
"Dependencies": [ | ||
{ | ||
"UniqueID": "Platonymous.ModUpdater", | ||
"IsRequired": false | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Pathoschild.Stardew.ModBuildConfig" version="3.1.0" targetFramework="net452" /> | ||
</packages> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.