Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,152 @@
namespace Harmony.BindingItemPatches
{
[HarmonyPatch(typeof(BindingItem))]
[HarmonyPatch("ParseCVars")]
public class ParseCVarsPatch
{
public static bool Prefix(BindingItem __instance, ref string __result, string _fullText,
char ___cvarFormatSplitChar,
char[] ___cvarFormatSplitCharArray
)
{
//Log.Out("BindingItemPatches-ParseCVars _fullText: " + _fullText);
for (int num = _fullText.IndexOf("{cvar(", StringComparison.Ordinal); num != -1; num = _fullText.IndexOf("{cvar(", num, StringComparison.Ordinal))
{
//Log.Out("BindingItemPatches-ParseCVars num: " + num);
string text = _fullText.Substring(num, _fullText.IndexOf('}', num) + 1 - num);
string format = "";
int num2 = text.IndexOf('(') + 1;
string text2 = text.Substring(num2, text.IndexOf(')') - num2);
if (text2.IndexOf(___cvarFormatSplitChar) >= 0)
{
string[] array = text2.Split(___cvarFormatSplitCharArray);
text2 = array[0];
format = array[1];
}
bool foundEntry = text2.Contains("$varFuriousRamsay");
if (!foundEntry)
{
_fullText = _fullText.Replace(text, XUiM_Player.GetPlayer().GetCVar(text2).ToString(format));
}
else
{
if (text2.EndsWith("Perc") && !text2.EndsWith("Unit"))
{
//Log.Out("BindingItemPatches-ParseCVars RebirthVariables.localVariables[" + text2 + "Unit]: " + RebirthVariables.localVariables[text2 + "Unit"].ToString(format));
string level = text2.Replace("$varFuriousRamsay", "").Replace("Perc", "");
//Log.Out("BindingItemPatches-ParseCVars level: " + level);
bool found = false;
string foundKey = "";
foreach (var key in RebirthVariables.localClasses.Keys)
{
//Log.Out("BindingItemPatches-ParseCVars CLASS key: " + key);
if (level.Contains(key))
{
level = level.Replace(key, "");
found = true;
foundKey = key;
//Log.Out("BindingItemPatches-ParseCVars CLASS level: " + level);
break;
}
}
if (!found)
{
foreach (var key in RebirthVariables.localExpertise.Keys)
{
//Log.Out("BindingItemPatches-ParseCVars EXPERTISE key: " + key);
if (level.Contains(key))
{
level = level.Replace(key, "");
foundKey = key;
found = true;
//Log.Out("BindingItemPatches-ParseCVars EXPERTISE level: " + level);
break;
}
}
}
float total = 0;
if (found)
{
total = RebirthVariables.localVariables[text2.Replace(level, "") + "Unit"];
}
else
{
total = RebirthVariables.localVariables[text2 + "Unit"];
}
float unit = total % 1;
float percentage = (float)(Math.Truncate(unit * 100 * 100) / 100);
if (percentage > 100)
{
percentage = 100.00f;
}
if (found)
{
//Log.Out("BindingItemPatches-ParseCVars level: " + level);
//Log.Out("BindingItemPatches-ParseCVars unit: " + unit);
//Log.Out("BindingItemPatches-ParseCVars BEFORE percentage: " + percentage);
int foundLevel = int.Parse(level);
int currentLevel = (int)total + 1;
//Log.Out("BindingItemPatches-ParseCVars currentLevel: " + currentLevel);
//Log.Out("BindingItemPatches-ParseCVars foundLevel: " + foundLevel);
//Log.Out("BindingItemPatches-ParseCVars currentLevel: " + currentLevel);
if (foundLevel < currentLevel)
{
//Log.Out("BindingItemPatches-ParseCVars foundLevel < currentLevel");
percentage = 100.00f;
}
else if (foundLevel > currentLevel)
{
//Log.Out("BindingItemPatches-ParseCVars foundLevel > currentLevel");
percentage = 0.00f;
}
//Log.Out("BindingItemPatches-ParseCVars AFTER percentage: " + percentage);
}
_fullText = _fullText.Replace(text, percentage.ToString());
}
else if (text2.EndsWith("Lvl"))
{
//Log.Out("BindingItemPatches-ParseCVars RebirthVariables.localConstants[" + text2 + "]: " + RebirthVariables.localConstants[text2].ToString(format));
_fullText = _fullText.Replace(text, RebirthVariables.localConstants[text2].ToString(format));
}
else if (text2.EndsWith("_Cst"))
{
//Log.Out("BindingItemPatches-ParseCVars RebirthVariables.localConstants[" + text2 + "]: " + RebirthVariables.localConstants[text2].ToString(format));
_fullText = _fullText.Replace(text, RebirthVariables.localConstants[text2].ToString(format));
}
else
{
_fullText = _fullText.Replace(text, XUiM_Player.GetPlayer().GetCVar(text2).ToString(format));
}
}
}
__result = _fullText;
return false;
}
}
}