Skip to content

Commit

Permalink
swim
Browse files Browse the repository at this point in the history
  • Loading branch information
aedenthorn committed Jun 27, 2020
1 parent 044d440 commit 7c178f1
Show file tree
Hide file tree
Showing 26 changed files with 811 additions and 143 deletions.
69 changes: 69 additions & 0 deletions CustomFixedDialogue/CustomFixedDialogue.csproj
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>
89 changes: 89 additions & 0 deletions CustomFixedDialogue/DialoguePatches.cs
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);
}
}
}
6 changes: 6 additions & 0 deletions CustomFixedDialogue/ModConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace CustomFixedDialogue
{
public class ModConfig
{
}
}
50 changes: 50 additions & 0 deletions CustomFixedDialogue/ModEntry.cs
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))
);
}
}
}
36 changes: 36 additions & 0 deletions CustomFixedDialogue/Properties/AssemblyInfo.cs
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")]
22 changes: 22 additions & 0 deletions CustomFixedDialogue/manifest.json
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
},
]
}
4 changes: 4 additions & 0 deletions CustomFixedDialogue/packages.config
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 added MultipleSpouses 1.0.4.zip
Binary file not shown.
1 change: 1 addition & 0 deletions MultipleSpouses/HelperEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public static void GameLoop_OneSecondUpdateTicked(object sender, OneSecondUpdate
{
if (allSpouses.Contains(character.Name))
{

if (Misc.IsInBed(fh, character.GetBoundingBox()))
{
character.farmerPassesThrough = true;
Expand Down
1 change: 1 addition & 0 deletions ProceduralDungeons/ProceduralDungeons.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<EnableHarmony>true</EnableHarmony>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 2 additions & 0 deletions RandomNPC/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ private void UpdateTicking(object sender, UpdateTickingEventArgs e)
foreach (RNPC rnpc in RNPCs)
{
NPC npc = Game1.getCharacterFromName(rnpc.nameID);
if (npc == null)
continue;
GameLocation currentLocation = npc.currentLocation;
int dir = npc.getDirection();
if (currentLocation.isCollidingPosition(npc.nextPosition(dir), Game1.viewport, false, 0, false, npc))
Expand Down
14 changes: 12 additions & 2 deletions StardewValleyMods.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OutdoorButterflyHutch", "Ou
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swim", "Swim\Swim.csproj", "{D06D6A79-D6AA-45E4-9E39-9D150F8A5365}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "_releases", "_releases\_releases.shproj", "{DAE274FA-6F23-42E4-B235-DF130EED1A00}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomFixedDialogue", "CustomFixedDialogue\CustomFixedDialogue.csproj", "{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "_releases", "_releases\_releases.shproj", "{047040E0-3D07-46E5-852B-D1D45CD57BB8}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
_releases\_releases.projitems*{dae274fa-6f23-42e4-b235-df130eed1a00}*SharedItemsImports = 13
_releases\_releases.projitems*{047040e0-3d07-46e5-852b-d1d45cd57bb8}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -186,6 +188,14 @@ Global
{D06D6A79-D6AA-45E4-9E39-9D150F8A5365}.Release|Any CPU.Build.0 = Release|Any CPU
{D06D6A79-D6AA-45E4-9E39-9D150F8A5365}.Release|x86.ActiveCfg = Release|Any CPU
{D06D6A79-D6AA-45E4-9E39-9D150F8A5365}.Release|x86.Build.0 = Release|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Debug|x86.ActiveCfg = Debug|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Debug|x86.Build.0 = Debug|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Release|Any CPU.Build.0 = Release|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Release|x86.ActiveCfg = Release|Any CPU
{5CFBC975-48DC-40A0-9478-E81F76D7C8C2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Binary file renamed _releases/Swim 0.9.1.zip → Swim 0.9.2.zip
Binary file not shown.
Loading

0 comments on commit 7c178f1

Please sign in to comment.