1.3.12, Hooks for Mods

This commit is contained in:
yangzhi 2019-04-27 01:25:41 +08:00
parent b62fdf88e6
commit 0a17a0e6fd
13 changed files with 511 additions and 349 deletions

6
.gitignore vendored
View File

@ -18,6 +18,9 @@ _ReSharper*/
*.[Rr]e[Ss]harper *.[Rr]e[Ss]harper
*.DotSettings.user *.DotSettings.user
# LocalHistory
.localhistory/
# NuGet packages # NuGet packages
*.nupkg *.nupkg
**/packages/* **/packages/*
@ -26,3 +29,6 @@ _ReSharper*/
# sensitive files # sensitive files
appsettings.Development.json appsettings.Development.json
# assemblies
assemblies/

View File

@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mono.Cecil; using Mono.Cecil;
using Mono.Cecil.Cil; using Mono.Cecil.Cil;
@ -171,18 +169,124 @@ namespace DllRewrite
var GetGamePadState = typeInputState.Methods.FirstOrDefault(m => m.Name == "GetGamePadState"); var GetGamePadState = typeInputState.Methods.FirstOrDefault(m => m.Name == "GetGamePadState");
processor.Replace(method.Body.Instructions[1], processor.Create(OpCodes.Callvirt, GetGamePadState)); processor.Replace(method.Body.Instructions[1], processor.Create(OpCodes.Callvirt, GetGamePadState));
} }
public void ApplyCommonHookEntry(TypeDefinition targetType, string methodname, string hookname, bool patchPrefix = true, bool patchPostfix = true, Func<MethodDefinition, bool> methodFilter = null) public void ApplyCommonMidHookEntry(TypeDefinition targetType, Func<MethodDefinition, bool> methodChecker, Func<Instruction, bool> jointPointChecker, int jointPointOffset, string hookname)
{ {
string qualifyName = $"{targetType.FullName}.{methodname}"; byte i, j;
MethodDefinition targetMethod = targetType.Methods.FirstOrDefault(method => methodChecker(method));
string qualifyName = targetType.FullName + "." + targetMethod.Name + "_mid";
MethodDefinition prefixHook = this.StardewValley.MainModule.GetType("StardewValley.ModHooks").Methods.FirstOrDefault(m => m.Name == (hookname + "_Prefix"));
ILProcessor iLProcessor = targetMethod.Body.GetILProcessor();
FieldReference field = this.GetFieldReference("hooks", "StardewValley.Game1", this.StardewValley);
List<Instruction> instructions = new List<Instruction>();
byte returnIndex = 0;
byte parameterIndexBegin = 0;
byte parameterIndexEnd = 0;
byte parameterOffset = targetMethod.IsStatic ? ((byte)0) : ((byte)1);
byte stateIndex = (byte)targetMethod.Body.Variables.Count;
targetMethod.Body.Variables.Add(new VariableDefinition(this.GetTypeReference("System.Boolean")));
if (targetMethod.ReturnType.FullName != "System.Void")
{
returnIndex = (byte)targetMethod.Body.Variables.Count;
targetMethod.Body.Variables.Add(new VariableDefinition(this.GetTypeReference("System.Object")));
}
parameterIndexBegin = (byte)targetMethod.Body.Variables.Count;
for (i = 0; i < targetMethod.Parameters.Count; i = (byte)(i + 1))
{
targetMethod.Body.Variables.Add(new VariableDefinition(this.GetTypeReference("System.Object")));
parameterIndexEnd = (byte)targetMethod.Body.Variables.Count;
}
if (prefixHook != null)
{
Instruction jointPoint = targetMethod.Body.Instructions.FirstOrDefault(ins => jointPointChecker(ins));
for (int x = jointPointOffset; x < 0; x++)
{
jointPoint = jointPoint.Previous;
}
for (int x = 0; x < jointPointOffset; x++)
{
jointPoint = jointPoint.Next;
}
i = parameterOffset;
for (j = parameterIndexBegin; i < (targetMethod.Parameters.Count + parameterOffset); j = (byte)(j + 1))
{
instructions.Add(this._createLdargsInstruction(iLProcessor, i));
if (targetMethod.Parameters[i - parameterOffset].ParameterType.IsValueType)
{
instructions.Add(iLProcessor.Create(OpCodes.Box, targetMethod.Parameters[i - parameterOffset].ParameterType));
}
instructions.Add(this._createStlocInstruction(iLProcessor, j));
i = (byte)(i + 1);
}
instructions.Add(iLProcessor.Create(OpCodes.Ldsfld, field));
instructions.Add(iLProcessor.Create(OpCodes.Ldstr, qualifyName));
if (!targetMethod.IsStatic)
{
instructions.Add(iLProcessor.Create(OpCodes.Ldarg_0));
if (targetType.IsValueType)
{
instructions.Add(iLProcessor.Create(OpCodes.Box, targetType));
}
}
i = parameterOffset;
for (j = parameterIndexBegin; i < (targetMethod.Parameters.Count + parameterOffset); j = (byte)(j + 1))
{
instructions.Add(iLProcessor.Create(OpCodes.Ldloca_S, j));
i = (byte)(i + 1);
}
while (i < (prefixHook.Parameters.Count - 2))
{
instructions.Add(iLProcessor.Create(OpCodes.Ldloca_S, (byte)0));
i = (byte)(i + 1);
}
instructions.Add(iLProcessor.Create(OpCodes.Ldloca_S, returnIndex));
instructions.Add(iLProcessor.Create(OpCodes.Callvirt, prefixHook));
instructions.Add(this._createStlocInstruction(iLProcessor, stateIndex));
i = parameterOffset;
for (j = parameterIndexBegin; i < (targetMethod.Parameters.Count + parameterOffset); j = (byte)(j + 1))
{
instructions.Add(this._createLdlocInstruction(iLProcessor, j));
if (targetMethod.Parameters[i - parameterOffset].ParameterType.IsValueType)
{
instructions.Add(iLProcessor.Create(OpCodes.Unbox_Any, targetMethod.Parameters[i - parameterOffset].ParameterType));
}
else
{
instructions.Add(iLProcessor.Create(OpCodes.Castclass, targetMethod.Parameters[i - parameterOffset].ParameterType));
}
instructions.Add(iLProcessor.Create(OpCodes.Starg_S, i));
i = (byte)(i + 1);
}
instructions.Add(this._createLdlocInstruction(iLProcessor, stateIndex));
instructions.Add(iLProcessor.Create(OpCodes.Brtrue, jointPoint));
if (targetMethod.ReturnType.FullName != "System.Void")
{
instructions.Add(this._createLdlocInstruction(iLProcessor, returnIndex));
if (targetMethod.ReturnType.IsValueType)
{
instructions.Add(iLProcessor.Create(OpCodes.Unbox_Any, targetMethod.ReturnType));
}
else
{
instructions.Add(iLProcessor.Create(OpCodes.Castclass, targetMethod.ReturnType));
}
}
instructions.Add(iLProcessor.Create(OpCodes.Ret));
this.InsertInstructions(iLProcessor, jointPoint, instructions);
}
}
public void ApplyCommonHookEntry(TypeDefinition targetType, string methodname, string hookname, bool patchPrefix = true, bool patchPostfix = true, Func<MethodDefinition, bool> methodFilter = null, string qualifyNameSuffix = "")
{
string qualifyName = $"{targetType.FullName}.{methodname}{qualifyNameSuffix}";
TypeDefinition typeModHooksObject = this.StardewValley.MainModule.GetType("StardewValley.ModHooks"); TypeDefinition typeModHooksObject = this.StardewValley.MainModule.GetType("StardewValley.ModHooks");
var targetMethod = targetType.Methods.FirstOrDefault(method => (!method.IsConstructor && method.HasBody && method.Name == methodname && (methodFilter == null || methodFilter(method)))); var targetMethod = targetType.Methods.FirstOrDefault(method => (method.HasBody && method.Name == methodname && (methodFilter == null || methodFilter(method))));
var prefixHook = typeModHooksObject.Methods.FirstOrDefault(m => m.Name == hookname + "_Prefix"); var prefixHook = typeModHooksObject.Methods.FirstOrDefault(m => m.Name == hookname + "_Prefix");
var postfixHook = typeModHooksObject.Methods.FirstOrDefault(m => m.Name == hookname + "_Postfix"); var postfixHook = typeModHooksObject.Methods.FirstOrDefault(m => m.Name == hookname + "_Postfix");
var processor = targetMethod.Body.GetILProcessor(); var processor = targetMethod.Body.GetILProcessor();
FieldReference hooksField = this.GetFieldReference("hooks", "StardewValley.Game1", this.StardewValley); FieldReference hooksField = this.GetFieldReference("hooks", "StardewValley.Game1", this.StardewValley);
Instruction jointPoint; Instruction jointPoint;
List<Instruction> instructions; List<Instruction> instructions;
byte i, j; byte i, j, k;
// state // state
byte returnIndex = 0; byte returnIndex = 0;
byte parameterIndexBegin = 0, parameterIndexEnd = 0; byte parameterIndexBegin = 0, parameterIndexEnd = 0;
@ -205,7 +309,8 @@ namespace DllRewrite
{ {
instructions = new List<Instruction>(); instructions = new List<Instruction>();
jointPoint = targetMethod.Body.Instructions[0]; jointPoint = targetMethod.Body.Instructions[0];
for (i = parameterOffset, j = parameterIndexBegin; i < targetMethod.Parameters.Count + parameterOffset; i++, j++) k = (byte)(targetMethod.Parameters.Count + parameterOffset > prefixHook.Parameters.Count - 2 ? prefixHook.Parameters.Count - 2 - parameterOffset : targetMethod.Parameters.Count + parameterOffset);
for (i = parameterOffset, j = parameterIndexBegin; i < k; i++, j++)
{ {
instructions.Add(this._createLdargsInstruction(processor, i)); instructions.Add(this._createLdargsInstruction(processor, i));
if(targetMethod.Parameters[i - parameterOffset].ParameterType.IsValueType) if(targetMethod.Parameters[i - parameterOffset].ParameterType.IsValueType)
@ -222,7 +327,9 @@ namespace DllRewrite
if (targetType.IsValueType) if (targetType.IsValueType)
instructions.Add(processor.Create(OpCodes.Box, targetType)); instructions.Add(processor.Create(OpCodes.Box, targetType));
} }
for (i = parameterOffset, j = parameterIndexBegin; i < targetMethod.Parameters.Count + parameterOffset; i++, j++)
k = (byte)(targetMethod.Parameters.Count + parameterOffset > prefixHook.Parameters.Count - 2 ? prefixHook.Parameters.Count - 2 - parameterOffset : targetMethod.Parameters.Count + parameterOffset);
for (i = parameterOffset, j = parameterIndexBegin; i < k; i++, j++)
{ {
instructions.Add(processor.Create(OpCodes.Ldloca_S, j)); instructions.Add(processor.Create(OpCodes.Ldloca_S, j));
} }
@ -267,7 +374,8 @@ namespace DllRewrite
instructions.Add(processor.Create(OpCodes.Box, targetMethod.ReturnType)); instructions.Add(processor.Create(OpCodes.Box, targetMethod.ReturnType));
instructions.Add(this._createStlocInstruction(processor, returnIndex)); instructions.Add(this._createStlocInstruction(processor, returnIndex));
} }
for (i = parameterOffset, j = parameterIndexBegin; i < targetMethod.Parameters.Count + parameterOffset; i++, j++) k = (byte)(targetMethod.Parameters.Count + parameterOffset > postfixHook.Parameters.Count - 3 ? prefixHook.Parameters.Count - 3 - parameterOffset : targetMethod.Parameters.Count + parameterOffset);
for (i = parameterOffset, j = parameterIndexBegin; i < k; i++, j++)
{ {
instructions.Add(this._createLdargsInstruction(processor, i)); instructions.Add(this._createLdargsInstruction(processor, i));
if (targetMethod.Parameters[i - parameterOffset].ParameterType.IsValueType) if (targetMethod.Parameters[i - parameterOffset].ParameterType.IsValueType)
@ -284,7 +392,8 @@ namespace DllRewrite
if (targetType.IsValueType) if (targetType.IsValueType)
instructions.Add(processor.Create(OpCodes.Box, targetType)); instructions.Add(processor.Create(OpCodes.Box, targetType));
} }
for (i = parameterOffset, j = parameterIndexBegin; i < targetMethod.Parameters.Count + parameterOffset; i++, j++) k = (byte)(targetMethod.Parameters.Count + parameterOffset > postfixHook.Parameters.Count - 3 ? prefixHook.Parameters.Count - 3 - parameterOffset : targetMethod.Parameters.Count + parameterOffset);
for (i = parameterOffset, j = parameterIndexBegin; i < k; i++, j++)
{ {
instructions.Add(processor.Create(OpCodes.Ldloca_S, j)); instructions.Add(processor.Create(OpCodes.Ldloca_S, j));
} }
@ -554,7 +663,7 @@ namespace DllRewrite
{ {
this.ApplyGamePatch(); this.ApplyGamePatch();
this.InsertModHook("OnCommonHook_Prefix", new TypeReference[] { this.InsertModHook("OnCommonHook_Prefix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
this.GetTypeReference("System.Object"), this.GetTypeReference("System.Object"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -562,12 +671,12 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "__instance", "hookName", "__instance",
"param1", "param2", "param3", "param1", "param2", "param3",
"param4", "__result"}, "param4", "__result"},
this.GetTypeReference("System.Boolean")); this.GetTypeReference("System.Boolean"));
this.InsertModHook("OnCommonStaticHook_Prefix", new TypeReference[] { this.InsertModHook("OnCommonStaticHook_Prefix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -575,12 +684,12 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "param1", "hookName", "param1",
"param2", "param3", "param4", "param2", "param3", "param4",
"param5", "__result"}, "param5", "__result"},
this.GetTypeReference("System.Boolean")); this.GetTypeReference("System.Boolean"));
this.InsertModHook("OnCommonHook_Postfix", new TypeReference[] { this.InsertModHook("OnCommonHook_Postfix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
this.GetTypeReference("System.Object"), this.GetTypeReference("System.Object"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -589,12 +698,12 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Boolean")), new ByReferenceType(this.GetTypeReference("System.Boolean")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "__instance", "hookName", "__instance",
"param1", "param2", "param3", "param1", "param2", "param3",
"param4", "__state", "__result"}, "param4", "__state", "__result"},
this.GetTypeReference("System.Void")); this.GetTypeReference("System.Void"));
this.InsertModHook("OnCommonStaticHook_Postfix", new TypeReference[] { this.InsertModHook("OnCommonStaticHook_Postfix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -603,13 +712,13 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Boolean")), new ByReferenceType(this.GetTypeReference("System.Boolean")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "param1", "hookName", "param1",
"param2", "param3", "param4", "param2", "param3", "param4",
"param5", "__state", "__result"}, "param5", "__state", "__result"},
this.GetTypeReference("System.Void")); this.GetTypeReference("System.Void"));
this.InsertModHook("OnCommonHook10_Prefix", new TypeReference[] { this.InsertModHook("OnCommonHook10_Prefix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
this.GetTypeReference("System.Object"), this.GetTypeReference("System.Object"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -622,14 +731,14 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "__instance", "hookName", "__instance",
"param1", "param2", "param3", "param1", "param2", "param3",
"param4", "param5", "param6", "param4", "param5", "param6",
"param7", "param8", "param9", "param7", "param8", "param9",
"__result"}, "__result"},
this.GetTypeReference("System.Boolean")); this.GetTypeReference("System.Boolean"));
this.InsertModHook("OnCommonStaticHook10_Prefix", new TypeReference[] { this.InsertModHook("OnCommonStaticHook10_Prefix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -642,14 +751,14 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "param1", "hookName", "param1",
"param2", "param3", "param4", "param2", "param3", "param4",
"param5", "param6", "param7", "param5", "param6", "param7",
"param8", "param9", "param10", "param8", "param9", "param10",
"__result"}, "__result"},
this.GetTypeReference("System.Boolean")); this.GetTypeReference("System.Boolean"));
this.InsertModHook("OnCommonHook10_Postfix", new TypeReference[] { this.InsertModHook("OnCommonHook10_Postfix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
this.GetTypeReference("System.Object"), this.GetTypeReference("System.Object"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -663,14 +772,14 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Boolean")), new ByReferenceType(this.GetTypeReference("System.Boolean")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "__instance", "hookName", "__instance",
"param1", "param2", "param3", "param1", "param2", "param3",
"param4", "param5", "param6", "param4", "param5", "param6",
"param7", "param8", "param9", "param7", "param8", "param9",
"__state", "__result"}, "__state", "__result"},
this.GetTypeReference("System.Void")); this.GetTypeReference("System.Void"));
this.InsertModHook("OnCommonStaticHook10_Postfix", new TypeReference[] { this.InsertModHook("OnCommonStaticHook10_Postfix", new[] {
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
@ -684,7 +793,7 @@ namespace DllRewrite
new ByReferenceType(this.GetTypeReference("System.Object")), new ByReferenceType(this.GetTypeReference("System.Object")),
new ByReferenceType(this.GetTypeReference("System.Boolean")), new ByReferenceType(this.GetTypeReference("System.Boolean")),
new ByReferenceType(this.GetTypeReference("System.Object"))}, new ByReferenceType(this.GetTypeReference("System.Object"))},
new string[] { new[] {
"hookName", "param1", "hookName", "param1",
"param2", "param3", "param4", "param2", "param3", "param4",
"param5", "param6", "param7", "param5", "param6", "param7",
@ -696,198 +805,117 @@ namespace DllRewrite
this.ApplyCommonHookEntry(typeGame1, "Update", "OnCommonHook"); this.ApplyCommonHookEntry(typeGame1, "Update", "OnCommonHook");
this.ApplyCommonHookEntry(typeGame1, "_draw", "OnCommonHook"); this.ApplyCommonHookEntry(typeGame1, "_draw", "OnCommonHook");
this.ApplyCommonHookEntry(typeGame1, "getSourceRectForStandardTileSheet", "OnCommonStaticHook"); this.ApplyCommonHookEntry(typeGame1, "getSourceRectForStandardTileSheet", "OnCommonStaticHook");
this.ApplyCommonHookEntry(typeGame1, "tryToCheckAt", "OnCommonStaticHook"); this.ApplyCommonHookEntry(typeGame1, "tryToCheckAt", "OnCommonStaticHook", false);
this.ApplyCommonHookEntry(typeGame1, "getLocationRequest", "OnCommonStaticHook"); this.ApplyCommonHookEntry(typeGame1, "getLocationRequest", "OnCommonStaticHook", true, false);
this.ApplyCommonHookEntry(typeGame1, "getLocationRequest", "OnCommonStaticHook", true, false);
this.ApplyCommonHookEntry(typeGame1, "loadForNewGame", "OnCommonStaticHook");
this.ApplyCommonHookEntry(typeGame1, "warpFarmer", "OnCommonStaticHook10", true, false, method => method.Parameters.Count == 6);
this.ApplyCommonHookEntry(typeGame1, ".ctor", "OnCommonHook", false);
this.ApplyCommonHookEntry(typeGame1, "LoadContent", "OnCommonHook", false);
TypeDefinition targetType = null;
foreach (TypeDefinition definition21 in this.StardewValley.MainModule.GetTypes())
{
if (definition21.FullName == "StardewValley.Game1/<>c")
{
targetType = definition21;
}
}
this.ApplyCommonMidHookEntry(targetType, method => method.FullName.Contains("showEndOfNightStuff"), ins => (ins.OpCode == OpCodes.Ldstr) && (((string)ins.Operand) == "newRecord"), -2, "OnCommonHook");
// On Object hooks // On Object hooks
TypeDefinition typeObject = this.StardewValley.MainModule.GetType("StardewValley.Object"); TypeDefinition typeObject = this.StardewValley.MainModule.GetType("StardewValley.Object");
this.ApplyCommonHookEntry(typeObject, "canBePlacedHere", "OnCommonHook", true, false); this.ApplyCommonHookEntry(typeObject, "canBePlacedHere", "OnCommonHook", true, false);
this.ApplyCommonHookEntry(typeObject, "checkForAction", "OnCommonHook", true, false); this.ApplyCommonHookEntry(typeObject, "checkForAction", "OnCommonHook", true, false);
this.ApplyCommonHookEntry(typeObject, "isIndexOkForBasicShippedCategory", "OnCommonStaticHook"); this.ApplyCommonHookEntry(typeObject, "isIndexOkForBasicShippedCategory", "OnCommonStaticHook");
this.ApplyCommonHookEntry(typeObject, "drawWhenHeld", "OnCommonHook", true, false);
this.ApplyCommonHookEntry(typeObject, "drawInMenuWithColour", "OnCommonHook10");
this.ApplyCommonHookEntry(typeObject, "draw", "OnCommonHook", true, false, method => method.Parameters.Count == 4);
this.ApplyCommonHookEntry(typeObject, "draw", "OnCommonHook10", true, false, method => method.Parameters.Count == 5);
this.ApplyCommonHookEntry(typeObject, "getDescription", "OnCommonHook", true, false);
// On ReadyCheckDialog hooks // On ReadyCheckDialog hooks
TypeDefinition typeReadyCheckDialog = this.StardewValley.MainModule.GetType("StardewValley.Menus.ReadyCheckDialog"); TypeDefinition typeReadyCheckDialog = this.StardewValley.MainModule.GetType("StardewValley.Menus.ReadyCheckDialog");
this.ApplyCommonHookEntry(typeReadyCheckDialog, "update", "OnCommonHook"); this.ApplyCommonHookEntry(typeReadyCheckDialog, "update", "OnCommonHook");
// On IClickableMenu hooks
TypeDefinition typeIClickableMenu = this.StardewValley.MainModule.GetType("StardewValley.Menus.IClickableMenu");
this.ApplyCommonHookEntry(typeIClickableMenu, "drawToolTip", "OnCommonStaticHook10", false);
// On Dialogue hooks
TypeDefinition typeDialogue = this.StardewValley.MainModule.GetType("StardewValley.Dialogue");
this.ApplyCommonHookEntry(typeDialogue, ".ctor", "OnCommonHook", true, false, method => method.Parameters.Count == 2);
// On Building hooks // On Building hooks
TypeDefinition typeBuilding = this.StardewValley.MainModule.GetType("StardewValley.Buildings.Building"); TypeDefinition typeBuilding = this.StardewValley.MainModule.GetType("StardewValley.Buildings.Building");
this.ApplyCommonHookEntry(typeBuilding, "load", "OnCommonHook"); this.ApplyCommonHookEntry(typeBuilding, "load", "OnCommonHook");
// On GameLocation hooks // On GameLocation hooks
TypeDefinition typeGameLocation = this.StardewValley.MainModule.GetType("StardewValley.GameLocation"); TypeDefinition typeGameLocation = this.StardewValley.MainModule.GetType("StardewValley.GameLocation");
this.ApplyCommonHookEntry(typeGameLocation, "performTouchAction", "OnCommonHook"); this.ApplyCommonHookEntry(typeGameLocation, "performTouchAction", "OnCommonHook", true, false);
this.ApplyCommonHookEntry(typeGameLocation, "isActionableTile", "OnCommonHook"); this.ApplyCommonHookEntry(typeGameLocation, "isActionableTile", "OnCommonHook", false);
this.ApplyCommonHookEntry(typeGameLocation, "tryToAddCritters", "OnCommonHook"); this.ApplyCommonHookEntry(typeGameLocation, "tryToAddCritters", "OnCommonHook", true, false);
this.ApplyCommonHookEntry(typeGameLocation, "getSourceRectForObject", "OnCommonStaticHook"); this.ApplyCommonHookEntry(typeGameLocation, "getSourceRectForObject", "OnCommonStaticHook");
this.ApplyCommonHookEntry(typeGameLocation, "answerDialogue", "OnCommonHook"); this.ApplyCommonHookEntry(typeGameLocation, "answerDialogue", "OnCommonHook", true, false);
this.ApplyCommonHookEntry(typeGameLocation, "Equals", "OnCommonHook", true, false, (method)=> method.Parameters[0].ParameterType == this.GetTypeReference("StardewValley.GameLocation", this.StardewValley)); this.ApplyCommonHookEntry(typeGameLocation, "Equals", "OnCommonHook", true, false, method => method.Parameters[0].ParameterType == this.GetTypeReference("StardewValley.GameLocation", this.StardewValley));
this.ApplyCommonHookEntry(typeGameLocation, "performAction", "OnCommonHook", true, false);
// On Objects.TV hooks // On Objects.TV hooks
TypeDefinition typeObjectsTV = this.StardewValley.MainModule.GetType("StardewValley.Objects.TV"); TypeDefinition typeObjectsTV = this.StardewValley.MainModule.GetType("StardewValley.Objects.TV");
this.ApplyCommonHookEntry(typeObjectsTV, "checkForAction", "OnCommonHook"); this.ApplyCommonHookEntry(typeObjectsTV, "checkForAction", "OnCommonHook");
// On Furniture hooks
TypeDefinition typeFurniture = this.StardewValley.MainModule.GetType("StardewValley.Objects.Furniture");
this.ApplyCommonHookEntry(typeFurniture, "draw", "OnCommonHook", true, false);
//this.InsertModHook("OnGame1_Update_Prefix", new TypeReference[] { // On ColoredObject hooks
// this.GetTypeReference("StardewValley.Game1", this.StardewValley), TypeDefinition typeColoredObject = this.StardewValley.MainModule.GetType("StardewValley.Objects.ColoredObject");
// this.GetTypeReference("Microsoft.Xna.Framework.GameTime", this.MonoGame_Framework)}, this.ApplyCommonHookEntry(typeColoredObject, "drawInMenu", "OnCommonHook10", false);
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeGame1, "Update", "OnGame1_Update_Prefix", true);
//this.InsertModHook("OnGame1_Update_Postfix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Game1", this.StardewValley),
// this.GetTypeReference("Microsoft.Xna.Framework.GameTime", this.MonoGame_Framework)},
// this.GetTypeReference("System.Void"));
//this.ApplyHookEntry(typeGame1, "Update", "OnGame1_Update_Postfix", false);
this.InsertModHook("OnGame1_CreateContentManager_Prefix", new TypeReference[] { // On HoeDirt hooks
TypeDefinition typeHoeDirt = this.StardewValley.MainModule.GetType("StardewValley.TerrainFeatures.HoeDirt");
this.ApplyCommonHookEntry(typeHoeDirt, "dayUpdate", "OnCommonHook", true, false);
// On Utility hooks
TypeDefinition typeUtility = this.StardewValley.MainModule.GetType("StardewValley.Utility");
this.ApplyCommonHookEntry(typeUtility, "pickFarmEvent", "OnCommonStaticHook", false);
// On Farmer hooks
TypeDefinition typeFarmer = this.StardewValley.MainModule.GetType("StardewValley.Farmer");
this.ApplyCommonHookEntry(typeFarmer, "doneEating", "OnCommonHook", false);
// On MeleeWeapon hooks
TypeDefinition typeMeleeWeapon = this.StardewValley.MainModule.GetType("StardewValley.Tools.MeleeWeapon");
this.ApplyCommonHookEntry(typeMeleeWeapon, "drawDuringUse", "OnCommonStaticHook10", true, false, method => method.IsStatic);
// On Multiplayer hooks
TypeDefinition typeMultiplayer = this.StardewValley.MainModule.GetType("StardewValley.Multiplayer");
this.ApplyCommonHookEntry(typeMultiplayer, "processIncomingMessage", "OnCommonHook", true, false);
// On GameServer hooks
TypeDefinition typeGameServer = this.StardewValley.MainModule.GetType("StardewValley.Network.GameServer");
this.ApplyCommonHookEntry(typeGameServer, "sendServerIntroduction", "OnCommonHook", false);
// On NPC hooks
TypeDefinition typeNPC = this.StardewValley.MainModule.GetType("StardewValley.NPC");
this.ApplyCommonHookEntry(typeNPC, "receiveGift", "OnCommonHook10", false);
// On GameMenu hooks
TypeDefinition definition19 = this.StardewValley.MainModule.GetType("StardewValley.Menus.GameMenu");
this.ApplyCommonHookEntry(definition19, "getTabNumberFromName", "OnCommonHook", false);
// On FarmHouse hooks
TypeDefinition definition20 = this.StardewValley.MainModule.GetType("StardewValley.Locations.FarmHouse");
this.ApplyCommonHookEntry(definition20, "loadSpouseRoom", "OnCommonHook", true, false);
this.InsertModHook("OnGame1_CreateContentManager_Prefix", new[] {
this.GetTypeReference("StardewValley.Game1", this.StardewValley), this.GetTypeReference("StardewValley.Game1", this.StardewValley),
this.GetTypeReference("System.IServiceProvider"), this.GetTypeReference("System.IServiceProvider"),
this.GetTypeReference("System.String"), this.GetTypeReference("System.String"),
new ByReferenceType(this.GetTypeReference("StardewValley.LocalizedContentManager", this.StardewValley)) }, new ByReferenceType(this.GetTypeReference("StardewValley.LocalizedContentManager", this.StardewValley)) },
new string[] { "game1", "serviceProvider", "rootDirectory", "__result"}, new[] { "game1", "serviceProvider", "rootDirectory", "__result"},
this.GetTypeReference("System.Boolean")); this.GetTypeReference("System.Boolean"));
this.ApplyHookEntry(typeGame1, "CreateContentManager", "OnGame1_CreateContentManager_Prefix", true); this.ApplyHookEntry(typeGame1, "CreateContentManager", "OnGame1_CreateContentManager_Prefix", true);
//this.InsertModHook("OnGame1__draw_Prefix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Game1", this.StardewValley),
// this.GetTypeReference("Microsoft.Xna.Framework.GameTime", this.MonoGame_Framework),
// this.GetTypeReference("Microsoft.Xna.Framework.Graphics.RenderTarget2D", this.MonoGame_Framework)},
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeGame1, "_draw", "OnGame1__draw_Prefix", true);
//this.InsertModHook("OnGame1_getSourceRectForStandardTileSheet_Prefix", new TypeReference[] {
// this.GetTypeReference("Microsoft.Xna.Framework.Graphics.Texture2D", this.MonoGame_Framework),
// this.GetTypeReference("System.Int32"),
// this.GetTypeReference("System.Int32"),
// this.GetTypeReference("System.Int32"),
// new ByReferenceType(this.GetTypeReference("Microsoft.Xna.Framework.Rectangle", this.MonoGame_Framework)) },
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeGame1, "getSourceRectForStandardTileSheet", "OnGame1_getSourceRectForStandardTileSheet_Prefix", true);
//this.InsertModHook("OnGame1_getSourceRectForStandardTileSheet_Postfix", new TypeReference[] {
// this.GetTypeReference("Microsoft.Xna.Framework.Graphics.Texture2D", this.MonoGame_Framework),
// this.GetTypeReference("System.Int32"),
// this.GetTypeReference("System.Int32"),
// this.GetTypeReference("System.Int32"),
// new ByReferenceType(this.GetTypeReference("Microsoft.Xna.Framework.Rectangle", this.MonoGame_Framework)) },
// this.GetTypeReference("System.Void"));
//this.ApplyHookEntry(typeGame1, "getSourceRectForStandardTileSheet", "OnGame1_getSourceRectForStandardTileSheet_Postfix", false);
//this.InsertModHook("OnGame1_tryToCheckAt_Postfix", new TypeReference[] {
// this.GetTypeReference("Microsoft.Xna.Framework.Vector2", this.MonoGame_Framework),
// this.GetTypeReference("StardewValley.Farmer", this.StardewValley),
// new ByReferenceType(this.GetTypeReference("System.Boolean")) },
// this.GetTypeReference("System.Void"));
//this.ApplyHookEntry(typeGame1, "tryToCheckAt", "OnGame1_tryToCheckAt_Postfix", false);
//this.InsertModHook("OnGame1_getLocationRequest_Prefix", new TypeReference[] {
// this.GetTypeReference("System.String"),
// this.GetTypeReference("System.Boolean"),
// new ByReferenceType(this.GetTypeReference("StardewValley.LocationRequest", this.StardewValley)) },
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeGame1, "getLocationRequest", "OnGame1_getLocationRequest_Prefix", true);
//// On Object hooks
//this.InsertModHook("OnObject_canBePlacedHere_Prefix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Object", this.StardewValley),
// this.GetTypeReference("StardewValley.GameLocation", this.StardewValley),
// this.GetTypeReference("Microsoft.Xna.Framework.Vector2", this.MonoGame_Framework),
// new ByReferenceType(this.GetTypeReference("System.Boolean")) },
// this.GetTypeReference("System.Boolean"));
//TypeDefinition typeObject = this.StardewValley.MainModule.GetType("StardewValley.Object");
//this.ApplyHookEntry(typeObject, "canBePlacedHere", "OnObject_canBePlacedHere_Prefix", true);
//this.InsertModHook("OnObject_checkForAction_Prefix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Object", this.StardewValley),
// this.GetTypeReference("StardewValley.Farmer", this.StardewValley),
// this.GetTypeReference("System.Boolean"),
// new ByReferenceType(this.GetTypeReference("System.Boolean"))},
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeObject, "checkForAction", "OnObject_checkForAction_Prefix", true);
//this.InsertModHook("OnObject_isIndexOkForBasicShippedCategory_Postfix", new TypeReference[] {
// this.GetTypeReference("System.Int32"),
// new ByReferenceType(this.GetTypeReference("System.Boolean")) },
// this.GetTypeReference("System.Void"));
//this.ApplyHookEntry(typeObject, "isIndexOkForBasicShippedCategory", "OnObject_isIndexOkForBasicShippedCategory_Postfix", false);
//// On ReadyCheckDialog hooks
//this.InsertModHook("OnReadyCheckDialog_update_Postfix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Menus.ReadyCheckDialog", this.StardewValley),
// this.GetTypeReference("Microsoft.Xna.Framework.GameTime", this.MonoGame_Framework)},
// this.GetTypeReference("System.Void"));
//TypeDefinition typeReadyCheckDialog = this.StardewValley.MainModule.GetType("StardewValley.Menus.ReadyCheckDialog");
//this.ApplyHookEntry(typeReadyCheckDialog, "update", "OnReadyCheckDialog_update_Postfix", false);
//// On Building hooks
//this.InsertModHook("OnBuilding_load_Prefix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Buildings.Building", this.StardewValley)},
// this.GetTypeReference("System.Boolean"));
//TypeDefinition typeBuilding = this.StardewValley.MainModule.GetType("StardewValley.Buildings.Building");
//this.ApplyHookEntry(typeBuilding, "load", "OnBuilding_load_Prefix", true);
//// On GameLocation hooks
//this.InsertModHook("OnGameLocation_performTouchAction_Postfix", new TypeReference[] {
// this.GetTypeReference("StardewValley.GameLocation", this.StardewValley),
// this.GetTypeReference("System.String"),
// this.GetTypeReference("Microsoft.Xna.Framework.Vector2", this.MonoGame_Framework)},
// this.GetTypeReference("System.Void"));
//TypeDefinition typeGameLocation = this.StardewValley.MainModule.GetType("StardewValley.GameLocation");
//this.ApplyHookEntry(typeGameLocation, "performTouchAction", "OnGameLocation_performTouchAction_Postfix", false);
//this.InsertModHook("OnGameLocation_isActionableTile_Postfix", new TypeReference[] {
// this.GetTypeReference("StardewValley.GameLocation", this.StardewValley),
// this.GetTypeReference("System.Int32"),
// this.GetTypeReference("System.Int32"),
// this.GetTypeReference("StardewValley.Farmer", this.StardewValley),
// new ByReferenceType(this.GetTypeReference("System.Boolean"))},
// this.GetTypeReference("System.Void"));
//this.ApplyHookEntry(typeGameLocation, "isActionableTile", "OnGameLocation_isActionableTile_Postfix", false);
//this.InsertModHook("OnGameLocation_tryToAddCritters_Prefix", new TypeReference[] {
// this.GetTypeReference("StardewValley.GameLocation", this.StardewValley),
// this.GetTypeReference("System.Boolean")},
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeGameLocation, "tryToAddCritters", "OnGameLocation_tryToAddCritters_Prefix", true);
//this.InsertModHook("OnGameLocation_getSourceRectForObject_Prefix", new TypeReference[] {
// this.GetTypeReference("System.Int32"),
// new ByReferenceType(this.GetTypeReference("Microsoft.Xna.Framework.Rectangle", this.MonoGame_Framework)) },
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeGameLocation, "getSourceRectForObject", "OnGameLocation_getSourceRectForObject_Prefix", true);
//this.InsertModHook("OnGameLocation_getSourceRectForObject_Postfix", new TypeReference[] {
// this.GetTypeReference("System.Int32"),
// new ByReferenceType(this.GetTypeReference("Microsoft.Xna.Framework.Rectangle", this.MonoGame_Framework)) },
// this.GetTypeReference("System.Void"));
//this.ApplyHookEntry(typeGameLocation, "getSourceRectForObject", "OnGameLocation_getSourceRectForObject_Postfix", false);
//this.InsertModHook("OnGameLocation_answerDialogue_Prefix", new TypeReference[] {
// this.GetTypeReference("StardewValley.GameLocation", this.StardewValley),
// this.GetTypeReference("StardewValley.Response", this.StardewValley),
// new ByReferenceType(this.GetTypeReference("System.Boolean"))},
// this.GetTypeReference("System.Boolean"));
//this.ApplyHookEntry(typeGameLocation, "answerDialogue", "OnGameLocation_answerDialogue_Prefix", true);
//// On Objects.TV hooks
//this.InsertModHook("OnObjectsTV_checkForAction_Prefix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Objects.TV", this.StardewValley),
// this.GetTypeReference("StardewValley.Farmer", this.StardewValley),
// this.GetTypeReference("System.Boolean"),
// new ByReferenceType(this.GetTypeReference("System.Boolean"))},
// this.GetTypeReference("System.Boolean"));
//TypeDefinition typeObjectsTV = this.StardewValley.MainModule.GetType("StardewValley.Objects.TV");
//this.ApplyHookEntry(typeObjectsTV, "checkForAction", "OnObjectsTV_checkForAction_Prefix", true);
//this.InsertModHook("OnObjectsTV_checkForAction_Postfix", new TypeReference[] {
// this.GetTypeReference("StardewValley.Objects.TV", this.StardewValley),
// this.GetTypeReference("StardewValley.Farmer", this.StardewValley),
// this.GetTypeReference("System.Boolean"),
// new ByReferenceType(this.GetTypeReference("System.Boolean"))},
// this.GetTypeReference("System.Void"));
//this.ApplyHookEntry(typeObjectsTV, "checkForAction", "OnObjectsTV_checkForAction_Postfix", false);
return this.StardewValley; return this.StardewValley;
} }
} }

