|
|
@@ -0,0 +1,59 @@ |
|
|
|
using System.Globalization; |
|
|
|
using System.Reflection; |
|
|
|
using System.Text; |
|
|
|
using Game.UI.WorldMapScreen; |
|
|
|
using HarmonyLib; |
|
|
|
using Svelto.DataStructures; |
|
|
|
|
|
|
|
namespace CLre.Fixes |
|
|
|
{ |
|
|
|
public class MapPinPointsFloatFix |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[Bugfix(name = "OfflineSpawnpointSavingFloatFix", |
|
|
|
description = "Make spawnpoints save properly for everyone, even when floats contain a comma", |
|
|
|
more = "https://trello.com/c/hpADhDhQ/21-login-goes-to-original-spawn", |
|
|
|
component = BugfixType.HarmonyPatch, id = 9)] |
|
|
|
[HarmonyPatch] |
|
|
|
class WorldMapPinPointsMessage_InjectValues_Patch |
|
|
|
{ |
|
|
|
private static StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
|
|
[HarmonyPrefix] |
|
|
|
public static bool BeforeMethodCall(WorldMapPinPointsMessage __instance, |
|
|
|
FasterList<PinsPosition> pinPositions) |
|
|
|
{ |
|
|
|
#if DEBUG |
|
|
|
API.Utility.Logging.Log("Intercepting Game.UI.WorldMapScreen.WorldMapPinPointsMessage:InjectValues"); |
|
|
|
#endif |
|
|
|
sb.Length = 0; |
|
|
|
for (int i = 0; i < pinPositions.Count; i++) |
|
|
|
{ |
|
|
|
if (pinPositions[i].IsOnMap) |
|
|
|
{ |
|
|
|
// force culture invariant float format (with a . as decimal point) |
|
|
|
sb.AppendFormat("{0};{1};", |
|
|
|
pinPositions[i].PinPosition.x.ToString("0.0", CultureInfo.InvariantCulture), |
|
|
|
pinPositions[i].PinPosition.y.ToString("0.0", CultureInfo.InvariantCulture)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sb.AppendFormat("{0};{1};", "x", "x"); |
|
|
|
} |
|
|
|
} |
|
|
|
__instance.pinPoints = sb.ToString(); |
|
|
|
#if DEBUG |
|
|
|
API.Utility.Logging.Log($"Corrected pin point string to culture invariant: {sb.ToString()}"); |
|
|
|
#endif |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
[HarmonyTargetMethod] |
|
|
|
public static MethodBase Target() |
|
|
|
{ |
|
|
|
return AccessTools.Method(typeof(WorldMapPinPointsMessage), "InjectValues"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |