Skip to content

Commit

Permalink
1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoHHacks committed Jul 30, 2023
1 parent fdbdef8 commit 158c59c
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## GV 1.59:

### Release 1.4.1
- Hotfix for promos not working.

### Release 1.4.0
- UPDATE TO GAME VERSION 1.59

Expand Down
16 changes: 8 additions & 8 deletions Patches/PromoPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ public static void PatchPromoInfo()
return;
}

GameDialog.INHHDMCONJD++;
Array.Resize(ref GameDialog.JDJMBJHKNAB, GameDialog.INHHDMCONJD + 1);
ResizeArray(ref GameDialog.KIGJPKBDCKK, GameDialog.INHHDMCONJD + 1,
GameDialog.LEKNPAAEBAE++;
Array.Resize(ref GameDialog.JDJMBJHKNAB, GameDialog.LEKNPAAEBAE + 1);
ResizeArray(ref GameDialog.KIGJPKBDCKK, GameDialog.LEKNPAAEBAE + 1,
Math.Max(40, CustomContent.PromoData.Count));
Array.Resize(ref GameDialog.OIDMOHCDEHK, GameDialog.INHHDMCONJD + 1);
GameDialog.OIDMOHCDEHK[GameDialog.INHHDMCONJD] = CustomContent.PromoData.Count;
GameDialog.JDJMBJHKNAB[GameDialog.INHHDMCONJD] = "Custom";
GameDialog.KIGJPKBDCKK[GameDialog.INHHDMCONJD, 0] = 0;
Array.Resize(ref GameDialog.OIDMOHCDEHK, GameDialog.LEKNPAAEBAE + 1);
GameDialog.OIDMOHCDEHK[GameDialog.LEKNPAAEBAE] = CustomContent.PromoData.Count;
GameDialog.JDJMBJHKNAB[GameDialog.LEKNPAAEBAE] = "Custom";
GameDialog.KIGJPKBDCKK[GameDialog.LEKNPAAEBAE, 0] = 0;
for (int i = 0; i < CustomContent.PromoData.Count; i++)
{
GameDialog.KIGJPKBDCKK[GameDialog.INHHDMCONJD, i + 1] = 1000000 + i;
GameDialog.KIGJPKBDCKK[GameDialog.LEKNPAAEBAE, i + 1] = 1000000 + i;
}
}

Expand Down
8 changes: 6 additions & 2 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "IngoH.WrestlingEmpire.WECCL";
public const string PluginName = "Wrestling Empire Custom Content Loader";
public const string PluginVer = "1.4.0";
public const string PluginVer = "1.4.1";
public const float PluginCharacterVersion = 1.56f;
public const float PluginVersion = 1.59f;

Expand Down Expand Up @@ -1083,11 +1083,15 @@ public static int CountFiles(List<DirectoryInfo> dirs, LoadContent.ContentType t
return count;
}

public static string GetConfigValues()
public static string GetNonDefaultConfigValues()
{
string result = "";
foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> pair in Instance.Config.Select(x => new KeyValuePair<ConfigDefinition, ConfigEntryBase>(x.Key, x.Value)))
{
if (pair.Value.BoxedValue.ToString() == pair.Value.DefaultValue.ToString())
{
continue;
}
result += $"{pair.Key.Key}={pair.Value.BoxedValue}\n";
}

Expand Down
144 changes: 144 additions & 0 deletions Updates/V158toV159.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
namespace WECCL.Updates;

internal class V158toV159 : VersionDiff
{
public V158toV159()
{
this.MaterialCountsDiff = new List<int>
{
0,
2,
0,
0,
2,
2,
2,
2,
1,
1,
0,
1,
1,
0,
3,
3,
1,
0,
0,
0,
0,
0,
0,
11,
11,
2,
2,
1,
0,
1,
1,
0,
1,
1,
0,
0,
0,
0,
0,
0
};
this.FleshCountsDiff = new List<int>
{
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
};
this.ShapeCountsDiff = new List<int>
{
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
};
this.BodyFemaleCountDiff = 0;
this.FaceFemaleCountDiff = 0;
this.SpecialFootwearCountDiff = 0;
this.TransparentHairMaterialCountDiff = 0;
this.TransparentHairHairstyleCountDiff = 1;
this.KneepadCountDiff = 0;
this.MusicCountDiff = 0;
}
}
21 changes: 21 additions & 0 deletions Updates/VersionDiffGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace WECCL.Updates;