View File

@ -434,65 +434,93 @@
<Compile Include="SMAPI\Context.cs" /> <Compile Include="SMAPI\Context.cs" />
<Compile Include="SMAPI\Enums\LoadStage.cs" /> <Compile Include="SMAPI\Enums\LoadStage.cs" />
<Compile Include="SMAPI\Enums\SkillType.cs" /> <Compile Include="SMAPI\Enums\SkillType.cs" />
<Compile Include="SMAPI\Events\BuildingListChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\GraphicsEvents.cs" />
<Compile Include="SMAPI\Events\ButtonPressedEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\IDisplayEvents.cs" />
<Compile Include="SMAPI\Events\ButtonReleasedEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\RenderedActiveMenuEventArgs.cs" />
<Compile Include="SMAPI\Events\ChangeType.cs" /> <Compile Include="SMAPI\Events\Display\RenderedEventArgs.cs" />
<Compile Include="SMAPI\Events\CursorMovedEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\RenderedHudEventArgs.cs" />
<Compile Include="SMAPI\Events\DayEndingEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\RenderedWorldEventArgs.cs" />
<Compile Include="SMAPI\Events\DayStartedEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\RenderingActiveMenuEventArgs.cs" />
<Compile Include="SMAPI\Events\DebrisListChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\RenderingEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLaunchedEventArgs.cs" /> <Compile Include="SMAPI\Events\Display\RenderingHudEventArgs.cs" />
<Compile Include="SMAPI\Events\IHookEvents.cs" /> <Compile Include="SMAPI\Events\Display\RenderingWorldEventArgs.cs" />
<Compile Include="SMAPI\Events\IDisplayEvents.cs" /> <Compile Include="SMAPI\Events\Display\WindowResizedEventArgs.cs" />
<Compile Include="SMAPI\Events\IGameLoopEvents.cs" /> <Compile Include="SMAPI\Events\GameLoop\DayEndingEventArgs.cs" />
<Compile Include="SMAPI\Events\IInputEvents.cs" /> <Compile Include="SMAPI\Events\GameLoop\DayStartedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\GameEvents.cs" />
<Compile Include="SMAPI\Events\GameLoop\GameLaunchedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\IGameLoopEvents.cs" />
<Compile Include="SMAPI\Events\GameLoop\OneSecondUpdateTickedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\OneSecondUpdateTickingEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\ReturnedToTitleEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\SaveCreatedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\SaveCreatingEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\SavedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\SaveEvents.cs" />
<Compile Include="SMAPI\Events\GameLoop\SaveLoadedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\SavingEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\TimeChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\TimeEvents.cs" />
<Compile Include="SMAPI\Events\GameLoop\UpdateTickedEventArgs.cs" />
<Compile Include="SMAPI\Events\GameLoop\UpdateTickingEventArgs.cs" />
<Compile Include="SMAPI\Events\IModEvents.cs" /> <Compile Include="SMAPI\Events\IModEvents.cs" />
<Compile Include="SMAPI\Events\IMultiplayerEvents.cs" /> <Compile Include="SMAPI\Events\Input\ButtonPressedEventArgs.cs" />
<Compile Include="SMAPI\Events\InventoryChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\ButtonReleasedEventArgs.cs" />
<Compile Include="SMAPI\Events\IPlayerEvents.cs" /> <Compile Include="SMAPI\Events\Input\ControlEvents.cs" />
<Compile Include="SMAPI\Events\ISpecialisedEvents.cs" /> <Compile Include="SMAPI\Events\Input\CursorMovedEventArgs.cs" />
<Compile Include="SMAPI\Events\ItemStackChange.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsControllerButtonPressed.cs" />
<Compile Include="SMAPI\Events\ItemStackSizeChange.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsControllerButtonReleased.cs" />
<Compile Include="SMAPI\Events\IWorldEvents.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsControllerTriggerPressed.cs" />
<Compile Include="SMAPI\Events\LargeTerrainFeatureListChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsControllerTriggerReleased.cs" />
<Compile Include="SMAPI\Events\LevelChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsInput.cs" />
<Compile Include="SMAPI\Events\LoadStageChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsKeyboardStateChanged.cs" />
<Compile Include="SMAPI\Events\LocationListChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsKeyPressed.cs" />
<Compile Include="SMAPI\Events\MenuChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\EventArgsMouseStateChanged.cs" />
<Compile Include="SMAPI\Events\ModMessageReceivedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\IInputEvents.cs" />
<Compile Include="SMAPI\Events\MouseWheelScrolledEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\InputEvents.cs" />
<Compile Include="SMAPI\Events\NpcListChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Input\MouseWheelScrolledEventArgs.cs" />
<Compile Include="SMAPI\Events\ObjectCheckForActionEventArgs.cs" /> <Compile Include="SMAPI\Events\Menu\EventArgsClickableMenuChanged.cs" />
<Compile Include="SMAPI\Events\ObjectIsIndexOkForBasicShippedCategoryEventArgs.cs" /> <Compile Include="SMAPI\Events\Menu\EventArgsClickableMenuClosed.cs" />
<Compile Include="SMAPI\Events\ObjectListChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Menu\MenuChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\OneSecondUpdateTickedEventArgs.cs" /> <Compile Include="SMAPI\Events\Menu\MenuEvents.cs" />
<Compile Include="SMAPI\Events\OneSecondUpdateTickingEventArgs.cs" /> <Compile Include="SMAPI\Events\Mine\EventArgsMineLevelChanged.cs" />
<Compile Include="SMAPI\Events\PeerContextReceivedEventArgs.cs" /> <Compile Include="SMAPI\Events\Mine\MineEvents.cs" />
<Compile Include="SMAPI\Events\PeerDisconnectedEventArgs.cs" /> <Compile Include="SMAPI\Events\Multiplayer\IMultiplayerEvents.cs" />
<Compile Include="SMAPI\Events\RenderedActiveMenuEventArgs.cs" /> <Compile Include="SMAPI\Events\Multiplayer\ModMessageReceivedEventArgs.cs" />
<Compile Include="SMAPI\Events\RenderedEventArgs.cs" /> <Compile Include="SMAPI\Events\Multiplayer\MultiplayerEvents.cs" />
<Compile Include="SMAPI\Events\RenderedHudEventArgs.cs" /> <Compile Include="SMAPI\Events\Multiplayer\PeerContextReceivedEventArgs.cs" />
<Compile Include="SMAPI\Events\RenderedWorldEventArgs.cs" /> <Compile Include="SMAPI\Events\Multiplayer\PeerDisconnectedEventArgs.cs" />
<Compile Include="SMAPI\Events\RenderingActiveMenuEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\EventArgsInventoryChanged.cs" />
<Compile Include="SMAPI\Events\RenderingEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\EventArgsLevelUp.cs" />
<Compile Include="SMAPI\Events\RenderingHudEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\EventArgsPlayerWarped.cs" />
<Compile Include="SMAPI\Events\RenderingWorldEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\InventoryChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\ReturnedToTitleEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\IPlayerEvents.cs" />
<Compile Include="SMAPI\Events\SaveCreatedEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\ItemStackChange.cs" />
<Compile Include="SMAPI\Events\SaveCreatingEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\ItemStackSizeChange.cs" />
<Compile Include="SMAPI\Events\SavedEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\LevelChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\SaveLoadedEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\PlayerEvents.cs" />
<Compile Include="SMAPI\Events\SavingEventArgs.cs" /> <Compile Include="SMAPI\Events\Player\WarpedEventArgs.cs" />
<Compile Include="SMAPI\Events\TerrainFeatureListChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\ContentEvents.cs" />
<Compile Include="SMAPI\Events\TimeChangedEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\EventArgsIntChanged.cs" />
<Compile Include="SMAPI\Events\UnvalidatedUpdateTickedEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\EventArgsValueChanged.cs" />
<Compile Include="SMAPI\Events\UnvalidatedUpdateTickingEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\ISpecialisedEvents.cs" />
<Compile Include="SMAPI\Events\UpdateTickedEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\LoadStageChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\UpdateTickingEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\SpecialisedEvents.cs" />
<Compile Include="SMAPI\Events\WarpedEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\UnvalidatedUpdateTickedEventArgs.cs" />
<Compile Include="SMAPI\Events\ObjectCanBePlacedHereEventArgs.cs" /> <Compile Include="SMAPI\Events\Specialised\UnvalidatedUpdateTickingEventArgs.cs" />
<Compile Include="SMAPI\Events\WindowResizedEventArgs.cs" /> <Compile Include="SMAPI\Events\World\BuildingListChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\World\ChangeType.cs" />
<Compile Include="SMAPI\Events\World\DebrisListChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\World\EventArgsLocationBuildingsChanged.cs" />
<Compile Include="SMAPI\Events\World\EventArgsLocationObjectsChanged.cs" />
<Compile Include="SMAPI\Events\World\EventArgsLocationsChanged.cs" />
<Compile Include="SMAPI\Events\World\IWorldEvents.cs" />
<Compile Include="SMAPI\Events\World\LargeTerrainFeatureListChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\World\LocationEvents.cs" />
<Compile Include="SMAPI\Events\World\LocationListChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\World\NpcListChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\World\ObjectListChangedEventArgs.cs" />
<Compile Include="SMAPI\Events\World\TerrainFeatureListChangedEventArgs.cs" />
<Compile Include="SMAPI\Framework\Command.cs" /> <Compile Include="SMAPI\Framework\Command.cs" />
<Compile Include="SMAPI\Framework\CommandManager.cs" /> <Compile Include="SMAPI\Framework\CommandManager.cs" />
<Compile Include="SMAPI\Framework\ContentCoordinator.cs" /> <Compile Include="SMAPI\Framework\ContentCoordinator.cs" />
@ -513,11 +541,11 @@
<Compile Include="SMAPI\Framework\DeprecationWarning.cs" /> <Compile Include="SMAPI\Framework\DeprecationWarning.cs" />
<Compile Include="SMAPI\Framework\Events\EventManager.cs" /> <Compile Include="SMAPI\Framework\Events\EventManager.cs" />
<Compile Include="SMAPI\Framework\Events\ManagedEvent.cs" /> <Compile Include="SMAPI\Framework\Events\ManagedEvent.cs" />
<Compile Include="SMAPI\Framework\Events\ManagedEventBase.cs" />
<Compile Include="SMAPI\Framework\Events\ModDisplayEvents.cs" /> <Compile Include="SMAPI\Framework\Events\ModDisplayEvents.cs" />
<Compile Include="SMAPI\Framework\Events\ModEvents.cs" /> <Compile Include="SMAPI\Framework\Events\ModEvents.cs" />
<Compile Include="SMAPI\Framework\Events\ModEventsBase.cs" /> <Compile Include="SMAPI\Framework\Events\ModEventsBase.cs" />
<Compile Include="SMAPI\Framework\Events\ModGameLoopEvents.cs" /> <Compile Include="SMAPI\Framework\Events\ModGameLoopEvents.cs" />
<Compile Include="SMAPI\Framework\Events\ModHookEvents.cs" />
<Compile Include="SMAPI\Framework\Events\ModInputEvents.cs" /> <Compile Include="SMAPI\Framework\Events\ModInputEvents.cs" />
<Compile Include="SMAPI\Framework\Events\ModMultiplayerEvents.cs" /> <Compile Include="SMAPI\Framework\Events\ModMultiplayerEvents.cs" />
<Compile Include="SMAPI\Framework\Events\ModPlayerEvents.cs" /> <Compile Include="SMAPI\Framework\Events\ModPlayerEvents.cs" />
@ -592,6 +620,9 @@
<Compile Include="SMAPI\Framework\Reflection\ReflectedProperty.cs" /> <Compile Include="SMAPI\Framework\Reflection\ReflectedProperty.cs" />
<Compile Include="SMAPI\Framework\Reflection\Reflector.cs" /> <Compile Include="SMAPI\Framework\Reflection\Reflector.cs" />
<Compile Include="SMAPI\Framework\RequestExitDelegate.cs" /> <Compile Include="SMAPI\Framework\RequestExitDelegate.cs" />
<Compile Include="SMAPI\Framework\RewriteFacades\FarmerMethods.cs" />
<Compile Include="SMAPI\Framework\RewriteFacades\Game1Methods.cs" />
<Compile Include="SMAPI\Framework\RewriteFacades\IClickableMenuMethods.cs" />
<Compile Include="SMAPI\Framework\RewriteFacades\SpriteBatchMethods.cs" /> <Compile Include="SMAPI\Framework\RewriteFacades\SpriteBatchMethods.cs" />
<Compile Include="SMAPI\Framework\SCore.cs" /> <Compile Include="SMAPI\Framework\SCore.cs" />
<Compile Include="SMAPI\Framework\Serialisation\ColorConverter.cs" /> <Compile Include="SMAPI\Framework\Serialisation\ColorConverter.cs" />
@ -702,123 +733,128 @@
<Compile Include="SMAPI\Utilities\SDate.cs" /> <Compile Include="SMAPI\Utilities\SDate.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BmFont, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\BmFont.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Expansion.Downloader, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Expansion.ZipFile, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Google.Android.Vending.Expansion.ZipFile.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Licensing, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Google.Android.Vending.Licensing.dll</HintPath>
</Reference>
<Reference Include="Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Java.Interop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Microsoft.AppCenter.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Microsoft.AppCenter.Analytics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Analytics.Android.Bindings, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Microsoft.AppCenter.Analytics.Android.Bindings.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Android.Bindings, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Microsoft.AppCenter.Android.Bindings.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Crashes, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Microsoft.AppCenter.Crashes.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Crashes.Android.Bindings, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Microsoft.AppCenter.Crashes.Android.Bindings.dll</HintPath>
</Reference>
<Reference Include="Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Mono.Android.dll</HintPath>
</Reference>
<Reference Include="Mono.Security, Version=2.0.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="StardewValley"> <Reference Include="StardewValley">
<HintPath>..\Mods\assemblies\StardewValley.dll</HintPath> <HintPath>..\Mods\assemblies\StardewValley.dll</HintPath>
</Reference> </Reference>
<Reference Include="BmFont, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\BmFont.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Expansion.Downloader, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Expansion.ZipFile, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Google.Android.Vending.Expansion.ZipFile.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Licensing, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Google.Android.Vending.Licensing.dll</HintPath>
</Reference>
<Reference Include="Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Java.Interop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Microsoft.AppCenter.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Microsoft.AppCenter.Analytics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Analytics.Android.Bindings, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Microsoft.AppCenter.Analytics.Android.Bindings.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Android.Bindings, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Microsoft.AppCenter.Android.Bindings.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Crashes, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Microsoft.AppCenter.Crashes.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AppCenter.Crashes.Android.Bindings, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Microsoft.AppCenter.Crashes.Android.Bindings.dll</HintPath>
</Reference>
<Reference Include="Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Mono.Android.dll</HintPath>
</Reference>
<Reference Include="Mono.Security, Version=2.0.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Mods\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
<HintPath>..\Mods\assemblies\mscorlib.dll</HintPath>
</Reference>
<Reference Include="System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"> <Reference Include="System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
<HintPath>..\..\assemblies\System.dll</HintPath> <HintPath>..\Mods\assemblies\System.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"> <Reference Include="System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
<HintPath>..\..\assemblies\System.Xml</HintPath> <HintPath>..\Mods\assemblies\System.Xml</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\Mods\assemblies\System.Xml.Linq</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <Reference Include="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\assemblies\System.Net.Http.dll</HintPath> <HintPath>..\Mods\assemblies\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel.Internals">
<HintPath>..\..\assemblies\System.ServiceModel.Internals.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"> <Reference Include="System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
<HintPath>..\..\assemblies\System.Runtime.Serialization.dll</HintPath> <HintPath>..\Mods\assemblies\System.Runtime.Serialization.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Arch.Core.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Arch.Core.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Arch.Core.Common.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Arch.Core.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Arch.Lifecycle.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Arch.Lifecycle.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Arch.Lifecycle.Common.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Arch.Lifecycle.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Arch.Lifecycle.Runtime, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Arch.Lifecycle.Runtime, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Arch.Lifecycle.Runtime.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Arch.Lifecycle.Runtime.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Support.Annotations, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Support.Annotations, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Support.Annotations.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Support.Annotations.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Support.Compat.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Support.Compat.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Support.Core.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Support.Core.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Support.Core.UI.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Support.Core.UI.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Support.Core.Utils, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Support.Core.Utils, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Support.Core.Utils.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Support.Core.Utils.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Support.Fragment.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Support.Fragment.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Support.Media.Compat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Support.Media.Compat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Support.Media.Compat.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Support.Media.Compat.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\Xamarin.Android.Support.v4.dll</HintPath> <HintPath>..\Mods\assemblies\Xamarin.Android.Support.v4.dll</HintPath>
</Reference> </Reference>
<Reference Include="xTile, Version=1.0.7033.16602, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="xTile, Version=1.0.7033.16602, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\xTile.dll</HintPath> <HintPath>..\Mods\assemblies\xTile.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -8,6 +8,7 @@ using System.IO;
using StardewValley.Menus; using StardewValley.Menus;
using StardewValley.Buildings; using StardewValley.Buildings;
using StardewValley.Objects; using StardewValley.Objects;
using StardewModdingAPI.Patches;
namespace SMDroid namespace SMDroid
{ {
@ -57,7 +58,17 @@ namespace SMDroid
return this.core.GameInstance.Update(param1 as GameTime); return this.core.GameInstance.Update(param1 as GameTime);
case "StardewValley.Game1._draw": case "StardewValley.Game1._draw":
return this.core.GameInstance.Draw(param1 as GameTime, param2 as RenderTarget2D); return this.core.GameInstance.Draw(param1 as GameTime, param2 as RenderTarget2D);
case "StardewValley.Object.getDescription":
if (!ObjectErrorPatch.Object_GetDescription_Prefix(__instance as StardewValley.Object, ref __result))
{
return false;
}
return true;
default: default:
if ((hookName == "StardewValley.Dialogue..ctor") && !DialogueErrorPatch.Prefix(__instance as Dialogue, (string)param1, param2 as NPC))
{
return false;
}
return this.core.GameInstance.OnCommonHook_Prefix(hookName, __instance, ref param1, ref param2, ref param3, ref param4, ref __result); return this.core.GameInstance.OnCommonHook_Prefix(hookName, __instance, ref param1, ref param2, ref param3, ref param4, ref __result);
} }
} }
@ -81,6 +92,29 @@ namespace SMDroid
{ {
this.core.GameInstance.OnCommonStaticHook_Postfix(hookName, ref param1, ref param2, ref param3, ref param4, ref param5, ref __state, ref __result); this.core.GameInstance.OnCommonStaticHook_Postfix(hookName, ref param1, ref param2, ref param3, ref param4, ref param5, ref __state, ref __result);
} }
public override void OnCommonHook10_Postfix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref bool __state, ref object __result)
{
this.core.GameInstance.OnCommonHook10_Postfix(hookName, __instance, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref __state, ref __result);
}
public override bool OnCommonHook10_Prefix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object __result)
{
if ((hookName == "StardewValley.Menus.IClickableMenu.drawToolTip") && !ObjectErrorPatch.IClickableMenu_DrawTooltip_Prefix(__instance as IClickableMenu, param4 as Item))
{
return false;
}
return this.core.GameInstance.OnCommonHook10_Prefix(hookName, __instance, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref __result);
}
public override void OnCommonStaticHook10_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref bool __state, ref object __result)
{
this.core.GameInstance.OnCommonStaticHook10_Postfix(hookName, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref param10, ref __state, ref __result);
}
public override bool OnCommonStaticHook10_Prefix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref object __result)
{
return this.core.GameInstance.OnCommonStaticHook10_Prefix(hookName, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref param10, ref __result);
}
public override void OnGame1_NewDayAfterFade(Action action) public override void OnGame1_NewDayAfterFade(Action action)
{ {
this.core.GameInstance.OnNewDayAfterFade(); this.core.GameInstance.OnNewDayAfterFade();

View File

@ -44,7 +44,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <exception cref="InvalidOperationException">The <paramref name="path"/> is not relative or contains directory climbing (../).</exception> /// <exception cref="InvalidOperationException">The <paramref name="path"/> is not relative or contains directory climbing (../).</exception>
public TModel ReadJsonFile<TModel>(string path) where TModel : class public TModel ReadJsonFile<TModel>(string path) where TModel : class
{ {
if (!PathUtilities.IsSafeRelativePath(path)) if ((this.ModID != "Platonymous.ScaleUp") && !PathUtilities.IsSafeRelativePath(path))
throw new InvalidOperationException($"You must call {nameof(IModHelper.Data)}.{nameof(this.ReadJsonFile)} with a relative path."); throw new InvalidOperationException($"You must call {nameof(IModHelper.Data)}.{nameof(this.ReadJsonFile)} with a relative path.");
path = Path.Combine(this.ModFolderPath, PathUtilities.NormalisePathSeparators(path)); path = Path.Combine(this.ModFolderPath, PathUtilities.NormalisePathSeparators(path));

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StardewModdingAPI.SMAPI.Framework.ModLoading
{
class RewriteIgnoreConfig
{
public Dictionary<string, string> Ignore { get; set; } = new Dictionary<string, string>();
}
}

View File

@ -239,11 +239,11 @@ namespace StardewModdingAPI.Framework
); );
StardewValley.Program.gamePtr = Game1.game1; StardewValley.Program.gamePtr = Game1.game1;
// apply game patches // apply game patches
//new GamePatcher(this.Monitor).Apply( new GamePatcher(this.Monitor).Apply(
// new DialogueErrorPatch(this.MonitorForGame, this.Reflection), new DialogueErrorPatch(this.MonitorForGame, this.Reflection),
// new ObjectErrorPatch(), new ObjectErrorPatch(),
// new LoadForNewGamePatch(this.Reflection, this.GameInstance.OnLoadStageChanged) new LoadForNewGamePatch(this.Reflection, this.GameInstance.OnLoadStageChanged)
//); );
//// add exit handler //// add exit handler
//new Thread(() => //new Thread(() =>

View File

@ -114,6 +114,44 @@ namespace StardewModdingAPI.Framework
} }
return true; return true;
} }
internal void OnCommonHook10_Postfix(string hookName, object instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref bool state, ref object result)
{
foreach (IMod mod in this.HookReceiver)
{
mod.OnCommonHook10_Postfix(hookName, instance, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref state, ref result);
}
}
internal bool OnCommonHook10_Prefix(string hookName, object instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object result)
{
foreach (IMod mod in this.HookReceiver)
{
if (!mod.OnCommonHook10_Prefix(hookName, instance, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref result))
{
return false;
}
}
return true;
}
internal void OnCommonStaticHook10_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref bool state, ref object result)
{
foreach (IMod mod in this.HookReceiver)
{
mod.OnCommonStaticHook10_Postfix(hookName, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref param10, ref state, ref result);
}
}
internal bool OnCommonStaticHook10_Prefix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref object result)
{
foreach (IMod mod in this.HookReceiver)
{
if (!mod.OnCommonStaticHook10_Prefix(hookName, ref param1, ref param2, ref param3, ref param4, ref param5, ref param6, ref param7, ref param8, ref param9, ref param10, ref result))
{
return false;
}
}
return true;
}
/// <summary>Whether the game is saving and SMAPI has already raised <see cref="IGameLoopEvents.Saving"/>.</summary> /// <summary>Whether the game is saving and SMAPI has already raised <see cref="IGameLoopEvents.Saving"/>.</summary>
private bool IsBetweenSaveEvents; private bool IsBetweenSaveEvents;
@ -1137,7 +1175,6 @@ namespace StardewModdingAPI.Framework
IReflectedMethod DrawTutorialUI = this.Reflection.GetMethod(Game1.game1, "DrawTutorialUI", new Type[] { }); IReflectedMethod DrawTutorialUI = this.Reflection.GetMethod(Game1.game1, "DrawTutorialUI", new Type[] { });
IReflectedMethod DrawGreenPlacementBounds = this.Reflection.GetMethod(Game1.game1, "DrawGreenPlacementBounds", new Type[] { }); IReflectedMethod DrawGreenPlacementBounds = this.Reflection.GetMethod(Game1.game1, "DrawGreenPlacementBounds", new Type[] { });
Matrix matrix;
_drawHUD.SetValue(false); _drawHUD.SetValue(false);
_drawActiveClickableMenu.SetValue(false); _drawActiveClickableMenu.SetValue(false);
if (this.Reflection.GetField<Task>(typeof(Game1), "_newDayTask").GetValue() != null) if (this.Reflection.GetField<Task>(typeof(Game1), "_newDayTask").GetValue() != null)
@ -1145,9 +1182,9 @@ namespace StardewModdingAPI.Framework
Game1.game1.GraphicsDevice.Clear(bgColor.GetValue()); Game1.game1.GraphicsDevice.Clear(bgColor.GetValue());
if (Game1.showInterDayScroll) if (Game1.showInterDayScroll)
{ {
matrix = Matrix.CreateScale((float)1f); Matrix value = Matrix.CreateScale(1f);
Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, new Matrix?(matrix)); Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, new Matrix?(value));
SpriteText.drawStringWithScrollCenteredAt(Game1.spriteBatch, Game1.content.LoadString(@"Strings\UI:please_wait"), Game1.game1.GraphicsDevice.Viewport.Width / 2, Game1.game1.GraphicsDevice.Viewport.Height / 2, "", 1f, -1, 0, 0.088f, false); SpriteText.drawStringWithScrollCenteredAt(Game1.spriteBatch, Game1.content.LoadString("Strings\\UI:please_wait"), Game1.game1.GraphicsDevice.Viewport.Width / 2, Game1.game1.GraphicsDevice.Viewport.Height / 2, "", 1f, -1, 0, 0.088f, false);
Game1.spriteBatch.End(); Game1.spriteBatch.End();
} }
} }
@ -1246,7 +1283,7 @@ namespace StardewModdingAPI.Framework
Game1.game1.GraphicsDevice.Clear(bgColor.GetValue()); Game1.game1.GraphicsDevice.Clear(bgColor.GetValue());
if (((Game1.activeClickableMenu != null) && Game1.options.showMenuBackground) && Game1.activeClickableMenu.showWithoutTransparencyIfOptionIsSet()) if (((Game1.activeClickableMenu != null) && Game1.options.showMenuBackground) && Game1.activeClickableMenu.showWithoutTransparencyIfOptionIsSet())
{ {
matrix = Matrix.CreateScale((float)1f); Matrix matrix = Matrix.CreateScale((float)1f);
Game1.SetSpriteBatchBeginNextID("C"); Game1.SetSpriteBatchBeginNextID("C");
_spriteBatchBegin.Invoke(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, new Matrix?(matrix)); _spriteBatchBegin.Invoke(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, new Matrix?(matrix));
events.Rendering.RaiseEmpty(); events.Rendering.RaiseEmpty();

View File

@ -35,6 +35,10 @@ namespace StardewModdingAPI
void OnCommonHook_Postfix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref bool __state, ref object __result); void OnCommonHook_Postfix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref bool __state, ref object __result);
bool OnCommonStaticHook_Prefix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object __result); bool OnCommonStaticHook_Prefix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object __result);
void OnCommonStaticHook_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref bool __state, ref object __result); void OnCommonStaticHook_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref bool __state, ref object __result);
void OnCommonHook10_Postfix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref bool __state, ref object __result);
bool OnCommonHook10_Prefix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object __result);
void OnCommonStaticHook10_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref bool __state, ref object __result);
bool OnCommonStaticHook10_Prefix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref object __result);
/// <summary>Get an API that other mods can access. This is always called after <see cref="Entry"/>.</summary> /// <summary>Get an API that other mods can access. This is always called after <see cref="Entry"/>.</summary>
object GetApi(); object GetApi();

