-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #240 from Arkhist/develop
Prepare release 5.3.3
- Loading branch information
Showing
14 changed files
with
407 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Reflection; | ||
using Hacknet.Effects; | ||
using HarmonyLib; | ||
using Mono.Cecil.Cil; | ||
using MonoMod.Cil; | ||
|
||
namespace Pathfinder.BaseGameFixes; | ||
|
||
[HarmonyPatch] | ||
public static class FlickeringTextReportNull { | ||
[HarmonyPatch(typeof(FlickeringTextEffect), nameof(FlickeringTextEffect.GetReportString))] | ||
[HarmonyILManipulator] | ||
private static void GetReportStringManipulator(ILContext context) { | ||
ILCursor cursor = new(context); | ||
|
||
ILLabel unskipLabel = context.DefineLabel(); | ||
cursor.Emit(OpCodes.Ldsfld, typeof(FlickeringTextEffect).GetField(nameof(FlickeringTextEffect.LinedItemTarget), BindingFlags.Static | BindingFlags.Public)); | ||
cursor.Emit(OpCodes.Brtrue, unskipLabel); | ||
cursor.Emit(OpCodes.Ldstr, "FlickeringTextEffect was not used in this execution."); | ||
cursor.Emit(OpCodes.Ret); | ||
unskipLabel.Target = cursor.Next; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
PathfinderAPI/BaseGameFixes/KeepBranchesOnMailMissionCompletion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Hacknet; | ||
using HarmonyLib; | ||
using Mono.Cecil; | ||
using Mono.Cecil.Cil; | ||
using MonoMod.Cil; | ||
using MonoMod.Utils; | ||
|
||
namespace Pathfinder.BaseGameFixes; | ||
|
||
[HarmonyPatch] | ||
public static class KeepBranchesOnMailMissionCompletion { | ||
[HarmonyPatch(typeof(MailServer), nameof(MailServer.doRespondDisplay))] | ||
[HarmonyILManipulator] | ||
public static void DoRespondDisplayManipulator(ILContext context) { | ||
ILCursor cursor = new(context); | ||
|
||
cursor.GotoNext(MoveType.After, | ||
x => x.MatchLdarg(0), | ||
x => x.MatchLdarg(0), | ||
x => x.MatchLdfld<Hacknet.Daemon>("os"), | ||
x => x.MatchLdfld<OS>("branchMissions"), | ||
x => x.MatchLdloc(4), | ||
x => x.MatchCallvirt(out MethodReference method) && | ||
method.DeclaringType.Is(typeof(List<ActiveMission>)) && | ||
method.Name == "get_Item" | ||
, | ||
x => x.MatchCall<MailServer>("attemptCompleteMission"), | ||
x => x.MatchStloc(11) | ||
); | ||
Instruction startOfRange = cursor.Next; | ||
|
||
cursor.GotoNext(MoveType.After, | ||
x => x.MatchLdarg(0), | ||
x => x.MatchLdfld<Hacknet.Daemon>("os"), | ||
x => x.MatchLdfld<OS>("branchMissions"), | ||
x => x.MatchCallvirt(out MethodReference method) && | ||
method.DeclaringType.Is(typeof(List<ActiveMission>)) && | ||
method.Name == "Clear" | ||
); | ||
Instruction endOfRange = cursor.Prev; | ||
|
||
cursor.Goto(startOfRange); | ||
int count = cursor.Instrs.IndexOf(endOfRange) - cursor.Instrs.IndexOf(startOfRange) + 1; | ||
cursor.RemoveRange(count); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Hacknet; | ||
using HarmonyLib; | ||
using Mono.Cecil.Cil; | ||
using MonoMod.Cil; | ||
|
||
namespace Pathfinder.BaseGameFixes; | ||
|
||
[HarmonyPatch] | ||
public static class KillExeCheckIdentifierName | ||
{ | ||
[HarmonyILManipulator] | ||
[HarmonyPatch(typeof(SAKillExe), nameof(SAKillExe.Trigger))] | ||
internal static void SAKillExeTriggerIL(ILContext il) | ||
{ | ||
ILCursor c = new ILCursor(il); | ||
|
||
// if (oS.exes[i].name.ToLower().Contains(ExeName.ToLower())) | ||
c.GotoNext(MoveType.After, | ||
// (...) | ||
x => x.MatchLdfld(AccessTools.Field(typeof(SAKillExe), nameof(SAKillExe.ExeName))), | ||
x => x.MatchCallvirt(AccessTools.Method(typeof(string), nameof(string.ToLower))), | ||
x => x.MatchCallvirt(AccessTools.Method(typeof(string), nameof(string.Contains), new Type[]{ typeof(string) })), | ||
x => x.MatchLdcI4(0), | ||
x => x.MatchCeq() | ||
); | ||
c.Emit(OpCodes.Ldarg_0); | ||
c.Emit(OpCodes.Ldloc_0); | ||
c.Emit(OpCodes.Ldloc_1); | ||
c.EmitDelegate<Func<SAKillExe, OS, int, bool>>((__instance, oS, i) => | ||
oS.exes[i].IdentifierName.ToLower().Contains(__instance.ExeName.ToLower()) | ||
); | ||
c.Emit(OpCodes.Ldc_I4_0); | ||
c.Emit(OpCodes.Ceq); | ||
c.Emit(OpCodes.And); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.