36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
namespace Harmony.BlockPatches
|
|
{
|
|
[HarmonyPatch(typeof(Party))]
|
|
[HarmonyPatch("GetPartyXP")]
|
|
public class GetPartyXPPatch
|
|
{
|
|
public static bool Prefix(Party __instance, ref int __result, EntityPlayer player, int startingXP)
|
|
{
|
|
int num = __instance.MemberCountInRange(player);
|
|
|
|
// Parse the party multiplier option
|
|
float partyMultiplierOption = float.Parse(RebirthVariables.customPartyXPMultiplier) / 100;
|
|
|
|
// Calculate the result based on the multiplier
|
|
if (partyMultiplierOption == 0)
|
|
{
|
|
__result = startingXP;
|
|
}
|
|
else
|
|
{
|
|
float baseMultiplier = 1.0f - 0.1f * num; // Original multiplier logic
|
|
float adjustedMultiplier = partyMultiplierOption + (1 - partyMultiplierOption) * baseMultiplier;
|
|
Log.Out("GetPartyXP baseMultiplier: " + baseMultiplier);
|
|
Log.Out("GetPartyXP adjustedMultiplier: " + adjustedMultiplier);
|
|
__result = (int)(startingXP * adjustedMultiplier);
|
|
}
|
|
|
|
Log.Out("GetPartyXP startingXP: " + startingXP);
|
|
|
|
Log.Out("GetPartyXP XP: " + __result);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|