internal class VersionDiffGroup : VersionDiff
{
public VersionDiffGroup(params VersionDiff[] diffs)
{
foreach (VersionDiff diff in diffs)
{
this.MaterialCountsDiff = this.MaterialCountsDiff.Zip(diff.MaterialCountsDiff, (a, b) => a + b).ToList();
this.FleshCountsDiff = this.FleshCountsDiff.Zip(diff.FleshCountsDiff, (a, b) => a + b).ToList();
this.ShapeCountsDiff = this.ShapeCountsDiff.Zip(diff.ShapeCountsDiff, (a, b) => a + b).ToList();
this.BodyFemaleCountDiff += diff.BodyFemaleCountDiff;
this.FaceFemaleCountDiff += diff.FaceFemaleCountDiff;
this.SpecialFootwearCountDiff += diff.SpecialFootwearCountDiff;
this.TransparentHairMaterialCountDiff += diff.TransparentHairMaterialCountDiff;
this.TransparentHairHairstyleCountDiff += diff.TransparentHairHairstyleCountDiff;
this.KneepadCountDiff += diff.KneepadCountDiff;
this.MusicCountDiff += diff.MusicCountDiff;
}
}
}
1 change: 1 addition & 0 deletions Utils/ArrayUtils.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace WECCL.Utils;

[HarmonyPatch]
public static class ArrayUtils
{
public static int[] GenerateArrayForNum(int characters)
Expand Down
14 changes: 10 additions & 4 deletions Utils/DataSharing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using UnityEngine.SceneManagement;

Expand Down Expand Up @@ -30,9 +31,14 @@ private static string LoadUUID()
Plugin.Log.LogDebug("Loaded Data UUID: " + uuid);
return uuid;
}

const string PATH_PATTERN = @"([A-Z]:[\\/](?:[^\\/:\n]*[\\/])*)([^\\/:\n]*)";

public static void SendExceptionToServer(string message, string stackTrace, string dataSharingLevel)
{
message = Regex.Replace(message, PATH_PATTERN, @"#:\2");
stackTrace = Regex.Replace(stackTrace, PATH_PATTERN, @"#:\2");

if (dataSharingLevel == "None") return;
Dictionary<string, string> data;
if (dataSharingLevel == "Full")
Expand All @@ -43,12 +49,12 @@ public static void SendExceptionToServer(string message, string stackTrace, stri
{ "type", "exception" },
{ "message", message },
{ "stackTrace", stackTrace },
{ "wecclVersion", Plugin.PluginVersion.ToString(CultureInfo.CurrentCulture) },
{ "wecclVersion", Plugin.PluginVer},
{ "installedMods", string.Join(",", BepInEx.Bootstrap.Chainloader.PluginInfos.Select(x => x.Key)) },
{ "prefixes", string.Join(",", Prefixes) },
{ "nonDefaultConfigValues", Plugin.GetConfigValues() },
{ "nonDefaultConfigValues", Plugin.GetNonDefaultConfigValues() },
{ "currentScene", SceneManager.GetActiveScene().name },
{ "numberOfCharacters", Characters.c.Length.ToString() }
{ "numberOfCharacters", (Characters.c.Length - 1).ToString() }
};

}
Expand All @@ -59,7 +65,7 @@ public static void SendExceptionToServer(string message, string stackTrace, stri
{ "type", "exception" },
{ "message", message },
{ "stackTrace", stackTrace },
{ "wecclVersion", Plugin.PluginVersion.ToString(CultureInfo.CurrentCulture) }
{ "wecclVersion", Plugin.PluginVer }
};
}
Thread thread = new(() =>
Expand Down
19 changes: 13 additions & 6 deletions Utils/SaveRemapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,29 @@ internal static void PatchCustomContent(ref SaveData saveData)
bool changed = false;

Check warning on line 15 in Utils/SaveRemapper.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'changed' is assigned but its value is never used

int oldVersion = Mathf.RoundToInt(ContentMappings.ContentMap.GameVersion * 100);
int newVersion = Mathf.RoundToInt(Plugin.CharactersVersion * 100);
int newVersion = Mathf.RoundToInt(Plugin.PluginVersion * 100);

VersionDiff versionDiff = null;

if (oldVersion != newVersion)
{
Plugin.Log.LogInfo($"Game version changed from {oldVersion} to {newVersion}. Updating custom content map.");

if (oldVersion == 155 && newVersion == 156)
List<VersionDiff> versionDiffs = new();
if (oldVersion < 156 && newVersion >= 156)
{
versionDiffs.Add(new V155toV156());
}
if (oldVersion < 159 && newVersion >= 159)
{
versionDiffs.Add(new V158toV159());
}
if (versionDiffs.Count > 1)
{
versionDiff = new V155toV156();
versionDiff = new VersionDiffGroup(versionDiffs.ToArray());
}
else
{
Plugin.Log.LogError(
$"No update data found for version change from {oldVersion} to {newVersion}. Please report this to the mod author.");
versionDiff = versionDiffs[0];
}
}

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"namespace": "IngoH",
"name": "WECCL",
"description": "Loads custom content for Wrestling Empire",
"version_number": "1.4.0",
"version_number": "1.4.1",
"dependencies": [
"BepInEx-BepInExPack-5.4.2100"
],
Expand Down

0 comments on commit 158c59c

Please sign in to comment.