View File

@ -51,6 +51,10 @@ namespace StardewModdingAPI
public virtual void OnCommonStaticHook_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref bool __state, ref object __result) public virtual void OnCommonStaticHook_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref bool __state, ref object __result)
{ {
} }
public virtual void OnCommonHook10_Postfix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref bool __state, ref object __result) { }
public virtual bool OnCommonHook10_Prefix(string hookName, object __instance, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object __result) { return true; }
public virtual void OnCommonStaticHook10_Postfix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref bool __state, ref object __result) { }
public virtual bool OnCommonStaticHook10_Prefix(string hookName, ref object param1, ref object param2, ref object param3, ref object param4, ref object param5, ref object param6, ref object param7, ref object param8, ref object param9, ref object param10, ref object __result) { return true; }
/// <summary>Get an API that other mods can access. This is always called after <see cref="Entry"/>.</summary> /// <summary>Get an API that other mods can access. This is always called after <see cref="Entry"/>.</summary>

View File

@ -46,10 +46,10 @@ namespace StardewModdingAPI.Patches
/// <param name="harmony">The Harmony instance.</param> /// <param name="harmony">The Harmony instance.</param>
public void Apply(HarmonyInstance harmony) public void Apply(HarmonyInstance harmony)
{ {
ConstructorInfo constructor = AccessTools.Constructor(typeof(Dialogue), new[] { typeof(string), typeof(NPC) }); //ConstructorInfo constructor = AccessTools.Constructor(typeof(Dialogue), new[] { typeof(string), typeof(NPC) });
MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(DialogueErrorPatch.Prefix)); //MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(DialogueErrorPatch.Prefix));
harmony.Patch(constructor, new HarmonyMethod(prefix), null); //harmony.Patch(constructor, new HarmonyMethod(prefix), null);
} }
@ -63,7 +63,7 @@ namespace StardewModdingAPI.Patches
/// <returns>Returns whether to execute the original method.</returns> /// <returns>Returns whether to execute the original method.</returns>
/// <remarks>This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments.</remarks> /// <remarks>This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments.</remarks>
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")] [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")]
private static bool Prefix(Dialogue __instance, string masterDialogue, NPC speaker) public static bool Prefix(Dialogue __instance, string masterDialogue, NPC speaker)
{ {
// get private members // get private members
bool nameArraysTranslated = DialogueErrorPatch.Reflection.GetField<bool>(typeof(Dialogue), "nameArraysTranslated").GetValue(); bool nameArraysTranslated = DialogueErrorPatch.Reflection.GetField<bool>(typeof(Dialogue), "nameArraysTranslated").GetValue();

View File

@ -55,11 +55,11 @@ namespace StardewModdingAPI.Patches
/// <param name="harmony">The Harmony instance.</param> /// <param name="harmony">The Harmony instance.</param>
public void Apply(HarmonyInstance harmony) public void Apply(HarmonyInstance harmony)
{ {
MethodInfo method = AccessTools.Method(typeof(Game1), nameof(Game1.loadForNewGame)); //MethodInfo method = AccessTools.Method(typeof(Game1), nameof(Game1.loadForNewGame));
MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(LoadForNewGamePatch.Prefix)); //MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(LoadForNewGamePatch.Prefix));
MethodInfo postfix = AccessTools.Method(this.GetType(), nameof(LoadForNewGamePatch.Postfix)); //MethodInfo postfix = AccessTools.Method(this.GetType(), nameof(LoadForNewGamePatch.Postfix));
harmony.Patch(method, new HarmonyMethod(prefix), new HarmonyMethod(postfix)); //harmony.Patch(method, new HarmonyMethod(prefix), new HarmonyMethod(postfix));
} }

View File

@ -25,16 +25,16 @@ namespace StardewModdingAPI.Patches
public void Apply(HarmonyInstance harmony) public void Apply(HarmonyInstance harmony)
{ {
// object.getDescription // object.getDescription
harmony.Patch( //harmony.Patch(
original: AccessTools.Method(typeof(SObject), nameof(SObject.getDescription)), // original: AccessTools.Method(typeof(SObject), nameof(SObject.getDescription)),
prefix: new HarmonyMethod(AccessTools.Method(this.GetType(), nameof(ObjectErrorPatch.Object_GetDescription_Prefix))) // prefix: new HarmonyMethod(AccessTools.Method(this.GetType(), nameof(ObjectErrorPatch.Object_GetDescription_Prefix)))
); //);
// IClickableMenu.drawToolTip //// IClickableMenu.drawToolTip
harmony.Patch( //harmony.Patch(
original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.drawToolTip)), // original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.drawToolTip)),
prefix: new HarmonyMethod(AccessTools.Method(this.GetType(), nameof(ObjectErrorPatch.IClickableMenu_DrawTooltip_Prefix))) // prefix: new HarmonyMethod(AccessTools.Method(this.GetType(), nameof(ObjectErrorPatch.IClickableMenu_DrawTooltip_Prefix)))
); //);
} }
@ -47,7 +47,7 @@ namespace StardewModdingAPI.Patches
/// <returns>Returns whether to execute the original method.</returns> /// <returns>Returns whether to execute the original method.</returns>
/// <remarks>This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments.</remarks> /// <remarks>This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments.</remarks>
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")] [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")]
private static bool Object_GetDescription_Prefix(SObject __instance, ref string __result) public static bool Object_GetDescription_Prefix(SObject __instance, ref object __result)
{ {
// invalid bigcraftables crash instead of showing '???' like invalid non-bigcraftables // invalid bigcraftables crash instead of showing '???' like invalid non-bigcraftables
if (!__instance.IsRecipe && __instance.bigCraftable.Value && !Game1.bigCraftablesInformation.ContainsKey(__instance.ParentSheetIndex)) if (!__instance.IsRecipe && __instance.bigCraftable.Value && !Game1.bigCraftablesInformation.ContainsKey(__instance.ParentSheetIndex))
@ -65,7 +65,7 @@ namespace StardewModdingAPI.Patches
/// <returns>Returns whether to execute the original method.</returns> /// <returns>Returns whether to execute the original method.</returns>
/// <remarks>This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments.</remarks> /// <remarks>This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments.</remarks>
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")] [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")]
private static bool IClickableMenu_DrawTooltip_Prefix(IClickableMenu __instance, Item hoveredItem) public static bool IClickableMenu_DrawTooltip_Prefix(IClickableMenu __instance, Item hoveredItem)
{ {
// invalid edible item cause crash when drawing tooltips // invalid edible item cause crash when drawing tooltips
if (hoveredItem is SObject obj && obj.Edibility != -300 && !Game1.objectInformation.ContainsKey(obj.ParentSheetIndex)) if (hoveredItem is SObject obj && obj.Edibility != -300 && !Game1.objectInformation.ContainsKey(obj.ParentSheetIndex))