874 lines
40 KiB
C#
874 lines
40 KiB
C#
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
|
|
namespace Harmony.EntityGroupsPatches
|
|
{
|
|
[HarmonyPatch(typeof(EntityGroups))]
|
|
[HarmonyPatch("IsEnemyGroup")]
|
|
public class IsEnemyGroupPatch
|
|
{
|
|
public static bool Prefix(EntityGroups __instance, ref bool __result, string _sEntityGroupName)
|
|
{
|
|
List<SEntityClassAndProb> list = EntityGroups.list[_sEntityGroupName];
|
|
try
|
|
{
|
|
__result = list != null && list.Count >= 1 && EntityClass.list[list[0].entityClassId].bIsEnemyEntity;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Log.Out("=====================================================================================");
|
|
Log.Out("EntityGroupsPatches-IsEnemyGroup _sEntityGroupName: " + _sEntityGroupName);
|
|
Log.Out("=====================================================================================");
|
|
__result = false;
|
|
return false;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(EntityGroups))]
|
|
[HarmonyPatch("GetRandomFromGroupList")]
|
|
public class GetRandomFromGroupListPatch
|
|
{
|
|
public static bool Prefix(EntityGroups __instance, ref int __result, List<SEntityClassAndProb> grpList, GameRandom random)
|
|
{
|
|
float randomFloat = random.RandomFloat;
|
|
float num = 0f;
|
|
for (int i = 0; i < grpList.Count; i++)
|
|
{
|
|
SEntityClassAndProb sentityClassAndProb = grpList[i];
|
|
|
|
num += sentityClassAndProb.prob;
|
|
if (randomFloat <= num && sentityClassAndProb.prob > 0f)
|
|
{
|
|
if (sentityClassAndProb.entityClassId != 0)
|
|
{
|
|
string optionDemos = RebirthVariables.customDemos;
|
|
string optionKamikaze = RebirthVariables.customKamikaze;
|
|
string optionSeekers = RebirthVariables.customSeekers;
|
|
bool isHordeNight = RebirthUtilities.IsHordeNight();
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroupList entityClassId: " + sentityClassAndProb.entityClassId);
|
|
|
|
if (EntityClass.list[sentityClassAndProb.entityClassId].entityClassName.ToLower() == "zombiedemolition")
|
|
{
|
|
if (isHordeNight && optionDemos == "nothordenight")
|
|
{
|
|
continue;
|
|
}
|
|
else if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
__result = sentityClassAndProb.entityClassId;
|
|
return false;
|
|
}
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroupList B entityClassName: " + EntityClass.list[sentityClassAndProb.entityClassId].entityClassName);
|
|
}
|
|
else if (EntityClass.list[sentityClassAndProb.entityClassId].entityClassName.ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (isHordeNight && optionDemos == "nothordenight")
|
|
{
|
|
continue;
|
|
}
|
|
else if (optionKamikaze == "nothordenightpoi")
|
|
{
|
|
continue;
|
|
}
|
|
else if (optionKamikaze == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.list[sentityClassAndProb.entityClassId].entityClassName.ToLower().Contains("furiousramsayseeker"))
|
|
{
|
|
if (isHordeNight && optionSeekers == "nothordenight")
|
|
{
|
|
continue;
|
|
}
|
|
else if (optionSeekers == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroupList A entityClassName: " + EntityClass.list[sentityClassAndProb.entityClassId].entityClassName);
|
|
__result = sentityClassAndProb.entityClassId;
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
__result = sentityClassAndProb.entityClassId;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
__result = -1;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(EntityGroups))]
|
|
[HarmonyPatch("GetRandomFromGroup")]
|
|
public class GetRandomFromGroupPatch
|
|
{
|
|
public static bool Prefix(EntityGroups __instance, ref int __result, string _sEntityGroupName, ref int lastClassId, GameRandom random = null)
|
|
{
|
|
MethodBase caller = new StackTrace().GetFrame(4).GetMethod();
|
|
string callerMethodName = caller.Name;
|
|
string callerClassName = caller.ReflectedType.Name;
|
|
string calledMethodName = MethodBase.GetCurrentMethod().Name;
|
|
|
|
MethodBase caller2 = new StackTrace().GetFrame(3).GetMethod();
|
|
string callerMethodName2 = caller2.Name;
|
|
string callerClassName2 = caller2.ReflectedType.Name;
|
|
|
|
var reflectedType = caller2.ReflectedType;
|
|
string callerClassName3 = "";
|
|
|
|
if (reflectedType.Name.Contains(">d__"))
|
|
{
|
|
// Get the parent type (likely the actual class containing the method)
|
|
var declaringType = reflectedType.DeclaringType;
|
|
callerClassName3 = declaringType.Name;
|
|
}
|
|
|
|
string optionDemos = RebirthVariables.customDemos;
|
|
string optionKamikaze = RebirthVariables.customKamikaze;
|
|
string optionSeekers = RebirthVariables.customSeekers;
|
|
string optionTornado = RebirthVariables.customTornados;
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup callerClassName: " + callerClassName);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup callerMethodName: " + callerMethodName);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup calledMethodName: " + calledMethodName);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup _sEntityGroupName: " + _sEntityGroupName);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup callerClassName2: " + callerClassName2);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup callerMethodName2: " + callerMethodName2);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup callerClassName3: " + callerClassName3);
|
|
|
|
//Log.Out("StackTrace: '{0}'", Environment.StackTrace);
|
|
|
|
string _name = _sEntityGroupName.ToLower();
|
|
|
|
bool isSleeper = (callerClassName.ToLower().Contains("sleepervolume") || callerClassName.ToLower().Contains("updatespawnpatch") || callerMethodName.ToLower().Contains("sleepervolume") || callerMethodName.ToLower().Contains("updatespawnpatch") ||
|
|
callerClassName2.ToLower().Contains("sleepervolume") || callerClassName2.ToLower().Contains("updatespawnpatch") || callerMethodName2.ToLower().Contains("sleepervolume") || callerMethodName2.ToLower().Contains("updatespawnpatch"));
|
|
|
|
|
|
if (_name.Contains("animal") ||
|
|
_name.Contains("vulture") ||
|
|
_name.Contains("dog") ||
|
|
_name.Contains("bear") ||
|
|
_name.Contains("wolf") ||
|
|
_name.Contains("snake") ||
|
|
_name.Contains("boar") ||
|
|
_name.Contains("grace") ||
|
|
_name.Contains("wildgame") ||
|
|
_name.Contains("zombiedemolition")
|
|
)
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup NOT VALID, _sEntityGroupName: " + _sEntityGroupName);
|
|
|
|
if (isSleeper && (_name.Contains("snake") || _name.Contains("boar") || _name.Contains("chicken")))
|
|
{
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
int gameStage = 0;
|
|
float multiplierGamestage = float.Parse(RebirthVariables.customGamestageMultiplier) / 100;
|
|
|
|
if (callerClassName.ToLower().Contains("spawnmanagerbiomes") || callerMethodName.ToLower().Contains("spawnmanagerbiomes") ||
|
|
callerClassName2.ToLower().Contains("spawnmanagerbiomes") || callerMethodName2.ToLower().Contains("spawnmanagerbiomes")
|
|
)
|
|
{
|
|
gameStage = (int)(RebirthVariables.biomeGameStage * multiplierGamestage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BIOME gameStage: " + gameStage);
|
|
|
|
__result = 0;
|
|
|
|
//System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
|
|
//watch.Start();
|
|
|
|
(int min, int max) key;
|
|
|
|
if (RebirthUtilities.ScenarioSkip())
|
|
{
|
|
key = (1, 1);
|
|
}
|
|
else
|
|
{
|
|
key = RebirthUtilities.GetGamestageFloorAndCeiling(gameStage, RebirthUtilities.biomeGroups);
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup key.min: " + key.min);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup key.max: " + key.max);
|
|
|
|
if (RebirthUtilities.biomeGroups.TryGetValue(key, out List<int> entities))
|
|
{
|
|
//for (int i = 0; i < entities.Count; i++)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BIOME Entity: " + EntityClass.GetEntityClassName(entities[i]));
|
|
//}
|
|
|
|
int foundAt = -1;
|
|
|
|
for (int i = 0; i < 250; i++)
|
|
{
|
|
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count - 1);
|
|
|
|
if (entities[randomValue] == lastClassId)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup lastClassId: " + lastClassId);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[randomValue]: " + entities[randomValue]);
|
|
|
|
if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (optionKamikaze == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "zombiedemolition")
|
|
{
|
|
if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "furiousramsaywindtornado")
|
|
{
|
|
if (!(optionTornado == "biomesonly" ||
|
|
optionTornado == "always")
|
|
)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup randomValue: " + randomValue);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BIOME SPAWNED GetEntityClassName: " + EntityClass.GetEntityClassName(entities[randomValue]));
|
|
|
|
lastClassId = entities[randomValue];
|
|
__result = entities[randomValue];
|
|
foundAt = i;
|
|
break;
|
|
}
|
|
|
|
//watch.Stop();
|
|
////Log.Out("EntityGroupsPatches-GetRandomFromGroup time to process: " + watch.ElapsedMilliseconds + " ms");
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup foundAt: " + foundAt);
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (callerClassName.ToLower().Contains("baseaction") && callerClassName2.ToLower().Contains("actionbasespawn")
|
|
)
|
|
{
|
|
try
|
|
{
|
|
gameStage = RebirthUtilities.GetIntegerFromString(_sEntityGroupName);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Out("EntityGroupsPatches-GetRandomFromGroup BASEACTION CANNOT GET GAMESTAGE _sEntityGroupName: " + _sEntityGroupName);
|
|
return true;
|
|
}
|
|
|
|
gameStage = (int)(gameStage * multiplierGamestage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BASEACTION multiplierGamestage: " + multiplierGamestage);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BASEACTION gameStage: " + gameStage);
|
|
|
|
__result = 0;
|
|
|
|
(int min, int max) key;
|
|
|
|
if (RebirthUtilities.ScenarioSkip())
|
|
{
|
|
key = (1, 1);
|
|
}
|
|
else
|
|
{
|
|
key = RebirthUtilities.GetGamestageFloorAndCeiling(gameStage, RebirthUtilities.generalGroups);
|
|
}
|
|
|
|
if (RebirthUtilities.generalGroups.TryGetValue(key, out List<int> entities))
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BASEACTION entities.Count: " + entities.Count);
|
|
|
|
//for (int i = 0; i < entities.Count; i++)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup Entity: " + EntityClass.GetEntityClassName(entities[i]));
|
|
//}
|
|
|
|
for (int i = 0; i < 250; i++)
|
|
{
|
|
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count - 1);
|
|
|
|
if (entities[randomValue] == lastClassId)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup lastClassId: " + lastClassId);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[randomValue]: " + entities[randomValue]);
|
|
|
|
if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("zombiestevecrawler"))
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (optionKamikaze == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "zombiedemolition")
|
|
{
|
|
if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "furiousramsaywindtornado")
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClass(entities[randomValue]).Tags.Test_AllSet(FastTags<TagGroup.Global>.Parse("animal")))
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup IS ANIMAL, SKIPPING");
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup randomValue: " + randomValue);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BASEACTION SPAWNED GetEntityClassName: " + EntityClass.GetEntityClassName(entities[randomValue]));
|
|
|
|
lastClassId = entities[randomValue];
|
|
__result = entities[randomValue];
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (callerClassName3.ToLower() == "questactionspawngsenemy"
|
|
)
|
|
{
|
|
//try
|
|
//{
|
|
//gameStage = RebirthUtilities.GetIntegerFromString(_sEntityGroupName);
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup QUESTACTION CANNOT GET GAMESTAGE _sEntityGroupName: " + _sEntityGroupName);
|
|
//return true;
|
|
//}
|
|
|
|
gameStage = (int)(RebirthVariables.gameStage * multiplierGamestage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup QUESTACTION multiplierGamestage: " + multiplierGamestage);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup QUESTACTION gameStage: " + gameStage);
|
|
|
|
__result = 0;
|
|
|
|
(int min, int max) key;
|
|
|
|
if (RebirthUtilities.ScenarioSkip())
|
|
{
|
|
key = (1, 1);
|
|
}
|
|
else
|
|
{
|
|
key = RebirthUtilities.GetGamestageFloorAndCeiling(gameStage, RebirthUtilities.generalGroups);
|
|
}
|
|
|
|
if (RebirthUtilities.generalGroups.TryGetValue(key, out List<int> entities))
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup QUESTACTION entities.Count: " + entities.Count);
|
|
|
|
//for (int i = 0; i < entities.Count; i++)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup Entity: " + EntityClass.GetEntityClassName(entities[i]));
|
|
//}
|
|
|
|
for (int i = 0; i < 250; i++)
|
|
{
|
|
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count - 1);
|
|
|
|
if (entities[randomValue] == lastClassId)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup lastClassId: " + lastClassId);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[randomValue]: " + entities[randomValue]);
|
|
|
|
if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("zombiestevecrawler"))
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (optionKamikaze == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "zombiedemolition")
|
|
{
|
|
if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "furiousramsaywindtornado")
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClass(entities[randomValue]).Tags.Test_AllSet(FastTags<TagGroup.Global>.Parse("animal")))
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup IS ANIMAL, SKIPPING");
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup randomValue: " + randomValue);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup QUESTACTION SPAWNED GetEntityClassName: " + EntityClass.GetEntityClassName(entities[randomValue]));
|
|
|
|
lastClassId = entities[randomValue];
|
|
__result = entities[randomValue];
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (callerClassName.ToLower().Contains("aiwanderinghordespawner") || callerMethodName.ToLower().Contains("aiwanderinghordespawner") ||
|
|
callerClassName2.ToLower().Contains("aiwanderinghordespawner") || callerMethodName2.ToLower().Contains("aiwanderinghordespawner")
|
|
)
|
|
{
|
|
gameStage = (int)(RebirthVariables.wanderingHordeGameStage * multiplierGamestage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup WANDERING RebirthVariables.wanderingHordeGameStage: " + RebirthVariables.wanderingHordeGameStage);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup WANDERING multiplierGamestage: " + multiplierGamestage);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup WANDERING gameStage: " + gameStage);
|
|
|
|
__result = 0;
|
|
|
|
(int min, int max) key;
|
|
|
|
if (RebirthUtilities.ScenarioSkip())
|
|
{
|
|
key = (1, 1);
|
|
}
|
|
else
|
|
{
|
|
key = RebirthUtilities.GetGamestageFloorAndCeiling(gameStage, RebirthUtilities.generalGroups);
|
|
}
|
|
|
|
if (RebirthUtilities.generalGroups.TryGetValue(key, out List<int> entities))
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup WANDERING entities.Count: " + entities.Count);
|
|
|
|
//for (int i = 0; i < entities.Count; i++)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup Entity: " + EntityClass.GetEntityClassName(entities[i]));
|
|
//}
|
|
|
|
for (int i = 0; i < 250; i++)
|
|
{
|
|
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count - 1);
|
|
|
|
if (entities[randomValue] == lastClassId)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup lastClassId: " + lastClassId);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[randomValue]: " + entities[randomValue]);
|
|
|
|
if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("zombiestevecrawler"))
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (optionKamikaze == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "zombiedemolition")
|
|
{
|
|
if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "furiousramsaywindtornado")
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClass(entities[randomValue]).Tags.Test_AllSet(FastTags<TagGroup.Global>.Parse("animal")))
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup IS ANIMAL, SKIPPING");
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup randomValue: " + randomValue);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup WANDERING HORDE SPAWNED GetEntityClassName: " + EntityClass.GetEntityClassName(entities[randomValue]));
|
|
|
|
lastClassId = entities[randomValue];
|
|
__result = entities[randomValue];
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (callerClassName.ToLower().Contains("aidirectorbloodmoonparty") || callerMethodName.ToLower().Contains("aidirectorbloodmoonparty") ||
|
|
callerClassName2.ToLower().Contains("aidirectorbloodmoonparty") || callerMethodName2.ToLower().Contains("aidirectorbloodmoonparty")
|
|
)
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BLOOD MOON: " + _sEntityGroupName);
|
|
|
|
if (_sEntityGroupName.ToLower().Contains("feralhordestagegs"))
|
|
{
|
|
try
|
|
{
|
|
gameStage = int.Parse(_sEntityGroupName.Replace("feralHordeStageGS", ""));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Out("EntityGroupsPatches-GetRandomFromGroup CANNOT GET GAMESTAGE _sEntityGroupName: " + _sEntityGroupName);
|
|
return true;
|
|
}
|
|
|
|
__result = 0;
|
|
|
|
gameStage = (int)(gameStage * multiplierGamestage);
|
|
|
|
(int min, int max) key = RebirthUtilities.GetGamestageFloorAndCeiling(gameStage, RebirthUtilities.bloodMoonGroups);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup B key.min: " + key.min);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup B key.max: " + key.max);
|
|
|
|
bool isHordeNight = RebirthUtilities.IsHordeNight();
|
|
|
|
if (RebirthUtilities.bloodMoonGroups.TryGetValue(key, out List<int> entities))
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup B entities.Count: " + entities.Count);
|
|
|
|
//for (int i = 0; i < entities.Count; i++)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[" + i + "]: " + EntityClass.GetEntityClassName(entities[i]));
|
|
//}
|
|
|
|
for (int i = 0; i < 250; i++)
|
|
{
|
|
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count - 1);
|
|
|
|
if (entities[randomValue] == lastClassId)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup lastClassId: " + lastClassId);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[randomValue]: " + entities[randomValue]);
|
|
|
|
if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("zombiestevecrawler"))
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (optionKamikaze == "ttnothordenight" ||
|
|
optionKamikaze == "ttnothordenightpoi" ||
|
|
optionKamikaze == "never"
|
|
)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsayseeker"))
|
|
{
|
|
if (optionSeekers == "ttnothordenight" ||
|
|
optionSeekers == "never"
|
|
)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "zombiedemolition")
|
|
{
|
|
if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "furiousramsaywindtornado")
|
|
{
|
|
if (!(optionTornado == "hordenightonly" ||
|
|
optionTornado == "always"))
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup randomValue: " + randomValue);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup BLOOD MOON SPAWNED GetEntityClassName: " + EntityClass.GetEntityClassName(entities[randomValue]));
|
|
|
|
lastClassId = entities[randomValue];
|
|
__result = entities[randomValue];
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
else if (callerClassName.ToLower().Contains("aihordespawner") || callerMethodName.ToLower().Contains("aihordespawner") ||
|
|
callerClassName2.ToLower().Contains("aihordespawner") || callerMethodName2.ToLower().Contains("aihordespawner")
|
|
)
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup _sEntityGroupName:" + _sEntityGroupName);
|
|
|
|
if (_sEntityGroupName.ToLower().Contains("scouthordestagegs"))
|
|
{
|
|
try
|
|
{
|
|
gameStage = int.Parse(_sEntityGroupName.Replace("scoutHordeStageGS", ""));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup CANNOT GET GAMESTAGE _sEntityGroupName: " + _sEntityGroupName);
|
|
return true;
|
|
}
|
|
|
|
__result = 0;
|
|
gameStage = (int)(gameStage * multiplierGamestage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup SCREAMER gameStage: " + gameStage);
|
|
|
|
(int min, int max) key;
|
|
|
|
if (RebirthUtilities.ScenarioSkip())
|
|
{
|
|
key = (1, 1);
|
|
}
|
|
else
|
|
{
|
|
key = RebirthUtilities.GetGamestageFloorAndCeiling(gameStage, RebirthUtilities.generalGroups);
|
|
}
|
|
|
|
bool isHordeNight = RebirthUtilities.IsHordeNight();
|
|
|
|
if (RebirthUtilities.generalGroups.TryGetValue(key, out List<int> entities))
|
|
{
|
|
//for (int i = 0; i < entities.Count; i++)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[" + i + "]: " + EntityClass.GetEntityClassName(entities[i]));
|
|
//}
|
|
|
|
for (int i = 0; i < 250; i++)
|
|
{
|
|
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count - 1);
|
|
|
|
if (entities[randomValue] == lastClassId)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup lastClassId: " + lastClassId);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[randomValue]: " + entities[randomValue]);
|
|
|
|
if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("zombiestevecrawler"))
|
|
{
|
|
continue;
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (optionKamikaze == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "zombiedemolition")
|
|
{
|
|
if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "furiousramsaywindtornado")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup randomValue: " + randomValue);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup SCOUT SPAWNED GetEntityClassName: " + EntityClass.GetEntityClassName(entities[randomValue]));
|
|
|
|
lastClassId = entities[randomValue];
|
|
__result = entities[randomValue];
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (callerClassName.ToLower().Contains("sleepervolume") || callerClassName.ToLower().Contains("updatespawnpatch") || callerMethodName.ToLower().Contains("sleepervolume") || callerMethodName.ToLower().Contains("updatespawnpatch") ||
|
|
callerClassName2.ToLower().Contains("sleepervolume") || callerClassName2.ToLower().Contains("updatespawnpatch") || callerMethodName2.ToLower().Contains("sleepervolume") || callerMethodName2.ToLower().Contains("updatespawnpatch")
|
|
)
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup IS FROM SLEEPERVOLUME");
|
|
|
|
gameStage = RebirthVariables.gameStage;
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup gameStage BEFORE MULTIPLIER: " + gameStage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup IS VALID, _sEntityGroupName: " + _sEntityGroupName);
|
|
|
|
__result = 0;
|
|
gameStage = (int)(gameStage * multiplierGamestage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup gameStage AFTER MULTIPLIER: " + gameStage);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup SLEEPER gameStage: " + gameStage);
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup SLEEPER RebirthVariables.prefabDifficulty: " + RebirthVariables.prefabDifficulty);
|
|
|
|
(int min, int max) key;
|
|
|
|
if (RebirthUtilities.ScenarioSkip())
|
|
{
|
|
key = (1, 1);
|
|
}
|
|
else
|
|
{
|
|
key = RebirthUtilities.GetGamestageFloorAndCeiling(gameStage, RebirthUtilities.generalGroups);
|
|
}
|
|
|
|
bool isHordeNight = RebirthUtilities.IsHordeNight();
|
|
|
|
if (RebirthUtilities.generalGroups.TryGetValue(key, out List<int> entities))
|
|
{
|
|
//for (int i = 0; i < entities.Count; i++)
|
|
//{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[" + i + "]: " + EntityClass.GetEntityClassName(entities[i]));
|
|
//}
|
|
|
|
for (int i = 0; i < 250; i++)
|
|
{
|
|
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count - 1);
|
|
|
|
if (entities[randomValue] == lastClassId)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup lastClassId: " + lastClassId);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup entities[randomValue]: " + entities[randomValue]);
|
|
|
|
if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower().Contains("furiousramsaykamikaze"))
|
|
{
|
|
if (isHordeNight && optionDemos == "nothordenight")
|
|
{
|
|
continue;
|
|
}
|
|
else if (optionKamikaze == "notpoi")
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup SKIPPED KAMIKAZE");
|
|
continue;
|
|
}
|
|
else if (optionKamikaze == "nothordenightpoi")
|
|
{
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup SKIPPED KAMIKAZE");
|
|
continue;
|
|
}
|
|
else if (optionKamikaze == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "zombiedemolition")
|
|
{
|
|
if (isHordeNight && optionDemos == "nothordenight")
|
|
{
|
|
continue;
|
|
}
|
|
else if (optionDemos == "never")
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
else if (EntityClass.GetEntityClassName(entities[randomValue]).ToLower() == "furiousramsaywindtornado")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup randomValue: " + randomValue);
|
|
//Log.Out("EntityGroupsPatches-GetRandomFromGroup SLEEPER SPAWNED GetEntityClassName: " + EntityClass.GetEntityClassName(entities[randomValue]));
|
|
|
|
lastClassId = entities[randomValue];
|
|
__result = entities[randomValue];
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|