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
+26638
View File
@@ -0,0 +1,26638 @@
using Audio;
using Platform;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using UnityEngine;
using static RebirthManager;
using static RebirthVariables;
using static UIPopupList;
using static WorldGenerationEngineFinal.WorldBuilder;
public enum LBDType
{
Class,
Expertise,
Genetics
}
public class NearestPathSorter : IComparer<Vector3>
{
public NearestPathSorter(Entity _self)
{
this.self = _self;
}
public int Compare(Vector3 _obj1, Vector3 _obj2)
{
var distanceSq = this.self.GetDistanceSq(_obj1);
var distanceSq2 = this.self.GetDistanceSq(_obj2);
if (distanceSq < distanceSq2)
return -1;
if (distanceSq > distanceSq2)
return 1;
return 0;
}
private Entity self;
}
public static class EntityTargetingUtilities
{
public static bool CanTakeDamage(EntityAlive self, EntityAlive damagingEntity)
{
if (self == null) return true;
// If it's dead, offer no such protection.
if (self.IsDead()) return true;
// If the damage was not caused by a living entity, take that damage.
if (!(damagingEntity is EntityAlive livingEntity))
return true;
return EntityUtilities.VerifyFactionStanding(damagingEntity, self);
}
}
public class EntityUtilities : RebirthUtilities
{
public enum Orders
{
None = 0,
Follow = 1,
Stay = 2,
Wander = 3,
SetPatrolPoint = 4,
Patrol = 5,
Hire = 6,
Loot = 7,
Task = 8,
Guard = 9,
TempStay = 10
}
}
public class ModGeneralUtilities : RebirthUtilities
{
}
public class RebirthUtilities
{
public static Dictionary<int, Entity> LeaderCache = new Dictionary<int, Entity>();
private static readonly CachedStringFormatterXuiRgbaColor durabilitycolorFormatter = new CachedStringFormatterXuiRgbaColor();
public static List<RecipeOutputRebirth> recipeOutputs = new List<RecipeOutputRebirth>();
public static List<int>[] baseGamestageEntities = new List<int>[99];
public static List<int>[] biomeGamestageEntities = new List<int>[99];
public static List<int>[] hordeNightGamestageEntities = new List<int>[99];
public static List<int> banditsMale = new List<int>();
public static List<int> banditsFemale = new List<int>();
public static List<int> survivorsMale = new List<int>();
public static List<int> survivorsFemale = new List<int>();
public static List<int> banditsLow = new List<int>();
public static List<int> banditsLowMed = new List<int>();
public static List<int> banditsMed = new List<int>();
public static List<int> banditsMedHigh = new List<int>();
public static List<int> banditsHigh = new List<int>();
public static List<int> survivorsLow = new List<int>();
public static List<int> survivorsLowMed = new List<int>();
public static List<int> survivorsMed = new List<int>();
public static List<int> survivorsMedHigh = new List<int>();
public static List<int> survivorsHigh = new List<int>();
public static List<int> biomesLow = new List<int>();
public static List<int> biomesMed = new List<int>();
public static List<int> biomesHigh = new List<int>();
public static List<int> biomesVeryHigh = new List<int>();
public static List<int> tornadosLow = new List<int>();
public static List<int> tornadosMed = new List<int>();
public static List<int> tornadosHigh = new List<int>();
public static List<int> hordeNightLowLow = new List<int>();
public static List<int> hordeNightLowMed = new List<int>();
public static List<int> hordeNightLowHigh = new List<int>();
public static List<int> hordeNightMedLow = new List<int>();
public static List<int> hordeNightMedMed = new List<int>();
public static List<int> hordeNightMedHigh = new List<int>();
public static List<int> hordeNightHighLow = new List<int>();
public static List<int> hordeNightHighMed = new List<int>();
public static List<int> hordeNightHighHigh = new List<int>();
public static List<int> hordeNightVeryHighLow = new List<int>();
public static List<int> hordeNightVeryHighMed = new List<int>();
public static List<int> hordeNightVeryHighHigh = new List<int>();
public static List<int> hordeNightPlusLow = new List<int>();
public static List<int> hordeNightPlusMed = new List<int>();
public static List<int> hordeNightPlusHigh = new List<int>();
public static List<int> hordeNightPlusVeryHigh = new List<int>();
public static List<int> zombieSupportLow = new List<int>();
public static List<int> zombieSupportMedium = new List<int>();
public static List<int> zombieSupportHigh = new List<int>();
public static List<int> zombieSupportVeryHigh = new List<int>();
public static List<int> zombieAnimalsBossesLow = new List<int>();
public static List<int> zombieAnimalsBossesMedium = new List<int>();
public static List<int> zombieAnimalsBossesHigh = new List<int>();
public static List<int> zombieAnimalsLow = new List<int>();
public static List<int> zombieAnimalsMedium = new List<int>();
public static List<int> zombieAnimalsHigh = new List<int>();
public static List<int> forestGroup = new List<int>();
public static List<int> desertGroup = new List<int>();
public static List<int> snowGroup = new List<int>();
public static List<int> wastelandGroup = new List<int>();
public static List<int> burntGroup = new List<int>();
public static List<int> sleepersLow = new List<int>();
public static List<int> sleepersLowMed = new List<int>();
public static List<int> sleepersMed = new List<int>();
public static List<int> sleepersHigh = new List<int>();
public static List<int> sleepersFeralLow = new List<int>();
public static List<int> sleepersFeralMed = new List<int>();
public static List<int> sleepersFeralHigh = new List<int>();
public static List<int> sleepersRadiatedLow = new List<int>();
public static List<int> sleepersRadiatedMed = new List<int>();
public static List<int> sleepersRadiatedHigh = new List<int>();
public static List<int> sleepersTaintedLow = new List<int>();
public static List<int> sleepersTaintedMed = new List<int>();
public static List<int> sleepersTaintedHigh = new List<int>();
public static List<HNPGroupRebirth> HNPGroups = new List<HNPGroupRebirth>();
public static Dictionary<(int min, int max), List<int>> generalGroups = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> generalGroupsForest = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> generalGroupsDesert = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> generalGroupsSnow = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> generalGroupsWasteland = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> generalGroupsBurnt = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> biomeGroups = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> biomeGroupsNPCs = new Dictionary<(int, int), List<int>>();
public static Dictionary<(int min, int max), List<int>> bloodMoonGroups = new Dictionary<(int, int), List<int>>();
public static float maxDistanceToLeader = 60f;
/*public static IEnumerator UpdateBlocks()
{
RebirthVariables.updatingBlocks = true;
yield return new WaitForSeconds(1f);
List<BlockChangeInfo> blockChangesToProcess;
// Lock to safely swap lists
lock (RebirthVariables.lockObject)
{
if (RebirthVariables.blockChanges.Count == 0)
{
RebirthVariables.updatingBlocks = false;
yield break;
}
// Swap lists
blockChangesToProcess = RebirthVariables.blockChanges;
RebirthVariables.blockChanges = RebirthVariables.pendingBlockChanges;
RebirthVariables.pendingBlockChanges = new List<BlockChangeInfo>();
}
// Process blocks safely
GameManager.Instance.World.SetBlocksRPC(blockChangesToProcess);
RebirthVariables.updatingBlocks = false;
}*/
public static bool canAttack(EntityAlive entity)
{
return entity.sleepingOrWakingUp ||
entity.bodyDamage.CurrentStun != EnumEntityStunType.None ||
(entity.Jumping && !entity.isSwimming) ||
entity.emodel.IsRagdollActive ||
entity.emodel.avatarController.IsAnimationStunRunning() ||
(!entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("skip,template,invisible")) && !entity.IsEating && entity.emodel.avatarController.anim.IsInTransition(0)) ||
RebirthUtilities.HasBuffLike(entity, "FuriousRamsayRangedStun");
}
public static bool canAttack2(EntityAlive entity)
{
return entity.emodel.IsRagdollActive ||
entity.emodel.avatarController.IsAnimationStunRunning() ||
(!entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("skip,template,invisible")) && !entity.IsEating && entity.emodel.avatarController.anim.IsInTransition(0)) ||
RebirthUtilities.HasBuffLike(entity, "FuriousRamsayRangedStun") && !entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("ally"));
}
public static void SetHiveSpawnGroup(string biomeName)
{
//Log.Out("RebirthUtilities-SetHiveSpawnGroup START: " + biomeName);
if (biomeName == "forest" || biomeName == "pine_forest")
{
//Log.Out("RebirthUtilities-SetHiveSpawnGroup biomeName: " + biomeName);
RebirthUtilities.generalGroups = RebirthUtilities.generalGroupsForest;
RebirthUtilities.biomeGroups = RebirthUtilities.generalGroupsForest;
}
else if (biomeName == "desert")
{
//Log.Out("RebirthUtilities-SetHiveSpawnGroup biomeName: " + biomeName);
RebirthUtilities.generalGroups = RebirthUtilities.generalGroupsDesert;
RebirthUtilities.biomeGroups = RebirthUtilities.generalGroupsDesert;
}
else if (biomeName == "snow")
{
//Log.Out("RebirthUtilities-SetHiveSpawnGroup biomeName: " + biomeName);
RebirthUtilities.generalGroups = RebirthUtilities.generalGroupsSnow;
RebirthUtilities.biomeGroups = RebirthUtilities.generalGroupsSnow;
}
else if (biomeName == "wasteland")
{
//Log.Out("RebirthUtilities-SetHiveSpawnGroup biomeName: " + biomeName);
RebirthUtilities.generalGroups = RebirthUtilities.generalGroupsWasteland;
RebirthUtilities.biomeGroups = RebirthUtilities.generalGroupsWasteland;
}
else if (biomeName == "burnt_forest")
{
//Log.Out("RebirthUtilities-SetHiveSpawnGroup biomeName: " + biomeName);
RebirthUtilities.generalGroups = RebirthUtilities.generalGroupsBurnt;
RebirthUtilities.biomeGroups = RebirthUtilities.generalGroupsBurnt;
}
}
public static bool IsHiveDayActive()
{
return !RebirthVariables.activateHiveDayCycle || RebirthUtilities.GetDayOfWeek() != 2;
}
public static int GetDayOfWeek()
{
return GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime) % 7;
}
public static string GetTimeRemainingMS(float randomWeaponUpdateTick, float randomWeaponUpdateCheck)
{
float timeLeft = randomWeaponUpdateTick - (Time.time - randomWeaponUpdateCheck);
if (timeLeft <= 0) return "0[ffffff]s[-]";
int minutes = Mathf.FloorToInt(timeLeft / 60);
int seconds = Mathf.FloorToInt(timeLeft % 60);
return $"{minutes}[ffffff]m[-] {seconds}[ffffff]s[-]";
}
public static void RefreshRandomWeapons(EntityPlayerLocal player)
{
RebirthVariables.randomWeaponInitiated = true;
int questTier = player.QuestJournal.GetCurrentFactionTier((byte)1);
int random = Manager.random.RandomRange(questTier, questTier + 2);
if (questTier == 5)
{
random = questTier;
}
questTier = random;
RebirthVariables.randomWeapons.Clear();
int index = 0;
List<string> items = new List<string>();
List<WeaponType> types = new List<WeaponType>();
for (int i = 0; i < 100; i++)
{
string weaponType = "Melee";
WeaponType type = new WeaponType();
type = WeaponType.Melee;
random = Manager.random.RandomRange(1, 3);
if (random > 1)
{
weaponType = "Ranged";
type = WeaponType.Ranged;
}
string lootGroup = $"groupWeapons{weaponType}T{questTier}_FR";
List<LootContainer.LootEntry> lootGroupEntries = RebirthUtilities.GetLootGroupEntries(lootGroup);
random = Manager.random.RandomRange(0, lootGroupEntries.Count);
ItemValue itemValue = lootGroupEntries[random].item.itemValue;
int minModSlots = 2;
int maxModSlots = 7;
if (questTier < 3)
{
minModSlots = 3;
maxModSlots = 5;
}
else if (questTier == 3)
{
minModSlots = 3;
maxModSlots = 6;
}
else
{
minModSlots = 4;
maxModSlots = 7;
}
itemValue = new ItemValue(itemValue.type);
//itemValue.Modifications = new ItemValue[Manager.random.RandomRange(minModSlots, maxModSlots + 1)];
string bonusName = RebirthVariables.weaponAura[Manager.random.RandomRange(0, RebirthVariables.weaponAura.Count)];
string bonusType = "aura";
int bonusLevel = Manager.random.RandomRange(1, questTier + 1);
itemValue.SetMetadata("bonus", bonusName, TypedMetadataValue.TypeTag.String);
itemValue.SetMetadata("type", bonusType, TypedMetadataValue.TypeTag.String);
itemValue.SetMetadata("level", bonusLevel, TypedMetadataValue.TypeTag.Integer);
itemValue.SetMetadata("active", 0, TypedMetadataValue.TypeTag.Integer);
/*if (itemValue.ItemClass.Name == "gunShotgunT2PumpShotgun")
{
Log.Out("============================================================================");
Log.Out("EntityPlayerLocalPatches-OnUpdateLive itemValue.ItemClass.Name:" + itemValue.ItemClass.Name);
Log.Out("EntityPlayerLocalPatches-OnUpdateLive MagazineSize:" + (int)EffectManager.GetValue(PassiveEffects.MagazineSize, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive AttacksPerMinute:" + (int)EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive RoundsPerMinute:" + (int)EffectManager.GetValue(PassiveEffects.RoundsPerMinute, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive EntityDamage:" + (int)EffectManager.GetValue(PassiveEffects.EntityDamage, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive EntityDamage (Primary):" + (int)EffectManager.GetValue(PassiveEffects.EntityDamage, itemValue, 0, player, null, FastTags<TagGroup.Global>.Parse("primary")));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive EntityDamage (Secondary):" + (int)EffectManager.GetValue(PassiveEffects.EntityDamage, itemValue, 0, player, null, FastTags<TagGroup.Global>.Parse("secondary")));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive BlockDamage:" + (int)EffectManager.GetValue(PassiveEffects.BlockDamage, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive BlockDamage (Primary):" + (int)EffectManager.GetValue(PassiveEffects.BlockDamage, itemValue, 0, player, null, FastTags<TagGroup.Global>.Parse("primary")));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive BlockDamage (Secondary):" + (int)EffectManager.GetValue(PassiveEffects.BlockDamage, itemValue, 0, player, null, FastTags<TagGroup.Global>.Parse("secondary")));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive DegradationMax:" + (int)EffectManager.GetValue(PassiveEffects.DegradationMax, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive DamageFalloffRange:" + (int)EffectManager.GetValue(PassiveEffects.DamageFalloffRange, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive ModSlots:" + (int)EffectManager.GetValue(PassiveEffects.ModSlots, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive StaminaLoss:" + (int)EffectManager.GetValue(PassiveEffects.StaminaLoss, itemValue));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive StaminaLoss (Primary):" + (int)EffectManager.GetValue(PassiveEffects.StaminaLoss, itemValue, 0, player, null, FastTags<TagGroup.Global>.Parse("primary")));
Log.Out("EntityPlayerLocalPatches-OnUpdateLive StaminaLoss (Secondary):" + (int)EffectManager.GetValue(PassiveEffects.StaminaLoss, itemValue, 0, player, null, FastTags<TagGroup.Global>.Parse("secondary")));
}*/
RandomWeapon myWeapon = new RandomWeapon(itemValue, type);
int countMelee = types.Count(item => item == WeaponType.Melee);
int countRanged = types.Count(item => item == WeaponType.Ranged);
int countItems = items.Count(x => x == itemValue.ItemClass.Name);
bool skip = (type == WeaponType.Melee && countMelee == 1) ||
(type == WeaponType.Ranged && countRanged == 2);
if (!skip && countItems < 1)
{
RebirthVariables.randomWeapons.Add(myWeapon);
items.Add(itemValue.ItemClass.Name);
types.Add(type);
index++;
}
if (index == 3)
{
break;
}
}
}
public static int GetTier(ItemClass itemClass)
{
int tier = 0;
if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("durability1")))
{
tier = 1;
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("durability2")))
{
tier = 2;
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("durability3")))
{
tier = 3;
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("durability4")))
{
tier = 4;
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("durability5")))
{
tier = 5;
}
return tier;
}
public static int GetType(ItemClass itemClass)
{
int type = 0;
if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("melee")))
{
type = 1;
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("ranged")))
{
type = 2;
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("armor")))
{
type = 3;
}
return type;
}
public static string GetBlueprint(ItemClass itemClass)
{
string blueprint = "";
if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("melee")))
{
blueprint = "Strength";
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("ranged")))
{
blueprint = "Dexterity";
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("armor")))
{
if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("head")))
{
blueprint = "Intelligence";
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("chest")))
{
blueprint = "Constitution";
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("hands")))
{
blueprint = "Strength";
}
else if (itemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("feet")))
{
blueprint = "Dexterity";
}
}
return blueprint;
}
public static List<LootContainer.LootEntry> GetLootGroupEntries(string lootGroup)
{
if (!LootContainer.lootGroups.ContainsKey(lootGroup))
return new List<LootContainer.LootEntry>();
return LootContainer.lootGroups[lootGroup].items;
}
public static string FormatFloat(float value, int decimalPlaces)
{
return value.ToString($"F{decimalPlaces}");
}
public static string FormatPercentage(float value, int decimalPlaces)
{
return (value * 100).ToString($"F{decimalPlaces}") + "%";
}
public static int GetIntegerFromString(string input)
{
StringBuilder numericPart = new StringBuilder();
foreach (char c in input)
{
if (char.IsDigit(c))
{
numericPart.Append(c);
}
}
// If no digits were found, return 0
if (numericPart.Length == 0)
{
return 0;
}
// Convert the numeric part to an integer
return int.Parse(numericPart.ToString());
}
public static IEnumerator addHiveStarterItems(EntityPlayerLocal entity, float duration)
{
yield return new WaitForSeconds(duration);
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolTorch"), entity, 5);
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("meleeToolAxeT1IronFireaxe"), entity, 1, "", 2, true, 2);
//RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("gunHandgunT0PipePistol"), entity, 1, "", 1, true, 1);
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("medicalFirstAidBandage"), entity, 2);
int random = Manager.random.RandomRange(2, 5);
if (random == 1)
{
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("vehicleMinibikePlaceable"), entity, 1);
}
else if (random == 2)
{
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("vehicleVMMotoGuppyPlaceable"), entity, 1);
}
else if (random == 3)
{
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("vehicleVMVespaPlaceable"), entity, 1);
}
else if (random == 4)
{
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem("vehicleVMVespakartPlaceable"), entity, 1);
}
//RebirthUtilities.addToPlayerBag(ItemClass.GetItem("ammo9mmBulletBall"), entity, 150);
//RebirthUtilities.addToPlayerBag(ItemClass.GetItem("modArmorHelmetLight"), entity, 1);
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("modMeleeClubBurningShaft"), entity, 1);
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("resourceHeadlight"), entity, 1, "", 3);
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("carBattery"), entity, 1, "", 1);
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("smallEngine"), entity, 1, "", 1);
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("partMinibikeWheel_FR"), entity, 1, "", 1);
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("partMinibikeWheel_FR"), entity, 1, "", 1);
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("ammoGasCan"), entity, 2000);
//Log.Out("RebirthUtilities-addHiveStarterItems ENABLED CAMERA A");
if (entity != null && entity.inventory != null)
{
//Log.Out("RebirthUtilities-addHiveStarterItems 1a");
entity.inventory.ForceHoldingItemUpdate();
}
if (entity != null && entity.transform != null)
{
//Log.Out("RebirthUtilities-addHiveStarterItems 2a");
entity.bIntroAnimActive = false;
entity.SetControllable(true);
}
if (entity.windowManager != null)
{
//Log.Out("RebirthUtilities-addHiveStarterItems 3a");
entity.windowManager.ReEnableHUD();
}
entity.EnableCamera(true);
yield break;
}
public static void MoveToSpawnPoint(EntityPlayerLocal __instance, bool enabledPlayer = false)
{
//Log.Out("RebirthUtilities-MoveToSpawnPoint START");
if (__instance.world.IsEditor() || GameUtils.IsWorldEditor() || GameUtils.IsPlaytesting())
{
//Log.Out("RebirthUtilities-MoveToSpawnPoint EXIT");
return;
}
if (RebirthUtilities.ScenarioSkip())
{
//Log.Out("RebirthUtilities-MoveToSpawnPoint HIVE");
if (__instance.Buffs.GetCustomVar("$spawnedIn") == 0f)
{
/*//Log.Out("RebirthUtilities-MoveToSpawnPoint INITIAL SPAWN");
List<PrefabInstance> prefabInstances = new List<PrefabInstance>();
foreach (string prefabName in RebirthVariables.hivePrefab)
{
//Log.Out($"RebirthUtilities-MoveToSpawnPoint FOR EACH {prefabName}");
var matchingInstances = GameManager.Instance.World.ChunkClusters[0].ChunkProvider
.GetDynamicPrefabDecorator()
.GetDynamicPrefabs()
.FindAll(instance => instance.name.Contains(prefabName));
prefabInstances.AddRange(matchingInstances);
}
//Log.Out("RebirthUtilities-MoveToSpawnPoint prefabInstances.Count: " + prefabInstances.Count);
if (prefabInstances.Count > 0)
{
List<PrefabInstance> validPrefabs = new List<PrefabInstance>();
foreach (PrefabInstance prefab in prefabInstances)
{
Vector2 prefabPosition = new Vector2((float)prefab.boundingBoxPosition.x + (float)prefab.boundingBoxSize.x / 2f, (float)prefab.boundingBoxPosition.z + (float)prefab.boundingBoxSize.z / 2f);
//Log.Out("RebirthUtilities-MoveToSpawnPoint prefabPosition: " + prefabPosition);
BiomeDefinition biomeAt = GameManager.Instance.World.ChunkCache.ChunkProvider.GetBiomeProvider().GetBiomeAt((int)prefabPosition.x, (int)prefabPosition.z);
if (biomeAt != null && biomeAt.m_sBiomeName == "pine_forest")
{
//Log.Out("RebirthUtilities-MoveToSpawnPoint biomeAt.m_sBiomeName: " + biomeAt.m_sBiomeName);
validPrefabs.Add(prefab);
}
}
if (validPrefabs.Count > 0)
{
//Log.Out($"RebirthUtilities-MoveToSpawnPoint PARSING VALID PREFABS: {validPrefabs.Count}");
int random = Manager.random.RandomRange(0, validPrefabs.Count);
//Log.Out("RebirthUtilities-MoveToSpawnPoint random: " + random);
PrefabInstance selectedPrefab = validPrefabs[random];
Vector3 prefabPosition = selectedPrefab.boundingBoxPosition;
if (selectedPrefab != null)
{
//Log.Out($"RebirthUtilities-MoveToSpawnPoint {selectedPrefab.name} selectedPrefab.boundingBoxPosition: {selectedPrefab.boundingBoxPosition}");
foreach (TileEntity tile in RebirthUtilities.GetCustomTileEntities(selectedPrefab.boundingBoxPosition, 50, "239"))
{
//Log.Out("RebirthUtilities-MoveToSpawnPoint tile: " + tile.GetTileEntityType());
if (tile is TileEntitySpawnPoint tileEntity)
{
//Log.Out("RebirthUtilities-MoveToSpawnPoint tileEntity.blockValue.Block.blockName: " + tileEntity.blockValue.Block.blockName);
Vector3 vector = tileEntity.ToWorldPos();
vector.y = vector.y + 0.5f;
__instance.SetPosition(vector);
__instance.Buffs.SetCustomVar("$spawnedIn", 1f);
GameManager.Instance.StartCoroutine(addHiveStarterItems(__instance, 4f));
return;
}
}
prefabPosition.y = prefabPosition.y + 1.5f;
__instance.SetPosition(prefabPosition);
//Log.Out("RebirthUtilities-MoveToSpawnPoint AFTER prefabPosition: " + prefabPosition);
__instance.Buffs.SetCustomVar("$spawnedIn", 1f);
GameManager.Instance.StartCoroutine(addHiveStarterItems(__instance, 4f));
}
}
}
else*/
{
__instance.Buffs.SetCustomVar("$spawnedIn", 1f);
GameManager.Instance.StartCoroutine(addHiveStarterItems(__instance, 4f));
}
}
}
else
{
__instance.Buffs.SetCustomVar("$spawnedIn", 1f);
}
}
public static float LootDropChance(int biome)
{
/*
Calculates the loot drop chance based on biome number (0 to 4) with a very gradual increase.
The result grows from 0% to 90%, ensuring a smooth and even progression.
*/
if (biome < 0 || biome > 4)
throw new ArgumentOutOfRangeException("Biome number must be between 0 and 4");
double minChance = 0.0; // 0%
double maxChance = 0.9; // 90%
double k = 0.25; // Controls the smooth progression
double chance = minChance + (maxChance - minChance) * (Math.Exp(k * biome) - 1) / (Math.Exp(k * 4) - 1);
return (float)Math.Round(chance, 4); // Returning a rounded percentage value
}
public static string GetBiomeName(Vector3 position)
{
string biomeName = "";
BiomeDefinition biomeAt = GameManager.Instance.World.ChunkCache.ChunkProvider.GetBiomeProvider().GetBiomeAt((int)position.x, (int)position.z);
if (biomeAt != null)
{
biomeName = biomeAt.m_sBiomeName;
}
return biomeName;
}
public static string GetBiomeName(EntityAlive entity)
{
string biomeName = "";
if (entity.biomeStandingOn != null)
{
biomeName = entity.biomeStandingOn.m_sBiomeName;
}
else
{
BiomeDefinition biomeAt = GameManager.Instance.World.ChunkCache.ChunkProvider.GetBiomeProvider().GetBiomeAt((int)entity.position.x, (int)entity.position.z);
if (biomeAt != null)
{
biomeName = biomeAt.m_sBiomeName;
}
}
return biomeName;
}
public static string GetBiomeName(int biomeID)
{
if (RebirthVariables.biomes.TryGetValue(biomeID, out string biomeName))
{
return biomeName;
}
else
{
return "";
}
}
public static int GetBiomeID(string biomeName)
{
foreach (var kvp in RebirthVariables.biomes)
{
if (kvp.Value.Equals(biomeName, StringComparison.OrdinalIgnoreCase))
{
return kvp.Key;
}
}
return -1; // Default return for invalid names
}
public static bool ScenarioSkip()
{
bool result = false;
if (RebirthVariables.customScenario == "hive")
{
result = true;
}
return result;
}
public static bool CanAttackExecute(EntityAlive target, float multiplier = 1)
{
bool result = false;
int chance = Manager.random.RandomRange(0, 101);
int threshold = 80;
//Log.Out("RebirthUtilities-CanAttackExecute target: " + target.EntityClass.entityClassName);
if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("feral")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("radiated")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss"))
)
{
threshold = 60;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("radiated")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss")))
{
threshold = 40;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss")))
{
threshold = 20;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss")))
{
threshold = 5;
}
//Log.Out("RebirthUtilities-CanAttackExecute chance: " + chance);
//Log.Out("RebirthUtilities-CanAttackExecute threshold: " + threshold);
if (chance <= (threshold * multiplier))
{
//Log.Out("RebirthUtilities-CanAttackExecute CAN EXECUTE");
result = true;
}
return result;
}
public static bool getBasicBlockInfo(
EntityPlayerLocal _epl,
out ItemClassBlock.ItemBlockInventoryData _ibid,
out Block _blockHolding,
out Block _blockSelectedShape,
out bool _hasAutoRotation,
out bool _onlySimpleRotations,
out bool _hasCopyRotation,
out bool _allowShapes,
out bool _hasCopyAutoShape,
out bool _hasCopyShapeLegacy,
out bool _allowPainting)
{
//Log.Out("RebirthUtilities-getBasicBlockInfo START");
_hasAutoRotation = false;
_onlySimpleRotations = false;
_hasCopyRotation = false;
_hasCopyAutoShape = false;
_hasCopyShapeLegacy = false;
_allowPainting = false;
Inventory inventory = _epl.inventory;
_blockHolding = inventory.GetHoldingBlock().GetBlock();
_ibid = inventory.holdingItemData as ItemClassBlock.ItemBlockInventoryData;
_allowShapes = _blockHolding.SelectAlternates;
_blockSelectedShape = (Block)null;
if (_blockHolding == null || _ibid == null)
{
//Log.Out("RebirthUtilities-getBasicBlockInfo EXIT");
return false;
}
_blockSelectedShape = _allowShapes ? _blockHolding.GetAltBlock(_ibid.itemValue.Meta) : _blockHolding;
_hasAutoRotation = _blockSelectedShape.BlockPlacementHelper != BlockPlacement.None;
_onlySimpleRotations = (_blockSelectedShape.AllowedRotations & EBlockRotationClasses.Advanced) == EBlockRotationClasses.None;
ref bool local = ref _hasCopyRotation;
BlockValue blockValue;
int num;
if (_epl.HitInfo.bHitValid && !_epl.HitInfo.hit.blockValue.isair)
{
//Log.Out("RebirthUtilities-getBasicBlockInfo 1");
Block block = _blockSelectedShape;
blockValue = _epl.HitInfo.hit.blockValue;
int rotation = (int)blockValue.rotation;
num = block.SupportsRotation((byte)rotation) ? 1 : 0;
}
else
{
//Log.Out("RebirthUtilities-getBasicBlockInfo 2");
num = 0;
}
local = num != 0;
if (_allowShapes && _epl.HitInfo.bHitValid)
{
//Log.Out("RebirthUtilities-getBasicBlockInfo 3");
blockValue = _epl.HitInfo.hit.blockValue;
Block block = blockValue.Block;
if (block.GetAutoShapeType() != EAutoShapeType.None && _blockHolding.AutoShapeSupportsShapeName(block.GetAutoShapeShapeName()))
{
//Log.Out("RebirthUtilities-getBasicBlockInfo 4");
_hasCopyAutoShape = true;
}
else if (_blockHolding.ContainsAlternateBlock(block.GetBlockName()))
{
//Log.Out("RebirthUtilities-getBasicBlockInfo 5");
_hasCopyShapeLegacy = true;
}
}
_allowPainting = _blockSelectedShape.shape is BlockShapeNew && _blockSelectedShape.MeshIndex == (byte)0;
return true;
}
public static void TeleportAllNPCs(EntityPlayerLocal _player)
{
if (_player is EntityPlayerLocal)
{
foreach (hireInfo hire in playerHires)
{
if (hire.playerID == _player.entityId)
{
EntityNPCRebirth hiredNPC = GameManager.Instance.World.GetEntity(hire.hireID) as EntityNPCRebirth;
if (hiredNPC != null && hiredNPC.Buffs.GetCustomVar("$FR_NPC_Hidden") == 0 && hiredNPC.Buffs.GetCustomVar("$FR_NPC_Respawn") == 0f)
{
hiredNPC.HideNPC(false);
hiredNPC.guardPosition = Vector3.zero;
hiredNPC.attackTarget = null;
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "order", "follow");
hiredNPC.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
RebirthUtilities.toggleCollisions(false, hiredNPC);
hiredNPC.SetPosition(_player.position);
}
}
}
}
}
public static void InstantiateParticleEffect(string particleName, string impactPosition, string soundName, EntityAlive entityAlive, Vector3 AoEposition)
{
//Log.Out("RebirthUtilities-InstantiateParticleEffect START");
if (particleName == "")
{
return;
}
//Log.Out("RebirthUtilities-InstantiateParticleEffect particleName: " + particleName);
bool isPositionAoE = false;
if (impactPosition != "")
{
isPositionAoE = true;
}
//Log.Out("RebirthUtilities-InstantiateParticleEffect isPositionAoE: " + isPositionAoE);
if (entityAlive == null && !isPositionAoE)
{
//Log.Out("RebirthUtilities-InstantiateParticleEffect 1");
return;
}
float lightBrightness = 0;
Vector3 position = entityAlive.position;
if (entityAlive != null && !isPositionAoE)
{
//Log.Out("RebirthUtilities-InstantiateParticleEffect 2");
position = entityAlive.position;
}
else if (isPositionAoE)
{
//Log.Out("RebirthUtilities-InstantiateParticleEffect 3");
position = AoEposition;
}
//Log.Out("RebirthUtilities-InstantiateParticleEffect position: " + position);
lightBrightness = entityAlive.world.GetLightBrightness(new Vector3i(position.x, position.y, position.z));
bool isAvailable = ParticleEffect.IsAvailable(particleName);
if (!isAvailable)
{
//Log.Out("RebirthUtilities-InstantiateParticleEffect 4");
ParticleEffect.LoadAsset(particleName);
}
ParticleEffect particleEffect = new ParticleEffect(particleName, position, lightBrightness, Color.white, null, null, false);
particleEffect.ParticleId = ParticleEffect.ToId(particleName);
if (soundName != "")
{
//Log.Out("RebirthUtilities-InstantiateParticleEffect soundName: " + soundName);
Manager.BroadcastPlayByLocalPlayer(position, soundName);
}
//Log.Out("RebirthUtilities-InstantiateParticleEffect particleName: " + particleName + " / id: " + particleName.GetHashCode());
//Log.Out("RebirthUtilities-InstantiateParticleEffect _params.Self.entityId: " + entityAlive.entityId);
GameManager.Instance.SpawnParticleEffectServer(particleEffect, entityAlive.entityId, false, true);
}
public static IEnumerator pauseSleep(EntityAlive entity, float duration)
{
entity.Buffs.SetCustomVar(".TempPause", 1f);
entity.IsSleeping = false;
yield return new WaitForSeconds(duration);
entity.IsSleeping = true;
entity.Buffs.SetCustomVar(".TempPause", 0f);
RebirthManager.UpdateHireInfo(entity.entityId, "spawnPosition", "", entity.position.ToString(), new Vector3(0, entity.rotation.y, 0).ToString());
yield break;
}
public static IEnumerator adjustNPCStats(EntityNPCRebirth entity)
{
yield return new WaitForSeconds(1);
float health = entity.Buffs.GetCustomVar("$tempHealth");
//Log.Out("RebirthUtilities-adjustNPCStats health: " + health);
if (health > 0f)
{
//Log.Out("RebirthUtilities-adjustNPCStats CHANGE HEALTH");
entity.Buffs.AddBuff("AdjustNPCStats");
}
yield break;
}
public static void CollectEntityClient(int entityId, int playerId)
{
//Log.Out("RebirthUtilities-CollectEntityClient START");
EntityNPCRebirth myEntity = GameManager.Instance.World.GetEntity(entityId) as EntityNPCRebirth;
if (myEntity == null) return;
myEntity.Collect(playerId);
}
public static void CollectEntityServer(int entityId, int playerId)
{
//Log.Out("RebirthUtilities-CollectEntityServer START");
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(
NetPackageManager.GetPackage<NetPackagePickUpNPCRebirth>().Setup(entityId, playerId), false);
return;
}
var entity = GameManager.Instance.World.GetEntity(entityId);
if (entity == null) return;
if (GameManager.Instance.World.IsLocalPlayer(playerId))
{
CollectEntityClient(entityId, playerId);
}
else
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(
NetPackageManager.GetPackage<NetPackagePickUpNPCRebirth>().Setup(entityId, playerId), false, playerId);
}
}
public static hireInfo GetHireById(int hireID)
{
return playerHires.FirstOrDefault(h => h.hireID == hireID);
}
public static void SpawnHire(int hireID, Vector3 spawnPosition)
{
hireInfo hire = RebirthUtilities.GetHireById(hireID);
EntityNPCRebirth NewEntity = EntityFactory.CreateEntity(EntityClass.FromString(hire.className), spawnPosition, hire.spawnRotation) as EntityNPCRebirth;
NewEntity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
NewEntity._strMyName = hire.name;
RebirthUtilities.SetLeaderAndOwner(NewEntity.entityId, hire.playerID);
NewEntity.IsEntityUpdatedInUnloadedChunk = true;
NewEntity.bWillRespawn = true;
NewEntity.bIsChunkObserver = true;
NewEntity.belongsPlayerId = hire.playerID;
NewEntity.guardPosition = spawnPosition;
GameManager.Instance.World.SpawnEntityInWorld(NewEntity);
int oldHireID = hire.hireID;
hire.hireID = NewEntity.entityId;
hire.order = 1;
bool addObserver = false;
//Log.Out("RebirthUtilities-SpawnHire player.entityId: " + player.entityId);
//Log.Out("RebirthUtilities-SpawnHire NewEntity.entityId: " + NewEntity.entityId);
RebirthManager.UpdateHireInfo(oldHireID, "newid", "", "", "", NewEntity.entityId);
if (hire.order == (int)EntityUtilities.Orders.None)
{
//Log.Out("RebirthUtilities-SpawnHire SET TO FOLLOW");
NewEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
}
else if (hire.order == (int)EntityUtilities.Orders.Follow)
{
//Log.Out("RebirthUtilities-SpawnHire SET TO STAY");
NewEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
addObserver = true;
}
else
{
//Log.Out("RebirthUtilities-SpawnHire SET TO STAY (GUARD)");
NewEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
addObserver = true;
}
RebirthUtilities.SetLeaderAndOwner(NewEntity.entityId, hire.playerID);
bool foundObserver = false;
for (int j = 0; j < observers.Count; j++)
{
if (observers[j].entityID == hire.hireID)
{
//Log.Out("RebirthUtilities-SpawnHire UPDATED OBSERVER, hire: " + hire.hireID);
observers[j].entityID = NewEntity.entityId;
foundObserver = true;
break;
}
}
EntityPlayer player = GameManager.Instance.World.GetEntity(hire.playerID) as EntityPlayer;
if (player != null)
{
float flMode = player.Buffs.GetCustomVar("varNPCModMode");
float flHalt = player.Buffs.GetCustomVar("varNPCModStopAttacking");
if (flMode == 0)
{
NewEntity.Buffs.AddBuff("buffNPCModFullControlMode");
}
else
{
NewEntity.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
if (flHalt == 1)
{
NewEntity.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
NewEntity.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
}
if (addObserver && !foundObserver)
{
//Log.Out("RebirthUtilities-SpawnHire ADDED CHUNK OBSERVER, hire: " + hire.hireID);
ChunkManager.ChunkObserver observerRef = GameManager.Instance.AddChunkObserver(NewEntity.position, false, 3, -1);
observers.Add(new chunkObservers(NewEntity.entityId, observerRef));
}
}
// THIS AFFECTS PERFORMANCE
public static IEnumerator CheckHires()
{
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
if (!isClient)
{
//Log.Out("RebirthUtilities-Update HIRES NOT CLIENT");
for (int i = 0; i < observers.Count; i++)
{
bool foundHire = false;
foreach (hireInfo hire in playerHires)
{
if (observers[i].entityID == hire.hireID && (hire.order == 1 || hire.order == 2))
{
foundHire = true;
break;
}
}
if (!foundHire)
{
GameManager.Instance.RemoveChunkObserver(observers[i].observerRef);
observers.RemoveAt(i);
//Log.Out("RebirthUtilities-Update A REMOVED OBSERVER");
break;
}
}
List<EntityPlayer> spawnedPlayers = new List<EntityPlayer>();
//Log.Out("RebirthUtilities-Update HIRES playerHires: " + playerHires.Count);
foreach (hireInfo hire in playerHires)
{
EntityPlayer player = GameManager.Instance.World.GetEntity(hire.playerID) as EntityPlayer;
if (player)
{
if (player.IsSpawned() && !player.AttachedToEntity)
{
if (!spawnedPlayers.Contains(player))
{
spawnedPlayers.Add(player);
}
//Log.Out("RebirthUtilities-Update Player Spawned: " + hire.playerID);
if (hire.order == 1 || hire.order == 2)
{
bool foundHire = false;
foreach (chunkObservers observer in observers)
{
if (observer.entityID == hire.hireID)
{
foundHire = true;
break;
}
}
if (!foundHire)
{
//Log.Out("RebirthUtilities-Update ADDED CHUNK OBSERVER for: " + hire.hireID);
ChunkManager.ChunkObserver observerRef = GameManager.Instance.AddChunkObserver(hire.spawnPosition, false, 3, -1);
observers.Add(new chunkObservers(hire.hireID, observerRef));
}
}
else if (hire.order == 0)
{
for (int i = 0; i < observers.Count; i++)
{
if (observers[i].entityID == hire.hireID)
{
GameManager.Instance.RemoveChunkObserver(observers[i].observerRef);
observers.RemoveAt(i);
//Log.Out("RebirthUtilities-Update REMOVED OBSERVER");
break;
}
}
}
hire.playerSpawned = true;
}
else
{
//Log.Out("RebirthUtilities-Update Player NOT Spawned: " + hire.playerID);
}
}
//Log.Out("==========================================================================");
//Log.Out("RebirthUtilities-Update hire.playerID: " + hire.playerID);
//Log.Out("RebirthUtilities-Update hire.hireID: " + hire.hireID);
//Log.Out("RebirthUtilities-Update hire.name: " + hire.name);
//Log.Out("RebirthUtilities-Update hire.className: " + hire.className);
//Log.Out("RebirthUtilities-Update hire.spawnPosition: " + hire.spawnPosition);
//Log.Out("RebirthUtilities-Update hire.spawnRotation: " + hire.spawnRotation);
//Log.Out("RebirthUtilities-Update hire.reSpawnPosition: " + hire.reSpawnPosition);
//Log.Out("RebirthUtilities-Update hire.reSpawnRotation: " + hire.reSpawnRotation);
//Log.Out("RebirthUtilities-Update hire.numKills: " + hire.numKills);
//Log.Out("RebirthUtilities-Update hire.numMine: " + hire.numMine);
//Log.Out("RebirthUtilities-Update hire.order: " + hire.order);
//Log.Out("RebirthUtilities-Update hire.playerSpawned: " + hire.playerSpawned);
}
//Log.Out("RebirthUtilities-Update observers.Count: " + observers.Count);
/*//foreach (chunkObservers observer in observers)
//{
//Log.Out("RebirthUtilities-Update observer: " + observer.entityID);
//Log.Out("RebirthUtilities-Update observer.observerRef.position: " + observer.observerRef.position);
//}*/
foreach (EntityPlayer player in spawnedPlayers)
{
//Log.Out("RebirthUtilities-Update CHECKING PLAYER: " + player.entityId + " / OWNED HIRES: " + playerHires.Count);
if (player.Buffs.HasBuff("god") || player.Buffs.HasBuff("FuriousRamsayDelay-10") || player.Buffs.HasBuff("FuriousRamsayDelay-5") || player.AttachedToEntity)
{
continue;
}
Chunk chunkPlayer = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos((int)player.position.x, (int)player.position.z);
for (int i = 0; i < playerHires.Count; i++)
{
hireInfo hire = playerHires[i];
//Log.Out("RebirthUtilities-Update CHECKING HIRE: " + hire.hireID + " / entity: " + hire.className + " / rsSpawnPosition: " + hire.reSpawnPosition);
if (hire.playerID == player.entityId)
{
EntityNPCRebirth hiredNPC = GameManager.Instance.World.GetEntity(hire.hireID) as EntityNPCRebirth;
if (hiredNPC == null)
{
//Log.Out("RebirthUtilities-Update HIRE COULDN'T BE FOUND IN WORLD, name: " + hire.name);
Vector3 respawnPosition = new Vector3(0, 0, 0);
Vector3 respawnRotation = new Vector3(0, 0, 0);
if (hire.reSpawnPosition != new Vector3(0, 0, 0))
{
//Log.Out("RebirthUtilities-CheckHires RESPAWN POINT WAS SET, USING IT");
respawnPosition = hire.reSpawnPosition;
respawnRotation.y = player.rotation.y;
}
else
{
//Log.Out("RebirthUtilities-CheckHires NO RESPAWN POINT WAS SET, USING BEDROLL IF ONE EXISTS");
SpawnPosition spawnPoint = RebirthUtilities.GetSpawnPoint(player);
if (spawnPoint.IsUndef())
{
//Log.Out("RebirthUtilities-CheckHires NO BEDROLL FOUND, USING PLAYER'S POSITION");
respawnPosition = player.position;
respawnRotation.y = player.rotation.y;
continue;
}
else
{
//Log.Out("RebirthUtilities-CheckHires BEDROLL FOUND, USING IT");
respawnPosition = spawnPoint.position;
respawnRotation.y = player.rotation.y;
}
}
//Log.Out("RebirthUtilities-CheckHires Player's position: " + player.position);
//Log.Out("RebirthUtilities-CheckHires respawnPosition: " + respawnPosition);
Chunk chunkHire = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos((int)respawnPosition.x, (int)respawnPosition.z);
//Log.Out("RebirthUtilities-Update chunkPlayer pos: " + chunkPlayer.ChunkPos);
if (chunkHire != null && (
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x + 1) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x - 1) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z - 1)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x + 1) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z - 1)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x - 1) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z + 1)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x + 1) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z + 1)) ||
((chunkHire.ChunkPos.x == chunkPlayer.ChunkPos.x - 1) &&
(chunkHire.ChunkPos.z == chunkPlayer.ChunkPos.z))
)
)
{
//Log.Out("RebirthUtilities-Update chunkHire pos: " + chunkHire.ChunkPos);
Entity entity = player.world.GetEntity(hire.hireID);
if (entity == null)
{
//Log.Out("RebirthUtilities-Update ADDED MISSING HIRE: " + hire.hireID);
EntityNPCRebirth NewEntity = EntityFactory.CreateEntity(EntityClass.FromString(hire.className), respawnPosition, respawnRotation) as EntityNPCRebirth;
NewEntity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
NewEntity._strMyName = hire.name;
RebirthUtilities.SetLeaderAndOwner(NewEntity.entityId, player.entityId);
NewEntity.IsEntityUpdatedInUnloadedChunk = true;
NewEntity.bWillRespawn = true;
NewEntity.bIsChunkObserver = true;
NewEntity.belongsPlayerId = player.entityId;
NewEntity.guardPosition = Vector3.zero; //respawnPosition;
bool addObserver = false;
GameManager.Instance.World.SpawnEntityInWorld(NewEntity);
int oldHireID = hire.hireID;
hire.hireID = NewEntity.entityId;
hire.order = 1;
SaveCurrent();
//Log.Out("RebirthUtilities-Update player.entityId: " + player.entityId);
//Log.Out("RebirthUtilities-Update NewEntity.entityId: " + NewEntity.entityId);
RebirthManager.UpdateHireInfo(oldHireID, "newid", "", "", "", NewEntity.entityId);
if (hire.order == (int)EntityUtilities.Orders.None)
{
//Log.Out("RebirthUtilities-Update SET TO FOLLOW");
NewEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
}
else if (hire.order == (int)EntityUtilities.Orders.Follow)
{
//Log.Out("RebirthUtilities-Update SET TO STAY");
NewEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
addObserver = true;
}
else
{
//Log.Out("RebirthUtilities-Update SET TO STAY (GUARD)");
NewEntity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
addObserver = true;
}
RebirthUtilities.SetLeaderAndOwner(NewEntity.entityId, player.entityId);
bool foundObserver = false;
for (int j = 0; j < observers.Count; j++)
{
if (observers[j].entityID == hire.hireID)
{
//Log.Out("RebirthUtilities-CheckHires UPDATED OBSERVER, hire: " + hire.hireID);
observers[j].entityID = NewEntity.entityId;
foundObserver = true;
break;
}
}
float flMode = player.Buffs.GetCustomVar("varNPCModMode");
float flHalt = player.Buffs.GetCustomVar("varNPCModStopAttacking");
if (flMode == 0)
{
NewEntity.Buffs.AddBuff("buffNPCModFullControlMode");
}
else
{
NewEntity.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
if (flHalt == 1)
{
NewEntity.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
NewEntity.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
if (addObserver && !foundObserver)
{
//Log.Out("RebirthUtilities-CheckHires ADDED CHUNK OBSERVER, hire: " + hire.hireID);
ChunkManager.ChunkObserver observerRef = GameManager.Instance.AddChunkObserver(NewEntity.position, false, 3, -1);
observers.Add(new chunkObservers(NewEntity.entityId, observerRef));
}
}
else
{
//Log.Out("RebirthUtilities-CheckHires HIRE EXISTS AT THIS POSITION: " + entity.position);
}
}
}
else
{
if (hiredNPC.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1f)
{
//Log.Out($"RebirthUtilities-CheckHires HIRE [{hiredNPC.EntityName}/{hiredNPC.EntityClass.entityClassName}] EXISTS AT THIS POSITION: " + hiredNPC.position);
SpawnPosition spawnPoint = RebirthUtilities.GetSpawnPoint(player);
if (!spawnPoint.IsUndef() && (hiredNPC.position.x != spawnPoint.position.x || hiredNPC.position.z != spawnPoint.position.z))
{
//Log.Out($"RebirthUtilities-CheckHires Bedroll Location: " + spawnPoint.position);
hiredNPC.HideNPC(false);
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "reSpawnPosition", "", Vector3.zero.ToString(), new Vector3(0, hiredNPC.rotation.y, 0).ToString());
hiredNPC.SetPosition(new Vector3(spawnPoint.position.x, spawnPoint.position.y + 1f, spawnPoint.position.z));
GameManager.Instance.StartCoroutine(pauseSleep(hiredNPC, 1f));
}
}
}
}
}
}
}
else
{
/*//foreach (hireInfo hire in playerHires)
//{
//Log.Out("RebirthUtilities-Update hire.hireID: " + hire.hireID);
//Log.Out("RebirthUtilities-Update hire.className: " + hire.className);
//Log.Out("RebirthUtilities-Update hire.playerSpawned: " + hire.playerSpawned);
//}*/
}
yield break;
}
public static IEnumerator CheckOutbreak()
{
//Log.Out("OutbreakManagerRebirth-Update RebirthVariables.isHerd: " + RebirthVariables.isHerd);
//Log.Out("OutbreakManagerRebirth-Update RebirthVariables.herdStartTime: " + RebirthVariables.herdStartTime);
//Log.Out("OutbreakManagerRebirth-Update RebirthVariables.herdDuration: " + RebirthVariables.herdDuration);
if (!RebirthVariables.stopWHSpawns && RebirthVariables.isWHSpawned)
{
float diff = Time.time - RebirthVariables.herdStartTime;
//Log.Out("OutbreakManagerRebirth-Update diff: " + diff + " / " + RebirthVariables.herdDuration);
AIDirectorWanderingHordeComponent director = GameManager.Instance.World.aiDirector.GetComponent<AIDirectorWanderingHordeComponent>();
if (director != null && director.spawners.Count > 0)
{
AIWanderingHordeSpawner spawner = director.spawners[director.spawners.Count - 1];
if (spawner != null)
{
//Log.Out("OutbreakManagerRebirth-Update spawner.commandList.Count: " + spawner.commandList.Count);
}
}
if (diff >= RebirthVariables.herdDuration)
{
Log.Out("OutbreakManagerRebirth-Update STOP OUTBREAK");
RebirthVariables.isHerd = false;
RebirthVariables.stopWHSpawns = true;
RebirthVariables.herdDuration = 0f;
if (director != null && director.spawners.Count > 0)
{
AIWanderingHordeSpawner spawner = director.spawners[director.spawners.Count - 1];
if (spawner != null)
{
spawner.Cleanup();
director.spawners.RemoveAt(director.spawners.Count - 1);
}
}
}
}
yield break;
}
public static IEnumerator UpdatePurgePrefabs()
{
if (dynamicPrefabsLoaded)
{
//Log.Out("ScenarioManager-Update LIST OF PREFABS LOADED, dynamicPrefabs.Count: " + dynamicPrefabs.Count);
//if (dynamicPrefabs.Count > 0)
//{
//GameManager.Instance.StartCoroutine(RebirthUtilities.processDynamicPrefabs("pine_forest"));
//GameManager.Instance.StartCoroutine(RebirthUtilities.processDynamicPrefabs("desert"));
//GameManager.Instance.StartCoroutine(RebirthUtilities.processDynamicPrefabs("snow"));
//GameManager.Instance.StartCoroutine(RebirthUtilities.processDynamicPrefabs("wasteland"));
//GameManager.Instance.StartCoroutine(RebirthUtilities.processDynamicPrefabs("burnt_forest"));
//}
//else
//{
//prefabUpdateTick = 5f;
//}
}
else
{
if (RebirthVariables.testPurge)
Log.Out("ScenarioManager-Update GET LIST OF PREFABS");
//System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
//watch.Start();
int numPrefabs = 0;
int numPrefabs2 = 0;
int numPrefabs3 = 0;
List<PrefabInstance> tempDynamicPrefabs = GameManager.Instance.GetDynamicPrefabDecorator()?.GetDynamicPrefabs();
if (tempDynamicPrefabs != null)
{
if (RebirthVariables.testPurge)
Log.Out("ScenarioManager-Update RETRIEVED BASE LIST OF DYNAMIC PREFABS, tempDynamicPrefabs.Count: " + tempDynamicPrefabs.Count);
if (tempDynamicPrefabs.Count > 0)
{
foreach (PrefabInstance _prefabInstance in tempDynamicPrefabs)
{
numPrefabs++;
//if (!_prefabInstance.prefab.PrefabName.ToLower().Contains("_tile_") && !_prefabInstance.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("rwgonly,streettile,part,hideui")))
if (_prefabInstance.prefab.SleeperVolumes.Count > 0 && !_prefabInstance.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("rwgonly,streettile,hideui")))
{
numPrefabs2++;
BiomeDefinition biomeAt = GameManager.Instance.World.ChunkCache.ChunkProvider.GetBiomeProvider().GetBiomeAt(_prefabInstance.boundingBoxPosition.x, _prefabInstance.boundingBoxPosition.z);
if (biomeAt != null)
{
numPrefabs3++;
Vector3 location = new Vector3(_prefabInstance.boundingBoxPosition.x, _prefabInstance.boundingBoxPosition.y, _prefabInstance.boundingBoxPosition.z);
if (RebirthVariables.testPurge)
{
Log.Out("ScenarioManager-Update _prefabInstance.prefab.PrefabName: " + _prefabInstance.prefab.PrefabName);
Log.Out("ScenarioManager-Update _prefabInstance.boundingBoxPosition: " + _prefabInstance.boundingBoxPosition);
Log.Out("ScenarioManager-Update _prefabInstance.boundingBoxSize: " + _prefabInstance.boundingBoxSize);
Log.Out("ScenarioManager-Update _prefabInstance.prefab.Tags: " + _prefabInstance.prefab.Tags);
Log.Out("ScenarioManager-Update biomeAt.m_sBiomeName: " + biomeAt.m_sBiomeName);
Log.Out("ScenarioManager-Update _prefabInstance.prefab.SleeperVolumes.Count: " + _prefabInstance.prefab.SleeperVolumes.Count);
}
if (!IsIgnoredPrefab(_prefabInstance.prefab.PrefabName))
{
AddDynamicPrefab(new DynamicPrefab(_prefabInstance.prefab.PrefabName, location, new Vector3(_prefabInstance.boundingBoxSize.x, _prefabInstance.boundingBoxSize.y, _prefabInstance.boundingBoxSize.z), _prefabInstance.prefab.DifficultyTier, biomeAt.m_sBiomeName, _prefabInstance.prefab.Tags.ToString()));
}
}
}
}
if (!RebirthVariables.purgePrefabCount)
{
RebirthVariables.purgePrefabCount = true;
foreach (KeyValuePair<int, string> biome in RebirthVariables.biomes)
{
int key = biome.Key; // The int key (0, 1, 2, etc.)
string value = biome.Value; // The string value ("pine_forest", "desert", etc.)
for (int i = 0; i <= 6; i++)
{
int clearedPrefabs = GetClearedPrefabCount(value, i);
RebirthUtilities.AddSpawnedPrefab(value, RebirthManager.RetrieveTotalBiomePrefabs(value, i), i);
if (RebirthVariables.testPurge)
Log.Out($"ScenarioManager-Update {value} PREFABS, DIFFICULTY {i}: {RebirthUtilities.GetSpawnedPrefab(value, i)} / cleared: {clearedPrefabs}");
}
}
}
dynamicPrefabsLoaded = true;
}
}
//watch.Stop();
//Log.Out("ScenarioManager-Update time to process: " + watch.ElapsedMilliseconds + " ms");
if (RebirthVariables.testPurge)
{
Log.Out("ScenarioManager-Update numPrefabs: " + numPrefabs);
Log.Out("ScenarioManager-Update numPrefabs2: " + numPrefabs2);
Log.Out("ScenarioManager-Update numPrefabs3: " + numPrefabs3);
}
}
yield break;
}
public static IEnumerator CleanupPurgePrefabs()
{
//Log.Out("ScenarioManager-Update CLEANUP, ClearedPrefabs.Count: " + ClearedPrefabs.Count);
//Log.Out("ScenarioManager-Update CLEANUP, DiscoveredPrefabs.Count: " + DiscoveredPrefabs.Count);
List<PrefabInfo> ignoredPrefabs = GetIgnoredDiscoveredPrefabs();
foreach (var prefab in ignoredPrefabs)
{
// Example: remove them from DiscoveredPrefabs
DiscoveredPrefabs.Remove(prefab);
//Log.Out("ScenarioManager-Update ignoredPrefabs CLEANUP, prefab.Name: " + prefab.Name);
Vector3 location = new Vector3(prefab.Position.x + prefab.Size.x / 2f, prefab.Position.y, prefab.Position.z + prefab.Size.z / 2f);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
NavObjectManager.Instance.UnRegisterNavObjectByPosition(location, "discovered_waypoint_" + prefab.Difficulty);
}
else
{
if (!GameManager.IsDedicatedServer)
{
NavObjectManager.Instance.UnRegisterNavObjectByPosition(location, "discovered_waypoint_" + prefab.Difficulty);
}
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage((NetPackage)NetPackageManager.GetPackage<NetPackageUnregisterNavObject>().Setup("discovered_waypoint_" + prefab.Difficulty, location.x, location.y, location.z), false);
}
}
SaveDiscovered();
var matchingPrefabs = DiscoveredPrefabs
.Where(discovered => ClearedPrefabs.Any(cleared =>
cleared.Name == discovered.Name && cleared.Position == discovered.Position))
.ToList();
// Optional: Log the number of matching prefabs found
//Log.Out($"ScenarioManager-Update CLEANUP: {matchingPrefabs.Count} discovered prefabs already cleared.");
// Perform any other cleanup actions or processing with matchingPrefabs
foreach (var prefab in matchingPrefabs)
{
// Example: remove them from DiscoveredPrefabs
DiscoveredPrefabs.Remove(prefab);
//Log.Out("ScenarioManager-Update CLEANUP, prefab.Name: " + prefab.Name);
Vector3 location = new Vector3(prefab.Position.x + prefab.Size.x / 2f, prefab.Position.y, prefab.Position.z + prefab.Size.z / 2f);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
NavObjectManager.Instance.UnRegisterNavObjectByPosition(location, "discovered_waypoint_" + prefab.Difficulty);
}
else
{
if (!GameManager.IsDedicatedServer)
{
NavObjectManager.Instance.UnRegisterNavObjectByPosition(location, "discovered_waypoint_" + prefab.Difficulty);
}
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage((NetPackage)NetPackageManager.GetPackage<NetPackageUnregisterNavObject>().Setup("discovered_waypoint_" + prefab.Difficulty, location.x, location.y, location.z), false);
}
}
yield break;
}
// THIS AFFECTS PERFORMANCE
public static IEnumerator CheckEvents()
{
if (nextFeralSenseDay < GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime))
{
nextFeralSenseDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime) + Manager.random.RandomRange(0, 3);
nextFeralSensePeriod = Manager.random.RandomRange(0, 3);
}
bool isClient = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient;
//Log.Out("RebirthUtilities-CheckEvents isClient: " + isClient);
if (!isClient)
{
DictionaryList<int, AIDirectorPlayerState> trackedPlayers = GameManager.Instance.World.aiDirector.GetComponent<AIDirectorPlayerManagementComponent>().trackedPlayers;
for (int i = 0; i < trackedPlayers.list.Count; i++)
{
AIDirectorPlayerState aidirectorPlayerState = trackedPlayers.list[i];
if (!aidirectorPlayerState.Player.IsDead())
{
//Log.Out("RebirthUtilities-CheckEvents player: " + aidirectorPlayerState.Player.entityId);
bool foundPlayer = false;
foreach (eventInfo eventData in playerEvents)
{
if (eventData.playerID == aidirectorPlayerState.Player.entityId)
{
//Log.Out("RebirthUtilities-CheckEvents FOUND PLAYER");
foundPlayer = true;
string optionScreamerNights = RebirthVariables.customScreamerNights;
if (optionScreamerNights != "none")
{
//Log.Out("RebirthUtilities-CheckEvents SCREAMER NIGHTS TURNED ON nextScreamerNight: " + nextScreamerNight);
if (!GameManager.Instance.World.IsDaytime())
{
//Log.Out("RebirthUtilities-CheckEvents isScreamerEventActivated: " + isScreamerEventActivated);
if (!isScreamerEventActivated && (nextScreamerNight == GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime)))
{
isScreamerEventActivated = true;
//Log.Out("RebirthUtilities-CheckEvents isScreamerEventActivated: " + isScreamerEventActivated);
}
//Log.Out("RebirthUtilities-CheckEvents IS NIGHT");
if (isScreamerEventActivated && (Time.time - eventData.eventCheckScreamer) > eventUpdateTickCheckScreamer)
{
eventData.eventCheckScreamer = Time.time;
//Log.Out("RebirthUtilities-CheckEvents SCREAMER TICK");
int playerLevel = aidirectorPlayerState.Player.Progression.Level;
int topLevel = 150;
if (optionScreamerNights == "higher")
{
topLevel = 75;
}
else if (optionScreamerNights == "lower")
{
topLevel = 225;
}
if (playerLevel >= 20)
{
//Log.Out("RebirthUtilities-CheckEvents CAN SPAWN SCREAMER");
int playerLevelDifference = topLevel - playerLevel;
if (playerLevelDifference < 0)
{
playerLevelDifference = 0;
}
int baseChance = topLevel - playerLevelDifference;
int randomInt = aidirectorPlayerState.Player.rand.RandomRange(0, topLevel);
//Log.Out("RebirthUtilities-CheckEvents playerLevel: " + playerLevel);
//Log.Out("RebirthUtilities-CheckEvents topLevel: " + topLevel);
//Log.Out("RebirthUtilities-CheckEvents playerLevelDifference: " + playerLevelDifference);
//Log.Out("RebirthUtilities-CheckEvents randomInt: " + randomInt);
//Log.Out("RebirthUtilities-CheckEvents baseChance: " + baseChance);
if (randomInt < baseChance)
{
int searchDistance = 150;
List<Entity> entitiesInBounds = aidirectorPlayerState.Player.world.GetEntitiesInBounds(typeof(EntityZombieScreamerRebirth), BoundsUtils.BoundsForMinMax(aidirectorPlayerState.Player.position.x - searchDistance, aidirectorPlayerState.Player.position.y - 50, aidirectorPlayerState.Player.position.z - searchDistance, aidirectorPlayerState.Player.position.x + searchDistance, aidirectorPlayerState.Player.position.y + 50, aidirectorPlayerState.Player.position.z + searchDistance), new List<Entity>());
//Log.Out("RebirthUtilities-CheckEvents NUM Screamers: " + entitiesInBounds.Count);
if (entitiesInBounds.Count < RebirthVariables.customScreamerMax)
{
//Log.Out("RebirthUtilities-CheckEvents randomInt < baseChance SPAWNED SCREAMER");
RebirthUtilities.SpawnScreamer(aidirectorPlayerState.Player.position, (int)(playerLevel / 40));
}
else
{
//Log.Out("RebirthUtilities-CheckEvents TOO MANY SCREAMERS ALREADY");
}
}
else
{
//Log.Out("RebirthUtilities-CheckEvents randomInt >= baseChance NO SPAWN");
}
}
else
{
//Log.Out("RebirthUtilities-CheckEvents CAN'T SPAWN SCREAMER");
}
}
else
{
//Log.Out("RebirthUtilities-CheckEvents NEED TO WAIT A BIT");
}
}
else
{
if (isScreamerEventActivated)
{
isScreamerEventActivated = false;
if (optionScreamerNights == "higher")
{
nextScreamerNight = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime) + Manager.random.RandomRange(1, 2);
}
else if (optionScreamerNights == "lower")
{
nextScreamerNight = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime) + Manager.random.RandomRange(4, 6);
}
else
{
nextScreamerNight = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime) + Manager.random.RandomRange(2, 4);
}
//Log.Out("RebirthUtilities-CheckEvents IS DAY, nextScreamerNight: " + nextScreamerNight);
}
//Log.Out("RebirthUtilities-CheckEvents IS DAY");
if (nextScreamerNight < GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime))
{
nextScreamerNight = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime) + Manager.random.RandomRange(0, 3);
isScreamerEventActivated = false;
}
}
}
else
{
//Log.Out("RebirthUtilities-CheckEvents SCREAMER NIGHTS TURNED OFF");
}
}
}
if (!foundPlayer)
{
//Log.Out("RebirthUtilities-CheckEvents DIDN'T FIND PLAYER");
AddEvent(aidirectorPlayerState.Player.entityId, 0, 0, 0);
}
}
}
}
yield break;
}
public static void BuildHiveEntityGroups()
{
//Log.Out("RebirthUtilities-BuildHiveEntityGroups START");
List<int> entities = new List<int>();
generalGroupsForest = new Dictionary<(int min, int max), List<int>>();
generalGroupsDesert = new Dictionary<(int min, int max), List<int>>();
generalGroupsSnow = new Dictionary<(int min, int max), List<int>>();
generalGroupsWasteland = new Dictionary<(int min, int max), List<int>>();
generalGroupsBurnt = new Dictionary<(int min, int max), List<int>>();
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.forestGroup, ref entities, 100);
RandomizeList(entities);
generalGroupsForest.Add((1, 1), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.desertGroup, ref entities, 100);
RandomizeList(entities);
generalGroupsDesert.Add((1, 1), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.snowGroup, ref entities, 100);
RandomizeList(entities);
generalGroupsSnow.Add((1, 1), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.wastelandGroup, ref entities, 100);
RandomizeList(entities);
generalGroupsWasteland.Add((1, 1), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.burntGroup, ref entities, 100);
RandomizeList(entities);
generalGroupsBurnt.Add((1, 1), entities);
/*foreach (var group in RebirthUtilities.generalGroupsForest)
{
Log.Out("===========================================================================");
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups FOREST");
foreach (var entity in group.Value)
{
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups entity: " + EntityClass.GetEntityClassName(entity));
}
}
foreach (var group in RebirthUtilities.generalGroupsDesert)
{
Log.Out("===========================================================================");
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups DESERT");
foreach (var entity in group.Value)
{
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups entity: " + EntityClass.GetEntityClassName(entity));
}
}
foreach (var group in RebirthUtilities.generalGroupsSnow)
{
Log.Out("===========================================================================");
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups SNOW");
foreach (var entity in group.Value)
{
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups entity: " + EntityClass.GetEntityClassName(entity));
}
}
foreach (var group in RebirthUtilities.generalGroupsWasteland)
{
Log.Out("===========================================================================");
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups WASTELAND");
foreach (var entity in group.Value)
{
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups entity: " + EntityClass.GetEntityClassName(entity));
}
}
foreach (var group in RebirthUtilities.generalGroupsBurnt)
{
Log.Out("===========================================================================");
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups BURNT");
foreach (var entity in group.Value)
{
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups entity: " + EntityClass.GetEntityClassName(entity));
}
}*/
}
public static IEnumerator BuildGamestageSpawnGroups()
{
RebirthUtilities.BuildSpawnGroups();
if (RebirthUtilities.ScenarioSkip())
{
RebirthUtilities.BuildHiveEntityGroups();
}
else
{
RebirthUtilities.BuildSpecificEntityGroups(ref RebirthUtilities.generalGroups);
}
RebirthUtilities.BuildSpecificEntityGroups(ref RebirthUtilities.biomeGroups, true);
/*foreach (var group in RebirthUtilities.generalGroups)
{
Log.Out("===========================================================================");
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups group.Key.min: " + group.Key.min);
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups group.Key.max: " + group.Key.max);
foreach (var entities in group.Value)
{
Log.Out("RebirthUtilities-BuildGamestageSpawnGroups entity: " + EntityClass.GetEntityClassName(entities));
}
}*/
RebirthUtilities.BuildSpecificEntityGroups(ref RebirthUtilities.bloodMoonGroups, false, true);
yield break;
}
public static IEnumerator BuildSpecificSpawnGroup(int groupType)
{
if (groupType == 1)
{
RebirthUtilities.BuildSpecificEntityGroups(ref RebirthUtilities.generalGroups);
}
else if (groupType == 2)
{
RebirthUtilities.BuildSpecificEntityGroups(ref RebirthUtilities.biomeGroups, true);
}
else if (groupType == 3)
{
RebirthUtilities.BuildSpecificEntityGroups(ref RebirthUtilities.bloodMoonGroups, false, true);
}
yield break;
}
public static float GetCalculatedLevel(EntityAlive _ea, ProgressionValue _pv)
{
if (_pv == null)
return 0.0f;
if (_pv.calculatedFrame == Time.frameCount)
return _pv.calculatedLevel;
ProgressionClass progressionClass = _pv.ProgressionClass;
if (progressionClass == null)
return 0.0f;
float level = (float)_pv.Level;
if (progressionClass.Type == ProgressionType.Attribute)
level = EffectManager.GetValue(PassiveEffects.AttributeLevel, _originalValue: level, _entity: _ea, tags: progressionClass.NameTag);
else if (progressionClass.Type == ProgressionType.Skill)
level = EffectManager.GetValue(PassiveEffects.SkillLevel, _originalValue: level, _entity: _ea, tags: progressionClass.NameTag);
else if (progressionClass.Type == ProgressionType.Perk)
level = EffectManager.GetValue(PassiveEffects.PerkLevel, _originalValue: level, _entity: _ea, tags: progressionClass.NameTag);
float calculatedLevel = Mathf.Max(Mathf.Min(level, ProgressionClass.GetCalculatedMaxLevel(_ea, _pv)), (float)progressionClass.MinLevel);
_pv.calculatedFrame = Time.frameCount;
_pv.calculatedLevel = calculatedLevel;
return calculatedLevel;
}
public static void LoadRebirthXMLOptions()
{
RebirthVariables.disableFogOnFlight = RebirthUtilities.GetPropertyValue("RebirthOptions", "disableFogOnFlight") == "true";
//Log.Out("RebirthVariables-setConfigVariables disableFogOnFlight: " + RebirthVariables.disableFogOnFlight);
}
public static bool CanSeeTargetHealth(EntityPlayer player, EntityAlive target)
{
bool canSeeTarget = true;
if (player == null || target == null)
{
//Log.Out("RebirthUtilities-CanSeeTargetHealth NO PLAYER OR TARGET");
return false;
}
//Log.Out("RebirthUtilities-CanSeeTargetHealth RebirthVariables.customTargetBarVisibility: " + RebirthVariables.customTargetBarVisibility);
if (RebirthVariables.customTargetBarVisibility == "none")
{
canSeeTarget = false;
}
else if (RebirthVariables.customTargetBarVisibility == "default")
{
canSeeTarget = false;
float canSeeLevel = player.Buffs.GetCustomVar("$DetermineEntityHealth");
//Log.Out("RebirthUtilities-CanSeeTargetHealth canSeeLevel: " + canSeeLevel);
if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("decoy"))
)
{
canSeeTarget = true;
}
if (canSeeLevel == 1)
{
if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("zombie")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("feral")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("radiated")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("hostile"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("melee")) &&
target.HasAnyTags(FastTags<TagGroup.Global>.Parse("npc"))
)
{
canSeeTarget = true;
}
}
else if (canSeeLevel == 2)
{
if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("zombie")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("radiated")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("bear")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("mountainlion")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("dire"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("npc"))
)
{
canSeeTarget = true;
}
}
else if (canSeeLevel == 3)
{
if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("zombie")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("npc"))
)
{
canSeeTarget = true;
}
}
else if (canSeeLevel == 4)
{
if ((target.HasAnyTags(FastTags<TagGroup.Global>.Parse("zombie")) &&
!target.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted"))) ||
target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("npc"))
)
{
canSeeTarget = true;
}
}
else if (canSeeLevel == 5)
{
if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("zombie")) ||
target.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal"))
)
{
canSeeTarget = true;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("npc"))
)
{
canSeeTarget = true;
}
}
//Log.Out("RebirthUtilities-CanSeeTargetHealth canSeeTarget: " + canSeeTarget);
}
return canSeeTarget;
}
public static int EnnemiesAround(EntityPlayer player, int minMax = 50, int minHeight = 50)
{
int numEntities = 0;
List<Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityZombieSDX), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - minHeight, player.position.z - minMax, player.position.x + minMax, player.position.y + minHeight, player.position.z + minMax), new List<Entity>());
if (entitiesInBounds.Count > 0)
{
for (int x = 0; x < entitiesInBounds.Count; x++)
{
EntityAlive entity = (EntityAlive)entitiesInBounds[x];
if (entity.IsAlive() && VerifyFactionStanding(player, entity))
{
numEntities++;
}
}
}
entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityEnemyAnimal), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - minHeight, player.position.z - minMax, player.position.x + minMax, player.position.y + minHeight, player.position.z + minMax), new List<Entity>());
if (entitiesInBounds.Count > 0)
{
for (int x = 0; x < entitiesInBounds.Count; x++)
{
EntityAlive entity = (EntityAlive)entitiesInBounds[x];
if (entity.IsAlive() && VerifyFactionStanding(player, entity))
{
numEntities++;
}
}
}
entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityNPCRebirth), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - minHeight, player.position.z - minMax, player.position.x + minMax, player.position.y + minHeight, player.position.z + minMax), new List<Entity>());
if (entitiesInBounds.Count > 0)
{
for (int x = 0; x < entitiesInBounds.Count; x++)
{
EntityAlive entity = (EntityAlive)entitiesInBounds[x];
if (entity.IsAlive() && VerifyFactionStanding(player, entity))
{
numEntities++;
}
}
}
return numEntities;
}
public static int GetCurrentBiomeID(string biomeName)
{
int biomeNum = 0;
foreach (KeyValuePair<int, string> biome in RebirthVariables.biomes)
{
if (biome.Value.ToLower() == biomeName.ToLower())
{
return biome.Key;
}
}
return biomeNum;
}
public static string GetCurrentBiomePurgeProgression()
{
string result = "pine_forest";
int biomeNum = 0;
bool foundValue = false;
foreach (KeyValuePair<int, string> biome in RebirthVariables.biomes)
{
int totalPrefabs = RebirthUtilities.GetTotalSpawnedPrefab(biome.Value);
int currentClearedPrefabs = RebirthUtilities.GetPurgeBiome(biome.Value);
biomeNum = biome.Key;
float percentage = ((float)currentClearedPrefabs / totalPrefabs) * 100;
float numThreshold = RebirthVariables.purgeBiomeThreshold;
if (RebirthVariables.testPurgeDiscovery)
{
numThreshold = 7f;
}
if (percentage < numThreshold)
{
result = biome.Value;
foundValue = true;
break;
}
}
if (!foundValue && biomeNum == 5)
{
result = "burnt_forest";
}
//Log.Out("RebirthUtilities-GetCurrentBiomePurgeProgression result: " + result);
return result;
}
public static bool IsPrefabIgnored(string prefabName)
{
return RebirthVariables.ignorePrefabs.Root
.Elements("prefab")
.Any(p => prefabName.ToLower().Contains((p.Attribute("name")?.Value.ToLower() ?? "")));
}
public static void CheckSleeperActivated(EntityAlive entity)
{
if (RebirthVariables.customScenario != "purge")
{
return;
}
if (entity.Buffs.GetCustomVar("$sleeperActivated") == 1f)
{
//Log.Out("RebirthUtilities-CheckSleeperActivated purgeZombieTick: " + entity.EntityName + " (" + entity.entityId + ")");
PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(entity.position);
if (poiatPosition != null)
{
//Log.Out("RebirthUtilities-CheckSleeperActivated poiatPosition.prefab.PrefabName: " + poiatPosition.prefab.PrefabName);
EntityPlayer closestPlayer = entity.world.GetClosestPlayer(entity.position, 120f, false);
if (closestPlayer != null)
{
PrefabInstance poiatPositionPlayer = RebirthUtilities.GetPrefabAtPosition(closestPlayer.position);
if (poiatPositionPlayer != null)
{
//Log.Out("RebirthUtilities-CheckSleeperActivated poiatPositionPlayer.prefab.PrefabName: " + poiatPositionPlayer.prefab.PrefabName);
//Log.Out("RebirthUtilities-CheckSleeperActivated poiatPosition.boundingBoxPosition: " + poiatPosition.boundingBoxPosition);
//Log.Out("RebirthUtilities-CheckSleeperActivated poiatPositionPlayer.boundingBoxPosition: " + poiatPositionPlayer.boundingBoxPosition);
if (poiatPositionPlayer.boundingBoxPosition == poiatPosition.boundingBoxPosition)
{
//Log.Out("RebirthUtilities-CheckSleeperActivated ACTIVATE PLAYER: " + entity.EntityClass.entityClassName);
entity.Buffs.SetCustomVar("$sleeperActivated", 2f);
entity.ConditionalTriggerSleeperWakeUp();
entity.SetAttackTarget(closestPlayer, 60000);
entity.sightRangeBase = 200;
entity.SetMaxViewAngle(360);
return;
}
}
}
else
{
entity.Buffs.SetCustomVar("$sleeperActivated", 3f);
}
}
else
{
entity.Buffs.SetCustomVar("$sleeperActivated", 3f);
}
}
}
public static bool TryGetSeeCache(EntityAlive sourceEntity, EntityAlive targetEntity, out bool isSeen)
{
isSeen = false;
if (targetEntity == null)
{
return false;
}
if (sourceEntity?.seeCache?.positiveCache?.Contains(targetEntity.entityId) == true)
{
isSeen = true;
return true;
}
return sourceEntity?.seeCache?.negativeCache?.Contains(targetEntity.entityId) == true;
}
public static IEnumerator CheckPurgeProgress(EntityPlayer player, bool isLocal = true)
{
int notification = -1;
float previousValue = 0f;
float percentage = 0;
float purgeDisplayPercentage = 0;
string biome = "";
string notificationBiome = "";
foreach (KeyValuePair<int, string> biomeEntry in RebirthVariables.biomes)
{
int biomeKey = biomeEntry.Key;
string biomeName = biomeEntry.Value;
biome = biomeName;
int clearedPrefabs = RebirthManager.GetTotalClearedPrefabCount(biomeName);
int totalPrefabs = RebirthUtilities.GetTotalSpawnedPrefab(biomeName);
int currentClearedPrefabs = RebirthUtilities.GetPurgeBiome(biomeName);
percentage = ((float)currentClearedPrefabs / totalPrefabs) * 100;
purgeDisplayPercentage = ((float)clearedPrefabs / totalPrefabs) * 100;
//Log.Out("============================================================================================");
//Log.Out("RebirthUtilities-CheckPurgeProgress biomeName: " + biomeName);
//Log.Out("RebirthUtilities-CheckPurgeProgress percentage: " + percentage);
//Log.Out("RebirthUtilities-CheckPurgeProgress purgeDisplayPercentage: " + purgeDisplayPercentage);
foreach (KeyValuePair<int, Tuple<float, float>> discoveryUnlock in RebirthVariables.discoveryUnlocks)
{
int key = discoveryUnlock.Key;
float startValue = discoveryUnlock.Value.Item1; // First value of the tuple
float endValue = discoveryUnlock.Value.Item2; // Second value of the tuple
//Log.Out("RebirthUtilities-CheckPurgeProgress key: " + key);
//Log.Out("RebirthUtilities-CheckPurgeProgress startValue: " + startValue);
//Log.Out("RebirthUtilities-CheckPurgeProgress endValue: " + endValue);
bool flag1 = purgeDisplayPercentage > 0 && purgeDisplayPercentage >= startValue;
bool flag2 = purgeDisplayPercentage > 0 && purgeDisplayPercentage < endValue;
//Log.Out("RebirthUtilities-CheckPurgeProgress purgeDisplayPercentage >= startValue: " + flag1);
//Log.Out("RebirthUtilities-CheckPurgeProgress purgeDisplayPercentage < endValue: " + flag2);
if (flag1 && flag2)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress AUTO-DISCOVER");
/*if (key < 6)
{
GameManager.Instance.StartCoroutine(RebirthUtilities.processDynamicPrefabs(biomeName, player, 15000f, key));
if (player.Buffs.GetCustomVar("$autoDiscovery_" + biomeKey + "_" + key) == 0f)
{
notification = key;
player.Buffs.SetCustomVar("$autoDiscovery_" + biomeKey + "_" + key, 1f);
}
}*/
//string biomeName = GetCurrentBiomePurgeProgression();
if (key == 0 && player.Buffs.GetCustomVar("$autoDiscovery_" + biomeKey + "_" + key) == 0f)
{
if (RebirthUtilities.EnnemiesAround(player) > 0)
{
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("FuriousRamsayInfo_Purge4AutoDiscovery"), player, 1, "");
}
else
{
GameEventManager.Current.HandleAction("info_purge_autodiscovery" + key, player, player, false, sequenceLink: "");
}
player.Buffs.SetCustomVar("FuriousRamsayInfo_Purge4AutoDiscovery", 1f);
}
else if (key == 5 && player.Buffs.GetCustomVar("$autoDiscovery_" + biomeKey + "_" + key) == 0f)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress 5 UNLOCK BIOME: " + biomeName);
if (RebirthUtilities.EnnemiesAround(player) > 0)
{
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("FuriousRamsayInfo_Purge5BiomeUnlock_" + biomeName), player, 1, "");
}
else
{
GameEventManager.Current.HandleAction("info_purge_autodiscovery" + key + "_" + biomeName, player, player, false, sequenceLink: "");
}
}
else if (key == 6)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress 6 UNLOCK BIOME: " + biomeName);
//Log.Out("RebirthUtilities-CheckPurgeProgress ModBiomeStabilizerDevice_desert: " + player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_desert"));
//Log.Out("RebirthUtilities-CheckPurgeProgress ModBiomeStabilizerDevice_snow: " + player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_snow"));
//Log.Out("RebirthUtilities-CheckPurgeProgress ModBiomeStabilizerDevice_wasteland: " + player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_wasteland"));
//Log.Out("RebirthUtilities-CheckPurgeProgress ModBiomeStabilizerDevice_burnt_forest: " + player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_burnt_forest"));
bool unlockDesert = false;
bool unlockSnow = false;
bool unlockWasteland = false;
bool unlockBurntForest = false;
if (biomeName == "pine_forest" && player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_desert") == 0f)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK DESERT");
unlockDesert = true;
}
else if (biomeName == "desert" && player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_snow") == 0f)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK SNOW");
unlockSnow = true;
}
else if (biomeName == "snow" && player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_wasteland") == 0f)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK WASTELAND");
unlockWasteland = true;
}
else if (biomeName == "wasteland" && player.Buffs.GetCustomVar("ModBiomeStabilizerDevice_burnt_forest") == 0f)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK BURNT");
unlockBurntForest = true;
}
bool sendMessage = false;
string message = "";
string soundName = "purge_unlock";
if (unlockDesert)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK DESERT SCHEMATIC");
player.Buffs.SetCustomVar("ModBiomeStabilizerDevice_desert", 1f);
player.Buffs.SetCustomVar("FuriousRamsayInfo_Purge5BiomeUnlock_desert", 1f);
sendMessage = true;
message = string.Format(Localization.Get("PurgeModBiomeStabilizerReport"), Localization.Get("biome_desert"));
notificationBiome = biomeName;
}
if (unlockSnow)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK SNOW SCHEMATIC");
player.Buffs.SetCustomVar("ModBiomeStabilizerDevice_snow", 1f);
player.Buffs.SetCustomVar("FuriousRamsayInfo_Purge5BiomeUnlock_snow", 1f);
sendMessage = true;
message = string.Format(Localization.Get("PurgeModBiomeStabilizerReport"), Localization.Get("biome_snow"));
notificationBiome = biomeName;
}
if (unlockWasteland)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK WASTELAND SCHEMATIC");
player.Buffs.SetCustomVar("ModBiomeStabilizerDevice_wasteland", 1f);
player.Buffs.SetCustomVar("FuriousRamsayInfo_Purge5BiomeUnlock_wasteland", 1f);
sendMessage = true;
message = string.Format(Localization.Get("PurgeModBiomeStabilizerReport"), Localization.Get("biome_wasteland"));
notificationBiome = biomeName;
}
if (unlockBurntForest)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress UNLOCK BURNT SCHEMATIC");
player.Buffs.SetCustomVar("ModBiomeStabilizerDevice_burnt_forest", 1f);
player.Buffs.SetCustomVar("FuriousRamsayInfo_Purge5BiomeUnlock_burnt_forest", 1f);
sendMessage = true;
message = string.Format(Localization.Get("PurgeModBiomeStabilizerReport"), Localization.Get("biome_burnt_forest"));
notificationBiome = biomeName;
}
if (sendMessage)
{
if (isLocal)
{
Manager.PlayInsidePlayerHead(soundName);
GameManager.ShowTooltip((EntityPlayerLocal)player, message, string.Empty);
}
else
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage((NetPackage)NetPackageManager.GetPackage<NetPackageShowToolbetlMessage>().Setup(message, player.entityId, soundName));
}
}
}
if (key < 6)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress processDynamicPrefabs: " + biomeName + " / " + key);
GameManager.Instance.StartCoroutine(RebirthUtilities.processDynamicPrefabs(biomeName, player, 15000f, key));
if (player.Buffs.GetCustomVar("$autoDiscovery_" + biomeKey + "_" + key) == 0f)
{
notification = key;
notificationBiome = biomeName;
player.Buffs.SetCustomVar("$autoDiscovery_" + biomeKey + "_" + key, 1f);
}
}
break;
}
}
}
//Log.Out("RebirthUtilities-CheckPurgeProgress notification: " + notification);
//Log.Out("RebirthUtilities-CheckPurgeProgress RebirthVariables.biomes.Count: " + RebirthVariables.biomes.Count);
foreach (KeyValuePair<int, string> biomeEntry in RebirthVariables.biomes)
{
int key = biomeEntry.Key;
string value = biomeEntry.Value;
int clearedPrefabs = RebirthManager.GetTotalClearedPrefabCount(value);
int totalPrefabs = RebirthUtilities.GetTotalSpawnedPrefab(value);
float biomePercentage = ((float)clearedPrefabs / totalPrefabs) * 100;
int index = key + 1;
if (index < RebirthVariables.biomes.Count)
{
string biomeName = RebirthVariables.biomes[index];
//Log.Out("RebirthUtilities-CheckPurgeProgress biomeName: " + biomeName);
//Log.Out("RebirthUtilities-CheckPurgeProgress biomePercentage: " + biomePercentage);
//if (biomePercentage < 90)
{
//Log.Out("RebirthUtilities-CheckPurgeProgress 1: " + "BiomeProtection_" + biomeName);
if (!player.Buffs.HasBuff("BiomeProtection_" + biomeName))
{
player.Buffs.AddBuff("BiomeProtection_" + biomeName);
}
}
/*else
{
//Log.Out("RebirthUtilities-CheckPurgeProgress 2");
if (player.Buffs.HasBuff("BiomeProtection_" + biomeName))
{
//Log.Out("RebirthUtilities-CheckPurgeProgress 3");
player.Buffs.RemoveBuff("BiomeProtection_" + biomeName);
}
}*/
}
}
if (notification > -1 && notification < 9999)
{
yield return new WaitForSeconds(8);
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-CheckPurgeProgress notification: " + notification);
Log.Out("RebirthUtilities-CheckPurgeProgress percentage: " + percentage);
Log.Out("RebirthUtilities-CheckPurgeProgress purgeDisplayPercentage: " + purgeDisplayPercentage);
Log.Out("RebirthUtilities-CheckPurgeProgress biome: " + biome);
Log.Out("RebirthUtilities-CheckPurgeProgress isLocal: " + isLocal);
Log.Out("RebirthUtilities-CheckPurgeProgress notificationBiome: " + notificationBiome);
}
string message = string.Format(Localization.Get("PurgeAutoDiscoverReport"), notification, Localization.Get("biome_" + notificationBiome));
string soundName = "purge_unlock";
if (isLocal)
{
Manager.PlayInsidePlayerHead(soundName);
GameManager.ShowTooltip((EntityPlayerLocal)player, message, string.Empty);
}
else
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage((NetPackage)NetPackageManager.GetPackage<NetPackageShowToolbetlMessage>().Setup(message, player.entityId, soundName));
}
}
else if (notification == 9999)
{
}
yield break;
}
// Add a new PurgeBiome entry
public static void AddPurgeBiome(string biome, int count)
{
RebirthVariables.purgeBiomes.Add(new PurgeBiome(biome, count));
}
// Update the count for a given biome
public static bool ChangePurgeBiome(string biome, int newCount)
{
var purgeBiome = RebirthVariables.purgeBiomes.FirstOrDefault(pb => pb.biome == biome);
if (purgeBiome != null)
{
purgeBiome.count = newCount;
return true;
}
return false; // Biome not found
}
// Get the count for a given biome
public static int GetPurgeBiome(string biome)
{
int value = 0;
var purgeBiome = RebirthVariables.purgeBiomes.FirstOrDefault(pb => pb.biome == biome);
if (purgeBiome != null)
{
value = purgeBiome.count;
}
return value;
}
// Function to retrieve the cleared value for a given biome and difficulty
public static int GetTotalSpawnedPrefab(string biome)
{
return RebirthVariables.trackedPrefabs
.Where(p => p.biome == biome) // Find all prefabs matching the biome
.Sum(p => p.count); // Sum the 'count' values
}
public static int GetSpawnedPrefab(string biome, int difficulty)
{
/*Log.Out("RebirthUtilities-GetSpawnedPrefab RebirthVariables.trackedPrefabs.Count: " + RebirthVariables.trackedPrefabs.Count);
foreach (SpawnedPrefab prefab in RebirthVariables.trackedPrefabs)
{
Log.Out("RebirthUtilities-GetSpawnedPrefab prefab.biome: " + prefab.biome);
Log.Out("RebirthUtilities-GetSpawnedPrefab prefab.difficulty: " + prefab.difficulty);
Log.Out("RebirthUtilities-GetSpawnedPrefab prefab.count: " + prefab.count);
Log.Out("RebirthUtilities-GetSpawnedPrefab prefab.cleared: " + prefab.cleared);
}*/
SpawnedPrefab foundPrefab = RebirthVariables.trackedPrefabs.Find(p => p.biome == biome && p.difficulty == difficulty);
if (foundPrefab != null)
{
return foundPrefab.count;
}
return 0;
}
public static void AddSpawnedPrefab(string biome, int count, int difficulty)
{
// Create a new SpawnedPrefab and add it to the list
SpawnedPrefab newPrefab = new SpawnedPrefab(biome, count, difficulty);
RebirthVariables.trackedPrefabs.Add(newPrefab);
}
// Function to change the cleared value for a given biome and difficulty
public static IEnumerator processDynamicPrefabs(string biome, EntityPlayer player, float distance, int difficulty)
{
if (RebirthManager.dynamicPrefabs.Count == 0)
{
yield break;
}
if (RebirthVariables.testPurge2)
Log.Out("RebirthUtilities-processDynamicPrefabs =================================================================================");
if (RebirthVariables.testPurge2)
Log.Out("RebirthUtilities-processDynamicPrefabs RebirthManager.dynamicPrefabs.Count: " + RebirthManager.dynamicPrefabs.Count);
RebirthManager.processingDynamicPrefabs = true;
List<DynamicPrefab> filteredPrefabs = RebirthManager.RetrieveDynamicPrefabsFromDistance(biome, player.position, distance, difficulty);
if (RebirthVariables.testPurge2)
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs.Count: " + filteredPrefabs.Count);
for (int i = 0; i < filteredPrefabs.Count; i++)
{
/*if (filteredPrefabs.Count == 5)
{
DynamicPrefab prefab2 = RebirthManager.RetrieveDynamicPrefab(i, biome);
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].PrefabName: " + filteredPrefabs[i].PrefabName);
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].Position: " + filteredPrefabs[i].Position);
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].Size: " + filteredPrefabs[i].Size);
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].Difficulty: " + filteredPrefabs[i].Difficulty);
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].Biome: " + filteredPrefabs[i].Biome);
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].Tags: " + filteredPrefabs[i].Tags);
}
}*/
//for (int j = 0; j <= difficulty; j++)
{
DynamicPrefab prefab = filteredPrefabs[i]; // RebirthManager.RetrieveDynamicPrefab(filteredPrefabs, j, biome);
if (prefab != null)
{
//Vector3 location = new Vector3(prefab.Position.x, prefab.Position.y, prefab.Position.z);
Vector3 location = new Vector3(prefab.Position.x + prefab.Size.x / 2f, prefab.Position.y, prefab.Position.z + prefab.Size.z / 2f);
bool isPrefabDiscovered = RebirthManager.IsPrefabDiscovered(prefab.PrefabName, prefab.Position);
bool isPrefabCleared = RebirthManager.IsPrefabCleared(prefab.PrefabName, prefab.Position);
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-processDynamicPrefabs prefab.PrefabName: " + prefab.PrefabName);
Log.Out("RebirthUtilities-processDynamicPrefabs prefab.Position: " + prefab.Position);
Log.Out("RebirthUtilities-processDynamicPrefabs prefab.Size: " + prefab.Size);
Log.Out("RebirthUtilities-processDynamicPrefabs prefab.Difficulty: " + prefab.Difficulty);
Log.Out("RebirthUtilities-processDynamicPrefabs prefab.Biome: " + prefab.Biome);
Log.Out("RebirthUtilities-processDynamicPrefabs isPrefabDiscovered: " + isPrefabDiscovered);
}
if (!isPrefabDiscovered && !isPrefabCleared)
{
//PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(prefab.Position);
PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(location);
if (poiatPosition != null)
{
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-processDynamicPrefabs poiatPosition.prefab.PrefabName: " + poiatPosition.prefab.PrefabName);
Log.Out("RebirthUtilities-processDynamicPrefabs poiatPosition.prefab.Tags: " + poiatPosition.prefab.Tags);
Log.Out("RebirthUtilities-processDynamicPrefabs poiatPosition.prefab.SleeperVolumes.Count: " + poiatPosition.prefab.SleeperVolumes.Count);
Log.Out("RebirthUtilities-processDynamicPrefabs poiatPosition.prefab.InfoVolumes.Count: " + poiatPosition.prefab.InfoVolumes.Count);
Log.Out("RebirthUtilities-processDynamicPrefabs poiatPosition.prefab.SleeperVolumes.Count: " + poiatPosition.prefab.SleeperVolumes.Count);
Log.Out("RebirthUtilities-processDynamicPrefabs poiatPosition.prefab.SleeperVolumes.Capacity: " + poiatPosition.prefab.SleeperVolumes.Capacity);
}
//if (poiatPosition.prefab.SleeperVolumes.Count == 0)
if (prefab.PrefabName.ToLower() != poiatPosition.prefab.PrefabName.ToLower())
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-processDynamicPrefabs DIFFERENT PREFAB NAMES");
RebirthManager.RemoveDynamicPrefab(prefab.PrefabName, prefab.Position);
}
else if (poiatPosition.prefab.SleeperVolumes.Count == 0)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-processDynamicPrefabs REMOVE - NO SLEEPER VOLUMES");
RebirthManager.RemoveDynamicPrefab(prefab.PrefabName, prefab.Position);
}
else
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-processDynamicPrefabs ADD DISCOVERED PREFAB");
Dictionary<int, string> Players = new Dictionary<int, string>();
Players.Add(-1, "Server");
RebirthManager.AddDiscoveredPrefab(prefab.PrefabName, prefab.Position, prefab.Size, prefab.Difficulty, -1, Players, prefab.Biome);
//RebirthManager.AddDiscoveredPrefab(prefab.PrefabName, location, new Vector3(prefab.Size.x, prefab.Size.y, prefab.Size.z), prefab.Difficulty, 0, Players, prefab.Biome);
RebirthManager.RemoveDynamicPrefab(prefab.PrefabName, prefab.Position);
RebirthManager.processingDynamicPrefabs = false;
//yield break;
}
}
else
{
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].PrefabName: " + filteredPrefabs[i].PrefabName);
Log.Out("RebirthUtilities-processDynamicPrefabs filteredPrefabs[" + i + "].Tags: " + filteredPrefabs[i].Tags);
}
RebirthManager.RemoveDynamicPrefab(prefab.PrefabName, prefab.Position);
}
}
else
{
RebirthManager.RemoveDynamicPrefab(prefab.PrefabName, prefab.Position);
}
}
else
{
if (RebirthVariables.testPurge2)
{
Log.Out("RebirthUtilities-processDynamicPrefabs B filteredPrefabs[" + i + "].PrefabName: " + filteredPrefabs[i].PrefabName);
Log.Out("RebirthUtilities-processDynamicPrefabs B filteredPrefabs[" + i + "].Position: " + filteredPrefabs[i].Position);
Log.Out("RebirthUtilities-processDynamicPrefabs B filteredPrefabs[" + i + "].Size: " + filteredPrefabs[i].Size);
Log.Out("RebirthUtilities-processDynamicPrefabs B filteredPrefabs[" + i + "].Difficulty: " + filteredPrefabs[i].Difficulty);
Log.Out("RebirthUtilities-processDynamicPrefabs B filteredPrefabs[" + i + "].Biome: " + filteredPrefabs[i].Biome);
Log.Out("RebirthUtilities-processDynamicPrefabs B filteredPrefabs[" + i + "].Tags: " + filteredPrefabs[i].Tags);
}
}
}
}
RebirthManager.processingDynamicPrefabs = false;
yield break;
}
public static PrefabInstance GetPrefabAtPosition(Vector3 position)
{
List<PrefabInstance> spawnPIs = new List<PrefabInstance>();
PrefabInstance tempPrefab = null;
int numSleepers = 0;
GameManager.Instance.World.GetPOIsAtXZ((int)position.x, (int)position.x, (int)position.z, (int)position.z, spawnPIs);
for (int index = 0; index < spawnPIs.Count; ++index)
{
PrefabInstance spawnPi = spawnPIs[index];
if (spawnPi != null)
{
bool shouldBypass = spawnPi.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("hideui"));
Vector3 location = new Vector3(spawnPi.boundingBoxPosition.x + spawnPi.boundingBoxSize.x / 2f, spawnPi.boundingBoxPosition.y, spawnPi.boundingBoxPosition.z + spawnPi.boundingBoxSize.z / 2f);
if (RebirthVariables.testPurge2)
{
Log.Out("RebirthUtilities-GetPrefabAtPosition spawnPi.prefab.PrefabName: " + spawnPi.prefab.PrefabName);
Log.Out("RebirthUtilities-GetPrefabAtPosition spawnPi.boundingBoxPosition: " + spawnPi.boundingBoxPosition);
Log.Out("RebirthUtilities-GetPrefabAtPosition spawnPi.boundingBoxSize: " + spawnPi.boundingBoxSize);
Log.Out("RebirthUtilities-GetPrefabAtPosition spawnPi.prefab.Tags: " + spawnPi.prefab.Tags);
Log.Out("RebirthUtilities-GetPrefabAtPosition spawnPi.prefab.SleeperVolumes.Count: " + spawnPi.prefab.SleeperVolumes.Count);
Log.Out("RebirthUtilities-GetPrefabAtPosition position / location: " + position + " / " + location);
}
if (!shouldBypass)
{
//if (!spawnPi.prefab.PrefabName.ToLower().Contains("_tile_") && spawnPi.prefab.SleeperVolumes.Count > 0)
if (location == position)
{
//Log.Out("RebirthUtilities-GetPrefabAtPosition FOUND SAME sleeperVolumes.Count" + GameManager.Instance.World.GetPOIAtPosition(position, false).sleeperVolumes.Count);
if (RebirthVariables.testPurge2)
Log.Out("RebirthUtilities-GetPrefabAtPosition RETURN spawnPi");
return spawnPi;
}
int numCurrentSleepers = spawnPi.prefab.SleeperVolumes.Count;
if (numCurrentSleepers > 0)
{
if (numSleepers == 0)
{
//Log.Out("RebirthUtilities-GetPrefabAtPosition 1");
tempPrefab = spawnPi;
numSleepers = numCurrentSleepers;
}
else
{
if (tempPrefab != null &&
!spawnPi.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("streettile,rwgonly")) &&
tempPrefab.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("streettile,rwgonly"))
)
{
//Log.Out("RebirthUtilities-GetPrefabAtPosition 2");
tempPrefab = spawnPi;
numSleepers = numCurrentSleepers;
}
else if (tempPrefab == null)
{
//Log.Out("RebirthUtilities-GetPrefabAtPosition 3");
tempPrefab = spawnPi;
numSleepers = numCurrentSleepers;
}
}
}
}
}
}
if (tempPrefab != null)
{
//Log.Out("RebirthUtilities-GetPrefabAtPosition RETURN FUZZY MATCH: " + tempPrefab.prefab.PrefabName);
return tempPrefab;
}
PrefabInstance prefab = GameManager.Instance.World.GetPOIAtPosition(position, false);
if (prefab != null)
{
if (RebirthVariables.testPurge2)
{
Log.Out("RebirthUtilities-GetPrefabAtPosition RETURN OTHER PrefabName: " + prefab.prefab.PrefabName);
Log.Out("RebirthUtilities-GetPrefabAtPosition RETURN OTHER sleeperVolumes.Count: " + prefab.sleeperVolumes.Count);
}
}
return prefab;
}
public static void RandomizePlayerEquipment(EntityPlayerLocal player)
{
System.Random random = new System.Random();
// Groups of armor strings
var armorGroups = new List<List<string>>()
{
new List<string>() { "armorLumberjackHelmet", "armorRogueHelmet", "armorScavengerHelmet", "armorAthleticHelmet", "armorFarmerHelmet" },
new List<string>() { "armorLumberjackOutfit", "armorRogueOutfit", "armorScavengerOutfit", "armorAthleticOutfit", "armorFarmerOutfit" },
new List<string>() { "armorLumberjackGloves", "armorRogueGloves", "armorScavengerGloves", "armorAthleticGloves", "armorFarmerGloves" },
new List<string>() { "armorLumberjackBoots", "armorRogueBoots", "armorScavengerBoots", "armorAthleticBoots", "armorFarmerBoots" }
};
// Iterate over each armor group (head, body, hands, feet)
for (int i = 0; i < armorGroups.Count; i++)
{
// Pick a random armor piece from the group
string randomArmor = armorGroups[i][random.Next(armorGroups[i].Count)];
// Create an ItemValue for the randomly selected armor
ItemValue itemValue = ItemClass.GetItem(randomArmor, false);
itemValue.Quality = 1;
itemValue.Modifications = new ItemValue[4];
// Assign it to the correct equipment slot
player.equipment.SetSlotItem(i, itemValue);
XUiM_PlayerInventory playerInventory = LocalPlayerUI.GetUIForPlayer(player).xui.PlayerInventory;
playerInventory.xui.PlayerEquipment.RefreshEquipment();
}
}
public static IEnumerator checkSleeperVolumes(PrefabInstance poiatPosition, EntityPlayer _playerTouched, int maxSleeperVolumeCount, bool sendToClient = false)
{
RebirthVariables.checkSleeperVolumes = true;
bool shouldBypass = poiatPosition.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("rwgonly,streettile,hideui"));
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.name: " + poiatPosition.name);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.prefab.PrefabName: " + poiatPosition.prefab.PrefabName);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.prefab.Tags: " + poiatPosition.prefab.Tags);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.prefab.DifficultyTier: " + poiatPosition.prefab.DifficultyTier);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.prefab.statistics.ToString(): " + poiatPosition.prefab.statistics.ToString());
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.prefab.entities.Count: " + poiatPosition.prefab.entities.Count);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.prefab.ThemeTags: " + poiatPosition.prefab.ThemeTags);
/*foreach (var marker in poiatPosition.prefab.POIMarkers)
{
Log.Out("RebirthUtilities-checkSleeperVolumes marker.name: " + marker.name);
Log.Out("RebirthUtilities-checkSleeperVolumes marker.MarkerType: " + marker.MarkerType);
Log.Out("RebirthUtilities-checkSleeperVolumes marker.Tags: " + marker.Tags);
}*/
}
if (RebirthManager.IsPrefabCleared(poiatPosition.prefab.PrefabName, new Vector3(poiatPosition.boundingBoxPosition.x, poiatPosition.boundingBoxPosition.y, poiatPosition.boundingBoxPosition.z)))
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes PREFAB IS ALREADY CLEARED");
if (sendToClient)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes SEND TO CLIENT 0");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScenarioDisplay>().Setup(1, false), false, _playerTouched.entityId);
}
else
{
RebirthVariables.purgeDisplay = false;
}
RebirthVariables.checkSleeperVolumes = false;
yield break;
}
if (RebirthVariables.testPurge)
Log.Out("==========================================================================");
bool shouldActivate = false;
int numSpawns = 0;
int numCurrentSpawns = 0;
int numVolumes = 0;
int clearedSleeperVolumeCount = 0;
int totalSleeperVolumeCount = poiatPosition.prefab.SleeperVolumes.Count;
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.prefab.SleeperVolumes.Count: " + totalSleeperVolumeCount);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.name: " + poiatPosition.name);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.sleeperVolumes.Count: " + poiatPosition.sleeperVolumes.Count);
//Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.triggerVolumes.Count: " + poiatPosition.triggerVolumes.Count);
//Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.wallVolumes.Count: " + poiatPosition.wallVolumes.Count);
}
if (totalSleeperVolumeCount > 0 && !poiatPosition.prefab.Tags.Test_AnySet(FastTags<TagGroup.Poi>.Parse("hideui")))
{
shouldBypass = false;
}
//Log.Out("================================================================");
foreach (SleeperVolume volume in poiatPosition.sleeperVolumes)
{
numSpawns = numSpawns + volume.numSpawned;
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes volume.numSpawned: " + volume.numSpawned);
if (!volume.wasCleared)
{
byte difficultyTier = poiatPosition.prefab.DifficultyTier;
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes difficultyTier: " + difficultyTier);
if (!shouldBypass)
{
shouldActivate = true;
}
float num = poiatPosition.LastQuestClass == null ? 1f : poiatPosition.LastQuestClass.SpawnMultiplier;
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes num: " + num);
float _countScale = num * ((int)difficultyTier < SleeperVolume.difficultyTierScale.Length ? SleeperVolume.difficultyTierScale[(int)difficultyTier] : SleeperVolume.difficultyTierScale[SleeperVolume.difficultyTierScale.Length - 1]);
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-checkSleeperVolumes _countScale: " + _countScale);
Log.Out("RebirthUtilities-checkSleeperVolumes volume.spawnCountMin: " + volume.spawnCountMin);
Log.Out("RebirthUtilities-checkSleeperVolumes volume.spawnCountMax: " + volume.spawnCountMax);
Log.Out("RebirthUtilities-checkSleeperVolumes volume.spawnPointList.Count: " + volume.spawnPointList.Count);
Log.Out("RebirthUtilities-checkSleeperVolumes volume.Center: " + volume.Center);
}
numVolumes++;
if (volume.numSpawned > 0)
{
numCurrentSpawns = numCurrentSpawns + volume.numSpawned;
//Log.Out("RebirthUtilities-checkSleeperVolumes numVolumes: " + numVolumes);
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-checkSleeperVolumes volume.numSpawned: " + volume.numSpawned);
Log.Out("RebirthUtilities-checkSleeperVolumes volume.wasCleared: " + volume.wasCleared);
}
}
else
{
numCurrentSpawns = numCurrentSpawns + 1;
}
}
else
{
clearedSleeperVolumeCount++;
}
//yield return new WaitForSeconds(0.2f);
}
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-checkSleeperVolumes shouldActivate: " + shouldActivate);
Log.Out("RebirthUtilities-checkSleeperVolumes COUNT numVolumes: " + numVolumes);
}
if (!sendToClient)
{
RebirthVariables.currentSleeperVolumeCount = numVolumes;
RebirthVariables.currentPOITier = poiatPosition.prefab.DifficultyTier;
}
if (shouldActivate && !RebirthVariables.activatingSleeperVolumes)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes F");
//Log.Out("RebirthUtilities-checkSleeperVolumes activateSleeperVolumes");
GameManager.Instance.StartCoroutine(RebirthUtilities.activateSleeperVolumes(poiatPosition.sleeperVolumes, _playerTouched, poiatPosition.prefab.PrefabName, new Vector3(poiatPosition.boundingBoxPosition.x, poiatPosition.boundingBoxPosition.y, poiatPosition.boundingBoxPosition.z), poiatPosition.prefab.DifficultyTier));
}
if (numVolumes > maxSleeperVolumeCount)
{
if (!sendToClient)
{
RebirthVariables.maxSleeperVolumeCount = numVolumes;
}
else
{
maxSleeperVolumeCount = numVolumes;
}
}
float currentSleeperVolumePerc = 0;
if (!sendToClient)
{
RebirthVariables.currentSleeperEntityCount = numCurrentSpawns;
currentSleeperVolumePerc = ((float)numVolumes / (float)poiatPosition.prefab.SleeperVolumes.Count) * 100;
RebirthVariables.currentSleeperVolumePerc = currentSleeperVolumePerc;
RebirthVariables.clearedSleeperVolumeCount = clearedSleeperVolumeCount;
RebirthVariables.totalSleeperVolumeCount = totalSleeperVolumeCount;
}
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-checkSleeperVolumes numVolumes: " + numVolumes);
Log.Out("RebirthUtilities-checkSleeperVolumes numCurrentSpawns: " + numCurrentSpawns);
Log.Out("RebirthUtilities-checkSleeperVolumes numSpawns: " + numSpawns);
Log.Out("RebirthUtilities-checkSleeperVolumes maxSleeperVolumeCount: " + maxSleeperVolumeCount);
Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.sleeperVolumes.Count: " + poiatPosition.sleeperVolumes.Count);
Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.maxSleeperVolumeCount: " + RebirthVariables.maxSleeperVolumeCount);
Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.currentSleeperVolumePerc: " + RebirthVariables.currentSleeperVolumePerc);
Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.clearedSleeperVolumeCount: " + RebirthVariables.clearedSleeperVolumeCount);
Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.totalSleeperVolumeCount: " + RebirthVariables.totalSleeperVolumeCount);
Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.currentSleeperEntityCount: " + RebirthVariables.currentSleeperEntityCount);
Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.currentSleeperVolumeCount: " + RebirthVariables.currentSleeperVolumeCount);
//Log.Out("RebirthUtilities-checkSleeperVolumes shouldActivate: " + shouldActivate);
}
if (sendToClient)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes SEND TO CLIENT 1, _playerTouched.entityId: " + _playerTouched.entityId);
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageUpdatePurgeDisplay>().Setup(poiatPosition.prefab.PrefabName, poiatPosition.boundingBoxPosition.x, poiatPosition.boundingBoxPosition.y, poiatPosition.boundingBoxPosition.z, numCurrentSpawns, numVolumes, maxSleeperVolumeCount, currentSleeperVolumePerc, clearedSleeperVolumeCount, totalSleeperVolumeCount, poiatPosition.prefab.DifficultyTier), false, _playerTouched.entityId);
}
/*else
{
_playerTouched.Buffs.SetCustomVar("$currentSleeperEntityCount", RebirthVariables.currentSleeperEntityCount);
_playerTouched.Buffs.SetCustomVar("$currentSleeperVolumeCount", RebirthVariables.currentSleeperVolumeCount);
_playerTouched.Buffs.SetCustomVar("$maxSleeperVolumeCount", RebirthVariables.maxSleeperVolumeCount);
_playerTouched.Buffs.SetCustomVar("$currentSleeperVolumePerc", RebirthVariables.currentSleeperVolumePerc);
}*/
if (numVolumes == 0 && numSpawns > 0)
{
Vector3 prefabLocation = new Vector3(poiatPosition.boundingBoxPosition.x, poiatPosition.boundingBoxPosition.y, poiatPosition.boundingBoxPosition.z);
int totalKills = RebirthManager.GetTotalPurgeKills(poiatPosition.prefab.PrefabName, prefabLocation);
//int numEntitiesCleared = RebirthManager.GetDiscoveredPrefabEntitiesCleared(poiatPosition.prefab.PrefabName, prefabLocation);
bool isPrefabCleared = RebirthManager.IsPrefabCleared(poiatPosition.prefab.PrefabName, prefabLocation);
if (RebirthVariables.testPurge)
{
Log.Out("RebirthUtilities-checkSleeperVolumes totalKills: " + totalKills);
//Log.Out("RebirthUtilities-checkSleeperVolumes numEntitiesCleared: " + numEntitiesCleared);
Log.Out("RebirthUtilities-checkSleeperVolumes isPrefabCleared: " + isPrefabCleared);
}
//bool flag = numEntitiesCleared == -1 || numEntitiesCleared >= 0;
bool flag = totalKills >= 0;
if (flag && !isPrefabCleared)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes A1");
if (sendToClient)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes SEND TO CLIENT 2");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScenarioDisplay>().Setup(1, false), false, _playerTouched.entityId);
}
else
{
RebirthVariables.purgeDisplay = false;
}
if (RebirthVariables.testPurge)
Log.Out($"RebirthUtilities-checkSleeperVolumes CLEARED POI: {poiatPosition.prefab.PrefabName} / Position: {poiatPosition.boundingBoxPosition} / Size: {poiatPosition.boundingBoxSize}");
//if (!RebirthManager.IsPrefabCleared(poiatPosition.prefab.PrefabName, location))
if (!RebirthVariables.activatingSleeperVolumes)
{
//Log.Out("RebirthUtilities-checkSleeperVolumes numVolumes: " + numVolumes);
//Log.Out("RebirthUtilities-checkSleeperVolumes numCurrentSpawns: " + numCurrentSpawns);
//Log.Out("RebirthUtilities-checkSleeperVolumes numSpawns: " + numSpawns);
//Log.Out("RebirthUtilities-checkSleeperVolumes maxSleeperVolumeCount: " + maxSleeperVolumeCount);
//Log.Out("RebirthUtilities-checkSleeperVolumes poiatPosition.sleeperVolumes.Count: " + poiatPosition.sleeperVolumes.Count);
//Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.maxSleeperVolumeCount: " + RebirthVariables.maxSleeperVolumeCount);
//Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.currentSleeperVolumePerc: " + RebirthVariables.currentSleeperVolumePerc);
//Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.clearedSleeperVolumeCount: " + RebirthVariables.clearedSleeperVolumeCount);
//Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.totalSleeperVolumeCount: " + RebirthVariables.totalSleeperVolumeCount);
//Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.currentSleeperEntityCount: " + RebirthVariables.currentSleeperEntityCount);
//Log.Out("RebirthUtilities-checkSleeperVolumes RebirthVariables.currentSleeperVolumeCount: " + RebirthVariables.currentSleeperVolumeCount);
Dictionary<int, string> Players = new Dictionary<int, string>();
Players.Add(_playerTouched.entityId, _playerTouched.entityName);
string biomeName = RebirthUtilities.GetBiomeName(_playerTouched);
if (biomeName != "")
{
RebirthManager.AddPrefab(poiatPosition.prefab.PrefabName, prefabLocation, new Vector3(poiatPosition.boundingBoxSize.x, poiatPosition.boundingBoxSize.y, poiatPosition.boundingBoxSize.z), poiatPosition.prefab.DifficultyTier, numSpawns, Players, biomeName);
}
}
}
else
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes B");
if (sendToClient)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes SEND TO CLIENT 3");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScenarioDisplay>().Setup(1, false), false, _playerTouched.entityId);
}
else
{
RebirthVariables.purgeDisplay = false;
}
}
}
else
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes C");
if (numVolumes > 0 && numSpawns > 0)
{
if (RebirthVariables.testPurge)
Log.Out($"RebirthUtilities-checkSleeperVolumes NUM VOLUMES LEFT [{numVolumes}] / TOTAL ENTITIES [{numCurrentSpawns}]");
if (sendToClient)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes SEND TO CLIENT 4");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScenarioDisplay>().Setup(1, true), false, _playerTouched.entityId);
}
else
{
RebirthVariables.purgeDisplay = true;
}
Vector3 location = new Vector3(poiatPosition.boundingBoxPosition.x, poiatPosition.boundingBoxPosition.y, poiatPosition.boundingBoxPosition.z);
if (!RebirthManager.IsPrefabDiscovered(poiatPosition.prefab.PrefabName, location))
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes PREFAB DISCOVERED");
Dictionary<int, string> Players = new Dictionary<int, string>();
Players.Add(_playerTouched.entityId, _playerTouched.entityName);
if (_playerTouched.biomeStandingOn != null)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes ADD DISCOVERED PREFAB");
string biomeName = _playerTouched.biomeStandingOn.m_sBiomeName;
RebirthManager.AddDiscoveredPrefab(poiatPosition.prefab.PrefabName, location, new Vector3(poiatPosition.boundingBoxSize.x, poiatPosition.boundingBoxSize.y, poiatPosition.boundingBoxSize.z), poiatPosition.prefab.DifficultyTier, -1, Players, biomeName);
}
}
}
else
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes D");
if (sendToClient)
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes SEND TO CLIENT 5");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScenarioDisplay>().Setup(1, false), false, _playerTouched.entityId);
}
else
{
if (RebirthVariables.testPurge)
Log.Out("RebirthUtilities-checkSleeperVolumes E");
RebirthVariables.purgeDisplay = false;
}
}
}
RebirthVariables.checkSleeperVolumes = false;
yield break;
}
public static IEnumerator activateSleeperVolumes(List<SleeperVolume> sleeperVolumes, EntityPlayer _playerTouched, string prefabName, Vector3 position, int currentPOITier)
{
RebirthVariables.activatingSleeperVolumes = true;
//Log.Out("==========================================================================");
if (RebirthVariables.currentPrefab != prefabName)
{
RebirthVariables.maxSleeperVolumeCount = 0;
RebirthVariables.currentPrefab = prefabName;
}
int numSpawns = 0;
//Log.Out("=======================================================");
//Log.Out("RebirthUtilities-activateSleeperVolumes sleeperVolumes.Count: " + sleeperVolumes.Count);
int numVolumes = 0;
int clearedSleeperVolumeCount = 0;
int totalSleeperVolumeCount = sleeperVolumes.Count;
int numVolume = 0;
foreach (SleeperVolume volume in sleeperVolumes)
{
numVolume++;
if (!volume.wasCleared)
{
numVolumes++;
}
else
{
clearedSleeperVolumeCount++;
}
if (volume.isSpawned)
{
//Log.Out($"RebirthUtilities-activateSleeperVolumes SPAWNED [{numVolume}]");
}
//yield return new WaitForSeconds(0.2f);
}
numVolume = 0;
foreach (SleeperVolume volume in sleeperVolumes)
{
numVolume++;
numSpawns = numSpawns + volume.numSpawned;
if (!volume.isSpawned)
{
bool proceed = false;
//Log.Out("RebirthUtilities-activateSleeperVolumes totalSleeperVolumeCount: " + totalSleeperVolumeCount);
//Log.Out("RebirthUtilities-activateSleeperVolumes clearedSleeperVolumeCount: " + clearedSleeperVolumeCount);
//Log.Out("RebirthUtilities-activateSleeperVolumes currentPOITier: " + currentPOITier);
if (clearedSleeperVolumeCount > 0 && (totalSleeperVolumeCount - clearedSleeperVolumeCount) <= (currentPOITier + 1))
{
if (currentPOITier > 2 && totalSleeperVolumeCount > currentPOITier)
{
proceed = true;
}
else if (currentPOITier < 3)
{
proceed = true;
}
}
/*if (RebirthVariables.maxSleeperVolumeCount >= 10)
{
if (RebirthVariables.currentSleeperVolumePerc > 0 && RebirthVariables.currentSleeperVolumePerc <= 20)
{
proceed = true;
}
}
else
{
if (RebirthVariables.currentSleeperVolumeCount <= 2)
{
proceed = true;
}
}*/
if (proceed)
{
//Log.Out("RebirthUtilities-activateSleeperVolumes UPDATEPLAYERTOUCHED");
volume.UpdatePlayerTouched(_playerTouched.world, _playerTouched);
}
}
//Log.Out("RebirthUtilities-activateSleeperVolumes volume.numSpawned: " + volume.numSpawned);
//yield return new WaitForSeconds(1f);
}
//Log.Out("RebirthUtilities-activateSleeperVolumes UpdateDiscoveredPrefab");
RebirthManager.UpdateDiscoveredPrefab(prefabName, position, 0);
RebirthVariables.activatingSleeperVolumes = false;
yield break;
}
public static void AddNewWaypoint(PrefabInstance _prefabInstance, EntityPlayer player, string iconName)
{
if (_prefabInstance == null)
{
//Log.Out("RebirthUtilities-AddNewWaypoint START");
return;
}
Waypoint _wp = new Waypoint();
_wp.pos = World.worldToBlockPos((Vector3)(_prefabInstance.boundingBoxPosition + _prefabInstance.boundingBoxSize / 2));
_wp.icon = iconName;
_wp.name.Update(_prefabInstance.prefab.PrefabName, PlatformManager.MultiPlatform.User.PlatformUserId);
_wp.ownerId = (PlatformUserIdentifierAbs)null;
//_wp.entityId = -1;
_wp.bIsAutoWaypoint = true;
_wp.bUsingLocalizationId = true;
/*if (player.Waypoints.ContainsWaypoint(_wp))
{
//Log.Out("RebirthUtilities-AddNewWaypoint WP Exists");
return;
}*/
NavObject navObject = NavObjectManager.Instance.RegisterNavObject("waypoint", (Vector3)_wp.pos, _wp.icon, true);
navObject.UseOverrideColor = true;
navObject.OverrideColor = Color.white;
navObject.IsActive = true;
navObject.name = _wp.name.Text;
navObject.usingLocalizationId = true;
//_wp.navObject = navObject;
//player.Waypoints.Collection.Add(_wp);
}
public static bool CanBeLooted(Vector3i _blockPos, BlockValue _blockValue, int _cIdx)
{
bool __result = true;
World world = GameManager.Instance.World;
TileEntity tileEntity = world.GetTileEntity(_cIdx, _blockPos) as TileEntity;
if (tileEntity != null)
{
if (tileEntity is TileEntityLootContainer lootContainer)
{
if (lootContainer.bPlayerStorage)
{
return true;
}
}
}
bool isWithinTraderArea = world.IsWithinTraderArea(_blockPos);
//Log.Out("RebirthUtilities-CanBeLooted isWithinTraderArea: " + isWithinTraderArea);
if (isWithinTraderArea)
{
bool optionLootTrader = RebirthVariables.customLootTraderArea;
//Log.Out("RebirthUtilities-CanBeLooted optionLootTrader: " + optionLootTrader);
//Log.Out("RebirthUtilities-CanBeLooted A RebirthVariables.customLootTraderArea: " + RebirthVariables.customLootTraderArea);
if (!RebirthVariables.customLootTraderArea)
{
//Log.Out("RebirthUtilities-CanBeLooted A1");
__result = false;
}
}
else
{
//Log.Out("RebirthUtilities-CanBeLooted B");
bool isActuallyWithinTraderArea = world.GetTraderAreaAt(_blockPos) != null;
if (isActuallyWithinTraderArea)
{
//Log.Out("RebirthUtilities-CanBeLooted B RebirthVariables.customLootTraderArea: " + RebirthVariables.customLootTraderArea);
if (!RebirthVariables.customLootTraderArea)
{
//Log.Out("RebirthUtilities-CanBeLooted B1");
__result = false;
}
}
else
{
}
}
return __result;
}
public static void ChangeOption(string option, string value)
{
//Log.Out("ConsoleCmdChangeOption-Execute option: " + option);
//Log.Out("ConsoleCmdChangeOption-Execute value: " + value);
if (option.Trim().ToLower() == "hnp")
{
if (value.Trim().ToLower() == "true")
{
RebirthVariables.customHordeNight = true;
}
else if (value.Trim().ToLower() == "false")
{
RebirthVariables.customHordeNight = false;
}
BuildSpecificEntityGroups(ref RebirthUtilities.bloodMoonGroups, false, true);
}
else if (option.Trim().ToLower() == "turbo")
{
if (value.Trim().ToLower() == "true")
{
RebirthVariables.customHordeNightTurbo = true;
}
else if (value.Trim().ToLower() == "false")
{
RebirthVariables.customHordeNightTurbo = false;
}
BuildSpecificEntityGroups(ref RebirthUtilities.bloodMoonGroups, false, true);
}
else if (option.Trim().ToLower() == "hnpmultiplier")
{
if (int.TryParse(value, out int newValue))
{
RebirthVariables.HNPMultiplier = newValue;
BuildSpecificEntityGroups(ref RebirthUtilities.bloodMoonGroups, false, true);
}
}
}
public static (int min, int max) GetGamestageFloorAndCeiling(int gameStage, Dictionary<(int min, int max), List<int>> group)
{
foreach (var range in group.Keys)
{
if (gameStage >= range.min && gameStage <= range.max)
{
return range;
}
}
// Return a default value if no range is found
throw new ArgumentException($"Game stage {gameStage} does not fall within any defined ranges.");
}
public static void RandomizeList<T>(List<T> list)
{
System.Random random = new System.Random();
int n = list.Count;
for (int i = n - 1; i > 0; i--)
{
int j = random.Next(0, i + 1); // Select a random index
// Swap elements
T temp = list[i];
list[i] = list[j];
list[j] = temp;
}
}
public static void AddEntityToGroupFromCount2(List<int> entityGroup, ref List<int> entities, int numEntities = 0)
{
if (entityGroup.Count > 0)
{
for (int i = 0; i < numEntities; i++)
{
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entityGroup.Count);
entities.Add(entityGroup[randomValue]);
}
}
}
public static void AddEntityToGroup2(List<int> entityGroup, ref List<int> entities, int iterations = 1, float randomValueCompare = 100f, bool bypassRandom = false, bool bypassTornados = false, bool log = false)
{
if (log)
Log.Out("RebirthUtilities-AddEntityToGroup2 START, bypassRandom: " + bypassRandom);
if (entityGroup.Count > 0)
{
if (log)
Log.Out("RebirthUtilities-AddEntityToGroup2 entityGroup.Count: " + entityGroup.Count);
for (int i = 0; i < iterations; i++)
{
if (log)
Log.Out("RebirthUtilities-AddEntityToGroup2 i: " + i);
foreach (int entity in entityGroup)
{
float compare = randomValueCompare;
float randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(1, 1000);
if (log)
Log.Out("RebirthUtilities-AddEntityToGroup2 randomValue: " + randomValue);
if (!bypassRandom || (!bypassTornados && EntityClass.GetEntityClassName(entity).ToLower().Contains("tornado")))
{
if (log)
Log.Out("RebirthUtilities-AddEntityToGroup2 REDUCE COMPARE TO 25");
compare = 25;
}
if (log)
Log.Out("RebirthUtilities-AddEntityToGroup2 randomValueCompare * 10: " + randomValueCompare * 10);
if (randomValue <= compare * 10)
{
if (log)
Log.Out("RebirthUtilities-AddEntityToGroup2 ADD entity: " + EntityClass.GetEntityClassName(entity));
entities.Add(entity);
}
}
}
}
}
public static void BuildSpecificEntityGroups(ref Dictionary<(int min, int max), List<int>> groupToBuild, bool buildBiomeGroup = false, bool buildBloodMoonGroup = false)
{
//Log.Out("RebirthUtilities-BuildSpecificEntityGroups START");
List<int> entities = new List<int>();
groupToBuild = new Dictionary<(int min, int max), List<int>>();
float numBanditSpawns = float.Parse(RebirthVariables.customBanditSpawnMultiplier) / 100;
float numSurvivorSpawns = float.Parse(RebirthVariables.customSurvivorSpawnMultiplier) / 100;
float customTornadosMultiplierOption = float.Parse(RebirthVariables.customTornadosMultiplier) / 100;
bool optionHNP = RebirthVariables.customHordeNight;
bool optionHNPTurbo = RebirthVariables.customHordeNightTurbo;
if (buildBloodMoonGroup)
{
//Log.Out("RebirthUtilities-BuildSpecificEntityGroups optionHNP: " + optionHNP);
//Log.Out("RebirthUtilities-BuildSpecificEntityGroups optionHNPTurbo: " + optionHNPTurbo);
}
int HNMultiplier = RebirthVariables.HNMultiplier;
int HNPMultiplier = RebirthVariables.HNPMultiplier;
float randomValueCompare = 100f;
bool bypassRandom = false;
bool bypassTornados = false;
if (optionHNP)
{
HNMultiplier = HNMultiplier * 2;
bypassRandom = true;
}
else if (optionHNP && optionHNPTurbo)
{
HNMultiplier = HNMultiplier * 3;
RebirthVariables.customXRayDetection = true;
}
if (optionHNP && optionHNPTurbo)
{
HNPMultiplier = HNPMultiplier * 3;
bypassTornados = true;
}
bool addNPCSpawns = true;
if (RebirthVariables.customDelayNPCSpawns == "neverspawn")
{
addNPCSpawns = false;
}
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 240);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
if (RebirthVariables.customDelayNPCSpawns == "nodelay")
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(8 * numBanditSpawns));
}
}
if (numSurvivorSpawns > 0)
{
if (RebirthVariables.customDelayNPCSpawns == "nodelay")
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(8 * numSurvivorSpawns));
}
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 3 * HNMultiplier);
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((0, 10), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 200);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10")
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(8 * numBanditSpawns));
}
}
if (numSurvivorSpawns > 0)
{
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10")
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(8 * numSurvivorSpawns));
}
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 3 * HNMultiplier);
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((10, 20), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10" ||
RebirthVariables.customDelayNPCSpawns == "gs20")
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(8 * numBanditSpawns));
}
}
if (numSurvivorSpawns > 0)
{
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10" ||
RebirthVariables.customDelayNPCSpawns == "gs20")
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(8 * numSurvivorSpawns));
}
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((20, 30), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(5 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(7 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(5 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(7 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((30, 40), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 70);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 90);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(5 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(7 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(5 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(7 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((40, 50), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(5 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(7 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(5 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(7 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((50, 60), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 50);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 50);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 90);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 100);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((60, 70), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 90);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((70, 80), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 30);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 30);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((80, 90), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 110);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((90, 100), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 15);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 15);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 75);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 105);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 4);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((100, 110), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 70);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 100);
/*RandomizeList(entities); //entities.Sort();
for (int i = 0; i < entities.Count; i++)
{
Log.Out("RebirthUtilities-BuildSpecificEntityGroups GENERAL ENTITIES entities[" + i + "]: " + EntityClass.GetEntityClassName(entities[i]));
}*/
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLow, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLow, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 2 * HNMultiplier);
/*List<int> entities2 = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities2, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities2, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities2, 2 * HNMultiplier);
entities2.Sort();
for (int i = 0; i < entities2.Count; i++)
{
Log.Out("RebirthUtilities-BuildSpecificEntityGroups HN ENTITIES entities[" + i + "]: " + EntityClass.GetEntityClassName(entities2[i]));
}*/
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
/*entities2 = new List<int>();
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities2, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
entities2.Sort();
for (int i = 0; i < entities2.Count; i++)
{
Log.Out("RebirthUtilities-BuildSpecificEntityGroups HNP ENTITIES entities[" + i + "]: " + EntityClass.GetEntityClassName(entities2[i]));
}*/
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((110, 120), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLow, ref entities, 5);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersLowMed, ref entities, 5);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 65);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 120);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((120, 130), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 2 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((130, 140), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 30);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 90);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsLowMed, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsLowMed, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 2 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((140, 150), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesLow, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightLowHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((150, 160), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 70);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((160, 170), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMed, ref entities, (int)(4 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(6 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(4 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMed, ref entities, (int)(4 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(6 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(4 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 2 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((170, 180), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(7 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(5 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(7 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(5 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 2 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((180, 190), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersHigh, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(7 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(5 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(7 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(5 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusLow, ref entities, 2 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((190, 200), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 160);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(7 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(5 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(7 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(5 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((200, 210), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(5 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(7 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(5 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(7 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((210, 220), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(5 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(7 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(5 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(7 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((220, 230), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsMedHigh, ref entities, (int)(5 * numBanditSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(7 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsMedHigh, ref entities, (int)(5 * numSurvivorSpawns));
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(7 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((230, 240), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((240, 250), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedMed, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((250, 260), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((260, 270), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((270, 280), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralMed, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 150);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((280, 290), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersFeralHigh, ref entities, 50);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 150);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 100);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusMed, ref entities, 3 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((290, 300), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 120);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((300, 310), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 30);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 130);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 140);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightMedHigh, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((310, 320), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 160);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((320, 330), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedLow, ref entities, 10);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 180);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((330, 340), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 160);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 5 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((340, 350), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((350, 360), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 120);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 12);
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((360, 370), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 12);
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((370, 380), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedMed, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 12);
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((380, 390), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 12);
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((390, 400), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesHigh, ref entities, 12);
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 6);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((400, 410), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 100);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((410, 420), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 100);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusHigh, ref entities, 4 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 6 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((420, 430), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 120);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((430, 440), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersRadiatedHigh, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 120);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((440, 450), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((450, 460), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 140);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 20);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((460, 470), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((470, 480), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 60);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 120);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 40);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((480, 490), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((490, 500), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 40);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 100);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 60);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((500, 510), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((510, 520), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((520, 530), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((530, 540), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((540, 550), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((550, 560), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighHigh, ref entities, 2 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((560, 570), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((570, 580), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightHighHigh, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 4 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((580, 590), entities);
entities = new List<int>();
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedLow, ref entities, 20);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedMed, ref entities, 80);
AddEntityToGroupFromCount2(RebirthUtilities.sleepersTaintedHigh, ref entities, 80);
if (buildBiomeGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.biomesVeryHigh, ref entities, 8);
AddEntityToGroupFromCount2(RebirthUtilities.tornadosLow, ref entities, (int)(4 * customTornadosMultiplierOption));
if (addNPCSpawns)
{
if (numBanditSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.banditsHigh, ref entities, (int)(10 * numBanditSpawns));
}
if (numSurvivorSpawns > 0)
{
AddEntityToGroupFromCount2(RebirthUtilities.survivorsHigh, ref entities, (int)(10 * numSurvivorSpawns));
}
}
}
if (buildBloodMoonGroup)
{
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighLow, ref entities, 2 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighMed, ref entities, 3 * HNMultiplier);
AddEntityToGroupFromCount2(RebirthUtilities.hordeNightVeryHighHigh, ref entities, 4 * HNMultiplier);
if (optionHNP)
{
AddEntityToGroup2(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, 9 * HNPMultiplier, randomValueCompare, bypassRandom, bypassTornados);
}
}
RandomizeList(entities); //entities.Sort();
groupToBuild.Add((590, 9999), entities);
}
public static float GetModifiedIncrease(float geneticValue, float increase)
{
// Ensure geneticValue is within the valid range of 0 to 10
geneticValue = Math.Clamp(geneticValue, 0, 10);
// Calculate the reduction factor based on the genetic value
// At geneticValue = 0, factor = 1 (no reduction)
// At geneticValue = 10, factor = 0.75 (25% reduction)
float reductionFactor = 1 - (0.75f * (geneticValue / 10));
// Apply the reduction factor to the base increase
float modifiedIncrease = increase * reductionFactor;
return modifiedIncrease;
}
public static void SetDismemberChance(EntityAlive player, EntityAlive target, int selectedAmmoTypeIndex, ItemValue itemRanged)
{
player.Buffs.SetCustomVar(".FuriousRamsayHPAmmo", 0f);
string itemName = player.inventory.holdingItem.Name;
//Log.Out("RebirthUtilities-SetDismemberChance itemName: " + itemName);
ItemActionAttack holdingGun = (ItemActionAttack)itemRanged.ItemClass.Actions[0];
string ammoType = ItemClass.GetItem(holdingGun.MagazineItemNames[selectedAmmoTypeIndex], false).ItemClass.GetItemName();
//Log.Out("RebirthUtilities-SetDismemberChance ammoType: " + ammoType);
ItemClass itemClass = itemRanged.ItemClass; // ItemClass.GetItem(itemName, false).ItemClass;
List<string> tagNames = itemClass.ItemTags.GetTagNames();
//ItemValue itemRanged = ItemClass.GetItem(itemClass.GetItemName(), false);
float myDelay = 60;
if ((itemRanged.ItemClass.GetItemName() == "gunBotT2JunkTurret" && player.inventory.holdingItem.GetItemName() != "gunBotT2JunkTurret") || itemRanged.ItemClass.GetItemName().ToLower().StartsWith("furiousramsayjunkturret"))
{
myDelay = 180;
if (player.Buffs.HasBuff("FuriousRamsayRampage"))
{
myDelay = 420;
}
}
else
{
ItemActionData _actionData = player.inventory.holdingItemData.actionData[0];
ItemActionRanged.ItemActionDataRanged itemActionDataRanged = (ItemActionRanged.ItemActionDataRanged)_actionData;
myDelay = EffectManager.GetValue(PassiveEffects.RoundsPerMinute, itemActionDataRanged.invData.itemValue, 60f / itemActionDataRanged.OriginalDelay, player);
//Log.Out("RebirthUtilities-SetDismemberChance myDelay: " + myDelay);
}
if (myDelay < 60)
{
myDelay = 60;
}
//Log.Out("RebirthUtilities-SetDismemberChance BEFORE myDelay: " + myDelay);
float divisor = 20;
myDelay = myDelay / divisor;
//Log.Out("RebirthUtilities-SetDismemberChance AFTER myDelay: " + myDelay);
float value = 60 / myDelay;
//Log.Out("RebirthUtilities-SetDismemberChance BEFORE value: " + value);
if (value > 20)
{
value = 20;
}
//Log.Out("RebirthUtilities-SetDismemberChance AFTER MAX value: " + value);
divisor = 2f;
if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted")))
{
divisor = 4f;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("radiated")))
{
divisor = 3f;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("feral")))
{
divisor = 2.5f;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal,bear")))
{
divisor = 6f;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal,wolf")))
{
divisor = 4f;
}
else if (target.HasAnyTags(FastTags<TagGroup.Global>.Parse("animal,dog")))
{
divisor = 2f;
}
//Log.Out("RebirthUtilities-SetDismemberChance divisor: " + divisor);
value = value / divisor;
//Log.Out("RebirthUtilities-SetDismemberChance AFTER SUBSTRACT value: " + value);
if (value < 1)
{
value = 1;
}
int intValue = (int)Math.Ceiling(value);
//Log.Out("RebirthUtilities-SetDismemberChance AFTER MIN intValue: " + intValue);
float random = GameManager.Instance.World.GetGameRandom().RandomRange(0, 21);
//Log.Out("RebirthUtilities-SetDismemberChance random: " + random);
if (random <= intValue)
{
//Log.Out("RebirthUtilities-SetDismemberChance CAN DISMEMBER");
player.Buffs.SetCustomVar(".FuriousRamsayHPAmmo", 1f);
}
}
public static bool WillLiveAgain(EntityAlive __instance)
{
//Log.Out("RebirthUtilities-WillLiveAgain START");
if (RebirthUtilities.ScenarioSkip())
{
return false;
}
bool isRebirthOn = RebirthVariables.customRebirth;
if (isRebirthOn && !RebirthUtilities.IsHordeNight() && __instance is EntityZombieSDX zombie && !__instance.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss,animal,temp,noRebirth")) && __instance.Buffs.GetCustomVar("$varFuriousRamsaySupportMinion") == 0f)
{
//Log.Out("RebirthUtilities-WillLiveAgain zombie.entityThatKilledMeID: " + zombie.entityThatKilledMeID);
if (zombie.entityThatKilledMeID != -1)
{
Entity killer = __instance.world.GetEntity(zombie.entityThatKilledMeID);
if (killer is EntityPlayer player)
{
ProgressionValue progressionValue = player.Progression.GetProgressionValue("FuriousRamsayRebirth");
int numReborn = (int)__instance.Buffs.GetCustomVar("$reborn");
int numRebirthArmorMod = (int)player.Buffs.GetCustomVar("$ModRebirth");
//Log.Out("RebirthUtilities-WillLiveAgain numRebirthArmorMod: " + numRebirthArmorMod);
//Log.Out("RebirthUtilities-WillLiveAgain BEFORE $reborn: " + numReborn);
int numRebornAdjustment = 0;
if (numRebirthArmorMod == 5)
{
numRebornAdjustment = 1;
}
if (progressionValue.level == 0)
{
return false;
}
else if (progressionValue.level >= 1 &&
progressionValue.level < 4 &&
numReborn >= (1 - numRebornAdjustment)
)
{
return false;
}
else if (progressionValue.level >= 4 &&
progressionValue.level < 7 &&
numReborn >= (2 - numRebornAdjustment)
)
{
return false;
}
else if (progressionValue.level >= 7 &&
progressionValue.level < 10 &&
numReborn >= (3 - numRebornAdjustment)
)
{
return false;
}
else if (progressionValue.level >= 10 &&
numReborn >= (4 - numRebornAdjustment)
)
{
return false;
}
numReborn++;
__instance.Buffs.SetCustomVar("$reborn", numReborn);
//Log.Out("RebirthUtilities-WillLiveAgain AFTER $reborn: " + __instance.Buffs.GetCustomVar("$reborn"));
float chance = progressionValue.Level * 2.5f * (1 - (numRebirthArmorMod * 0.10f));
int random = UnityEngine.Random.Range(0, 101);
//Log.Out("RebirthUtilities-WillLiveAgain REBIRTH chance: " + chance);
//Log.Out("RebirthUtilities-WillLiveAgain REBIRTH random: " + random);
if (RebirthVariables.testRebirth)
{
random = 0;
}
if (random <= chance)
{
__instance.Buffs.SetCustomVar("$willLiveAgain", 1f);
//Log.Out("RebirthUtilities-WillLiveAgain $willLiveAgain");
return true;
}
}
}
}
return false;
}
public static void Reborn(EntityAlive __instance)
{
//Log.Out("RebirthUtilities-Reborn START");
if (__instance is EntityZombieSDX zombie)
{
//Log.Out("RebirthUtilities-Reborn zombie.entityThatKilledMeID: " + zombie.entityThatKilledMeID);
if (zombie.entityThatKilledMeID != -1)
{
Entity killer = __instance.world.GetEntity(zombie.entityThatKilledMeID);
if (killer is EntityPlayer player)
{
ProgressionValue progressionValue = player.Progression.GetProgressionValue("FuriousRamsayRebirth");
//Log.Out("RebirthUtilities-Reborn REBORN");
int chance = progressionValue.Level * 75;
int random = UnityEngine.Random.Range(0, 1001);
//Log.Out("RebirthUtilities-Reborn EVOLUTION chance: " + chance);
//Log.Out("RebirthUtilities-Reborn EVOLUTION random: " + random);
int classID = zombie.entityClass;
if (RebirthVariables.testRebirth)
{
random = 0;
}
if (random <= chance)
{
//Log.Out("RebirthUtilities-Reborn EVOLVED");
string className = zombie.EntityClass.entityClassName;
if (zombie.HasAnyTags(FastTags<TagGroup.Global>.Parse("radiated")))
{
className = className.Replace("Radiated", "Tainted");
}
else if (zombie.HasAnyTags(FastTags<TagGroup.Global>.Parse("feral")))
{
className = className.Replace("Feral", "Radiated");
}
else
{
className = className + "Feral";
}
//Log.Out("RebirthUtilities-Reborn className: " + className);
int newClassID = EntityClass.FromString(className);
if (newClassID != -1)
{
classID = newClassID;
}
//Log.Out("RebirthUtilities-Reborn className: " + className);
}
float eventSpawn = zombie.Buffs.GetCustomVar("$eventSpawn");
float numStartScale = zombie.Buffs.GetCustomVar("$StartScale");
int numReborn = (int)__instance.Buffs.GetCustomVar("$reborn");
//Log.Out("RebirthUtilities-Reborn numReborn: " + numReborn);
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("RebirthUtilities-Reborn SEND TO SERVER");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesReborn>().Setup(__instance.entityId, classID, numReborn, (int)eventSpawn, numStartScale));
return;
}
__instance.MarkToUnload();
__instance.KillLootContainer();
SpawnRebornZombie(zombie, classID, zombie.position, zombie.rotation, numReborn, (int)eventSpawn, numStartScale);
}
}
}
}
public static void SpawnRebornZombie(EntityAlive zombie, int classID, Vector3 entityPos, Vector3 entityRot, int numReborn, int eventSpawn, float numStartScale)
{
//Log.Out("RebirthUtilities-SpawnRebornZombie numReborn: " + numReborn);
Entity entity = EntityFactory.CreateEntity(classID, entityPos, entityRot, -1, "");
if (entity != null)
{
entity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
zombie.world.SpawnEntityInWorld(entity);
if (entity is EntityAlive entityAlive)
{
entityAlive.Buffs.SetCustomVar("$eventSpawn", eventSpawn);
entityAlive.Buffs.SetCustomVar("$reborn", numReborn);
if (numStartScale > 0)
{
entityAlive.Buffs.SetCustomVar("$StartScale", numStartScale);
}
if (zombie.GetAttackTarget() != null)
{
entityAlive.SetAttackTarget(zombie.GetAttackTarget(), 12000);
}
else
{
EntityPlayer closestPlayer = entityAlive.world.GetClosestPlayer(entityAlive.position, 120, false);
if (closestPlayer != null)
{
entityAlive.SetAttackTarget(zombie.GetAttackTarget(), 12000);
}
}
}
}
}
public static void PlayCompanionSpawnSound(EntityPlayer player)
{
int minMax = 20;
int minHeight = 20;
List<Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityNPCRebirth), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - minHeight, player.position.z - minMax, player.position.x + minMax, player.position.y + minHeight, player.position.z + minMax), new List<Entity>());
if (entitiesInBounds.Count > 0)
{
//Log.Out("RebirthUtilities-PlayCompanionSpawnSound 1");
for (int x = 0; x < entitiesInBounds.Count; x++)
{
EntityNPCRebirth npc = (EntityNPCRebirth)entitiesInBounds[x];
if (npc != null)
{
if (npc.HasAnyTags(FastTags<TagGroup.Global>.Parse("dog")))
{
Manager.BroadcastPlayByLocalPlayer(npc.position, "FuriousRamsayDogSense");
return;
}
}
}
}
}
public static bool WillPOIBanditEventTrigger(int number)
{
System.Random random = new System.Random();
// Ensure the number is within the valid range
if (number < 1 || number > 6)
{
return false;
}
// Calculate the chance of triggering the event
// Higher numbers have a higher chance
int maxChance = 10; // 1 in 10
int minChance = 100; // 1 in 100
// Linear interpolation between maxChance and minChance based on the number
int chance = minChance - (number - 1) * (minChance - maxChance) / (6 - 1);
//Log.Out("RebirthUtilities-WillPOIBanditEventTrigger chance: " + chance);
// Generate a random number to determine if the event triggers
int randomValue = random.Next(1, chance + 1);
//Log.Out("RebirthUtilities-WillPOIBanditEventTrigger randomValue: " + randomValue);
// Return true if the event triggers (i.e., if the random value is 1)
return randomValue == 1;
}
public static void CheckForOpenDoor(EntityAlive entity)
{
EntityMoveHelper moveHelper = entity.moveHelper;
if (moveHelper.HitInfo == null)
{
//Log.Out("RebirthUtilities-CheckForOpenDoor 22a");
return;
}
Vector3i blockPos = moveHelper.HitInfo.hit.blockPos;
if (entity.world.GetBlock(blockPos).isair)
{
//Log.Out("RebirthUtilities-CheckForOpenDoor 22b");
return;
}
var block = GameManager.Instance.World.GetBlock(blockPos);
bool bHasTags = Block.list[block.type].HasTag(BlockTags.Door);
bool bIsOpen = !BlockDoor.IsDoorOpen(block.meta);
/*Log.Out("RebirthUtilities-CheckForOpenDoor block.meta: " + block.meta);
Log.Out("RebirthUtilities-CheckForOpenDoor bHasTags: " + bHasTags);
Log.Out("RebirthUtilities-CheckForOpenDoor bIsOpen: " + bIsOpen);*/
bool isHatch = block.Block.GetBlockName().Contains("Hatch");
bool isDoorOpen = BlockDoor.IsDoorOpen(block.meta);
if (Block.list[block.type].HasTag(BlockTags.Door) &&
(!isDoorOpen || (isHatch && isDoorOpen))
)
{
/*Log.Out("RebirthUtilities-CheckForOpenDoor rotation.x: " + block.Block.shape.GetRotation(block).x);
Log.Out("RebirthUtilities-CheckForOpenDoor rotation.y: " + block.Block.shape.GetRotation(block).y);
Log.Out("RebirthUtilities-CheckForOpenDoor rotation.z: " + block.Block.shape.GetRotation(block).z);*/
//Log.Out("RebirthUtilities-CheckForOpenDoor IS DOOR AND IS CLOSED");
if (GameManager.Instance.World.GetTileEntity(0, blockPos) is TileEntitySecureDoor tileEntitySecureDoor)
{
//Log.Out("RebirthUtilities-CheckForOpenDoor 5");
if (!tileEntitySecureDoor.IsLocked())
{
//Log.Out("RebirthUtilities-CheckForOpenDoor DOOR IS NOT LOCKED");
var chunk = entity.world.GetChunkFromWorldPos(blockPos) as Chunk;
if (tileEntitySecureDoor != null)
{
//Log.Out("RebirthUtilities-CheckForOpenDoor 6");
float flCanOpenDoors = entity.Buffs.GetCustomVar("$varFuriousRamsayOpenDoors");
//Log.Out("RebirthUtilities-CheckForOpenDoor flCanOpenDoors: " + flCanOpenDoors);
if (flCanOpenDoors == 1)
{
if ((isHatch && isDoorOpen) || (!isHatch && !isDoorOpen))
{
//Log.Out("RebirthUtilities-CheckForOpenDoor " + System.Environment.StackTrace);
//Log.Out("RebirthUtilities-CheckForOpenDoor 7");
//tileEntitySecureDoor.SetLocked(false);
block.Block.OnBlockActivated(entity.world, chunk.ClrIdx, blockPos, block, null);
}
}
}
}
}
}
}
public static void TriggerDefensiveRage(EntityAlive entity)
{
string type = "";
string strEntity = "";
string entityPos = "";
string entityRot = "";
string strDistance = "";
string strHeight = "";
string strSpawner = "";
string strDirection = "random";
string strSound = "";
float numStartScale = 0;
int minion = 0;
int numEntities = 1;
int attackPlayer = 0;
int checkMaxEntities = 0;
int minMax = 40;
int maxEntities = 20;
int repeat = 1;
int allNames = 1;
int atPlayerLevel = 0;
int randomRotation = 1;
int numRotation = -1;
int isBoss = -1;
int handParticle = -1;
string lootListName = "";
string lootDropClass = "";
int lootDropChance = 1;
string navIcon = "";
string buffList = "";
bool forceSpawn = false;
//Log.Out("RebirthUtilities-TriggerDefensiveRage START");
ProgressionValue progressionValue = entity.Progression.GetProgressionValue("FuriousRamsayPerkRage");
int progressionLevel = progressionValue.Level;
if (progressionLevel == 0)
{
//Log.Out("RebirthUtilities-TriggerDefensiveRage 1");
return;
}
int tier = progressionValue.Level;
if (entity.Buffs.HasBuff($"FuriousRamsayRageBuffTier1{tier}"))
{
//Log.Out("RebirthUtilities-TriggerDefensiveRage 2");
return;
}
//Log.Out($"RebirthUtilities-TriggerDefensiveRage BUFF: FuriousRamsayRageBuffTier{tier}");
entity.Buffs.AddBuff($"FuriousRamsayRageBuffTier{tier}");
if (tier > 10)
{
// Make sure the trainer spawn doesn't go over the max is is 10;
tier = 10;
}
strEntity = $"FuriousRamsayTrainerBerserkerSpawnTier{tier}_FR";
strDistance = "9999";
minion = 1;
bool shouldAttackPlayer = false;
bool spawnAtPlayerLevel = false;
atPlayerLevel = 0;
if (atPlayerLevel == 1)
{
spawnAtPlayerLevel = true;
}
bool spawnAtRandomRotation = true;
randomRotation = 1;
if (randomRotation == 0)
{
spawnAtRandomRotation = false;
}
RebirthUtilities.SpawnEntity(entity.entityId, strEntity, numEntities, entityPos, entityRot, strDistance, strSpawner, strHeight, strDirection, numStartScale, numRotation, spawnAtRandomRotation, spawnAtPlayerLevel, shouldAttackPlayer, entity.entityId, minion, strSound, maxEntities, checkMaxEntities, minMax, repeat, allNames, isBoss, handParticle, lootListName, lootDropClass, lootDropChance, navIcon, buffList, false, forceSpawn);
}
public static void TriggerOffensiveRage(EntityAlive entity)
{
//Log.Out("RebirthUtilities-TriggerOffensiveRage START");
ProgressionValue progressionValue = entity.Progression.GetProgressionValue("FuriousRamsayPerkRage");
int progressionLevel = progressionValue.Level;
if (progressionLevel == 0)
{
//Log.Out("RebirthUtilities-TriggerOffensiveRage 1");
return;
}
int tier = progressionValue.Level;
if (entity.Buffs.HasBuff($"FuriousRamsayOffensiveRageBuffTier{tier}"))
{
//Log.Out("RebirthUtilities-TriggerOffensiveRage 2");
return;
}
//Log.Out($"RebirthUtilities-TriggerOffensiveRage BUFF: FuriousRamsayOffensiveRageBuffTier{tier}");
entity.Buffs.AddBuff($"FuriousRamsayOffensiveRageBuffTier{tier}");
}
public static IEnumerator RemoveCompanion(EntityNPCRebirth entity, float delay)
{
yield return new WaitForSeconds(delay);
//Log.Out("RebirthUtilities-RemoveCompanion START, entity: " + entity.entityId + " / " + entity.EntityName);
EntityPlayer owner = null;
int OwnerID = (int)entity.Buffs.GetCustomVar("$Leader");
if (OwnerID > 0)
{
//Log.Out("RebirthUtilities-RemoveCompanion 1");
EntityPlayer entityPlayer = (EntityPlayer)entity.world.GetEntity(OwnerID);
if (entityPlayer != null)
{
owner = entityPlayer;
//Log.Out("RebirthUtilities-RemoveCompanion BEFORE owner.Companions.Count: " + owner.Companions.Count);
for (int i = 0; i < owner.companions.Count; i++)
{
//Log.Out($"RebirthUtilities-RemoveCompanion owner.Companions[{i}].entityId: " + owner.Companions[i].entityId);
//Log.Out($"RebirthUtilities-RemoveCompanion owner.Companions[{i}].EntityName: " + owner.Companions[i].EntityName);
if (entity.entityId == owner.Companions[i].entityId)
{
owner.Companions.Remove(owner.Companions[i]);
break;
}
}
//Log.Out("RebirthUtilities-RemoveCompanion AFTER owner.Companions.Count: " + owner.Companions.Count);
}
}
yield break;
}
public static void DespawnEntity(EntityAlive entity)
{
//Log.Out("RebirthUtilities-DespawnEntity START");
if (entity == null)
{
//Log.Out("RebirthUtilities-DespawnEntity 1");
return;
}
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("RebirthUtilities-DespawnEntity 2");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageDespawnEntityRebirth>().Setup(entity.entityId), false);
if (entity is EntityNPCRebirth npc)
{
GameManager.Instance.StartCoroutine(RemoveCompanion(npc, 1.5f));
}
}
else
{
//Log.Out("RebirthUtilities-DespawnEntity 3");
//if (!GameManager.IsDedicatedServer)
{
//Log.Out("RebirthUtilities-DespawnEntity 4");
if (entity is EntityNPCRebirth npc)
{
GameManager.Instance.StartCoroutine(RemoveCompanion(npc, 0));
}
}
entity.bIsChunkObserver = false;
entity.bWillRespawn = false;
if (entity.Buffs.GetCustomVar("$Leader") > 0)
{
entity.lootDropProb = 0;
GameManager.Instance.DropContentOfLootContainerServer(BlockValue.Air, new Vector3i(entity.position), entity.entityId);
}
RebirthManager.RemoveHire(entity.entityId);
GameManager.Instance.World.RemoveEntity(entity.entityId, EnumRemoveEntityReason.Despawned);
}
}
public static List<int> GetEntityListInt(List<int> entities, int numEntities, List<int> excludeEntities, bool useDuplicates = false)
{
List<int> resultEntities = new List<int>();
int count = 0;
int random = -1;
//Log.Out("RebirthUtilities-GetEntityList numEntities: " + numEntities);
//Log.Out("RebirthUtilities-GetEntityList excludeEntity: " + excludeEntity);
//Log.Out("RebirthUtilities-GetEntityList entities.Count: " + entities.Count);
while (count < numEntities)
{
random = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count);
//Log.Out("RebirthUtilities-GetEntityList random: " + random);
bool addEntity = true;
foreach (int excludedEntity in excludeEntities)
{
if (excludedEntity != -1 && excludedEntity == entities[random])
{
//Log.Out("RebirthUtilities-GetEntityList SKIP");
addEntity = false;
break;
}
}
if (addEntity)
{
bool exists = resultEntities.Contains(entities[random]);
if (!useDuplicates && exists)
{
continue;
}
resultEntities.Add(entities[random]);
count++;
}
}
return resultEntities;
}
public static string GetEntityList(List<int> entities, int numEntities, List<int> excludeEntities)
{
string result = "";
int count = 0;
int random = -1;
//Log.Out("RebirthUtilities-GetEntityList numEntities: " + numEntities);
//Log.Out("RebirthUtilities-GetEntityList excludeEntity: " + excludeEntity);
//Log.Out("RebirthUtilities-GetEntityList entities.Count: " + entities.Count);
while (count < numEntities)
{
random = GameManager.Instance.World.GetGameRandom().RandomRange(0, entities.Count);
//Log.Out("RebirthUtilities-GetEntityList random: " + random);
bool addEntity = true;
foreach (int excludedEntity in excludeEntities)
{
if (excludedEntity != -1 && excludedEntity == entities[random])
{
//Log.Out("RebirthUtilities-GetEntityList SKIP");
addEntity = false;
break;
}
}
if (addEntity)
{
string entityClass = EntityClass.GetEntityClassName(entities[random]);
if (entityClass.ToLower().Contains("stevecrawler"))
{
continue;
}
//Log.Out("RebirthUtilities-GetEntityList entityClass: " + entityClass);
if (count > 0)
{
result = result + "," + entityClass;
}
else
{
result = entityClass;
}
count++;
//Log.Out("RebirthUtilities-GetEntityList count: " + count);
}
}
return result;
}
public static void CheckForTraderDoor(EntityVehicle entity)
{
int blockRangeX = 20;
int blockRangeY = 2;
int blockRangeZ = 20;
//Log.Out("RebirthUtilities-CheckForTraderDoor START");
Vector3i origin = new Vector3i(entity.position.x, entity.position.y, entity.position.z);
List<Vector3i> secureDoors = new List<Vector3i>();
for (int i = origin.x - blockRangeX; i <= origin.x + blockRangeX; i++)
{
for (int j = origin.z - blockRangeZ; j <= origin.z + blockRangeZ; j++)
{
for (int k = origin.y - blockRangeY; k <= origin.y + blockRangeY; k++)
{
Vector3i blockPos = new Vector3i(i, k, j);
bool canOpen = false;
TileEntity tileEntity = GameManager.Instance.World.GetTileEntity(0, blockPos);
if (tileEntity != null)
{
if (tileEntity is TileEntitySecureDoor tileEntitySecureDoor)
{
bool isBusy = false;
//Log.Out("RebirthUtilities-CheckForTraderDoor blockPos: " + blockPos);
foreach (Vector3i pos in RebirthVariables.traderDoors)
{
//Log.Out("RebirthUtilities-CheckForTraderDoor pos: " + pos);
if (pos == blockPos)
{
isBusy = true;
break;
}
}
//Log.Out("RebirthUtilities-CheckForTraderDoor isBusy: " + isBusy);
if (!isBusy)
{
bool isWithinTraderArea = false;
//PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(blockPos); // GameManager.Instance.World.GetPOIAtPosition(blockPos, false);
PrefabInstance poiatPosition = GameManager.Instance.World.GetPOIAtPosition(blockPos, false);
if (poiatPosition != null)
{
//Log.Out("RebirthUtilities-CheckForTraderDoor poiatPosition.name: " + poiatPosition.name);
if (poiatPosition.name.ToLower().Contains("trader_"))
{
isWithinTraderArea = true;
}
}
//Log.Out("RebirthUtilities-CheckForTraderDoor isWithinTraderArea: " + isWithinTraderArea);
if (isWithinTraderArea)
{
canOpen = true;
if (tileEntitySecureDoor.IsLocked())
{
//Log.Out("RebirthUtilities-CheckForTraderDoor IS LOCKED");
PersistentPlayerData persistentPlayerData = GameManager.Instance.World.GetGameManager().GetPersistentPlayerList().GetPlayerData(tileEntitySecureDoor.GetOwner());
if (persistentPlayerData == null)
{
//Log.Out("RebirthUtilities-CheckForTraderDoor CANNOT OPEN");
canOpen = false;
}
}
if (canOpen)
{
secureDoors.Add(blockPos);
//Log.Out("RebirthUtilities-CheckForTraderDoor 1");
}
}
}
}
}
}
}
}
Vector3i openDoor = new Vector3i(0, 0, 0);
float currentDistance = 0;
foreach (Vector3i door in secureDoors)
{
float distance = Vector3.Distance(
new Vector3(entity.position.x, entity.position.y, entity.position.z),
new Vector3(door.x, door.y, door.z)
);
if (currentDistance == 0)
{
currentDistance = distance;
openDoor = door;
}
else
{
if (distance < currentDistance)
{
openDoor = door;
}
}
}
if (openDoor != new Vector3i(0, 0, 0))
{
BlockValue block = GameManager.Instance.World.GetBlock(openDoor);
//Log.Out("RebirthUtilities-CheckForTraderDoor blockName: " + block.Block.blockName);
if (!BlockDoor.IsDoorOpen(block.meta))
{
//Log.Out("RebirthUtilities-CheckForTraderDoor 2");
RebirthVariables.traderDoors.Add(openDoor);
Chunk chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(openDoor);
block.Block.OnBlockActivated(GameManager.Instance.World, chunk.ClrIdx, openDoor, block, null);
Task task = Task.Delay(4000)
.ContinueWith(t => CloseDoor(entity.entityId, openDoor));
Task task2 = Task.Delay(4000)
.ContinueWith(t => ClearDoor(openDoor));
}
else
{
//Log.Out("RebirthUtilities-CheckForTraderDoor 3");
Chunk chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(openDoor);
block.Block.OnBlockActivated(GameManager.Instance.World, chunk.ClrIdx, openDoor, block, null);
}
}
}
public static void ClearDoor(Vector3i blockPos)
{
RebirthVariables.traderDoors.Remove(blockPos);
}
public static int ConvertStringToInt(string input)
{
if (int.TryParse(input, out int result))
{
return result;
}
else
{
return -1;
}
}
public static void BackupHelper(EntityAlive myEntity, EntityAlive awayFromEntity, float distance, float maxDistanceFromLeader = 15f)
{
if (myEntity.moveHelper == null)
return;
var dirV = myEntity.position - awayFromEntity.position;
var vector = Vector3.zero;
vector = RandomPositionGenerator.CalcPositionInDirection(myEntity, awayFromEntity.position, dirV, (float)distance, 80f);
int OwnerID = (int)myEntity.Buffs.GetCustomVar("$Leader");
if (OwnerID > 0)
{
EntityPlayer entityPlayer = (EntityPlayer)myEntity.world.GetEntity(OwnerID);
// Limit distance from the owner
if (entityPlayer != null)
{
float distanceToLeader = Vector3.Distance(vector, entityPlayer.position);
if (distanceToLeader > maxDistanceFromLeader)
{
dirV = myEntity.position - entityPlayer.position;
vector = RandomPositionGenerator.CalcPositionInDirection(myEntity, entityPlayer.position, dirV, (float)distance, 80f);
dirV = awayFromEntity.position - myEntity.position;
vector = RandomPositionGenerator.CalcPositionInDirection(myEntity, awayFromEntity.position, dirV, (float)distance, 80f);
}
}
}
if (myEntity.moveHelper.IsBlocked)
{
dirV = awayFromEntity.position - myEntity.position;
vector = RandomPositionGenerator.CalcPositionInDirection(myEntity, awayFromEntity.position, dirV, (float)distance * 2, 80f);
}
myEntity.moveHelper.SetMoveTo(vector, true);
myEntity.SetInvestigatePosition(vector, 200);
myEntity.SetLookPosition(awayFromEntity.position);
myEntity.RotateTo(awayFromEntity.position.x, awayFromEntity.position.y, awayFromEntity.position.z, 30f, 30f);
}
public static int TotalGameSecondsPassed()
{
// Assuming you have access to the game's time management system
//int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
//Log.Out("RebirthUtilities-TotalGameSecondsPassed currentDay: " + currentDay);
//float currentTimeOfDayHours = GameUtils.WorldTimeToHours(GameManager.Instance.World.worldTime);
//Log.Out("RebirthUtilities-TotalGameSecondsPassed currentTimeOfDayHours: " + currentTimeOfDayHours);
//float currentTimeOfDayMinutes = GameUtils.WorldTimeToMinutes(GameManager.Instance.World.worldTime);
//Log.Out("RebirthUtilities-TotalGameSecondsPassed currentTimeOfDayMinutes: " + currentTimeOfDayMinutes);
// Retrieve the day length setting (in real-world minutes)
//int dayLengthInMinutes = GamePrefs.GetInt(EnumGamePrefs.DayNightLength);
//Log.Out("RebirthUtilities-TotalGameSecondsPassed dayLengthInMinutes: " + dayLengthInMinutes);
// Convert the day length to in-game seconds
//int dayLengthInRealSeconds = dayLengthInMinutes * 60;
//Log.Out("RebirthUtilities-TotalGameSecondsPassed dayLengthInRealSeconds: " + dayLengthInRealSeconds);
// Calculate the number of in-game seconds that have passed today
/*int secondsPassedToday = Mathf.FloorToInt(currentTimeOfDayHours * (dayLengthInRealSeconds / 24f) +
currentTimeOfDayMinutes * (dayLengthInRealSeconds / (24f * 60f))
);*/
//Log.Out("RebirthUtilities-TotalGameSecondsPassed secondsPassedToday: " + secondsPassedToday);
// Calculate the total number of in-game seconds passed since the start of the game
//int totalSecondsPassed = (currentDay - 1) * dayLengthInRealSeconds + secondsPassedToday;
//Log.Out("RebirthUtilities-TotalGameSecondsPassed totalSecondsPassed: " + totalSecondsPassed);
//return totalSecondsPassed;
int totalSeconds = (int)(GameUtils.WorldTimeToTotalSeconds(GameManager.Instance.World.worldTime) * ((GamePrefs.GetInt(EnumGamePrefs.DayNightLength) * 60) / (24f * 3600f)));
return totalSeconds;
}
public static void InitWeapon(string key, EntityPlayer player)
{
string craftingKey = "craftingSpears";
if (key == "LongRangeRifles")
{
craftingKey = "craftingRifles";
}
else if (key == "Shotguns")
{
craftingKey = "craftingShotguns";
}
else if (key == "AssaultRifles")
{
craftingKey = "FuriousRamsayCraftingAssaultRifles";
}
else if (key == "MachineGuns")
{
craftingKey = "craftingMachineGuns";
}
else if (key == "SubmachineGuns")
{
craftingKey = "FuriousRamsayCraftingSubmachineGuns";
}
else if (key == "TacticalRifles")
{
craftingKey = "FuriousRamsayCraftingTacticalRifles";
}
else if (key == "Revolvers")
{
craftingKey = "FuriousRamsayCraftingRevolvers";
}
else if (key == "Pistols")
{
craftingKey = "craftingHandguns";
}
else if (key == "HeavyHandguns")
{
craftingKey = "FuriousRamsayCraftingHeavyHandguns";
}
int PerkLevel = 2;
if (key == "LongRangeRifles")
{
PerkLevel = 3;
}
float categoryValue = RebirthUtilities.GetDirectCraftingPerksCategoryValue(key, player.Progression.GetProgressionValue(craftingKey).Level);
RebirthUtilities.InitPipeWeapon(key, player);
RebirthVariables.localVariables["$varFuriousRamsay" + key + "PercUnit"] = categoryValue;
RebirthUtilities.ProcessAttribute(player, "$varFuriousRamsay" + key + "PercUnit");
RebirthVariables.localConstants["$varFuriousRamsayPerk" + PerkLevel + "PercUnit"] = categoryValue;
}
public static void InitPipeWeapon(string key, EntityPlayer player)
{
string pipeWeapon = "";
if (key == "LongRangeRifles")
{
pipeWeapon = "PipeRifle";
}
else if (key == "Shotguns")
{
pipeWeapon = "PipeShotgun";
}
else if (key == "AssaultRifles" ||
key == "MachineGuns" ||
key == "SubmachineGuns" ||
key == "TacticalRifles"
)
{
pipeWeapon = "PipeMachinegun";
}
else if (key == "Revolvers" ||
key == "Pistols" ||
key == "HeavyHandguns"
)
{
pipeWeapon = "PipePistol";
}
ProgressionValue craftingProgressionValue = player.Progression.GetProgressionValue("FuriousRamsayCrafting" + pipeWeapon);
if (craftingProgressionValue.level < 50)
{
string cvarName = "$varFuriousRamsay" + pipeWeapon + "PercUnit";
//Log.Out("RebirthUtilities-InitPipeWeapon Expertise cvarName: " + cvarName);
float categoryValue = RebirthUtilities.GetDirectCraftingPerksCategoryValue(pipeWeapon, 50);
//Log.Out("RebirthUtilities-InitPipeWeapon Expertise categoryValue: " + categoryValue);
RebirthVariables.localVariables[cvarName] = categoryValue;
RebirthUtilities.ProcessAttribute(player, cvarName);
craftingProgressionValue.Level = 50;
cvarName = "$varFuriousRamsay" + key + "PercUnit";
//Log.Out("RebirthUtilities-InitPipeWeapon Expertise cvarName: " + cvarName);
categoryValue = RebirthUtilities.GetDirectCraftingPerksCategoryValue(key, 50);
//Log.Out("RebirthUtilities-InitPipeWeapon Expertise categoryValue: " + categoryValue);
RebirthVariables.localVariables[cvarName] = categoryValue;
RebirthUtilities.ProcessAttribute(player, cvarName);
}
}
public static void UnhideNPC(string parameter, Vector3 position = new Vector3())
{
//Log.Out("RebirthUtilities-UnhideNPC 1");
if (parameter.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-UnhideNPC 2");
int entityID = 0;
if (int.TryParse(parameter, out entityID))
{
//Log.Out("RebirthUtilities-UnhideNPC 3");
EntityNPCRebirth npc = (EntityNPCRebirth)GameManager.Instance.World.GetEntity(entityID);
if (npc != null)
{
//Log.Out("RebirthUtilities-UnhideNPC 4, npc: " + npc.EntityName);
float delta = npc.HideDuration - ((int)GameManager.Instance.World.worldTime / GameStats.GetInt(EnumGameStats.TimeOfDayIncPerSec));
if (delta <= 0)
{
//Log.Out("RebirthUtilities-UnhideNPC 5");
npc.HideNPC(false);
}
}
}
}
else
{
//Log.Out("RebirthUtilities-UnhideNPC 6");
int minMax = 200;
List<Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityNPCRebirth), BoundsUtils.BoundsForMinMax(position.x - minMax, position.y - 30, position.z - minMax, position.x + minMax, position.y + 30, position.z + minMax), new List<Entity>());
if (entitiesInBounds.Count > 0)
{
//Log.Out("RebirthUtilities-UnhideNPC 7");
for (int x = 0; x < entitiesInBounds.Count; x++)
{
EntityNPCRebirth npc = (EntityNPCRebirth)entitiesInBounds[x];
if (npc != null)
{
//Log.Out("RebirthUtilities-UnhideNPC 8, npc: " + npc.EntityName);
float delta = npc.HideDuration - ((int)GameManager.Instance.World.worldTime / GameStats.GetInt(EnumGameStats.TimeOfDayIncPerSec));
if (delta <= 0)
{
//Log.Out("RebirthUtilities-UnhideNPC 9");
npc.HideNPC(false);
}
}
}
}
}
}
public static bool IsStringAnInteger(string str)
{
int result;
return int.TryParse(str, out result);
}
public static bool IsBlockTraderAllowed(string name)
{
if (name.ToLower().Contains("furiousramsayspawncube") ||
name.ToLower() == "walltorchlightplayer" ||
name.ToLower() == "meleetooltorch" ||
name.ToLower() == "gunbott1junksledge" ||
name.ToLower() == "gunbott2junkturret" ||
name.ToLower() == "gunbott3junkdrone" ||
name.ToLower().Contains("frameshapes")
)
{
return true;
}
return false;
}
public static string ConvertToMinutesSeconds(int totalSeconds)
{
int minutes = totalSeconds / 60;
int seconds = totalSeconds % 60;
string minuteString = "[cccccc]m[-]";
string secondString = "[cccccc]s[-]";
string result = "";
if (minutes > 0)
{
result = $"{minutes}{minuteString} {seconds}{secondString}";
}
else
{
result = $"{seconds}{secondString}";
}
return result;
}
public static float CalculateHeatMapDivisor(float roundsPerMinute)
{
// Constants for the function
const float thresholdRPM = 60.0f;
const float maxRPM = 300.0f;
const float minResult = 0.2f;
const float maxResult = 1.0f;
if (roundsPerMinute <= thresholdRPM)
{
return maxResult;
}
else if (roundsPerMinute >= maxRPM)
{
return minResult;
}
else
{
// Calculate the result using an exponential decay function
float decayRate = (float)Math.Log(minResult / maxResult) / (maxRPM - thresholdRPM);
float result = maxResult * (float)Math.Exp(decayRate * (roundsPerMinute - thresholdRPM));
return result;
}
}
public static void CheckNPCOrder(EntityPlayer player, bool playSound = false)
{
float flValue = player.Buffs.GetCustomVar("varNPCModStopAttacking");
if (player.Buffs.HasBuff("buffNPCModHaltDisplay"))
{
flValue = 1;
player.Buffs.RemoveBuff("buffNPCModResumeDisplay");
player.Buffs.AddBuff("buffNPCModHaltDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCHalt");
}
}
else
{
flValue = 0;
player.Buffs.RemoveBuff("buffNPCModHaltDisplay");
player.Buffs.AddBuff("buffNPCModResumeDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCResume");
}
}
player.Buffs.SetCustomVar("varNPCModStopAttacking", flValue);
for (int j = 0; j < player.Companions.Count; j++)
{
var entity = player.Companions[j] as global::EntityAlive;
if (entity != null)
{
if (flValue == 1)
{
entity.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
entity.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
}
}
}
public static void CheckNPCMode(EntityPlayer player, bool playSound = false)
{
float flValue = player.Buffs.GetCustomVar("varNPCModMode");
if (player.Buffs.HasBuff("buffNPCModHuntingModeDisplay"))
{
flValue = 1;
player.Buffs.RemoveBuff("buffNPCModFullControlModeDisplay");
player.Buffs.AddBuff("buffNPCModHuntingModeDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCHuntingMode");
}
}
else
{
flValue = 0;
player.Buffs.RemoveBuff("buffNPCModHuntingModeDisplay");
player.Buffs.AddBuff("buffNPCModFullControlModeDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCFullControlMode");
}
}
player.Buffs.SetCustomVar("varNPCModMode", flValue);
for (int j = 0; j < player.Companions.Count; j++)
{
var entity = player.Companions[j] as global::EntityAlive;
if (entity != null)
{
if (flValue == 0)
{
entity.Buffs.AddBuff("buffNPCModFullControlMode");
entity.Buffs.RemoveBuff("buffNPCModThreatControlMode");
}
else
{
entity.Buffs.AddBuff("buffNPCModThreatControlMode");
entity.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
}
}
}
public static void SwitchNPCOrder(EntityPlayer player, bool playSound = true)
{
float flValue = player.Buffs.GetCustomVar("varNPCModStopAttacking");
if (player.Buffs.HasBuff("buffNPCModResumeDisplay"))
{
flValue = 1;
player.Buffs.RemoveBuff("buffNPCModResumeDisplay");
player.Buffs.AddBuff("buffNPCModHaltDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCHalt");
}
}
else
{
flValue = 0;
player.Buffs.RemoveBuff("buffNPCModHaltDisplay");
player.Buffs.AddBuff("buffNPCModResumeDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCResume");
}
}
player.Buffs.SetCustomVar("varNPCModStopAttacking", flValue);
for (int j = 0; j < player.Companions.Count; j++)
{
var entity = player.Companions[j] as global::EntityAlive;
if (entity != null)
{
if (flValue == 1)
{
entity.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
entity.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
}
}
}
public static void SwitchNPCMode(EntityPlayer player, bool playSound = true)
{
float flValue = player.Buffs.GetCustomVar("varNPCModMode");
if (player.Buffs.HasBuff("buffNPCModFullControlModeDisplay"))
{
flValue = 1;
player.Buffs.RemoveBuff("buffNPCModFullControlModeDisplay");
player.Buffs.AddBuff("buffNPCModHuntingModeDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCHuntingMode");
}
}
else
{
flValue = 0;
player.Buffs.RemoveBuff("buffNPCModHuntingModeDisplay");
player.Buffs.AddBuff("buffNPCModFullControlModeDisplay");
if (playSound)
{
Manager.PlayInsidePlayerHead("NPCFullControlMode");
}
}
player.Buffs.SetCustomVar("varNPCModMode", flValue);
for (int j = 0; j < player.Companions.Count; j++)
{
var entity = player.Companions[j] as global::EntityAlive;
if (entity != null)
{
if (flValue == 0)
{
entity.Buffs.AddBuff("buffNPCModFullControlMode");
entity.Buffs.RemoveBuff("buffNPCModThreatControlMode");
}
else
{
entity.Buffs.AddBuff("buffNPCModThreatControlMode");
entity.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
}
}
}
public static void DisplayRequirementCaption(EntityAlive entity, string strRequirement)
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption START");
if (strRequirement.Contains(".FuriousRamsayCantUse"))
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 1");
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttCannotUseRangedBerserker"), string.Empty, "ui_denied", null);
}
else if (strRequirement.Contains("cvar.$varFuriousRamsayPerkGoodVibrations GTE 1"))
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 2");
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttClassLevel6"), string.Empty, "ui_denied", null);
}
else if (strRequirement.Contains("Player level") && strRequirement.Contains("GTE"))
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 3");
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttPlayerLevelGTE"), string.Empty, "ui_denied", null);
}
else if (strRequirement.Contains("Target does NOT have buff 'buffdrugpainkillers'"))
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 4");
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttWaitPainkillers"), string.Empty, "ui_denied", null);
}
else if (strRequirement.Contains("cvar.$varFuriousRamsayAttributeNumClasses LT 2"))
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 5");
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttMaxTwoClasses"), string.Empty, "ui_denied", null);
}
else if (strRequirement == "stat 'Health'% LT 1")
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 5a");
//GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttAtMaxHealth"), string.Empty, "ui_denied", null);
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttCannotUseAtThisTime"), string.Empty, "ui_denied", null);
}
else if (strRequirement.Contains("FuriousRamsayAchievementMercenaries"))
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 6");
int level = int.Parse(strRequirement.Replace("'FuriousRamsayAchievementMercenaries' level Equals", "").Trim());
ProgressionValue progressionValue = entity.Progression.GetProgressionValue("FuriousRamsayAchievementMercenaries");
int progressionLevel = progressionValue.Level;
if (level < progressionLevel)
{
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttMercenariesHave"), string.Empty, "ui_denied", null);
}
else
{
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttMercenariesReq").Replace("{0}", level.ToString()), string.Empty, "ui_denied", null);
}
}
else
{
//Log.Out("RebirthUtilities-DisplayRequirementCaption 7, strRequirement: " + strRequirement);
GameManager.ShowTooltip(entity as EntityPlayerLocal, Localization.Get("ttCannotUseAtThisTime"), string.Empty, "ui_denied", null);
}
}
public static bool IsWeaponAvailable(EntityAlive entity, float classID)
{
float activeClassID = entity.Buffs.GetCustomVar("$ActiveClass_FR");
if (activeClassID == 0)
{
//Log.Out("RebirthUtilities-IsWeaponAvailable 1");
return true;
}
else
{
//Log.Out("RebirthUtilities-IsWeaponAvailable 2");
if (RebirthUtilities.IsHordeNight())
{
//Log.Out("RebirthUtilities-IsWeaponAvailable 3");
return true;
}
else
{
//Log.Out("RebirthUtilities-IsWeaponAvailable 4");
if (activeClassID == 10)
{
ProgressionValue progressionValue = entity.Progression.GetProgressionValue("furiousramsayattberserker");
if (progressionValue != null && progressionValue.Level >= 10)
{
//Log.Out("RebirthUtilities-IsWeaponAvailable 5");
return RebirthUtilities.IsClassActive(entity, classID);
}
else
{
//Log.Out("RebirthUtilities-IsWeaponAvailable 6");
return false;
}
}
else
{
//Log.Out("RebirthUtilities-IsWeaponAvailable 7");
return true;
}
}
}
return true;
}
public static bool CanHeal(string itemName, EntityAlive healingTarget, EntityAlive healer)
{
//Log.Out("RebirthUtilities-CanHeal START");
//Log.Out("RebirthUtilities-CanHeal healer: " + healer.EntityName);
//Log.Out("RebirthUtilities-CanHeal healingTarget: " + healingTarget.EntityName);
//Log.Out("RebirthUtilities-CanHeal Health: " + healingTarget.Health);
//Log.Out("RebirthUtilities-CanHeal GetMaxHealth: " + healingTarget.GetMaxHealth());
//Log.Out("RebirthUtilities-CanHeal healingTarget.Stats.Health.ModifiedMax: " + healingTarget.Stats.Health.ModifiedMax);
bool restrictiveHealing = RebirthVariables.customRestrictiveHealing;
itemName = itemName.ToLower().Trim();
bool isBleeding = healingTarget.Buffs.HasBuff("buffInjuryBleeding");
bool isHealing = healingTarget.Buffs.HasBuff("buffHealHealth");
bool isPainKiller = itemName == "drugpainkillers";
bool isPainkillerActive = healingTarget.Buffs.HasBuff("buffDrugPainkillers");
bool hasConcussion = healingTarget.Buffs.HasBuff("buffInjuryConcussion");
bool hasAbrasion = healingTarget.Buffs.HasBuff("buffInjuryAbrasion");
bool hasLaceration = healingTarget.Buffs.HasBuff("buffLaceration");
bool isHealingItem = itemName == "medicalbandage" ||
itemName == "medicalfirstaidbandage" ||
itemName == "medicalfirstaidkit" ||
itemName == "drugpainkillers" ||
itemName == "medicalaloecream";
bool isAbrasionItem = itemName == "medicalaloecream" ||
itemName == "medicalfirstaidbandage" ||
itemName == "medicalfirstaidkit";
bool isLacerationItem = itemName == "resourcesewingkit" ||
itemName == "medicalfirstaidkit";
float healingAmount = healingTarget.Buffs.GetCustomVar("medicalRegHealthAmount");
//Log.Out("RebirthUtilities-CanHeal restrictiveHealing: " + restrictiveHealing);
//Log.Out("RebirthUtilities-CanHeal itemName: " + itemName);
//Log.Out("RebirthUtilities-CanHeal isPainkillerActive: " + isPainkillerActive);
//Log.Out("RebirthUtilities-CanHeal hasConcussion: " + hasConcussion);
//Log.Out("RebirthUtilities-CanHeal isPainKiller: " + isPainKiller);
//Log.Out("RebirthUtilities-CanHeal hasAbrasion: " + hasAbrasion);
//Log.Out("RebirthUtilities-CanHeal isAbrasionItem: " + isAbrasionItem);
//Log.Out("RebirthUtilities-CanHeal hasLaceration: " + hasLaceration);
//Log.Out("RebirthUtilities-CanHeal isLacerationItem: " + isLacerationItem);
//Log.Out("RebirthUtilities-CanHeal isBleeding: " + isBleeding);
//Log.Out("RebirthUtilities-CanHeal isHealing: " + isHealing);
//Log.Out("RebirthUtilities-CanHeal healingAmount: " + healingAmount);
bool canHeal = true;
if (isHealingItem && healingTarget.Health == (int)healingTarget.Stats.Health.ModifiedMax && healingTarget.GetMaxHealth() != (int)healingTarget.Stats.Health.ModifiedMax)
{
canHeal = false;
if (hasConcussion && isPainKiller)
{
//Log.Out("RebirthUtilities-CanHeal HAS CONCUSSION");
canHeal = true;
}
else if (hasAbrasion && isAbrasionItem)
{
//Log.Out("RebirthUtilities-CanHeal HAS ABRASION");
canHeal = true;
}
else if (hasLaceration && isLacerationItem)
{
//Log.Out("RebirthUtilities-CanHeal HAS LACERATION");
canHeal = true;
}
if (!canHeal)
{
//Log.Out("RebirthUtilities-CanHeal no need to heal");
return false;
}
}
if (restrictiveHealing && isHealing && healingAmount > 10 && !isBleeding)
{
//Log.Out("RebirthUtilities-CanHeal healing is restricted");
canHeal = false;
return false;
}
//Log.Out("RebirthUtilities-CanHeal canHeal: " + canHeal);
if (isPainkillerActive && isPainKiller)
{
string message = Localization.Get("ttWaitPainkillers");
if (healingTarget.entityId != healer.entityId)
{
message = Localization.Get("ttTargetWaitPainkillers");
}
GameManager.ShowTooltip(healer as EntityPlayerLocal, message, string.Empty, "ui_denied", null);
//Log.Out("RebirthUtilities-CanHeal Cannot heal A");
return false;
}
if (!canHeal)
{
// (itemName == "foodHoney" && !healingTarget.Buffs.HasBuff("buffInfectionMain")) ||
if (itemName == "medicalbandage" ||
itemName == "medicalfirstaidbandage" ||
itemName == "medicalfirstaidKit" ||
itemName == "medicalaloecream"
)
{
string message = Localization.Get("ttNotDoneHealing");
if (healingTarget.entityId != healer.entityId)
{
message = Localization.Get("ttTargetNotDoneHealing");
}
GameManager.ShowTooltip(healer as EntityPlayerLocal, message, string.Empty, "ui_denied", null);
//Log.Out("RebirthUtilities-CanHeal Cannot heal B");
return false;
}
}
return true;
}
public static int AdjustGamestage(int gamestage, int POITier, int biomeID)
{
//Log.Out("RebirthUtilities-AdjustGamestage START, gamestage: " + gamestage);
//Log.Out("RebirthUtilities-AdjustGamestage START, POITier: " + POITier);
//Log.Out("RebirthUtilities-AdjustGamestage START, biomeID: " + biomeID);
if (POITier == 0)
{
return 0; // No increase if POITier is zero
}
// Define the base increases for each tier
int[] tierIncreases = { 1, 30, 60, 90, 120, 150, 180 };
int[] biomeIncreases = { 0, 20, 40, 60, 80, 100 };
// Calculate the base increase based on POITier and biomeID
float baseIncrease = tierIncreases[POITier - 1] + biomeIncreases[biomeID];
//Log.Out("RebirthUtilities-AdjustGamestage BEFORE baseIncrease: " + baseIncrease);
// Adjust based on custom POI risk settings
string optionPOIRisk = RebirthVariables.customPOIRisk.ToLower();
if (optionPOIRisk == "none")
{
return 0; // No increase if risk is set to none
}
else if (optionPOIRisk == "low")
{
baseIncrease *= 0.5f;
}
else if (optionPOIRisk == "high")
{
baseIncrease *= 1.5f;
}
//Log.Out("RebirthUtilities-AdjustGamestage AFTER baseIncrease: " + baseIncrease);
// Cap gamestage to the maximum threshold (600 in this case)
int maxGamestage = RebirthVariables.maxGamestage;
if (gamestage > maxGamestage)
{
gamestage = maxGamestage;
}
// Adjustment factor reduces the increase as gamestage approaches maxGamestage
double adjustmentFactor = (double)(maxGamestage - gamestage) / maxGamestage;
//Log.Out("RebirthUtilities-AdjustGamestage adjustmentFactor: " + adjustmentFactor);
// Calculate the adjusted increase
int adjustedIncrease = (int)(baseIncrease * adjustmentFactor);
//Log.Out("RebirthUtilities-AdjustGamestage adjustedIncrease: " + adjustedIncrease);
// Ensure the increase is not negative
if (adjustedIncrease < 0)
{
adjustedIncrease = 0;
}
return adjustedIncrease;
}
/*public static int AdjustGamestage(int gamestage, int POITier, int biomeID)
{
if (POITier == 0)
{
return 0;
}
//Log.Out("RebirthUtilities-AdjustGamestage gamestage: " + gamestage);
//Log.Out("RebirthUtilities-AdjustGamestage POITier: " + POITier);
//Log.Out("RebirthUtilities-AdjustGamestage biomeID: " + biomeID);
// Define the base increases for each tier
int[] tierIncreases = { 1, 30, 60, 90, 120, 150, 180 };
int[] biomeIncreases = { 0, 20, 40, 60, 80, 100 };
// Get the base increase based on the Biome
//Log.Out("RebirthUtilities-AdjustGamestage tierIncrease: " + tierIncreases[POITier - 1]);
//Log.Out("RebirthUtilities-AdjustGamestage biomeIncrease: " + biomeIncreases[biomeID]);
float baseIncrease = tierIncreases[POITier - 1] + biomeIncreases[biomeID];
//Log.Out("RebirthUtilities-AdjustGamestage baseIncrease BEFORE: " + baseIncrease);
string optionPOIRisk = RebirthVariables.customPOIRisk.ToLower();
//Log.Out("RebirthUtilities-AdjustGamestage optionPOIRisk: " + optionPOIRisk);
if (gamestage > 300)
{
gamestage = 300;
}
if (optionPOIRisk == "none")
{
return 0;
}
else if (optionPOIRisk == "low")
{
baseIncrease = baseIncrease * 0.5f;
}
else if (optionPOIRisk == "high")
{
baseIncrease = baseIncrease * 1.5f;
}
//Log.Out("RebirthUtilities-AdjustGamestage baseIncrease AFTER: " + baseIncrease);
// Adjust the increase based on the player's current gamestage
double adjustmentFactor = (300.0 - gamestage) / 300.0;
//Log.Out("RebirthUtilities-AdjustGamestage adjustmentFactor: " + adjustmentFactor);
int adjustedIncrease = (int)(baseIncrease - (gamestage * adjustmentFactor));
//Log.Out("RebirthUtilities-AdjustGamestage adjustedIncrease: " + adjustedIncrease);
if (adjustedIncrease < 0)
{
adjustedIncrease = 0;
}
return adjustedIncrease;
}*/
public static void DropBackpack(EntityAlive _entityAlive)
{
//Log.Out("RebirthUtilities-DropBackpack START");
if (_entityAlive.lootContainer != null)
{
//Log.Out("RebirthUtilities-DropBackpack 1");
bool isBackpackEmpty = _entityAlive.lootContainer.IsEmpty();
if (!isBackpackEmpty)
{
//Log.Out("RebirthUtilities-DropBackpack 2");
var bagPosition = new Vector3i(_entityAlive.position + _entityAlive.transform.up);
var className = "BackpackNPC";
var entityClass = EntityClass.GetEntityClass(className.GetHashCode());
if (entityClass == null)
{
//Log.Out("RebirthUtilities-DropBackpack 3");
className = "Backpack";
}
//Log.Out("RebirthUtilities-DropBackpack className: " + className);
var entityBackpack = EntityFactory.CreateEntity(className.GetHashCode(), bagPosition) as EntityItem;
//Log.Out("RebirthUtilities-DropBackpack 4");
var entityCreationData = new EntityCreationData(entityBackpack)
{
entityName = Localization.Get(_entityAlive.EntityName),
id = -1,
lootContainer = _entityAlive.lootContainer
};
//Log.Out("RebirthUtilities-DropBackpack 5");
GameManager.Instance.RequestToSpawnEntityServer(entityCreationData);
//Log.Out("RebirthUtilities-DropBackpack 6");
if (entityBackpack)
{
//Log.Out("RebirthUtilities-DropBackpack 7");
entityBackpack.OnEntityUnload();
}
}
}
}
public static void HasSelectedClass(EntityPlayerLocal player)
{
//Log.Out("RebirthUtilities-HasSelectedClass $FR_InitialClassChosen: " + player.Buffs.GetCustomVar("$FR_InitialClassChosen"));
//Log.Out("RebirthUtilities-HasSelectedClass quest_basicsurvival_3: " + (player.QuestJournal.FindQuest("quest_basicsurvival_3") != null));
if (player.Buffs.GetCustomVar("$ActiveClass_FR") > 0)
{
player.Buffs.SetCustomVar("$FR_InitialClassChosen", 1f);
}
Quest quest = player.QuestJournal.FindQuest("quest_basicsurvival_3");
if (quest != null)
{
//Log.Out("RebirthUtilities-HasSelectedClass 3 quest.CurrentState: " + quest.CurrentState);
if (quest.CurrentState == Quest.QuestState.NotStarted ||
quest.CurrentState == Quest.QuestState.InProgress ||
quest.CurrentState == Quest.QuestState.ReadyForTurnIn)
{
return;
}
quest = player.QuestJournal.FindQuest("quest_basicsurvival_3a");
if (quest != null)
{
//Log.Out("RebirthUtilities-HasSelectedClass 3A quest.CurrentState: " + quest.CurrentState);
if (quest.CurrentState == Quest.QuestState.NotStarted ||
quest.CurrentState == Quest.QuestState.InProgress ||
quest.CurrentState == Quest.QuestState.ReadyForTurnIn)
{
return;
}
}
quest = player.QuestJournal.FindQuest("quest_basicsurvival_5");
if (quest != null)
{
//Log.Out("RebirthUtilities-HasSelectedClass 5 quest.CurrentState: " + quest.CurrentState);
if (quest.CurrentState == Quest.QuestState.NotStarted ||
quest.CurrentState == Quest.QuestState.InProgress ||
quest.CurrentState == Quest.QuestState.ReadyForTurnIn)
{
return;
}
}
if (!(player.Buffs.GetCustomVar("$FR_InitialClassChosen") == 1f))
{
quest = QuestClass.CreateQuest("quest_BasicSurvival_3a");
if (quest != null)
{
player.QuestJournal.AddQuest(quest);
}
}
}
}
public static bool IsVanillaTrader(int EntityID)
{
//Log.Out("RebirthUtilities-IsVanillaTrader START");
EntityTrader trader = GameManager.Instance.World.GetEntity(EntityID) as EntityTrader;
if (trader != null)
{
string name = trader.EntityClass.entityClassName;
//Log.Out("RebirthUtilities-IsVanillaTrader name: " + name);
if (name == "npcTraderJoel" ||
name == "npcTraderRekt" ||
name == "npcTraderBob" ||
name == "npcTraderHugh" ||
name == "npcTraderJen")
{
return true;
}
}
return false;
}
public static int GetNPCMagazineSize(EntityAlive entity)
{
int magazineSize = 1;
int NPCLevel = (int)entity.Buffs.GetCustomVar("$FR_NPC_Level");
//Log.Out("RebirthUtilities-GetNPCMagazineSize NPCLevel: " + NPCLevel);
string weapon = entity.inventory.holdingItem.GetItemName().ToLower();
if (weapon == "gunnpcpipeshotgun")
{
magazineSize = 1;
}
else if (weapon == "gunnpcpipepistol")
{
magazineSize = 5 + (NPCLevel - 1) / 2;
}
else if (weapon == "gunnpcpipemg")
{
magazineSize = 7 + (NPCLevel - 1) / 2;
}
else if (weapon == "gunnpcpshotgun")
{
magazineSize = 4 + (NPCLevel - 1) / 2;
}
else if (weapon == "gunnpcashotgun")
{
magazineSize = 5 + ((NPCLevel - 1) * 2);
}
else if (weapon == "gunnpcpiperifle")
{
magazineSize = 1;
}
else if (weapon == "gunnpcpistol")
{
magazineSize = 5 + NPCLevel - 1;
}
else if (weapon == "gunnpcdpistol")
{
magazineSize = 5 + NPCLevel - 1;
}
else if (weapon == "gunnpclbow")
{
magazineSize = 1;
}
else if (weapon == "gunnpcak47")
{
magazineSize = 7 + ((NPCLevel - 1) * 2);
}
else if (weapon == "gunnpcsmg5")
{
magazineSize = 12 + ((NPCLevel - 1) * 3);
}
else if (weapon == "gunnpcm60")
{
magazineSize = 12 + ((NPCLevel - 1) * 3);
}
else if (weapon == "gunnpcxbow")
{
magazineSize = 1;
}
else if (weapon == "gunnpctrifle")
{
magazineSize = 8 + ((NPCLevel - 1) * 3);
}
else if (weapon == "gunnpchrifle")
{
magazineSize = 1;
}
else if (weapon == "gunnpcsrifle")
{
magazineSize = 5 + NPCLevel - 1;
}
//Log.Out("RebirthUtilities-GetNPCMagazineSize magazineSize: " + magazineSize);
return magazineSize;
}
public static void AddEntityClassToCategory(int entityID, string category, string group)
{
if (category.Trim().Length == 0 || entityID == 0)
{
return;
}
int newEntry = new int();
newEntry = entityID;
category = category.ToLower();
if (group == "bandits")
{
if (category == "low")
{
banditsLow.Add(newEntry);
}
if (category == "lowmed")
{
banditsLowMed.Add(newEntry);
}
if (category == "med")
{
banditsMed.Add(newEntry);
}
if (category == "medhigh")
{
banditsMedHigh.Add(newEntry);
}
if (category == "high")
{
banditsHigh.Add(newEntry);
}
}
if (group == "survivors")
{
if (category == "low")
{
survivorsLow.Add(newEntry);
}
if (category == "lowmed")
{
survivorsLowMed.Add(newEntry);
}
if (category == "med")
{
survivorsMed.Add(newEntry);
}
if (category == "medhigh")
{
survivorsMedHigh.Add(newEntry);
}
if (category == "high")
{
survivorsHigh.Add(newEntry);
}
}
}
public static string GetCategoryFromWeaponName(string weaponName)
{
string result = "";
foreach (string weapon in RebirthVariables.npcWeaponCategories.Keys)
{
if (weapon == weaponName)
{
return RebirthVariables.npcWeaponCategories[weapon];
}
}
return result;
}
public static void RemoveCommonParticles(EntityAlive entity)
{
/*string prefix = "Ptl_";
foreach (string particleName in RebirthVariables.commonParticles)
{
if (entity.HasParticle(prefix + particleName))
{
//Log.Out("RebirthUtilities-RemoveCommonParticles HAS PARTICLE: " + particleName);
entity.RemoveParticle(prefix + particleName);
}
}*/
var parent = entity.gameObject.transform.parent;
if (parent != null)
{
Component[] componentsInChildren = entity.GetComponentsInChildren<Component>();
//Log.Out($"Zombie Parent: {parent.name} [" + entity.EntityClass.entityClassName + "]" + " / particles: " + componentsInChildren.Length);
for (int i = 0; i < componentsInChildren.Length; i++)
{
var c = componentsInChildren[i];
if (c == null || c.name == null)
continue;
//Log.Out($" C: {c} - Layer: {c.gameObject.layer} - Tag: {c.tag} - Active: {c.gameObject.activeSelf} - Position: {c.gameObject.transform.position}");
if (c.name.StartsWith("Ptl_") || c.name.StartsWith("tempPrefab_"))
{
//Log.Out("RebirthUtilities-RemoveCommonParticles HAS PREFAB: " + c.name);
//entity.RemoveParticle(c.name);
UnityEngine.Object.Destroy(c.gameObject);
}
}
}
}
public static ItemValue GetItemValue(int EntityID, string strProperty)
{
var result = ItemClass.GetItem("casinoCoin");
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAliveV2;
if (myEntity)
{
var entityClass = EntityClass.list[myEntity.entityClass];
if (entityClass.Properties.Values.ContainsKey(strProperty))
result = ItemClass.GetItem(entityClass.Properties.Values[strProperty]);
if (result.IsEmpty())
result = ItemClass.GetItem("casinoCoin");
}
return result;
}
public static ItemValue GetHireCurrency(int EntityID)
{
var result = ItemClass.GetItem("casinoCoin");
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAliveV2;
if (myEntity)
result = GetItemValue(EntityID, "HireCurrency");
if (result.IsEmpty())
result = ItemClass.GetItem("casinoCoin", true);
return result;
}
public static void Stop(int entityID, bool full = false)
{
var myEntity = GameManager.Instance.World.GetEntity(entityID) as EntityAlive;
if (myEntity == null)
return;
myEntity.motion = Vector3.zero;
myEntity.navigator?.clearPath();
myEntity.moveHelper?.Stop();
myEntity.speedForward = 0;
myEntity.speedStrafe = 0;
if (!full) return;
// This seems to prevent the shuffling of feet.
myEntity.emodel.avatarController.UpdateFloat(AvatarController.forwardHash, 0, false);
myEntity.emodel.avatarController.UpdateFloat(AvatarController.strafeHash, 0, false);
}
public static bool HasBuffLike(EntityAlive entity, string buffCompare)
{
for (int i = 0; i < entity.Buffs.ActiveBuffs.Count; i++)
{
BuffValue buffValue = entity.Buffs.ActiveBuffs[i];
if (buffValue != null && buffValue.BuffClass != null)
{
if (buffValue.BuffName.ToLower().Contains(buffCompare.ToLower()))
{
return true;
}
}
}
return false;
}
public static Vector3 AlignToEdge(Vector3 vector)
{
return new Vector3i(vector).ToVector3();
}
public static Vector3 GetMoveToLocation(EntityAlive entity, Vector3 position, float maxDist = 10f)
{
//Log.Out("RebirthUtilities-GetMoveToLocation START");
var vector = entity.world.FindSupportingBlockPos(position);
if (!(maxDist > 0f))
{
//Log.Out("RebirthUtilities-GetMoveToLocation 1");
return vector;
}
var Targetblock = entity.world.GetBlock(new Vector3i(vector));
if (Targetblock.Block is BlockLadder)
{
//Log.Out("RebirthUtilities-GetMoveToLocation 2");
vector = AlignToEdge(vector);
}
var vector2 = new Vector3(entity.position.x, vector.y, entity.position.z);
var vector3 = vector - vector2;
var magnitude = vector3.magnitude;
//Log.Out("RebirthUtilities-GetMoveToLocation magnitude: " + magnitude);
if (magnitude > 5f)
{
//Log.Out("RebirthUtilities-GetMoveToLocation 3");
return vector;
}
if (magnitude <= maxDist)
{
//Log.Out("RebirthUtilities-GetMoveToLocation 4");
// When climbing ladders, align the vector to its edges to allow better ladder migration.
var yDist = vector.y - entity.position.y;
if (yDist > 1.5f || yDist < -1.5f)
{
//Log.Out("RebirthUtilities-GetMoveToLocation 5");
return AlignToEdge(vector);
}
//Log.Out("RebirthUtilities-GetMoveToLocation 6");
return vector2;
}
else
{
//Log.Out("RebirthUtilities-GetMoveToLocation 7");
vector3 *= maxDist / magnitude;
var vector4 = vector - vector3;
vector4.y += 0.51f;
var pos = World.worldToBlockPos(vector4);
var block = entity.world.GetBlock(pos);
var block2 = block.Block;
if (block2.PathType <= 0)
{
//Log.Out("RebirthUtilities-GetMoveToLocation 8");
RaycastHit raycastHit;
if (Physics.Raycast(vector4 - Origin.position, Vector3.down, out raycastHit, 1.02f, 1082195968))
{
//Log.Out("RebirthUtilities-GetMoveToLocation 9");
vector4.y = raycastHit.point.y + Origin.position.y;
return vector4;
}
if (block2.IsElevator((int)block.rotation))
{
//Log.Out("RebirthUtilities-GetMoveToLocation 10");
vector4.y = vector.y;
return vector4;
}
}
}
//Log.Out("RebirthUtilities-GetMoveToLocation 11");
return AlignToEdge(vector);
}
public static void UpdateHandItem(int entityId, string item)
{
var entity = GameManager.Instance.World.GetEntity(entityId) as EntityAliveV2;
if (entity == null)
{
return;
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageWeaponSwap>().Setup(entity, item), false, -1, -1, -1, null, 192);
}
else
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageWeaponSwap>().Setup(entity, item), false);
}
}
/*public static void AddEntitiesToGroup(List<int> entityGroup, ref List<int>[] gamestageEntities, int gameStageFloor, int randomValueCompare, int repeat = 1)
{
//Log.Out("RebirthUtils-AddEntitiesToGroup START");
if (entityGroup.Count > 0)
{
//Log.Out("RebirthUtils-AddEntitiesToGroup entityGroup.Count: " + entityGroup.Count);
for (int n = 0; n < repeat; n++)
{
//Log.Out("RebirthUtils-AddEntitiesToGroup repeat: " + repeat);
for (int i = 0; i < entityGroup.Count; i++)
{
float random = GameManager.Instance.World.GetGameRandom().RandomRange(1, 100);
//Log.Out("RebirthUtils-AddEntitiesToGroup i: " + i + " / random: " + random);
if (random <= randomValueCompare)
{
gamestageEntities[gameStageFloor].Add(entityGroup[i]);
}
}
}
}
//Log.Out("RebirthUtils-AddEntitiesToGroup count: " + gamestageEntities[gameStageFloor].Count);
}
public static void AddEntitiesToArrayGroup(List<int> entityGroup, ref int[] gamestageEntities, int gameStageFloor, int randomValueCompare, int repeat = 1)
{
//Log.Out("RebirthUtils-AddEntitiesToGroup START");
if (entityGroup.Count > 0)
{
//Log.Out("RebirthUtils-AddEntitiesToGroup entityGroup.Count: " + entityGroup.Count);
for (int n = 0; n < repeat; n++)
{
//Log.Out("RebirthUtils-AddEntitiesToGroup repeat: " + repeat);
for (int i = 0; i < entityGroup.Count; i++)
{
float random = GameManager.Instance.World.GetGameRandom().RandomRange(1, 100);
//Log.Out("RebirthUtils-AddEntitiesToGroup i: " + i + " / random: " + random);
if (random <= randomValueCompare)
{
gamestageEntities[gameStageFloor] = entityGroup[i].entityId;
}
}
}
}
//Log.Out("RebirthUtils-AddEntitiesToGroup count: " + gamestageEntities[gameStageFloor].Count);
}*/
public static void CheckDistanceToLeader(EntityAlive entity, EntityAlive leader)
{
EntityNPCRebirth npc = (EntityNPCRebirth)entity;
if (npc != null)
{
if (leader != null && npc.Buffs.GetCustomVar("CurrentOrder") == (int)EntityUtilities.Orders.Follow)
{
float distance = entity.GetDistance(leader);
if (distance > EntityUtilities.maxDistanceToLeader)
{
entity.SetRevengeTarget((EntityAlive) null);
entity.attackTarget = (EntityAlive) null;
entity.motion = Vector3.zero;
entity.navigator?.clearPath();
entity.moveHelper?.Stop();
//entity.speedForward = 0;
//entity.speedStrafe = 0;
npc.TeleportToPlayer((EntityAlive)leader, false);
return;
}
}
}
}
public static void AddEntityToGroupFromCount(List<int> entityGroup, ref List<int> entities, int gameStage, int minGameStage, int maxGameStage, int numEntities = 0)
{
//Log.Out("RebirthUtilities-AddEntityToGroup START");
if (gameStage >= minGameStage && gameStage < maxGameStage)
{
//Log.Out("RebirthUtilities-AddEntityToGroup entityGroup.Count: " + entityGroup.Count);
if (entityGroup.Count > 0)
{
for (int i = 0; i < numEntities; i++)
{
int randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(0, entityGroup.Count);
//Log.Out("RebirthUtilities-AddEntityToGroup randomValue: " + randomValue);
//Log.Out("RebirthUtilities-AddEntityToGroup i: " + i);
entities.Add(entityGroup[randomValue]);
}
}
}
}
public static void AddEntityToGroup(List<int> entityGroup, ref List<int> entities, int gameStage, int minGameStage, int maxGameStage, int iterations = 1, float randomValueCompare = 100f, bool bypassRandom = false)
{
//Log.Out("RebirthUtilities-AddEntityToGroup START");
if (gameStage >= minGameStage && gameStage < maxGameStage)
{
//Log.Out("RebirthUtilities-AddEntityToGroup entityGroup.Count: " + entityGroup.Count);
if (entityGroup.Count > 0)
{
//Log.Out("RebirthUtilities-AddEntityToGroup iterations: " + iterations);
for (int i = 0; i < iterations; i++)
{
foreach (int entity in entityGroup)
{
//Log.Out("RebirthUtilities-AddEntityToGroup entity: " + EntityClass.GetEntityClassName(entity.entityId));
float randomValue = GameManager.Instance.World.GetGameRandom().RandomRange(1, 1000);
//Log.Out("RebirthUtilities-AddEntityToGroup randomValue: " + randomValue);
//Log.Out("RebirthUtilities-AddEntityToGroup randomValueCompare: " + randomValueCompare * 10);
if (!bypassRandom && EntityClass.GetEntityClassName(entity).ToLower().Contains("tornado"))
{
randomValueCompare = 10;
}
if (randomValue <= randomValueCompare * 10)
{
//Log.Out("RebirthUtilities-AddEntityToGroup entityGroup[" + i + "]: " + EntityClass.GetEntityClassName(entity.entityId));
entities.Add(entity);
}
}
}
}
}
}
public static void AppendEntityGroupHN(int gameStage, ref List<int> entities)
{
bool optionHNP = RebirthVariables.customHordeNight;
bool optionHNPTurbo = RebirthVariables.customHordeNightTurbo;
if (!optionHNP)
{
AddEntityToGroup(RebirthUtilities.hordeNightLowLow, ref entities, gameStage, 0, 34, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 0, 34, 15);
AddEntityToGroup(RebirthUtilities.hordeNightLowLow, ref entities, gameStage, 34, 72, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 34, 72, 15);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 34, 72, 10);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 72, 114, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 72, 114, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 72, 114, 10);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 114, 160, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 114, 160, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 114, 160, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 160, 210, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 160, 210, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 160, 210, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 210, 264, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 210, 264, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 210, 264, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 264, 322, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 264, 322, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 264, 322, 10);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 322, 384, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 322, 384, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 322, 384, 10);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 384, 450, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 384, 450, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 384, 450, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 450, 520, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 450, 520, 20);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 450, 520, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 520, 595, 20);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 520, 595, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighHigh, ref entities, gameStage, 520, 595, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 595, 9999, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 595, 9999, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighHigh, ref entities, gameStage, 595, 9999, 20);
}
else if (optionHNP && !optionHNPTurbo)
{
AddEntityToGroup(RebirthUtilities.hordeNightLowLow, ref entities, gameStage, 0, 34, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 0, 34, 15);
AddEntityToGroup(RebirthUtilities.hordeNightLowLow, ref entities, gameStage, 34, 72, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 34, 72, 15);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 34, 72, 10);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 72, 114, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 72, 114, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 72, 114, 10);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 114, 160, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 114, 160, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 114, 160, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 160, 210, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 160, 210, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 160, 210, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 210, 264, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 210, 264, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 210, 264, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 264, 322, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 264, 322, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 264, 322, 10);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 322, 384, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 322, 384, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 322, 384, 10);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 384, 450, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 384, 450, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 384, 450, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 450, 520, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 450, 520, 20);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 450, 520, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 520, 595, 20);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 520, 595, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighHigh, ref entities, gameStage, 520, 595, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 595, 9999, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 595, 9999, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighHigh, ref entities, gameStage, 595, 9999, 20);
//Log.Out("RebirthUtilities-AppendEntityGroupHN entities.Count (BEFORE HNP): " + entities.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusLow.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusLow.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusMed.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusMed.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusHigh.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusHigh.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusVeryHigh.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusVeryHigh.Count);
// HORDE NIGHT PLUS
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 25, 50, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 50, 75, 5);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 75, 100, 6);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 100, 125, 6);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 125, 150, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 125, 150, 2);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 150, 175, 3);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 150, 175, 3);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 175, 200, 2);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 175, 200, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 200, 225, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 200, 225, 3);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 225, 250, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 225, 250, 3);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 250, 275, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 250, 275, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 275, 300, 3);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 275, 300, 5);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 300, 325, 5);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 300, 325, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 325, 350, 5);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 325, 350, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 350, 375, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 350, 375, 6);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 375, 400, 4);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 375, 400, 6);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 400, 9999, 9);
//Log.Out("RebirthUtilities-AppendEntityGroupHN entities.Count (AFTER HNP): " + entities.Count);
}
else if (optionHNP && optionHNPTurbo)
{
AddEntityToGroup(RebirthUtilities.hordeNightLowLow, ref entities, gameStage, 0, 34, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 0, 34, 15);
AddEntityToGroup(RebirthUtilities.hordeNightLowLow, ref entities, gameStage, 34, 72, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 34, 72, 15);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 34, 72, 10);
AddEntityToGroup(RebirthUtilities.hordeNightLowMed, ref entities, gameStage, 72, 114, 20);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 72, 114, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 72, 114, 10);
AddEntityToGroup(RebirthUtilities.hordeNightLowHigh, ref entities, gameStage, 114, 160, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 114, 160, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 114, 160, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedLow, ref entities, gameStage, 160, 210, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 160, 210, 15);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 160, 210, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedMed, ref entities, gameStage, 210, 264, 20);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 210, 264, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 210, 264, 10);
AddEntityToGroup(RebirthUtilities.hordeNightMedHigh, ref entities, gameStage, 264, 322, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 264, 322, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 264, 322, 10);
AddEntityToGroup(RebirthUtilities.hordeNightHighLow, ref entities, gameStage, 322, 384, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 322, 384, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 322, 384, 10);
AddEntityToGroup(RebirthUtilities.hordeNightHighMed, ref entities, gameStage, 384, 450, 15);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 384, 450, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 384, 450, 20);
AddEntityToGroup(RebirthUtilities.hordeNightHighHigh, ref entities, gameStage, 450, 520, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 450, 520, 20);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 450, 520, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 520, 595, 20);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 520, 595, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighHigh, ref entities, gameStage, 520, 595, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighLow, ref entities, gameStage, 595, 9999, 10);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighMed, ref entities, gameStage, 595, 9999, 15);
AddEntityToGroup(RebirthUtilities.hordeNightVeryHighHigh, ref entities, gameStage, 595, 9999, 20);
//Log.Out("RebirthUtilities-AppendEntityGroupHN entities.Count (BEFORE HNP TURBO): " + entities.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusLow.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusLow.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusMed.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusMed.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusHigh.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusHigh.Count);
//Log.Out("RebirthUtilities-AppendEntityGroupHN RebirthUtilities.hordeNightPlusVeryHigh.Count (BEFORE HNP): " + RebirthUtilities.hordeNightPlusVeryHigh.Count);
// HORDE NIGHT PLUS TURBO
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 25, 50, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 50, 75, 10, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 75, 100, 12, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 100, 125, 12, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 125, 150, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 125, 150, 4, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 150, 175, 6, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 150, 175, 6, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusLow, ref entities, gameStage, 175, 200, 4, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 175, 200, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 200, 225, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 200, 225, 6, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 225, 250, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 225, 250, 6, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 250, 275, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 250, 275, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusMed, ref entities, gameStage, 275, 300, 6, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 275, 300, 10, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 300, 325, 10, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 300, 325, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 325, 350, 10, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 325, 350, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 350, 375, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 350, 375, 12, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusHigh, ref entities, gameStage, 375, 400, 8, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 375, 400, 12, 100, true);
AddEntityToGroup(RebirthUtilities.hordeNightPlusVeryHigh, ref entities, gameStage, 400, 9999, 18, 100, true);
//Log.Out("RebirthUtilities-AppendEntityGroupHN entities.Count (BEFORE HNP TURBO): " + entities.Count);
}
}
public static void AppendEntityGroupBandits(int gameStage, ref List<int> entities, float multiplier = 1)
{
//Log.Out("RebirthUtilities-AppendEntityGroupBandits START");
if (RebirthVariables.customDelayNPCSpawns == "neverspawn")
{
return;
}
if (RebirthVariables.customDelayNPCSpawns == "nodelay"
)
{
AddEntityToGroupFromCount(RebirthUtilities.banditsLow, ref entities, gameStage, 1, 10, (int)(8 * multiplier));
}
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10"
)
{
AddEntityToGroupFromCount(RebirthUtilities.banditsLow, ref entities, gameStage, 10, 20, (int)(8 * multiplier));
}
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10" ||
RebirthVariables.customDelayNPCSpawns == "gs20"
)
{
AddEntityToGroupFromCount(RebirthUtilities.banditsLow, ref entities, gameStage, 20, 30, (int)(8 * multiplier));
}
AddEntityToGroupFromCount(RebirthUtilities.banditsLow, ref entities, gameStage, 30, 60, (int)(5 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsLowMed, ref entities, gameStage, 30, 60, (int)(7 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsLow, ref entities, gameStage, 60, 90, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsLowMed, ref entities, gameStage, 60, 90, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMed, ref entities, gameStage, 60, 90, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsLow, ref entities, gameStage, 90, 120, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsLowMed, ref entities, gameStage, 90, 120, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMed, ref entities, gameStage, 90, 120, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsLowMed, ref entities, gameStage, 120, 150, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMed, ref entities, gameStage, 120, 150, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMedHigh, ref entities, gameStage, 120, 150, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMed, ref entities, gameStage, 150, 180, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMedHigh, ref entities, gameStage, 150, 180, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsHigh, ref entities, gameStage, 150, 180, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMedHigh, ref entities, gameStage, 180, 210, (int)(7 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsHigh, ref entities, gameStage, 180, 210, (int)(5 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsMedHigh, ref entities, gameStage, 210, 240, (int)(5 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsHigh, ref entities, gameStage, 210, 240, (int)(7 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.banditsHigh, ref entities, gameStage, 240, 9999, (int)(10 * multiplier));
}
public static void AppendEntityGroupSurvivors(int gameStage, ref List<int> entities, float multiplier = 1)
{
//Log.Out("RebirthUtilities-AppendEntityGroupBandits START");
if (RebirthVariables.customDelayNPCSpawns == "neverspawn")
{
return;
}
if (RebirthVariables.customDelayNPCSpawns == "nodelay"
)
{
AddEntityToGroupFromCount(RebirthUtilities.survivorsLow, ref entities, gameStage, 1, 10, (int)(8 * multiplier));
}
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10"
)
{
AddEntityToGroupFromCount(RebirthUtilities.survivorsLow, ref entities, gameStage, 10, 20, (int)(8 * multiplier));
}
if (RebirthVariables.customDelayNPCSpawns == "nodelay" ||
RebirthVariables.customDelayNPCSpawns == "gs10" ||
RebirthVariables.customDelayNPCSpawns == "gs20"
)
{
AddEntityToGroupFromCount(RebirthUtilities.survivorsLow, ref entities, gameStage, 20, 30, (int)(8 * multiplier));
}
AddEntityToGroupFromCount(RebirthUtilities.survivorsLow, ref entities, gameStage, 30, 60, (int)(5 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsLowMed, ref entities, gameStage, 30, 60, (int)(7 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsLow, ref entities, gameStage, 60, 90, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsLowMed, ref entities, gameStage, 60, 90, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMed, ref entities, gameStage, 60, 90, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsLow, ref entities, gameStage, 90, 120, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsLowMed, ref entities, gameStage, 90, 120, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMed, ref entities, gameStage, 90, 120, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsLowMed, ref entities, gameStage, 120, 150, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMed, ref entities, gameStage, 120, 150, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMedHigh, ref entities, gameStage, 120, 150, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMed, ref entities, gameStage, 150, 180, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMedHigh, ref entities, gameStage, 150, 180, (int)(6 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsHigh, ref entities, gameStage, 150, 180, (int)(4 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMedHigh, ref entities, gameStage, 180, 210, (int)(7 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsHigh, ref entities, gameStage, 180, 210, (int)(5 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsMedHigh, ref entities, gameStage, 210, 240, (int)(5 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsHigh, ref entities, gameStage, 210, 240, (int)(7 * multiplier));
AddEntityToGroupFromCount(RebirthUtilities.survivorsHigh, ref entities, gameStage, 240, 9999, (int)(10 * multiplier));
}
public static void AppendEntityGroupBiomeTornados(int gameStage, ref List<int> entities, float multiplier = 1)
{
float customTornadosMultiplierOption = float.Parse(RebirthVariables.customTornadosMultiplier) / 100;
AddEntityToGroupFromCount(RebirthUtilities.tornadosLow, ref entities, gameStage, 30, 9999, (int)(4 * customTornadosMultiplierOption));
}
public static void AppendEntityGroupBiome(int gameStage, ref List<int> entities, float multiplier = 1)
{
AddEntityToGroupFromCount(RebirthUtilities.biomesLow, ref entities, gameStage, 10, 60, 4);
AddEntityToGroupFromCount(RebirthUtilities.biomesLow, ref entities, gameStage, 60, 110, 6);
AddEntityToGroupFromCount(RebirthUtilities.biomesLow, ref entities, gameStage, 110, 160, 8);
AddEntityToGroupFromCount(RebirthUtilities.biomesMed, ref entities, gameStage, 110, 160, 6);
AddEntityToGroupFromCount(RebirthUtilities.biomesMed, ref entities, gameStage, 160, 210, 8);
AddEntityToGroupFromCount(RebirthUtilities.biomesMed, ref entities, gameStage, 210, 260, 10);
AddEntityToGroupFromCount(RebirthUtilities.biomesHigh, ref entities, gameStage, 210, 260, 6);
AddEntityToGroupFromCount(RebirthUtilities.biomesHigh, ref entities, gameStage, 260, 310, 8);
AddEntityToGroupFromCount(RebirthUtilities.biomesHigh, ref entities, gameStage, 310, 360, 10);
AddEntityToGroupFromCount(RebirthUtilities.biomesHigh, ref entities, gameStage, 360, 410, 12);
AddEntityToGroupFromCount(RebirthUtilities.biomesVeryHigh, ref entities, gameStage, 360, 410, 6);
AddEntityToGroupFromCount(RebirthUtilities.biomesVeryHigh, ref entities, gameStage, 410, 460, 8);
AddEntityToGroupFromCount(RebirthUtilities.biomesVeryHigh, ref entities, gameStage, 460, 510, 10);
AddEntityToGroupFromCount(RebirthUtilities.biomesVeryHigh, ref entities, gameStage, 510, 9999, 12);
}
public static List<int> RemoveZombieSupportEntries(List<int> entitiesBosses)
{
if (entitiesBosses == null)
{
return new List<int>(); // Return an empty list if entitiesBosses == null
}
// Combine all the zombie support lists
var combinedZombieSupport = RebirthUtilities.zombieSupportLow
.Concat(RebirthUtilities.zombieSupportMedium)
.Concat(RebirthUtilities.zombieSupportHigh)
.Concat(RebirthUtilities.zombieSupportVeryHigh)
.ToHashSet(); // Use HashSet for faster lookup
// Filter the entitiesBosses list
return entitiesBosses.Where(boss => !combinedZombieSupport.Contains(boss)).ToList();
}
public static List<int> BuildZombieSupportGroup(int gameStage)
{
List<int> entities = new List<int>();
AddEntityToGroupFromCount(RebirthUtilities.zombieSupportLow, ref entities, gameStage, 0, 140, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieSupportMedium, ref entities, gameStage, 140, 280, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieSupportHigh, ref entities, gameStage, 280, 420, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieSupportVeryHigh, ref entities, gameStage, 420, 9999, 100);
return entities;
}
public static List<int> BuildZombieAnimalBossGroup(int gameStage)
{
List<int> entities = new List<int>();
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesLow, ref entities, gameStage, 0, 80, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesMedium, ref entities, gameStage, 80, 160, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesHigh, ref entities, gameStage, 160, 9999, 100);
return entities;
}
public static List<int> BuildZombieAnimalSupportGroup(int gameStage)
{
List<int> entities = new List<int>();
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 0, 60, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 60, 120, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesLow, ref entities, gameStage, 60, 120, 20);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 120, 180, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesLow, ref entities, gameStage, 120, 180, 40);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesMedium, ref entities, gameStage, 120, 180, 20);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 180, 240, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesLow, ref entities, gameStage, 180, 240, 40);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesMedium, ref entities, gameStage, 180, 240, 20);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesHigh, ref entities, gameStage, 180, 240, 10);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 240, 9999, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesLow, ref entities, gameStage, 240, 9999, 20);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesMedium, ref entities, gameStage, 240, 9999, 40);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsBossesHigh, ref entities, gameStage, 240, 9999, 20);
return entities;
}
public static List<int> BuildZombieAnimalGroup(int gameStage)
{
List<int> entities = new List<int>();
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 0, 50, 200);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsMedium, ref entities, gameStage, 0, 50, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsHigh, ref entities, gameStage, 0, 50, 50);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 50, 100, 150);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsMedium, ref entities, gameStage, 50, 100, 150);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsHigh, ref entities, gameStage, 50, 100, 75);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsLow, ref entities, gameStage, 100, 150, 50);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsMedium, ref entities, gameStage, 100, 150, 200);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsHigh, ref entities, gameStage, 100, 150, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsMedium, ref entities, gameStage, 150, 200, 150);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsHigh, ref entities, gameStage, 150, 200, 150);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsMedium, ref entities, gameStage, 200, 250, 100);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsHigh, ref entities, gameStage, 200, 250, 200);
AddEntityToGroupFromCount(RebirthUtilities.zombieAnimalsHigh, ref entities, gameStage, 250, 9999, 100);
return entities;
}
public static List<int> BuildEntityGroup(int gameStage)
{
List<int> entities = new List<int>();
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 0, 10, 240);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 0, 10, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 0, 10, 20);
//Log.Out("RebirthUtilities-BuildEntityGroup RebirthUtilities.sleepersLow: " + RebirthUtilities.sleepersLow.Count);
//Log.Out("RebirthUtilities-BuildEntityGroup RebirthUtilities.sleepersLowMed: " + RebirthUtilities.sleepersLowMed.Count);
//Log.Out("RebirthUtilities-BuildEntityGroup RebirthUtilities.sleepersMed: " + RebirthUtilities.sleepersMed.Count);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 10, 20, 200);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 10, 20, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 10, 20, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 20, 30, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 20, 30, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 20, 30, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 20, 30, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 30, 40, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 30, 40, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 30, 40, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 30, 40, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 40, 50, 70);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 40, 50, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 40, 50, 90);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 40, 50, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 50, 60, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 50, 60, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 50, 60, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 50, 60, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 60, 70, 50);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 60, 70, 50);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 60, 70, 90);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 60, 70, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 70, 80, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 70, 80, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 70, 80, 90);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 70, 80, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 70, 80, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 80, 90, 30);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 80, 90, 30);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 80, 90, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 80, 90, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 80, 90, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 90, 100, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 90, 100, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 90, 100, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 90, 100, 110);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 90, 100, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 100, 110, 15);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 100, 110, 15);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 100, 110, 75);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 100, 110, 105);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 100, 110, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 110, 120, 10);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 110, 120, 10);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 110, 120, 70);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 110, 120, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 110, 120, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLow, ref entities, gameStage, 120, 130, 5);
AddEntityToGroupFromCount(RebirthUtilities.sleepersLowMed, ref entities, gameStage, 120, 130, 5);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 120, 130, 65);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 120, 130, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 120, 130, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 130, 140, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 130, 140, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 130, 140, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 130, 140, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 140, 150, 30);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 140, 150, 90);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 140, 150, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 140, 150, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 150, 160, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 150, 160, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 150, 160, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 150, 160, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersMed, ref entities, gameStage, 160, 170, 10);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 160, 170, 70);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 160, 170, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 160, 170, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 170, 180, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 170, 180, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 170, 180, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 170, 180, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 180, 190, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 180, 190, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 180, 190, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 180, 190, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersHigh, ref entities, gameStage, 190, 200, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 190, 200, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 190, 200, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 190, 200, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 200, 210, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 200, 210, 160);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 200, 210, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 210, 220, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 210, 220, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 210, 220, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 210, 220, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralLow, ref entities, gameStage, 220, 230, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 220, 230, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 220, 230, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 220, 230, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 230, 240, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 230, 240, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 230, 240, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 240, 250, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 240, 250, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 240, 250, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 250, 260, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 250, 260, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 250, 260, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 250, 260, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 260, 270, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 260, 270, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 260, 270, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 260, 270, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 270, 280, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 270, 280, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 270, 280, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 270, 280, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralMed, ref entities, gameStage, 280, 290, 10);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 280, 290, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 280, 290, 150);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 280, 290, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersFeralHigh, ref entities, gameStage, 290, 300, 50);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 290, 300, 150);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 290, 300, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 300, 310, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 300, 310, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 300, 310, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 310, 320, 30);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 310, 320, 130);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 310, 320, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 320, 330, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 320, 330, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 320, 330, 160);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedLow, ref entities, gameStage, 330, 340, 10);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 330, 340, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 330, 340, 180);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 330, 340, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 340, 350, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 340, 350, 160);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 340, 350, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 350, 360, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 350, 360, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 350, 360, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 360, 370, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 360, 370, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 360, 370, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 370, 380, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 370, 380, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 370, 380, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 370, 380, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedMed, ref entities, gameStage, 370, 390, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 370, 390, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 370, 390, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 370, 390, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 390, 410, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 390, 410, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 390, 410, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 410, 430, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 410, 430, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 410, 430, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersRadiatedHigh, ref entities, gameStage, 430, 450, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 430, 450, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 430, 450, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 450, 470, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 450, 470, 140);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedHigh, ref entities, gameStage, 450, 470, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 470, 490, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 470, 490, 120);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedHigh, ref entities, gameStage, 470, 490, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 490, 510, 40);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 490, 510, 100);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedHigh, ref entities, gameStage, 490, 510, 60);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedLow, ref entities, gameStage, 510, 9999, 20);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedMed, ref entities, gameStage, 510, 9999, 80);
AddEntityToGroupFromCount(RebirthUtilities.sleepersTaintedHigh, ref entities, gameStage, 510, 9999, 80);
return entities;
}
public static Entity GetLeader(int EntityID)
{
Entity leader = null;
var currentEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (currentEntity)
{
if (currentEntity.Buffs.HasCustomVar("$Leader"))
{
int leaderId = (int)currentEntity.Buffs.GetCustomVar("$Leader");
// This is a guard against some code, somewhere, getting the cvar value without
// checking to see if it exists first. If so, the cvar exists with a value of 0.
if (leaderId > 0)
leader = GameManager.Instance.World.GetEntity(leaderId);
// Something happened to our leader.
/*if (leader == null)
{
Log.Out("RebirthUtilities-GetLeader REMOVE LEADER");
Log.Out("StackTrace: '{0}'", Environment.StackTrace);
currentEntity.Buffs.SetCustomVar("$Leader", 0f);
leader = null;
}*/
}
}
return leader;
}
public static Entity GetOwner(int EntityID)
{
Entity leader = null;
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity == null) return null;
if (myEntity.Buffs.HasCustomVar("Owner"))
{
int leaderId = (int)myEntity.Buffs.GetCustomVar("Owner");
// This is a guard against some code, somewhere, getting the cvar value without
// checking to see if it exists first. If so, the cvar exists with a value of 0.
if (leaderId > 0)
leader = GameManager.Instance.World.GetEntity(leaderId);
}
return leader;
}
public static Entity GetLeaderOrOwner(int EntityID)
{
if (RebirthUtilities.LeaderCache.ContainsKey(EntityID))
{
var cacheLeader = RebirthUtilities.LeaderCache[EntityID];
if (cacheLeader != null)
return cacheLeader;
}
var leader = GetLeader(EntityID);
if (leader == null)
leader = GetOwner(EntityID);
// If we acquired a leader again, cache it.
if (leader != null)
{
if (RebirthUtilities.LeaderCache.ContainsKey((int)EntityID))
RebirthUtilities.LeaderCache[EntityID] = leader;
else
RebirthUtilities.LeaderCache.Add((int)EntityID, leader);
}
return leader;
}
public static bool GetBoolValue(int EntityID, string strProperty)
{
var result = false;
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
var entityClass = EntityClass.list[myEntity.entityClass];
if (entityClass.Properties.Values.ContainsKey(strProperty))
result = bool.Parse(entityClass.Properties.Values[strProperty]);
}
return result;
}
public static float GetFloatValue(int EntityID, string strProperty)
{
float result = -1;
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
var entityClass = EntityClass.list[myEntity.entityClass];
if (entityClass.Properties.Values.ContainsKey(strProperty))
result = StringParsers.ParseFloat(entityClass.Properties.Values[strProperty]);
}
return result;
}
public static string GetStringValue(int EntityID, string strProperty)
{
var result = string.Empty;
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
var entityClass = EntityClass.list[myEntity.entityClass];
if (entityClass.Properties.Values.ContainsKey(strProperty))
return entityClass.Properties.Values[strProperty];
}
return result;
}
public static float GetCVarValue(int EntityID, string strCvarName)
{
var value = 0f;
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
if (myEntity.Buffs.HasCustomVar(strCvarName))
value = myEntity.Buffs.GetCustomVar(strCvarName);
return value;
}
//public static MethodInfo updateOpenCloseState = AccessTools.Method(typeof(BlockDoor), "updateOpenCloseState", new Type[] { typeof(bool), typeof(WorldBase), typeof(Vector3i), typeof(int), typeof(BlockValue), typeof(bool) });
public static void OpenDoor(int EntityID, Vector3i blockPos, bool forceLock = false)
{
//Log.Out("RebirthUtilities-OpenDoor START");
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
BlockValue block = myEntity.world.GetBlock(blockPos);
if (Block.list[block.type].HasTag(BlockTags.Door) && !BlockDoor.IsDoorOpen(block.meta))
{
var chunk = myEntity.world.GetChunkFromWorldPos(blockPos) as Chunk;
if (forceLock)
{
var tileEntitySecureDoor =
(TileEntitySecureDoor)GameManager.Instance.World.GetTileEntity(0, blockPos);
if (tileEntitySecureDoor != null)
tileEntitySecureDoor.SetLocked(false);
}
block.Block.OnBlockActivated(myEntity.world, chunk.ClrIdx, blockPos, block, null);
//updateOpenCloseState.Invoke(block, new object[] { true, myEntity.world, blockPos, chunk.ClrIdx, block, false });
}
}
}
public static void CloseDoor(int EntityID, Vector3i blockPos)
{
//Log.Out("RebirthUtilities-CloseDoor START");
var myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
var block = myEntity.world.GetBlock(blockPos);
if (Block.list[block.type].HasTag(BlockTags.Door) && BlockDoor.IsDoorOpen(block.meta))
{
var chunk = myEntity.world.GetChunkFromWorldPos(blockPos) as Chunk;
if (chunk == null)
return;
block.Block.OnBlockActivated(myEntity.world, chunk.ClrIdx, blockPos, block, null);
//updateOpenCloseState.Invoke(block, new object[] { true, myEntity.world, blockPos, chunk.ClrIdx, block, false });
}
}
}
public static bool CheckForClosedDoor(EntityAlive entity)
{
//Log.Out("RebirthUtilities-CheckForClosedDoor entity.moveHelper.BlockedTime: " + entity.moveHelper.BlockedTime + "ms");
/*if (!entity.moveHelper.IsBlocked)
{
//Log.Out("RebirthUtilities-CheckForClosedDoor 1");
return false;
}*/
bool isBlocked = entity.moveHelper.IsBlocked &&
entity.moveHelper.BlockedTime > 0.35f;
if (!isBlocked)
{
return false;
}
if (entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal")))
{
return false;
}
if (entity.moveHelper.HitInfo == null)
{
return false;
}
var blockPos = entity.moveHelper.HitInfo.hit.blockPos;
var block = GameManager.Instance.World.GetBlock(blockPos);
bool isHatch = block.Block.GetBlockName().Contains("Hatch");
if (!(Block.list[block.type].HasTag(BlockTags.Door) &&
(!BlockDoor.IsDoorOpen(block.meta) || (isHatch && BlockDoor.IsDoorOpen(block.meta)))
))
{
//Log.Out("RebirthUtilities-CheckForClosedDoor 2");
return false;
}
bool canOpen = true;
if (GameManager.Instance.World.GetTileEntity(0, blockPos) is TileEntitySecureDoor tileEntitySecureDoor)
{
//Log.Out("RebirthUtilities-CheckForClosedDoor 3");
if (tileEntitySecureDoor.IsLocked())
{
//Log.Out("RebirthUtilities-CheckForClosedDoor 4");
PersistentPlayerData persistentPlayerData = GameManager.Instance.World.GetGameManager().GetPersistentPlayerList().GetPlayerData(tileEntitySecureDoor.GetOwner());
if (persistentPlayerData == null)
{
//Log.Out("RebirthUtilities-CheckForClosedDoor 5");
canOpen = false;
}
}
}
if (canOpen)
{
//Log.Out("RebirthUtilities-CheckForClosedDoor 6");
if (isHatch && BlockDoor.IsDoorOpen(block.meta))
{
//Log.Out($"RebirthUtilities-CheckForClosedDoor IsDoorOpen {System.Environment.StackTrace}");
CloseDoor(entity.entityId, blockPos);
Task.Run(async () =>
{
await Task.Delay(2000);
OpenDoor(entity.entityId, blockPos);
});
//Task task = Task.Delay(2000)
//.ContinueWith(t => OpenDoor(entity.entityId, blockPos));
}
else
{
//Log.Out("RebirthUtilities-CheckForClosedDoor 8");
//Log.Out($"RebirthUtilities-CheckForClosedDoor Else {System.Environment.StackTrace}");
OpenDoor(entity.entityId, blockPos);
Task.Run(async () =>
{
await Task.Delay(2000);
CloseDoor(entity.entityId, blockPos);
});
//Task task = Task.Delay(2000)
//.ContinueWith(t => CloseDoor(entity.entityId, blockPos));
}
}
//Log.Out("RebirthUtilities-CheckForClosedDoor END");
entity.moveHelper.ClearBlocked();
return true;
}
public static string GetValueFromKey(string valueText, string key)
{
if (string.IsNullOrEmpty(valueText))
return string.Empty;
foreach (var text in valueText.Split(';'))
{
var parse = text.Split('=');
if (parse.Length == 2)
if (parse[0].ToLower() == key.ToLower())
return parse[1];
}
return "";
}
public static void SetLeaderAndOwner(int EntityID, int LeaderID, bool defaultOrder = true)
{
EntityNPCRebirth npc = GameManager.Instance.World.GetEntity(EntityID) as EntityNPCRebirth;
EntityPlayer player = GameManager.Instance.World.GetEntity(LeaderID) as EntityPlayer;
if (npc && player)
{
npc.Owner = player;
player.AddOwnedEntity(npc);
npc.Buffs.SetCustomVar("$Leader", player.entityId);
}
}
public static IEnumerator delayRespawn(EntityNPCRebirth entity, Vector3 respawnPosition, Vector3 respawnRotation)
{
//Log.Out("RebirthUtilities-delayRespawn BEFORE DELAY");
yield return new WaitForSeconds(4);
//Log.Out("RebirthUtilities-delayRespawn AFTER DELAY");
if (GameManager.Instance == null || (GameManager.Instance != null && GameManager.Instance.World == null))
{
yield break;
}
if (entity.PhysicsTransform != null)
{
entity.PhysicsTransform.gameObject.layer = 15;
}
entity.emodel.SetAlive();
entity.motion = Vector3.zero;
entity.navigator?.clearPath();
entity.moveHelper?.Stop();
entity.speedForward = 0;
entity.speedStrafe = 0;
//entity.motion = Vector3.zero;
//entity.navigator?.clearPath();
entity.LeaderUtils.IsTeleporting = true;
entity.isHirable = false;
entity.SetPosition(respawnPosition, true);
entity.rotation.y = respawnRotation.y;
entity.ClearDamagedTarget();
entity.ClearStun();
entity.LeaderUtils.IsTeleporting = false;
entity.Buffs.AddBuff("FuriousRamsayDeathParticle");
entity.Buffs.SetCustomVar("$FR_NPC_RespawnCommandActivation", 0);
entity.TriggerSleeperPose(0);
yield break;
}
public static Vector3 GetRespawnPosition(EntityAlive myEntity)
{
Vector3 respawnPosition = myEntity.position;
float numTerrainHeight = GameManager.Instance.World.GetTerrainHeight((int)myEntity.position.x, (int)myEntity.position.z) + 0.25f;
foreach (RebirthManager.hireInfo hire in RebirthManager.playerHires)
{
if (hire.hireID == myEntity.entityId)
{
Vector3 myEntityPosition = hire.reSpawnPosition;
numTerrainHeight = GameManager.Instance.World.GetTerrainHeight((int)hire.reSpawnPosition.x, (int)hire.reSpawnPosition.z) + 0.25f;
if (hire.reSpawnPosition != new Vector3(0, 0, 0))
{
if (hire.reSpawnPosition.y < 0)
{
myEntityPosition.y = numTerrainHeight;
}
return myEntityPosition;
}
else
{
return new Vector3(myEntity.position.x, numTerrainHeight, myEntity.position.x);
}
}
}
if (respawnPosition.y < 0)
{
respawnPosition.y = numTerrainHeight;
}
return respawnPosition;
}
public static string GetRandomName(EntityAlive entity)
{
string result = "";
bool randomNames = GetPropertyValue("AdvancedNPCFeatures", "UseRandomNames") == "true";
//Log.Out("RebirthUtilities-GetRandomName randomNames: " + randomNames);
if (randomNames)
{
bool excludeTags = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesTagsExclude")));
bool group1Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroup1Tags")));
bool group2Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroup2Tags")));
bool group3Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroup3Tags")));
bool group4Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroup4Tags")));
//Log.Out("RebirthUtilities-GetRandomName EntityTags: " + entity.EntityTags.GetTagNames().ToString().Trim());
//Log.Out("RebirthUtilities-GetRandomName UseRandomNamesGroup2Tags: " + Configuration.GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroup2Tags"));
bool groupNPC1Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroupNPC1Tags")));
bool groupNPC2Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroupNPC2Tags")));
bool groupNPC3Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroupNPC3Tags")));
bool groupNPC4Names = entity.EntityTags.Test_AnySet(FastTags<TagGroup.Global>.Parse(GetPropertyValue("AdvancedNPCFeatures", "UseRandomNamesGroupNPC4Tags")));
//Log.Out("RebirthUtilities-GetRandomName excludeTags: " + excludeTags);
//Log.Out("RebirthUtilities-GetRandomName group1Names: " + group1Names);
//Log.Out("RebirthUtilities-GetRandomName group2Names: " + group2Names);
//Log.Out("RebirthUtilities-GetRandomName group3Names: " + group3Names);
//Log.Out("RebirthUtilities-GetRandomName group4Names: " + group4Names);
//Log.Out("RebirthUtilities-GetRandomName groupNPC1Names: " + groupNPC1Names);
//Log.Out("RebirthUtilities-GetRandomName groupNPC2Names: " + groupNPC2Names);
//Log.Out("RebirthUtilities-GetRandomName groupNPC3Names: " + groupNPC3Names);
//Log.Out("RebirthUtilities-GetRandomName groupNPC4Names: " + groupNPC4Names);
if (!excludeTags &&
(group1Names || group2Names || group3Names || group4Names ||
groupNPC1Names || groupNPC2Names || groupNPC3Names || groupNPC4Names)
)
{
string key = "";
if (group4Names)
{
key = "RandomNamesGroup4";
}
else if (group3Names)
{
key = "RandomNamesGroup3";
}
else if (group2Names)
{
key = "RandomNamesGroup2";
}
else if (group1Names)
{
key = "RandomNamesGroup1";
}
else if (groupNPC4Names)
{
key = "RandomNamesGroupNPC4";
}
else if (groupNPC3Names)
{
key = "RandomNamesGroupNPC3";
}
else if (groupNPC2Names)
{
key = "RandomNamesGroupNPC2";
}
else if (groupNPC1Names)
{
key = "RandomNamesGroupNPC1";
}
//Log.Out("RebirthUtilities-GetRandomName key: " + key);
if (key != "")
{
string[] tags = GetPropertyValue("AdvancedNPCFeatures", key).Split(',');
int index = UnityEngine.Random.Range(0, tags.Length);
result = tags[index];
}
}
}
//Log.Out("RebirthUtilities-GetRandomName result: " + result);
return result;
}
public static int GetLeader(EntityAlive entity)
{
foreach (RebirthManager.hireInfo hire in RebirthManager.playerHires)
{
if (hire.hireID == entity.entityId)
{
return hire.playerID;
}
}
return 0;
}
public static IEnumerator delayNPCShotgunTrigger(float time, EntityNPCRebirth npc)
{
npc.canShotgunTrigger = false;
yield return new WaitForSeconds(time);
npc.canShotgunTrigger = true;
yield break;
}
public static void DumpFollowerDown(EntityPlayer primaryPlayer, bool sendToServer = false)
{
//Log.Out("RebirthUtilities-DumpFollowerDown NOT isClient");
if (primaryPlayer != null)
{
//Log.Out("RebirthUtilities-DumpFollowerDown primaryPlayer EXISTS");
World _world = GameManager.Instance.World;
int minMax = 30;
bool addedItems = false;
List<Entity> entitiesInBounds = _world.GetEntitiesInBounds(typeof(EntityNPCRebirth), BoundsUtils.BoundsForMinMax(primaryPlayer.position.x - minMax, primaryPlayer.position.y - 30, primaryPlayer.position.z - minMax, primaryPlayer.position.x + minMax, primaryPlayer.position.y + 30, primaryPlayer.position.z + minMax), new List<Entity>());
//Log.Out("RebirthUtilities-DumpFollowerDown entitiesInBounds.Count: " + entitiesInBounds.Count);
if (entitiesInBounds.Count > 0)
{
bool[] lockedSlots = primaryPlayer.bag.LockedSlots;
for (int x = 0; x < entitiesInBounds.Count; x++)
{
EntityNPCRebirth entityFollower = (EntityNPCRebirth)entitiesInBounds[x];
if (entityFollower != null)
{
//Log.Out("RebirthUtilities-DumpFollowerDown NPC: " + entityFollower.EntityClass.entityClassName);
bool skip = false;
if (entityFollower.HasAnyTags(FastTags<TagGroup.Global>.Parse("temp")) || (entityFollower.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal")) && RebirthVariables.customCompanionInventory == "none"))
{
skip = true;
}
float hidden = entityFollower.Buffs.GetCustomVar("$FR_NPC_Hidden");
float respawned = entityFollower.Buffs.GetCustomVar("$FR_NPC_Respawn");
if (!skip && hidden == 0 && respawned == 0 && !entityFollower.HasAnyTags(FastTags<TagGroup.Global>.Parse("noinventory")) && entityFollower.LeaderUtils.Owner != null && entityFollower.LeaderUtils.Owner.entityId == primaryPlayer.entityId)
{
//Log.Out("RebirthUtilities-DumpFollowerDown IS MINE");
ItemStack[] slots = primaryPlayer.bag.GetSlots();
//Log.Out("RebirthUtilities-DumpFollowerDown player bag slots: " + slots.Length);
for (int i = 0; i < slots.Length; i++)
{
ItemStack itemStack = slots[i];
bool skipSlot = false;
if (lockedSlots != null)
{
skipSlot = lockedSlots[i];
}
if (!itemStack.IsEmpty() && !skipSlot)
{
//Log.Out("RebirthUtilities-DumpFollowerDown GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-DumpFollowerDown itemStack.count: " + itemStack.count);
string itemName = itemStack.itemValue.ItemClass.GetItemName().ToLower();
if ((itemName != "questwhiteriversupplies" &&
itemName != "questcassadoresupplies"
))
{
if (entityFollower.lootContainer.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-DumpFollowerDown HAS ITEM");
ValueTuple<bool, bool> tryStack = entityFollower.lootContainer.TryStackItem(0, itemStack);
bool item = tryStack.Item1;
bool item2 = tryStack.Item2;
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-DumpFollowerDown COULD NOT STACK");
bool tryAdd = entityFollower.lootContainer.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
else
{
if (tryStack.Item2)
{
//Log.Out("RebirthUtilities-DumpFollowerDown COULD STACK ALL");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerDown COULD STACK PARTIAL, itemStack.count: " + itemStack.count);
primaryPlayer.bag.SetSlot(i, itemStack.Clone());
addedItems = true;
bool tryAdd = entityFollower.lootContainer.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerDown DOES NOT HAVE ITEM");
bool tryAdd = entityFollower.lootContainer.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
}
entityFollower.lootContainer.setModified();
}
}
}
}
}
}
public static void DumpDroneDown(EntityPlayer primaryPlayer, bool sendToServer = false)
{
//Log.Out("RebirthUtilities-DumpFollowerDown NOT isClient");
if (primaryPlayer != null)
{
//Log.Out("RebirthUtilities-DumpFollowerDown primaryPlayer EXISTS");
World _world = GameManager.Instance.World;
int minMax = 30;
bool addedItems = false;
bool[] lockedSlots = primaryPlayer.bag.LockedSlots;
OwnedEntityData[] ownedEntities = primaryPlayer.GetOwnedEntities();
for (int j = 0; j < ownedEntities.Length; j++)
{
//Log.Out("DroneManagerPatches-RemoveAllVehiclesFromMap ___dronesActive.Count: " + ___dronesActive.Count);
EntityDrone entityFollower = primaryPlayer.world.GetEntity(ownedEntities[j].entityId) as EntityDrone;
if (entityFollower != null)
{
//Log.Out("RebirthUtilities-DumpFollowerDown NPC: " + entityFollower.EntityClass.entityClassName);
bool skip = false;
if (entityFollower.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal,temp")) && RebirthVariables.customCompanionInventory == "none")
{
skip = true;
}
if (!skip)
{
//Log.Out("RebirthUtilities-DumpFollowerDown IS MINE");
ItemStack[] slots = primaryPlayer.bag.GetSlots();
//Log.Out("RebirthUtilities-DumpFollowerDown player bag slots: " + slots.Length);
for (int i = 0; i < slots.Length; i++)
{
ItemStack itemStack = slots[i];
bool skipSlot = false;
if (lockedSlots != null)
{
skipSlot = lockedSlots[i];
}
if (!itemStack.IsEmpty() && !skipSlot)
{
//Log.Out("RebirthUtilities-DumpFollowerDown GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-DumpFollowerDown itemStack.count: " + itemStack.count);
string itemName = itemStack.itemValue.ItemClass.GetItemName().ToLower();
if ((itemName != "questwhiteriversupplies" &&
itemName != "questcassadoresupplies"
))
{
if (entityFollower.lootContainer.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-DumpFollowerDown HAS ITEM");
ValueTuple<bool, bool> tryStack = entityFollower.lootContainer.TryStackItem(0, itemStack);
bool item = tryStack.Item1;
bool item2 = tryStack.Item2;
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-DumpFollowerDown COULD NOT STACK");
bool tryAdd = entityFollower.lootContainer.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
else
{
if (tryStack.Item2)
{
//Log.Out("RebirthUtilities-DumpFollowerDown COULD STACK ALL");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerDown COULD STACK PARTIAL, itemStack.count: " + itemStack.count);
primaryPlayer.bag.SetSlot(i, itemStack.Clone());
addedItems = true;
bool tryAdd = entityFollower.lootContainer.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerDown DOES NOT HAVE ITEM");
bool tryAdd = entityFollower.lootContainer.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
}
entityFollower.lootContainer.setModified();
}
}
}
}
}
public static void DumpFollowerUp(EntityPlayer primaryPlayer, bool sendToServer = false)
{
//Log.Out("RebirthUtilities-DumpFollowerUp NOT isClient");
if (primaryPlayer != null)
{
//Log.Out("RebirthUtilities-DumpFollowerUp primaryPlayer EXISTS");
World _world = GameManager.Instance.World;
int minMax = 30;
bool addedItems = false;
List<Entity> entitiesInBounds = _world.GetEntitiesInBounds(typeof(EntityNPCRebirth), BoundsUtils.BoundsForMinMax(primaryPlayer.position.x - minMax, primaryPlayer.position.y - 30, primaryPlayer.position.z - minMax, primaryPlayer.position.x + minMax, primaryPlayer.position.y + 30, primaryPlayer.position.z + minMax), new List<Entity>());
//Log.Out("RebirthUtilities-DumpFollowerUp entitiesInBounds.Count: " + entitiesInBounds.Count);
if (entitiesInBounds.Count > 0)
{
for (int x = 0; x < entitiesInBounds.Count; x++)
{
EntityNPCRebirth entityFollower = (EntityNPCRebirth)entitiesInBounds[x];
if (entityFollower != null)
{
//Log.Out("RebirthUtilities-DumpFollowerUp NPC: " + entityFollower.EntityClass.entityClassName);
bool isAnimal = false;
if (entityFollower.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal")))
{
isAnimal = true;
}
if (!entityFollower.HasAnyTags(FastTags<TagGroup.Global>.Parse("noinventory")) && entityFollower.LeaderUtils.Owner != null && entityFollower.LeaderUtils.Owner.entityId == primaryPlayer.entityId)
{
//Log.Out("RebirthUtilities-DumpFollowerUp IS MINE");
ItemStack[] slots = entityFollower.lootContainer.GetItems();
//Log.Out("RebirthUtilities-DumpFollowerUp player bag slots: " + slots.Length);
for (int i = 0; i < slots.Length; i++)
{
ItemStack itemStack = slots[i];
if (!itemStack.IsEmpty())
{
string itemName = itemStack.itemValue.ItemClass.GetItemName().ToLower();
bool bypass = (itemName == "medicalfirstaidbandage" ||
itemName == "drugpainkillers" ||
itemName == "medicalbandage" ||
itemName == "medicalfirstaidkit" ||
itemName == "drinkjarriverwater" ||
itemName == "drinkjarboiledwater" ||
itemName == "furiousramsaymodsmokeresist" ||
itemName == "furiousramsaymodshockresist" ||
itemName == "furiousramsaymodfireshocksmokeresist" ||
itemName == "furiousramsaymodfireshockresist" ||
itemName == "furiousramsaymodfireresist"
);
if (isAnimal)
{
bypass = (itemName == "furiousramsaymodsmokeresist" ||
itemName == "furiousramsaymodshockresist" ||
itemName == "furiousramsaymodfireshocksmokeresist" ||
itemName == "furiousramsaymodfireshockresist" ||
itemName == "furiousramsaymodfireresist"
);
}
if (entityFollower.Buffs.HasBuff("FuriousRamsayResistFire") &&
(itemName == "drinkjarriverwater" ||
itemName == "drinkjarboiledwater"))
{
bypass = false;
}
if (!bypass)
{
//Log.Out("RebirthUtilities-DumpFollowerUp GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-DumpFollowerUp itemStack.count: " + itemStack.count);
if (primaryPlayer.bag.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-DumpFollowerUp HAS ITEM");
ValueTuple<bool, bool> tryStack = primaryPlayer.bag.TryStackItem(0, itemStack);
bool item = tryStack.Item1;
bool item2 = tryStack.Item2;
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-DumpFollowerUp COULD NOT STACK");
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
else
{
if (tryStack.Item2)
{
//Log.Out("RebirthUtilities-DumpFollowerUp COULD STACK ALL");
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerUp COULD STACK PARTIAL, itemStack.count: " + itemStack.count);
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerUp DOES NOT HAVE ITEM");
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
}
entityFollower.lootContainer.setModified();
}
}
}
}
}
}
public static void DumpDroneUp(EntityPlayer primaryPlayer, bool sendToServer = false)
{
//Log.Out("RebirthUtilities-DumpFollowerUp NOT isClient");
if (primaryPlayer != null)
{
//Log.Out("RebirthUtilities-DumpFollowerUp primaryPlayer EXISTS");
World _world = GameManager.Instance.World;
int minMax = 30;
bool addedItems = false;
OwnedEntityData[] ownedEntities = primaryPlayer.GetOwnedEntities();
for (int j = 0; j < ownedEntities.Length; j++)
{
//Log.Out("DroneManagerPatches-RemoveAllVehiclesFromMap ___dronesActive.Count: " + ___dronesActive.Count);
EntityDrone entityFollower = primaryPlayer.world.GetEntity(ownedEntities[j].entityId) as EntityDrone;
if (entityFollower != null)
{
ItemStack[] slots = entityFollower.lootContainer.GetItems();
//Log.Out("RebirthUtilities-DumpFollowerUp player bag slots: " + slots.Length);
for (int i = 0; i < slots.Length; i++)
{
ItemStack itemStack = slots[i];
if (!itemStack.IsEmpty())
{
string itemName = itemStack.itemValue.ItemClass.GetItemName().ToLower();
bool bypass = (itemName == "medicalfirstaidbandage" ||
itemName == "drugpainkillers" ||
itemName == "medicalfirstaidkit"
);
if (!bypass)
{
//Log.Out("RebirthUtilities-DumpFollowerUp GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-DumpFollowerUp itemStack.count: " + itemStack.count);
if (primaryPlayer.bag.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-DumpFollowerUp HAS ITEM");
ValueTuple<bool, bool> tryStack = primaryPlayer.bag.TryStackItem(0, itemStack);
bool item = tryStack.Item1;
bool item2 = tryStack.Item2;
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-DumpFollowerUp COULD NOT STACK");
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
else
{
if (tryStack.Item2)
{
//Log.Out("RebirthUtilities-DumpFollowerUp COULD STACK ALL");
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerUp COULD STACK PARTIAL, itemStack.count: " + itemStack.count);
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
else
{
//Log.Out("RebirthUtilities-DumpFollowerUp DOES NOT HAVE ITEM");
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpFollowerUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityFollower.lootContainer.UpdateSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
}
entityFollower.lootContainer.setModified();
}
}
}
}
public static void CheckExternalOptions()
{
CheckPathSmoothing();
}
public static void CheckPathSmoothing()
{
//Log.Out("ModManagerPatches-LoadMods RebirthVariables.customPathSmoothing: " + RebirthVariables.customPathSmoothing);
if (RebirthVariables.customPathSmoothing)
{
//Log.Out("ModManagerPatches-LoadMods RebirthVariables.customPathSmoothing IS ON");
if (!HarmonyLib.Harmony.HasAnyPatches("PathSmoothing"))
{
//Log.Out("ModManagerPatches-LoadMods RebirthVariables.customPathSmoothing PATCH");
PathSmoothing.Common.Enable();
}
}
else
{
//Log.Out("ModManagerPatches-LoadMods RebirthVariables.customPathSmoothing IS OFF");
if (HarmonyLib.Harmony.HasAnyPatches("PathSmoothing"))
{
//Log.Out("ModManagerPatches-LoadMods RebirthVariables.customPathSmoothing UNPATCH");
PathSmoothing.Common.Disable();
}
}
}
public static string GetFactionName(int factionID)
{
string result = "";
foreach (string factionName in RebirthVariables.factions.Keys)
{
if (RebirthVariables.factions[factionName] == factionID)
{
result = factionName;
break;
}
}
return result;
}
public static int GetFactionID(string factionName)
{
int result = 0;
foreach (string faction in RebirthVariables.factions.Keys)
{
if (faction.ToLower() == factionName.ToLower())
{
result = RebirthVariables.factions[faction];
break;
}
}
return result;
}
/// <summary>
///
/// </summary>
/// <param name="source"></param>
/// <param name="target"></param>
/// <param name="checkCanDamage"></param>
/// <returns>True if safe to attack, False otherwise</returns>
public static bool VerifyFactionStandingDetails(string sourceFaction, string targetFaction, bool checkCanDamage = false)
{
bool result = true;
foreach (factionStanding standing in RebirthVariables.factionStandings)
{
if (standing.source.ToLower() == sourceFaction.ToLower())
{
if (standing.target.ToLower() == targetFaction.ToLower()
)
{
if (checkCanDamage)
{
return standing.canDamage;
}
return false;
}
else if (standing.target.ToLower() == "*")
{
if (checkCanDamage)
{
return standing.canDamage;
}
return false;
}
}
}
return result;
}
public static bool VerifyFactionStanding(EntityAlive source, EntityAlive target, bool checkCanDamage = false, bool forceLog = false)
{
bool log = RebirthVariables.testVerifyFaction;
TeLogging = log;
if (target == null || source == null)
{
//Log.Out("EAITargetPatches-verifyFactionStanding 1");
RebirthUtilities.TeLog($"target: {target}, source: {source}");
return true;
}
if (target is EntityDrone && forceLog)
{
log = true;
}
if (source.Buffs.GetCustomVar("onMission") == 1f ||
source.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1f ||
source.Buffs.GetCustomVar("$FR_NPC_Hidden") == 1f)
{
RebirthUtilities.TeLog($"source: {source} - has buff onMission or Respawn or Hidden");
return false;
}
if (target.Buffs.GetCustomVar("onMission") == 1f ||
target.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1f ||
target.Buffs.GetCustomVar("$FR_NPC_Hidden") == 1f)
{
RebirthUtilities.TeLog($"target: {target} - has buff onMission or Respawn or Hidden");
return false;
}
bool result = true;
string sourceFaction = "";
string targetFaction = "";
if (source.EntityClass.Properties.Values.ContainsKey("Faction"))
{
sourceFaction = source.EntityClass.Properties.Values["Faction"];
}
if (target.EntityClass.Properties.Values.ContainsKey("Faction"))
{
targetFaction = target.EntityClass.Properties.Values["Faction"];
}
if (log)
{
Log.Out("=================================================================================");
Log.Out("EAITargetPatches-verifyFactionStanding checkCanDamage: " + checkCanDamage);
Log.Out("EAITargetPatches-verifyFactionStanding BEFORE [" + source.EntityClass.entityClassName + "] sourceFaction: " + sourceFaction);
Log.Out("EAITargetPatches-verifyFactionStanding BEFORE [" + target.EntityClass.entityClassName + "] targetFaction: " + targetFaction);
}
int modifiedFactionID = (int)source.Buffs.GetCustomVar("$faction");
if (modifiedFactionID > 0)
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding 2");
}
string modifiedFaction = GetFactionName(modifiedFactionID).ToLower();
if (modifiedFaction != "")
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding 3");
}
sourceFaction = modifiedFaction;
}
}
modifiedFactionID = (int)target.Buffs.GetCustomVar("$faction");
if (modifiedFactionID > 0)
{
RebirthUtilities.TeLog($"target: {target}, modifiedFactionID: {modifiedFactionID}");
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding 4");
}
string modifiedFaction = GetFactionName(modifiedFactionID).ToLower();
if (modifiedFaction != "")
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding 5");
}
targetFaction = modifiedFaction;
}
}
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding AFTER sourceFaction: " + sourceFaction);
Log.Out("EAITargetPatches-verifyFactionStanding AFTER targetFaction: " + targetFaction);
}
if (sourceFaction.ToLower() == targetFaction.ToLower())
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding 6");
Log.Out("EAITargetPatches-verifyFactionStanding RETURN SOURCE faction: " + sourceFaction + " entity: " + source.EntityClass.entityClassName);
Log.Out("EAITargetPatches-verifyFactionStanding RETURN TARGET faction: " + targetFaction + " entity: " + target.EntityClass.entityClassName);
}
RebirthUtilities.TeLog($"source: {source}, target: {target}, sourceFaction: {sourceFaction}, targetFaction: {targetFaction}");
return false;
}
if (sourceFaction == "")
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding SOURCE faction: " + sourceFaction + " entity: " + source.EntityClass.entityClassName);
}
}
if (targetFaction == "")
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding TARGET faction: " + targetFaction + " entity: " + target.EntityClass.entityClassName);
}
}
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding SOURCE faction: " + sourceFaction + " entity: " + source.EntityClass.entityClassName);
Log.Out("EAITargetPatches-verifyFactionStanding TARGET faction: " + targetFaction + " entity: " + target.EntityClass.entityClassName);
Log.Out("EAITargetPatches-verifyFactionStanding factionStandings.Count: " + RebirthVariables.factionStandings.Count);
}
foreach (factionStanding standing in RebirthVariables.factionStandings)
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding standing.source : " + standing.source.ToLower());
Log.Out("EAITargetPatches-verifyFactionStanding standing.target : " + standing.target.ToLower());
Log.Out("EAITargetPatches-verifyFactionStanding sourceFaction : " + sourceFaction.ToLower());
}
if (standing.source.ToLower() == sourceFaction.ToLower())
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding standing.target.ToLower() : " + standing.target.ToLower());
Log.Out("EAITargetPatches-verifyFactionStanding targetFaction.ToLower() : " + targetFaction.ToLower());
}
if (standing.target.ToLower() == targetFaction.ToLower()
)
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding standing.target : " + standing.target.ToLower());
Log.Out("EAITargetPatches-verifyFactionStanding targetFaction : " + targetFaction.ToLower());
}
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding standing.canDamage: " + standing.canDamage);
}
if (checkCanDamage)
{
RebirthUtilities.TeLog($"VerifyFactionStanding - checkCanDamage1 {standing.canDamage}");
return standing.canDamage;
}
return false;
}
else if (standing.target.ToLower() == "*")
{
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding IS * ");
}
if (checkCanDamage)
{
RebirthUtilities.TeLog($"VerifyFactionStanding - checkCanDamage2 * {standing.canDamage}");
return standing.canDamage;
}
if (log)
{
Log.Out("EAITargetPatches-verifyFactionStanding SKIP");
}
return false;
}
}
}
RebirthUtilities.TeLog($"source: {source}, target: {target}, sourceFaction: {sourceFaction}, targetFaction: {targetFaction}, modifiedFactionID: {modifiedFactionID}, Result: {result}");
return result;
}
public static List<TileEntity> GetCustomTileEntities(Vector3 _blockPos, float distance, string targetTypes)
{
//Log.Out("RebirthUtilities-GetCustomTileEntities targetTypes: " + targetTypes);
var tileEntities = new List<TileEntity>();
var paths = ScanForCustomTileEntities(_blockPos, targetTypes, true);
foreach (var path in paths)
{
var distanceToLeader = Vector3.Distance(_blockPos, path);
if (!(distanceToLeader < distance)) continue;
var tileEntity = GameManager.Instance.World.GetTileEntity(0, new Vector3i(path));
if (tileEntity == null) continue;
tileEntities.Add(tileEntity);
}
//Log.Out("RebirthUtilities-GetCustomTileEntities tileEntities.Count: " + tileEntities.Count);
return tileEntities;
}
public static List<Vector3> ScanForCustomTileEntities(Vector3 _blockPos, string _targetTypes = "",
bool ignoreTouch = false)
{
//Log.Out("=================================================================================");
//Log.Out("RebirthUtilities-ScanForCustomTileEntities _targetTypes: " + _targetTypes);
var paths = new List<Vector3>();
var chunkX = World.toChunkXZ((int)_blockPos.x);
var chunkZ = World.toChunkXZ((int)_blockPos.z);
for (var i = -1; i < 2; i++)
{
for (var j = -1; j < 2; j++)
{
var chunk = (Chunk)GameManager.Instance.World.GetChunkSync(chunkX + j, chunkZ + i);
if (chunk == null)
{
//Log.Out("RebirthUtilities-ScanForCustomTileEntities CHUNK IS NULL");
continue;
}
var tileEntities = chunk.GetTileEntities();
//Log.Out("RebirthUtilities-ScanForCustomTileEntities tileEntities.Count: " + tileEntities.Count);
foreach (var tileEntity in tileEntities.list)
{
//Log.Out("RebirthUtilities-ScanForCustomTileEntities GetTileEntityType: " + tileEntity.GetTileEntityType());
//Log.Out("RebirthUtilities-ScanForCustomTileEntities (int)GetTileEntityType: " + (int)tileEntity.GetTileEntityType());
foreach (var filterTypeFull in _targetTypes.Split(','))
{
//Log.Out("RebirthUtilities-ScanForCustomTileEntities filterTypeFull: " + filterTypeFull);
// Check if the filter type includes a :, which may indicate we want a precise block.
int filterType = int.Parse(filterTypeFull);
if ((int)tileEntity.GetTileEntityType() != filterType) continue;
//Log.Out("RebirthUtilities-ScanForCustomTileEntities filterType: " + filterType);
//Log.Out("RebirthUtilities-ScanForCustomTileEntities (int)tileEntity.GetTileEntityType(): " + (int)tileEntity.GetTileEntityType());
//Log.Out("RebirthUtilities-ScanForCustomTileEntities ADD PATH");
var position = tileEntity.ToWorldPos().ToVector3();
paths.Add(position);
}
}
}
}
//Log.Out("RebirthUtilities-ScanForCustomTileEntities paths: " + paths.Count);
paths = paths.OrderBy(p => Vector3.Distance(_blockPos, p)).ToList();
return paths;
}
public static List<TileEntity> GetTileEntities(EntityAlive player, float distance, bool notBroadcast = false)
{
var tileEntities = new List<TileEntity>();
const string targetTypes = "Loot, SecureLoot, Composite";
var paths = ScanForTileEntities(player, targetTypes, true);
foreach (var path in paths)
{
var distanceToLeader = Vector3.Distance(player.position, path);
if (!(distanceToLeader < distance)) continue;
var tileEntity = player.world.GetTileEntity(0, new Vector3i(path));
if (tileEntity == null) continue;
bool isValid = !Broadcastmanager.HasInstance || Broadcastmanager.Instance.Check(tileEntity.ToWorldPos());
if (notBroadcast) isValid = true;
if (isValid)
{
switch (tileEntity.GetTileEntityType())
{
case TileEntityType.Loot:
if (tileEntity is not TileEntityLootContainer lootTileEntity) break;
tileEntities.Add(tileEntity);
break;
case TileEntityType.SecureLoot:
case TileEntityType.Composite:
tileEntities.Add(tileEntity);
break;
case TileEntityType.SecureLootSigned:
case TileEntityType.None:
case TileEntityType.DewCollector:
case TileEntityType.LandClaim:
case TileEntityType.Trader:
case TileEntityType.VendingMachine:
case TileEntityType.Forge:
case TileEntityType.Campfire:
case TileEntityType.SecureDoor:
case TileEntityType.Workstation:
case TileEntityType.Sign:
case TileEntityType.GoreBlock:
case TileEntityType.Powered:
case TileEntityType.PowerSource:
case TileEntityType.PowerRangeTrap:
case TileEntityType.Light:
case TileEntityType.Trigger:
case TileEntityType.Sleeper:
case TileEntityType.PowerMeleeTrap:
default:
break;
}
}
}
return tileEntities;
}
public static List<Vector3> ScanForTileEntities(EntityAlive Self, string _targetTypes = "",
bool ignoreTouch = false)
{
var paths = new List<Vector3>();
var blockPosition = Self.GetBlockPosition();
var chunkX = World.toChunkXZ(blockPosition.x);
var chunkZ = World.toChunkXZ(blockPosition.z);
if (string.IsNullOrEmpty(_targetTypes) || _targetTypes.ToLower().Contains("basic"))
_targetTypes = "LandClaim, Loot, VendingMachine, Forge, Campfire, Workstation, PowerSource, Composite";
for (var i = -1; i < 2; i++)
{
for (var j = -1; j < 2; j++)
{
var chunk = (Chunk)Self.world.GetChunkSync(chunkX + j, chunkZ + i);
if (chunk == null) continue;
var tileEntities = chunk.GetTileEntities();
foreach (var tileEntity in tileEntities.list)
{
foreach (var filterTypeFull in _targetTypes.Split(','))
{
// Check if the filter type includes a :, which may indicate we want a precise block.
var filterType = filterTypeFull;
var blockNames = "";
if (filterTypeFull.Contains(":"))
{
filterType = filterTypeFull.Split(':')[0];
blockNames = filterTypeFull.Split(':')[1];
}
// Parse the filter type and verify if the tile entity is in the filter.
var targetType = EnumUtils.Parse<TileEntityType>(filterType, true);
//Log.Out("RebirthUtilities-ScanForTileEntities targetType: " + targetType);
if (tileEntity.GetTileEntityType() != targetType) continue;
switch (tileEntity.GetTileEntityType())
{
case TileEntityType.None:
continue;
// If the loot containers were already touched, don't path to them.
case TileEntityType.Loot:
if (((TileEntityLootContainer)tileEntity).bTouched && ignoreTouch == false)
continue;
break;
case TileEntityType.SecureLoot:
if (((TileEntitySecureLootContainer)tileEntity).bTouched && ignoreTouch == false)
continue;
break;
}
// Search for the tile entity's block name to see if its filtered.
if (!string.IsNullOrEmpty(blockNames))
{
if (!blockNames.Contains(tileEntity.blockValue.Block.GetBlockName()))
continue;
}
var position = tileEntity.ToWorldPos().ToVector3();
paths.Add(position);
}
}
}
}
// sort the paths to keep the closes one.
paths.Sort(new NearestPathSorter(Self));
return paths;
}
public static bool IsCurrentRevengeTarget(EntityAlive self, Entity target)
{
if (target == null || self == null)
return false;
var revengeTarget = self.GetRevengeTarget();
if (revengeTarget == null)
return false;
return revengeTarget.entityId == target.entityId;
}
public static string getQualityColor(int quality)
{
CachedStringFormatter<Color32> cachedStringFormatter = durabilitycolorFormatter;
return cachedStringFormatter.Format(QualityInfo.GetQualityColor(quality));
}
public static void checkCraftingProgression(Inventory __instance, EntityAlive primaryPlayer)
{
//EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
if (primaryPlayer != null)
{
ItemValue holdingItemItemValue = __instance.holdingItemItemValue;
if (holdingItemItemValue != null)
{
string holdingItem = __instance.holdingItemItemValue.ItemClass.GetItemName().ToLower();
//Log.Out("=====================================================================================================");
//Log.Out("RebirthUtilities-checkCraftingProgression holdingItem: " + holdingItem);
bool foundItem = false;
int foundItemAt = -1;
int n = 0;
int m = -1;
float classID = primaryPlayer.Buffs.GetCustomVar("$ActiveClass_FR");
string playerClass = RebirthUtilities.GetClassNameFromID(classID);
bool skipOtherCrafting = playerClass.ToLower() == "soldier" && (holdingItem.ToLower() == "meleetoolaxet1ironfireaxe" || holdingItem.ToLower() == "meleetoolaxet2steelaxe");
if (!skipOtherCrafting)
{
foreach (var key in RebirthVariables.localOtherCrafting.Keys)
{
//Log.Out("RebirthUtilities-checkCraftingProgression key: " + key);
n++;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
//Log.Out("RebirthUtilities-checkCraftingProgression localOtherCrafting.craftingPerk: " + craftingList.craftingPerk);
string craftingProgression = craftingList.craftingPerk;
ProgressionValue progressionValue = primaryPlayer.Progression.GetProgressionValue(craftingProgression);
if (progressionValue != null)
{
RebirthVariables.holdingItem = "";
RebirthVariables.holdingItemQuality = 0;
RebirthVariables.holdingItemIcon = "";
RebirthVariables.holdingItemColor = "";
RebirthVariables.holdingItemPerc = 0f;
RebirthVariables.holdingItemCraftIcon = "";
if (progressionValue.ProgressionClass.DisplayDataList != null)
{
for (int i = 0; i < progressionValue.ProgressionClass.DisplayDataList.Count; i++)
{
string itemName = progressionValue.ProgressionClass.DisplayDataList[i].ItemName.ToLower();
//Log.Out("RebirthUtilities-checkCraftingProgression ITEM NAME: " + itemName);
if (!itemName.StartsWith("mod") &&
!itemName.StartsWith("furiousramsayattribute") &&
!(itemName.Trim().Length == 0)
)
{
if (progressionValue.ProgressionClass.DisplayDataList[i].ItemName.ToLower() == holdingItem)
{
//Log.Out("RebirthUtilities-checkCraftingProgression FOUND ITEM");
foundItem = true;
foundItemAt = i;
m = n;
}
int progressionLevel = progressionValue.ProgressionClass.DisplayDataList[i].GetQualityLevel(progressionValue.Level);
if (progressionLevel > 0)
{
RebirthVariables.holdingItem = progressionValue.ProgressionClass.DisplayDataList[i].ItemName;
RebirthVariables.holdingItemQuality = progressionLevel;
RebirthVariables.holdingItemIcon = progressionValue.ProgressionClass.DisplayDataList[i].ItemName;
RebirthVariables.holdingItemColor = getQualityColor(RebirthVariables.holdingItemQuality);
//Log.Out("RebirthUtilities-checkCraftingProgression RebirthVariables.holdingItem: " + RebirthVariables.holdingItem);
//Log.Out("RebirthUtilities-checkCraftingProgression foundItemAt: " + foundItemAt);
//Log.Out("RebirthUtilities-checkCraftingProgression i: " + i);
//Log.Out("RebirthUtilities-checkCraftingProgression m: " + m);
//Log.Out("RebirthUtilities-checkCraftingProgression n: " + n);
if (foundItemAt < i)
{
if (m == n)
{
//Log.Out("RebirthUtilities-checkCraftingProgression A");
RebirthVariables.holdingItemCraftIcon = "ui_game_symbol_hammer";
}
}
else
{
//Log.Out("RebirthUtilities-checkCraftingProgression B");
if (RebirthVariables.holdingItemQuality > holdingItemItemValue.Quality)
{
//Log.Out("RebirthUtilities-checkCraftingProgression C");
RebirthVariables.holdingItemCraftIcon = "ui_game_symbol_hammer";
}
}
float currentXP = RebirthVariables.localVariables["$varFuriousRamsay" + key + "PercUnit"];
//Log.Out("RebirthUtilities-checkCraftingProgression currentXP: " + currentXP);
float floor = GetOtherCategoryPreviousFromXP(key, currentXP);
float ceiling = GetOtherCategoryNextFromXP(key, currentXP);
if (currentXP > ceiling)
{
currentXP = ceiling;
}
float perc = (currentXP - floor) / (ceiling - floor);
RebirthVariables.holdingItemPerc = perc;
//Log.Out("RebirthUtilities-checkCraftingProgression floor: " + floor);
//Log.Out("RebirthUtilities-checkCraftingProgression ceiling: " + ceiling);
//Log.Out("RebirthUtilities-checkCraftingProgression perc: " + perc * 100);
ItemValue craftingItem = ItemClass.GetItem(RebirthVariables.holdingItem, false);
if (craftingItem != null)
{
RebirthVariables.holdingItemIcon = craftingItem.ItemClass.GetIconName();
}
//Log.Out("RebirthUtilities-checkCraftingProgression D1 ItemName: " + RebirthVariables.holdingItem);
//Log.Out("RebirthUtilities-checkCraftingProgression D1 QualityLevel: " + RebirthVariables.holdingItemQuality);
//Log.Out("RebirthUtilities-checkCraftingProgression D1 Icon: " + RebirthVariables.holdingItemIcon);
//Log.Out("RebirthUtilities-checkCraftingProgression D1 Color: " + RebirthVariables.holdingItemColor);
}
if (foundItem && i == progressionValue.ProgressionClass.DisplayDataList.Count - 1)
{
//Log.Out("RebirthUtilities-checkCraftingProgression END OF CRAFTING LIST AFTER HAVING FOUND ITEM");
return;
}
}
}
if (foundItem)
{
return;
}
}
}
break;
}
}
}
foundItem = false;
foundItemAt = -1;
n = 0;
m = -1;
foreach (var key in RebirthVariables.localExpertiseCrafting.Keys)
{
//Log.Out("RebirthUtilities-checkCraftingProgression key: " + key);
n++;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
//Log.Out("RebirthUtilities-checkCraftingProgression localExpertiseCrafting.craftingPerk: " + craftingList.craftingPerk);
string craftingProgression = craftingList.craftingPerk;
ProgressionValue progressionValue = primaryPlayer.Progression.GetProgressionValue(craftingProgression);
if (progressionValue != null)
{
RebirthVariables.holdingItem = "";
RebirthVariables.holdingItemQuality = 0;
RebirthVariables.holdingItemIcon = "";
RebirthVariables.holdingItemColor = "";
RebirthVariables.holdingItemPerc = 0f;
RebirthVariables.holdingItemCraftIcon = "";
if (progressionValue.ProgressionClass.DisplayDataList != null)
{
for (int i = 0; i < progressionValue.ProgressionClass.DisplayDataList.Count; i++)
{
if (progressionValue.ProgressionClass.DisplayDataList[i].UnlockDataList.Count > 0)
{
for (int j = 0; j < progressionValue.ProgressionClass.DisplayDataList[i].UnlockDataList.Count; j++)
{
string itemNameLower = progressionValue.ProgressionClass.DisplayDataList[i].UnlockDataList[j].ItemName.ToLower();
string itemName = progressionValue.ProgressionClass.DisplayDataList[i].UnlockDataList[j].ItemName;
//Log.Out("RebirthUtilities-checkCraftingProgression UNLOCK ITEM NAME: " + itemNameLower);
if (!itemNameLower.StartsWith("mod") &&
!itemNameLower.StartsWith("furiousramsayattribute") &&
!(itemNameLower.Trim().Length == 0)
)
{
if (itemNameLower == holdingItem)
{
//Log.Out("RebirthUtilities-checkCraftingProgression FOUND ITEM");
foundItem = true;
foundItemAt = i;
m = n;
}
int progressionLevel = progressionValue.ProgressionClass.DisplayDataList[i].GetQualityLevel(progressionValue.Level);
if (progressionLevel > 0)
{
RebirthVariables.holdingItem = itemName;
RebirthVariables.holdingItemQuality = progressionLevel;
RebirthVariables.holdingItemIcon = itemName;
RebirthVariables.holdingItemColor = getQualityColor(RebirthVariables.holdingItemQuality);
//Log.Out("RebirthUtilities-checkCraftingProgression RebirthVariables.holdingItem: " + RebirthVariables.holdingItem);
//Log.Out("RebirthUtilities-checkCraftingProgression foundItemAt: " + foundItemAt);
//Log.Out("RebirthUtilities-checkCraftingProgression i: " + i);
//Log.Out("RebirthUtilities-checkCraftingProgression m: " + m);
//Log.Out("RebirthUtilities-checkCraftingProgression n: " + n);
if (foundItemAt < i)
{
if (m == n)
{
//Log.Out("RebirthUtilities-checkCraftingProgression A");
RebirthVariables.holdingItemCraftIcon = "ui_game_symbol_hammer";
}
}
else
{
//Log.Out("RebirthUtilities-checkCraftingProgression B");
if (RebirthVariables.holdingItemQuality > holdingItemItemValue.Quality)
{
//Log.Out("RebirthUtilities-checkCraftingProgression C");
RebirthVariables.holdingItemCraftIcon = "ui_game_symbol_hammer";
}
}
float currentXP = RebirthVariables.localVariables["$varFuriousRamsay" + key + "PercUnit"];
//Log.Out("RebirthUtilities-checkCraftingProgression currentXP: " + currentXP);
float floor = GetExpertiseCategoryPreviousFromXP(key, currentXP);
float ceiling = GetExpertiseCategoryNextFromXP(key, currentXP);
if (currentXP > ceiling)
{
currentXP = ceiling;
}
float perc = (currentXP - floor) / (ceiling - floor);
RebirthVariables.holdingItemPerc = perc;
//Log.Out("RebirthUtilities-checkCraftingProgression floor: " + floor);
//Log.Out("RebirthUtilities-checkCraftingProgression ceiling: " + ceiling);
//Log.Out("RebirthUtilities-checkCraftingProgression perc: " + perc * 100);
ItemValue craftingItem = ItemClass.GetItem(RebirthVariables.holdingItem, false);
//Log.Out("RebirthUtilities-checkCraftingProgression D1 ItemName: " + RebirthVariables.holdingItem);
if (craftingItem != null)
{
if (craftingItem.ItemClass != null)
{
if (craftingItem.ItemClass.CustomIcon != null && craftingItem.ItemClass.CustomIcon.Value.Length > 0)
{
RebirthVariables.holdingItemIcon = craftingItem.ItemClass.CustomIcon.Value;
}
RebirthVariables.holdingItemIcon = craftingItem.ItemClass.Name;
}
}
//Log.Out("RebirthUtilities-checkCraftingProgression D1 ItemName: " + RebirthVariables.holdingItem);
//Log.Out("RebirthUtilities-checkCraftingProgression D1 QualityLevel: " + RebirthVariables.holdingItemQuality);
//Log.Out("RebirthUtilities-checkCraftingProgression D1 Icon: " + RebirthVariables.holdingItemIcon);
//Log.Out("RebirthUtilities-checkCraftingProgression D1 Color: " + RebirthVariables.holdingItemColor);
}
if (foundItem && i == progressionValue.ProgressionClass.DisplayDataList.Count - 1)
{
//Log.Out("RebirthUtilities-checkCraftingProgression END OF CRAFTING LIST AFTER HAVING FOUND ITEM");
return;
}
}
}
}
}
if (foundItem)
{
return;
}
}
}
break;
}
}
RebirthVariables.holdingItem = "";
RebirthVariables.holdingItemQuality = 0;
RebirthVariables.holdingItemIcon = "";
RebirthVariables.holdingItemColor = "";
RebirthVariables.holdingItemPerc = 0f;
RebirthVariables.holdingItemCraftIcon = "";
//Log.Out("RebirthUtilities-checkCraftingProgression B ItemName: " + RebirthVariables.holdingItem);
//Log.Out("RebirthUtilities-checkCraftingProgression B QualityLevel: " + RebirthVariables.holdingItemQuality);
//Log.Out("RebirthUtilities-checkCraftingProgression B Icon: " + RebirthVariables.holdingItemIcon);
}
else
{
RebirthVariables.holdingItem = "";
RebirthVariables.holdingItemQuality = 0;
RebirthVariables.holdingItemIcon = "";
RebirthVariables.holdingItemColor = "";
RebirthVariables.holdingItemPerc = 0f;
RebirthVariables.holdingItemCraftIcon = "";
//Log.Out("RebirthUtilities-checkCraftingProgression E ItemName: " + RebirthVariables.holdingItem);
}
}
}
public static bool IsCraftableItem()
{
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
bool foundItem = false;
if (primaryPlayer != null)
{
ItemValue holdingItemItemValue = primaryPlayer.inventory.holdingItemItemValue;
if (holdingItemItemValue != null)
{
string holdingItem = primaryPlayer.inventory.holdingItemItemValue.ItemClass.GetItemName().ToLower();
foreach (var key in RebirthVariables.localExpertiseCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
string craftingProgression = craftingList.craftingPerk;
ProgressionValue progressionValue = primaryPlayer.Progression.GetProgressionValue(craftingProgression);
if (progressionValue != null)
{
if (progressionValue.ProgressionClass.DisplayDataList != null)
{
for (int i = 0; i < progressionValue.ProgressionClass.DisplayDataList.Count; i++)
{
if (progressionValue.ProgressionClass.DisplayDataList[i].ItemName.ToLower() == holdingItem)
{
return true;
}
}
}
}
}
}
foreach (var key in RebirthVariables.localOtherCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
string craftingProgression = craftingList.craftingPerk;
ProgressionValue progressionValue = primaryPlayer.Progression.GetProgressionValue(craftingProgression);
if (progressionValue != null)
{
if (progressionValue.ProgressionClass.DisplayDataList != null)
{
for (int i = 0; i < progressionValue.ProgressionClass.DisplayDataList.Count; i++)
{
if (progressionValue.ProgressionClass.DisplayDataList[i].ItemName.ToLower() == holdingItem)
{
return true;
}
}
}
}
}
}
}
}
return foundItem;
}
public static void setHordeNightActiveValue(bool value)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
int entityID = -1;
if (!GameManager.IsDedicatedServer)
{
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
if (primaryPlayer != null)
{
entityID = primaryPlayer.entityId;
}
}
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetHordeNightActive>().Setup(value), false, -1, entityID, -1, null, 192);
}
}
public static bool IsOptionAvailable(string optionType, string optionName, string optionValue)
{
bool flag = false;
if (optionType == "bool")
{
//Log.Out("IsOptionValidRebirth-IsValid 2");
bool option = CustomGameOptions.GetBool(optionName);
//Log.Out("IsOptionValidRebirth-IsValid option: " + option);
bool optionCompare = StringParsers.ParseBool(optionValue, 0, -1, true);
//Log.Out("IsOptionValidRebirth-IsValid optionValue: " + optionValue);
flag = option == optionCompare;
}
else if (optionType == "int")
{
//Log.Out("IsOptionValidRebirth-IsValid 3");
int option = CustomGameOptions.GetInt(optionName);
//Log.Out("IsOptionValidRebirth-IsValid option: " + option);
int optionCompare = int.Parse(optionValue);
//Log.Out("IsOptionValidRebirth-IsValid optionValue: " + optionValue);
flag = option == optionCompare;
}
else if (optionType == "string")
{
//Log.Out("IsOptionValidRebirth-IsValid 4");
string option = CustomGameOptions.GetString(optionName);
//Log.Out("IsOptionValidRebirth-IsValid option: " + option);
//Log.Out("IsOptionValidRebirth-IsValid optionValue: " + optionValue);
flag = option.ToLower() == optionValue.ToLower();
}
return flag;
}
public static bool CanShoot(EntityAlive sourceEntity, EntityAlive targetEntity, float attackDistance, float maxDistance = -1, bool IsLeaderRebirth = false)
{
bool canLog = false; /*(sourceEntity is EntityAliveSDX && sourceEntity.EntityClass.entityClassName.Contains("SMG") &&
targetEntity is EntityZombie
);*/
if (targetEntity.IsDead())
{
if (canLog)
Log.Out("RebirthUtilities-CanShoot TARGET IS DEAD / target: " + targetEntity.EntityClass.entityClassName);
return false;
}
var headPosition = sourceEntity.getHeadPosition();
var headPosition2 = targetEntity.getHeadPosition();
var direction = headPosition2 - headPosition;
var seeDistance = attackDistance;
if (maxDistance > -1)
seeDistance = maxDistance;
if (direction.magnitude > seeDistance)
{
if (canLog)
Log.Out("RebirthUtilities-CanShoot TARGET IS TOO FAR (direction.magnitude: " + direction.magnitude + ", seeDistance: " + seeDistance + ") / target: " + targetEntity.EntityClass.entityClassName);
return false;
}
var ray = new Ray(headPosition, direction);
ray.origin += direction.normalized * 0.2f;
if (Voxel.Raycast(sourceEntity.world, ray, seeDistance, true, true)) // Original code
{
if (canLog)
//Log.Out("RebirthUtilities-CanShoot 1");
if (GameUtils.IsBlockOrTerrain(Voxel.voxelRayHitInfo.tag))
{
if (canLog)
Log.Out("RebirthUtilities-CanShoot 2: " + Voxel.voxelRayHitInfo.tag + " / target: \" + targetEntity.EntityClass.entityClassName);");
string blockName = Voxel.voxelRayHitInfo.hit.blockValue.Block.GetBlockName();
if (blockName.Contains("bars") || blockName.Contains("securityGatePlate"))
{
if (canLog)
Log.Out("RebirthUtilities-CanShoot CAN SHOOT THROUGH BARS, blockName: " + blockName + " / target: \" + targetEntity.EntityClass.entityClassName);");
return true;
}
else
{
if (canLog)
Log.Out("RebirthUtilities-CanShoot CAN;t SHOOT THROUGH BLOCK / target: " + targetEntity.EntityClass.entityClassName);
return false;
}
}
if (canLog)
Log.Out("RebirthUtilities-CanShoot CAN SHOOT / target: " + targetEntity.EntityClass.entityClassName);
return true;
}
if (canLog)
Log.Out("RebirthUtilities-CanShoot END / target: " + targetEntity.EntityClass.entityClassName);
return false;
}
public static void SetAnimatorBool(EntityAlive entity, string property, bool value)
{
if (entity.emodel != null && entity.emodel.avatarController != null)
{
entity.emodel.avatarController.UpdateBool(property, value, true);
}
}
public static IEnumerator reloadNPCWeapon(EntityAlive entity)
{
//Log.Out("RebirthUtilities-reloadNPCWeapon START");
yield return new WaitForSeconds(5f);
RebirthUtilities.SetAnimatorBool(entity, "Reload", false);
//Log.Out("RebirthUtilities-reloadNPCWeapon 1");
entity.Buffs.SetCustomVar("$reloading", 0f);
yield break;
}
public static void LoadParticleAsset(string assetPath)
{
bool isAvailable = ParticleEffect.IsAvailable(assetPath);
if (!isAvailable)
{
ParticleEffect.LoadAsset(assetPath);
}
}
public static void DumpVehicleDown(EntityPlayer primaryPlayer, bool sendToServer = false)
{
//Log.Out("RebirthUtilities-DumpVehicleDown NOT isClient");
if (primaryPlayer != null)
{
//Log.Out("RebirthUtilities-DumpVehicleDown primaryPlayer EXISTS");
World _world = GameManager.Instance.World;
int minMax = 50;
bool addedItems = false;
List<Entity> entitiesInBounds = _world.GetEntitiesInBounds(typeof(global::EntityVehicleRebirth), BoundsUtils.BoundsForMinMax(primaryPlayer.position.x - minMax, primaryPlayer.position.y - 50, primaryPlayer.position.z - minMax, primaryPlayer.position.x + minMax, primaryPlayer.position.y + 30, primaryPlayer.position.z + minMax), new List<Entity>());
//Log.Out("RebirthUtilities-DumpVehicleDown entitiesInBounds.Count: " + entitiesInBounds.Count);
if (entitiesInBounds.Count > 0)
{
bool[] lockedSlots = primaryPlayer.bag.LockedSlots;
for (int x = 0; x < entitiesInBounds.Count; x++)
{
global::EntityVehicleRebirth entityVehicle = (global::EntityVehicleRebirth)entitiesInBounds[x];
if (entityVehicle != null)
{
//Log.Out("RebirthUtilities-DumpVehicleDown VEHICLE: " + entityVehicle.EntityClass.entityClassName);
PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(entityVehicle.GetOwner());
if (playerData.EntityId == primaryPlayer.entityId)
{
ItemStack[] slots = primaryPlayer.bag.GetSlots();
for (int i = 0; i < slots.Length; i++)
{
ItemStack itemStack = slots[i];
bool skipSlot = false;
if (lockedSlots != null)
{
skipSlot = lockedSlots[i];
}
if (!itemStack.IsEmpty() && !skipSlot)
{
//Log.Out("RebirthUtilities-DumpVehicleDown GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-DumpVehicleDown itemStack.count: " + itemStack.count);
string itemName = itemStack.itemValue.ItemClass.GetItemName().ToLower();
if (itemName != "questwhiteriversupplies" &&
itemName != "questcassadoresupplies"
)
{
if (entityVehicle.bag.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-DumpVehicleDown HAS ITEM");
ValueTuple<bool, bool> tryStack = entityVehicle.bag.TryStackItem(0, itemStack);
bool item = tryStack.Item1;
bool item2 = tryStack.Item2;
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-DumpVehicleDown COULD NOT STACK");
bool tryAdd = entityVehicle.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpVehicleDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
else
{
if (tryStack.Item2)
{
//Log.Out("RebirthUtilities-DumpVehicleDown COULD STACK ALL");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
else
{
//Log.Out("RebirthUtilities-DumpVehicleDown COULD STACK PARTIAL, itemStack.count: " + itemStack.count);
primaryPlayer.bag.SetSlot(i, itemStack.Clone());
addedItems = true;
bool tryAdd = entityVehicle.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpVehicleDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
else
{
//Log.Out("RebirthUtilities-DumpVehicleDown DOES NOT HAVE ITEM");
bool tryAdd = entityVehicle.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpVehicleDown tryAdd: " + tryAdd);
if (tryAdd)
{
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
}
ItemStack[] slotsVehicle = entityVehicle.bag.GetSlots();
//for (int n = 0; n < slotsVehicle.Length; n++)
//{
//if (!slotsVehicle[n].IsEmpty())
//{
//Log.Out("RebirthUtilities-DumpVehicleDown B Bag [" + n + "]: " + slotsVehicle[n].itemValue.ItemClass.GetItemName());
//}
//}
if (sendToServer)
{
//Log.Out("RebirthUtilities-DumpVehicleDown SENT BAG CONTENT TO SERVER");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageVehicleUpdateBag>().Setup(entityVehicle.entityId, slotsVehicle));
}
break;
}
}
}
}
}
}
public static void DumpVehicleUp(EntityPlayer primaryPlayer, bool sendToServer = false)
{
//Log.Out("RebirthUtilities-DumpVehicleUp NOT isClient");
if (primaryPlayer != null)
{
//Log.Out("RebirthUtilities-DumpVehicleUp primaryPlayer EXISTS");
World _world = GameManager.Instance.World;
int minMax = 50;
bool addedItems = false;
List<Entity> entitiesInBounds = _world.GetEntitiesInBounds(typeof(global::EntityVehicleRebirth), BoundsUtils.BoundsForMinMax(primaryPlayer.position.x - minMax, primaryPlayer.position.y - 50, primaryPlayer.position.z - minMax, primaryPlayer.position.x + minMax, primaryPlayer.position.y + 30, primaryPlayer.position.z + minMax), new List<Entity>());
//Log.Out("RebirthUtilities-DumpVehicleUp entitiesInBounds.Count: " + entitiesInBounds.Count);
if (entitiesInBounds.Count > 0)
{
for (int x = 0; x < entitiesInBounds.Count; x++)
{
global::EntityVehicleRebirth entityVehicle = (global::EntityVehicleRebirth)entitiesInBounds[x];
if (entityVehicle != null)
{
//Log.Out("RebirthUtilities-DumpVehicleUp VEHICLE: " + entityVehicle.EntityClass.entityClassName);
PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(entityVehicle.GetOwner());
if (playerData.EntityId == primaryPlayer.entityId)
{
ItemStack[] slots = entityVehicle.bag.GetSlots();
for (int i = 0; i < slots.Length; i++)
{
ItemStack itemStack = slots[i];
if (!itemStack.IsEmpty())
{
//Log.Out("RebirthUtilities-DumpVehicleUp GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-DumpVehicleUp itemStack.count: " + itemStack.count);
if (primaryPlayer.bag.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-DumpVehicleUp HAS ITEM");
ValueTuple<bool, bool> tryStack = primaryPlayer.bag.TryStackItem(0, itemStack);
bool item = tryStack.Item1;
bool item2 = tryStack.Item2;
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-DumpVehicleUp COULD NOT STACK");
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpVehicleUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityVehicle.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
else
{
if (tryStack.Item2)
{
//Log.Out("RebirthUtilities-DumpVehicleUp COULD STACK ALL");
entityVehicle.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
else
{
//Log.Out("RebirthUtilities-DumpVehicleUp COULD STACK PARTIAL, itemStack.count: " + itemStack.count);
entityVehicle.bag.SetSlot(i, itemStack.Clone());
addedItems = true;
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpVehicleUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityVehicle.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
else
{
//Log.Out("RebirthUtilities-DumpVehicleUp DOES NOT HAVE ITEM");
bool tryAdd = primaryPlayer.bag.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpVehicleUp tryAdd: " + tryAdd);
if (tryAdd)
{
entityVehicle.bag.SetSlot(i, ItemStack.Empty.Clone());
addedItems = true;
}
}
}
}
ItemStack[] slotsVehicle = entityVehicle.bag.GetSlots();
for (int n = 0; n < slotsVehicle.Length; n++)
{
if (!slotsVehicle[n].IsEmpty())
{
//Log.Out("RebirthUtilities-DumpVehicleUp B Bag [" + n + "]: " + slotsVehicle[n].itemValue.ItemClass.GetItemName());
}
}
if (sendToServer)
{
//Log.Out("RebirthUtilities-DumpVehicleUp SENT BAG CONTENT TO SERVER");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageVehicleUpdateBag>().Setup(entityVehicle.entityId, slotsVehicle));
}
}
}
}
}
}
}
public static void QuickStackOnClick(EntityPlayer primaryPlayer, bool mine, List<Vector3i> tileList = null)
{
//Log.Out("RebirthUtilities-QuickStackOnClick START");
if (primaryPlayer != null)
{
World _world = GameManager.Instance.World;
int distance = RebirthVariables.quickStackDistance;
List<TileEntity> tileEntities = RebirthUtilities.GetTileEntities(primaryPlayer, distance, true);
//Log.Out("RebirthUtilities-QuickStackOnClick fromServer: " + fromServer);
//Log.Out("RebirthUtilities-QuickStackOnClick tileEntities: " + tileEntities.Count);
foreach (var tileEntity in tileEntities)
{
if (tileEntity.TryGetSelfOrFeature(out ITileEntityLootable storage))
{
if (storage == null)
{
continue;
}
//Log.Out("RebirthUtilities-QuickStackOnClick A blockName: " + tileEntity.blockValue.Block.blockName);
bool isAccessed = false;
Vector3i tilePosition = tileEntity.ToWorldPos();
if (tileList != null && tileList.Count > 0)
{
for (int index = 0; index < tileList.Count; index++)
{
if (tileList[index].x == tilePosition.x &&
tileList[index].y == tilePosition.y &&
tileList[index].z == tilePosition.z
)
{
isAccessed = true;
}
}
}
//Log.Out("RebirthUtilities-QuickStackOnClick isAccessed: " + isAccessed);
//Log.Out("RebirthUtilities-QuickStackOnClick storage.IsUserAccessing(): " + storage.IsUserAccessing());
//Log.Out("RebirthUtilities-QuickStackOnClick storage.bTouched: " + storage.bTouched);
if (storage.IsUserAccessing() || !storage.bTouched || isAccessed)
{
//Log.Out("RebirthUtilities-QuickStackOnClick USER ACCESSING OR TOUCHED blockName: " + tileEntity.blockValue.Block.blockName);
continue;
}
bool canAccess = false;
if (mine)
{
//Log.Out("RebirthUtilities-QuickStackOnClick MINE blockName: " + tileEntity.blockValue.Block.blockName);
if (!tileEntity.TryGetSelfOrFeature(out ILockable lockable))
{
//Log.Out("RebirthUtilities-QuickStackOnClick NOT LOCKABLE");
continue;
}
PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(lockable.GetOwner());
//Log.Out("RebirthUtilities-QuickStackOnClick NOT LOCKABLE");
if (playerData != null && playerData.EntityId == primaryPlayer.entityId)
{
//Log.Out("RebirthUtilities-QuickStackOnClick MINE");
canAccess = true;
}
}
else
{
//Log.Out("RebirthUtilities-QuickStackOnClick NOT MINE blockName: " + tileEntity.blockValue.Block.blockName);
tileEntity.TryGetSelfOrFeature(out ILockable lockable);
if (lockable == null)
{
canAccess = true;
}
else
{
if (!lockable.IsLocked())
{
canAccess = true;
}
else
{
PlatformUserIdentifierAbs internalLocalUserIdentifier = PlatformManager.InternalLocalUserIdentifier;
if (lockable.IsUserAllowed(internalLocalUserIdentifier))
{
canAccess = true;
}
}
}
}
if (canAccess)
{
//Log.Out("RebirthUtilities-QuickStackOnClick CAN ACCESS storage: " + storage.blockValue.Block.blockName);
DumpItems(primaryPlayer, storage);
}
}
}
}
}
public static void DumpItems(EntityPlayer primaryPlayer, ITileEntityLootable storage)
{
bool[] lockedSlots = primaryPlayer.bag.LockedSlots;
ItemStack[] slots = primaryPlayer.bag.GetSlots();
//Log.Out("RebirthUtilities-DumpItems player bag slots: " + slots.Length);
if (lockedSlots != null)
{
//Log.Out("RebirthUtilities-DumpItems lockedSlots.Count: " + lockedSlots.Length);
}
for (int i = 0; i < slots.Length; i++)
{
//Log.Out("RebirthUtilities-DumpItems i: " + i);
ItemStack itemStack = slots[i];
bool skipSlot = false;
if (lockedSlots != null)
{
skipSlot = lockedSlots[i];
}
//Log.Out("RebirthUtilities-DumpItems skipSlot: " + skipSlot);
//Log.Out($"RebirthUtilities-DumpItems lockedSlots[{i}]: " + lockedSlots[i]);
//Log.Out("RebirthUtilities-DumpItems itemStack.IsEmpty(): " + itemStack.IsEmpty());
if (!itemStack.IsEmpty() && !skipSlot)
{
//Log.Out("RebirthUtilities-DumpItems GetItemName: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("RebirthUtilities-DumpItems itemStack.count: " + itemStack.count);
string itemName = itemStack.itemValue.ItemClass.GetItemName().ToLower();
bool hasItem = storage.HasItem(itemStack.itemValue);
//Log.Out("RebirthUtilities-DumpItems hasItem: " + hasItem);
if (hasItem)
{
//Log.Out("RebirthUtilities-DumpItems HAS ITEM");
ValueTuple<bool, bool> tryStack = storage.TryStackItem(0, itemStack);
bool item = tryStack.Item1;
bool item2 = tryStack.Item2;
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-DumpItems COULD NOT STACK");
bool tryAdd = storage.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpItems tryAdd: " + tryAdd);
if (tryAdd)
{
/*Log.Out("RebirthUtilities-DumpItems CLEARING SLOT A");
if (fromServer)
{
Log.Out("RebirthUtilities-DumpItems CLEARING SLOT A1");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
ClearBagSlot(primaryPlayer.entityId, i);
}
else
{*/
//Log.Out("RebirthUtilities-DumpItems CLEARING SLOT A2");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
//}
}
}
else
{
if (tryStack.Item2)
{
//Log.Out("RebirthUtilities-DumpItems COULD STACK ALL");
//Log.Out("RebirthUtilities-DumpItems CLEARING SLOT B");
/*if (fromServer)
{
Log.Out("RebirthUtilities-DumpItems CLEARING SLOT B1");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
ClearBagSlot(primaryPlayer.entityId, i);
}
else
{*/
//Log.Out("RebirthUtilities-DumpItems CLEARING SLOT B2");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
//}
}
else
{
//Log.Out("RebirthUtilities-DumpItems COULD STACK PARTIAL, itemStack.count: " + itemStack.count);
primaryPlayer.bag.SetSlot(i, itemStack.Clone());
bool tryAdd = storage.AddItem(itemStack);
//Log.Out("RebirthUtilities-DumpItems tryAdd: " + tryAdd);
if (tryAdd)
{
//Log.Out("RebirthUtilities-DumpItems CLEARING SLOT C");
/*if (fromServer)
{
Log.Out("RebirthUtilities-DumpItems CLEARING SLOT C1");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
ClearBagSlot(primaryPlayer.entityId, i);
}
else
{*/
//Log.Out("RebirthUtilities-DumpItems CLEARING SLOT C2");
primaryPlayer.bag.SetSlot(i, ItemStack.Empty.Clone());
//}
}
}
}
storage.SetModified();
}
}
}
}
/*public static void ClearBagSlot(int entityId, int slot)
{
Log.Out("RebirthUtilities-ClearBagSlot START");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageClearBagSlot>().Setup(entityId, slot), false, entityId);
}*/
public static bool IsQuesting(EntityPlayer player)
{
//Log.Out("RebirthUtilities-IsQuesting player.QuestJournal.quests.Count: " + player.QuestJournal.quests.Count);
if (player.QuestJournal.ActiveQuest != null) // Works for Fetch/Clear, not Burried Supplies
{
Quest activeQuest = player.QuestJournal.ActiveQuest;
//Log.Out("RebirthUtilities-IsQuesting activeQuest.Active: " + activeQuest.Active);
if (activeQuest != null && activeQuest.GetPOIName() != "")
{
//Log.Out("RebirthUtilities-IsQuesting 1");
return true;
}
}
else
{
foreach (Quest quest in player.QuestJournal.quests)
{
if (quest.Active && quest.RallyMarkerActivated && quest.QuestClass.Properties.Values.ContainsKey("IsQuestType"))
{
//Log.Out("RebirthUtilities-IsQuesting quest.RallyMarkerActivated: " + quest.RallyMarkerActivated);
return true;
}
//Log.Out("RebirthUtilities-IsQuesting quest.Active: " + quest.Active);
//Log.Out("RebirthUtilities-IsQuesting quest.CurrentState: " + quest.CurrentState);
//Log.Out("RebirthUtilities-IsQuesting quest.CurrentPhase: " + quest.CurrentPhase);
//Log.Out("RebirthUtilities-IsQuesting quest.GetPOIName: " + quest.GetPOIName());
//Log.Out("RebirthUtilities-IsQuesting IsQuestType: " + quest.QuestClass.Properties.Values.ContainsKey("IsQuestType"));
}
}
return false;
}
public static bool IsQuestingInPOI(EntityPlayerLocal player)
{
//Log.Out("RebirthUtilities-IsQuestingInPOI START");
if (player.QuestJournal.ActiveQuest != null)
{
//Log.Out("RebirthUtilities-IsQuestingInPOI 1");
Quest activeQuest = player.QuestJournal.ActiveQuest;
if (activeQuest != null)
{
string POIName = activeQuest.GetPOIName();
//Log.Out("RebirthUtilities-IsQuestingInPOI activeQuest.ID: " + activeQuest.ID);
//Log.Out("RebirthUtilities-IsQuestingInPOI activeQuest.QuestClass.Name: " + activeQuest.QuestClass.Name);
if (POIName != "")
{
//Log.Out("RebirthUtilities-IsQuestingInPOI activeQuest.GetPOIName(): " + activeQuest.GetPOIName());
return true;
}
}
}
return false;
}
public static IEnumerator LoadSpawningXML(XmlFile _xmlFile)
{
//Log.Out("RebirthUtilities-LoadSpawningXML START");
XElement root = _xmlFile.XmlDoc.Root;
if (!root.HasElements)
throw new Exception("No element <spawning> found!");
using (IEnumerator<XElement> enumerator = root.Elements((XName)"biome").GetEnumerator())
{
while (enumerator.MoveNext())
{
XElement current = enumerator.Current;
string attribute1 = current.GetAttribute((XName)"name");
if (attribute1.Length == 0)
throw new Exception("Attribute 'name' missing on biome tag");
BiomeSpawnEntityGroupList spawnEntityGroupList = new BiomeSpawnEntityGroupList();
BiomeSpawningClass.list[attribute1] = spawnEntityGroupList;
foreach (XElement element in current.Elements((XName)"spawn"))
{
string attribute2 = element.GetAttribute((XName)"id");
string entityGroup = element.GetAttribute("entitygroup");
int hashCode = attribute2.GetHashCode();
if (spawnEntityGroupList.Find(hashCode) != null)
throw new Exception("Duplicate id hash '" + attribute2 + "' in biome '" + attribute1 + "'");
int _maxCount = 1;
if (element.HasAttribute((XName)"maxcount"))
_maxCount = int.Parse(element.GetAttribute((XName)"maxcount"));
if (entityGroup.ToLower().StartsWith("zombies"))
{
string spawnNumOption = RebirthVariables.customNumZombieSpawns;
if (spawnNumOption == "none")
{
continue;
}
else if (spawnNumOption == "lowest")
{
_maxCount = _maxCount - 2;
if (_maxCount < 1)
{
_maxCount = 1;
}
}
else if (spawnNumOption == "lower")
{
_maxCount--;
if (_maxCount < 1)
{
_maxCount = 1;
}
}
else if (spawnNumOption == "higher")
{
_maxCount++;
}
else if (spawnNumOption == "highest")
{
_maxCount = _maxCount + 2;
}
else if (spawnNumOption == "random")
{
int floor = _maxCount - 2;
if (floor < 1)
{
floor = 1;
}
int ceiling = _maxCount + 2;
GameRandom gameRandom = GameManager.Instance.World.GetGameRandom();
_maxCount = gameRandom.RandomRange(floor, ceiling + 1);
//maxCount = Manager.random.RandomRange(floor, ceiling + 1);
}
else if (spawnNumOption.Contains("gradual"))
{
int currentDay = 1;
if (GameManager.Instance.gameStateManager.IsGameStarted())
{
currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
}
int dayDivisor = 14;
if (spawnNumOption.Contains("slower"))
{
dayDivisor = dayDivisor * 2;
}
else if (spawnNumOption.Contains("faster"))
{
dayDivisor = dayDivisor / 2;
}
int floor = _maxCount - 2;
if (floor < 1)
{
floor = 1;
}
int ceiling = _maxCount + 2;
_maxCount = floor + (int)(currentDay / dayDivisor);
if (_maxCount > ceiling)
{
_maxCount = ceiling;
}
}
}
int _respawndelay = 0;
if (element.HasAttribute((XName)"respawndelay"))
_respawndelay = (int)((double)StringParsers.ParseFloat(element.GetAttribute((XName)"respawndelay")) * 24000.0);
if (entityGroup.ToLower().StartsWith("zombies"))
{
//Log.Out($"RESPAWN DELAY BEFORE ({entityGroup}): {_respawndelay}");
string spawnMultiplierOption = RebirthVariables.customFreqZombieSpawns;
float multiplier = 1f;
if (spawnMultiplierOption == "slowest")
{
multiplier = 4f;
}
else if (spawnMultiplierOption == "slow")
{
multiplier = 2f;
}
else if (spawnMultiplierOption == "fast")
{
multiplier = 0.8f;
}
else if (spawnMultiplierOption == "faster")
{
multiplier = 0.6f;
}
else if (spawnMultiplierOption == "fastest")
{
multiplier = 0.4f;
}
else if (spawnMultiplierOption == "relentless")
{
multiplier = 0.2f;
}
else if (spawnMultiplierOption == "gradualslower")
{
int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
if (currentDay <= 14)
{
multiplier = 4f;
}
else if (currentDay > 15 && currentDay <= 28)
{
multiplier = 2f;
}
else if (currentDay > 29 && currentDay <= 49)
{
multiplier = 1f;
}
else if (currentDay > 50 && currentDay <= 70)
{
multiplier = 0.8f;
}
else if (currentDay > 71)
{
multiplier = 0.6f;
}
}
else if (spawnMultiplierOption == "gradual")
{
int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
if (currentDay <= 7)
{
multiplier = 4f;
}
else if (currentDay > 7 && currentDay <= 14)
{
multiplier = 2f;
}
else if (currentDay > 15 && currentDay <= 28)
{
multiplier = 1f;
}
else if (currentDay > 29 && currentDay <= 42)
{
multiplier = 0.8f;
}
else if (currentDay > 43)
{
multiplier = 0.6f;
}
}
else if (spawnMultiplierOption == "gradualfaster")
{
int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
if (currentDay <= 7)
{
multiplier = 4f;
}
else if (currentDay > 8 && currentDay <= 14)
{
multiplier = 2f;
}
else if (currentDay > 15 && currentDay <= 21)
{
multiplier = 1f;
}
else if (currentDay > 22 && currentDay <= 28)
{
multiplier = 0.8f;
}
else if (currentDay > 29)
{
multiplier = 0.6f;
}
}
/*bool optionFeelingLucky = RebirthVariables.customFeelingLucky;
if (GameManager.Instance.World.IsDaytime())
{
optionFeelingLucky = false;
}
if (optionFeelingLucky)
{
if (multiplier < 1f)
{
multiplier = multiplier * 0.9f;
}
else
{
multiplier = multiplier * 0.8f;
}
}*/
_respawndelay = (int)(_respawndelay * multiplier);
//Log.Out($"MULTIPLIER: {multiplier}");
//Log.Out($"RESPAWN DELAY AFTER ({entityGroup}): {_respawndelay}");
}
EDaytime _daytime = EDaytime.Any;
if (element.HasAttribute((XName)"time"))
_daytime = EnumUtils.Parse<EDaytime>(element.GetAttribute((XName)"time"));
BiomeSpawnEntityGroupData spawnEntityGroupData = new BiomeSpawnEntityGroupData(hashCode, _maxCount, _respawndelay, _daytime);
string attribute3 = element.GetAttribute((XName)"tags");
if (attribute3.Length > 0)
spawnEntityGroupData.POITags = FastTags<TagGroup.Poi>.Parse(attribute3);
string attribute4 = element.GetAttribute((XName)"notags");
if (attribute4.Length > 0)
spawnEntityGroupData.noPOITags = FastTags<TagGroup.Poi>.Parse(attribute4);
string attribute5 = element.GetAttribute((XName)"entitygroup");
if (attribute5.Length == 0)
throw new Exception("Missing attribute 'entitygroup' in entitygroup of biome '" + attribute1 + "'");
spawnEntityGroupData.entityGroupName = EntityGroups.list.ContainsKey(attribute5) ? attribute5 : throw new Exception("Entity group '" + attribute5 + "' not existing!");
spawnEntityGroupList.list.Add(spawnEntityGroupData);
}
}
yield break;
}
/*XElement root = _xmlFile.XmlDoc.Root;
if (!root.HasElements)
{
throw new Exception("No element <spawning> found!");
}
using (IEnumerator<XElement> enumerator = root.Elements("biome").GetEnumerator())
{
while (enumerator.MoveNext())
{
XElement xelement = enumerator.Current;
if (!xelement.HasAttribute("name"))
{
throw new Exception("Attribute 'name' missing on biome tag");
}
string attribute = xelement.GetAttribute("name");
BiomeSpawnEntityGroupList biomeSpawnEntityGroupList = new BiomeSpawnEntityGroupList();
foreach (XElement element in xelement.Elements("spawn"))
{
if (!element.HasAttribute("entitygroup"))
{
throw new Exception("Missing attribute 'entitygroup' in entitygroup of biome '" + attribute + "'");
}
string entityGroup = element.GetAttribute("entitygroup");
int maxCount = 1;
if (element.HasAttribute("maxcount"))
{
maxCount = int.Parse(element.GetAttribute("maxcount"));
}
if (entityGroup.ToLower().StartsWith("zombies"))
{
string spawnNumOption = RebirthVariables.customNumZombieSpawns;
if (spawnNumOption == "none")
{
continue;
}
else if (spawnNumOption == "lowest")
{
maxCount = maxCount - 2;
if (maxCount < 1)
{
maxCount = 1;
}
}
else if (spawnNumOption == "lower")
{
maxCount--;
if (maxCount < 1)
{
maxCount = 1;
}
}
else if (spawnNumOption == "higher")
{
maxCount++;
}
else if (spawnNumOption == "highest")
{
maxCount = maxCount + 2;
}
else if (spawnNumOption == "random")
{
int floor = maxCount - 2;
if (floor < 1)
{
floor = 1;
}
int ceiling = maxCount + 2;
GameRandom gameRandom = GameManager.Instance.World.GetGameRandom();
maxCount = gameRandom.RandomRange(floor, ceiling + 1);
//maxCount = Manager.random.RandomRange(floor, ceiling + 1);
}
else if (spawnNumOption.Contains("gradual"))
{
int currentDay = 1;
if (GameManager.Instance.gameStateManager.IsGameStarted())
{
currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
}
int dayDivisor = 14;
if (spawnNumOption.Contains("slower"))
{
dayDivisor = dayDivisor * 2;
}
else if (spawnNumOption.Contains("faster"))
{
dayDivisor = dayDivisor / 2;
}
int floor = maxCount - 2;
if (floor < 1)
{
floor = 1;
}
int ceiling = maxCount + 2;
maxCount = floor + (int)(currentDay / dayDivisor);
if (maxCount > ceiling)
{
maxCount = ceiling;
}
}
}
int respawndelay = 0;
if (element.HasAttribute("respawndelay"))
{
respawndelay = (int)(StringParsers.ParseFloat(element.GetAttribute("respawndelay"), 0, -1, NumberStyles.Any) * 24000f);
}
float spawnDeadChance = 0f;
if (element.HasAttribute("spawnDeadChance"))
{
spawnDeadChance = StringParsers.ParseFloat(element.GetAttribute("spawnDeadChance"), 0, -1, NumberStyles.Any);
}
EDaytime daytime = EDaytime.Any;
if (element.HasAttribute("time"))
{
daytime = EnumUtils.Parse<EDaytime>(element.GetAttribute("time"), false);
}
BiomeSpawnEntityGroupData biomeSpawnEntityGroupData = new BiomeSpawnEntityGroupData(maxCount, respawndelay, spawnDeadChance, daytime);
string attribute2 = element.GetAttribute("tags");
if (attribute2.Length > 0)
{
biomeSpawnEntityGroupData.POITags = FastTags<TagGroup.Poi>.Parse(attribute2);
}
attribute2 = element.GetAttribute("notags");
if (attribute2.Length > 0)
{
biomeSpawnEntityGroupData.noPOITags = FastTags<TagGroup.Poi>.Parse(attribute2);
}
biomeSpawnEntityGroupList.list.Add(biomeSpawnEntityGroupData);
biomeSpawnEntityGroupData.entityGroupRefName = entityGroup;
if (!EntityGroups.list.ContainsKey(biomeSpawnEntityGroupData.entityGroupRefName))
{
throw new Exception("Entity group '" + biomeSpawnEntityGroupData.entityGroupRefName + "' not existing!");
}
BiomeSpawningClass.list[attribute] = biomeSpawnEntityGroupList;
}
}
yield break;
}*/
yield break;
}
public static void SpawnScreamer(Vector3 targetPos, int numMaxScreamers = 0)
{
Bounds bb = new Bounds(targetPos, new Vector3(50f, 50f, 50f));
List<Entity> entitiesInBounds = new List<Entity>();
GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityZombieScreamerRebirth), bb, entitiesInBounds);
//Log.Out("RebirthUtilities-SpawnScreamer entitiesInBounds.Count: " + entitiesInBounds.Count);
if (numMaxScreamers == 0)
{
numMaxScreamers = 4 + (GameStats.GetInt(EnumGameStats.GameDifficulty) * 2);
}
//Log.Out("RebirthUtilities-SpawnScreamer numMaxScreamers: " + numMaxScreamers);
if (entitiesInBounds.Count < numMaxScreamers)
{
if (targetPos != null)
{
//Log.Out("RebirthUtilities-SpawnScreamer targetPos: " + targetPos);
try
{
GameManager.Instance.World.aiDirector.GetComponent<AIDirectorChunkEventComponent>().SpawnScouts(targetPos);
}
catch
{
//Log.Out("RebirthUtilities-SpawnScreamer ERROR SPAWNING SCREAMER");
}
}
}
}
public static SpawnPosition GetSpawnPoint(EntityPlayer player)
{
if (player.SpawnPoints == null || player.SpawnPoints.Count == 0)
{
return SpawnPosition.Undef;
}
return new SpawnPosition(player.SpawnPoints[0].ToVector3() + new Vector3(0.5f, 0f, 0.5f), 0f);
}
public static bool SendToClient(int playerID)
{
if (GameManager.IsDedicatedServer)
{
return true;
}
else
{
EntityPlayerLocal entityPlayerLocal = GameManager.Instance.World.GetPrimaryPlayer();
if (entityPlayerLocal != null)
{
if (entityPlayerLocal.entityId != playerID)
{
return true;
}
}
}
return false;
}
public static IEnumerator UpdateActiveClasses(EntityAlive ___entityPlayerLocal)
{
//Log.Out("RebirthUtilities-UpdateActiveClasses START");
float activeClassID = ___entityPlayerLocal.Buffs.GetCustomVar("$ActiveClass_FR");
foreach (var key in RebirthVariables.localClasses.Keys)
{
string perk = "furiousramsayatt" + key.ToLower();
//Log.Out("RebirthUtilities-UpdateActiveClasses perk: " + perk);
RebirthVariables.localClassMeta[key].isActive = false;
ProgressionValue progressionValue = ___entityPlayerLocal.Progression.GetProgressionValue(perk);
if (progressionValue != null)
{
//Log.Out("RebirthUtilities-UpdateActiveClasses PROGRESSION EXISTS, level: " + progressionValue.Level);
if (perk == "furiousramsayattberserker")
{
//Log.Out("RebirthUtilities-UpdateActiveClasses 1");
if (progressionValue.Level >= 10)
{
RebirthVariables.localClassMeta[key].isActive = true;
//Log.Out("RebirthUtilities-UpdateActiveClasses A " + key + ": " + RebirthVariables.localClassMeta[key].isActive);
}
}
else if (perk == "furiousramsayattwitchdoctor")
{
//Log.Out("RebirthUtilities-UpdateActiveClasses 2");
if (progressionValue.Level >= 8)
{
RebirthVariables.localClassMeta[key].isActive = true;
//Log.Out("RebirthUtilities-UpdateActiveClasses B " + key + ": " + RebirthVariables.localClassMeta[key].isActive);
}
}
else
{
//Log.Out("RebirthUtilities-UpdateActiveClasses 3");
if (progressionValue.Level >= 6)
{
RebirthVariables.localClassMeta[key].isActive = true;
//Log.Out("RebirthUtilities-UpdateActiveClasses C " + key + ": " + RebirthVariables.localClassMeta[key].isActive);
}
}
}
if (RebirthVariables.localClasses[key] == activeClassID)
{
RebirthVariables.localClassMeta[key].isActive = true;
//Log.Out("RebirthUtilities-UpdateActiveClasses ACTIVE " + key + ": " + RebirthVariables.localClassMeta[key].isActive);
}
}
yield break;
}
public static bool IsPrimaryClass(EntityAlive ___entityPlayer, float classID)
{
if (___entityPlayer == null)
{
//Log.Out("RebirthUtilities-IsClassActive 1");
return false;
}
float activeClassID = ___entityPlayer.Buffs.GetCustomVar("$ActiveClass_FR");
if (activeClassID == classID)
{
//Log.Out("RebirthUtilities-IsClassActive 2 activeClassID: " + activeClassID);
return true;
}
return false;
}
public static float ClassLevels(EntityAlive ___entityPlayer)
{
float totalLevels = 0;
ProgressionValue progressionValue = null;
foreach (var key in RebirthVariables.localClasses.Keys)
{
string perk = "furiousramsayatt" + key.ToLower();
progressionValue = ___entityPlayer.Progression.GetProgressionValue(perk);
if (progressionValue != null)
{
// Use floating-point calculation for precision
float level = (float)progressionValue.level;
if (level > 10)
{
level = 10;
}
float scaledLevel = (float)(Math.Pow(level / 10.0, 2) * 10.0);
//Log.Out("RebirthUtilities-ClassLevels perk: " + perk);
//Log.Out("RebirthUtilities-ClassLevels level: " + level);
//Log.Out("RebirthUtilities-ClassLevels scaledLevel: " + scaledLevel);
// Add scaled level to the total levels (no casting to int)
totalLevels += scaledLevel;
}
}
return totalLevels;
}
public static bool IsClassActive(EntityAlive ___entityPlayer, float classID)
{
bool result = false;
//Log.Out("RebirthUtilities-IsClassActive START");
if (___entityPlayer == null || RebirthUtilities.ScenarioSkip())
{
//Log.Out("RebirthUtilities-IsClassActive 1");
return false;
}
float activeClassID = ___entityPlayer.Buffs.GetCustomVar("$ActiveClass_FR");
if (activeClassID == classID)
{
//Log.Out("RebirthUtilities-IsClassActive 2 activeClassID: " + activeClassID);
return true;
}
ProgressionValue progressionValue = null;
foreach (var key in RebirthVariables.localClasses.Keys)
{
//Log.Out("RebirthUtilities-IsClassActive 3 key: " + key);
if (RebirthVariables.localClasses[key] == classID)
{
string perk = "furiousramsayatt" + key.ToLower();
//Log.Out("RebirthUtilities-IsClassActive perk: " + perk);
progressionValue = ___entityPlayer.Progression.GetProgressionValue(perk);
if (progressionValue != null)
{
//Log.Out("RebirthUtilities-IsClassActive 3");
if (perk == "furiousramsayattberserker")
{
if (progressionValue.Level >= 10)
{
result = true;
}
}
else if (perk == "furiousramsayattwitchdoctor")
{
if (progressionValue.Level >= 8)
{
result = true;
}
}
else
{
//Log.Out("RebirthUtilities-IsClassActive 4");
if (progressionValue.Level >= 6)
{
//Log.Out("RebirthUtilities-IsClassActive 5");
result = true;
}
}
}
else
{
//Log.Out("StackTrace: '{0}'", Environment.StackTrace);
Log.Out("RebirthUtilities-IsClassActive PROGRESSION [" + perk + "] == null");
}
}
}
return result;
}
public static bool IsClassActive(int classID, bool reverse = false)
{
//Log.Out("RebirthUtilities-IsClassActive START, classID: " + classID);
foreach (string classKey in RebirthVariables.localClasses.Keys)
{
if (RebirthVariables.localClasses[classKey] == classID)
{
//Log.Out("RebirthUtilities-IsClassActive FOUND CLASS, classKey: " + classKey);
foreach (string classMetaKey in RebirthVariables.localClassMeta.Keys)
{
//Log.Out("RebirthUtilities-IsClassActive classMetaKey: " + classMetaKey);
if (classMetaKey == classKey)
{
//Log.Out("RebirthUtilities-IsClassActive isActive: " + RebirthVariables.localClassMeta[classMetaKey].isActive);
if (RebirthVariables.localClassMeta[classMetaKey].isActive)
{
if (reverse)
{
return false;
}
else
{
return true;
}
}
}
}
}
}
if (reverse)
{
return true;
}
else
{
return false;
}
}
public static IEnumerator delayShotgunTrigger(float time)
{
RebirthVariables.canShotgunTrigger = false;
yield return new WaitForSeconds(time);
RebirthVariables.canShotgunTrigger = true;
yield break;
}
public static bool IsNaturalSelectionOn()
{
string optionNaturalSelectionOn = RebirthVariables.customNaturalSelection;
bool isHordeNight = RebirthUtilities.IsHordeNight();
////Log.Out("RebirthUtilities-IsNaturalSelectionOn optionNaturalSelectionOn: " + optionNaturalSelectionOn);
////Log.Out("RebirthUtilities-IsNaturalSelectionOn isHordeNight: " + isHordeNight);
bool flag = optionNaturalSelectionOn == "on";
bool flag2 = optionNaturalSelectionOn == "nohordenight" && !isHordeNight;
bool flag3 = optionNaturalSelectionOn == "nohordenightcount";
////Log.Out("RebirthUtilities-IsNaturalSelectionOn flag: " + flag);
////Log.Out("RebirthUtilities-IsNaturalSelectionOn flag2: " + flag2);
bool isNaturalSelectionOn = flag || flag2 || flag3;
return isNaturalSelectionOn;
}
public static bool IsNaturalSelectionCountingOn()
{
string optionNaturalSelectionOn = RebirthVariables.customNaturalSelection;
bool isHordeNight = RebirthUtilities.IsHordeNight();
bool flag = optionNaturalSelectionOn == "on";
bool flag2 = optionNaturalSelectionOn == "nohordenight" && !isHordeNight;
bool flag3 = optionNaturalSelectionOn == "nohordenightcount" && !isHordeNight;
bool isNaturalSelectionOn = flag || flag2 || flag3;
return isNaturalSelectionOn;
}
public static float GetDirectCraftingPerksCategoryValue(string perkName, float craftingValue)
{
float result = 0f;
////Log.Out("RebirthUtilities-GetDirectCraftingPerksCategoryValue perkName: " + perkName);
////Log.Out("RebirthUtilities-GetDirectCraftingPerksCategoryValue craftingValue: " + craftingValue);
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[perkName];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
////Log.Out("RebirthUtilities-GetDirectCraftingPerksCategoryValue craftingLevel.craftingLevel: " + craftingLevel.craftingLevel);
////Log.Out("RebirthUtilities-GetDirectCraftingPerksCategoryValue craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.craftingLevel == craftingValue)
{
////Log.Out("RebirthUtilities-GetDirectCraftingPerksCategoryValue craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
return craftingLevel.categoryLevel;
}
}
}
return result;
}
public static float GetExpertiseCategoryCeilingFromNetFloor(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
if (craftingLevel.categoryLevel < currentXP)
{
result = craftingLevel.categoryLevel;
}
if (craftingLevel.categoryLevel > currentXP)
{
gotResult = true;
break;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetGeneticsCategoryCeilingFromNetFloor(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localGeneticsCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
if (craftingLevel.categoryLevel < currentXP)
{
result = craftingLevel.categoryLevel;
}
if (craftingLevel.categoryLevel > currentXP)
{
gotResult = true;
break;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetOtherCategoryCeilingFromNetFloor(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
if (craftingLevel.categoryLevel < currentXP)
{
result = craftingLevel.categoryLevel;
}
if (craftingLevel.categoryLevel > currentXP)
{
gotResult = true;
break;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetCategoryFloor(string key)
{
float result = 0;
bool foundResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
result = craftingLevel.categoryLevel;
foundResult = true;
break;
}
if (foundResult)
{
break;
}
}
return result;
}
public static float GetCategoryFloorFromXP(string key, float currentXP)
{
float result = 0;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
if (craftingLevel.categoryLevel <= currentXP)
{
result = craftingLevel.categoryLevel;
break;
}
}
}
return result;
}
public static float GetCategoryCeilingFromXP(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
////Log.Out("RebirthUtilities-GetCategoryCeilingFromXP currentXP: " + currentXP);
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
////Log.Out("RebirthUtilities-GetCategoryCeilingFromXP craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.categoryLevel > (currentXP - 0.0001))
{
////Log.Out("RebirthUtilities-GetCategoryCeilingFromXP HIGHER");
result = craftingLevel.categoryLevel;
gotResult = true;
}
if (craftingLevel.categoryLevel == currentXP)
{
////Log.Out("RebirthUtilities-GetCategoryCeilingFromXP EQUAL");
result = craftingLevel.categoryLevel;
gotResult = true;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetOtherCategoryFloor(string key)
{
float result = 0;
bool foundResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
result = craftingLevel.categoryLevel;
foundResult = true;
break;
}
if (foundResult)
{
break;
}
}
return result;
}
public static float GetOtherCategoryFloorFromXP(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
//Log.Out("RebirthUtilities-GetOtherCategoryFloorFromXP currentXP: " + currentXP);
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetOtherCategoryFloorFromXP craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.categoryLevel <= currentXP)
{
//Log.Out("RebirthUtilities-GetOtherCategoryFloorFromXP LOWER, craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
result = craftingLevel.categoryLevel;
gotResult = true;
break;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetOtherCategoryCeilingFromXP(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
//Log.Out("RebirthUtilities-GetCategoryCeilingFromXP key: " + key);
//Log.Out("RebirthUtilities-GetCategoryCeilingFromXP currentXP: " + currentXP);
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetCategoryCeilingFromXP craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.categoryLevel > (currentXP - 0.0001))
{
//Log.Out("RebirthUtilities-GetCategoryCeilingFromXP HIGHER, craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
result = craftingLevel.categoryLevel;
gotResult = true;
}
if (craftingLevel.categoryLevel == currentXP)
{
//Log.Out("RebirthUtilities-GetCategoryCeilingFromXP EQUAL, craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
result = craftingLevel.categoryLevel;
gotResult = true;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetOtherCategoryPreviousFromXP(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
//Log.Out("RebirthUtilities-GetOtherCategoryPreviousFromXP currentXP: " + currentXP);
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetOtherCategoryPreviousFromXP craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.categoryLevel <= currentXP)
{
//Log.Out("RebirthUtilities-GetOtherCategoryPreviousFromXP LOWER, craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
result = craftingLevel.categoryLevel;
}
else
{
gotResult = true;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetOtherCategoryNextFromXP(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
//Log.Out("RebirthUtilities-GetOtherCategoryNextFromXP key: " + key);
//Log.Out("RebirthUtilities-GetOtherCategoryNextFromXP currentXP: " + currentXP);
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetOtherCategoryNextFromXP craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.categoryLevel > currentXP)
{
//Log.Out("RebirthUtilities-GetOtherCategoryNextFromXP HIGHER, craftingLevel.categoryLevel [" + craftingLevel.categoryLevel + "] > currentXP [" + (currentXP - 0.0001) + "]");
result = craftingLevel.categoryLevel;
gotResult = true;
break;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetExpertiseCategoryPreviousFromXP(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
//Log.Out("RebirthUtilities-GetExpertiseCategoryPreviousFromXP currentXP: " + currentXP);
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetExpertiseCategoryPreviousFromXP craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.categoryLevel <= currentXP)
{
//Log.Out("RebirthUtilities-GetExpertiseCategoryPreviousFromXP LOWER, craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
result = craftingLevel.categoryLevel;
}
else
{
gotResult = true;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static float GetExpertiseCategoryNextFromXP(string key, float currentXP)
{
float result = 0;
bool gotResult = false;
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
//Log.Out("RebirthUtilities-GetExpertiseCategoryNextFromXP key: " + key);
//Log.Out("RebirthUtilities-GetExpertiseCategoryNextFromXP currentXP: " + currentXP);
foreach (var craftingList in CategoryCraftingList)
{
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (var craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetExpertiseCategoryNextFromXP craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
if (craftingLevel.categoryLevel > currentXP)
{
//Log.Out("RebirthUtilities-GetExpertiseCategoryNextFromXP HIGHER, craftingLevel.categoryLevel [" + craftingLevel.categoryLevel + "] > currentXP [" + (currentXP - 0.0001) + "]");
result = craftingLevel.categoryLevel;
gotResult = true;
break;
}
}
if (gotResult)
{
break;
}
}
return result;
}
public static int DecBagItem(ItemValue _itemValue, int _count, EntityPlayer player, bool ignoreLockedSlots = false)
{
int num = _count;
bool[] lockedSlots = player.bag.LockedSlots;
ItemStack[] slots = player.bag.GetSlots();
int num2 = 0;
//Log.Out("RebirthUtilities-DecBagItem START");
////Log.Out("RebirthUtilities-DecBagItem _count: " + _count);
////Log.Out("RebirthUtilities-DecBagItem num2: " + num2);
////Log.Out("RebirthUtilities-DecBagItem player.bag.GetSlots().Length: " + player.bag.GetSlots().Length);
for (int i = 0; i < slots.Length; i++)
{
////Log.Out("RebirthUtilities-DecBagItem num2: " + num2);
bool skipSlot = false;
if (lockedSlots != null)
{
skipSlot = !ignoreLockedSlots && lockedSlots[i];
}
if (slots[num2].itemValue.type == _itemValue.type && !skipSlot)
{
////Log.Out("RebirthUtilities-DecBagItem Found: " + _itemValue.ItemClass.GetItemName());
if (ItemClass.GetForId(slots[num2].itemValue.type).CanStack())
{
////Log.Out("RebirthUtilities-DecBagItem CAN STACK");
int count = slots[num2].count;
int num3 = (count >= _count) ? _count : count;
slots[num2].count -= num3;
_count -= num3;
if (slots[num2].count <= 0)
{
slots[num2].Clear();
}
}
else
{
////Log.Out("RebirthUtilities-DecBagItem CANNOT STACK");
slots[num2].Clear();
_count--;
}
}
num2++;
}
player.bag.SetSlots(slots);
return num - _count;
}
public static int GetNonProtectedBagItemCount(ItemValue _itemValue, EntityPlayer player)
{
bool[] lockedSlots = player.bag.LockedSlots;
ItemStack[] slots = player.bag.GetSlots();
int num = 0;
for (int i = 0; i < slots.Length; i++)
{
////Log.Out("RebirthUtilities-GetNonProtectedBagItemCount i: " + i);
bool skipSlot = false;
if (lockedSlots != null)
{
skipSlot = lockedSlots[i];
}
if (slots[i].itemValue.type == _itemValue.type && !skipSlot)
{
////Log.Out("RebirthUtilities-GetNonProtectedBagItemCount FOUND");
num += slots[i].count;
}
}
return num;
}
public static IEnumerator SpawnVehicleFromItemCoroutine(string className, Vector3 vehiclePosition, Vector3 vehicleRotation, ItemValue itemValue, int entityThatPlacedIt, bool isLocal)
{
EntityVehicleRebirth entityVehicle = EntityFactory.CreateEntity(EntityClass.FromString(className), vehiclePosition + Vector3.up * 0.25f, vehicleRotation) as EntityVehicleRebirth;
ItemValue[] itemValues = { ItemValue.None };
entityVehicle.itemValues = itemValues;
entityVehicle.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
////Log.Out("RebirthUtilities-SpawnVehicleFromItemCoroutine itemValue.UseTimes" + itemValue.UseTimes);
entityVehicle.GetVehicle().SetItemValue(itemValue);
if (!isLocal)
{
if (GameManager.Instance.World.GetEntity(entityThatPlacedIt) as EntityPlayer != null)
{
entityVehicle.Spawned = true;
ClientInfo clientInfo = SingletonMonoBehaviour<ConnectionManager>.Instance.Clients.ForEntityId(entityThatPlacedIt);
entityVehicle.SetOwner(clientInfo.InternalId);
}
}
else
{
entityVehicle.SetOwner(PlatformManager.InternalLocalUserIdentifier);
}
GameManager.Instance.World.SpawnEntityInWorld(entityVehicle);
yield break;
}
public static IEnumerator SpawnVehicleCoroutine(Vector3i blockPos, ItemValue[] itemValues, float bodyDurability, float gasPerc, float oilPerc, float durability, float maxBodyDurability, int rotation, string className, int ownerID)
{
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine START");
Chunk chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(blockPos);
GameManager.Instance.World.SetBlockRPC(chunk.ClrIdx, blockPos, BlockValue.Air);
yield return new WaitForSeconds(0.5f);
//Log.Out("className: " + className);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine durability: " + durability);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine bodyDurability: " + bodyDurability);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine maxBodyDurability: " + maxBodyDurability);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine itemValues.Length: " + itemValues.Length);
int i = 0;
foreach (ItemValue itemValue in itemValues)
{
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine i: " + i);
if (!(itemValue == null || itemValue == ItemValue.None || itemValue.ItemClass == null))
{
float currentItemUseTimes = itemValue.UseTimes;
string currentItemName = itemValue.ItemClass.GetItemName();
int itemQuality = itemValue.Quality;
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine currentItemName: " + currentItemName);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine currentItemUseTimes: " + currentItemUseTimes);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine itemQuality: " + itemQuality);
}
i++;
}
EntityVehicleRebirth entityVehicle = EntityFactory.CreateEntity(EntityClass.FromString(className), new Vector3(blockPos.x, blockPos.y + 0.25f, blockPos.z), new Vector3(0f, rotation, 0f)) as EntityVehicleRebirth;
entityVehicle.itemValues = itemValues;
entityVehicle.Health = Mathf.RoundToInt(durability);
entityVehicle.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
entityVehicle.vehicle.SetFuelLevel(gasPerc * entityVehicle.vehicle.GetMaxFuelLevel());
entityVehicle.OilPerc = oilPerc;
entityVehicle.bodyDurability = bodyDurability;
entityVehicle.baseBodyDurability = bodyDurability;
entityVehicle.maxBodyDurability = maxBodyDurability;
entityVehicle.Stats.Health.BaseMax = Mathf.RoundToInt(durability);
entityVehicle.Stats.Health.OriginalMax = Mathf.RoundToInt(durability);
entityVehicle.Health = Mathf.RoundToInt(durability);
PersistentPlayerList persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
if (((persistentPlayerList != null) ? persistentPlayerList.Players : null) != null)
{
foreach (KeyValuePair<PlatformUserIdentifierAbs, PersistentPlayerData> keyValuePair in persistentPlayerList.Players)
{
if (keyValuePair.Value.EntityId == ownerID)
{
////Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine FOUND OWNER");
entityVehicle.SetOwner(keyValuePair.Key);
break;
}
}
}
GameManager.Instance.World.SpawnEntityInWorld(entityVehicle);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
i = 0;
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine entityVehicle.itemValues.Length: " + entityVehicle.itemValues.Length);
foreach (ItemValue itemValue in entityVehicle.itemValues)
{
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine i: " + i);
if (!(itemValue == null || itemValue == ItemValue.None || itemValue.ItemClass == null))
{
int playerID = ownerID;
int currentVehicleID = entityVehicle.entityId;
float currentItemUseTimes = itemValue.UseTimes;
string currentItemName = itemValue.ItemClass.GetItemName();
int itemQuality = itemValue.Quality;
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine playerID: " + playerID);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine currentVehicleID: " + currentVehicleID);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine currentItemName: " + currentItemName);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine currentItemUseTimes: " + currentItemUseTimes);
//Log.Out("XUiC_RepairableVehicleWindow-SpawnVehicleCoroutine itemQuality: " + itemQuality);
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageVehicleUpdatePartRebirth>().Setup(playerID, currentVehicleID, i, currentItemUseTimes, itemQuality, currentItemName), false, -1, -1, -1, null, 192);
}
i++;
}
}
yield break;
}
public static int GetQualityFromLootstage(EntityPlayerLocal player)
{
int lootStage = player.GetHighestPartyLootStage(0f, 0f);
int maxQuality = 1;
if (lootStage > 0 && lootStage <= 15)
{
maxQuality = 1;
}
else if (lootStage > 15 && lootStage <= 45)
{
maxQuality = 2;
}
else if (lootStage > 45 && lootStage <= 85)
{
maxQuality = 3;
}
else if (lootStage > 85 && lootStage <= 135)
{
maxQuality = 4;
}
else if (lootStage > 135 && lootStage <= 185)
{
maxQuality = 5;
}
else
{
maxQuality = 6;
}
System.Random rnd = new System.Random();
int randomInt = rnd.Next(1, maxQuality + 1);
//int randomInt = ___random.RandomRange(1, maxQuality);
return randomInt;
}
public static float GetVehiclePartChance(RepairableVehicleSlotsEnum slot)
{
float chance = 0f;
foreach (RepairableVehicleSlotsEnum key in RebirthVariables.localVehicleParts.Keys)
{
if (key == slot)
{
chance = RebirthVariables.localVehicleParts[key].chance;
////Log.Out("RebirthUtilities-GetVehiclePartChance slot: " + slot);
////Log.Out("RebirthUtilities-GetVehiclePartChance chance: " + chance);
break;
}
}
return chance;
}
public static int GetVehiclePartQuality(RepairableVehicleSlotsEnum slot)
{
int quality = 1;
foreach (RepairableVehicleSlotsEnum key in RebirthVariables.localVehicleParts.Keys)
{
if (key == slot)
{
quality = RebirthVariables.localVehicleParts[key].maxRandomQuality;
////Log.Out("RebirthUtilities-GetVehiclePartChance slot: " + slot);
////Log.Out("RebirthUtilities-GetVehiclePartChance quality: " + quality);
break;
}
}
return quality;
}
public static int GetBlockAngle(int _rotation)
{
switch (_rotation)
{
case 0:
return 0;
case 1:
return 90;
case 2:
return 180;
case 3:
return 270;
case 24:
return 45;
case 25:
return 135;
case 26:
return 225;
case 27:
return 315;
}
return 0;
}
public static void notifyMissingItem(ItemValue itemValue, EntityAlive _entity)
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip((EntityPlayerLocal)_entity, Localization.Get("ttMissingResources"));
ItemStack @is = new ItemStack(itemValue, 0);
LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)_entity).entityPlayer.AddUIHarvestingItem(@is, true);
}
public static bool hasItem(ItemValue itemValue, EntityAlive _entity)
{
//Log.Out("RebirthUtilities-hasItem item: " + itemValue.ItemClass.Name);
int itemCount = _entity.bag.GetItemCount(itemValue, -1, -1, true);
int itemCount2 = _entity.inventory.GetItemCount(itemValue, false, -1, -1, true);
//Log.Out("RebirthUtilities-hasItem itemCount: " + itemCount);
//Log.Out("RebirthUtilities-hasItem itemCount2: " + itemCount2);
// ADD CODE TO CHECK EQUIPMENT
if ((itemCount + itemCount2) > 0)
{
//Log.Out("RebirthUtilities-hasItem HAS ITEM");
return true;
}
//Log.Out("RebirthUtilities-hasItem DOES NOT HAVE ITEM");
return false;
}
public static int numItems(ItemValue itemValue, EntityAlive _entity)
{
//Log.Out("RebirthUtilities-numItems item: " + itemValue.ItemClass.Name);
int itemCount = _entity.bag.GetItemCount(itemValue, -1, -1, true);
int itemCount2 = _entity.inventory.GetItemCount(itemValue, false, -1, -1, true);
//Log.Out("RebirthUtilities-numItems itemCount: " + itemCount);
//Log.Out("RebirthUtilities-numItems itemCount2: " + itemCount2);
//Log.Out("RebirthUtilities-numItems DOES NOT HAVE ITEM");
return itemCount + itemCount2;
}
public static void addToPlayerInventory(ItemValue itemValue, EntityAlive _entity, int count, string sound = "", int quality = 1, bool forceModSlots = false, int modSlots = -1)
{
if (itemValue.HasQuality)
{
count = 1;
itemValue.Quality = (ushort)quality;
if (forceModSlots)
{
itemValue.Modifications = new ItemValue[modSlots];
}
}
ItemStack itemStack = new ItemStack(itemValue, count);
int itemCount = _entity.bag.GetItemCount(itemValue, -1, -1, true);
int itemCount2 = _entity.inventory.GetItemCount(itemValue, false, -1, -1, true);
EntityPlayer entityPlayer = _entity as EntityPlayer;
if (itemStack.count > 0)
{
EntityPlayerLocal entityPlayerLocal = _entity as EntityPlayerLocal;
if (entityPlayerLocal != null)
{
LocalPlayerUI.GetUIForPlayer(entityPlayerLocal).entityPlayer.AddUIHarvestingItem(itemStack, true);
}
if (itemCount > 0)
{
if (!entityPlayer.inventory.AddItem(itemStack) && !entityPlayer.bag.AddItem(itemStack))
{
GameManager.Instance.ItemDropServer(itemStack, entityPlayer.GetPosition(), new Vector3(0.5f, 0f, 0.5f), entityPlayer.entityId, 60f, false);
}
}
else if (itemCount2 > 0)
{
if (!entityPlayer.inventory.AddItem(itemStack) && !entityPlayer.bag.AddItem(itemStack))
{
GameManager.Instance.ItemDropServer(itemStack, entityPlayer.GetPosition(), new Vector3(0.5f, 0f, 0.5f), entityPlayer.entityId, 60f, false);
}
}
else if (!entityPlayer.inventory.AddItem(itemStack) && !entityPlayer.bag.AddItem(itemStack))
{
GameManager.Instance.ItemDropServer(itemStack, entityPlayer.GetPosition(), new Vector3(0.5f, 0f, 0.5f), entityPlayer.entityId, 60f, false);
}
if (sound.Length > 0)
{
entityPlayer.PlayOneShot(sound, false);
}
}
}
public static void addToPlayerBag(ItemValue itemValue, EntityAlive _entity, int count, string sound = "", int quality = 1, bool forceModSlots = false, int modSlots = -1)
{
if (itemValue.HasQuality)
{
count = 1;
itemValue.Quality = (ushort)quality;
if (forceModSlots)
{
itemValue.Modifications = new ItemValue[modSlots];
}
}
ItemStack itemStack = new ItemStack(itemValue, count);
int itemCount = _entity.bag.GetItemCount(itemValue, -1, -1, true);
int itemCount2 = _entity.inventory.GetItemCount(itemValue, false, -1, -1, true);
EntityPlayer entityPlayer = _entity as EntityPlayer;
if (itemStack.count > 0)
{
EntityPlayerLocal entityPlayerLocal = _entity as EntityPlayerLocal;
if (entityPlayerLocal != null)
{
LocalPlayerUI.GetUIForPlayer(entityPlayerLocal).entityPlayer.AddUIHarvestingItem(itemStack, true);
}
if (itemCount > 0)
{
if (!entityPlayer.bag.AddItem(itemStack) && !entityPlayer.inventory.AddItem(itemStack))
{
GameManager.Instance.ItemDropServer(itemStack, entityPlayer.GetPosition(), new Vector3(0.5f, 0f, 0.5f), entityPlayer.entityId, 60f, false);
}
}
else if (itemCount2 > 0)
{
if (!entityPlayer.bag.AddItem(itemStack) && !entityPlayer.inventory.AddItem(itemStack))
{
GameManager.Instance.ItemDropServer(itemStack, entityPlayer.GetPosition(), new Vector3(0.5f, 0f, 0.5f), entityPlayer.entityId, 60f, false);
}
}
else if (!entityPlayer.bag.AddItem(itemStack) && !entityPlayer.inventory.AddItem(itemStack))
{
GameManager.Instance.ItemDropServer(itemStack, entityPlayer.GetPosition(), new Vector3(0.5f, 0f, 0.5f), entityPlayer.entityId, 60f, false);
}
if (sound.Length > 0)
{
entityPlayer.PlayOneShot(sound, false);
}
}
}
public static bool useInventoryBagItem(EntityAlive entityPlayer, string itemClassName, int count)
{
//Log.Out("RebirthUtilities-useInventoryBagItem START");
ItemValue itemStack = ItemClass.GetItem(itemClassName, false);
ItemClass itemClass = itemStack.ItemClass;
int itemCount = entityPlayer.bag.GetItemCount(itemStack, -1, -1, false);
int itemCount2 = entityPlayer.inventory.GetItemCount(itemStack, false, -1, -1);
if (itemClass != null)
{
itemCount = entityPlayer.bag.GetItemCount(itemStack, -1, -1, false);
itemCount2 = entityPlayer.inventory.GetItemCount(itemStack, false, -1, -1);
}
//Log.Out("RebirthUtilities-useInventoryBagItem count: " + count);
//Log.Out("RebirthUtilities-useInventoryBagItem itemCount: " + itemCount);
//Log.Out("RebirthUtilities-useInventoryBagItem itemCount2: " + itemCount2);
if ((itemCount + itemCount2) >= count)
{
//Log.Out("RebirthUtilities-useInventoryBagItem 1");
if (itemCount >= count)
{
//Log.Out("RebirthUtilities-useInventoryBagItem 2");
entityPlayer.bag.DecItem(itemStack, count, false);
}
else
{
//Log.Out("RebirthUtilities-useInventoryBagItem 3");
int numLeft = count - itemCount;
entityPlayer.bag.DecItem(itemStack, itemCount, false);
entityPlayer.inventory.DecItem(itemStack, numLeft, false);
}
LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)entityPlayer).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemStack, count));
return true;
}
else
{
//Log.Out("RebirthUtilities-useInventoryBagItem itemClassName: " + itemClassName);
if (itemClassName == "HotwireKit")
{
GameManager.ShowTooltip((EntityPlayerLocal)entityPlayer, Localization.Get("ttMissingHotwirekit"));
}
else if (itemClassName == "FuriousRamsayBikeRepairKit")
{
GameManager.ShowTooltip((EntityPlayerLocal)entityPlayer, Localization.Get("ttMissingBicycleRepairkit"));
}
else
{
GameManager.ShowTooltip((EntityPlayerLocal)entityPlayer, Localization.Get("ttMissingResources"));
}
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 0);
LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)entityPlayer).entityPlayer.AddUIHarvestingItem(@is, true);
return false;
}
}
public static void ProcessCheckAchievements(int biomeID, EntityAlive __instance, EntityAlive entityThatDied)
{
//Log.Out("RebirthUtilities-ProcessCheckAchievements START");
if (entityThatDied == null || RebirthUtilities.ScenarioSkip())
{
return;
}
//Log.Out("RebirthUtilities-ProcessCheckAchievements entityThatDied: " + entityThatDied.EntityClass.entityClassName);
int playerLevel = __instance.Progression.Level;
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayNurseZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementHealingAuraExp";
string notification = "Your [cc4137]Healing Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkHealingAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayLabZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementStaminaAuraExp";
string notification = "Your [cc4137]Stamina Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkStaminaAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsaySpiderZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementMobilityAuraExp";
string notification = "Your [cc4137]Mobility Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkMobilityAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayBikerZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementArmorPenetrationAuraExp";
string notification = "Your [cc4137]Armor Penetration Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkArmorPenetrationAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayUtilityWorkerZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementBlockDamageAuraExp";
string notification = "Your [cc4137]Block Damage Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkBlockDamageAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsaySoldierZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementFireRateAuraExp";
string notification = "Your [cc4137]Fire Rate Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkFireRateAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayMaleHazmatZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementAttackSpeedAuraExp";
string notification = "Your [cc4137]Attack Speed Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkAttackSpeedAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayJanitorZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementShadowAuraExp";
string notification = "Your [cc4137]Shadow Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkShadowAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayFatHawaiianZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementVitalityAuraExp";
string notification = "Your [cc4137]Vitality Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkVitalityAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayTomClarkZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementAgilityAuraExp";
string notification = "Your [cc4137]Agility Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkAgilityAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayFemaleFatZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementPierceAuraExp";
string notification = "Your [cc4137]Pierce Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkPierceAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsaySkateboarderZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementTradeAuraExp";
string notification = "Your [cc4137]Trade Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPeFuriousRamsayPerkTradeAuraModrkHealingAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayBurntZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementFortuityAuraExp";
string notification = "Your [cc4137]Fortuity Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkFortuityAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
if (biomeID != 3 &&
entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("FuriousRamsayMoeZombie")) &&
!IsHordeNight() && playerLevel >= 20
)
{
string tag = "$varFuriousRamsayAchievementStabilityAuraExp";
string notification = "Your [cc4137]Stability Aura[-] is now Level [aceefc]{0}[-]";
if (!HasMod(__instance, "FuriousRamsayPerkStabilityAuraMod"))
{
notification = "";
}
ProcessAchievement(__instance, tag, notification);
}
//Log.Out("RebirthUtilities-ProcessCheckAchievements EntityTags: " + entityThatDied.EntityTags.ToString());
if (entityThatDied.HasAnyTags(FastTags<TagGroup.Global>.Parse("smokeimmunezombie")))
{
string tag = "$varFuriousRamsayAchievementFarmerTraderExp";
string notification = "Achievement: You now have access to the [3cf7fa]Farmer Trader[-]";
ProcessAchievement(__instance, tag, notification);
}
if (entityThatDied.HasAnyTags(FastTags<TagGroup.Global>.Parse("fireimmunezombie")))
{
string tag = "$varFuriousRamsayAchievementHandymanTraderExp";
string notification = "Achievement: You now have access to the [3cf7fa]Handywoman Trader[-]";
ProcessAchievement(__instance, tag, notification);
}
if (entityThatDied.HasAnyTags(FastTags<TagGroup.Global>.Parse("shockimmunezombie")))
{
string tag = "$varFuriousRamsayAchievementBlackShieldTraderExp";
string notification = "Achievement: You now have access to the [3cf7fa]Black Shield Trader[-]";
ProcessAchievement(__instance, tag, notification);
}
if (entityThatDied.EntityTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("hostile")))
{
string tag = "$varFuriousRamsayAchievementHuntingExp";
string notification = "Achievement: [9eff3d]Level {0}[-] in [3cf7fa]Smells like Bacon[-]";
ProcessAchievement(__instance, tag, notification);
}
}
public static void ProcessDamageXP(string itemName, int biomeID, bool hitHead, int playerEntityID, int targetEntityID, int eventType, bool isKill = false, string holdingItem = "")
{
EntityAlive __instance = GameManager.Instance.World.GetEntity(playerEntityID) as EntityAlive;
EntityAlive entityThatDied = GameManager.Instance.World.GetEntity(targetEntityID) as EntityAlive;
if (entityThatDied is EntityWraith && !entityThatDied.Buffs.HasBuff("FuriousRamsayWraithProtection"))
{
return;
}
//Log.Out("RebirthUtilities-ProcessDamageXP entityThatDied: " + entityThatDied.EntityClass.entityClassName);
//Log.Out("RebirthUtilities-ProcessDamageXP eventType: " + eventType);
//Log.Out("RebirthUtilities-ProcessDamageXP isKill: " + isKill);
//Log.Out("RebirthUtilities-ProcessDamageXP entityThatDied is EntityWraith: " + (entityThatDied is EntityWraith));
//Log.Out("RebirthUtilities-ProcessDamageXP entityThatDied.Buffs.HasBuff(FuriousRamsayWraithProtection): " + entityThatDied.Buffs.HasBuff("FuriousRamsayWraithProtection"));
MinEventTypes _eventType = 0;
if (eventType == 1)
{
_eventType = MinEventTypes.onSelfKilledOther;
}
else if (eventType == 2)
{
_eventType = MinEventTypes.onSelfDamagedOther;
}
float activeClassID = __instance.Buffs.GetCustomVar("$ActiveClass_FR");
ItemClass heldItem = null;
if (__instance.inventory != null)
{
heldItem = __instance.inventory.holdingItem;
}
if (itemName == "gunBotT2JunkTurret" || (itemName.ToLower().StartsWith("furiousramsayjunkturret") && !itemName.ToLower().StartsWith("furiousramsayjunkturretSledge")))
{
//Log.Out("RebirthUtilities-ProcessDamageXP IS gunBotT2JunkTurret");
heldItem = ItemClass.GetItem("gunBotT2JunkTurret", false).ItemClass;
}
else if (itemName == "gunBotT1JunkSledge" || itemName.ToLower().StartsWith("furiousramsayjunkturretSledge"))
{
//Log.Out("RebirthUtilities-ProcessDamageXP IS gunBotT2JunkTurret");
heldItem = ItemClass.GetItem("gunBotT1JunkSledge", false).ItemClass;
}
if (holdingItem != "")
{
heldItem = ItemClass.GetItem(holdingItem, false).ItemClass;
}
if (heldItem == null)
{
return;
}
List<string> tagNames = heldItem.ItemTags.GetTagNames();
bool isMelee = isMeleeWeapon(tagNames);
bool isSecondaryAttack = false;
bool isTool = hasTag(tagNames, "tool");
bool isMotorTool = hasTag(tagNames, "motorTool");
bool isAxe = hasTag(tagNames, "axe");
bool isRepairTool = hasTag(tagNames, "repairTool");
/*
if (!RebirthVariables.forceNoHit)
{
if (isMotorTool)
{
return;
}
if (isTool && !isAxe && !isRepairTool)
{
return;
}
}
*/
if (isMelee && __instance.inventory.holdingItemItemValue.ItemClass.Actions[1] != null)
{
isSecondaryAttack = __instance.inventory.holdingItemItemValue.ItemClass.Actions[1].IsActionRunning(__instance.inventory.GetItemActionDataInSlot(__instance.inventory.holdingItemIdx, 1));
}
float multiplier = 1f;
//Log.Out("RebirthUtilities-ProcessDamageXP entityThatDied.EntityTags: " + entityThatDied.EntityTags);
if (_eventType == MinEventTypes.onSelfKilledOther || isKill)
{
//Log.Out("RebirthUtilities-ProcessDamageXP ProcessCheckAchievements");
float geneticsMultipler = 1f;
if (!IsHordeNight())
{
ProcessCheckAchievements(biomeID, __instance, entityThatDied);
}
else
{
geneticsMultipler = 0.2f;
}
float forcedStrengthMultiplier = 1f;
float forcedDexterityMultiplier = 1f;
float forcedConstitutionMultiplier = 1f;
float forcedIntelligenceMultiplier = 1f;
float forcedCharismaMultiplier = 1f;
if (!isMelee)
{
forcedStrengthMultiplier = 0f * geneticsMultipler;
forcedDexterityMultiplier = 0.2f * geneticsMultipler;
forcedConstitutionMultiplier = 0.2f * geneticsMultipler;
forcedIntelligenceMultiplier = 0.2f * geneticsMultipler;
forcedCharismaMultiplier = 0.2f * geneticsMultipler;
}
ProcessGeneticsLBD(__instance, "Strength", "IncreaseFightingStrength", forcedStrengthMultiplier);
ProcessGeneticsLBD(__instance, "Dexterity", "IncreaseFightingDexterity", forcedDexterityMultiplier);
ProcessGeneticsLBD(__instance, "Constitution", "IncreaseFightingConstitution", forcedConstitutionMultiplier);
ProcessGeneticsLBD(__instance, "Intelligence", "IncreaseFightingIntelligence", forcedIntelligenceMultiplier);
ProcessGeneticsLBD(__instance, "Charisma", "IncreaseFightingCharisma", forcedCharismaMultiplier);
}
if (hitHead)
{
//Log.Out("RebirthUtilities-ProcessDamageXP EnumBodyPartHit.Head");
if (_eventType == MinEventTypes.onSelfDamagedOther)
{
multiplier *= RebirthVariables.localConstants["$varFuriousRamsayExperienceDamageHeadMultiplier_Cst"];
//Log.Out("RebirthUtilities-ProcessDamageXP onSelfDamagedOther");
}
else
{
multiplier *= RebirthVariables.localConstants["$varFuriousRamsayExperienceKillHeadMultiplier_Cst"];
//Log.Out("RebirthUtilities-ProcessDamageXP onSelfKilledOther");
}
}
else
{
if (_eventType == MinEventTypes.onSelfDamagedOther)
{
multiplier *= RebirthVariables.localConstants["$varFuriousRamsayExperienceDamageBodyMultiplier_Cst"];
//Log.Out("RebirthUtilities-ProcessDamageXP onSelfDamagedOther");
}
else
{
//Log.Out("RebirthUtilities-ProcessDamageXP onSelfKilledOther");
multiplier *= RebirthVariables.localConstants["$varFuriousRamsayExperienceKillBodyMultiplier_Cst"];
}
}
if (RebirthUtilities.ScenarioSkip())
{
return;
}
float experienceModMultiplier = __instance.Buffs.GetCustomVar("$ClassExpIncrease");
if (experienceModMultiplier > 0)
{
multiplier = multiplier + (multiplier * experienceModMultiplier);
}
float classMultiplierOption = float.Parse(RebirthVariables.customClassXPMultiplier) / 100;
//Log.Out("RebirthUtilities-ProcessDamageXP multiplier: " + multiplier);
string className = GetClassNameFromID(activeClassID);
for (int i = 0; i < tagNames.Count; i++)
{
//Log.Out("RebirthUtilities-ProcessDamageXP tagNames[i]: " + tagNames[i]);
if (tagNames[i].StartsWith("Weapon"))
{
string weapon = tagNames[i].Replace("Weapon", "");
//Log.Out("RebirthUtilities-ProcessDamageXP weapon: " + weapon);
int tier = 1;
if (weapon.Contains("Tier2"))
{
//Log.Out("RebirthUtilities-ProcessDamageXP Tier2");
tier = 2;
}
else if (weapon.Contains("Tier3"))
{
//Log.Out("RebirthUtilities-ProcessDamageXP Tier3");
tier = 3;
}
weapon = weapon.Replace("Tier1", "").Replace("Tier2", "").Replace("Tier3", "");
//Log.Out("RebirthUtilities-ProcessDamageXP weapon: " + weapon);
//Log.Out("===================================================================================");
bool leveledPipe = false;
if (weapon.Contains("Pipe") && __instance.inventory.holdingItem.ItemTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("PipeWeapon")))
{
string pipeWeapon = weapon;
//Log.Out("RebirthUtilities-ProcessDamageXP PIPE WEAPON");
float increment = RebirthVariables.localConstants["$varFuriousRamsay" + pipeWeapon + "Increment_Cst"] / RebirthVariables.localConstants["$varFuriousRamsay" + pipeWeapon + "Multiplier_Cst"];
int classProgressionLevel = 1;
float num = 1f - (0.025f * (classProgressionLevel - 1));
float foodMultiplier = 1f;
if ((isMelee && __instance.Buffs.HasBuff("FuriousRamsayFoodMeatStew")) ||
(!isMelee && __instance.Buffs.HasBuff("FuriousRamsayFoodVegetableStew"))
)
{
foodMultiplier = 1.05f;
}
num = num / increment * multiplier * RebirthVariables.localConstants["$varFuriousRamsayClassMultiplierConfig_Cst"] * foodMultiplier;
num *= classMultiplierOption;
RebirthVariables.localVariables["$varFuriousRamsay" + pipeWeapon + "PercUnit"] += num;
leveledPipe = true;
float number = RebirthVariables.localVariables["$varFuriousRamsay" + pipeWeapon + "PercUnit"];
if (number <= 1f)
{
foreach (string key in RebirthVariables.localExpertiseCrafting.Keys)
{
//Log.Out("RebirthUtilities-ProcessDamageXP key: " + key);
if (key == pipeWeapon)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
//Log.Out("RebirthUtilities-ProcessDamageXP craftingList.craftingPerk: " + craftingList.craftingPerk);
ProgressionValue craftingProgressionValue = __instance.Progression.GetProgressionValue(craftingList.craftingPerk);
int craftingProgressionLevel = craftingProgressionValue.Level;
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
if (number >= craftingLevel.categoryLevel)
{
//Log.Out("RebirthUtilities-ProcessDamageXP craftingList.craftingPerk: " + craftingList.craftingPerk);
//Log.Out("RebirthUtilities-ProcessDamageXP number (" + number + ") > craftingLevel.categoryLevel (" + craftingLevel.categoryLevel + ")");
//Log.Out("RebirthUtilities-ProcessDamageXP craftingProgressionLevel (" + craftingProgressionLevel + " < craftingLevel.craftingLevel (" + craftingLevel.craftingLevel + ")");
if (craftingProgressionLevel < craftingLevel.craftingLevel)
{
//Log.Out("RebirthUtilities-ProcessDamageXP GO UP!");
craftingProgressionValue.Level = craftingLevel.craftingLevel;
EntityPlayerLocal entityPlayerLocal = (EntityPlayerLocal)__instance;
entityPlayerLocal.PlayerUI.xui.CollectedItemList.AddCraftingSkillNotification(craftingProgressionValue, false);
//Log.Out("RebirthUtilities-ProcessDamageXP craftingProgressionLevel: " + craftingProgressionLevel);
//Log.Out("RebirthUtilities-ProcessDamageXP craftingLevel.craftingLevel: " + craftingLevel.craftingLevel);
craftingProgressionValue.ProgressionClass.HandleCheckCrafting(entityPlayerLocal, craftingProgressionLevel, craftingLevel.craftingLevel);
__instance.Progression.bProgressionStatsChanged = true;
__instance.bPlayerStatsChanged = true;
break;
}
}
}
}
}
}
}
//Log.Out("RebirthUtilities-ProcessDamageXP num: " + num);
}
if (!leveledPipe)
{
foreach (string key in RebirthVariables.localExpertiseClass.Keys)
{
if (key == weapon)
{
string currentClass = RebirthVariables.localExpertiseClass[key];
//Log.Out("RebirthUtilities-ProcessDamageXP className: " + className);
//Log.Out("RebirthUtilities-ProcessDamageXP currentClass: " + currentClass);
//Log.Out("RebirthUtilities-ProcessDamageXP isMelee: " + isMelee);
bool isActiveClassWeapon = false;
float classMultiplier = 1; // 0.15f;
if (currentClass == className ||
(className == "Berserker" && isMelee)
)
{
isActiveClassWeapon = true;
classMultiplier = 1f;
}
//Log.Out("RebirthUtilities-ProcessDamageXP isActiveClassWeapon: " + isActiveClassWeapon);
//Log.Out("RebirthUtilities-ProcessDamageXP " + "$varFuriousRamsay" + weapon + "PercUnit" + ": " + RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"]);
//Log.Out("RebirthUtilities-ProcessDamageXP multiplier: " + multiplier);
//Log.Out("RebirthUtilities-ProcessDamageXP classMultiplier: " + classMultiplier);
ProgressionValue classProgressionValue = __instance.Progression.GetProgressionValue("furiousramsayatt" + currentClass.ToLower());
int classProgressionLevel = classProgressionValue.Level;
int maxProgression = 10;
foreach (string classKey in RebirthVariables.localClassProgressionMax.Keys)
{
if (classKey == currentClass)
{
maxProgression = RebirthVariables.localClassProgressionMax[classKey];
break;
}
}
float num = 1f - (0.025f * (classProgressionLevel - 1));
string currentWeapon = weapon;
if (currentClass == "Berserker" && isMelee)
{
bool foundWeapon = false;
//Log.Out("RebirthUtilities-ProcessDamageXP tagNames: " + tagNames.ToString());
for (int j = 0; j < tagNames.Count; j++)
{
if (tagNames[i].StartsWith("Weapon"))
{
string weaponBerserker = tagNames[j].Replace("Weapon", "");
tier = 1;
if (weaponBerserker.Contains("Tier2"))
{
tier = 2;
}
else if (weaponBerserker.Contains("Tier3"))
{
tier = 3;
}
weaponBerserker = weaponBerserker.Replace("Tier1", "").Replace("Tier2", "").Replace("Tier3", "");
//Log.Out("RebirthUtilities-ProcessDamageXP weaponBerserker: " + weaponBerserker);
foreach (string keyWeapon in RebirthVariables.localExpertiseClass.Keys)
{
//Log.Out("RebirthUtilities-ProcessDamageXP keyWeapon: " + keyWeapon);
if ((keyWeapon == weaponBerserker) && (keyWeapon != "Melee"))
{
currentWeapon = keyWeapon;
foundWeapon = true;
//Log.Out("RebirthUtilities-ProcessDamageXP currentWeapon: " + currentWeapon);
break;
}
}
}
if (foundWeapon)
{
break;
}
}
}
float increment = RebirthVariables.localConstants["$varFuriousRamsay" + currentWeapon + "Increment_Cst"] / RebirthVariables.localConstants["$varFuriousRamsay" + currentWeapon + "Multiplier_Cst"];
if (__instance.inventory.holdingItem.ItemTags.ToString().Contains("Exception"))
{
//Log.Out("RebirthUtilities-ProcessDamageXP EXCEPTION");
for (int k = 0; k < tagNames.Count; k++)
{
if (tagNames[k].Contains("Exception"))
{
string currentWeaponKey = tagNames[k];
//Log.Out("RebirthUtilities-ProcessDamageXP currentWeaponKey: " + currentWeaponKey);
increment = RebirthVariables.localConstants[currentWeaponKey];
//Log.Out("RebirthUtilities-ProcessDamageXP increment: " + increment);
break;
}
}
}
//Log.Out("=============================================================================");
//Log.Out("RebirthUtilities-ProcessDamageXP BEFORE classMultiplier: " + classMultiplier);
if (!isMelee && activeClassID == 0)
{
classMultiplier = 0.3f;
}
ProgressionValue expertiseProgressionValue = __instance.Progression.GetProgressionValue("FuriousRamsayPerk" + weapon);
int expertiseProgressionLevel = expertiseProgressionValue.Level;
float expertiseLevel = RebirthVariables.localConstants["$varFuriousRamsay" + weapon + "Lvl"];
float expertiseExperience = RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"];
float floor = RebirthUtilities.GetCategoryFloor(currentWeapon);
//Log.Out("RebirthUtilities-ProcessDamageXP floor: " + floor);
//Log.Out("RebirthUtilities-ProcessDamageXP expertiseExperience: " + expertiseExperience);
//Log.Out("RebirthUtilities-ProcessDamageXP activeClassID: " + activeClassID);
//Log.Out("RebirthUtilities-ProcessDamageXP currentClass: " + currentClass);
//Log.Out("RebirthUtilities-ProcessDamageXP className: " + className);
/*if (!isMelee && activeClassID > 0 && (currentClass != className) && expertiseExperience >= floor)
{
Log.Out("RebirthUtilities-ProcessDamageXP RANGED NOT CURRENT CLASS, OVER LEVEL 1");
float currentClassID = GetIDFromClassName(currentClass);
if (IsClassActive((int)currentClassID))
{
Log.Out("RebirthUtilities-ProcessDamageXP AAA");
classMultiplier = 1f;
}
else
{
Log.Out("RebirthUtilities-ProcessDamageXP BBB");
classMultiplier = 0.85f;
}
}*/
//Log.Out("RebirthUtilities-ProcessDamageXP AFTER classMultiplier: " + classMultiplier);
float foodMultiplier = 1f;
if ((isMelee && __instance.Buffs.HasBuff("FuriousRamsayFoodMeatStew")) ||
(!isMelee && __instance.Buffs.HasBuff("FuriousRamsayFoodVegetableStew"))
)
{
foodMultiplier = 1.1f;
}
num = num / increment * multiplier * classMultiplier * RebirthVariables.localConstants["$varFuriousRamsayClassMultiplierConfig_Cst"] * foodMultiplier;
//Log.Out("RebirthUtilities-ProcessDamageXP BEFORE num: " + num);
//Log.Out("RebirthUtilities-ProcessDamageXP classMultiplierOption: " + classMultiplierOption);
num *= classMultiplierOption;
if (isSecondaryAttack)
{
//Log.Out("RebirthUtilities-ProcessDamageXP CCC");
num *= 1.10f;
}
if (IsHordeNight())
{
//Log.Out("RebirthUtilities-ProcessDamageXP APPLIED MULTIPLIER RebirthVariables.customHordeNightXPMultiplier: " + RebirthVariables.customHordeNightXPMultiplier);
float multiplierHN = float.Parse(RebirthVariables.customHordeNightXPMultiplier) / 100;
num *= multiplierHN;
}
if (__instance.Buffs.HasBuff("FuriousRamsayScreamerSignalActive"))
{
//Log.Out("RebirthUtilities-ProcessDamageXP APPLIED MULTIPLIER RebirthVariables.CustomScreamerSignalXPMultiplier: " + RebirthVariables.CustomScreamerSignalXPMultiplier);
float multiplierHN = float.Parse(RebirthVariables.customScreamerSignalXPMultiplier) / 100;
num *= multiplierHN;
}
//Log.Out("RebirthUtilities-ProcessDamageXP currentClass: " + currentClass);
//Log.Out("RebirthUtilities-ProcessDamageXP className: " + className);
//Log.Out("RebirthUtilities-ProcessDamageXP BEFORE num: " + num);
if (className == "Berserker" && isMelee && (currentClass != className))
{
float currentClassID = GetIDFromClassName(currentClass);
//if (!IsClassActive((int)currentClassID))
{
//Log.Out("RebirthUtilities-ProcessDamageXP DDD");
num *= 0.75f; // 0.3f;
}
}
else if (currentClass != className && activeClassID > 0)
{
float currentClassID = GetIDFromClassName(currentClass);
//if (!IsClassActive((int)currentClassID))
{
//Log.Out("RebirthUtilities-ProcessDamageXP EEE");
num *= 0.5f;
}
}
//Log.Out("RebirthUtilities-ProcessDamageXP AFTER num: " + num);
//Log.Out("RebirthUtilities-ProcessDamageXP expertiseLevel: " + expertiseLevel);
//Log.Out("RebirthUtilities-ProcessDamageXP " + currentWeapon + "Increment_Cst: " + RebirthVariables.localConstants["$varFuriousRamsay" + currentWeapon + "Increment_Cst"]);
//Log.Out("RebirthUtilities-ProcessDamageXP num: " + num);
//Log.Out("RebirthUtilities-ProcessDamageXP currentClass: " + "furiousramsayatt" + currentClass.ToLower());
int classProgressionMax = GetClassProgressionMax(currentClass);
int expertiseProgressionMax = GetExpertiseProgressionMax(weapon);
//Log.Out("RebirthUtilities-ProcessDamageXP classProgressionLevel: " + classProgressionLevel);
//Log.Out("RebirthUtilities-ProcessDamageXP expertiseProgressionLevel: " + expertiseProgressionLevel);
if (expertiseProgressionLevel == classProgressionLevel)
{
//Log.Out("RebirthUtilities-ProcessDamageXP LEVEL CLASS");
num *= 3;
if ((currentClass != className) & (className == "Berserker" && isMelee))
{
//Log.Out("RebirthUtilities-ProcessDamageXP FFF");
num *= 10;
}
//Log.Out("RebirthUtilities-ProcessDamageXP A num: " + num);
float currentValue = RebirthVariables.localVariables["$varFuriousRamsay" + currentClass + "PercUnit"];
float projectedValue = RebirthVariables.localVariables["$varFuriousRamsay" + currentClass + "PercUnit"] + num;
//Log.Out("RebirthUtilities-ProcessDamageXP currentValue: " + currentValue);
//Log.Out("RebirthUtilities-ProcessDamageXP projectedValue: " + projectedValue);
//Log.Out("RebirthUtilities-ProcessDamageXP ((int)currentValue): " + ((int)currentValue));
//Log.Out("RebirthUtilities-ProcessDamageXP ((int)projectedValue): " + ((int)projectedValue));
if (((int)projectedValue) > ((int)currentValue))
{
RebirthVariables.localVariables["$varFuriousRamsay" + currentClass + "PercUnit"] = (int)projectedValue;
}
else
{
RebirthVariables.localVariables["$varFuriousRamsay" + currentClass + "PercUnit"] += num;
}
if ((int)RebirthVariables.localVariables["$varFuriousRamsay" + currentClass + "PercUnit"] > maxProgression)
{
RebirthVariables.localVariables["$varFuriousRamsay" + currentClass + "PercUnit"] = maxProgression;
}
if (isActiveClassWeapon)
{
RebirthVariables.localConstants["$varFuriousRamsayClassPercUnit"] = RebirthVariables.localVariables["$varFuriousRamsay" + currentClass + "PercUnit"];
}
ProcessAttribute(__instance, "$varFuriousRamsay" + currentClass + "PercUnit");
}
else
{
if (activeClassID > 0 && isMelee)
{
//Log.Out("RebirthUtilities-ProcessDamageXP GGG");
num = num * RebirthVariables.meleeExpertiseMultiplier;
}
//Log.Out("RebirthUtilities-ProcessDamageXP B num: " + num);
foreach (string expertiseKey in RebirthVariables.localExpertise.Keys)
{
if (expertiseKey == weapon)
{
maxProgression = RebirthVariables.localExpertise[expertiseKey];
break;
}
}
//Log.Out("RebirthUtilities-ProcessDamageXP LEVEL EXPERTISE");
float currentValue = RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"];
float projectedValue = RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"] + num;
//Log.Out("RebirthUtilities-ProcessDamageXP currentValue: " + currentValue);
//Log.Out("RebirthUtilities-ProcessDamageXP projectedValue: " + projectedValue);
//Log.Out("RebirthUtilities-ProcessDamageXP ((int)currentValue): " + ((int)currentValue));
//Log.Out("RebirthUtilities-ProcessDamageXP ((int)projectedValue): " + ((int)projectedValue));
if (((int)projectedValue) > ((int)currentValue))
{
RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"] = (int)projectedValue;
}
else
{
RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"] += num;
}
if ((int)RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"] > maxProgression)
{
RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"] = maxProgression;
}
if (isActiveClassWeapon)
{
RebirthVariables.localConstants["$varFuriousRamsayPerk" + tier + "PercUnit"] = RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"];
}
//Log.Out("RebirthUtilities-ProcessDamageXP $varFuriousRamsay" + weapon + "PercUnit: " + RebirthVariables.localVariables["$varFuriousRamsay" + weapon + "PercUnit"]);
ProcessAttribute(__instance, "$varFuriousRamsay" + weapon + "PercUnit");
}
//Log.Out("RebirthUtilities-ProcessDamageXP " + "$varFuriousRamsayPerk" + tier + "PercUnit" + ": " + RebirthVariables.localConstants["$varFuriousRamsayPerk" + tier + "PercUnit"]);
}
}
}
}
}
}
public static bool CanHarvest(Block _block, string _tag)
{
//Log.Out("RebirthUtilities-CanHarvest START");
if (_block.itemsToDrop.TryGetValue(EnumDropEvent.Harvest, out List<Block.SItemDropProb> harvests))
{
//Log.Out("RebirthUtilities-CanHarvest HARVEST 1");
foreach (Block.SItemDropProb harvest in harvests)
{
//Log.Out("RebirthUtilities-CanHarvest harvest.tag: " + harvest.tag);
if (harvest.tag == _tag)
{
//Log.Out("RebirthUtilities-CanHarvest FOUND IN HARVEST TAG");
return true;
}
}
}
if (_block.itemsToDrop.TryGetValue(EnumDropEvent.Destroy, out List<Block.SItemDropProb> destroys))
{
//Log.Out("RebirthUtilities-CanHarvest DESTROY 1");
foreach (Block.SItemDropProb destroy in destroys)
{
//Log.Out("RebirthUtilities-CanHarvest destroy.tag: " + destroy.tag);
if (destroy.tag == _tag)
{
//Log.Out("RebirthUtilities-CanHarvest FOUND IN DESTROY TAG");
return true;
}
}
}
return false;
}
public static float GetCraftingIncrement(string category, float currentValue)
{
float result = 0f;
foreach (string key in RebirthVariables.localCraftingIncrements.Keys)
{
////Log.Out("RebirthUtilities-GetCraftingIncrement category: " + category);
////Log.Out("RebirthUtilities-GetCraftingIncrement key: " + key);
if (key == category)
{
////Log.Out("RebirthUtilities-GetCraftingIncrement key == category");
foreach (craftingIncrements craftingIncrement in RebirthVariables.localCraftingIncrements[key])
{
////Log.Out("RebirthUtilities-GetCraftingIncrement craftingIncrement.currentValue: " + currentValue);
////Log.Out("RebirthUtilities-GetCraftingIncrement craftingIncrement.floor: " + craftingIncrement.floor);
////Log.Out("RebirthUtilities-GetCraftingIncrement craftingIncrement.ceiling: " + craftingIncrement.ceiling);
if (currentValue >= craftingIncrement.floor &&
currentValue < craftingIncrement.ceiling
)
{
////Log.Out("RebirthUtilities-GetCraftingIncrement craftingIncrement.increment: " + craftingIncrement.increment);
result = craftingIncrement.increment;
return result;
}
}
}
}
return result;
}
public static int GetGeneticLevel(string genetic)
{
int result = (int)RebirthVariables.localVariables["$varFuriousRamsay" + genetic + "PercUnit"];
return result;
}
public static string GetClassFromPerk(string craftingPerk)
{
string result = "";
foreach (string key in RebirthVariables.localExpertiseClass.Keys)
{
if (key == craftingPerk)
{
return RebirthVariables.localExpertiseClass[key];
}
}
return result;
}
public static float GetCraftingOtherCategoryValue(string craftingPerk, float craftingValue)
{
float result = 0f;
////Log.Out("RebirthUtilities-GetCraftingOtherCategoryValue craftingPerk: " + craftingPerk);
////Log.Out("RebirthUtilities-GetCraftingOtherCategoryValue craftingValue: " + craftingValue);
foreach (string key in RebirthVariables.localOtherCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
if (craftingList.craftingPerk.ToLower() == craftingPerk.ToLower())
{
////Log.Out("RebirthUtilities-GetCraftingOtherCategoryValue FOUND CRAFTING PERK");
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevelFloor in craftingLevelsList)
{
////Log.Out("RebirthUtilities-GetCraftingOtherCategoryValue craftingLevelFloor.craftingLevel: " + craftingLevelFloor.craftingLevel);
////Log.Out("RebirthUtilities-GetCraftingOtherCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
if (craftingLevelFloor.craftingLevel == craftingValue)
{
////Log.Out("RebirthUtilities-GetCraftingOtherCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
return craftingLevelFloor.categoryLevel;
}
}
}
}
}
return result;
}
public static int GetActualCraftingOtherCategoryValue(string craftingPerk, float perkValue)
{
int result = 0;
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingPerk: " + craftingPerk);
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingValue: " + craftingValue);
foreach (string key in RebirthVariables.localOtherCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
if (craftingList.craftingPerk.ToLower() == craftingPerk.ToLower())
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue FOUND CRAFTING PERK");
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.craftingLevel: " + craftingLevelFloor.craftingLevel);
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
if (craftingLevel.categoryLevel > perkValue)
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
return result;
}
result = craftingLevel.craftingLevel;
}
}
}
}
return result;
}
public static int GetActualCraftingGeneticsCategoryValue(string craftingPerk, float perkValue)
{
int result = 0;
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingPerk: " + craftingPerk);
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingValue: " + craftingValue);
foreach (string key in RebirthVariables.localGeneticsCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localGeneticsCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
if (craftingList.craftingPerk.ToLower() == craftingPerk.ToLower())
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue FOUND CRAFTING PERK");
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.craftingLevel: " + craftingLevelFloor.craftingLevel);
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
if (craftingLevel.categoryLevel > perkValue)
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
return result;
}
result = craftingLevel.craftingLevel;
}
}
}
}
return result;
}
public static int GetActualCraftingPerksCategoryValue(string craftingPerk, float perkValue)
{
int result = 0;
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingPerk: " + craftingPerk);
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingValue: " + craftingValue);
foreach (string key in RebirthVariables.localExpertiseCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
if (craftingList.craftingPerk.ToLower() == craftingPerk.ToLower())
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue FOUND CRAFTING PERK");
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.craftingLevel: " + craftingLevelFloor.craftingLevel);
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
if (craftingLevel.categoryLevel > perkValue)
{
//Log.Out("RebirthUtilities-GetActualCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
return result;
}
result = craftingLevel.craftingLevel;
}
}
}
}
return result;
}
public static float GetCraftingGeneticsCategoryValue(string craftingPerk, float craftingValue)
{
float result = 0f;
////Log.Out("RebirthUtilities-GetCraftingGeneticsCategoryValue craftingPerk: " + craftingPerk);
////Log.Out("RebirthUtilities-GetCraftingGeneticsCategoryValue craftingValue: " + craftingValue);
foreach (string key in RebirthVariables.localGeneticsCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localGeneticsCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
if (craftingList.craftingPerk.ToLower() == craftingPerk.ToLower())
{
////Log.Out("RebirthUtilities-GetCraftingGeneticsCategoryValue FOUND CRAFTING PERK");
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevelFloor in craftingLevelsList)
{
////Log.Out("RebirthUtilities-GetCraftingGeneticsCategoryValue craftingLevelFloor.craftingLevel: " + craftingLevelFloor.craftingLevel);
////Log.Out("RebirthUtilities-GetCraftingGeneticsCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
if (craftingLevelFloor.craftingLevel == craftingValue)
{
////Log.Out("RebirthUtilities-GetCraftingGeneticsCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
return craftingLevelFloor.categoryLevel;
}
}
}
}
}
return result;
}
public static float GetCraftingPerksCategoryValue(string craftingPerk, float craftingValue)
{
float result = 0f;
////Log.Out("RebirthUtilities-GetCraftingPerksCategoryValue craftingPerk: " + craftingPerk);
////Log.Out("RebirthUtilities-GetCraftingPerksCategoryValue craftingValue: " + craftingValue);
foreach (string key in RebirthVariables.localExpertiseCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
if (craftingList.craftingPerk.ToLower() == craftingPerk.ToLower())
{
////Log.Out("RebirthUtilities-GetCraftingPerksCategoryValue FOUND CRAFTING PERK");
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevelFloor in craftingLevelsList)
{
////Log.Out("RebirthUtilities-GetCraftingPerksCategoryValue craftingLevelFloor.craftingLevel: " + craftingLevelFloor.craftingLevel);
////Log.Out("RebirthUtilities-GetCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
if (craftingLevelFloor.craftingLevel == craftingValue)
{
////Log.Out("RebirthUtilities-GetCraftingPerksCategoryValue craftingLevelFloor.categoryLevel: " + craftingLevelFloor.categoryLevel);
return craftingLevelFloor.categoryLevel;
}
}
}
}
}
return result;
}
public static void GetMaxGeneticsProgression(ref float progressionValue, string progressionKey)
{
int maxProgression = 10;
foreach (string geneticsKey in RebirthVariables.localGenetics.Keys)
{
if (geneticsKey == progressionKey)
{
maxProgression = RebirthVariables.localGenetics[geneticsKey];
break;
}
}
if (progressionValue > maxProgression)
{
progressionValue = maxProgression;
}
}
public static void ProcessItem(EntityAlive ___entityPlayerLocal, FastTags<TagGroup.Global> itemTags)
{
float geneticsMultiplierOption = float.Parse(RebirthVariables.customGeneticsXPMultiplier) / 100;
int playerLevelTier = GetPlayerLevelTier(___entityPlayerLocal);
string keyName = "";
string cvarName = "";
string categoryName = "";
bool isValid = false;
bool hasCooldown = ___entityPlayerLocal.Buffs.HasBuff("FuriousRamsayUsedDrugsCountdown");
if (!hasCooldown && itemTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("medicalLow")))
{
keyName = "Constitution";
cvarName = "$varFuriousRamsay" + keyName + "PercUnit";
categoryName = "$varFuriousRamsayIncreaseUseDrugsLowTier" + playerLevelTier;
___entityPlayerLocal.Buffs.AddBuff("FuriousRamsayUsedDrugsCountdown");
isValid = true;
}
else if (!hasCooldown && itemTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("medicalMedium")))
{
keyName = "Constitution";
cvarName = "$varFuriousRamsay" + keyName + "PercUnit";
categoryName = "$varFuriousRamsayIncreaseUseDrugsMediumTier" + playerLevelTier;
___entityPlayerLocal.Buffs.AddBuff("FuriousRamsayUsedDrugsCountdown");
isValid = true;
}
else if (!hasCooldown && itemTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("medicalHigh")))
{
keyName = "Constitution";
cvarName = "$varFuriousRamsay" + keyName + "PercUnit";
categoryName = "$varFuriousRamsayIncreaseUseDrugsHighTier" + playerLevelTier;
___entityPlayerLocal.Buffs.AddBuff("FuriousRamsayUsedDrugsCountdown");
isValid = true;
}
if (isValid)
{
float num = RebirthVariables.localVariables[cvarName] + (RebirthVariables.localConstants[categoryName] * geneticsMultiplierOption);
GetMaxGeneticsProgression(ref num, keyName);
RebirthVariables.localVariables[cvarName] = num;
ProcessAttribute(___entityPlayerLocal, cvarName);
}
}
public static int GetPlayerLevelTier(EntityAlive __instance)
{
int result = 1;
int playerLevel = __instance.Progression.Level;
if (playerLevel > 0 && playerLevel < RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier1_Cst"])
{
result = 1;
}
else if (playerLevel >= RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier1_Cst"] && playerLevel < RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier2_Cst"])
{
result = 2;
}
else if (playerLevel >= RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier2_Cst"] && playerLevel < RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier3_Cst"])
{
result = 3;
}
else if (playerLevel >= RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier3_Cst"] && playerLevel < RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier4_Cst"])
{
result = 4;
}
else if (playerLevel >= RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier4_Cst"])
{
result = 5;
}
return result;
}
public static float GetPerkLevel(EntityAlive __instance, string progression)
{
ProgressionValue progressionValue = __instance.Progression.GetProgressionValue(progression);
return RebirthUtilities.GetCalculatedLevel(__instance, progressionValue);
}
public static bool hasTag(List<string> tagNames, string tagName)
{
bool result = false;
for (int i = 0; i < tagNames.Count; i++)
{
if (tagNames[i].ToLower() == tagName.ToLower())
{
result = true;
break;
}
}
return result;
}
public static bool isMeleeWeapon(List<string> tagNames)
{
bool isMelee = false;
for (int i = 0; i < tagNames.Count; i++)
{
if (tagNames[i].ToLower() == "melee")
{
isMelee = true;
break;
}
}
return isMelee;
}
public static float GetBonusChance(ItemValue itemValue, bool isMelee = false, bool isPrimaryAttack = true)
{
float chance = 0;
if (itemValue != null)
{
if (itemValue.HasMetadata("bonus") &&
itemValue.HasMetadata("level") &&
itemValue.HasMetadata("type") &&
itemValue.HasMetadata("active"))
{
string bonusName = (string)itemValue.GetMetadata("bonus");
string bonusType = (string)itemValue.GetMetadata("type");
int bonusLevel = (int)itemValue.GetMetadata("level");
int isActive = (int)itemValue.GetMetadata("active");
if (isActive == 1)
{
//Log.Out("EntityNPCRebirth-SetItemValue bonusName: " + bonusName);
//Log.Out("EntityNPCRebirth-SetItemValue bonusType: " + bonusType);
//Log.Out("EntityNPCRebirth-SetItemValue bonusLevel: " + bonusLevel);
//Log.Out("EntityNPCRebirth-SetItemValue isActive: " + isActive);
string auraKey = bonusName;
int auraProgressionLevel = bonusLevel;
float attacksPerMinute = 60;
float roundsPerMinute = 60;
ItemClass itemClass = itemValue.ItemClass;
ItemValue itemRanged = ItemClass.GetItem(itemClass.GetItemName(), false);
float baseChance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].baseChancePerLevel;
if (isMelee)
{
chance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].chancePerLevel * 2;
if (isPrimaryAttack)
{
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemValue, 60f);
attacksPerMinute = 60 / myDelay;
chance = chance * 3 / 4;
}
else
{
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemValue, 60f);
attacksPerMinute = 60 / myDelay;
}
chance = chance * 180 / attacksPerMinute;
}
else
{
int numMagazineSize = 1;
ItemActionRanged myAction = (ItemActionRanged)itemClass.Actions[0];
if (!isMelee)
{
float originalDelay = -1f;
if (itemValue.ItemClass.Properties.Values.ContainsKey("Delay"))
{
originalDelay = StringParsers.ParseFloat(itemValue.ItemClass.Properties.Values["Delay"]);
}
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.RoundsPerMinute, itemValue, 60f / originalDelay, null);
roundsPerMinute = 60 / myDelay;
}
numMagazineSize = (int)EffectManager.GetValue(PassiveEffects.MagazineSize, itemRanged, myAction.BulletsPerMagazine, null, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (numMagazineSize == 1)
{
roundsPerMinute = 60;
}
chance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].chancePerLevel * 60 / roundsPerMinute;
if (RebirthVariables.localAuras[auraKey].overrideChance)
{
chance = 10 * RebirthVariables.localAuras[auraKey].chancePerLevel * 60 / roundsPerMinute;
baseChance = 10 * RebirthVariables.localAuras[auraKey].baseChancePerLevel;
if (isMelee)
{
chance = 10 * RebirthVariables.localAuras[auraKey].meleeChance * 60 / roundsPerMinute;
chance = chance / 10f;
}
}
}
string targetBuff = RebirthVariables.localAuras[auraKey].targetBuff;
string playerBuff = RebirthVariables.localAuras[auraKey].playerBuff;
string cooldownBuff = "FuriousRamsayDamagedCooldown" + auraKey;
string targetPlayerBuff = RebirthVariables.localAuras[auraKey].targetPlayerBuff;
int random = Manager.random.RandomRange(0, 100);
if (chance > 20f)
{
chance = 20f;
}
if (RebirthVariables.testAuras)
{
chance = 100f;
}
//Log.Out("EntityNPCRebirth-SetItemValue chance: " + chance);
//Log.Out("EntityNPCRebirth-SetItemValue attacksPerMinute: " + attacksPerMinute);
//Log.Out("EntityNPCRebirth-SetItemValue roundsPerMinute: " + roundsPerMinute);
}
}
}
return chance;
}
public static void SetBonusChance(ItemValue itemValue, EntityAlive __instance, EntityAlive entityTarget, bool isMelee = false, bool isPrimaryAttack = true)
{
float chance = 0;
if (itemValue != null)
{
if (itemValue.HasMetadata("bonus") &&
itemValue.HasMetadata("level") &&
itemValue.HasMetadata("type") &&
itemValue.HasMetadata("active"))
{
string bonusName = (string)itemValue.GetMetadata("bonus");
string bonusType = (string)itemValue.GetMetadata("type");
int bonusLevel = (int)itemValue.GetMetadata("level");
int isActive = (int)itemValue.GetMetadata("active");
if (isActive == 1)
{
//Log.Out("EntityNPCRebirth-SetItemValue bonusName: " + bonusName);
//Log.Out("EntityNPCRebirth-SetItemValue bonusType: " + bonusType);
//Log.Out("EntityNPCRebirth-SetItemValue bonusLevel: " + bonusLevel);
//Log.Out("EntityNPCRebirth-SetItemValue isActive: " + isActive);
string auraKey = bonusName;
int auraProgressionLevel = bonusLevel;
float attacksPerMinute = 60;
float roundsPerMinute = 60;
ItemClass itemClass = itemValue.ItemClass;
ItemValue itemRanged = ItemClass.GetItem(itemClass.GetItemName(), false);
ItemActionData _actionData = __instance.inventory.holdingItemData.actionData[0];
float baseChance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].baseChancePerLevel;
if (isMelee)
{
chance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].chancePerLevel * 2;
if (isPrimaryAttack)
{
_actionData = __instance.inventory.holdingItemData.actionData[0];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
ItemActionDynamicMelee.ItemActionDynamicMeleeData itemActionData = (ItemActionDynamicMelee.ItemActionDynamicMeleeData)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, __instance, tags: tags);
attacksPerMinute = 60 / myDelay;
}
chance = chance * 3 / 4;
}
else
{
_actionData = __instance.inventory.holdingItemData.actionData[1];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
ItemActionDynamicMelee.ItemActionDynamicMeleeData itemActionData = (ItemActionDynamicMelee.ItemActionDynamicMeleeData)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, __instance, tags: tags);
attacksPerMinute = 60 / myDelay;
}
}
chance = chance * 180 / attacksPerMinute;
}
else
{
int numMagazineSize = 1;
ItemActionRanged myAction = (ItemActionRanged)itemClass.Actions[0];
if (_actionData != null && !isMelee)
{
ItemActionRanged.ItemActionDataRanged itemActionDataRanged = (ItemActionRanged.ItemActionDataRanged)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.RoundsPerMinute, itemActionDataRanged.invData.itemValue, 60f / itemActionDataRanged.OriginalDelay, __instance);
roundsPerMinute = 60 / myDelay;
}
numMagazineSize = (int)EffectManager.GetValue(PassiveEffects.MagazineSize, itemRanged, myAction.BulletsPerMagazine, __instance, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
if (numMagazineSize == 1)
{
roundsPerMinute = 60;
}
chance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].chancePerLevel * 60 / roundsPerMinute;
if (RebirthVariables.localAuras[auraKey].overrideChance)
{
chance = 10 * RebirthVariables.localAuras[auraKey].chancePerLevel * 60 / roundsPerMinute;
baseChance = 10 * RebirthVariables.localAuras[auraKey].baseChancePerLevel;
if (isMelee)
{
chance = 10 * RebirthVariables.localAuras[auraKey].meleeChance * 60 / roundsPerMinute;
chance = chance / 10f;
}
}
}
string targetBuff = RebirthVariables.localAuras[auraKey].targetBuff;
string playerBuff = RebirthVariables.localAuras[auraKey].playerBuff;
string cooldownBuff = "FuriousRamsayDamagedCooldown" + auraKey;
string targetPlayerBuff = RebirthVariables.localAuras[auraKey].targetPlayerBuff;
int random = __instance.rand.RandomRange(0, 100);
if (chance > 20f)
{
chance = 20f;
}
if (RebirthVariables.testAuras)
{
chance = 100f;
}
//Log.Out("EntityNPCRebirth-SetItemValue chance: " + chance);
//Log.Out("EntityNPCRebirth-SetItemValue attacksPerMinute: " + attacksPerMinute);
//Log.Out("EntityNPCRebirth-SetItemValue roundsPerMinute: " + roundsPerMinute);
if (random < chance)
{
if (playerBuff.Trim().Length > 0)
{
if (RebirthVariables.localAuras[auraKey].useTargetBuffLevels)
{
playerBuff = playerBuff + auraProgressionLevel;
}
__instance.Buffs.AddBuff(playerBuff);
}
if (targetBuff.Trim().Length > 0)
{
if (targetPlayerBuff.Trim().Length > 0)
{
__instance.Buffs.AddBuff(targetPlayerBuff);
EntityPlayerLocal playerLocal = (EntityPlayerLocal)__instance;
RebirthUtilities.AddBuffToGroups(playerLocal, targetPlayerBuff, true, true);
}
if (RebirthVariables.localAuras[auraKey].useTargetBuffLevels)
{
targetBuff = targetBuff + auraProgressionLevel;
}
if (targetBuff == "FuriousRamsayAddExplosionDamage")
{
entityTarget.Buffs.AddBuff("FuriousRamsayCounterResistSmoke");
}
entityTarget.Buffs.AddBuff(targetBuff, __instance.entityId);
}
}
}
}
}
}
public static void SetAuraChance(ItemValue itemValue, string itemClassName, int entitySourceID, float classID, int entityTargetID, bool fireEvent = true, bool isMelee = false, int entityNPC = -1, bool fromOtherDamage = false, bool skipCooldown = false, bool isPrimaryAttack = true)
{
//Log.Out("RebirthUtilities-SetAuraChance START, itemClassName: " + itemClassName);
ItemClass itemClass = ItemClass.GetItem(itemClassName, false).ItemClass;
List<string> tagNames = itemClass.ItemTags.GetTagNames();
if (RebirthUtilities.ScenarioSkip() || (hasTag(tagNames, "motorTool") && !fromOtherDamage))
{
return;
}
EntityAlive __instance = GameManager.Instance.World.GetEntity(entitySourceID) as EntityAlive;
if (__instance == null)
{
//Log.Out("RebirthUtilities-SetAuraChance exit");
return;
}
EntityAlive npc = null;
if (entityNPC > 0)
{
npc = GameManager.Instance.World.GetEntity(entityNPC) as EntityAlive;
//Log.Out("RebirthUtilities-SetAuraChance entityClassName: " + npc.EntityClass.entityClassName);
}
/*if (npc && hasTag(tagNames, "melee"))
{
return;
}*/
EntityAlive target = null;
if (entityTargetID != -1)
{
//Log.Out("RebirthUtilities-SetAuraChance A, entityTargetID: " + entityTargetID);
target = GameManager.Instance.World.GetEntity(entityTargetID) as EntityAlive;
}
string playerClass = GetClassNameFromID(classID);
ItemValue itemRanged = ItemClass.GetItem(itemClass.GetItemName(), false);
float roundsPerMinute = 60;
int numMagazineSize = 1;
ItemActionRanged myAction = null;
if (!fromOtherDamage && !isMelee)
{
//Log.Out("RebirthUtilities-SetAuraChance B1");
if (itemClassName.ToLower().Contains("gunnpc"))
{
if (npc)
{
//Log.Out("RebirthUtilities-SetAuraChance itemClassName: " + itemClassName);
//Log.Out("RebirthUtilities-SetAuraChance GetItemName: " + itemClass.GetItemName());
//Log.Out("RebirthUtilities-SetAuraChance Class Name: " + itemClass.Name);
myAction = (ItemActionRanged)itemClass.Actions[1];
//Log.Out("RebirthUtilities-SetAuraChance myAction: " + myAction);
//Log.Out("RebirthUtilities-SetAuraChance npc.inventory.holdingItemData.actionData.Count: " + npc.inventory.holdingItemData.actionData.Count);
//Log.Out("RebirthUtilities-SetAuraChance npc.inventory.holdingItem.GetItemName(): " + npc.inventory.holdingItem.GetItemName());
ItemActionData _actionData = npc.inventory.holdingItemData.actionData[1];
if (_actionData != null && _actionData.GetType() is ItemActionRanged.ItemActionDataRanged)
{
ItemActionRanged.ItemActionDataRanged itemActionDataRanged = (ItemActionRanged.ItemActionDataRanged)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.RoundsPerMinute, itemActionDataRanged.invData.itemValue, 60f / itemActionDataRanged.OriginalDelay, itemActionDataRanged.invData.holdingEntity);
roundsPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance B2 A, roundsPerMinute: " + roundsPerMinute);
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance _actionData.GetType(): " + _actionData.GetType());
}
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance B2 B");
return;
}
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance B2 C");
if ((itemClassName == "gunBotT2JunkTurret" && __instance.inventory.holdingItem.GetItemName() != "gunBotT2JunkTurret") ||
(itemClassName.ToLower().StartsWith("furiousramsayjunkturret") && !itemClassName.ToLower().StartsWith("furiousramsayjunkturretsledge"))
)
{
//Log.Out("RebirthUtilities-SetAuraChance B2 C1");
myAction = (ItemActionRanged)itemClass.Actions[0];
roundsPerMinute = 180;
if (__instance.Buffs.HasBuff("FuriousRamsayRampage"))
{
//Log.Out("RebirthUtilities-SetAuraChance B2 C2");
roundsPerMinute = roundsPerMinute * 3;
}
}
else if ((itemClassName == "gunBotT1JunkSledge" && __instance.inventory.holdingItem.GetItemName() != "gunBotT1JunkSledge") ||
(itemClassName.ToLower().StartsWith("furiousramsayjunkturretsledge"))
)
{
//Log.Out("RebirthUtilities-SetAuraChance B2 C1");
myAction = (ItemActionRanged)itemClass.Actions[0];
roundsPerMinute = 50;
if (__instance.Buffs.HasBuff("FuriousRamsayRampage"))
{
//Log.Out("RebirthUtilities-SetAuraChance B2 C3");
roundsPerMinute = roundsPerMinute * 3;
}
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance B2 C4, itemClass: " + itemClass.Name);
myAction = (ItemActionRanged)itemClass.Actions[0];
ItemActionData _actionData = __instance.inventory.holdingItemData.actionData[0];
if (_actionData != null)
{
ItemActionRanged.ItemActionDataRanged itemActionDataRanged = (ItemActionRanged.ItemActionDataRanged)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.RoundsPerMinute, itemActionDataRanged.invData.itemValue, 60f / itemActionDataRanged.OriginalDelay, __instance);
roundsPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance B2 C5, roundsPerMinute: " + roundsPerMinute);
}
}
}
//Log.Out("RebirthUtilities-SetAuraChance B3");
if (myAction == null)
{
//Log.Out("RebirthUtilities-SetAuraChance C");
return;
}
//Log.Out("RebirthUtilities-SetAuraChance roundsPerMinute: " + roundsPerMinute);
numMagazineSize = (int)EffectManager.GetValue(PassiveEffects.MagazineSize, itemRanged, myAction.BulletsPerMagazine, __instance, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
//Log.Out("RebirthUtilities-SetAuraChance numMagazineSize: " + numMagazineSize);
if (numMagazineSize == 1)
{
//Log.Out("RebirthUtilities-SetAuraChance E");
roundsPerMinute = 60;
}
}
bool isBerserker = playerClass.ToLower() == "berserker";
//Log.Out("RebirthUtilities-SetAuraChance playerClass: " + playerClass);
//Log.Out("RebirthUtilities-SetAuraChance isBerserker: " + isBerserker);
//Log.Out("RebirthUtilities-SetAuraChance isMelee: " + isMelee);
//Log.Out("RebirthUtilities-SetAuraChance fromOtherDamage: " + fromOtherDamage);
bool isTurret = hasTag(tagNames, "CurrentWeaponDeployableTurrets");
string BerserkerAura = "";
if (isBerserker && isMelee && !fromOtherDamage && !isTurret)
{
//Log.Out("RebirthUtilities-SetAuraChance: Berserker + Melee DETECTED.");
// a) Identify which localExpertiseClass key matches our current item tag.
// Example logic: look for "WeaponKnuckles", "WeaponSwords", etc.,
// strip off “Weapon”, “Tier1”, etc. and see if that key is in localExpertiseClass.
string foundWeaponType = "";
foreach (var tag in tagNames)
{
if (tag.StartsWith("Weapon"))
{
// e.g. "WeaponKnucklesTier2" => "Knuckles"
string raw = tag.Replace("Weapon", "")
.Replace("Tier1", "")
.Replace("Tier2", "")
.Replace("Tier3", "");
// If that raw is in localExpertiseClass, we store it
if (RebirthVariables.localExpertiseClass.ContainsKey(raw))
{
foundWeaponType = raw;
break;
}
}
}
if (string.IsNullOrEmpty(foundWeaponType))
{
//Log.Out("RebirthUtilities-SetAuraChance: Could not find a matching weapon type for Berserker!");
// Possibly we bail out or do default handling
return;
}
// b) The dictionary says: "Knuckles" => "Madman", or "Swords" => "Butcher", etc.
// We want to see if there's any localAuras that belongs to that same class.
string auraClass = RebirthVariables.localExpertiseClass[foundWeaponType];
//Log.Out($"RebirthUtilities-SetAuraChance: foundWeaponType={foundWeaponType}, auraClass={auraClass}");
var auraMatches = RebirthVariables.localAuras
.Where(kvp => kvp.Value.className.Equals(auraClass, StringComparison.OrdinalIgnoreCase))
.Select(kvp => kvp.Key)
.ToList();
if (!auraMatches.Any())
{
//Log.Out($"RebirthUtilities-SetAuraChance: No auras found for class={auraClass}");
return;
}
/////////////////
float attacksPerMinute = 60;
float chanceMultiplier = 1;
if (isPrimaryAttack)
{
ItemActionData _actionData = __instance.inventory.holdingItemData.actionData[0];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
ItemActionDynamicMelee.ItemActionDynamicMeleeData itemActionData = (ItemActionDynamicMelee.ItemActionDynamicMeleeData)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, __instance, tags: tags);
attacksPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance 1 attacksPerMinute: " + attacksPerMinute);
}
//Log.Out("RebirthUtilities-SetAuraChance IS PRIMARY ATTACK: " + chanceMultiplier);
chanceMultiplier = chanceMultiplier * 3 / 4;
}
else
{
ItemActionData _actionData = __instance.inventory.holdingItemData.actionData[1];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
ItemActionDynamicMelee.ItemActionDynamicMeleeData itemActionData = (ItemActionDynamicMelee.ItemActionDynamicMeleeData)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, __instance, tags: tags);
attacksPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance 3 attacksPerMinute: " + attacksPerMinute);
}
//Log.Out("RebirthUtilities-SetAuraChance IS SECONDARY ATTACK: " + chanceMultiplier);
}
/////////////////
// d) For each matching aura, do the usual chance calculation
// but tie the “level” to the players melee skill or some other progression
// that you want. In your example, you might do:
foreach (var auraKey in auraMatches)
{
var auraData = RebirthVariables.localAuras[auraKey];
int meleeSkillLevel = 0;
// Suppose you store your Berserkers “Melee” progression in "FuriousRamsayPerkMelee"
//Log.Out($"RebirthUtilities-SetAuraChance auraData.weaponPerkName={auraData.weaponPerkName}");
ProgressionValue pVal = __instance.Progression.GetProgressionValue(auraData.weaponPerkName);
if (pVal != null)
meleeSkillLevel = pVal.Level;
//Log.Out($"RebirthUtilities-SetAuraChance meleeSkillLevel={meleeSkillLevel}");
// e) Compute chance similarly to how your original code does it
float auraProgressionLevel = meleeSkillLevel;
//Log.Out($"RebirthUtilities-SetAuraChance auraProgressionLevel={auraProgressionLevel}");
// If you want a special “meleeChance” multiplier:
float chance = auraData.meleeChance;
float maxChance = auraData.baseChancePerLevel * 10;
chance = (chanceMultiplier * chance * 180) / attacksPerMinute;
//Log.Out($"RebirthUtilities-SetAuraChance chanceMultiplier={chanceMultiplier}");
//Log.Out($"RebirthUtilities-SetAuraChance meleeChance={auraData.meleeChance}");
//Log.Out($"RebirthUtilities-SetAuraChance maxChance={maxChance}");
//Log.Out($"RebirthUtilities-SetAuraChance attacksPerMinute={attacksPerMinute}");
//Log.Out($"RebirthUtilities-SetAuraChance chance={chance}");
// Then apply your usual clamp logic, fromOtherDamage logic,
// FuriousRamsayFullAura logic, etc.
// The difference: We do not check for an active buff named
// "FuriousRamsayBuffXXXAura" for Berserker+Melee.
// EXAMPLE:
if (chance > maxChance) chance = maxChance;
if (RebirthVariables.testAuras)
{
chance = 100f;
}
//Log.Out($"Berserker + Melee => auraKey={auraKey}, finalChance={chance}");
if (target != null && __instance.rand.RandomRange(0, 100) < chance)
{
// Actually apply the buff to the target, or to the player,
// or do your “AddBuff” calls, etc.
string playerBuff = auraData.playerBuff;
string targetPlayerBuff = auraData.targetPlayerBuff;
string targetBuff = auraData.targetBuff;
BerserkerAura = targetBuff;
//Log.Out("RebirthUtilities-SetAuraChance fireEvent D");
//Log.Out("RebirthUtilities-SetAuraChance useTargetBuffLevels: " + RebirthVariables.localAuras[auraKey].useTargetBuffLevels);
if (playerBuff.Trim().Length > 0)
{
if (RebirthVariables.localAuras[auraKey].useTargetBuffLevels)
{
playerBuff = playerBuff + auraProgressionLevel;
}
//Log.Out("RebirthUtilities-SetAuraChance fireEvent E");
if (npc)
{
npc.Buffs.AddBuff(playerBuff);
}
else
{
__instance.Buffs.AddBuff(playerBuff);
}
break;
}
//Log.Out("RebirthUtilities-SetAuraChance playerBuff: " + playerBuff);
if (targetBuff.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SetAuraChance fireEvent F");
if (targetPlayerBuff.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SetAuraChance fireEvent G");
__instance.Buffs.AddBuff(targetPlayerBuff);
EntityPlayerLocal playerLocal = (EntityPlayerLocal)__instance;
AddBuffToGroups(playerLocal, targetPlayerBuff, true, true);
}
if (RebirthVariables.localAuras[auraKey].useTargetBuffLevels)
{
targetBuff = targetBuff + auraProgressionLevel;
}
else
{
if (auraProgressionLevel == 0)
{
targetBuff = "";
}
}
if (targetBuff == "FuriousRamsayAddExplosionDamage")
{
target.Buffs.AddBuff("FuriousRamsayCounterResistSmoke");
}
target.Buffs.AddBuff(targetBuff, __instance.entityId);
}
//Log.Out("RebirthUtilities-SetAuraChance targetPlayerBuff: " + targetPlayerBuff);
//Log.Out("RebirthUtilities-SetAuraChance targetBuff: " + targetBuff);
}
}
// Since we are done with Berserker+Melee, we can return here if thats all you needed
//return;
}
for (int i = 0; i < RebirthVariables.localAuraChances.Count; i++)
{
string auraKey = RebirthVariables.localAuraChances.ElementAt(i).Key;
if (entityNPC > 0 && RebirthVariables.localAuraChances.ElementAt(i).Value == 2)
{
//Log.Out("RebirthUtilities-SetAuraChance CONTINUE, auraKey: " + auraKey);
//Log.Out("RebirthUtilities-SetAuraChance CONTINUE, entityNPC: " + entityNPC);
continue;
}
for (int l = 0; l < __instance.Buffs.ActiveBuffs.Count; l++)
{
BuffValue buffValue = __instance.Buffs.ActiveBuffs[l];
if (buffValue != null && buffValue.BuffClass != null)
{
//Log.Out("RebirthUtilities-SetAuraChance 1");
BuffClass buffClass = buffValue.BuffClass;
float chance = 0;
int auraProgressionLevel = 0;
bool bSword = hasTag(tagNames, "weapontier1swords");
//Log.Out("RebirthUtilities-SetAuraChance bSword: " + bSword);
//Log.Out("RebirthUtilities-SetAuraChance auraKey: " + auraKey);
//Log.Out("RebirthUtilities-SetAuraChance buffClass: " + buffClass.Name.ToLower());
/*if (bSword && auraKey != "RangedBleed")
{
//Log.Out("RebirthUtilities-SetAuraChance CONTINUE");
continue;
}*/
if (buffClass.Name.ToLower().Contains(("furiousramsaybuff" + auraKey.ToLower() + "aura").ToLower()))
{
//Log.Out("RebirthUtilities-SetAuraChance 2");
bool isOwner = false;
if (buffClass.Name.ToLower() == ("furiousramsaybuff" + auraKey.ToLower() + "aura").ToLower())
{
//Log.Out("RebirthUtilities-SetAuraChance 3");
string progression = RebirthVariables.localAuras[auraKey].progressionName;
ProgressionValue auraProgressionValue = __instance.Progression.GetProgressionValue(progression);
auraProgressionLevel = auraProgressionValue.Level;
isOwner = true;
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance 4");
auraProgressionLevel = int.Parse(buffClass.Name.ToLower().Replace(("furiousramsaybuff" + auraKey.ToLower() + "aura").ToLower(), ""));
}
bool foundWeapon = false;
string weapon = "";
//Log.Out("RebirthUtilities-SetAuraChance isOwner: " + isOwner);
foreach (string key in RebirthVariables.localExpertiseClass.Keys)
{
//Log.Out("RebirthUtilities-SetAuraChance key: " + key);
if (RebirthVariables.localExpertiseClass[key] == playerClass)
{
//Log.Out("RebirthUtilities-SetAuraChance key == playerClass");
for (int k = 0; k < tagNames.Count; k++)
{
//Log.Out("RebirthUtilities-SetAuraChance tagNames[k]: " + tagNames[k]);
if (tagNames[k].StartsWith("Weapon"))
{
weapon = tagNames[k].Replace("Weapon", "").Replace("Tier1", "").Replace("Tier2", "").Replace("Tier3", "");
//Log.Out("RebirthUtilities-SetAuraChance weapon: " + weapon);
if (weapon == key)
{
foundWeapon = true;
//Log.Out("RebirthUtilities-SetAuraChance foundWeapon: " + foundWeapon);
break;
}
}
}
}
if (foundWeapon)
{
break;
}
}
chance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].chancePerLevel * 60 / roundsPerMinute;
float baseChance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].baseChancePerLevel;
//Log.Out("RebirthUtilities-SetAuraChance A0 chance: " + chance);
if (isMelee)
{
chance = auraProgressionLevel * RebirthVariables.localAuras[auraKey].meleeChance * 60 / roundsPerMinute;
//Log.Out("RebirthUtilities-SetAuraChance A1 chance: " + chance);
}
//Log.Out("RebirthUtilities-SetAuraChance A2 chance: " + chance);
//Log.Out("RebirthUtilities-SetAuraChance A baseChance: " + baseChance);
if (RebirthVariables.localAuras[auraKey].overrideChance)
{
//Log.Out("RebirthUtilities-SetAuraChance overrideChance");
chance = 10 * RebirthVariables.localAuras[auraKey].chancePerLevel * 60 / roundsPerMinute;
baseChance = 10 * RebirthVariables.localAuras[auraKey].baseChancePerLevel;
//Log.Out("RebirthUtilities-SetAuraChance B chance: " + chance);
//Log.Out("RebirthUtilities-SetAuraChance B baseChance: " + baseChance);
if (isMelee)
{
chance = 10 * RebirthVariables.localAuras[auraKey].meleeChance * 60 / roundsPerMinute;
chance = chance / 10f;
//Log.Out("RebirthUtilities-SetAuraChance C chance: " + chance);
}
}
if (!isOwner)
{
chance *= 0.8f;
//Log.Out("RebirthUtilities-SetAuraChance D chance: " + chance);
}
else
{
if (!foundWeapon)
{
chance *= 0.8f;
//Log.Out("RebirthUtilities-SetAuraChance E chance: " + chance);
}
}
if (!fromOtherDamage && isMelee && itemClassName != "gunBotT2JunkTurret") //) && !hasTag(tagNames, "CurrentWeaponDeployableTurrets"))
{
float activeClassID = __instance.Buffs.GetCustomVar("$ActiveClass_FR");
bool bSpear = hasTag(tagNames, "weapontier1spears");
bool bClub = hasTag(tagNames, "weapontier1clubs");
bSword = hasTag(tagNames, "weapontier1swords");
bool bAxe = hasTag(tagNames, "weapontier1axes");
bool bBaton = hasTag(tagNames, "weapontier1batons");
bool bKnuckles = hasTag(tagNames, "weapontier1knuckles");
bool bHammer = hasTag(tagNames, "weapontier1hammers");
bool bKnife = hasTag(tagNames, "weapontier1knives");
bool bTurret = hasTag(tagNames, "weapontier3deployableturrets");
//Log.Out("EntityAlivePatches-FireEvent bSword:" + bSword);
//Log.Out("EntityAlivePatches-FireEvent activeClassID: " + activeClassID);
bool isMeleeTrigger = (activeClassID == 1 && bSpear) ||
(activeClassID == 2 && bClub) ||
(activeClassID == 3 && bSword) ||
(activeClassID == 4 && bAxe) ||
(activeClassID == 5 && (bBaton || bTurret)) ||
(activeClassID == 6 && bKnuckles) ||
(activeClassID == 7 && bHammer) ||
(activeClassID == 8 && bKnife) ||
activeClassID == 10;
//Log.Out("RebirthUtilities-SetAuraChance isMeleeTrigger: " + isMeleeTrigger);
float attacksPerMinute = 60;
if (bTurret)
{
attacksPerMinute = 60f;
if (__instance.Buffs.HasBuff("FuriousRamsayRampage"))
{
attacksPerMinute = attacksPerMinute * 3;
}
}
else
{
if (isPrimaryAttack)
{
if (npc)
{
ItemActionData _actionData = npc.inventory.holdingItemData.actionData[0];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
//Log.Out("RebirthUtilities-SetAuraChance 0 _actionData.invData.itemValue.ItemClass.Name: " + _actionData.invData.itemValue.ItemClass.Name);
ItemActionMelee.InventoryDataMelee itemActionData = (ItemActionMeleeSDX.InventoryDataMelee)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, npc, tags: tags);
attacksPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance 0 attacksPerMinute: " + attacksPerMinute);
}
chance = chance * 3 / 4;
}
else
{
ItemActionData _actionData = __instance.inventory.holdingItemData.actionData[0];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
ItemActionDynamicMelee.ItemActionDynamicMeleeData itemActionData = (ItemActionDynamicMelee.ItemActionDynamicMeleeData)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, __instance, tags: tags);
attacksPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance 1 attacksPerMinute: " + attacksPerMinute);
}
chance = chance * 3 / 4;
}
//Log.Out("RebirthUtilities-SetAuraChance IS PRIMARY ATTACK: " + chance);
}
else
{
if (npc)
{
ItemActionData _actionData = npc.inventory.holdingItemData.actionData[0];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
ItemActionMelee.InventoryDataMelee itemActionData = (ItemActionMeleeSDX.InventoryDataMelee)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, npc, tags: tags);
attacksPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance 2 attacksPerMinute: " + attacksPerMinute);
}
}
else
{
ItemActionData _actionData = __instance.inventory.holdingItemData.actionData[1];
if (_actionData != null)
{
FastTags<TagGroup.Global> tags = _actionData.indexInEntityOfAction == 0 ? FastTags<TagGroup.Global>.Parse("primary") : FastTags<TagGroup.Global>.Parse("secondary");
ItemActionDynamicMelee.ItemActionDynamicMeleeData itemActionData = (ItemActionDynamicMelee.ItemActionDynamicMeleeData)_actionData;
float myDelay = 60f / EffectManager.GetValue(PassiveEffects.AttacksPerMinute, itemActionData.invData.itemValue, 60f, __instance, tags: tags);
attacksPerMinute = 60 / myDelay;
//Log.Out("RebirthUtilities-SetAuraChance 3 attacksPerMinute: " + attacksPerMinute);
}
}
//Log.Out("RebirthUtilities-SetAuraChance IS SECONDARY ATTACK: " + chance);
}
}
chance = chance * 180 / attacksPerMinute;
//Log.Out("RebirthUtilities-SetAuraChance F chance: " + chance);
if (!isMeleeTrigger)
{
chance = chance * 3 / 4;
//Log.Out("RebirthUtilities-SetAuraChance G chance: " + chance);
}
}
if (chance > baseChance)
{
chance = baseChance;
//Log.Out("RebirthUtilities-SetAuraChance H chance: " + chance);
}
if ((classID == 1 && itemClass.ItemTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("CurrentWeaponBows"))) ||
(classID == 5 && itemClass.ItemTags.Test_AllSet(FastTags<TagGroup.Global>.Parse("CurrentWeaponRevolvers"))))
{
//chance *= 2f;
}
if (entityNPC > 0 && chance < 5)
{
chance = 5;
}
if (chance > 20f)
{
chance = 20f;
//Log.Out("RebirthUtilities-SetAuraChance I chance: " + chance);
}
if (fromOtherDamage)
{
chance = 100f;
}
if (__instance.Buffs.HasBuff("FuriousRamsayFullAura"))
{
chance = 100 * 250 / roundsPerMinute;
if (chance > 100)
{
chance = 100;
}
}
float triggerChance = __instance.Buffs.GetCustomVar("$AuraSelfDamageOtherIncrease");
if (triggerChance > 0)
{
chance = chance + (chance * triggerChance);
//Log.Out("RebirthUtilities-SetAuraChance J chance: " + chance);
}
//Log.Out("RebirthUtilities-SetAuraChance A chancePerLevel: " + RebirthVariables.localAuras[auraKey].chancePerLevel);
//Log.Out("RebirthUtilities-SetAuraChance A baseChancePerLevel: " + RebirthVariables.localAuras[auraKey].baseChancePerLevel);
//Log.Out("RebirthUtilities-SetAuraChance A roundsPerMinute: " + roundsPerMinute);
//Log.Out("RebirthUtilities-SetAuraChance A auraProgressionLevel: " + auraProgressionLevel);
//Log.Out("RebirthUtilities-SetAuraChance A chance: " + chance);
//Log.Out("RebirthUtilities-SetAuraChance A baseChance: " + baseChance);
//Log.Out("RebirthUtilities-SetAuraChance A fireEvent: " + fireEvent);
if (fireEvent)
{
//Log.Out("RebirthUtilities-SetAuraChance fireEvent A");
string targetBuff = RebirthVariables.localAuras[auraKey].targetBuff;
string playerBuff = RebirthVariables.localAuras[auraKey].playerBuff;
string cooldownBuff = "FuriousRamsayDamagedCooldown" + auraKey;//RebirthVariables.localAuras[auraKey].cooldownBuff;
//Log.Out("RebirthUtilities-SetAuraChance fireEvent cooldownBuff: " + cooldownBuff);
string targetPlayerBuff = RebirthVariables.localAuras[auraKey].targetPlayerBuff;
int random = __instance.rand.RandomRange(0, 100);
bool mustSkip = false;
if (fromOtherDamage)
{
//Log.Out("RebirthUtilities-SetAuraChance fromOtherDamage: " + fromOtherDamage);
if (npc)
{
if (!npc.Buffs.HasBuff(cooldownBuff))
{
//Log.Out("RebirthUtilities-SetAuraChance AA3");
npc.Buffs.AddBuff(cooldownBuff);
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance AA4");
mustSkip = true;
}
}
else
{
if (!__instance.Buffs.HasBuff(cooldownBuff))
{
//Log.Out("RebirthUtilities-SetAuraChance AA3");
if (!skipCooldown)
{
__instance.Buffs.AddBuff(cooldownBuff);
}
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance AA4");
mustSkip = true;
}
}
}
if (isBerserker && BerserkerAura == targetBuff)
{
//Log.Out("RebirthUtilities-SetAuraChance AA5");
mustSkip = true;
}
//Log.Out("RebirthUtilities-SetAuraChance random: " + random);
//Log.Out("RebirthUtilities-SetAuraChance chance: " + chance);
//Log.Out("RebirthUtilities-SetAuraChance mustSkip: " + mustSkip);
if (npc)
{
chance = chance * 0.67f;
}
if (RebirthVariables.testAuras)
{
chance = 100f;
}
if (random < chance && target != null && !mustSkip)
{
//Log.Out("RebirthUtilities-SetAuraChance fireEvent B");
bool canTrigger = true;
//Log.Out("RebirthUtilities-SetAuraChance canTrigger: " + canTrigger);
if (canTrigger)
{
//Log.Out("RebirthUtilities-SetAuraChance fireEvent D");
//Log.Out("RebirthUtilities-SetAuraChance playerBuff: " + playerBuff);
//Log.Out("RebirthUtilities-SetAuraChance targetPlayerBuff: " + targetPlayerBuff);
//Log.Out("RebirthUtilities-SetAuraChance targetBuff: " + targetBuff);
if (playerBuff.Trim().Length > 0)
{
if (RebirthVariables.localAuras[auraKey].useTargetBuffLevels)
{
playerBuff = playerBuff + auraProgressionLevel;
}
//Log.Out("RebirthUtilities-SetAuraChance fireEvent E");
if (npc)
{
npc.Buffs.AddBuff(playerBuff);
}
else
{
__instance.Buffs.AddBuff(playerBuff);
}
break;
}
if (targetBuff.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SetAuraChance fireEvent F");
if (targetPlayerBuff.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SetAuraChance fireEvent G");
__instance.Buffs.AddBuff(targetPlayerBuff);
EntityPlayerLocal playerLocal = (EntityPlayerLocal)__instance;
AddBuffToGroups(playerLocal, targetPlayerBuff, true, true);
}
if (RebirthVariables.localAuras[auraKey].useTargetBuffLevels)
{
targetBuff = targetBuff + auraProgressionLevel;
}
if (targetBuff == "FuriousRamsayAddExplosionDamage")
{
target.Buffs.AddBuff("FuriousRamsayCounterResistSmoke");
}
target.Buffs.AddBuff(targetBuff, __instance.entityId);
if (fromOtherDamage)
{
//Log.Out("RebirthUtilities-SetAuraChance fromOtherDamage 3");
if (target is EntityZombieSDX)
{
//Log.Out("RebirthUtilities-SetAuraChance fromOtherDamage 4");
}
}
}
}
}
}
else
{
//Log.Out("RebirthUtilities-SetAuraChance B roundsPerMinute: " + roundsPerMinute);
//Log.Out("RebirthUtilities-SetAuraChance B chance: " + chance);
//Log.Out("RebirthUtilities-SetAuraChance B AURA: " + "$varFuriousRamsay" + auraKey + "AuraBase_Cst");
/*//Log.Out("StackTrace: '{0}'", Environment.StackTrace);*/
RebirthVariables.localConstants["$varFuriousRamsay" + auraKey + "Aura_Cst"] = chance;
RebirthVariables.localConstants["$varFuriousRamsay" + auraKey + "Aura2_Cst"] = chance * 2;
RebirthVariables.localConstants["$varFuriousRamsay" + auraKey + "AuraBase_Cst"] = baseChance;
RebirthVariables.localConstants["$varFuriousRamsay" + auraKey + "AuraBase2_Cst"] = baseChance * 2;
}
}
}
}
}
}
public static void AddBuffToGroups(EntityPlayerLocal playerLocal, string targetPlayerBuff, bool followers = false, bool party = false)
{
if (playerLocal != null)
{
if (followers)
{
// NPCs
for (int j = 0; j < playerLocal.Companions.Count; j++)
{
EntityNPCRebirth companion = playerLocal.Companions[j] as EntityNPCRebirth;
companion.Buffs.AddBuff(targetPlayerBuff);
}
}
if (party)
{
// PARTY MEMBERS
if (playerLocal.Party != null)
{
if (playerLocal.Party.MemberList != null)
{
for (int j = 0; j < playerLocal.Party.MemberList.Count; j++)
{
EntityPlayer partyMember = playerLocal.Party.MemberList[j];
partyMember.Buffs.AddBuff(targetPlayerBuff);
}
}
}
}
}
}
public static void ProcessAttribute(EntityAlive ___entityPlayerLocal, string cvar, bool forceUpdate = false)
{
if (GameUtils.IsWorldEditor() || GameUtils.IsPlaytesting())
{
return;
}
int units = 0;
bool progressionChanged = false;
////Log.Out("RebirthUtilities-ProcessAttribute cvar: " + cvar);
if (cvar.EndsWith("PercUnit"))
{
if (!ScenarioSkip() && HasOtherKey(cvar))
{
////Log.Out("RebirthUtilities-ProcessAttribute IS OTHER");
string other = cvar.Replace("PercUnit", "").Replace("$varFuriousRamsay", "");
////Log.Out("RebirthUtilities-ProcessAttribute other: " + other);
float number = RebirthVariables.localVariables[cvar];
foreach (string key in RebirthVariables.localOtherCrafting.Keys)
{
////Log.Out("RebirthUtilities-ProcessAttribute key: " + key);
if (key == other)
{
////Log.Out("RebirthUtilities-ProcessAttribute key == other");
List<categoryCrafting> OtherCraftingList = RebirthVariables.localOtherCrafting[key];
foreach (categoryCrafting craftingList in OtherCraftingList)
{
ProgressionValue craftingProgressionValue = ___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk);
int craftingProgressionLevel = craftingProgressionValue.Level;
////Log.Out("RebirthUtilities-ProcessAttribute craftingProgressionLevel: " + craftingProgressionLevel);
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
////Log.Out("RebirthUtilities-ProcessAttribute craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
////Log.Out("RebirthUtilities-ProcessAttribute craftingLevel.craftingLevel: " + craftingLevel.craftingLevel);
if (number >= craftingLevel.categoryLevel &&
craftingProgressionLevel < craftingLevel.craftingLevel
)
{
////Log.Out("RebirthUtilities-ProcessAttribute GO UP!");
craftingProgressionValue.Level = craftingLevel.craftingLevel;
EntityPlayerLocal entityPlayerLocal = (EntityPlayerLocal)___entityPlayerLocal;
entityPlayerLocal.PlayerUI.xui.CollectedItemList.AddCraftingSkillNotification(craftingProgressionValue, false);
////Log.Out("RebirthUtilities-ProcessAttribute craftingProgressionLevel: " + craftingProgressionLevel);
////Log.Out("RebirthUtilities-ProcessAttribute craftingLevel.craftingLevel: " + craftingLevel.craftingLevel);
craftingProgressionValue.ProgressionClass.HandleCheckCrafting(entityPlayerLocal, craftingProgressionLevel, craftingLevel.craftingLevel);
progressionChanged = true;
break;
}
}
}
}
}
}
else if (HasGeneticsKey(cvar))
{
////Log.Out("RebirthUtilities-ProcessAttribute IS GENETICS");
string genetic = cvar.Replace("PercUnit", "").Replace("$varFuriousRamsay", "");
////Log.Out("RebirthUtilities-ProcessAttribute genetic: " + genetic);
float number = RebirthVariables.localVariables[cvar];
units = (int)number;
////Log.Out("RebirthUtilities-ProcessAttribute number: " + number);
////Log.Out("RebirthUtilities-ProcessAttribute units: " + units);
ProgressionValue progressionValue = ___entityPlayerLocal.Progression.GetProgressionValue("attfortitude");
int progressionLevel = progressionValue.Level;
RebirthVariables.localConstants[cvar.Replace("PercUnit", "Lvl")] = units;
if (progressionLevel < units && progressionLevel < 10)
{
progressionValue.Level = units;
progressionChanged = true;
GameManager.ShowTooltip(___entityPlayerLocal as EntityPlayerLocal, "Your [3cf7fa]" + genetic + "[-] is now [9eff3d]Level " + units + "[-]", string.Empty, "FuriousRamsayPerkLevelUp", null);
}
if (!ScenarioSkip())
{
foreach (string key in RebirthVariables.localGeneticsCrafting.Keys)
{
////Log.Out("RebirthUtilities-ProcessAttribute key: " + key);
if (key == genetic)
{
////Log.Out("RebirthUtilities-ProcessAttribute key == genetic");
List<categoryCrafting> GeneticsCraftingList = RebirthVariables.localGeneticsCrafting[key];
foreach (categoryCrafting craftingList in GeneticsCraftingList)
{
////Log.Out("RebirthUtilities-ProcessAttribute craftingList.craftingPerk: " + craftingList.craftingPerk);
ProgressionValue craftingProgressionValue = ___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk);
int craftingProgressionLevel = craftingProgressionValue.Level;
////Log.Out("RebirthUtilities-ProcessAttribute craftingProgressionLevel: " + craftingProgressionLevel);
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
////Log.Out("RebirthUtilities-ProcessAttribute craftingLevel.categoryLevel: " + craftingLevel.categoryLevel);
////Log.Out("RebirthUtilities-ProcessAttribute craftingLevel.craftingLevel: " + craftingLevel.craftingLevel);
if (number >= craftingLevel.categoryLevel &&
craftingProgressionLevel < craftingLevel.craftingLevel
)
{
////Log.Out("RebirthUtilities-ProcessAttribute GO UP!");
craftingProgressionValue.Level = craftingLevel.craftingLevel;
EntityPlayerLocal entityPlayerLocal = (EntityPlayerLocal)___entityPlayerLocal;
entityPlayerLocal.PlayerUI.xui.CollectedItemList.AddCraftingSkillNotification(craftingProgressionValue, false);
////Log.Out("RebirthUtilities-ProcessAttribute craftingProgressionLevel: " + craftingProgressionLevel);
////Log.Out("RebirthUtilities-ProcessAttribute craftingLevel.craftingLevel: " + craftingLevel.craftingLevel);
craftingProgressionValue.ProgressionClass.HandleCheckCrafting(entityPlayerLocal, craftingProgressionLevel, craftingLevel.craftingLevel);
progressionChanged = true;
break;
}
}
}
}
}
}
}
else if (!ScenarioSkip())
{
////Log.Out("RebirthUtilities-ProcessAttribute IS CLASS OR EXPERTISE");
float flClass = ___entityPlayerLocal.Buffs.GetCustomVar("$ActiveClass_FR");
bool isClass = false;
string playerClass = "";
float progressionMax = 10;
foreach (string key in RebirthVariables.localClasses.Keys)
{
if (cvar.Contains(key))
{
isClass = true;
playerClass = key;
////Log.Out("RebirthUtilities-ProcessAttribute FOUND CLASS: " + playerClass);
progressionMax = GetClassProgressionMax(key);
break;
}
}
if (isClass)
{
////Log.Out("RebirthUtilities-ProcessAttribute IS CLASS");
units = (int)RebirthVariables.localVariables[cvar];
////Log.Out("RebirthUtilities-ProcessAttribute cvar: " + cvar);
////Log.Out("RebirthUtilities-ProcessAttribute localVariables[cvar]: " + RebirthVariables.localVariables[cvar]);
ProgressionValue progressionValue = ___entityPlayerLocal.Progression.GetProgressionValue("furiousramsayatt" + playerClass.ToLower());
int progressionLevel = progressionValue.Level;
foreach (string localExpertiseLevelWithClass in RebirthVariables.localExpertiseLevelWithClass.Keys)
{
if (localExpertiseLevelWithClass == playerClass)
{
ProgressionValue classProgressionValue = ___entityPlayerLocal.Progression.GetProgressionValue("FuriousRamsayPerk" + RebirthVariables.localExpertiseLevelWithClass[localExpertiseLevelWithClass]);
classProgressionValue.Level = progressionLevel;
if (RebirthUtilities.IsClassActive(10))
{
////Log.Out("RebirthUtilities-ProcessAttribute FuriousRamsayBeserkerRageTier: " + progressionLevel);
___entityPlayerLocal.Buffs.RemoveBuff("FuriousRamsayBeserkerRageTier" + (progressionLevel - 1));
___entityPlayerLocal.Buffs.AddBuff("FuriousRamsayBeserkerRageTier" + progressionLevel);
}
////Log.Out("RebirthUtilities-ProcessAttribute localExpertiseLevelWithClass: " + RebirthVariables.localExpertiseLevelWithClass[localExpertiseLevelWithClass]);
foreach (string expertiseTierKey in RebirthVariables.localExpertiseTier.Keys)
{
////Log.Out("RebirthUtilities-ProcessAttribute expertiseTierKey: " + expertiseTierKey);
if (expertiseTierKey == RebirthVariables.localExpertiseLevelWithClass[localExpertiseLevelWithClass])
{
RebirthVariables.localConstants["$varFuriousRamsayPerk" + RebirthVariables.localExpertiseTier[expertiseTierKey] + "PercUnit"] = RebirthVariables.localVariables["$varFuriousRamsay" + playerClass + "PercUnit"];
RebirthVariables.localVariables["$varFuriousRamsay" + expertiseTierKey + "PercUnit"] = RebirthVariables.localVariables["$varFuriousRamsay" + playerClass + "PercUnit"];
////Log.Out("RebirthUtilities-ProcessAttribute $varFuriousRamsay" + expertiseTierKey + "PercUnit: " + RebirthVariables.localVariables["$varFuriousRamsay" + expertiseTierKey + "PercUnit"]);
////Log.Out("RebirthUtilities-ProcessAttribute $varFuriousRamsayPerk" + RebirthVariables.localExpertiseTier[expertiseTierKey] + "PercUnit: " + RebirthVariables.localConstants["$varFuriousRamsayPerk" + RebirthVariables.localExpertiseTier[expertiseTierKey] + "PercUnit"]);
break;
}
}
progressionChanged = true;
}
}
RebirthVariables.localConstants[cvar.Replace("PercUnit", "Lvl")] = units;
////Log.Out("RebirthUtilities-ProcessAttribute units: " + units);
////Log.Out("RebirthUtilities-ProcessAttribute progressionLevel: " + progressionLevel);
////Log.Out("RebirthUtilities-ProcessAttribute progressionMax: " + progressionMax);
if ((progressionLevel < units && progressionLevel < progressionMax) || forceUpdate)
{
////Log.Out("RebirthUtilities-ProcessAttribute INCREASE CLASS LEVEL");
progressionValue.Level = units;
foreach (string localPerk in RebirthVariables.localClassPerk.Keys)
{
if (localPerk == playerClass)
{
////Log.Out("RebirthUtilities-ProcessAttribute class: " + localPerk);
List<classPerk> classPerkList = RebirthVariables.localClassPerk[localPerk];
////Log.Out("RebirthUtilities-ProcessAttribute classPerkList.Count: " + classPerkList.Count);
foreach (classPerk classPerk in classPerkList)
{
////Log.Out("RebirthUtilities-ProcessAttribute classPerk.perk: " + classPerk.perk);
List<perkLevels> perkLevelList = classPerk.levels;
ProgressionValue currentPerkProgressionValue = ___entityPlayerLocal.Progression.GetProgressionValue(classPerk.perk);
int currentPerkProgressionLevel = currentPerkProgressionValue.Level;
////Log.Out("RebirthUtilities-ProcessAttribute perkLevelList.Count: " + perkLevelList.Count);
foreach (perkLevels perkLevel in perkLevelList)
{
if (perkLevel.classLevel <= units)
{
////Log.Out("RebirthUtilities-ProcessAttribute perkLevel.classLevel (" + perkLevel.classLevel + ") >= units (" + units + ")");
////Log.Out("RebirthUtilities-ProcessAttribute currentPerkProgressionLevel (" + currentPerkProgressionLevel + " < perkLevel.perkLevel (" + perkLevel.perkLevel + ")");
if (currentPerkProgressionLevel < perkLevel.perkLevel)
{
////Log.Out("RebirthUtilities-ProcessAttribute TRUE");
ProgressionValue perkProgressionValue = ___entityPlayerLocal.Progression.GetProgressionValue(classPerk.perk);
perkProgressionValue.Level = perkLevel.perkLevel;
break;
}
}
}
}
}
}
progressionChanged = true;
GameManager.Instance.StartCoroutine(RebirthUtilities.UpdateActiveClasses(___entityPlayerLocal));
if (flClass > 0)
{
GameManager.ShowTooltip(___entityPlayerLocal as EntityPlayerLocal, "You are now a [9eff3d]Level " + units + "[-] [3cf7fa]" + playerClass + "[-]", string.Empty, "FuriousRamsayPerkLevelUp", null);
}
else
{
GameManager.ShowTooltip(___entityPlayerLocal as EntityPlayerLocal, "The [3cf7fa]" + playerClass + "[-] class has increased to [9eff3d]Level " + units + "[-]", string.Empty, "FuriousRamsayPerkLevelUp", null);
}
foreach (string rewardkey in RebirthVariables.localClassRewards.Keys)
{
if (rewardkey == playerClass)
{
////Log.Out("RebirthUtilities-ProcessAttribute rewardkey: " + rewardkey);
List<classRewards> classRewardsList = RebirthVariables.localClassRewards[rewardkey];
foreach (classRewards classRewards in classRewardsList)
{
if (classRewards.classLevel == units)
{
////Log.Out("RebirthUtilities-ProcessAttribute classRewards.classLevel: " + classRewards.classLevel);
////Log.Out("RebirthUtilities-ProcessAttribute classRewards.rewards.Count: " + classRewards.rewards.Count);
foreach (classReward classReward in classRewards.rewards)
{
////Log.Out("RebirthUtilities-ProcessAttribute classReward.itemName: " + classReward.itemName);
//AddItem(___entityPlayerLocal, classReward.itemName, classReward.numItems, classReward.numQuality, classReward.numLocation);
}
}
}
}
}
}
}
else
{
////Log.Out("RebirthUtilities-ProcessAttribute IS EXPERTISE");
bool isExpertise = false;
string expertise = "";
progressionMax = 10;
foreach (string key in RebirthVariables.localExpertise.Keys)
{
if (cvar.Contains(key))
{
isExpertise = true;
expertise = key;
////Log.Out("RebirthUtilities-ProcessAttribute FOUND EXPERTISE: " + expertise);
progressionMax = RebirthVariables.localExpertise[key];
break;
}
}
if (isExpertise)
{
////Log.Out("RebirthUtilities-ProcessAttribute EXPERTISE");
float number = RebirthVariables.localVariables[cvar];
units = (int)number;
////Log.Out("RebirthUtilities-ProcessAttribute cvar: " + cvar);
////Log.Out("RebirthUtilities-ProcessAttribute localVariables[cvar]: " + RebirthVariables.localVariables[cvar]);
ProgressionValue progressionValue = ___entityPlayerLocal.Progression.GetProgressionValue("FuriousRamsayPerk" + expertise);
int progressionLevel = progressionValue.Level;
RebirthVariables.localConstants[cvar.Replace("PercUnit", "Lvl")] = units;
////Log.Out("RebirthUtilities-ProcessAttribute units: " + units);
////Log.Out("RebirthUtilities-ProcessAttribute progressionLevel: " + progressionLevel);
////Log.Out("RebirthUtilities-ProcessAttribute progressionMax: " + progressionMax);
if (progressionLevel < units && progressionLevel < progressionMax)
{
////Log.Out("RebirthUtilities-ProcessAttribute INCREASE EXPERTISE LEVEL");
progressionValue.Level = units;
progressionChanged = true;
if (flClass > 0)
{
////Log.Out("FuriousRamsayPerk" + expertise + "Name");
GameManager.ShowTooltip(___entityPlayerLocal as EntityPlayerLocal, "Your [3cf7fa]" + Localization.Get("FuriousRamsayPerk" + expertise + "Name") + "[-] expertise is now [9eff3d]Level " + units + "[-]", string.Empty, "FuriousRamsayPerkLevelUp", null);
}
else
{
GameManager.ShowTooltip(___entityPlayerLocal as EntityPlayerLocal, "The [3cf7fa]" + Localization.Get("FuriousRamsayPerk" + expertise + "Name") + "[-] expertise is now [9eff3d]Level " + units + "[-]", string.Empty, "FuriousRamsayPerkLevelUp", null);
}
}
foreach (string key in RebirthVariables.localExpertiseCrafting.Keys)
{
////Log.Out("RebirthUtilities-ProcessAttribute key: " + key);
if (key == expertise)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
foreach (categoryCrafting craftingList in CategoryCraftingList)
{
////Log.Out("RebirthUtilities-ProcessAttribute craftingList.craftingPerk: " + craftingList.craftingPerk);
ProgressionValue craftingProgressionValue = ___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk);
int craftingProgressionLevel = craftingProgressionValue.Level;
List<craftingLevels> craftingLevelsList = craftingList.levels;
foreach (craftingLevels craftingLevel in craftingLevelsList)
{
if (number >= craftingLevel.categoryLevel)
{
////Log.Out("RebirthUtilities-ProcessAttribute craftingList.craftingPerk: " + craftingList.craftingPerk);
////Log.Out("RebirthUtilities-ProcessAttribute number (" + number + ") > craftingLevel.categoryLevel (" + craftingLevel.categoryLevel + ")");
////Log.Out("RebirthUtilities-ProcessAttribute craftingProgressionLevel (" + craftingProgressionLevel + " < craftingLevel.craftingLevel (" + craftingLevel.craftingLevel + ")");
if (craftingProgressionLevel < craftingLevel.craftingLevel)
{
////Log.Out("RebirthUtilities-ProcessAttribute GO UP!");
craftingProgressionValue.Level = craftingLevel.craftingLevel;
EntityPlayerLocal entityPlayerLocal = (EntityPlayerLocal)___entityPlayerLocal;
entityPlayerLocal.PlayerUI.xui.CollectedItemList.AddCraftingSkillNotification(craftingProgressionValue, false);
////Log.Out("RebirthUtilities-ProcessAttribute craftingProgressionLevel: " + craftingProgressionLevel);
////Log.Out("RebirthUtilities-ProcessAttribute craftingLevel.craftingLevel: " + craftingLevel.craftingLevel);
craftingProgressionValue.ProgressionClass.HandleCheckCrafting(entityPlayerLocal, craftingProgressionLevel, craftingLevel.craftingLevel);
progressionChanged = true;
break;
}
}
}
}
}
}
}
}
}
}
if (progressionChanged)
{
___entityPlayerLocal.Progression.bProgressionStatsChanged = true;
___entityPlayerLocal.bPlayerStatsChanged = true;
}
}
public static bool HasEquippedItem(EntityAlive entity, string item)
{
// Equipment armor items hard coded at 5 slots
if (entity == null || entity.equipment == null) return false; // this should not happen
ItemValue[] armor = entity.equipment.GetItems(); // armor slot ItemValue can be null if nothing equipped
if (armor == null || armor.Length == 0) return false; // this should not happen
var equippedItem = armor.Where(iVal => iVal != null && iVal.ItemClass != null && iVal.ItemClass.GetItemName().ToLower().Equals(item.ToLower())).FirstOrDefault();
if (equippedItem == null) return false; // did not find the matching item equipped
return true;
}
public static bool HasMod(EntityAlive entity, string mod)
{
ItemValue[] armor = entity.equipment.GetItems();
var equippedMod = armor.Where(iVal => iVal != null && iVal.Modifications != null && iVal.Modifications.Length > 0 &&
iVal.Modifications.Any(m => m != null && m.ItemClass != null && m.ItemClass.Name.ToLower().Equals(mod.ToLower()))).FirstOrDefault();
if (equippedMod == null) return false; // did not find the matching mod equipped
return true;
}
public static void ProcessGeneticsLBD(EntityAlive entity, string geneticTrait, string lbdCategory, float forcedMultiplier = 1f)
{
float geneticsMultiplierOption = float.Parse(RebirthVariables.customGeneticsXPMultiplier) / 100;
int maxProgression = RebirthVariables.localGenetics[geneticTrait];
float geneticValue = RebirthVariables.localVariables["$varFuriousRamsay" + geneticTrait + "PercUnit"];
float projectedGeneticValue = geneticValue;
int playerLevel = entity.Progression.GetLevel();
float increase = 0;
int max = 5;
//Log.Out("RebirthUtilities-ProcessGeneticsLBD geneticsMultiplierOption: " + geneticsMultiplierOption);
//Log.Out("RebirthUtilities-ProcessGeneticsLBD maxProgression: " + maxProgression);
//Log.Out("RebirthUtilities-ProcessGeneticsLBD geneticValue: " + geneticValue);
//Log.Out("RebirthUtilities-ProcessGeneticsLBD playerLevel: " + playerLevel);
for (int i = 0; i < max; i++)
{
////Log.Out("RebirthUtilities-ProcessGeneticsLBD i: " + i);
if (i == 0)
{
if (playerLevel >= 0 && playerLevel <= RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier" + (i + 1) + "_Cst"])
{
increase = RebirthVariables.localConstants["$varFuriousRamsay" + lbdCategory + "Tier" + (i + 1)];
////Log.Out("RebirthUtilities-ProcessGeneticsLBD increase: " + increase);
}
}
else if (i == (max - 1))
{
if (playerLevel > RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier" + (i - 1) + "_Cst"])
{
increase = RebirthVariables.localConstants["$varFuriousRamsay" + lbdCategory + "Tier" + i];
}
}
else
{
if (playerLevel > RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier" + i + "_Cst"] && playerLevel < RebirthVariables.localConstants["$varFuriousRamsayPlayerLevelTier" + (i + 1) + "_Cst"])
{
increase = RebirthVariables.localConstants["$varFuriousRamsay" + lbdCategory + "Tier" + (i + 1)];
}
}
}
projectedGeneticValue += increase * geneticsMultiplierOption * forcedMultiplier;
////Log.Out("RebirthUtilities-ProcessGeneticsLBD projectedGeneticValue: " + projectedGeneticValue);
if ((int)projectedGeneticValue > maxProgression)
{
////Log.Out("RebirthUtilities-ProcessGeneticsLBD projectedGeneticValue > maxProgression");
projectedGeneticValue = maxProgression;
}
RebirthVariables.localVariables["$varFuriousRamsay" + geneticTrait + "PercUnit"] = projectedGeneticValue;
ProcessAttribute(entity, "$varFuriousRamsay" + geneticTrait + "PercUnit");
}
public static void ProcessAchievement(EntityAlive entity, string tag, string notification)
{
//Log.Out("RebirthUtilities-ProcessAchievement START, tag: " + tag);
int max = 0;
foreach (string constantKey in RebirthVariables.localConstants.Keys)
{
if (constantKey.StartsWith(tag) && !constantKey.Contains("Perc"))
{
//Log.Out("RebirthUtilities-ProcessAchievement constantKey: " + constantKey);
//Log.Out("RebirthUtilities-ProcessAchievement tag: " + tag);
int number = int.Parse(constantKey.Replace(tag, "").Replace("Lvl", "").Replace("_Cst", ""));
if (number > max)
{
max = number;
}
}
}
//Log.Out("RebirthUtilities-ProcessAchievement max: " + max);
float skillValue = RebirthVariables.localVariables[tag];
float maxValue = RebirthVariables.localConstants[tag + "Lvl" + max + "_Cst"];
//Log.Out("RebirthUtilities-ProcessAchievement skillValue: " + skillValue);
//Log.Out("RebirthUtilities-ProcessAchievement maxValue: " + maxValue);
if (skillValue > maxValue)
{
skillValue = maxValue;
}
if (skillValue <= maxValue)
{
//Log.Out("RebirthUtilities-ProcessAchievement 1");
if (skillValue < maxValue)
{
skillValue++;
}
RebirthVariables.localVariables[tag] = skillValue;
//Log.Out("RebirthUtilities-ProcessAchievement RebirthVariables.localVariables[" + tag + "]: " + RebirthVariables.localVariables[tag]);
bool changed = false;
int skillLevel = 0;
for (int i = 1; i <= max; i++)
{
//Log.Out("RebirthUtilities-ProcessAchievement RebirthVariables.localConstants[" + tag + "Lvl" + i + "_Cst" + "]: " + RebirthVariables.localConstants[tag + "Lvl" + i + "_Cst"]);
if (skillValue == RebirthVariables.localConstants[tag + "Lvl" + i + "_Cst"])
{
changed = true;
skillLevel = i;
}
}
//Log.Out("RebirthUtilities-ProcessAchievement changed: " + changed);
//Log.Out("RebirthUtilities-ProcessAchievement skillLevel: " + skillLevel);
bool wasLower = false;
if (changed)
{
string progressionString = tag.Replace("Exp", "").Replace("$var", "");
//Log.Out("RebirthUtilities-ProcessAchievement progressionString: " + progressionString);
ProgressionValue achievementProgressionValue = entity.Progression.GetProgressionValue(progressionString);
wasLower = achievementProgressionValue.Level < skillLevel;
achievementProgressionValue.Level = skillLevel;
if (wasLower && notification.Length > 0)
{
//Log.Out("RebirthUtilities-ProcessAchievement 2");
GameManager.ShowTooltip(entity as EntityPlayerLocal, notification.Replace("{0}", skillLevel.ToString()), string.Empty, "FuriousRamsayPerkLevelUp", null);
}
}
if (wasLower)
{
UpdateAchievementData(tag, max);
}
RebirthVariables.RefreshConstants(entity as EntityPlayerLocal);
}
}
public static void UpdateAchievementData(string tag, int maxLevel)
{
//Log.Out("RebirthUtilities-UpdateAchievementData START, tag: " + tag);
//Log.Out("RebirthUtilities-UpdateAchievementData START, maxLevel: " + maxLevel);
for (int i = 1; i <= maxLevel; i++)
{
float currentValue = RebirthVariables.localVariables[tag];
float levelValue = RebirthVariables.localConstants[tag + "Lvl" + i + "_Cst"];
////Log.Out("RebirthUtilities-UpdateAchievementData " + tag + ": " + RebirthVariables.localVariables[tag]);
////Log.Out("RebirthUtilities-UpdateAchievementData " + tag + i + "_Cst: " + RebirthVariables.localConstants[tag + "Lvl" + i + "_Cst"]);
if (currentValue > levelValue)
{
RebirthVariables.localConstants[tag + i + "_Cst"] = levelValue;
RebirthVariables.localConstants[tag + "Perc" + i + "_Cst"] = 100f;
}
else
{
RebirthVariables.localConstants[tag + i + "_Cst"] = currentValue;
RebirthVariables.localConstants[tag + "Perc" + i + "_Cst"] = currentValue / levelValue * 100;
}
}
}
public static void AddItem(EntityAlive player, string itemName, int numItems, int numQuality = 1, int numLocation = 0)
{
ItemValue item = ItemClass.GetItem(itemName, false);
ItemValue itemValue = new ItemValue(ItemClass.GetItem(itemName, false).type, true);
int num = numItems;
if (itemValue.HasQuality)
{
num = 1;
}
ItemStack myStack = new ItemStack(itemValue, num);
if (numQuality > 0)
{
myStack.itemValue.Quality = (ushort)numQuality;
}
if (numLocation == 1)
{
if (!player.inventory.AddItem(myStack))
{
if (!player.bag.AddItem(myStack))
{
player.world.gameManager.ItemDropServer(new ItemStack(itemValue, num), player.GetPosition(), Vector3.zero);
}
}
}
else
{
if (!player.bag.AddItem(myStack))
{
player.world.gameManager.ItemDropServer(new ItemStack(itemValue, num), player.GetPosition(), Vector3.zero);
}
}
}
public static bool HasFilterTag(Block _block, string tag)
{
bool result = false;
if (_block.FilterTags != null)
{
for (int i = 0; i < _block.FilterTags.Length; i++)
{
////Log.Out("EntityAlivePatches-FireEvent FilterTag[" + i + "]: " + _block.FilterTags[i]);
if (_block.FilterTags[i].ToLower() == tag.ToLower())
{
result = true;
break;
}
}
}
return result;
}
public static bool HasOtherKey(string variable)
{
bool result = false;
foreach (string key in RebirthVariables.localOtherCrafting.Keys)
{
if (variable.Contains(key))
{
result = true;
break;
}
}
return result;
}
public static bool HasGeneticsKey(string variable)
{
bool result = false;
foreach (string key in RebirthVariables.localGenetics.Keys)
{
if (variable.Contains(key))
{
result = true;
break;
}
}
return result;
}
public static string GetClassNameFromID(float classID)
{
string className = "none";
foreach (string key in RebirthVariables.localClasses.Keys)
{
if (RebirthVariables.localClasses[key] == classID)
{
className = key;
break;
}
}
return className;
}
public static float GetIDFromClassName(string className)
{
float result = 0f;
foreach (string key in RebirthVariables.localClasses.Keys)
{
if (key.ToLower() == className.ToLower())
{
result = RebirthVariables.localClasses[key];
break;
}
}
return result;
}
public static int GetClassProgressionMax(float classID)
{
int result = 10;
string className = "";
foreach (string key in RebirthVariables.localClasses.Keys)
{
if (RebirthVariables.localClasses[key] == classID)
{
className = key;
break;
}
}
foreach (string key in RebirthVariables.localClassProgressionMax.Keys)
{
if (key == className)
{
result = RebirthVariables.localClassProgressionMax[key];
break;
}
}
return result;
}
public static int GetClassProgressionMax(string className)
{
int result = 10;
foreach (string key in RebirthVariables.localClassProgressionMax.Keys)
{
if (key == className)
{
result = RebirthVariables.localClassProgressionMax[key];
break;
}
}
return result;
}
public static int GetExpertiseProgressionMax(string weapon)
{
int result = 10;
foreach (string key in RebirthVariables.localExpertise.Keys)
{
if (weapon == key)
{
result = RebirthVariables.localExpertise[key];
break;
}
}
return result;
}
public static void addParticles(string strParticleName, Vector3i position)
{
if (GameManager.IsDedicatedServer) return;
if (strParticleName == null || strParticleName == "")
strParticleName = "#@modfolder(0-SCore):Resources/PathSmoke.unity3d?P_PathSmoke_X";
if (!ParticleEffect.IsAvailable(strParticleName))
ParticleEffect.LoadAsset(strParticleName);
var blockValue = GameManager.Instance.World.GetBlock(position);
GameManager.Instance.World.GetGameManager().SpawnBlockParticleEffect(position,
new ParticleEffect(strParticleName, position.ToVector3() + Vector3.up, blockValue.Block.shape.GetRotation(blockValue), 1f, Color.white));
}
public static Vector3 CenterPosition(Vector3 position)
{
var temp = position;
temp.x = 0.5f + Utils.Fastfloor(position.x);
temp.z = 0.5f + Utils.Fastfloor(position.z);
temp.y = Utils.Fastfloor(position.y);
return temp;
}
public static void addParticlesCentered(string strParticleName, Vector3i position)
{
//Log.Out("RebirthUtilities-addParticlesCentered START, position: " + position);
if (string.IsNullOrEmpty(strParticleName))
{
//Log.Out("RebirthUtilities-addParticlesCentered 1");
strParticleName = "#@modfolder:Resources/PathSmoke.unity3d?P_PathSmoke_X";
}
if (strParticleName == "NoParticle")
{
//Log.Out("RebirthUtilities-addParticlesCentered 2");
return;
}
if (!ParticleEffect.IsAvailable(strParticleName))
{
//Log.Out("RebirthUtilities-addParticlesCentered 3");
ParticleEffect.LoadAsset(strParticleName);
}
if (GameManager.Instance.HasBlockParticleEffect(position))
{
removeParticles(position);
//Log.Out("RebirthUtilities-addParticlesCentered 4");
//return;
}
if (GameManager.IsDedicatedServer)
{
//Log.Out("RebirthUtilities-addParticlesCentered 5");
return;
}
var centerPosition = CenterPosition(position);
var blockValue = GameManager.Instance.World.GetBlock(position);
var rotation = Quaternion.identity;
var particle = new ParticleEffect(strParticleName, centerPosition, rotation, 1f, Color.white);
//Log.Out("RebirthUtilities-addParticlesCentered position: " + position);
GameManager.Instance.SpawnBlockParticleEffect(position, particle);
}
public static void removeParticles(Vector3i position)
{
if (GameManager.IsDedicatedServer) return;
GameManager.Instance.World.GetGameManager().RemoveBlockParticleEffect(position);
}
public static void RemoveParticle(EntityAlive entityAlive, string particleName)
{
////Log.Out("RebirthUtilities-RemoveParticle START");
if (entityAlive == null)
{
////Log.Out("RebirthUtilities-RemoveParticle entityAlive == null");
return;
}
entityAlive.RemoveParticle(particleName);
entityAlive.RemovePart(particleName);
/*
maybe todo fix - Why did TFP remove NetPackageAddRemoveBuffParticles from MinEventActionRemoveParticleEffectFromEntity
if(SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageAddRemoveBuffParticles>().SetupRemove(entityAlive.entityId, particleName), false, -1, entityAlive.entityId, -1, -1);
return;
}
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageAddRemoveBuffParticles>().SetupRemove(entityAlive.entityId, particleName), false);
*/
}
public static void BuildHNPGroups()
{
string optionTornados = RebirthVariables.customTornados;
string optionDemos = RebirthVariables.customDemos;
string optionKamikaze = RebirthVariables.customKamikaze;
//Log.Out("RebirthUtilities-BuildHNPGroups optionDemos: " + optionDemos);
//Log.Out("RebirthUtilities-BuildHNPGroups START");
foreach (KeyValuePair<int, EntityClass> keyValuePair in EntityClass.list.Dict)
{
try
{
string className = keyValuePair.Value.classname.ToString();
//Log.Out("RebirthUtilities-BuildHNPGroups optionTornados: " + optionTornados);
//Log.Out("RebirthUtilities-BuildHNPGroups className: " + className);
//Log.Out("RebirthUtilities-BuildHNPGroups !(!optionTornados && className.ToLower() == \"furiousramsaywindtornado\"): " + !(!optionTornados && className.ToLower() == "furiousramsaywindtornado"));
if (!(optionTornados == "always" || optionTornados == "hordenightonly") && keyValuePair.Value.entityClassName.ToLower() == "furiousramsaywindtornado")
{
//Log.Out("RebirthUtilities-BuildHNPGroups entity: " + keyValuePair.Value.entityClassName + " (" + className + ")");
continue;
}
if ((optionDemos == "nothordenight" || optionDemos == "never") && keyValuePair.Value.entityClassName.ToLower() == "zombiedemolition")
{
//Log.Out("RebirthUtilities-BuildHNPGroups SKIPPING DEMOS");
continue;
}
if ((optionKamikaze == "never" || optionKamikaze == "nothordenight" || optionKamikaze == "nothordenightpoi") && keyValuePair.Value.entityClassName.ToLower().Contains("furiousramsaykamikaze"))
{
//Log.Out("RebirthUtilities-BuildHNPGroups SKIPPING KAMIKAZES");
continue;
}
if (className.ToLower().Contains("entityzombie") ||
className.ToLower().Contains("entitywraith")
)
{
string entityClassName = keyValuePair.Value.entityClassName;
if (!entityClassName.ToLower().Contains("event") &&
!entityClassName.ToLower().Contains("boss") &&
!entityClassName.ToLower().Contains("quest") &&
!entityClassName.ToLower().Contains("start") &&
!entityClassName.ToLower().Contains("loot")
)
{
if (keyValuePair.Value.Properties.Values.ContainsKey("Tags"))
{
if (!keyValuePair.Value.Properties.Values["Tags"].Contains("template") &&
!keyValuePair.Value.Properties.Values["Tags"].Contains("event") &&
!keyValuePair.Value.Properties.Values["Tags"].Contains("skip")
)
{
int hordeNightChance = 10;
int gamestageStart = 0;
int gamestageEnd = 0;
int entitySpecial = 0;
//Log.Out("RebirthUtilities-BuildHNPGroups entity: " + keyValuePair.Value.entityClassName + " (" + className + ")");
if (keyValuePair.Value.Properties.Values.ContainsKey("HordeNightChance"))
{
float customTornadosMultiplierOption = float.Parse(RebirthVariables.customTornadosMultiplier) / 100;
hordeNightChance = (int)(int.Parse(keyValuePair.Value.Properties.Values["HordeNightChance"]) * customTornadosMultiplierOption);
}
if (keyValuePair.Value.Properties.Values.ContainsKey("GamestageStart"))
{
gamestageStart = int.Parse(keyValuePair.Value.Properties.Values["GamestageStart"]);
}
if (keyValuePair.Value.Properties.Values.ContainsKey("SpecialSpawn"))
{
entitySpecial = int.Parse(keyValuePair.Value.Properties.Values["SpecialSpawn"]);
}
if (keyValuePair.Value.Properties.Values.ContainsKey("GamestageEnd"))
{
gamestageEnd = int.Parse(keyValuePair.Value.Properties.Values["GamestageEnd"]);
}
HNPGroupRebirth newGroup = new HNPGroupRebirth
{
entityId = keyValuePair.Key,
hordeNightChance = hordeNightChance,
gamestageStart = gamestageStart,
gamestageEnd = gamestageEnd,
entitySpecial = entitySpecial
};
HNPGroups.Add(newGroup);
}
}
}
}
}
catch (Exception)
{
////Log.Out("=====================================================================================");
////Log.Out("EntityGroupsPatches-IsEnemyGroup keyValuePair.Key: " + keyValuePair.Key);
////Log.Out("=====================================================================================");
}
}
}
public static void BuildSpawnGroups()
{
foreach (KeyValuePair<int, EntityClass> keyValuePair in EntityClass.list.Dict)
{
try
{
string className = keyValuePair.Value.classname.ToString();
string entityClassName = keyValuePair.Value.entityClassName;
////Log.Out("RebirthUtilities-BuildSleeperGroups className: " + className);
if (keyValuePair.Value.Properties.Values.ContainsKey("HideInSpawnMenu"))
{
bool hideInSpawnMenu = StringParsers.ParseBool(keyValuePair.Value.Properties.Values[EntityClass.PropHideInSpawnMenu], 0, -1, true);
if (hideInSpawnMenu)
{
////Log.Out("RebirthUtilities-BuildSleeperGroups hideInSpawnMenu: " + hideInSpawnMenu);
continue;
}
}
//Log.Out("RebirthUtilities-BuildSleeperGroups className: " + className);
//Log.Out("RebirthUtilities-BuildSleeperGroups Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
if (className.ToLower().Contains("npc"))
{
int newEntry = new int();
newEntry = keyValuePair.Key;
/*if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeForest!"))
{
newEntry.biome = 2;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeDesert!"))
{
newEntry.biome = 2;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeSnow!"))
{
newEntry.biome = 3;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeWasteland!"))
{
newEntry.biome = 4;
}*/
if (!keyValuePair.Value.Properties.Values["Tags"].Contains(",skip") &&
!keyValuePair.Value.Properties.Values["Tags"].Contains(",template"))
{
if (keyValuePair.Value.Properties.Values["Tags"].Contains(",survivor,"))
{
AddEntityClassToCategory(keyValuePair.Key, GetCategoryFromWeaponName(keyValuePair.Value.Properties.Values["BagItems"]), "survivors");
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains(",bandit,"))
{
AddEntityClassToCategory(keyValuePair.Key, GetCategoryFromWeaponName(keyValuePair.Value.Properties.Values["BagItems"]), "bandits");
}
}
}
EntityClass entityClass = EntityClass.GetEntityClass(keyValuePair.Key);
bool isEventBoss = false;
if (entityClass == null)
{
if (keyValuePair.Value.Properties.Values.ContainsKey("IsEventBoss"))
{
isEventBoss = true;
}
}
if (className.ToLower().Contains("entityzombie")
|| className.ToLower().Contains("entitywraith")
|| className.ToLower().Contains("entityvulture")
)
{
if (!entityClassName.ToLower().Contains("event") &&
!entityClassName.ToLower().Contains("boss") &&
!entityClassName.ToLower().Contains("quest") &&
!entityClassName.ToLower().Contains("start") &&
!entityClassName.ToLower().Contains("loot")
)
{
////Log.Out("RebirthUtilities-BuildSleeperGroups IS ZOMBIE: " + keyValuePair.Value.entityClassName);
////Log.Out("RebirthUtilities-BuildSleeperGroups 1");
if (keyValuePair.Value.Properties.Values.ContainsKey("Tags"))
{
////Log.Out("RebirthUtilities-BuildSleeperGroups Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
if (!keyValuePair.Value.Properties.Values["Tags"].Contains("template")
)
{
int newEntry = new int();
newEntry = keyValuePair.Key;
/*if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeForest!"))
{
newEntry.biome = 2;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeDesert!"))
{
newEntry.biome = 2;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeSnow!"))
{
newEntry.biome = 3;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeWasteland!"))
{
newEntry.biome = 4;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeForest!"))
{
newEntry.biome = 2;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeDesert!"))
{
newEntry.biome = 2;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeSnow!"))
{
newEntry.biome = 3;
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomeWasteland!"))
{
newEntry.biome = 4;
}*/
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieSupportLow!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE SUPPORT LOW entityClassName: " + entityClassName);
zombieSupportLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieSupportMedium!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE SUPPORT MEDIUM entityClassName: " + entityClassName);
zombieSupportMedium.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieSupportHigh!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE SUPPORT HIGH entityClassName: " + entityClassName);
zombieSupportHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieSupportVeryHigh!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE SUPPORT HIGH entityClassName: " + entityClassName);
zombieSupportVeryHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieAnimalsBossesLow!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE ANIMAL BOSSES LOW entityClassName: " + entityClassName);
zombieAnimalsBossesLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieAnimalsBossesMedium!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE ANIMAL BOSSES MEDIUM entityClassName: " + entityClassName);
zombieAnimalsBossesMedium.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieAnimalsBossesHigh!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE ANIMAL BOSSES HIGH entityClassName: " + entityClassName);
zombieAnimalsBossesHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieAnimalsLow!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE ANIMALS LOW entityClassName: " + entityClassName);
zombieAnimalsLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieAnimalsMedium!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE ANIMALS MEDIUM entityClassName: " + entityClassName);
zombieAnimalsMedium.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("zombieAnimalsHigh!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups ZOMBIE ANIMALS HIGH entityClassName: " + entityClassName);
zombieAnimalsHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("tornadosLow!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups TORNADOS LOW entityClassName: " + entityClassName);
tornadosLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomesLow!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups BIOMES LOW entityClassName: " + entityClassName);
biomesLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomesMed!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups BIOMES MED entityClassName: " + entityClassName);
biomesMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomesHigh!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups BIOMES HIGH entityClassName: " + entityClassName);
biomesHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("biomesVeryHigh!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups BIOMES VERY HIGH entityClassName: " + entityClassName);
biomesVeryHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightLowLow!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups HORDE NIGHT LOW entityClassName: " + entityClassName);
hordeNightLowLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightLowMed!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups HORDE NIGHT LOW entityClassName: " + entityClassName);
hordeNightLowMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightLowHigh!"))
{
//Log.Out("RebirthUtilities-BuildSleeperGroups HORDE NIGHT LOW entityClassName: " + entityClassName);
hordeNightLowHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightMedLow!"))
{
hordeNightMedLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightMedMed!"))
{
hordeNightMedMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightMedHigh!"))
{
hordeNightMedHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightHighLow!"))
{
hordeNightHighLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightHighMed!"))
{
hordeNightHighMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightHighHigh!"))
{
hordeNightHighHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightVeryHighLow!"))
{
hordeNightVeryHighLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightVeryHighMed!"))
{
hordeNightVeryHighMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightVeryHighHigh!"))
{
hordeNightVeryHighHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightPlusLow!"))
{
hordeNightPlusLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightPlusMed!"))
{
hordeNightPlusMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightPlusHigh!"))
{
hordeNightPlusHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("hordeNightPlusVeryHigh!"))
{
hordeNightPlusVeryHigh.Add(newEntry);
}
}
if (!keyValuePair.Value.Properties.Values["Tags"].Contains("template") &&
!keyValuePair.Value.Properties.Values["Tags"].Contains("nosleeper")
)
{
int newEntry = new int();
newEntry = keyValuePair.Key;
/*if (keyValuePair.Value.Properties.Values["Tags"].Contains("normal") &&
!keyValuePair.Value.Properties.Values["Tags"].Contains("feral,") &&
!keyValuePair.Value.Properties.Values["Tags"].Contains("radiated,")
)*/
{
if (keyValuePair.Value.Properties.Values["Tags"].Contains("regular!"))
{
forestGroup.Add(newEntry);
desertGroup.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("feral!"))
{
desertGroup.Add(newEntry);
snowGroup.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("radiated!"))
{
wastelandGroup.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("tainted!"))
{
burntGroup.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("alwaysLow!"))
{
sleepersLow.Add(newEntry);
sleepersMed.Add(newEntry);
sleepersHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("normalLow!"))
{
sleepersLow.Add(newEntry);
//Log.Out("RebirthUtilities-BuildSleeperGroups NORMAL LOW added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("normalLowMed!"))
{
sleepersLowMed.Add(newEntry);
//Log.Out("RebirthUtilities-BuildSleeperGroups NORMAL MED LOW added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("normalMed!"))
{
sleepersMed.Add(newEntry);
//Log.Out("RebirthUtilities-BuildSleeperGroups NORMAL MED added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("normalHigh!"))
{
sleepersHigh.Add(newEntry);
//Log.Out("RebirthUtilities-BuildSleeperGroups NORMAL HIGH added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
//Log.Out("RebirthUtilities-BuildSleeperGroups NORMAL added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
/*if (keyValuePair.Value.Properties.Values["Tags"].Contains("feral,") &&
!keyValuePair.Value.Properties.Values["Tags"].Contains("radiated,"))*/
{
if (keyValuePair.Value.Properties.Values["Tags"].Contains("alwaysMed!"))
{
sleepersFeralLow.Add(newEntry);
sleepersFeralMed.Add(newEntry);
sleepersFeralHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("feralLow!"))
{
sleepersFeralLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("feralMed!"))
{
sleepersFeralMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("feralHigh!"))
{
sleepersFeralHigh.Add(newEntry);
}
////Log.Out("RebirthUtilities-BuildSleeperGroups FERAL added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
//if (keyValuePair.Value.Properties.Values["Tags"].Contains("radiated,"))
{
if (keyValuePair.Value.Properties.Values["Tags"].Contains("alwaysHigh!"))
{
sleepersRadiatedLow.Add(newEntry);
sleepersRadiatedMed.Add(newEntry);
sleepersRadiatedHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("radiatedLow!"))
{
sleepersRadiatedLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("radiatedMed!"))
{
sleepersRadiatedMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("radiatedHigh!"))
{
sleepersRadiatedHigh.Add(newEntry);
}
////Log.Out("RebirthUtilities-BuildSleeperGroups RADIATED added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
//if (keyValuePair.Value.Properties.Values["Tags"].Contains("tainted,"))
{
if (keyValuePair.Value.Properties.Values["Tags"].Contains("alwaysVeryHigh!"))
{
sleepersTaintedLow.Add(newEntry);
sleepersTaintedMed.Add(newEntry);
sleepersTaintedHigh.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("taintedLow!"))
{
sleepersTaintedLow.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("taintedMed!"))
{
sleepersTaintedMed.Add(newEntry);
}
if (keyValuePair.Value.Properties.Values["Tags"].Contains("taintedHigh!"))
{
sleepersTaintedHigh.Add(newEntry);
}
////Log.Out("RebirthUtilities-BuildSleeperGroups RADIATED added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
////Log.Out("RebirthUtilities-BuildSleeperGroups added entityClassName: " + entityClassName + " / Tags: " + keyValuePair.Value.Properties.Values["Tags"]);
}
}
}
}
}
catch (Exception)
{
////Log.Out("RebirthUtilities-BuildSleeperGroups A2 keyValuePair.Key: " + keyValuePair.Key);
//return true;
}
}
/*Log.Out("RebirthUtilities-BuildSleeperGroups banditsLow: " + banditsLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups banditsLowMed: " + banditsLowMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups banditsMed: " + banditsMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups banditsMedHigh: " + banditsMedHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups banditsHigh: " + banditsHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups survivorsLow: " + survivorsLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups survivorsLowMed: " + survivorsLowMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups survivorsMed: " + survivorsMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups survivorsMedHigh: " + survivorsMedHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups survivorsHigh: " + survivorsHigh.Count);*/
/*Log.Out("=========================================================================================");
for (int i = 0; i < sleepersLow.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersLow: " + Localization.Get(EntityClass.GetEntityClassName(sleepersLow[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersMed.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersMed: " + Localization.Get(EntityClass.GetEntityClassName(sleepersMed[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersHigh.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersHigh: " + Localization.Get(EntityClass.GetEntityClassName(sleepersHigh[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersFeralLow.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersFeralLow: " + Localization.Get(EntityClass.GetEntityClassName(sleepersFeralLow[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersFeralMed.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersFeralMed: " + Localization.Get(EntityClass.GetEntityClassName(sleepersFeralMed[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersFeralHigh.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersFeralHigh: " + Localization.Get(EntityClass.GetEntityClassName(sleepersFeralHigh[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersRadiatedLow.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersRadiatedLow: " + Localization.Get(EntityClass.GetEntityClassName(sleepersRadiatedLow[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersRadiatedMed.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersRadiatedMed: " + Localization.Get(EntityClass.GetEntityClassName(sleepersRadiatedMed[i].entityId)));
}
Log.Out("=========================================================================================");
for (int i = 0; i < sleepersRadiatedHigh.Count; i++)
{
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersRadiatedHigh: " + Localization.Get(EntityClass.GetEntityClassName(sleepersRadiatedHigh[i].entityId)));
}
Log.Out("=========================================================================================");*/
/*Log.Out("RebirthUtilities-BuildSleeperGroups biomesLow.Count: " + biomesLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups biomesMed.Count: " + biomesMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups biomesHigh.Count: " + biomesHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups biomesVeryHigh.Count: " + biomesVeryHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightLowLow.Count: " + hordeNightLowLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightLowMed.Count: " + hordeNightLowMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightLowHigh.Count: " + hordeNightLowHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightMedLow.Count: " + hordeNightMedLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightMedMed.Count: " + hordeNightMedMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightMedHigh.Count: " + hordeNightMedHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightHighLow.Count: " + hordeNightHighLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightHighMed.Count: " + hordeNightHighMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightHighHigh.Count: " + hordeNightHighHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightPlusLow.Count: " + hordeNightPlusLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightPlusMed.Count: " + hordeNightPlusMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightPlusHigh.Count: " + hordeNightPlusHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups hordeNightPlusVeryHigh.Count: " + hordeNightPlusVeryHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieSupportLow.Count: " + zombieSupportLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieSupportMedium.Count: " + zombieSupportMedium.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieSupportHigh.Count: " + zombieSupportHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieSupportVeryHigh.Count: " + zombieSupportVeryHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieAnimalsBossesLow.Count: " + zombieAnimalsBossesLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieAnimalsBossesMedium.Count: " + zombieAnimalsBossesMedium.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieAnimalsBossesHigh.Count: " + zombieAnimalsBossesHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieAnimalsLow.Count: " + zombieAnimalsLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieAnimalsMedium.Count: " + zombieAnimalsMedium.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups zombieAnimalsHigh.Count: " + zombieAnimalsHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersLow.Count: " + sleepersLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersLowMed.Count: " + sleepersLowMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersMed.Count: " + sleepersMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersHigh.Count: " + sleepersHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersFeralLow.Count: " + sleepersFeralLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersFeralMed.Count: " + sleepersFeralMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersFeralHigh.Count: " + sleepersFeralHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersRadiatedLow.Count: " + sleepersRadiatedLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersRadiatedMed.Count: " + sleepersRadiatedMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersRadiatedHigh.Count: " + sleepersRadiatedHigh.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersTaintedLow.Count: " + sleepersTaintedLow.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersTaintedMed.Count: " + sleepersTaintedMed.Count);
Log.Out("RebirthUtilities-BuildSleeperGroups sleepersTaintedHigh.Count: " + sleepersTaintedHigh.Count);*/
}
public static bool AddPlayerItem(EntityPlayer entityPlayer, int _ClrIdx, ItemStack itemStack, bool useNPCs = false, bool useDrone = false, bool keepAmmo = false)
{
bool addItems = false;
//Log.Out("RebirthUtilities-AddPlayerItem START");
bool isAmmo = itemStack.itemValue.ItemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("ammo"));
string ammo = itemStack.itemValue.ItemClass.Name;
bool forDog = itemStack.itemValue.ItemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("geneticsBlueprint")) ||
itemStack.itemValue.ItemClass.Name == "resourceCloth" ||
itemStack.itemValue.ItemClass.Name == "resourceLeather" ||
itemStack.itemValue.ItemClass.Name == "apparelRunningShoesHP" ||
itemStack.itemValue.ItemClass.Name == "apparelCoatJacketLetterZU" ||
itemStack.itemValue.ItemClass.Name == "foodRottingFlesh";
if (RebirthVariables.customCompanionInventory != "always")
{
forDog = false;
}
//Log.Out("RebirthUtilities-AddPlayerItem itemStack.itemValue.ItemClass.Name: " + itemStack.itemValue.ItemClass.Name);
//Log.Out("RebirthUtilities-AddPlayerItem isAmmo: " + isAmmo);
bool isValidAmmo = false;
if (isAmmo)
{
//Log.Out("RebirthUtilities-AddPlayerItem 1");
ItemStack[] slots = entityPlayer.inventory.GetSlots();
for (int i = 0; i < slots.Length - 1; i++)
{
ItemStack itemInventoryStack = slots[i];
if (!itemInventoryStack.IsEmpty())
{
//Log.Out("RebirthUtilities-AddPlayerItem 2");
bool isGun = itemInventoryStack.itemValue.ItemClass.HasAnyTags(FastTags<TagGroup.Global>.Parse("gun"));
if (isGun && itemInventoryStack.itemValue.ItemClass.Actions[0] is ItemActionRanged)
{
//Log.Out("RebirthUtilities-AddPlayerItem 3");
ItemActionRanged itemActionRanged = (ItemActionRanged)itemInventoryStack.itemValue.ItemClass.Actions[0];
if (itemActionRanged != null)
{
//Log.Out("RebirthUtilities-AddPlayerItem 4");
foreach (string ammoName in itemActionRanged.MagazineItemNames)
{
if (ammoName == ammo)
{
//Log.Out("RebirthUtilities-AddPlayerItem 5");
isValidAmmo = true;
break;
}
}
}
}
}
}
}
if (!(isAmmo && keepAmmo && isValidAmmo))
{
//Log.Out("RebirthUtilities-AddPlayerItem 6");
//Log.Out("RebirthUtilities-AddPlayerItem useDrone: " + useDrone);
//Log.Out("RebirthUtilities-AddPlayerItem entityPlayer.OwnedEntityCount: " + entityPlayer.OwnedEntityCount);
//Log.Out("RebirthUtilities-AddPlayerItem useNPCs: " + useNPCs);
//Log.Out("RebirthUtilities-AddPlayerItem entityPlayer.Companions.Count: " + entityPlayer.Companions.Count);
if (forDog && !addItems && useNPCs && entityPlayer.Companions.Count > 0)
{
//Log.Out("RebirthUtilities-AddPlayerItem 15");
EntityNPCRebirth npc = null;
for (int j = 0; j < entityPlayer.Companions.Count; j++)
{
npc = entityPlayer.Companions[j] as EntityNPCRebirth;
if (npc != null)
{
bool cantUseNPC = npc.Buffs.GetCustomVar("onMission") == 1f ||
npc.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1f ||
npc.Buffs.GetCustomVar("$FR_NPC_Hidden") == 1f;
//Log.Out("RebirthUtilities-AddPlayerItem 16, npc.enabled: " + npc.enabled);
//Log.Out("RebirthUtilities-AddPlayerItem 16, cantUseNPC: " + cantUseNPC);
if (npc.enabled && !cantUseNPC)
{
//Log.Out("RebirthUtilities-AddPlayerItem 17");
if (npc.HasAnyTags(FastTags<TagGroup.Global>.Parse("allyanimal")))
{
//Log.Out("RebirthUtilities-AddPlayerItem 18");
if (npc.lootContainer.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-AddPlayerItem 19");
ValueTuple<bool, bool> tryStack = npc.lootContainer.TryStackItem(npc.lootContainer.GetClrIdx(), itemStack);
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-AddPlayerItem 20");
bool tryAdd = npc.lootContainer.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 21");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 22");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 23");
bool tryAdd = npc.lootContainer.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 24");
addItems = true;
}
}
if (addItems)
{
//Log.Out("RebirthUtilities-AddPlayerItem 25");
break;
}
}
}
}
}
}
if (!addItems && useDrone && entityPlayer.OwnedEntityCount > 0)
{
OwnedEntityData[] ownedEntityClass = entityPlayer.GetOwnedEntityClass("entityJunkDrone");
if (ownedEntityClass.Length != 0)
{
//Log.Out("RebirthUtilities-AddPlayerItem 7");
EntityDrone entityDrone = GameManager.Instance.World.GetEntity(ownedEntityClass[0].Id) as EntityDrone;
if (entityDrone != null)
{
//Log.Out("RebirthUtilities-AddPlayerItem 8");
if (entityDrone.lootContainer.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-AddPlayerItem 9");
ValueTuple<bool, bool> tryStack = entityDrone.lootContainer.TryStackItem(entityDrone.lootContainer.GetClrIdx(), itemStack);
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-AddPlayerItem 10");
bool tryAdd = entityDrone.lootContainer.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 11");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 12");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 13");
bool tryAdd = entityDrone.lootContainer.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 14");
addItems = true;
}
}
}
}
}
//Log.Out("RebirthUtilities-AddPlayerItem addItems: " + addItems);
if (!addItems && useNPCs && entityPlayer.Companions.Count > 0)
{
//Log.Out("RebirthUtilities-AddPlayerItem 15");
EntityNPCRebirth npc = null;
for (int j = 0; j < entityPlayer.Companions.Count; j++)
{
//Log.Out("RebirthUtilities-AddPlayerItem 16");
npc = entityPlayer.Companions[j] as EntityNPCRebirth;
if (npc != null)
{
bool cantUseNPC = npc.Buffs.GetCustomVar("onMission") == 1f ||
npc.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1f ||
npc.Buffs.GetCustomVar("$FR_NPC_Hidden") == 1f;
if (npc.enabled && !cantUseNPC)
{
//Log.Out("RebirthUtilities-AddPlayerItem 17");
if (!npc.HasAnyTags(FastTags<TagGroup.Global>.Parse("trader,allyanimal,noinventory,temp")))
{
//Log.Out("RebirthUtilities-AddPlayerItem 18");
if (npc.lootContainer.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-AddPlayerItem 19");
ValueTuple<bool, bool> tryStack = npc.lootContainer.TryStackItem(npc.lootContainer.GetClrIdx(), itemStack);
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-AddPlayerItem 20");
bool tryAdd = npc.lootContainer.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 21");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 22");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 23");
bool tryAdd = npc.lootContainer.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 24");
addItems = true;
}
}
if (addItems)
{
//Log.Out("RebirthUtilities-AddPlayerItem 25");
break;
}
}
}
}
}
}
}
if (!addItems)
{
if (entityPlayer.inventory.GetItemCount(itemStack.itemValue) > 0)
{
bool tryStack = entityPlayer.inventory.TryStackItem(_ClrIdx, itemStack);
if (!tryStack)
{
//Log.Out("RebirthUtilities-AddPlayerItem 26");
bool tryAdd = entityPlayer.inventory.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 27");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 28");
if (entityPlayer.bag.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-AddPlayerItem 29");
ValueTuple<bool, bool> tryStackTuple = entityPlayer.bag.TryStackItem(_ClrIdx, itemStack);
if (!tryStackTuple.Item1)
{
//Log.Out("RebirthUtilities-AddPlayerItem 30");
bool tryAdd = entityPlayer.bag.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 31");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 32");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 33");
bool tryAdd = entityPlayer.bag.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 34");
addItems = true;
}
}
}
}
else
{
if (entityPlayer.bag.HasItem(itemStack.itemValue))
{
//Log.Out("RebirthUtilities-AddPlayerItem 29");
ValueTuple<bool, bool> tryStack = entityPlayer.bag.TryStackItem(_ClrIdx, itemStack);
if (!tryStack.Item1)
{
//Log.Out("RebirthUtilities-AddPlayerItem 30");
bool tryAdd = entityPlayer.bag.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 31");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 32");
addItems = true;
}
}
else
{
//Log.Out("RebirthUtilities-AddPlayerItem 33");
bool tryAdd = entityPlayer.bag.AddItem(itemStack);
if (tryAdd)
{
//Log.Out("RebirthUtilities-AddPlayerItem 34");
addItems = true;
}
}
}
}
//Log.Out("RebirthUtilities-AddPlayerItem END");
return addItems;
}
public static bool BlockExists(Vector3i _blockpos, int blockHeight, int blockWidth, string blockName)
{
int posX = 0;
int posY = 0;
int posZ = 0;
int num = 0;
for (int i = 0; i < blockHeight; i++)
{
for (int j = -(blockWidth - 1); j < blockWidth; j++)
{
for (int k = -(blockWidth - 1); k < blockWidth; k++)
{
posY = _blockpos.y + i;
posX = _blockpos.x + j;
posZ = _blockpos.z + k;
num++;
BlockValue block = GameManager.Instance.World.GetBlock(new Vector3i(posX, posY, posZ));
if (block.Block.GetBlockName().Contains(blockName))
{
////Log.Out("RebirthUtilities-BlockExists FOUND BLOCK, num: " + num);
return true;
}
}
}
}
return false;
}
public static ItemValue GetItemValue(EntityAlive entity, string key, string entityClassName = "None")
{
ItemValue itemValue = null;
if (key == "JunkTurret")
{
float levelTechnogeekClass = GetPerkLevel(entity, "furiousramsayatttechnogeek");
if (RebirthUtilities.IsClassActive(3) && levelTechnogeekClass >= 3)
{
if (entityClassName.Contains("JunkTurret"))
{
itemValue = ItemClass.GetItem(entityClassName.Replace("Gun", "Type"), false);
}
}
}
return itemValue;
}
public static void takeFromEntityContainer(EntityAlive entity, string itemGroupOrName)
{
ItemStack[] array = entity.bag.GetSlots();
if (entity.lootContainer != null)
{
array = entity.lootContainer.GetItems();
}
for (int i = 0; i < array.Length; i++)
{
if (array[i] != null && array[i].itemValue != null && array[i].itemValue.ItemClass != null && array[i].count > 0 && array[i].itemValue.ItemClass.Name.ContainsCaseInsensitive(itemGroupOrName))
{
array[i].count--;
if (array[i].count == 0)
{
array[i] = ItemStack.Empty.Clone();
}
entity.bag.SetSlots(array);
entity.bag.OnUpdate();
entity.lootContainer?.UpdateSlot(i, array[i]);
break;
}
}
}
public static float getDiscount(EntityPlayer player)
{
float perc = 1;
float progressionLevel = 0;
ProgressionValue progressionValue = player.Progression.GetProgressionValue("perkBetterBarter");
if (progressionValue != null)
{
progressionLevel = RebirthUtilities.GetCalculatedLevel(player, progressionValue);
}
if (progressionLevel == 1)
{
perc -= 0.02f;
}
else if (progressionLevel == 2)
{
perc -= 0.04f;
}
else if (progressionLevel == 3)
{
perc -= 0.06f;
}
else if (progressionLevel == 4)
{
perc -= 0.08f;
}
else if (progressionLevel == 5)
{
perc -= 0.1f;
}
progressionLevel = 0;
progressionValue = player.Progression.GetProgressionValue("FuriousRamsayAchievementTradeAura");
if (progressionValue != null)
{
progressionLevel = progressionValue.Level;
}
if (progressionLevel == 1)
{
perc -= 0.2f;
}
else if (progressionLevel == 2)
{
perc -= 0.3f;
}
else if (progressionLevel == 3)
{
perc -= 0.4f;
}
return perc;
}
public static void toggleCollisions(bool value, EntityAlive entity)
{
Transform physics = GameUtils.FindTagInChilds(entity.RootTransform, "LargeEntityBlocker");
if (physics)
{
/*if (entity.Buffs.GetCustomVar("$Leader") > 0)
{
//Log.Out("Set active: " + value);
}*/
physics.gameObject.SetActive(value);
}
entity.PhysicsTransform.gameObject.SetActive(value);
entity.IsNoCollisionMode.Value = !value;
}
public static bool IsAnyPlayerWithingDist(float dist, EntityAlive entity)
{
PersistentPlayerList persistentPlayerList = GameManager.Instance.GetPersistentPlayerList();
if ((persistentPlayerList?.Players) != null)
{
foreach (KeyValuePair<PlatformUserIdentifierAbs, PersistentPlayerData> keyValuePair in persistentPlayerList.Players)
{
EntityPlayer entityPlayer = entity.world.GetEntity(keyValuePair.Value.EntityId) as EntityPlayer;
if (entityPlayer)
{
float magnitude = (entityPlayer.getChestPosition() - entity.position).magnitude;
//Log.Out("RebirthUtilities-IsAnyPlayerWithingDist dist: " + dist);
//Log.Out("RebirthUtilities-IsAnyPlayerWithingDist entityPlayer.getChestPosition(): " + entityPlayer.getChestPosition());
//Log.Out("RebirthUtilities-IsAnyPlayerWithingDist entity.position: " + entity.position);
//Log.Out("RebirthUtilities-IsAnyPlayerWithingDist magnitude: " + magnitude);
if (entityPlayer && (magnitude <= dist))
{
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(entity, entityPlayer);
//FactionManager.Relationship myRelationship = FactionManager.Instance.GetRelationshipTier(entity, entityPlayer);
if (!shouldAttack /*myRelationship == FactionManager.Relationship.Love*/)
{
////Log.Out("RebirthUtilities-IsAnyPlayerWithingDist IsAnyPlayerWithingDist: " + (entityPlayer && (magnitude <= dist)));
return true;
}
}
}
}
////Log.Out("RebirthUtilities-IsAnyPlayerWithingDist IsAnyPlayerWithingDist: false");
return false;
}
////Log.Out("RebirthUtilities-IsAnyPlayerWithingDist IsAnyPlayerWithingDist: false");
return false;
}
public static void SetupTraderPrefabList(TraderArea area, int difficulty, ref Dictionary<TraderArea, List<QuestEventManager.PrefabListData>> TraderPrefabList)
{
if (!TraderPrefabList.ContainsKey(area))
{
Vector3 vector = area.Position.ToVector3();
List<PrefabInstance> poiprefabs = GameManager.Instance.GetDynamicPrefabDecorator().GetPOIPrefabs();
List<QuestEventManager.PrefabListData> list = new List<QuestEventManager.PrefabListData>();
QuestEventManager.PrefabListData prefabListData = new QuestEventManager.PrefabListData();
QuestEventManager.PrefabListData prefabListData2 = new QuestEventManager.PrefabListData();
QuestEventManager.PrefabListData prefabListData3 = new QuestEventManager.PrefabListData();
list.Add(prefabListData);
list.Add(prefabListData2);
list.Add(prefabListData3);
for (int i = 0; i < poiprefabs.Count; i++)
{
float num = Vector3.Distance(vector, poiprefabs[i].boundingBoxPosition);
if (num <= 1000f)
{
prefabListData.AddPOI(poiprefabs[i]);
}
else if (num <= 1500f)
{
prefabListData2.AddPOI(poiprefabs[i]);
}
else
{
prefabListData3.AddPOI(poiprefabs[i]);
}
}
TraderPrefabList.Add(area, list);
}
}
public static int GetEventCooldown(int playerLevel, float frequency)
{
////Log.Out("RebirthUtilities-GetEventCooldown START");
int numCooldown = 1;
int eventCooldown = (15 * 30) - (playerLevel * 10);
if (eventCooldown < (numCooldown * 30))
{
////Log.Out("RebirthUtilities-GetEventCooldown 1");
eventCooldown = numCooldown * 30;
}
eventCooldown = (int)(eventCooldown * frequency);
////Log.Out("RebirthUtilities-GetEventCooldown eventCooldown: " + eventCooldown);
return eventCooldown;
}
public static bool IsIndoors(EntityAlive entity)
{
////Log.Out("RebirthUtilities-IsIndoors START");
bool bIsIndoors = entity.Stats.AmountEnclosed > 0f;
////Log.Out("RebirthUtilities-IsIndoors entity.Stats.AmountEnclosed: " + entity.Stats.AmountEnclosed);
Vector3i vector3i = World.worldToBlockPos(entity.position);
float numTerrainHeight = GameManager.Instance.World.GetTerrainHeight(vector3i.x, vector3i.z);
float numPlayerHeight = vector3i.y;
bool bResult = false;
if (bIsIndoors)
{
////Log.Out("RebirthUtilities-IsIndoors 1");
bResult = true;
}
else
{
////Log.Out("RebirthUtilities-IsIndoors 2");
float numDifference = numPlayerHeight - numTerrainHeight;
if (numDifference > 3f)
{
////Log.Out("RebirthUtilities-IsIndoors 3");
bResult = true;
}
}
return bResult;
}
public static (float newX, float newY) CalculateNewPosition(float currentX, float currentZ, double distance, double rotation)
{
// Convert rotation angle from degrees to radians
double rotationInRadians = rotation * Math.PI / 180.0;
// Calculate the new position based on distance and rotation
double deltaX = distance * Math.Cos(rotationInRadians);
double deltaY = distance * Math.Sin(rotationInRadians);
// Calculate the new x and y coordinates
float newX = currentX + (float)deltaX;
float newY = currentZ + (float)deltaY;
return (newX, newY);
}
private static bool overlapsWithOtherBlock(WorldBase _world, Vector3 _pos)
{
////Log.Out("RebirthUtilities-overlapsWithOtherBlock START");
Vector3i _blockPos = Vector3i.FromVector3Rounded(_pos);
BlockValue blockValue = _world.GetBlock(_blockPos);
////Log.Out("RebirthUtilities-overlapsWithOtherBlock blockValue: " + blockValue.Block.GetBlockName());
int type = _world.GetBlock(_blockPos).type;
bool isType0 = type == 0;
bool isGroundCover = Block.list[type].blockMaterial.IsGroundCover;
bool isWater = _world.IsWater(_blockPos);
bool overlaps = !isType0 && !isGroundCover && !isWater;
return overlaps;
}
public static EntityAlive SpawnEntity(int entityID, string strEntity, int numEntities = 1, string entityPos = "", string entityRot = "", string strDistance = "", string strSpawner = "dynamic", string strHeight = "", string strDirection = "", float numStartScale = 1f, int numRotation = -1, bool randomRotation = false, bool atPlayerLevel = false, bool attackPlayer = true, int entityPlayerID = -1, int minion = -1, string strSound = "", int maxEntities = 20, int checkMaxEntities = 0, int minMax = 40, int repeat = 1, int allNames = 1, int isBoss = -1, int handParticle = -1, string lootListName = "", string lootDropClass = "", int lootDropChance = 1, string navIcon = "", string buffList = "", bool setRespawn = false, bool forceSpawn = false)
{
EntityAlive result = null;
//Log.Out("RebirthUtilities-SpawnEntity START");
//Log.Out("RebirthUtilities-SpawnEntity entityID: " + entityID);
//Log.Out("RebirthUtilities-SpawnEntity strEntity: " + strEntity);
//Log.Out("RebirthUtilities-SpawnEntity numEntities: " + numEntities);
//Log.Out("RebirthUtilities-SpawnEntity entityPos: " + entityPos);
//Log.Out("RebirthUtilities-SpawnEntity entityRot: " + entityRot);
//Log.Out("RebirthUtilities-SpawnEntity strDistance: " + strDistance);
//Log.Out("RebirthUtilities-SpawnEntity strSpawner: " + strSpawner);
//Log.Out("RebirthUtilities-SpawnEntity strHeight: " + strHeight);
//Log.Out("RebirthUtilities-SpawnEntity strDirection: " + strDirection);
//Log.Out("RebirthUtilities-SpawnEntity numStartScale: " + numStartScale);
//Log.Out("RebirthUtilities-SpawnEntity numRotation: " + numRotation);
//Log.Out("RebirthUtilities-SpawnEntity randomRotation: " + randomRotation);
//Log.Out("RebirthUtilities-SpawnEntity atPlayerLevel: " + atPlayerLevel);
//Log.Out("RebirthUtilities-SpawnEntity attackPlayer: " + attackPlayer);
//Log.Out("RebirthUtilities-SpawnEntity entityPlayerID: " + entityPlayerID);
//Log.Out("RebirthUtilities-SpawnEntity minion: " + minion);
//Log.Out("RebirthUtilities-SpawnEntity strSound: " + strSound);
//Log.Out("RebirthUtilities-SpawnEntity maxEntities: " + maxEntities);
//Log.Out("RebirthUtilities-SpawnEntity checkMaxEntities: " + checkMaxEntities);
//Log.Out("RebirthUtilities-SpawnEntity minMax: " + minMax);
//Log.Out("RebirthUtilities-SpawnEntity repeat: " + repeat);
//Log.Out("RebirthUtilities-SpawnEntity allNames: " + allNames);
//Log.Out("RebirthUtilities-SpawnEntity isBoss: " + isBoss);
//Log.Out("RebirthUtilities-SpawnEntity handParticle: " + handParticle);
//Log.Out("RebirthUtilities-SpawnEntity lootListName: " + lootListName);
//Log.Out("RebirthUtilities-SpawnEntity lootDropClass: " + lootDropClass);
//Log.Out("RebirthUtilities-SpawnEntity lootDropChance: " + lootDropChance);
//Log.Out("RebirthUtilities-SpawnEntity navIcon: " + navIcon);
//Log.Out("RebirthUtilities-SpawnEntity buffList: " + buffList);
//Log.Out("RebirthUtilities-SpawnEntity setRespawn: " + setRespawn);
//Log.Out("RebirthUtilities-SpawnEntity forceSpawn: " + forceSpawn);
//Log.Out("RebirthUtilities-SpawnEntity START, strEntity: " + strEntity);
string optionTornados = RebirthVariables.customTornados;
if (!(optionTornados == "always" || optionTornados == "hordenightonly") && strEntity.ToLower() == "furiousramsaywindtornado")
{
return result;
}
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntityAdvanced>().Setup(
entityID,
strEntity,
numEntities,
entityPos,
entityRot,
strDistance,
strSpawner,
strHeight,
strDirection,
numStartScale,
numRotation,
randomRotation,
atPlayerLevel,
attackPlayer,
entityPlayerID,
minion,
strSound,
maxEntities,
checkMaxEntities,
minMax,
repeat,
allNames,
isBoss,
handParticle,
lootListName,
lootDropClass,
lootDropChance,
navIcon,
buffList,
setRespawn
));
return result;
}
World world = GameManager.Instance.World;
EntityAlive entity = world.GetEntity(entityID) as EntityAlive;
EntityPlayer entityPlayer = null;
ItemValue holdingItemItemValue = null;
if (entityPlayerID > 0)
{
entityPlayer = world.GetEntity(entityPlayerID) as EntityPlayer;
if (entityPlayer != null)
{
holdingItemItemValue = entityPlayer.inventory.holdingItemItemValue;
}
}
if (entity == null)
{
return result;
}
Vector3 transformPos = MinEventParams.CachedEventParam.Position;
int numDistance = 0;
int numHeight = 0;
bool isWithinPOIBounds = false;
int iterations = 0;
string POIName = "";
Entity closestEntity = null;
int randomNumber = 0;
int number = 0;
if (strDistance != "")
{
numDistance = short.Parse(strDistance);
}
if (strHeight != "")
{
numHeight = short.Parse(strHeight);
}
Vector3 rotation = new Vector3(0f, entity.rotation.y, 0f);
//Log.Out("RebirthUtilities-SpawnEntity rotation 1: " + rotation);
if (entity == null)
{
//Log.Out("RebirthUtilities-SpawnEntity 1");
return result;
}
//Log.Out("RebirthUtilities-SpawnEntity entity.EntityClass.entityClassName: " + entity.EntityClass.entityClassName);
//Log.Out("RebirthUtilities-SpawnEntity entity.position: " + entity.position);
//Log.Out("RebirthUtilities-SpawnEntity entity.rotation.y: " + entity.rotation.y);
//Log.Out("RebirthUtilities-SpawnEntity transformPos (BEFORE): " + transformPos);
//Log.Out("RebirthUtilities-SpawnEntity numDistance: " + numDistance);
//Log.Out("RebirthUtilities-SpawnEntity numHeight: " + numHeight);
//Log.Out("RebirthUtilities-SpawnEntity atPlayerLevel: " + atPlayerLevel);
for (int y = 0; y < repeat; y++)
{
if (checkMaxEntities == 1)
{
//Log.Out("RebirthUtilities-SpawnEntity checkMaxEntities");
List<Entity> entitiesInBounds = world.GetEntitiesInBounds(typeof(EntityZombieSDX), BoundsUtils.BoundsForMinMax(entity.position.x - minMax, entity.position.y - 50, entity.position.z - minMax, entity.position.x + minMax, entity.position.y + 30, entity.position.z + minMax), new List<Entity>());
List<Entity> entitiesInBounds2 = world.GetEntitiesInBounds(typeof(EntityZombieCopRebirth), BoundsUtils.BoundsForMinMax(entity.position.x - minMax, entity.position.y - 50, entity.position.z - minMax, entity.position.x + minMax, entity.position.y + 30, entity.position.z + minMax), new List<Entity>());
//Log.Out("RebirthUtilities-SpawnEntity checkMaxEntities entitiesInBounds.Count: " + (entitiesInBounds.Count + entitiesInBounds2.Count));
if ((entitiesInBounds.Count + entitiesInBounds2.Count) > maxEntities)
{
return result;
}
}
if (numDistance > 0 && numDistance != 8888 && numDistance != 9998 && numDistance != 9999 && randomRotation)
{
randomNumber = UnityEngine.Random.Range(0, 359);
//Log.Out("RebirthUtilities-SpawnEntity numDistance: " + numDistance);
for (int findPosition = 0; findPosition <= 360; findPosition++)
{
//Log.Out("RebirthUtilities-SpawnEntity findPosition: " + findPosition);
isWithinPOIBounds = false;
number = randomNumber - findPosition;
if (number < 0)
{
number = 360 + number;
}
//Log.Out("RebirthUtilities-SpawnEntity randomNumber: " + randomNumber);
float x = numDistance * Mathf.Sin(number);
float z = numDistance * Mathf.Cos(number);
//Log.Out("RebirthUtilities-SpawnEntity numHeight: " + numHeight);
//Log.Out("RebirthUtilities-SpawnEntity transformPos.y (BEFORE): " + transformPos.y);
transformPos.x = entity.position.x + x;
transformPos.z = entity.position.z + z;
transformPos.y = entity.position.y + numHeight;
//Log.Out("RebirthUtilities-SpawnEntity entity: " + entity.EntityClass.entityClassName);
//Log.Out("RebirthUtilities-SpawnEntity entity.position.y: " + entity.position.y);
//Log.Out("RebirthUtilities-SpawnEntity transformPos.y (AFTER): " + transformPos.y);
PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(transformPos); // world.GetPOIAtPosition(transformPos, true);
iterations = findPosition;
if (poiatPosition != null)
{
isWithinPOIBounds = true;
POIName = poiatPosition.name;
//Log.Out("RebirthUtilities-SpawnEntity poiatPosition.name: " + poiatPosition.name);
}
/*for (int i = 0; i < GameManager.Instance.GetDynamicPrefabDecorator().allPrefabs.Count; i++)
{
PrefabInstance prefabInstance = GameManager.Instance.GetDynamicPrefabDecorator().allPrefabs[i];
int boundingBoxPositionX = prefabInstance.boundingBoxPosition.x;
int boundingBoxPositionZ = prefabInstance.boundingBoxPosition.z;
if (boundingBoxPositionX <= (int)transformPos.x &&
boundingBoxPositionZ <= (int)transformPos.z &&
boundingBoxPositionX + prefabInstance.boundingBoxSize.x >= (int)transformPos.x &&
boundingBoxPositionZ + prefabInstance.boundingBoxSize.z >= (int)transformPos.z
&&
!prefabInstance.prefab.FileNameNoExtension.Contains("rwg_tile") &&
!prefabInstance.prefab.FileNameNoExtension.Contains("part_")
)
{
POIName = GameManager.Instance.GetDynamicPrefabDecorator().allPrefabs[i].prefab.FileNameNoExtension;
isWithinPOIBounds = true;
break;
}
}*/
if (!isWithinPOIBounds)
{
//Log.Out("RebirthUtilities-SpawnEntity findPosition: " + findPosition);
//Log.Out("RebirthUtilities-SpawnEntity IS NOT WITHIN BOUNDS");
break;
}
}
}
else if (numDistance == 8888)
{
//Log.Out("RebirthUtilities-SpawnEntity 8888 1");
Vector3 vector = new Vector3((world.GetGameRandom().RandomFloat * 2f) + -1f, 0f, (world.GetGameRandom().RandomFloat * 2f) + -1f);
vector.Normalize();
float num = (world.GetGameRandom().RandomFloat * 12f) + 12f;
List<Entity> entitiesInBounds = world.GetEntitiesInBounds(typeof(EntityZombieSDX), BoundsUtils.BoundsForMinMax(entity.position.x - minMax, entity.position.y - 50, entity.position.z - minMax, entity.position.x + minMax, entity.position.y + 30, entity.position.z + minMax), new List<Entity>());
float currentDistance = 9999;
//int numClosestEntity = -1;
for (int i = 0; i < entitiesInBounds.Count; i++)
{
float distance = entity.GetDistanceSq(entitiesInBounds[i]);
if (distance < currentDistance)
{
//Log.Out("RebirthUtilities-SpawnEntity 8888 2");
currentDistance = distance;
//numClosestEntity = i;
closestEntity = entitiesInBounds[i];
}
}
Vector3 vector2 = entity.position + (vector * num);
rotation = new Vector3(0f, entity.transform.eulerAngles.y + 180f, 0f);
if (closestEntity)
{
//Log.Out("RebirthUtilities-SpawnEntity 8888 3, entity: " + closestEntity.EntityClass.entityClassName);
//Log.Out("RebirthUtilities-SpawnEntity 8888 4, Y: " + closestEntity.position.y);
vector2 = closestEntity.position;
rotation = new Vector3(0f, closestEntity.transform.eulerAngles.y + 180f, 0f);
}
float num2 = world.GetHeight((int)vector2.x, (int)vector2.z);
float num3 = world.GetTerrainHeight((int)vector2.x, (int)vector2.z);
vector2.y = ((num2 + num3) / 2f) + 1.5f;
transformPos.x = vector2.x;
transformPos.z = vector2.z;
transformPos.y = vector2.y;
//Log.Out("RebirthUtilities-SpawnEntity 8888 4, transformPos Y: " + closestEntity.position.y);
}
else if (numDistance == 9998)
{
//Log.Out("RebirthUtilities-SpawnEntity BEFORE transformPos.y: " + transformPos.y);
//Log.Out("RebirthUtilities-SpawnEntity numHeight: " + numHeight);
transformPos.y = transformPos.y + numHeight;
//Log.Out("RebirthUtilities-SpawnEntity AFTER transformPos.y: " + transformPos.y);
// DO NOTHING
}
else if (numDistance == 9999)
{
//Log.Out("RebirthUtilities-SpawnEntity 2");
// Do nothing
for (int findPosition = 0; findPosition <= 360; findPosition++)
{
randomNumber = UnityEngine.Random.Range(0, 359);
float x = 1.0f * Mathf.Sin(randomNumber);
float z = 1.0f * Mathf.Cos(randomNumber);
transformPos.x = entity.position.x + x;
transformPos.z = entity.position.z + z;
Vector3i blockPosition = Vector3i.FromVector3Rounded(new Vector3(transformPos.x, entity.position.y + .25f, transformPos.z));
bool notValidPosition = overlapsWithOtherBlock(world, blockPosition);
//Log.Out("================================================================================");
//Log.Out("RebirthUtilities-SpawnEntity randomNumber: " + randomNumber);
//Log.Out("RebirthUtilities-SpawnEntity transformPos (BEFORE): " + transformPos);
//Log.Out("RebirthUtilities-SpawnEntity blockPosition: " + blockPosition);
//Log.Out("RebirthUtilities-SpawnEntity notValidPosition: " + notValidPosition);
//Log.Out("RebirthUtilities-SpawnEntity BLOCK: " + world.GetBlock(Vector3i.FromVector3Rounded(new Vector3(transformPos.x, transformPos.y, transformPos.z))).Block.GetBlockName() + ", pos: " + Vector3i.FromVector3Rounded(new Vector3(transformPos.x, transformPos.y, transformPos.z)));
//Log.Out("RebirthUtilities-SpawnEntity BLOCK + .25: " + world.GetBlock(Vector3i.FromVector3Rounded(new Vector3(transformPos.x, transformPos.y + .25f, transformPos.z))).Block.GetBlockName() + ", pos: " + Vector3i.FromVector3Rounded(new Vector3(transformPos.x, transformPos.y + .25f, transformPos.z)));
if (!notValidPosition)
{
transformPos.x = blockPosition.x;
transformPos.y = blockPosition.y + .25f;
transformPos.z = blockPosition.z;
//Log.Out("RebirthUtilities-SpawnEntity transformPos (AFTER): " + transformPos);
break;
}
}
}
else if (randomRotation)
{
//Log.Out("RebirthUtilities-SpawnEntity 3");
transformPos.x = entity.position.x;
transformPos.z = entity.position.z;
transformPos.y = entity.position.y;
transformPos.y = transformPos.y + numHeight;
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity 3a");
// Get the forward vector (direction) and rotation of the player
Vector3 direction = entity.GetForwardVector();
Quaternion rotationNew = Quaternion.Euler(entity.rotation);
// Calculate the position of the new entity relative to the player
Vector3 newPosition = entity.position + (Quaternion.Euler(0f, numRotation, 0f) * direction * numDistance);
// Set the position and rotation of the new entity
transformPos = newPosition;
rotationNew *= Quaternion.Euler(0f, numRotation, 0f);
transformPos.y = transformPos.y + numHeight;
rotation.y = rotationNew.eulerAngles.y;
}
//Log.Out("RebirthUtilities-SpawnEntity transformPos (AFTER): " + transformPos);
/*//Log.Out("==============================================================================================================");
//Log.Out("==============================================================================================================");
//Log.Out("RebirthUtilities-SpawnEntity strEntity: " + strEntity);
//Log.Out("RebirthUtilities-SpawnEntity POIName: " + POIName);
//Log.Out("RebirthUtilities-SpawnEntity iterations: " + iterations);
//Log.Out("RebirthUtilities-SpawnEntity randomNumber: " + randomNumber);
//Log.Out("RebirthUtilities-SpawnEntity number: " + number);
//Log.Out("==============================================================================================================");
//Log.Out("==============================================================================================================");*/
/*if (isWithinPOIBounds)
{
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity Is not in a POI");
}*/
if (numRotation != -1)
{
//Log.Out("RebirthUtilities-SpawnEntity 3b");
if (randomRotation)
{
//Log.Out("RebirthUtilities-SpawnEntity 3c");
rotation.y += numRotation;
}
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity 3d");
if (numRotation == -1 && entityPlayer != null)
{
//Log.Out("RebirthUtilities-SpawnEntity 3d Face Player");
// Face player
Vector3 directionVector = entityPlayer.position - transformPos;
// Calculate the spawn position based on the player's position and facing direction
//Vector3 spawnPosition = entityPlayer.transform.position + entityPlayer.transform.forward * numDistance;
if (numDistance == 8888 && closestEntity)
{
directionVector = closestEntity.position - transformPos;
}
// Calculate the rotation to face the player
//Quaternion spawnRotation = Quaternion.LookRotation(entityPlayer.transform.position - spawnPosition, Vector3.up);
// Calculate the rotation quaternion from the direction vector
rotation.y = Quaternion.LookRotation(directionVector, Vector3.up).eulerAngles.y;
//Log.Out("RebirthUtilities-SpawnEntity rotation.y: " + rotation.y);
}
}
Vector3 startPoint = new Vector3(transformPos.x, transformPos.y, transformPos.z);
Vector3i blockPos = new Vector3i(startPoint);
bool overlaps = false;
Vector3i vector3i = World.worldToBlockPos(transformPos);
float numTerrainHeight = GameManager.Instance.World.GetTerrainHeight(vector3i.x, vector3i.z);
if (atPlayerLevel)
{
if (numTerrainHeight < entity.position.y)
{
overlaps = overlapsWithOtherBlock(world, new Vector3(transformPos.x, entity.position.y + .25f, transformPos.z));
//Log.Out("RebirthUtilities-SpawnEntity overlaps 1: " + overlaps);
if (overlaps)
{
//Log.Out("RebirthUtilities-SpawnEntity overlaps BLOCK A: " + world.GetBlock(Vector3i.FromVector3Rounded(new Vector3(transformPos.x, entity.position.y + .25f, transformPos.z))).Block.GetBlockName() + ", pos: " + Vector3i.FromVector3Rounded(new Vector3(transformPos.x, entity.position.y + .25f, transformPos.z)));
overlaps = overlapsWithOtherBlock(world, new Vector3(transformPos.x, entity.position.y + 1f, transformPos.z));
//Log.Out("RebirthUtilities-SpawnEntity overlaps 1a: " + overlaps);
if (!overlaps)
{
//Log.Out("RebirthUtilities-SpawnEntity overlaps 1b");
transformPos.y = entity.position.y + 1f;
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity overlaps BLOCK B: " + world.GetBlock(Vector3i.FromVector3Rounded(new Vector3(transformPos.x, entity.position.y + 1f, transformPos.z))).Block.GetBlockName() + ", pos: " + Vector3i.FromVector3Rounded(new Vector3(transformPos.x, entity.position.y + 1f, transformPos.z)));
}
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity overlaps 1c");
transformPos.y = entity.position.y + .25f;
}
}
else
{
overlaps = overlapsWithOtherBlock(world, new Vector3(transformPos.x, numTerrainHeight, transformPos.z));
transformPos.y = numTerrainHeight + 1.5f;
//Log.Out("RebirthUtilities-SpawnEntity BLOCK: " + world.GetBlock(Vector3i.FromVector3Rounded(new Vector3(transformPos.x, numTerrainHeight, transformPos.z))).Block.GetBlockName() + ", pos: " + Vector3i.FromVector3Rounded(new Vector3(transformPos.x, numTerrainHeight + 1.5f, transformPos.z)));
//Log.Out("RebirthUtilities-SpawnEntity overlaps 2: " + overlaps);
}
}
else
{
overlaps = overlapsWithOtherBlock(world, new Vector3(transformPos.x, transformPos.y, transformPos.z));
if (transformPos.y < numTerrainHeight)
{
transformPos.y = numTerrainHeight;
}
if (numHeight == 0)
{
transformPos.y = transformPos.y + 1.5f;
}
else
{
transformPos.y = transformPos.y + numHeight;
}
//Log.Out("RebirthUtilities-SpawnEntity BLOCK: " + world.GetBlock(Vector3i.FromVector3Rounded(new Vector3(transformPos.x, transformPos.y, transformPos.z))).Block.GetBlockName() + ", pos: " + Vector3i.FromVector3Rounded(new Vector3(transformPos.x, transformPos.y + 1.5f, transformPos.z)));
//Log.Out("RebirthUtilities-SpawnEntity overlaps 3: " + overlaps);
}
if (!randomRotation && overlaps)
{
//Log.Out("RebirthUtilities-SpawnEntity COULD NOT SPAWN ENTITY");
return result;
}
//Log.Out("RebirthUtilities-SpawnEntity SPAWN X: " + blockPos.x);
//Log.Out("RebirthUtilities-SpawnEntity SPAWN Y: " + blockPos.y);
//Log.Out("RebirthUtilities-SpawnEntity SPAWN Z: " + blockPos.z);
//Log.Out("RebirthUtilities-SpawnEntity strEntity: " + strEntity);
string[] words = strEntity.Split(',');
List<string> names = new List<string>();
//Log.Out("RebirthUtilities-SpawnEntity words.Length: " + words.Length);
if (allNames == 0)
{
for (int i = 0; i < numEntities; i++)
{
int numRandom = Manager.random.RandomRange(0, words.Length - 1);
names.Add(words[numRandom]);
}
}
else
{
for (int i = 0; i < words.Length; i++)
{
names.Add(words[i]);
}
}
//Log.Out("RebirthUtilities-SpawnEntity names: " + names);
//Log.Out("RebirthUtilities-SpawnEntity names.Count: " + names.Count);
if (entityPos != "")
{
//Log.Out("RebirthUtilities-SpawnEntity entityPos: " + entityPos);
entityPos = entityPos.Replace(")", "").Replace("(", "");
string[] coordinates = entityPos.Split(',');
transformPos = new Vector3(float.Parse(coordinates[0]), float.Parse(coordinates[1]), float.Parse(coordinates[2]));
//Log.Out("RebirthUtilities-SpawnEntity transformPos: " + transformPos);
}
if (entityRot != "")
{
//Log.Out("RebirthUtilities-SpawnEntity entityRot: " + entityPos);
entityRot = entityRot.Replace(")", "").Replace("(", "");
string[] coordinates = entityRot.Split(',');
rotation = new Vector3(float.Parse(coordinates[0]), float.Parse(coordinates[1]), float.Parse(coordinates[2]));
//Log.Out("RebirthUtilities-SpawnEntity rotation: " + transformPos);
}
for (int i = 0; i < numEntities; i++)
{
foreach (string word in names)
{
//Log.Out("RebirthUtilities-SpawnEntity word: " + word);
int entityId = EntityClass.FromString(word);
//Log.Out("RebirthUtilities-SpawnEntity entityId: " + entityId);
//Log.Out("RebirthUtilities-SpawnEntity transformPos (BEFORE ENTITY CREATION): " + transformPos);
EntityAlive NewEntity = null;
bool isTemporary = false;
try
{
NewEntity = EntityFactory.CreateEntity(entityId, transformPos, rotation) as EntityAlive;
}
catch (Exception ex)
{
//Log.Out("RebirthUtilities-SpawnEntity ERROR: " + ex.Message);
continue;
}
if (NewEntity == null)
{
//Log.Out("RebirthUtilities-SpawnEntity NO ENTITY TO SPAWN: " + word);
continue;
}
if (NewEntity.EntityClass.Tags.Test_AnySet(FastTags<TagGroup.Global>.Parse("temp")))
{
isTemporary = true;
}
//Log.Out("RebirthUtilities-SpawnEntity NewEntity: " + NewEntity.EntityName);
if (isBoss > 1)
{
//Log.Out("RebirthUtilities-SpawnEntity CAN OPEN DOORS");
NewEntity.Buffs.SetCustomVar("$varFuriousRamsayOpenDoors", 1f);
}
if (isBoss == 1 || isBoss == 2)
{
//Log.Out("RebirthUtilities-SpawnEntity IS BOSS");
NewEntity.Buffs.SetCustomVar("$varFuriousRamsayBoss", 1f);
}
if (isBoss == 99)
{
//Log.Out("RebirthUtilities-SpawnEntity IS SUPPORT");
NewEntity.Buffs.SetCustomVar("$varFuriousRamsaySupportMinion", 1f);
}
//Log.Out("RebirthUtilities-SpawnEntity NewEntity.belongsPlayerId: " + NewEntity.belongsPlayerId);
//Log.Out("RebirthUtilities-SpawnEntity NewEntity.position 1: " + NewEntity.position);
if (NewEntity != null)
{
if (NewEntity.NavObject != null)
{
NavObjectManager.Instance.UnRegisterNavObject(NewEntity.NavObject);
NewEntity.NavObject = null;
}
if (word.ToLower().Contains("zombiebear"))
{
numStartScale = 0.9f;
if (isBoss == 1f)
{
numStartScale = 1.2f;
}
else if (isBoss == 99f)
{
numStartScale = 1f;
}
}
//Log.Out("RebirthUtilities-SpawnEntity 4");
//GameManager.Instance.World.SpawnEntityInWorld(NewEntity);
if (strSpawner == "static")
{
//Log.Out("RebirthUtilities-SpawnEntity STATIC");
NewEntity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
}
else if (strSpawner == "biome")
{
//Log.Out("RebirthUtilities-SpawnEntity BIOME");
NewEntity.SetSpawnerSource(EnumSpawnerSource.Biome);
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity DYNAMIC");
NewEntity.SetSpawnerSource(EnumSpawnerSource.Dynamic);
}
//Log.Out("RebirthUtilities-SpawnEntity handParticle: " + handParticle);
if (NewEntity is EntityZombieSDX zombieEntity)
{
string otherTags = zombieEntity.otherTags;
if (handParticle == 1)
{
zombieEntity.Buffs.AddBuff("HandParticles1");
otherTags += ",fireresist,fireimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay877";
zombieEntity.SetEntityName("ttZombieFire");
}
else if (handParticle == 2)
{
zombieEntity.Buffs.AddBuff("HandParticles2");
otherTags += ",shockresist,shockimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay878";
zombieEntity.SetEntityName("ttZombieShock");
}
else if (handParticle == 3)
{
zombieEntity.Buffs.AddBuff("HandParticles3");
otherTags += ",fireresist,fireimmunezombie,shockresist,shockimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay879";
zombieEntity.SetEntityName("ttZombieFireShock");
}
else if (handParticle == 4)
{
// RADIATION
zombieEntity.Buffs.AddBuff("HandParticles4");
otherTags += ",hasparticle";
zombieEntity.SetEntityName("ttZombieToxic");
}
else if (handParticle == 5)
{
// FIRE, RADIATION
zombieEntity.Buffs.AddBuff("HandParticles5");
otherTags += ",fireresist,fireimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay877";
zombieEntity.SetEntityName("ttZombieToxicFire");
}
else if (handParticle == 6)
{
// SHOCK, RADIATION
zombieEntity.Buffs.AddBuff("HandParticles6");
otherTags += ",shockresist,shockimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay878";
zombieEntity.SetEntityName("ttZombieToxicShock");
}
else if (handParticle == 7)
{
// FIRE, BLOCK DAMAGE
zombieEntity.Buffs.AddBuff("HandParticles7");
otherTags += ",fireresist,fireimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay877";
zombieEntity.SetEntityName("ttZombieFire");
}
else if (handParticle == 8)
{
// SHOCK, BLOCK DAMAGE
zombieEntity.Buffs.AddBuff("HandParticles8");
otherTags += ",shockresist,shockimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay878";
zombieEntity.SetEntityName("ttZombiePowerFire");
}
else if (handParticle == 9)
{
// RADIATION, BLOCK DAMAGE
zombieEntity.Buffs.AddBuff("HandParticles9");
otherTags += ",hasparticle";
zombieEntity.SetEntityName("ttZombiePowerToxic");
}
else if (handParticle == 10)
{
zombieEntity.Buffs.AddBuff("HandParticles10");
otherTags += ",explosionresist,smokeimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay880";
zombieEntity.SetEntityName("ttZombieSmoke");
}
else if (handParticle == 11)
{
zombieEntity.Buffs.AddBuff("HandParticles11");
otherTags += ",explosionresist,smokeimmunezombie,fireresist,fireimmunezombie,shockresist,shockimmunezombie,hasparticle";
zombieEntity.lootListOnDeath = "FuriousRamsay881";
zombieEntity.SetEntityName("ttZombieFireShockSmoke");
}
if (isBoss == 1)
{
//Log.Out("RebirthUtilities-SpawnEntity isBoss: " + isBoss);
otherTags += ",boss";
}
else if (isBoss == 2)
{
otherTags += ",boss,eventspawn";
}
zombieEntity.otherTags = otherTags;
if (lootDropClass.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SpawnEntity [" + zombieEntity.EntityName + "] lootDropClass: " + lootDropClass);
zombieEntity.lootDropEntityClass = lootDropClass;
zombieEntity.lootDropProb = lootDropChance;
}
if (lootListName.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SpawnEntity lootListName: " + lootListName);
zombieEntity.lootListOnDeath = lootListName;
}
world.SpawnEntityInWorld(zombieEntity);
//Log.Out("RebirthUtilities-SpawnEntity [" + zombieEntity.EntityName + "] lootDropEntityClass: " + zombieEntity.lootDropEntityClass);
if (numStartScale > 0)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScaleRebirth>().Setup(zombieEntity.entityId, numStartScale), false, -1, -1, -1, null, 192);
}
else
{
zombieEntity.OverrideSize = numStartScale;
zombieEntity.SetScale(numStartScale);
zombieEntity.Buffs.SetCustomVar("$StartScale", numStartScale);
}
}
if (navIcon.Trim().Length > 0)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetNavObjectRebirth>().Setup(zombieEntity.entityId, navIcon), false, -1, -1, -1, null, 192);
}
else
{
if (RebirthVariables.customEventsNotification)
{
zombieEntity.RemoveNavObject("clear_sleeper");
zombieEntity.AddNavObject(navIcon, "", "");
zombieEntity.Buffs.SetCustomVar("$EventNavIcon", 1f);
}
}
}
if (buffList.Trim().Length > 0)
{
string[] buffs = buffList.Split(',');
for (int j = 0; j < buffs.Length; j++)
{
//Log.Out("RebirthUtilities-SpawnEntity buffList[j]: " + buffs[j]);
zombieEntity.Buffs.AddBuff(buffs[j]);
}
}
if (attackPlayer && entityPlayer)
{
zombieEntity.SetAttackTarget(entityPlayer, 60000);
zombieEntity.sightRangeBase = 200;
zombieEntity.SetMaxViewAngle(360);
zombieEntity.Buffs.SetCustomVar("$eventSpawn", 1f);
//Log.Out("RebirthUtilities-SpawnEntity player rotation: " + entityPlayer.rotation);
}
//Log.Out("RebirthUtilities-SpawnEntity otherTags: " + zombieEntity.otherTags);
}
else if (NewEntity is EntityNPCRebirth NewEntity2 && minion == -1)
{
string otherTags = NewEntity2.otherTags;
if (isBoss == 1)
{
//Log.Out("RebirthUtilities-SpawnEntity isBoss: " + isBoss);
otherTags += ",boss";
}
else if (isBoss == 2)
{
otherTags += ",boss,eventspawn";
}
NewEntity2.otherTags = otherTags;
//Log.Out("RebirthUtilities-SpawnEntity IS ENTITYNPCREBIRTH");
if (lootDropClass.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SpawnEntity LOOT DROP CLASS");
NewEntity2.lootDropEntityClass = lootDropClass;
NewEntity2.lootDropProb = lootDropChance;
}
else
{
NewEntity2.lootDropProb = 0;
}
if (lootListName.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SpawnEntity lootListName: " + lootListName);
if (lootListName == "")
{
NewEntity2.lootListOnDeath = "";
}
else
{
NewEntity2.lootListOnDeath = lootListName;
}
}
world.SpawnEntityInWorld(NewEntity2);
//Log.Out("RebirthUtilities-SpawnEntity numStartScale: " + numStartScale);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScaleRebirth>().Setup(NewEntity2.entityId, numStartScale), false, -1, -1, -1, null, 192);
}
else
{
NewEntity2.OverrideSize = numStartScale;
NewEntity2.scale = new Vector3(numStartScale, numStartScale, numStartScale);
NewEntity2.SetScale(numStartScale);
NewEntity2.Buffs.SetCustomVar("$StartScale", numStartScale);
}
if (navIcon.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SpawnEntity navIcon: " + navIcon);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetNavObjectRebirth>().Setup(NewEntity2.entityId, navIcon), false, -1, -1, -1, null, 192);
}
else
{
if (RebirthVariables.customEventsNotification)
{
NewEntity2.RemoveNavObject("clear_sleeper");
NewEntity2.AddNavObject(navIcon, "", "");
NewEntity2.Buffs.SetCustomVar("$EventNavIcon", 1f);
}
}
}
if (buffList.Trim().Length > 0)
{
string[] buffs = buffList.Split(',');
for (int j = 0; j < buffs.Length; j++)
{
//Log.Out("RebirthUtilities-SpawnEntity buffList[j]: " + buffs[j]);
NewEntity2.Buffs.AddBuff(buffs[j]);
}
}
if (attackPlayer && entityPlayer)
{
//Log.Out("RebirthUtilities-SpawnEntity ATTACK THE PLAYER, entityPlayer: " + entityPlayer.entityName);
NewEntity2.SetAttackTarget(entityPlayer, 60000);
NewEntity2.sightRangeBase = 200;
NewEntity2.SetMaxViewAngle(360);
NewEntity2.Buffs.SetCustomVar("$eventSpawn", 1f);
//Log.Out("RebirthUtilities-SpawnEntity player rotation: " + entityPlayer.rotation);
}
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity ELSE 1");
if (lootListName.Trim().Length > 0)
{
//Log.Out("RebirthUtilities-SpawnEntity lootListName: " + lootListName);
NewEntity.lootListOnDeath = lootListName;
}
world.SpawnEntityInWorld(NewEntity);
if (minion == 0)
{
NewEntity.Buffs.SetCustomVar("$FR_NPC_NoHire", 1f);
}
if (numStartScale > 0)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScaleRebirth>().Setup(NewEntity.entityId, numStartScale), false, -1, -1, -1, null, 192);
}
else
{
NewEntity.OverrideSize = numStartScale;
NewEntity.SetScale(numStartScale);
NewEntity.Buffs.SetCustomVar("$StartScale", numStartScale);
}
}
if (navIcon.Trim().Length > 0)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetNavObjectRebirth>().Setup(NewEntity.entityId, navIcon), false, -1, -1, -1, null, 192);
}
else
{
if (RebirthVariables.customEventsNotification)
{
NewEntity.RemoveNavObject("clear_sleeper");
NewEntity.AddNavObject(navIcon, "", "");
NewEntity.Buffs.SetCustomVar("$EventNavIcon", 1f);
}
}
}
if (attackPlayer && entityPlayer)
{
NewEntity.SetAttackTarget(entityPlayer, 60000);
NewEntity.sightRangeBase = 200;
NewEntity.SetMaxViewAngle(360);
NewEntity.Buffs.SetCustomVar("$eventSpawn", 1f);
//Log.Out("RebirthUtilities-SpawnEntity player rotation: " + entityPlayer.rotation);
}
if (buffList.Trim().Length > 0)
{
string[] buffs = buffList.Split(',');
for (int j = 0; j < buffs.Length; j++)
{
//Log.Out("RebirthUtilities-SpawnEntity buffList[j]: " + buffs[j]);
NewEntity.Buffs.AddBuff(buffs[j]);
}
}
if (NewEntity is EntityTurret && entityPlayer != null && minion == 1)
{
NewEntity.belongsPlayerId = entityPlayer.entityId;
}
else if (NewEntity is EntityNPCRebirth && entityPlayer != null && minion == 1)
{
//Log.Out("RebirthUtilities-SpawnEntity ELSE 2");
EntityNPCRebirth npc = (EntityNPCRebirth)NewEntity;
npc.belongsPlayerId = entityPlayer.entityId;
//Log.Out("RebirthUtilities-SpawnEntity npc.belongsPlayerId: " + npc.belongsPlayerId);
npc.Buffs.SetCustomVar("$delayedPickup", 1f);
npc.Buffs.AddBuff("delayPickup");
npc.SetItemValue(holdingItemItemValue);
entityPlayer.Buffs.SetCustomVar($"minion_{npc.entityId}", npc.entityId);
npc.Buffs.SetCustomVar("$FR_NPC_Minion", 1f);
npc.Buffs.AddBuff("buffNPCModFullControlMode");
//Log.Out("RebirthUtilities-SpawnEntity SET TO FOLLOW");
npc.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow);
//entityPlayer.AddOwnedEntity(npc);
float flMode = entityPlayer.Buffs.GetCustomVar("varNPCModMode");
float flHalt = entityPlayer.Buffs.GetCustomVar("varNPCModStopAttacking");
if (flMode == 0)
{
npc.Buffs.AddBuff("buffNPCModFullControlMode");
}
else
{
npc.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
if (flHalt == 1)
{
npc.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
npc.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
Vector3 reSpawnPosition = new Vector3(0, 0, 0);
Vector3 reSpawnRotation = new Vector3(0, 0, 0);
if (setRespawn)
{
reSpawnPosition = NewEntity.position;
reSpawnRotation = NewEntity.rotation;
}
if (!isTemporary)
{
RebirthManager.AddHire(entityPlayer.entityId,
npc.entityId,
npc.EntityName,
npc.EntityClass.entityClassName,
npc.position,
npc.rotation,
reSpawnPosition,
reSpawnRotation,
0,
0,
0,
true
);
}
//Log.Out("RebirthUtilities-SpawnEntity RESULT IS NPC");
npc.Owner = entityPlayer;
SetLeaderAndOwner(npc.entityId, entityPlayer.entityId);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageAddCompanion>().Setup(npc.entityId, npc.belongsPlayerId), false, npc.belongsPlayerId, -1, -1, null, 192);
}
else
{
((EntityAliveV2)npc).LeaderUtils.AddCompanion();
}
result = npc;
}
else if (NewEntity is EntitySurvivor && minion == 1)
{
//Log.Out("RebirthUtilities-SpawnEntity NewEntity IS ENTITYSURVIVOR");
if (entityPlayer != null)
{
//Log.Out("RebirthUtilities-SpawnEntity NewEntity PLAYER IS: " + entityPlayer.entityId);
NewEntity.belongsPlayerId = entityPlayer.entityId;
}
}
}
transformPos.x++;
}
else
{
//Log.Out("RebirthUtilities-SpawnEntity NewEntity == null");
}
}
}
}
if (strSound.Trim().Length > 0)
{
//Log.Out("MinEventActionSpawnEntitySDX-Execute PLAY SOUND");
Manager.BroadcastPlay(entity, strSound);
}
//Log.Out("RebirthUtilities-SpawnEntity END");
return result;
}
public static bool FindValidPosition(out Vector3 newPoint, Vector3 startPoint, float minDistance, float maxDistance)
{
World world = GameManager.Instance.World;
Vector3 a = new Vector3((world.GetGameRandom().RandomFloat * 2f) + -1f, 0f, (world.GetGameRandom().RandomFloat * 2f) + -1f);
a.Normalize();
float num = (world.GetGameRandom().RandomFloat * (maxDistance - minDistance)) + minDistance;
newPoint = startPoint + (a * num);
newPoint.y = startPoint.y + 1.5f;
Ray ray = new Ray(startPoint, (newPoint - startPoint).normalized);
if (Voxel.Raycast(world, ray, num, -538750981, 67, 0f))
{
return false;
}
BlockValue block = world.GetBlock(new Vector3i(newPoint - (ray.direction * 0.5f)));
if (block.Block.IsCollideMovement || block.Block.IsCollideArrows)
{
return false;
}
Vector3i blockPos = new Vector3i(startPoint);
if (!world.CanPlaceBlockAt(blockPos, null, false))
{
return false;
}
return true;
}
public static PrefabInstance FindPrefab(string poiName, Vector3 startPosition, ref List<Vector2> usedPOILocations, BiomeFilterTypes biomeFilterType = BiomeFilterTypes.AnyBiome, string biomeFilter = "")
{
//////Log.Out("RebirthUtilities-FindPrefab START poiName: " + poiName);
List<PrefabInstance> listOfPrefabs = GameManager.Instance.World.ChunkClusters[0].ChunkProvider.GetDynamicPrefabDecorator().GetDynamicPrefabs().FindAll(instance => instance.name.Contains(poiName));
if (listOfPrefabs == null)
{
//////Log.Out("RebirthUtilities-FindPrefab 1");
if (GamePrefs.GetBool(EnumGamePrefs.DebugMenuEnabled))
{
//////Log.Out("RebirthUtilities-FindPrefab 2");
//////Log.Out($"GotoPOISDX: No Prefabs by this name found: {poiName} Biome Filter Type: {biomeFilterType} Biome Filter: {biomeFilter}");
}
return null;
}
//////Log.Out("RebirthUtilities-FindPrefab prefab count: " + listOfPrefabs.Count);
// Filter the prefab list if there's an exact name
List<PrefabInstance> filteredPrefabs = listOfPrefabs.FindAll(instance => instance.name == poiName);
if (filteredPrefabs.Count > 0)
{
//////Log.Out("RebirthUtilities-FindPrefab 3");
listOfPrefabs = filteredPrefabs;
}
// Find the closes Prefab
PrefabInstance prefab = FindClosesPrefabs(startPosition, listOfPrefabs, usedPOILocations, biomeFilterType, biomeFilter);
if (prefab == null)
{
//////Log.Out("RebirthUtilities-FindPrefab 4");
return null;
}
//////Log.Out("RebirthUtilities-FindPrefab END");
return prefab;
}
public static PrefabInstance FindClosesPrefabs(Vector3 position, List<PrefabInstance> prefabs, List<Vector2> usedPOILocations, BiomeFilterTypes biomeFilterType, string biomeFilter)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs START");
PrefabInstance prefab = null;
float minDist = Mathf.Infinity;
string[] array = null;
foreach (PrefabInstance t in prefabs)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs prefab: " + t.name);
// Have we already went to this one?
Vector2 vector = new Vector2(t.boundingBoxPosition.x, t.boundingBoxPosition.z);
if (usedPOILocations != null && usedPOILocations.Contains(vector))
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 1");
continue;
}
//////Log.Out("RebirthUtilities-FindClosesPrefabs 2");
// Check if there's a biome filter.
if (biomeFilterType != BiomeFilterTypes.AnyBiome && !GameUtils.IsPlaytesting())
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 3");
BiomeDefinition biomeAt = GameManager.Instance.World.ChunkCache.ChunkProvider.GetBiomeProvider().GetBiomeAt((int)vector.x, (int)vector.y);
if (biomeFilterType == BiomeFilterTypes.OnlyBiome && biomeAt.m_sBiomeName != biomeFilter)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 4");
if (GamePrefs.GetBool(EnumGamePrefs.DebugMenuEnabled))
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 5");
//////Log.Out($"GotoPOISDX: Prefab Filtered based on Biome Filter Type: {biomeFilterType} Biome Filter: {biomeFilter}");
}
continue;
}
if (biomeFilterType == BiomeFilterTypes.ExcludeBiome)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 6");
if (array == null)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 7");
array = biomeFilter.Split(new char[]
{
','
});
}
bool flag = false;
for (int j = 0; j < array.Length; j++)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 8");
if (biomeAt.m_sBiomeName == array[j])
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 9");
if (GamePrefs.GetBool(EnumGamePrefs.DebugMenuEnabled))
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 10");
//////Log.Out($"GotoPOISDX: Prefab excluded based on Biome Filter Type: {biomeFilterType} Biome Filter: {biomeFilter}");
}
flag = true;
break;
}
}
if (flag)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 11");
continue;
}
}
}
float dist = Vector3.Distance(t.boundingBoxPosition, position);
if (GamePrefs.GetBool(EnumGamePrefs.DebugMenuEnabled))
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs ");
//////Log.Out($"GotoPOISDX: Prefab {t.name} Found at {t.boundingBoxPosition} Distance: {dist} {biomeFilterType} Biome Filter: {biomeFilter}");
}
if (dist < minDist)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 12");
if (GamePrefs.GetBool(EnumGamePrefs.DebugMenuEnabled))
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 13");
if (prefab != null)
{
//////Log.Out("RebirthUtilities-FindClosesPrefabs 14");
//////Log.Out($"GotoPOISDX: Found closer Prefab {t.name} than {prefab.name} Old distance {minDist}");
}
}
prefab = t;
minDist = dist;
}
}
////Log.Out("RebirthUtilities-FindClosesPrefabs END");
return prefab;
}
public static void SetBlockOpacity(WorldBase _world, int _clrIdx, Vector3i _blockPos, ref BlockValue _blockValue, string doorType, ref int lightOpacity)
{
//////Log.Out("RebirthUtilities-SetBlockOpacity _blockPos: " + _blockPos);
Chunk chunk = (Chunk)_world.GetChunkFromWorldPos(_blockPos);
int posDoor = CheckBlockPosition(_world, chunk, _blockPos, _blockValue, doorType);
//////Log.Out("RebirthUtilities-SetBlockOpacity _blockValue.meta: " + _blockValue.meta);
bool flag = BlockDoor.IsDoorOpen(_blockValue.meta);
//////Log.Out("RebirthUtilities-SetBlockOpacity IS DOOR OPEN: " + flag);
//////Log.Out("RebirthUtilities-SetBlockOpacity doorType: " + doorType);
if (flag)
{
//////Log.Out("RebirthUtilities-SetBlockOpacity 2");
if (posDoor == 0)
{
//////Log.Out("RebirthUtilities-SetBlockOpacity 3");
posDoor = 255;
}
else
{
//////Log.Out("RebirthUtilities-SetBlockOpacity 4");
posDoor = 0;
}
}
_blockValue.Block.lightOpacity = posDoor;
lightOpacity = posDoor;
//////Log.Out("RebirthUtilities-SetBlockOpacity _blockValue lightOpacity: " + _blockValue.Block.lightOpacity);
//////Log.Out("RebirthUtilities-SetBlockOpacity block lightOpacity: " + lightOpacity);
}
public static bool GetFood(WorldBase _world, Vector3i _blockpos, int blockHeight, int blockWidth, string foodType, int foodAmount, string blockType)
{
int posX = 0;
int posY = 0;
int posZ = 0;
//////Log.Out("RebirthUtilities-GetFood START blockType: " + blockType);
//////Log.Out("RebirthUtilities-GetFood START foodType: " + foodType);
//////Log.Out("RebirthUtilities-GetFood START foodAmount: " + foodAmount);
for (int i = -(blockHeight - 1); i < blockHeight; i++)
{
for (int j = -(blockWidth - 1); j < blockWidth; j++)
{
for (int k = -(blockWidth - 1); k < blockWidth; k++)
{
posY = _blockpos.y + i;
posX = _blockpos.x + j;
posZ = _blockpos.z + k;
BlockValue block = _world.GetBlock(new Vector3i(posX, posY, posZ));
if (block.Block.GetBlockName() == blockType)
{
//////Log.Out("RebirthUtilities-GetFood FOUND BLOCK");
Chunk chunk = (Chunk)_world.GetChunkFromWorldPos(new Vector3i(posX, posY, posZ));
if (_world.GetTileEntity(chunk.ClrIdx, new Vector3i(posX, posY, posZ)) is TileEntityLootContainer tileEntityLootContainer)
{
//////Log.Out("RebirthUtilities-GetFood FOUND TILEENTITY");
if (!tileEntityLootContainer.IsEmpty() && !tileEntityLootContainer.IsUserAccessing())
{
//////Log.Out("RebirthUtilities-GetFood LOOT CONTAINER ISN'T EMPTY");
for (int l = 0; l < tileEntityLootContainer.items.Length - 1; l++)
{
ItemStack myStack = tileEntityLootContainer.items[l];
if (myStack != null && myStack.count > foodAmount)
{
//////Log.Out("BlockFeedRebirth-UpdateTick Item Count: " + myStack.count);
//////Log.Out("BlockFeedRebirth-UpdateTick Item Name: " + myStack.itemValue.ItemClass.GetItemName().ToLower());
//////Log.Out("BlockFeedRebirth-UpdateTick foodType.ToLower(): " + foodType.ToLower());
if (myStack.itemValue.ItemClass.GetItemName().ToLower() == foodType.ToLower())
{
//////Log.Out("Item Name: " + myStack.itemValue.ItemClass.GetItemName());
//////Log.Out("Item Count: " + myStack.count);
myStack.count -= foodAmount;
//////Log.Out("BlockFeedRebirth-UpdateTick FED THE CHICKEN");
return true;
}
}
}
}
}
}
}
}
}
return false;
}
public static bool GetBlockInfo(WorldBase _world, Vector3i _blockpos, int blockHeight, int blockWidth)
{
int posX = 0;
int posY = 0;
int posZ = 0;
//////Log.Out("RebirthUtilities-overlapsWithOtherBlocks START");
for (int i = -(blockHeight - 1); i < blockHeight; i++)
{
for (int j = -(blockWidth - 1); j < blockWidth; j++)
{
for (int k = -(blockWidth - 1); k < blockWidth; k++)
{
posY = _blockpos.y + i;
posX = _blockpos.x + j;
posZ = _blockpos.z + k;
BlockValue block = _world.GetBlock(new Vector3i(posX, posY, posZ));
////Log.Out("RebirthUtilities-GetBlockInfo block: " + block.Block.GetBlockName() + " x: " + posX + " / y: " + posY + " / z: " + posZ);
}
}
}
return false;
}
public static void LogStats(EntityAlive entity)
{
/*if (entity is EntityNPCRebirth EntityNPCRebirth)
{
//Log.Out("========================================================================================");
//Log.Out("MinEventActionLogStatsRebirth-Execute enabled: " + EntityNPCRebirth.enabled);
//Log.Out("MinEventActionLogStatsRebirth-Execute npcID: " + EntityNPCRebirth.npcID);
//Log.Out("MinEventActionLogStatsRebirth-Execute Owner: " + EntityNPCRebirth.Buffs.GetCustomVar("Owner"));
//Log.Out("MinEventActionLogStatsRebirth-Execute Leader: " + EntityNPCRebirth.Buffs.GetCustomVar("$Leader"));
//Log.Out("MinEventActionLogStatsRebirth-Execute $FuriousRamsayHidden: " + EntityNPCRebirth.Buffs.GetCustomVar("$FR_NPC_Hidden"));
//Log.Out("MinEventActionLogStatsRebirth-Execute onMission: " + EntityNPCRebirth.Buffs.GetCustomVar("onMission"));
//Log.Out("MinEventActionLogStatsRebirth-Execute isIgnoredByAI: " + EntityNPCRebirth.isIgnoredByAI);
//Log.Out("MinEventActionLogStatsRebirth-Execute $FuriousRamsayRespawn: " + EntityNPCRebirth.Buffs.GetCustomVar("$FR_NPC_Respawn"));
//Log.Out("MinEventActionLogStatsRebirth-Execute FuriousRamsayRespawned Buff: " + EntityNPCRebirth.Buffs.HasBuff("FuriousRamsayRespawned"));
//Log.Out("MinEventActionLogStatsRebirth-Execute $FuriousRamsayRespawnCommandActivation: " + EntityNPCRebirth.Buffs.GetCustomVar("$FR_NPC_RespawnCommandActivation"));
//Log.Out("MinEventActionLogStatsRebirth-Execute NPCInteractedFlag: " + EntityNPCRebirth.Buffs.GetCustomVar("NPCInteractedFlag"));
//Log.Out("MinEventActionLogStatsRebirth-Execute $FuriousRamsayRespawnCommandActivation: " + EntityNPCRebirth.Buffs.GetCustomVar("$FR_NPC_RespawnCommandActivation"));
//Log.Out("MinEventActionLogStatsRebirth-Execute isHirable: " + EntityNPCRebirth.isHirable);
//Log.Out("MinEventActionLogStatsRebirth-Execute hasAI: " + EntityNPCRebirth.hasAI);
//Log.Out("MinEventActionLogStatsRebirth-Execute _defaultTraderID: " + EntityNPCRebirth._defaultTraderID);
//Log.Out("MinEventActionLogStatsRebirth-Execute NPCInfo.TraderID: " + EntityNPCRebirth.NPCInfo.TraderID);
}*/
}
/*public static string GetTimeRemainingHMS(float randomWeaponUpdateCheck)
{
float timeLeft = randomWeaponUpdateCheck - Time.time;
if (timeLeft <= 0) return "0s";
int hours = Mathf.FloorToInt(timeLeft / 3600);
int minutes = Mathf.FloorToInt((timeLeft % 3600) / 60);
int seconds = Mathf.FloorToInt(timeLeft % 60);
if (hours > 0)
return $"{hours}h {minutes}m {seconds}s";
else if (minutes > 0)
return $"{minutes}m {seconds}s";
else
return $"{seconds}s";
}*/
public static IEnumerator delayAuraTrigger(float time)
{
RebirthVariables.canAuraTrigger = false;
yield return new WaitForSeconds(time);
RebirthVariables.canAuraTrigger = true;
yield break;
}
public static IEnumerator messageHUD(EntityPlayerLocal target, float time, string messageKey)
{
//////Log.Out("RebirthUtilities-messageHUD START");
yield return new WaitForSeconds(time);
switch (messageKey)
{
case "miseryDeath":
//////Log.Out("RebirthUtilities-messageHUD messageKey: " + messageKey);
Manager.PlayInsidePlayerHead("FuriousRamsayDeath");
GameManager.ShowTooltip(target, Localization.Get(messageKey));
break;
case "miseryPlayerLevel":
//////Log.Out("RebirthUtilities-messageHUD messageKey: " + messageKey);
Manager.PlayInsidePlayerHead("FuriousRamsayAscension");
GameManager.ShowTooltip(target, Localization.Get(messageKey));
break;
case "miseryPlayerKill":
//////Log.Out("RebirthUtilities-messageHUD messageKey: " + messageKey);
Manager.PlayInsidePlayerHead("FuriousRamsayNaturalSelection");
GameManager.ShowTooltip(target, Localization.Get(messageKey));
break;
case "miseryRebirth":
//////Log.Out("RebirthUtilities-messageHUD messageKey: " + messageKey);
Manager.PlayInsidePlayerHead("FuriousRamsayAscension");
GameManager.ShowTooltip(target, Localization.Get(messageKey));
break;
default:
break;
}
yield break;
}
public static bool DestroyBlock(WorldBase _world, Vector3i _blockpos, int blockHeight, int blockWidth, string blockName)
{
int posX = 0;
int posY = 0;
int posZ = 0;
//////Log.Out("RebirthUtilities-overlapsWithOtherBlocks START");
for (int i = 0; i < blockHeight; i++)
{
for (int j = -(blockWidth - 1); j < blockWidth; j++)
{
for (int k = -(blockWidth - 1); k < blockWidth; k++)
{
posY = _blockpos.y + i;
posX = _blockpos.x + j;
posZ = _blockpos.z + k;
BlockValue block = _world.GetBlock(new Vector3i(posX, posY, posZ));
if (block.Block.GetBlockName().Contains(blockName))
{
//////Log.Out("RebirthUtilities-DestroyBlock block: " + block.Block.GetBlockName() + " x: " + posX + " / y: " + posY + " / z: " + posZ);
block.Block.DamageBlock(GameManager.Instance.World, 0, new Vector3i(posX, posY, posZ), block, Block.list[block.type].MaxDamage, -1, null, false, false);
return true;
}
}
}
}
return false;
}
public static bool overlapsWithOtherBlocks(WorldBase _world, Vector3i _blockpos, int blockHeight, int blockWidth)
{
int posX = 0;
int posY = 0;
int posZ = 0;
//////Log.Out("RebirthUtilities-overlapsWithOtherBlocks START");
for (int i = 0; i < blockHeight; i++)
{
for (int j = -(blockWidth - 1); j < blockWidth; j++)
{
for (int k = -(blockWidth - 1); k < blockWidth; k++)
{
posY = _blockpos.y + i;
posX = _blockpos.x + j;
posZ = _blockpos.z + k;
BlockValue block = _world.GetBlock(new Vector3i(posX, posY, posZ));
if (!block.isair
&& block.Block.GetBlockName() != "concreteShapes:roadPaintDash"
&& block.Block.GetBlockName() != "terrForestGround"
&& block.Block.GetBlockName() != "terrGravel"
&& block.Block.GetBlockName() != "treeShortGrass"
&& block.Block.GetBlockName() != "whitePicketFenceSheet"
&& block.Block.GetBlockName() != "treeDeadPineLeaf"
&& !block.Block.GetBlockName().ToLower().Contains("rock")
&& block.Block.GetBlockName() != "treeTallGrassDiagonal"
&& !block.Block.GetBlockName().Contains("planted") && !block.Block.GetBlockName().Contains("3Harvest")
&& block.Block.GetBlockName() != "treeBrownGrassDiagonal"
&& block.Block.GetBlockName() != "treeDesertShrub"
&& block.Block.GetBlockName() != "treeForestGrassDiagonal"
&& block.Block.GetBlockName() != "treeGreenBrownGrassDiagonal"
&& block.Block.GetBlockName() != "forestFlower"
&& !block.Block.GetBlockName().Contains("goreBlock")
&& !block.Block.GetBlockName().Contains("cntTrashPile")
&& !block.Block.GetBlockName().Contains("garbage_decor")
&& !block.Block.GetBlockName().Contains("concreteShapes:plate")
)
{
/*////Log.Out("RebirthUtilities-overlapsWithOtherBlocks block: " + block.Block.GetBlockName());
////Log.Out("RebirthUtilities-overlapsWithOtherBlocks pos: " + posX + ", " + posY + ", " + posZ);*/
return true;
}
}
}
}
return false;
}
public static float GetWeatherInfo(Vector3i _blockPos, string infoSought)
{
List<WeatherManager.BiomeWeather> biomeWeather = WeatherManager.Instance.biomeWeather;
Chunk chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(_blockPos);
if (chunk == null)
{
return 0f;
}
byte biomeId = chunk.GetBiomeId(World.toBlockXZ(_blockPos.x), World.toBlockXZ(_blockPos.z));
for (int l = 0; l < biomeWeather.Count; l++)
{
WeatherManager.BiomeWeather biomeWeather2 = biomeWeather[l];
if (biomeId == biomeWeather2.biomeDefinition.m_Id)
{
/*////Log.Out("RebirthUtilities-GetWeatherInfo TEMP: " + biomeWeather2.parameters[0].value);
////Log.Out("RebirthUtilities-GetWeatherInfo PRECIPITATION: " + biomeWeather2.parameters[1].value);
////Log.Out("RebirthUtilities-GetWeatherInfo CLOUDS: " + biomeWeather2.parameters[2].value);
////Log.Out("RebirthUtilities-GetWeatherInfo WIND: " + biomeWeather2.parameters[3].value);
////Log.Out("RebirthUtilities-GetWeatherInfo FOG: " + biomeWeather2.parameters[4].value);
////Log.Out("RebirthUtilities-GetWeatherInfo RAIN: " + biomeWeather2.rainParam.value);
////Log.Out("RebirthUtilities-GetWeatherInfo WET: " + biomeWeather2.wetParam.value);
////Log.Out("RebirthUtilities-GetWeatherInfo SNOWCOVER: " + biomeWeather2.snowCoverParam.value);
////Log.Out("RebirthUtilities-GetWeatherInfo SNOWFALL: " + biomeWeather2.snowFallParam.value);*/
switch (infoSought)
{
case "temp":
return biomeWeather2.parameters[0].value;
case "precipitation":
return biomeWeather2.parameters[1].value;
case "clouds":
return biomeWeather2.parameters[2].value;
case "wind":
return biomeWeather2.parameters[3].value;
case "fog":
return biomeWeather2.parameters[4].value;
case "rain":
return biomeWeather2.rainParam.value;
case "wet":
return biomeWeather2.wetParam.value;
case "snowcover":
return biomeWeather2.snowCoverParam.value;
case "snowfall":
return biomeWeather2.snowFallParam.value;
default:
break;
}
}
}
return 0f;
}
public static void ReplaceBlocks(string blockName, byte originBlockRotation, byte newBlockRotation, int blockPosX, int blockPosY, int blockPosZ,
int blockDepth, int blockWidth, int skipFromOrigin,
WorldBase _world, Chunk chunk
)
{
int posX = 0;
int posY = 0;
int posZ = 0;
byte rotationNew = 0;
BlockValue blockValue;
//////Log.Out("RebirthUtilities-ReplaceBlocks originBlockRotation: " + originBlockRotation);
//////Log.Out("RebirthUtilities-ReplaceBlocks newBlockRotation: " + newBlockRotation);
for (int i = 0; i < blockDepth; i++)
{
for (int j = -(blockWidth - 1); j < blockWidth; j++)
{
for (int k = -(blockWidth - 1); k < blockWidth; k++)
{
if (!(
j > -skipFromOrigin && k > -skipFromOrigin &&
j > -skipFromOrigin && k < skipFromOrigin &&
j < skipFromOrigin && k < skipFromOrigin &&
j < skipFromOrigin && k > -skipFromOrigin
))
{
blockValue = Block.GetBlockValue(blockName, true);
blockValue.rotation = newBlockRotation;
posX = blockPosX - j;
posY = blockPosY - i;
posZ = blockPosZ - k;
rotationNew = blockValue.rotation;
ConvertRotatedPosition(1, originBlockRotation, blockPosX, blockPosZ, ref posX, ref posZ, ref rotationNew);
blockValue.rotation = rotationNew;
//////Log.Out("RebirthUtilities-ReplaceBlocks rotationNew: " + rotationNew);
blockValue = BlockPlaceholderMap.Instance.Replace(blockValue, _world.GetGameRandom(), chunk, posX, posY, posZ, FastTags<TagGroup.Global>.none, false);
if (blockName == "FuriousRamsayAir")
{
_world.SetBlockRPC(chunk.ClrIdx, new Vector3i(posX, posY, posZ), BlockValue.Air);
}
else
{
_world.SetBlockRPC(chunk.ClrIdx, new Vector3i(posX, posY, posZ), blockValue);
}
}
}
}
}
}
public static void ConvertRotatedPosition(int rotationFrom, int rotationTo, int posXOrigin, int posZOrigin, ref int posX, ref int posZ, ref byte rotationBlock)
{
int diffX = posX - posXOrigin;
int diffZ = posZ - posZOrigin;
if (rotationFrom == 1 && rotationTo == 1)
{
}
else if (rotationFrom == 1 && rotationTo == 2)
{
posX = posXOrigin + diffZ;
posZ = posZOrigin - diffX;
if (rotationBlock == 0)
{
rotationBlock = 1;
}
else if (rotationBlock == 1)
{
rotationBlock = 2;
}
else if (rotationBlock == 2)
{
rotationBlock = 3;
}
else if (rotationBlock == 3)
{
rotationBlock = 0;
}
}
else if (rotationFrom == 1 && rotationTo == 3)
{
posX = posXOrigin - diffX;
posZ = posZOrigin - diffZ;
if (rotationBlock == 0)
{
rotationBlock = 2;
}
else if (rotationBlock == 1)
{
rotationBlock = 3;
}
else if (rotationBlock == 2)
{
rotationBlock = 0;
}
else if (rotationBlock == 3)
{
rotationBlock = 1;
}
}
else if (rotationFrom == 1 && rotationTo == 0)
{
posX = posXOrigin - diffZ;
posZ = posZOrigin + diffX;
if (rotationBlock == 0)
{
rotationBlock = 3;
}
else if (rotationBlock == 1)
{
rotationBlock = 0;
}
else if (rotationBlock == 2)
{
rotationBlock = 1;
}
else if (rotationBlock == 3)
{
rotationBlock = 2;
}
}
}
public static int CheckBlockPosition(WorldBase _world, Chunk _chunk, Vector3i _blockPos, BlockValue _blockValue, string doorType = "door", bool openDoor = false)
{
/*Z + (North)
Z - (South)
X + (East)
X - (West)*/
int lightOpacity = 0;
BlockValue blockC = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y - 1, _blockPos.z));
if (doorType == "hatch")
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition HATCH!");
if (_blockValue.rotation >= 24 && _blockValue.rotation <= 27)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition AAA");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition AAAa");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition AAAb");
_blockValue.Block.lightOpacity = 0;
}
}
else if (_blockValue.rotation == 0)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 1)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS WEST OF ME (NORTH AND EAST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 2)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 3)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS EAST OF ME (NORTH AND EAST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 4)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 5)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS EAST OF ME (NORTH AND EAST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 6)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 7)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS WEST OF ME (NORTH AND EAST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7n");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7q");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7r");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7s");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 8)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockD.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8j");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8k");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8i");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8j");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 8k");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
else if (_blockValue.rotation == 9)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9o");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9p");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9s");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9t");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 9w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 10)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10m");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10n");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 10o");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
else if (_blockValue.rotation == 11)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11o");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11p");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11s");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11t");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 11w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 12)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12s");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12t");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 13)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockD.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13m");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13n");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 13o");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
else if (_blockValue.rotation == 14)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14f2");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14f3");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14s");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14t");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 14w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 15)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockD.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15m");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15n");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 15o");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
else if (_blockValue.rotation == 16)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16m");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16n");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 16o");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
else if (_blockValue.rotation == 17)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17o");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17p");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17s");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17t");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 17w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 18)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18m");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18n");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 18o");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
else if (_blockValue.rotation == 19)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19o");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19p");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19s");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19t");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 19w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 20)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20f2");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20f3");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20s");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20t");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 20w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 21)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21m");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21n");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 21o");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
else if (_blockValue.rotation == 22)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22d");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22f2");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22f3");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22k");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22m");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22n");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22p");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22q");
blockA = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22r");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22s");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22t");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22u");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22v");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 22w");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
}
else if (_blockValue.rotation == 23)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23c");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockD = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23f");
if (blockD.Equals(BlockValue.Air))
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23f1");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23f2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23f3");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23f4");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23h");
_blockValue.Block.lightOpacity = 0;
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23i");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
// CHECK IF HATCH IS FLOATING
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23m");
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23n");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 23o");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition DOOR!");
if (_blockValue.rotation >= 24 && _blockValue.rotation <= 27)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition AAA");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition AAAa");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition AAAb");
_blockValue.Block.lightOpacity = 0;
}
}
else if (_blockValue.rotation == 0)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 0j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 1)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 1j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 2)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 2j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 3)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 3j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 4)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 4j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 5)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS WEST OF ME (NORTH AND SOUTH)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 6)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS SOUTH OF ME (EAST AND WEST)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 6j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 7)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7b");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7b1");
blockA = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7b2");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7c");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z - 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);*/
// DO I HAVE BLOCKS EAST OF ME (NORTH AND SOUTH)
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7d");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7e");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7f");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x - 1, _blockPos.y, _blockPos.z + 1));
/*////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);*/
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7g");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7h");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7i");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 7j");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else if (_blockValue.rotation == 10)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12a");
BlockValue blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z));
BlockValue blockB = _world.GetBlock(new Vector3i(_blockPos.x - 2, _blockPos.y, _blockPos.z));
blockC = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockC: " + blockC.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS EAST AND WEST OF ME
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12b");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12c");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12d");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12e");
blockA = _world.GetBlock(new Vector3i(_blockPos.x + 1, _blockPos.y, _blockPos.z + 1));
blockB = _world.GetBlock(new Vector3i(_blockPos.x - 2, _blockPos.y, _blockPos.z + 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA: " + blockA.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB: " + blockB.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA lightOpacity: " + blockA.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB lightOpacity: " + blockB.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH OF ME (EAST AND WEST)
if (!blockA.Equals(BlockValue.Air) &&
!blockB.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA.Block.lightOpacity >= 255 &&
blockB.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12f");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12h");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12i");
BlockValue blockA1 = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z + 1));
BlockValue blockB1 = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1: " + blockA1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1: " + blockB1.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA1 lightOpacity: " + blockA1.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB1 lightOpacity: " + blockB1.Block.lightOpacity);
// DO I HAVE BLOCKS NORTH AND SOUTH OF ME
if (!blockA1.Equals(BlockValue.Air) &&
!blockB1.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA1.Block.lightOpacity >= 255 &&
blockB1.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12j");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12k");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12l");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
BlockValue blockA2 = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y + 1, _blockPos.z + 1));
BlockValue blockB2 = _world.GetBlock(new Vector3i(_blockPos.x, _blockPos.y + 1, _blockPos.z - 1));
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2: " + blockA2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2: " + blockB2.Block.GetBlockName());
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockA2 lightOpacity: " + blockA2.Block.lightOpacity);
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition blockB2 lightOpacity: " + blockB2.Block.lightOpacity);
// DO I HAVE BLOCKS ABOVE ME (NORTH AND SOUTH)
if (!blockA2.Equals(BlockValue.Air) &&
!blockB2.Equals(BlockValue.Air) &&
!blockC.Equals(BlockValue.Air) &&
blockA2.Block.lightOpacity >= 255 &&
blockB2.Block.lightOpacity >= 255 &&
blockC.Block.lightOpacity >= 255)
{
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12m");
_blockValue.Block.lightOpacity = 0;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12n");
_blockValue.Block.lightOpacity = 0;
}
}
else
{
// LIGHT GOES THROUGH NO MATTER GIVEN THE ROTATION
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12o");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 12p");
_blockValue.Block.lightOpacity = 0;
}
}
}
}
}
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 999");
if (openDoor)
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5g");
_blockValue.Block.lightOpacity = 255;
lightOpacity = 255;
}
else
{
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition 5h");
_blockValue.Block.lightOpacity = 0;
}
}
}
////Log.Out("BlockDoorSecureRebirth-CheckBlockPosition lightOpacity: " + lightOpacity);
return lightOpacity;
}
public static bool CheckForBlock(WorldBase _world, int _clrIdx, Vector3i _blockPos, string blockName, int blockRange, int blockHeightMin, int blockHeightMax)
{
for (int i = _blockPos.x - blockRange; i <= _blockPos.x + blockRange; i++)
{
for (int j = _blockPos.z - blockRange; j <= _blockPos.z + blockRange; j++)
{
for (int k = _blockPos.y - blockHeightMin; k <= _blockPos.y + blockHeightMax; k++)
{
BlockValue block = _world.GetBlock(_clrIdx, new Vector3i(i, k, j));
if (block.Block.GetBlockName().ToLower() == blockName.ToLower())
{
return true;
}
}
}
}
return false;
}
public static bool HasObserver(WorldBase _world, int _clrIdx, Vector3i _blockPos, string blockName, int blockRange, int blockHeightMin, int blockHeightMax)
{
bool bFound = false;
/*int minMax = 100;
List<Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityChunkObserver), BoundsUtils.BoundsForMinMax(_blockPos.x - minMax, _blockPos.y - 20, _blockPos.z - minMax, _blockPos.x + minMax, _blockPos.y + 20, _blockPos.z + minMax), new List<Entity>());
if (entitiesInBounds != null && entitiesInBounds.Count > 0)
{
for (int x = 0; x < entitiesInBounds.Count; x++)
{
if (entitiesInBounds[x].EntityClass.entityClassName == "FuriousRamsayObserver")
{
bFound = true;
break;
}
}
}*/
return bFound;
}
public static bool CheckForHeat(Vector3 _blockPos, int distance, string targetTypes, string blockName)
{
//Log.Out("RebirthUtilities-CheckForHeat START");
foreach (TileEntity tile in RebirthUtilities.GetCustomTileEntities(_blockPos, distance, targetTypes))
{
//Log.Out("RebirthUtilities-CheckForHeat tile: " + tile.GetTileEntityType());
if (tile is TileEntityWorkstation tileEntity)
{
//Log.Out("RebirthUtilities-CheckForHeat tileEntity.IsBurning: " + tileEntity.IsBurning);
//Log.Out("RebirthUtilities-CheckForHeat tileEntity.blockValue.Block.blockName: " + tileEntity.blockValue.Block.blockName);
if (tileEntity.IsBurning && tileEntity.blockValue.Block.blockName == blockName)
{
//Log.Out("RebirthUtilities-CheckForHeat HAS HEAT");
return true;
}
}
}
return false;
}
public static int CheckForWater(Vector3 _blockPos, int distance, string targetTypes, string blockName)
{
int result = 0;
bool bFound = false;
foreach (TileEntity tile in RebirthUtilities.GetCustomTileEntities(_blockPos, distance, targetTypes))
{
//Log.Out("RebirthUtilities-CheckForWater tile: " + tile.GetTileEntityType());
if (tile is TileEntityWaterTankRebirth tileEntity)
{
//Log.Out("RebirthUtilities-CheckForWater tileEntity.waterCount: " + tileEntity.waterCount);
//Log.Out("RebirthUtilities-CheckForWater tileEntity.blockValue.Block.blockName: " + tileEntity.blockValue.Block.blockName);
if (tileEntity.waterCount > 0 && tileEntity.blockValue.Block.blockName == blockName)
{
int minMax = 100;
result += tileEntity.waterCount;
}
bFound = true;
}
}
if (!bFound)
{
return -1;
}
return result;
}
public static bool CheckForHeat(WorldBase _world, int _clrIdx, Vector3i _blockPos, string blockName, int blockRange, int blockHeightMin, int blockHeightMax)
{
for (int i = _blockPos.x - blockRange; i <= _blockPos.x + blockRange; i++)
{
for (int j = _blockPos.z - blockRange; j <= _blockPos.z + blockRange; j++)
{
for (int k = _blockPos.y - blockHeightMin; k <= _blockPos.y + blockHeightMax; k++)
{
Vector3i tankPos = new Vector3i(i, k, j);
BlockValue block = _world.GetBlock(_clrIdx, tankPos);
if (block.Block.GetBlockName().ToLower() == blockName.ToLower())
{
if (_world.GetTileEntity(_clrIdx, tankPos) is TileEntityWorkstation tileEntity)
{
if (tileEntity.IsBurning)
{
return true;
}
}
}
}
}
}
return false;
}
public static int CheckForWater(WorldBase _world, int _clrIdx, Vector3i _blockPos, string blockName, int blockRange, int blockHeightMin, int blockHeightMax)
{
int result = 0;
bool bFound = false;
for (int i = _blockPos.x - blockRange; i <= _blockPos.x + blockRange; i++)
{
for (int j = _blockPos.z - blockRange; j <= _blockPos.z + blockRange; j++)
{
for (int k = _blockPos.y - blockHeightMin; k <= _blockPos.y + blockHeightMax; k++)
{
Vector3i tankPos = new Vector3i(i, k, j);
BlockValue block = _world.GetBlock(_clrIdx, tankPos);
if (block.Block.GetBlockName().ToLower() == blockName.ToLower())
{
if (_world.GetTileEntity(_clrIdx, tankPos) is TileEntityWaterTankRebirth tileEntityWaterTank)
{
if (tileEntityWaterTank.waterCount > 0)
{
int minMax = 100;
/*List<Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityChunkObserver), BoundsUtils.BoundsForMinMax(tankPos.x - minMax, tankPos.y - 20, tankPos.z - minMax, tankPos.x + minMax, tankPos.y + 20, tankPos.z + minMax), new List<Entity>());
int numEntities = 0;
if (entitiesInBounds != null && entitiesInBounds.Count > 0)
{
for (int x = 0; x < entitiesInBounds.Count; x++)
{
if (entitiesInBounds[x].EntityClass.entityClassName == "FuriousRamsayObserver")
{
numEntities++;
}
}
}*/
//////Log.Out("RebirthUtilities-CheckForWater numEntities: " + numEntities);
result += tileEntityWaterTank.waterCount;
}
bFound = true;
}
}
}
}
}
if (!bFound)
{
return -1;
}
return result;
}
public static void DepleteWater(WorldBase _world, int _clrIdx, Vector3i _blockPos, string blockName, int blockRange, int blockHeightMin, int blockHeightMax, int depletion)
{
for (int i = _blockPos.x - blockRange; i <= _blockPos.x + blockRange; i++)
{
for (int j = _blockPos.z - blockRange; j <= _blockPos.z + blockRange; j++)
{
for (int k = _blockPos.y - blockHeightMin; k <= _blockPos.y + blockHeightMax; k++)
{
BlockValue block = _world.GetBlock(_clrIdx, new Vector3i(i, k, j));
if (block.Block.GetBlockName().ToLower() == blockName.ToLower())
{
if (_world.GetTileEntity(_clrIdx, new Vector3i(i, k, j)) is TileEntityWaterTankRebirth tileEntityWaterTank)
{
if (tileEntityWaterTank.waterCount > 0)
{
tileEntityWaterTank.waterCount -= depletion;
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageUpdateWaterTankRebirth>().Setup(_clrIdx, new Vector3i(i, k, j), tileEntityWaterTank.waterCount));
return;
}
}
}
}
}
}
}
public static bool IsIndoors(Vector3 _woldPos)
{
float num = 1f;
Vector3i vector3i = World.worldToBlockPos(_woldPos);
IChunk chunkFromWorldPos = GameManager.Instance.World.GetChunkFromWorldPos(vector3i);
if (chunkFromWorldPos != null && vector3i.y >= 0 && vector3i.y < 255)
{
num = Mathf.Max(chunkFromWorldPos.GetLight(vector3i.x, vector3i.y, vector3i.z, Chunk.LIGHT_TYPE.SUN), chunkFromWorldPos.GetLight(vector3i.x, vector3i.y + 1, vector3i.z, Chunk.LIGHT_TYPE.SUN));
num /= 15f;
}
return num <= 0f;
}
public static Vector3 StringToVector3(string sVector, bool isScale = false)
{
//Log.Out("RebirthUtilities-StringToVector3 sVector: " + sVector);
//Log.Out("StackTrace: '{0}'", Environment.StackTrace);
if (string.IsNullOrEmpty(sVector))
{
//Log.Out("RebirthUtilities-StringToVector3 == null");
if (isScale)
{
return new Vector3(1, 1, 1);
}
return Vector3.zero;
}
// Remove the parentheses
if (sVector.StartsWith("(") && sVector.EndsWith(")"))
sVector = sVector.Substring(1, sVector.Length - 2);
// split the items
var sArray = sVector.Split(',');
// store as a Vector3
var result = new Vector3(
float.Parse(sArray[0]),
float.Parse(sArray[1]),
float.Parse(sArray[2]));
return result;
}
public static Vector3i StringToVector3i(string sVector)
{
if (string.IsNullOrEmpty(sVector))
{
return Vector3i.zero;
}
// Remove the parentheses
if (sVector.StartsWith("(") && sVector.EndsWith(")"))
{
sVector = sVector.Substring(1, sVector.Length - 2);
}
// split the items
string[] sArray = sVector.Split(',');
// store as a Vector3i
Vector3i result = new Vector3i(
float.Parse(sArray[0]),
float.Parse(sArray[1]),
float.Parse(sArray[2]));
return result;
}
public static string GetPropertyValue(string strClass, string strFeature)
{
//Log.Out("RebirthUtilities-GetPropertyValue 1");
BlockValue ConfigurationFeatureBlock = Block.GetBlockValue("RebirthFeatures");
if (ConfigurationFeatureBlock.type == 0)
{
//Log.Out("RebirthUtilities-GetPropertyValue 2");
return string.Empty;
}
string result = string.Empty;
if (ConfigurationFeatureBlock.Block.Properties.Classes.ContainsKey(strClass))
{
//Log.Out("RebirthUtilities-GetPropertyValue 3");
DynamicProperties dynamicProperties3 = ConfigurationFeatureBlock.Block.Properties.Classes[strClass];
foreach (KeyValuePair<string, string> keyValuePair in dynamicProperties3.Values.Dict)
{
//Log.Out("RebirthUtilities-GetPropertyValue keyValuePair.Key: " + keyValuePair.Key);
if (keyValuePair.Key == strFeature)
{
//Log.Out("RebirthUtilities-GetPropertyValue keyValuePair.Value.ToString(): " + keyValuePair.Value.ToString());
return keyValuePair.Value.ToString();
}
}
}
return result;
}
public static void lootContainerOpened(TileEntityLootContainer _te, LocalPlayerUI _playerUI, int _entityIdThatOpenedIt)
{
//////Log.Out("RebirthUtilities-lootContainerOpened START");
if (_playerUI != null)
{
//////Log.Out("RebirthUtilities-lootContainerOpened 1");
bool flag = true;
string lootContainerName = string.Empty;
if (_te.entityId != -1)
{
//////Log.Out("RebirthUtilities-lootContainerOpened 2");
Entity entity = GameManager.Instance.World.GetEntity(_te.entityId);
if (entity != null)
{
//////Log.Out("RebirthUtilities-lootContainerOpened 3");
lootContainerName = Localization.Get(EntityClass.list[entity.entityClass].entityClassName);
if (entity is EntityVehicle)
{
flag = false;
}
}
}
else
{
//////Log.Out("RebirthUtilities-lootContainerOpened 4");
BlockValue block = GameManager.Instance.World.GetBlock(_te.ToWorldPos());
lootContainerName = Localization.Get(Block.list[block.type].GetBlockName());
}
if (flag)
{
//////Log.Out("RebirthUtilities-lootContainerOpened 5");
((XUiC_LootWindowGroup)((XUiWindowGroup)_playerUI.windowManager.GetWindow("looting")).Controller).SetTileEntityChest(lootContainerName, _te);
_playerUI.windowManager.Open("looting", true);
}
LootContainer lootContainer = LootContainer.GetLootContainer(_te.lootListName);
if (lootContainer != null && _playerUI.entityPlayer != null)
{
//////Log.Out("RebirthUtilities-lootContainerOpened 6");
lootContainer.ExecuteBuffActions(_te.entityId, _playerUI.entityPlayer);
}
}
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//////Log.Out("RebirthUtilities-lootContainerOpened 7");
GameManager.Instance.lootManager.LootContainerOpened(_te, _entityIdThatOpenedIt, new FastTags<TagGroup.Global>());
_te.bTouched = true;
_te.SetModified();
}
}
public static bool ContainersHaveItem(List<TileEntity> tileEntities, int numItems, ItemValue itemValue)
{
foreach (TileEntity tileEntity in tileEntities)
{
if (numItems <= 0)
{
break;
}
if (!tileEntity.TryGetSelfOrFeature<ITileEntityLootable>(out var lootTileEntity))
{
continue;
}
// If there's no items in this container, skip.
if (!lootTileEntity.HasItem(itemValue))
{
continue;
}
if (lootTileEntity == null)
{
break;
}
for (int y = 0; y < lootTileEntity.items.Length; y++)
{
ItemStack item = lootTileEntity.items[y];
if (item.IsEmpty())
{
continue;
}
if (item.itemValue.ItemClass == itemValue.ItemClass)
{
// If we can completely satisfy the result, let's do that.
if (item.count >= numItems)
{
return true;
}
else
{
return false;
}
}
}
}
return false;
}
public static void RemoveContainerItems(List<TileEntity> tileEntities, int numItems, ItemValue itemValue)
{
foreach (TileEntity tileEntity in tileEntities)
{
if (numItems <= 0)
{
break;
}
if (!tileEntity.TryGetSelfOrFeature<ITileEntityLootable>(out var lootTileEntity))
{
continue;
}
// If there's no items in this container, skip.
if (!lootTileEntity.HasItem(itemValue))
{
continue;
}
if (lootTileEntity == null)
{
break;
}
for (int y = 0; y < lootTileEntity.items.Length; y++)
{
ItemStack item = lootTileEntity.items[y];
if (item.IsEmpty())
{
continue;
}
if (item.itemValue.ItemClass == itemValue.ItemClass)
{
// If we can completely satisfy the result, let's do that.
if (item.count >= numItems)
{
item.count -= numItems;
numItems = 0;
}
else
{
// Otherwise, let's just count down until we meet the requirement.
while (numItems >= 0)
{
item.count--;
numItems--;
if (item.count <= 0)
{
break;
}
}
}
//Update the slot on the container, and do the Setmodified(), so that the dedis can get updated.
if (item.count < 1)
{
lootTileEntity.UpdateSlot(y, ItemStack.Empty.Clone());
}
else
{
lootTileEntity.UpdateSlot(y, item);
}
lootTileEntity.SetModified();
}
}
}
}
public static string GetEntityPropertyValue(int EntityID, string strProperty)
{
string result = "";
EntityAlive myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
EntityClass entityClass = EntityClass.list[myEntity.entityClass];
if (entityClass.Properties.Values.ContainsKey(strProperty))
{
result = entityClass.Properties.Values[strProperty];
}
}
return result;
}
public string generateID()
{
return Guid.NewGuid().ToString("N");
}
public enum TileEntityRebirth
{
TileEntitySpawnPoint = 239,
TileEntityWorkstationRebirth = 240,
TileEntityAoE = 241,
TileEntitySpawnPOIEntityRebirth = 242,
TileEntityDriveableLootContainer = 243,
TileEntitySecureBlockRebirth = 244,
TileEntitySecureLootContainerRebirth = 245,
TileEntityResourceFeederRebirth = 246,
TileEntityManualLightRebirth = 247,
TileEntityTimedBlockRebirth = 248,
TileEntityFarmPlotRebirth = 249,
TileEntityWaterTankRebirth = 250,
TileEntityAnimalChickenRebirth = 251,
TileEntityChickenCoopRebirth = 252,
TileEntityPlantGrowingRebirth = 253,
TileEntitySurvivorRebirth = 254,
TileEntityTraderRebirth = 255
}
public static List<Vector3> ScanForTileEntities(EntityAlive Self, string _targetTypes = "")
{
List<Vector3> paths = new List<Vector3>();
Vector3i blockPosition = Self.GetBlockPosition();
int chunkX = World.toChunkXZ(blockPosition.x);
int chunkZ = World.toChunkXZ(blockPosition.z);
if (string.IsNullOrEmpty(_targetTypes) || _targetTypes.ToLower().Contains("basic"))
{
_targetTypes = "LandClaim, Loot, VendingMachine, Forge, Campfire, Workstation, PowerSource";
}
for (int i = -1; i < 2; i++)
{
for (int j = -1; j < 2; j++)
{
Chunk chunk = (Chunk)Self.world.GetChunkSync(chunkX + j, chunkZ + i);
if (chunk == null)
{
continue;
}
DictionaryList<Vector3i, TileEntity> tileEntities = chunk.GetTileEntities();
foreach (TileEntity tileEntity in tileEntities.list)
{
foreach (string filterTypeFull in _targetTypes.Split(','))
{
// Check if the filter type includes a :, which may indicate we want a precise block.
string filterType = filterTypeFull;
string blockNames = "";
if (filterTypeFull.Contains(":"))
{
filterType = filterTypeFull.Split(':')[0];
blockNames = filterTypeFull.Split(':')[1];
}
// Parse the filter type and verify if the tile entity is in the filter.
TileEntityType targetType = EnumUtils.Parse<TileEntityType>(filterType, true);
if (tileEntity.GetTileEntityType() != targetType)
{
continue;
}
// Search for the tile entity's block name to see if its filtered.
if (!string.IsNullOrEmpty(blockNames))
{
if (!blockNames.Contains(tileEntity.blockValue.Block.GetBlockName()))
{
continue;
}
}
Vector3 position = tileEntity.ToWorldPos().ToVector3();
paths.Add(position);
}
}
}
}
// sort the paths to keep the closes one.
return paths;
}
public static bool IsHordeDay()
{
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int item = valueTuple.Item1;
if (GameStats.GetInt(EnumGameStats.BloodMoonDay) == item)
{
return true;
}
return false;
}
public static int GetHireCost(int EntityID)
{
int result = -1;
EntityAlive myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
result = GetIntValue(EntityID, "HireCost");
}
if (result == -1)
{
result = 1000;
}
return result;
}
public static int GetIntValue(int EntityID, string strProperty)
{
int result = -1;
EntityAlive myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity)
{
EntityClass entityClass = EntityClass.list[myEntity.entityClass];
if (entityClass.Properties.Values.ContainsKey(strProperty))
{
result = int.Parse(entityClass.Properties.Values[strProperty]);
}
}
return result;
}
private enum HitMasks : int
{
Transparent = 1,
Liquid = 2,
NotCollidable = 4,
CollideBullets = 8,
CollideRockets = 0x10,
CollideArrows = 0x20,
CollideMovement = 0x40,
CollideMelee = 0x80,
}
public static int GetHitMaskByWeaponBuff(EntityAlive entity)
{
// Raycasts should always collide with these types of blocks.
// This is 0x42, which is the "base" value used if you call the
// Voxel.Raycast(World _worldData, Ray ray, float distance, bool bHitTransparentBlocks, bool bHitNotCollidableBlocks)
// overload; the transparent and non-collidable values are "ORed" to that, as needed.
int baseMask =
(int)HitMasks.CollideMovement |
(int)HitMasks.Liquid;
// Check for specialized ranged weapons
if (entity.Buffs.HasBuff("LBowUser") ||
entity.Buffs.HasBuff("XBowUser"))
{
return baseMask | (int)HitMasks.CollideArrows;
}
if (entity.Buffs.HasBuff("RocketLUser"))
{
return baseMask | (int)HitMasks.CollideRockets;
}
// Otherwise, if it has the "ranged" tag, assume bullets
if (entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("ranged")))
{
return baseMask | (int)HitMasks.CollideBullets;
}
// Otherwise, assume melee
return baseMask | (int)HitMasks.CollideMelee;
}
public static Entity GetAttackOrRevengeTarget(int EntityID)
{
EntityAlive myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive;
if (myEntity != null)
{
if (myEntity.GetAttackTarget() != null)
{
return myEntity.GetAttackTarget();
}
if (myEntity.GetRevengeTarget() != null)
{
return myEntity.GetRevengeTarget();
}
}
return null;
}
public static bool CanShoot(EntityAlive sourceEntity, EntityAlive targetEntity, float maxDistance = -1)
{
bool canLog = false;
var headPosition = sourceEntity.getHeadPosition();
var headPosition2 = targetEntity.getHeadPosition();
var direction = headPosition2 - headPosition;
var seeDistance = maxDistance;
if (maxDistance > -1)
seeDistance = maxDistance;
else
seeDistance = sourceEntity.GetSeeDistance();
if (direction.magnitude > seeDistance)
{
if (canLog)
Log.Out("SCoreUtils-CanShoot direction.magnitude > seeDistance");
return false;
}
var ray = new Ray(headPosition, direction);
ray.origin += direction.normalized * 0.2f;
if (Voxel.Raycast(sourceEntity.world, ray, seeDistance, true, true)) // Original code
{
if (canLog)
Log.Out("SCoreUtils-CanShoot 1");
if (GameUtils.IsBlockOrTerrain(Voxel.voxelRayHitInfo.tag))
{
if (canLog)
Log.Out("SCoreUtils-CanShoot 2: " + Voxel.voxelRayHitInfo.tag);
string blockName = Voxel.voxelRayHitInfo.hit.blockValue.Block.GetBlockName();
if (blockName.Contains("bars") || blockName.Contains("securityGatePlate"))
{
if (canLog)
Log.Out("SCoreUtils-CanShoot 3, blockName: " + blockName);
return true;
}
else
{
if (canLog)
Log.Out("SCoreUtils-CanShoot 4");
return false;
}
}
if (canLog)
Log.Out("SCoreUtils-CanShoot 5");
return true;
}
if (canLog)
Log.Out("SCoreUtils-CanShoot END");
return false;
}
public static bool CanSee(EntityAlive sourceEntity, EntityAlive targetEntity, float maxDistance = -1)
{
// If they are dead, you can't see them anymore...
if (targetEntity.IsDead())
{
////Log.Out("RebirthUtilities-CanSee 1");
return false;
}
// If the entity isn't very close to us, make sure they are in our viewcone.
float distance = sourceEntity.GetDistanceSq(targetEntity);
if (distance > 100)
{
////Log.Out("RebirthUtilities-CanSee 2");
if (!sourceEntity.IsInViewCone(targetEntity.position))
{
////Log.Out("RebirthUtilities-CanSee 3");
return false;
}
}
// Check to see if its in our "See" cache
if (sourceEntity.CanSee(targetEntity))
{
////Log.Out("RebirthUtilities-CanSee 4");
return true;
}
// This may have caused them to path incorrect, so make sure they are fairly close.
// Are we already targetting each other?
//var target = EntityUtilities.GetAttackOrRevengeTarget(targetEntity.entityId);
//if (target != null)
//{
// if (distance < 20)
// return true;
//}
Entity target = GetAttackOrRevengeTarget(sourceEntity.entityId);
if (target != null && targetEntity.entityId == target.entityId)
{
////Log.Out("RebirthUtilities-CanSee 5");
if (distance < 20)
{
////Log.Out("RebirthUtilities-CanSee 6");
return true;
}
}
Vector3 headPosition = sourceEntity.getHeadPosition();
Vector3 headPosition2 = targetEntity.getHeadPosition();
Vector3 direction = headPosition2 - headPosition;
float seeDistance = maxDistance;
if (maxDistance > -1)
{
seeDistance = maxDistance;
}
else
{
seeDistance = sourceEntity.GetSeeDistance();
}
if (direction.magnitude > seeDistance)
{
////Log.Out("RebirthUtilities-CanSee 7");
return false;
}
Ray ray = new Ray(headPosition, direction);
ray.origin += direction.normalized * 0.2f;
int hitMask = GetHitMaskByWeaponBuff(sourceEntity);
if (Voxel.Raycast(sourceEntity.world, ray, seeDistance, hitMask, 0.0f))//|| Voxel.Raycast(sourceEntity.world, ray, seeDistance, false, false))
//if (Voxel.Raycast(sourceEntity.world, ray, seeDistance, true, true)) // Original code
{
////Log.Out("RebirthUtilities-CanSee 8");
Transform hitRootTransform = GameUtils.GetHitRootTransform(Voxel.voxelRayHitInfo.tag, Voxel.voxelRayHitInfo.transform);
if (hitRootTransform == null)
{
////Log.Out("RebirthUtilities-CanSee 9");
return false;
}
EntityAlive component = hitRootTransform.GetComponent<EntityAlive>();
bool bFlag = component != null;
bool bFlag2 = component.IsAlive();
bool bFlag3 = targetEntity != component;
////Log.Out("RebirthUtilities-CanSee component != null: " + bFlag);
////Log.Out("RebirthUtilities-CanSee component.IsAlive(): " + bFlag2);
////Log.Out("RebirthUtilities-CanSee targetEntity != component: " + bFlag3);
////Log.Out("RebirthUtilities-CanSee targetEntity: " + targetEntity.EntityName);
////Log.Out("RebirthUtilities-CanSee component: " + component.EntityName);
if (bFlag && bFlag2 && bFlag3)
{
////Log.Out("RebirthUtilities-CanSee 10");
// Check to see if its in our "See" cache
if (sourceEntity.CanSee(targetEntity))
{
////Log.Out("RebirthUtilities-CanSee 11");
return true;
}
// Don't wake up the sleeping zombies if the leader is crouching.
/*var leader = EntityUtilities.GetLeaderOrOwner(sourceEntity.entityId) as EntityAlive;
if (leader != null && leader.IsCrouching && component.IsSleeping)
{
////////Log.Out("RebirthUtilities-CanSee 12");
return false;
}*/
// if they are fairly far away, do a view cone check
if (sourceEntity.GetDistanceSq(targetEntity) > 30)
{
////Log.Out("RebirthUtilities-CanSee 13");
if (!sourceEntity.IsInViewCone(targetEntity.position))
{
////Log.Out("RebirthUtilities-CanSee 14");
return false;
}
}
// If the target is the player, check to see if they are stealth
/*var player = target as EntityPlayer;
if (player != null)
{
////////Log.Out("RebirthUtilities-CanSee 15");
var distance2 = sourceEntity.GetDistance(player);
if (!sourceEntity.CanSeeStealth(distance2, player.Stealth.lightLevel))
{
////////Log.Out("RebirthUtilities-CanSee 16");
return false;
}
}*/
// If the leader is the player, use the player's stealth check against the presumed NPC.
/*if (leader != null)
{
////////Log.Out("RebirthUtilities-CanSee 17");
var player2 = leader as EntityPlayer;
var distance2 = sourceEntity.GetDistance(leader);
if (leader is EntityPlayer && !sourceEntity.CanSeeStealth(distance2, player2.Stealth.lightLevel))
{
////////Log.Out("RebirthUtilities-CanSee 18");
return false;
}
}*/
/// Add the entity to our CanSee Cache, which expires.
sourceEntity.SetCanSee(targetEntity);
return true;
}
}
////Log.Out("RebirthUtilities-CanSee 19");
return false;
}
public static bool isHordeNightLonger()
{
if (GameManager.Instance.World != null)
{
if (SkyManager.IsBloodMoonVisible())
{
return RebirthVariables.isHordeNight;
}
else
{
//Log.Out("RebirthUtilities-isHordeNightLonger 3");
ulong worldTime = GameManager.Instance.World.worldTime;
ValueTuple<int, int, int> valueTuple = GameUtils.WorldTimeToElements(worldTime);
int num = valueTuple.Item2;
int num2 = valueTuple.Item3;
int numDaylength = GamePrefs.GetInt(EnumGamePrefs.DayLightLength);
//Log.Out("RebirthUtilities-isHordeNightLonger B1 numDaylength: " + numDaylength);
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient && RebirthVariables.DayLightLength > 0)
{
numDaylength = RebirthVariables.DayLightLength;
//Log.Out("RebirthUtilities-isHordeNightLonger B2 numDaylength: " + numDaylength);
}
int numOpenTime = 22 - numDaylength;
//Log.Out("RebirthUtilities-isHordeNightLonger B numOpenTime: " + numOpenTime);
if (num >= (numOpenTime))
{
if (num == numOpenTime)
{
if (num2 < (30))
{
if (RebirthVariables.wasHordeNight)
{
//Log.Out("RebirthUtilities-isHordeNightLonger 4");
return true;
}
}
}
//Log.Out("RebirthUtilities-isHordeNightLonger 5");
return false;
}
else
{
//Log.Out("RebirthUtilities-isHordeNightLonger 6");
RebirthVariables.wasHordeNight = false;
return false;
}
}
}
return false;
}
public static bool isPastHordeNight()
{
if (GameManager.Instance.World != null)
{
if (!SkyManager.IsBloodMoonVisible())
{
if (isHordeNightLonger())
{
return true;
}
}
}
return false;
}
public static bool IsHordeNight()
{
if (RebirthVariables.testHordeNightDay)
{
return true;
}
return RebirthVariables.isHordeNight;
}
public static IEnumerator GetBackPackContent(float halt, EntityPlayerLocal ___entityPlayerLocal, Vector3 vector)
{
//Log.Out("GetBackPackContent-RebirthUtilities: START, playerID: " + ___entityPlayerLocal.entityId);
yield return new WaitForSeconds(halt);
RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"] = 0;
//Log.Out("player location, ___entityPlayerLocal.position: " + ___entityPlayerLocal.position);
World world = GameManager.Instance.World;
for (int i = world.Entities.list.Count - 1; i >= 0; i--)
{
if (world.Entities.list[i] is EntityBackpack)
{
EntityBackpack backpack = (EntityBackpack)world.Entities.list[i];
if (backpack != null)
{
//Log.Out("player location, (EntityBackpack)world.Entities.list[i]).RefPlayerId: " + backpack.RefPlayerId);
//Log.Out("player location, playerID: " + ___entityPlayerLocal.entityId);
if (backpack.RefPlayerId == ___entityPlayerLocal.entityId)
{
//Log.Out("Found player backpack (RefPlayerId: " + backpack.RefPlayerId + "), pos: " + world.Entities.list[i].position + ", new pos: " + ___entityPlayerLocal.position);
//Log.Out("RebirthUtilities-GetBackPackContent bTouched: " + backpack.lootContainer.bTouched);
//Log.Out("RebirthUtilities-GetBackPackContent bWasTouched: " + backpack.lootContainer.bWasTouched);
if (!backpack.lootContainer.bWasTouched)
{
//Log.Out("RebirthUtilities-GetBackPackContent 1");
XUiM_PlayerInventory playerInventory = LocalPlayerUI.GetUIForPlayer(___entityPlayerLocal).xui.PlayerInventory;
ItemStack[] items = world.Entities.list[i].lootContainer.items;
for (int k = 0; k < items.Length; k++)
{
if (!items[k].IsEmpty())
{
//Log.Out("RebirthUtilities-GetBackPackContent 2");
ItemStack itemStack = items[k].Clone();
if (!playerInventory.AddItem(itemStack))
{
//Log.Out("RebirthUtilities-GetBackPackContent 3");
playerInventory.DropItem(itemStack);
}
world.Entities.list[i].lootContainer.UpdateSlot(k, ItemStack.Empty.Clone());
}
}
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("RebirthUtilities-GetBackPackContent 4");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageDespawnBackpackRebirth>().Setup(world.Entities.list[i].entityId), false);
}
break;
}
}
}
}
}
yield break;
}
public static IEnumerator ProcessItemEmptySpot(float halt, EntityPlayerLocal ___entityPlayerLocal, int itemIndex, int emptyItemIndex)
{
yield return new WaitForSeconds(halt);
___entityPlayerLocal.inventory.SetFocusedItemIdx(itemIndex);
___entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(itemIndex);
yield return new WaitForSeconds(0.15f);
ItemStack[] currentSlots = ___entityPlayerLocal.inventory.GetSlots();
currentSlots[emptyItemIndex] = ItemStack.Empty.Clone();
___entityPlayerLocal.inventory.SetSlots(currentSlots);
___entityPlayerLocal.inventory.SetFocusedItemIdx(itemIndex);
___entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(itemIndex);
RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"] = 0;
yield break;
}
public static IEnumerator ProcessItemUsedSpot(float halt, EntityPlayerLocal ___entityPlayerLocal, int itemIndex, ItemStack @currentHoldingItem, int numItems)
{
//////Log.Out("START");
yield return new WaitForSeconds(2f);
ItemStack[] currentSlots = ___entityPlayerLocal.inventory.GetSlots();
//////Log.Out("ADDING ITEM: " + @currentHoldingItem.itemValue.ItemClass.GetItemName());
currentSlots[itemIndex] = ItemStack.Empty.Clone();
___entityPlayerLocal.inventory.SetSlots(currentSlots);
currentSlots = ___entityPlayerLocal.inventory.GetSlots();
currentSlots[itemIndex] = @currentHoldingItem.Clone();
currentSlots[itemIndex] = new ItemStack(@currentHoldingItem.itemValue.Clone(), numItems);
___entityPlayerLocal.inventory.SetSlots(currentSlots);
___entityPlayerLocal.inventory.SetFocusedItemIdx(itemIndex);
___entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(itemIndex);
RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"] = 0;
//////Log.Out("END");
yield break;
}
public static void TakeItemWithTimer(WorldBase _world, int _cIdx, Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player, float _takeDelay, string _entityType, string _ReplacementBlockName, int _numBlocks, bool _isReplacementItem)
{
if (_blockValue.damage > 0)
{
GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttRepairBeforePickup"), string.Empty, "ui_denied", null);
return;
}
LocalPlayerUI playerUI = (_player as EntityPlayerLocal).PlayerUI;
playerUI.windowManager.Open("timer", true, false, true);
XUiC_Timer childByType = playerUI.xui.GetChildByType<XUiC_Timer>();
TimerEventData timerEventData = new TimerEventData();
////Log.Out("RebirthUtilities-TakeItemWithTimer _takeDelay: " + _takeDelay);
////Log.Out("RebirthUtilities-TakeItemWithTimer _ReplacementBlockName: " + _ReplacementBlockName);
////Log.Out("RebirthUtilities-TakeItemWithTimer _numBlocks: " + _numBlocks);
////Log.Out("RebirthUtilities-TakeItemWithTimer _isReplacementItem: " + _isReplacementItem);
if (_ReplacementBlockName == "")
{
_ReplacementBlockName = _blockValue.Block.GetBlockName();
}
else
{
if (_ReplacementBlockName.Contains(","))
{
string[] words = _ReplacementBlockName.Split(',');
System.Random rnd = new System.Random();
int numRandom = rnd.Next(words.Length);
_ReplacementBlockName = words[numRandom];
}
}
timerEventData.Data = new object[]
{
_cIdx,
_blockValue,
_blockPos,
_player,
_ReplacementBlockName,
_numBlocks,
_isReplacementItem
};
timerEventData.Event += new TimerEventHandler(EventData_Event);
timerEventData.CloseEvent += ResetEventData;
childByType.SetTimer(_takeDelay, timerEventData, -1f, "");
}
private static void ResetEventData(TimerEventData timerData)
{
timerData.Event -= EventData_Event;
}
private static void EventData_Event(TimerEventData timerData)
{
World world = GameManager.Instance.World;
object[] array = (object[])timerData.Data;
int clrIdx = (int)array[0];
BlockValue blockValue = (BlockValue)array[1];
Vector3i vector3i = (Vector3i)array[2];
BlockValue block = world.GetBlock(vector3i);
EntityPlayerLocal entityPlayerLocal = array[3] as EntityPlayerLocal;
string ReplacementBlockName = (string)array[4];
int numBlocks = (int)array[5];
//Log.Out("RebirthUtilities-EventData_Event array[0]: " + array[0]);
//Log.Out("RebirthUtilities-EventData_Event array[1]: " + array[1]);
//Log.Out("RebirthUtilities-EventData_Event array[2]: " + array[2]);
//Log.Out("RebirthUtilities-EventData_Event array[3]: " + array[3]);
//Log.Out("RebirthUtilities-EventData_Event array[4]: " + array[4]);
//Log.Out("RebirthUtilities-EventData_Event array[5]: " + array[5]);
//Log.Out("RebirthUtilities-EventData_Event array[6]: " + array[6]);
bool isReplacementItem = (bool)array[6];
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityPlayerLocal);
if (ReplacementBlockName != "")
{
block = Block.GetBlockValue(ReplacementBlockName, false);
////Log.Out("RebirthUtilities-EventData_Event block: " + block.Block.GetBlockName());
}
for (int j = 0; j < numBlocks; j++)
{
if (isReplacementItem)
{
////Log.Out("RebirthUtilities-EventData_Event ReplacementItem: " + ReplacementBlockName);
ItemValue item = ItemClass.GetItem(ReplacementBlockName);
if (item == null)
{
////Log.Out("RebirthUtilities-EventData_Event 3");
return;
}
ItemStack itemStack = new ItemStack(item, 1);
if (itemStack.itemValue.HasQuality)
{
int randomInt = RebirthUtilities.GetQualityFromLootstage(entityPlayerLocal);
itemStack.itemValue.Quality = (ushort)randomInt;
}
bool flag13 = !uiforPlayer.xui.PlayerInventory.AddItem(itemStack);
if (flag13)
{
////Log.Out("RebirthUtilities-EventData_Event 4");
uiforPlayer.xui.PlayerInventory.DropItem(itemStack);
}
}
else
{
////Log.Out("RebirthUtilities-EventData_Event NO REPLACEMENT ITEM");
////Log.Out("RebirthUtilities-EventData_Event block: " + block.Block.GetBlockName());
ItemStack itemStack = new ItemStack(block.ToItemValue(), 1);
if (itemStack.itemValue.HasQuality)
{
int randomInt = RebirthUtilities.GetQualityFromLootstage(entityPlayerLocal);
itemStack.itemValue.Quality = (ushort)randomInt;
}
if (!uiforPlayer.xui.PlayerInventory.AddItem(itemStack))
{
////Log.Out("RebirthUtilities-EventData_Event 5");
uiforPlayer.xui.PlayerInventory.DropItem(itemStack);
}
}
}
world.SetBlockRPC(clrIdx, vector3i, BlockValue.Air);
}
public static void AddOutputItems(Recipe _recipe, ItemStack[] workstationOutput, bool isWorkstation = false, WorkstationData workstationData = null)
{
string recipeName = _recipe.GetName();
string craftingArea = _recipe.craftingArea;
//Log.Out("RebirthUtilities-AddOutputItems recipeName: " + recipeName);
foreach (RecipeOutputRebirth recipe in recipeOutputs)
{
string outputRecipeName = recipe.recipeName;
string outputCraftingArea = recipe.craftingArea;
//Log.Out("RebirthUtilities-AddOutputItems recipeName: " + recipeName);
//Log.Out("RebirthUtilities-AddOutputItems outputRecipeName: " + outputRecipeName);
//Log.Out("RebirthUtilities-AddOutputItems craftingArea: " + craftingArea);
//Log.Out("RebirthUtilities-AddOutputItems outputCraftingArea: " + outputCraftingArea);
if (recipeName == outputRecipeName && craftingArea == outputCraftingArea)
{
//Log.Out("RebirthUtilities-AddOutputItems recipeName: " + recipe.recipeName);
foreach (ItemStack output in recipe.OutputItems)
{
//Log.Out("RebirthUtilities-AddOutputItems output.itemValue.ItemClass.Name: " + output.itemValue.ItemClass.Name);
//Log.Out("RebirthUtilities-AddOutputItems output.count: " + output.count);
if (output.itemValue.ItemClass.Name == "drinkJarEmpty" ||
output.itemValue.ItemClass.Name == "drinkCanEmpty"
)
{
ItemValue item = output.itemValue;
if (workstationOutput != null)
{
//Log.Out("RebirthUtilities-AddOutputItems WORKSTATION EXISTS");
ItemStack.AddToItemStackArray(workstationOutput, new ItemStack(item, output.count));
}
else
{
//Log.Out("RebirthUtilities-AddOutputItems 1");
if (!isWorkstation)
{
//Log.Out("RebirthUtilities-AddOutputItems 2");
GameManager.Instance.World.GetPrimaryPlayer().PlayerUI.xui.PlayerInventory.AddItemNoPartial(new ItemStack(item, output.count), false);
}
else
{
//Log.Out("RebirthUtilities-AddOutputItems 3");
foreach (XUiC_WorkstationWindowGroup xuiC_WorkstationWindowGroup in GameManager.Instance.World.GetPrimaryPlayer().PlayerUI.xui.GetWindowsByType<XUiC_WorkstationWindowGroup>())
{
//Log.Out("RebirthUtilities-AddOutputItems 4");
if (xuiC_WorkstationWindowGroup.IsOpen)
{
XUiC_WorkstationOutputGrid outputGrid = xuiC_WorkstationWindowGroup.GetChildByType<XUiC_WorkstationOutputGrid>();
//Log.Out("RebirthUtilities-AddOutputItems 5");
if (outputGrid != null)
{
//Log.Out("RebirthUtilities-AddOutputItems 6");
ItemStack itemStack = new ItemStack(item, output.count);
ItemStack[] slots = outputGrid.GetSlots();
bool flag = false;
for (int i = 0; i < slots.Length; i++)
{
if (slots[i].CanStackWith(itemStack))
{
//Log.Out("RebirthUtilities-AddOutputItems 7");
slots[i].count += output.count; //this.recipe.count;
flag = true;
break;
}
}
if (!flag)
{
//Log.Out("RebirthUtilities-AddOutputItems 8");
for (int j = 0; j < slots.Length; j++)
{
if (slots[j].IsEmpty())
{
//Log.Out("RebirthUtilities-AddOutputItems 9");
slots[j] = itemStack;
flag = true;
break;
}
}
}
if (flag)
{
//Log.Out("RebirthUtilities-AddOutputItems 10");
outputGrid.SetSlots(slots);
outputGrid.UpdateData(slots);
outputGrid.IsDirty = true;
}
}
}
}
}
}
}
}
break;
}
}
}
public static string craftingTimeToString(float time)
{
return string.Format("{0}:{1}", ((int)(time / 60f)).ToString("0").PadLeft(2, '0'), ((int)(time % 60f)).ToString("0").PadLeft(2, '0'));
}
public static bool outputStack(XUiC_RecipeStack __instance,
Recipe ___recipe,
ref ItemValue ___originalItem,
ref ItemValue ___outputItemValue,
int ___outputQuality,
int ___startingEntityId,
ref int ___amountToRepair,
bool ___playSound,
XUiWindowGroup ___windowGroup,
int ___recipeCount,
ref bool ___isCrafting,
ref float ___craftingTimeLeft,
float ___oneItemCraftTime,
ref bool ___isInventoryFull,
ref XUiController ___lockIcon,
ref XUiController ___overlay,
ref XUiController ___itemIcon,
ref XUiController ___timer,
ref XUiController ___count,
ref XUiController ___cancel,
bool ___isOver,
XUiController ___background,
float ___totalCraftTimeLeft
)
{
////Log.Out("RebirthUtilities-outputStack START");
if (___recipe == null)
{
////Log.Out("RebirthUtilities-outputStack 1");
return false;
}
EntityPlayerLocal entityPlayer = __instance.xui.playerUI.entityPlayer;
if (entityPlayer == null)
{
////Log.Out("RebirthUtilities-outputStack 2");
return false;
}
if (___originalItem == null || ___originalItem.Equals(ItemValue.None))
{
////Log.Out("RebirthUtilities-outputStack 3");
___outputItemValue = new ItemValue(___recipe.itemValueType, ___outputQuality, ___outputQuality, false, null, 1f);
ItemClass itemClass = ___outputItemValue.ItemClass;
if (___outputItemValue == null)
{
////Log.Out("RebirthUtilities-outputStack 4");
return false;
}
if (itemClass == null)
{
////Log.Out("RebirthUtilities-outputStack 5");
return false;
}
if (entityPlayer.entityId == ___startingEntityId)
{
////Log.Out("RebirthUtilities-outputStack 6");
//__instance.giveExp(___outputItemValue, itemClass);
}
else if (__instance.windowGroup.Controller is XUiC_WorkstationWindowGroup controller)
{
controller.WorkstationData.TileEntity.AddCraftComplete(__instance.startingEntityId, __instance.outputItemValue, __instance.recipe.GetName(), __instance.recipe.craftExpGain, __instance.recipe.count);
}
if (___recipe.GetName().Equals("meleeToolRepairT0StoneAxe"))
{
////Log.Out("RebirthUtilities-outputStack 7");
IAchievementManager achievementManager = PlatformManager.NativePlatform.AchievementManager;
////Log.Out("RebirthUtilities-outputStack 8");
achievementManager?.SetAchievementStat(EnumAchievementDataStat.StoneAxeCrafted, 1);
}
else if (___recipe.GetName().Equals("frameShapes:VariantHelper"))
{
////Log.Out("RebirthUtilities-outputStack 9");
IAchievementManager achievementManager2 = PlatformManager.NativePlatform.AchievementManager;
////Log.Out("RebirthUtilities-outputStack 10");
achievementManager2?.SetAchievementStat(EnumAchievementDataStat.WoodFrameCrafted, 1);
}
}
else if (___amountToRepair > 0)
{
////Log.Out("RebirthUtilities-outputStack 11");
ItemValue itemValue = ___originalItem.Clone();
itemValue.UseTimes -= ___amountToRepair;
ItemClass itemClass2 = itemValue.ItemClass;
if (itemValue.UseTimes < 0f)
{
////Log.Out("RebirthUtilities-outputStack 12");
itemValue.UseTimes = 0f;
}
___outputItemValue = itemValue.Clone();
QuestEventManager.Current.RepairedItem(___outputItemValue);
___amountToRepair = 0;
}
if (___outputItemValue != null)
{
////Log.Out("RebirthUtilities-outputStack 13");
GameSparksCollector.IncrementCounter(GameSparksCollector.GSDataKey.CraftedItems, ___outputItemValue.ItemClass.Name, 1, true, GameSparksCollector.GSDataCollection.SessionUpdates);
}
XUiC_WorkstationOutputGrid childByType = ___windowGroup.Controller.GetChildByType<XUiC_WorkstationOutputGrid>();
if (childByType != null && (___originalItem == null || ___originalItem.Equals(ItemValue.None)))
{
////Log.Out("RebirthUtilities-outputStack 14");
ItemStack itemStack = new ItemStack(___outputItemValue, ___recipe.count);
ItemStack[] slots = childByType.GetSlots();
bool flag = false;
for (int i = 0; i < slots.Length; i++)
{
////Log.Out("RebirthUtilities-outputStack 15");
if (slots[i].CanStackWith(itemStack))
{
////Log.Out("RebirthUtilities-outputStack 16");
slots[i].count += ___recipe.count;
flag = true;
break;
}
}
if (!flag)
{
////Log.Out("RebirthUtilities-outputStack 17");
for (int j = 0; j < slots.Length; j++)
{
////Log.Out("RebirthUtilities-outputStack 18");
if (slots[j].IsEmpty())
{
////Log.Out("RebirthUtilities-outputStack 19");
slots[j] = itemStack;
flag = true;
break;
}
}
}
if (flag)
{
////Log.Out("RebirthUtilities-outputStack 20");
childByType.SetSlots(slots);
childByType.UpdateData(slots);
childByType.IsDirty = true;
QuestEventManager.Current.CraftedItem(itemStack);
if (___playSound)
{
////Log.Out("RebirthUtilities-outputStack 21");
if (___recipe.craftingArea != null)
{
////Log.Out("RebirthUtilities-outputStack 22");
WorkstationData workstationData = CraftingManager.GetWorkstationData(___recipe.craftingArea);
if (workstationData != null)
{
// ADD TO WORKSTATION
AddOutputItems(___recipe, null, true, workstationData);
////Log.Out("RebirthUtilities-outputStack 23");
Manager.PlayInsidePlayerHead(workstationData.CraftCompleteSound, -1, 0f, false);
}
}
else
{
////Log.Out("RebirthUtilities-outputStack 24");
Manager.PlayInsidePlayerHead("craft_complete_item", -1, 0f, false);
}
}
}
else if (!AddItemToInventory(__instance,
___recipe,
___recipeCount,
___originalItem,
___outputItemValue,
ref ___isInventoryFull,
___playSound,
ref ___isCrafting,
ref ___craftingTimeLeft,
___oneItemCraftTime,
ref ___lockIcon,
ref ___overlay,
ref ___itemIcon,
ref ___timer,
ref ___count,
ref ___cancel,
___isOver,
___background,
___totalCraftTimeLeft))
{
////Log.Out("RebirthUtilities-outputStack 25");
___isInventoryFull = true;
string text = "No room in workstation output, crafting has been halted until space is cleared.";
if (Localization.Exists("wrnWorkstationOutputFull"))
{
////Log.Out("RebirthUtilities-outputStack 26");
text = Localization.Get("wrnWorkstationOutputFull");
}
GameManager.ShowTooltip(entityPlayer, text);
Manager.PlayInsidePlayerHead("ui_denied", -1, 0f, false);
return false;
}
}
else
{
////Log.Out("RebirthUtilities-outputStack 27");
if (!__instance.xui.dragAndDrop.CurrentStack.IsEmpty() && __instance.xui.dragAndDrop.CurrentStack.itemValue.ItemClass is ItemClassQuest)
{
////Log.Out("RebirthUtilities-outputStack 28");
return false;
}
ItemStack itemStack2 = new ItemStack(___outputItemValue, ___recipe.count);
if (__instance.destinationToolbeltSlot >= 0 && __instance.xui.PlayerInventory.AddItemToPreferredToolbeltSlot(itemStack2, __instance.destinationToolbeltSlot))
{
return true;
}
if (!__instance.xui.PlayerInventory.AddItemNoPartial(itemStack2, false))
{
////Log.Out("RebirthUtilities-outputStack 29");
if (itemStack2.count != ___recipe.count)
{
////Log.Out("RebirthUtilities-outputStack 30");
__instance.xui.PlayerInventory.DropItem(itemStack2);
QuestEventManager.Current.CraftedItem(itemStack2);
return true;
}
___isInventoryFull = true;
string text2 = "No room in inventory, crafting has been halted until space is cleared.";
if (Localization.Exists("wrnInventoryFull"))
{
////Log.Out("RebirthUtilities-outputStack 31");
text2 = Localization.Get("wrnInventoryFull");
}
GameManager.ShowTooltip(entityPlayer, text2);
Manager.PlayInsidePlayerHead("ui_denied", -1, 0f, false);
return false;
}
else
{
////Log.Out("RebirthUtilities-outputStack 32");
// ADD TO PLAYER INVENTORY
AddOutputItems(___recipe, null);
if (___originalItem != null && !___originalItem.IsEmpty())
{
////Log.Out("RebirthUtilities-outputStack 33");
if (___recipe.ingredients.Count > 0)
{
////Log.Out("RebirthUtilities-outputStack 34");
QuestEventManager.Current.ScrappedItem(___recipe.ingredients[0]);
}
}
else
{
////Log.Out("RebirthUtilities-outputStack 35");
itemStack2.count = ___recipe.count - itemStack2.count;
QuestEventManager.Current.CraftedItem(itemStack2);
}
if (___playSound)
{
////Log.Out("RebirthUtilities-outputStack 36");
Manager.PlayInsidePlayerHead("craft_complete_item", -1, 0f, false);
}
}
}
if (!___isInventoryFull)
{
////Log.Out("RebirthUtilities-outputStack 37");
___originalItem = ItemValue.None.Clone();
}
////Log.Out("RebirthUtilities-outputStack END");
return true;
}
public static bool AddItemToInventory(XUiC_RecipeStack __instance,
Recipe ___recipe,
int ___recipeCount,
ItemValue ___originalItem,
ItemValue ___outputItemValue,
ref bool ___isInventoryFull,
bool ___playSound,
ref bool ___isCrafting,
ref float ___craftingTimeLeft,
float ___oneItemCraftTime,
ref XUiController ___lockIcon,
ref XUiController ___overlay,
ref XUiController ___itemIcon,
ref XUiController ___timer,
ref XUiController ___count,
ref XUiController ___cancel,
bool ___isOver,
XUiController ___background,
float ___totalCraftTimeLeft
)
{
////Log.Out("RebirthUtilities-AddItemToInventory START");
ItemStack itemStack = new ItemStack(___outputItemValue, ___recipe.count);
if (!__instance.xui.PlayerInventory.AddItemNoPartial(itemStack, false))
{
////Log.Out("RebirthUtilities-AddItemToInventory 1");
updateRecipeData(___recipe,
___recipeCount,
___originalItem,
ref ___lockIcon,
ref ___overlay,
ref ___itemIcon,
ref ___timer,
ref ___count,
ref ___cancel,
___isOver,
___background,
___totalCraftTimeLeft);
return false;
}
AddOutputItems(___recipe, null);
QuestEventManager.Current.CraftedItem(new ItemStack(___outputItemValue, ___recipe.count));
___isInventoryFull = false;
if (___playSound)
{
////Log.Out("RebirthUtilities-AddItemToInventory 2");
if (___recipe.craftingArea != null)
{
WorkstationData workstationData = CraftingManager.GetWorkstationData(___recipe.craftingArea);
if (workstationData != null)
{
////Log.Out("RebirthUtilities-AddItemToInventory 3");
Manager.PlayInsidePlayerHead(workstationData.CraftCompleteSound, -1, 0f, false);
}
}
else
{
////Log.Out("RebirthUtilities-AddItemToInventory 4");
Manager.PlayInsidePlayerHead("craft_complete_item", -1, 0f, false);
}
}
if (___recipeCount <= 0)
{
////Log.Out("RebirthUtilities-AddItemToInventory 5");
___isCrafting = false;
if (___recipe != null || ___craftingTimeLeft != 0f)
{
////Log.Out("RebirthUtilities-AddItemToInventory 6");
__instance.SetRecipe(null, 0, 0f, true, -1, -1, -1f);
}
}
else
{
////Log.Out("RebirthUtilities-AddItemToInventory 7");
___craftingTimeLeft += ___oneItemCraftTime;
}
////Log.Out("RebirthUtilities-AddItemToInventory END");
return true;
}
public static void updateRecipeData(Recipe ___recipe,
int ___recipeCount,
ItemValue ___originalItem,
ref XUiController ___lockIcon,
ref XUiController ___overlay,
ref XUiController ___itemIcon,
ref XUiController ___timer,
ref XUiController ___count,
ref XUiController ___cancel,
bool ___isOver,
XUiController ___background,
float ___totalCraftTimeLeft
)
{
////Log.Out("RebirthUtilities-updateRecipeData START");
if (___recipe == null && (___originalItem == null || ___originalItem.type == 0))
{
////Log.Out("RebirthUtilities-updateRecipeData 1");
if (___lockIcon != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 2");
___lockIcon.ViewComponent.IsVisible = false;
}
if (___overlay != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 3");
___overlay.ViewComponent.IsVisible = false;
}
if (___itemIcon != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 4");
___itemIcon.ViewComponent.IsVisible = false;
}
if (___timer != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 5");
___timer.ViewComponent.IsVisible = false;
}
if (___count != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 6");
___count.ViewComponent.IsVisible = false;
}
if (___cancel != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 7");
___cancel.ViewComponent.IsVisible = false;
return;
}
}
else
{
////Log.Out("RebirthUtilities-updateRecipeData 8");
if (___lockIcon != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 9");
___lockIcon.ViewComponent.IsVisible = true;
}
if (___overlay != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 10");
___overlay.ViewComponent.IsVisible = true;
}
if (___itemIcon != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 11");
ItemClass itemClass = (___recipe != null) ? ItemClass.GetForId(___recipe.itemValueType) : ___originalItem.ItemClass;
if (itemClass != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 12");
((XUiV_Sprite)___itemIcon.ViewComponent).SetSpriteImmediately(itemClass.GetIconName());
___itemIcon.ViewComponent.IsVisible = true;
((XUiV_Sprite)___itemIcon.ViewComponent).Color = itemClass.GetIconTint(null);
}
}
if (___timer != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 13");
((XUiV_Label)___timer.ViewComponent).SetTextImmediately(craftingTimeToString(___totalCraftTimeLeft + 0.5f));
___timer.ViewComponent.IsVisible = true;
}
if (___count != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 14");
___count.ViewComponent.IsVisible = true;
((XUiV_Label)___count.ViewComponent).SetTextImmediately((___recipeCount * ___recipe.count).ToString());
}
if (___cancel != null)
{
////Log.Out("RebirthUtilities-updateRecipeData 15");
Color color = ((XUiV_Sprite)___cancel.ViewComponent).Color;
if (___isOver && UICamera.hoveredObject == ___background.ViewComponent.UiTransform.gameObject)
{
////Log.Out("RebirthUtilities-updateRecipeData 16");
((XUiV_Sprite)___cancel.ViewComponent).Color = new Color(color.r, color.g, color.b, 0.75f);
}
else
{
////Log.Out("RebirthUtilities-updateRecipeData 17");
((XUiV_Sprite)___cancel.ViewComponent).Color = new Color(color.r, color.g, color.b, 0f);
}
___cancel.ViewComponent.IsVisible = true;
}
}
}
public static void removeTileEntityAccess(Vector3i location)
{
for (int i = 0; i < RebirthVariables.accessedTileEntities.Count; i++)
{
if (RebirthVariables.accessedTileEntities[i].location == location)
{
RebirthVariables.accessedTileEntities.RemoveAt(i);
break;
}
}
}
public static void removeTileEntityAccess(int playerID)
{
for (int i = 0; i < RebirthVariables.accessedTileEntities.Count; i++)
{
if (RebirthVariables.accessedTileEntities[i].owner == playerID)
{
RebirthVariables.accessedTileEntities.RemoveAt(i);
break;
}
}
}
public static bool OpenTileWindow(EntityAlive _player, TileEntity tileEntity, string windowGroup, string window, string sound)
{
////Log.Out("RebirthUtilities-OpenTileWindow START");
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)_player);
GUIWindowManager windowManager = uiforPlayer.windowManager;
windowManager.Open(windowGroup, true, false, true);
////Log.Out("RebirthUtilities-OpenTileWindow windowGroup: " + windowGroup);
if (windowManager.IsWindowOpen(windowGroup))
{
Manager.BroadcastPlayByLocalPlayer(_player.position, sound);
////Log.Out("RebirthUtilities-OpenTileWindow windowGroup IS OPEN");
if (tileEntity is TileEntityDriveableLootContainer)
{
////Log.Out("RebirthUtilities-OpenTileWindow tileEntity is TileEntityDriveableLootContainer");
////Log.Out("RebirthUtilities-OpenTileWindow windowGroup window: " + window);
XUiC_RepairableVehicleWindow windowController = uiforPlayer.xui.GetWindow(window).Controller as XUiC_RepairableVehicleWindow;
////Log.Out("RebirthUtilities-OpenTileWindow windowController: " + windowController.ToString());
TileEntityDriveableLootContainer vehicleTE = tileEntity as TileEntityDriveableLootContainer;
////Log.Out("RebirthUtilities-OpenTileWindow vehicleTE: " + vehicleTE.ToString());
////Log.Out("RebirthUtilities-OpenTileWindow setting tileEntity . . .");
windowController.SetTileEntity(vehicleTE);
return true;
}
else
{
////Log.Out("RebirthUtilities-OpenTileWindow tileEntity is NOT TileEntityDriveableLootContainer");
if (tileEntity == null)
{
////Log.Out("RebirthUtilities-OpenTileWindow tileEntity == null");
}
}
}
return false;
}
public static void OpenTileEntity(EntityAlive _player, Vector3i _blockPos, string windowGroup, string window, string sound)
{
World world = GameManager.Instance.World;
Chunk chunk = (Chunk)world.GetChunkFromWorldPos(_blockPos.x, _blockPos.z);
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)_player);
if (world.GetTileEntity(chunk.ClrIdx, _blockPos) is TileEntity tileEntity)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !GameManager.IsDedicatedServer)
{
bool isAccessed = false;
foreach (TileEntityOwners tileEntityOwner in RebirthVariables.accessedTileEntities)
{
if (tileEntityOwner.location == _blockPos)
{
isAccessed = true;
break;
}
}
if (!isAccessed)
{
bool isOpen = OpenTileWindow(_player, tileEntity, windowGroup, window, sound);
if (isOpen)
{
TileEntityOwners tileEntityOwner = new TileEntityOwners
{
location = _blockPos,
owner = _player.entityId
};
RebirthVariables.accessedTileEntities.Add(tileEntityOwner);
}
}
else
{
GameManager.ShowTooltip(uiforPlayer.entityPlayer, Localization.Get("ttNoInteractItem"), string.Empty, "ui_denied", null);
}
}
else
{
if (!GameManager.IsDedicatedServer)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageOpenTileEntityRebirth>().Setup(uiforPlayer.entityPlayer.entityId, _blockPos.x, _blockPos.y, _blockPos.z, window, windowGroup, sound), false);
}
}
}
}
/// <summary>
/// Replacement for vanilla function for finding the root transform
/// </summary>
/// <param name="_tag"></param>
/// <param name="_hitTransform"></param>
/// <returns>The transform for the RootTransformRefEntity component</returns>
public static Transform GetHitRootTransform(string _tag, Transform _hitTransform)
{
// if this transform's tag does not begin with 'E_BP_' or the transform == null, just return
if (!_tag.StartsWith("E_BP_") || _hitTransform == null) return _hitTransform;
// if we find a reference to the RootTransformRefEntity class, return the root
if (_hitTransform.gameObject.TryGetComponent<RootTransformRefEntity>(out RootTransformRefEntity rootTx)) return rootTx.RootTransform;
// finally, try searching up the hierarchy for an Entity component
return FindEntityUp(_hitTransform);
}
/// <summary>
/// Searches for an Entity component and will move up the parent hierarchy
/// </summary>
/// <param name="_t"></param>
/// <returns>The transform for the Entity component</returns>
public static Transform FindEntityUp(Transform _t)
{
while (_t != null)
{
if (_t.gameObject.TryGetComponent<Entity>(out _)) return _t;
_t = _t.parent;
}
return null;
}
/// <summary>
/// Checks if the terrain mesh under the position exists and is both generated and displayed
/// </summary>
/// <param name="pos_">Unity world space - Origin.position</param>
/// <returns>true if terrain is fully rendered</returns>
public static bool IsTerrainValid(Vector3 pos_)
{
if (GameManager.Instance.World == null) return false;
var chunk = GameManager.Instance.World.ChunkClusters[0].GetChunkSync(World.toChunkXZ(Utils.Fastfloor(pos_.x)), World.toChunkXZ(Utils.Fastfloor(pos_.z)));
return chunk != null && chunk.IsCollisionMeshGenerated && chunk.IsDisplayed;
}
/// <summary>
/// Get a random body tag name from the dictionary
/// </summary>
/// <returns>string</returns>
public static string GetRandomBodyTag()
{
return RebirthVariables.bodyTags[GameManager.Instance.World.GetGameRandom().RandomRange(0, 11)];
}
public static bool TeLogging = false;
public static void TeLog(string text)
{
if (TeLogging)
{
Log.Out(text);
}
}
public static bool FindEntityOverlap(EntityAlive entity_, Vector3 pos_, int layerMask_, float radius_)
{
var allColliders = Physics.OverlapSphere(pos_, radius_, layerMask_, QueryTriggerInteraction.Ignore);
//Log.Out($"Rebirth layerMask: {layerMask}, allColliders: {allColliders.Length}");
foreach (var c in allColliders)
{
//Log.Out($"Rebirth coll: {c}, layer: {c.gameObject.layer}, tag: {c.tag}, pos: {c.transform.position}, root: {c.transform.root}");
RootTransformRefEntity refEntity = c.gameObject.GetComponent<RootTransformRefEntity>();
if (refEntity != null && refEntity.RootTransform != null)
{
EntityAlive hitEntity = refEntity.RootTransform.GetComponent<EntityAlive>();
if (hitEntity != null)
{
//Log.Out($"Rebirth ref Entity: {hitEntity}");
if (hitEntity == entity_)
{
Voxel.voxelRayHitInfo.bHitValid = true;
Voxel.voxelRayHitInfo.tag = c.transform.tag;
Voxel.voxelRayHitInfo.transform = c.transform;
Voxel.voxelRayHitInfo.hit.pos = c.transform.position + Origin.position;
Voxel.voxelRayHitInfo.hit.distanceSq = ((Voxel.voxelRayHitInfo.hit.pos != Vector3.zero) ? (entity_.getChestPosition() - Voxel.voxelRayHitInfo.hit.pos).sqrMagnitude : float.MaxValue);
Voxel.voxelRayHitInfo.fmcHit = Voxel.voxelRayHitInfo.hit;
//Log.Out($"Rebirth Found Attack Target Body Collider: {Voxel.voxelRayHitInfo.transform}, pos: {Voxel.voxelRayHitInfo.hit.pos}, distanceSq: {Voxel.voxelRayHitInfo.hit.distanceSq}");
return true;
}
}
}
}
return false;
}
}
+3757
View File
@@ -0,0 +1,3757 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using static RebirthVariables;
public enum SpawnType
{
None,
Zombies,
ZombieAnimals,
Bandits,
ApoBandits,
HazardHazmats,
Werewolves
}
public enum MusicControlOption
{
None,
FadeIn,
FadeOut,
}
public enum ExtendedEquipmentSlots
{
Head = 0,
Chest = 1,
Hands = 2,
Feet = 3,
WeatherKit = 4,
Neck = 5,
Wrists = 6,
Hips = 7,
Count = 8,
None = 8
}
public enum RepairableVehicleSlotsEnum
{
None = -1,
Headlight_v1,
CarBattery_1,
MinibikeEngine_1,
MotorcycleEngine_1,
V6Engine_1,
V8Engine_1,
GyroEngine_1,
SparkPlugs_1,
CarStarter_1,
FuelPump_1,
Alternator_1,
Carburetor_1,
CarTransmission_1,
CarRadiator_1,
TruckRadiator_1,
BicycleWheel_1,
MinibikeWheel_1,
MotorcycleWheel_1,
MotorcycleWheel_2,
CarWheel_1,
CarWheel_2,
TruckWheel_1,
TruckWheel_2,
MilitaryTruckWheel_1,
HeavyWheel_1,
GyroWheel_1,
Count
}
public enum WindowTypeEnum
{
None = -1,
EntityVehicle,
BlockRepairableVehicle
}
public class factionStanding
{
public string source;
public string target;
public bool canDamage;
public factionStanding()
{
}
public factionStanding(string _source, string _target, bool _canDamage)
{
this.source = _source;
this.target = _target;
this.canDamage = _canDamage;
}
}
public class VehicleParts
{
public string emptySpriteName;
public string emptyTooltipName;
public string itemName;
public float chance;
public int maxRandomQuality;
public int durabilityPerQuality;
public bool requiredToOperate;
public VehicleParts()
{
}
public VehicleParts(string emptySpriteName, string emptyTooltipName, string itemName, float chance, int maxRandomQuality, int durabilityPerQuality, bool requiredToOperate)
{
this.emptySpriteName = emptySpriteName;
this.emptyTooltipName = emptyTooltipName;
this.itemName = itemName;
this.chance = chance;
this.maxRandomQuality = maxRandomQuality;
this.durabilityPerQuality = durabilityPerQuality;
this.requiredToOperate = requiredToOperate;
}
}
public class TileEntityOwners
{
public int owner;
public Vector3i location = new Vector3i();
public TileEntityOwners()
{
}
public TileEntityOwners(int owner, Vector3i location)
{
this.owner = owner;
this.location = location;
}
}
public class classPerk
{
public string perk;
public List<perkLevels> levels = new List<perkLevels>();
public classPerk()
{
}
public classPerk(string perk, List<perkLevels> levels)
{
this.perk = perk;
this.levels = levels;
}
}
public class perkLevels
{
public int classLevel;
public int perkLevel;
public perkLevels()
{
}
public perkLevels(int classLevel = 0, int perkLevel = 0)
{
this.classLevel = classLevel;
this.perkLevel = perkLevel;
}
}
public class auraData
{
public string progressionName;
public string modName;
public string allyAura;
public string className;
public string targetBuff;
public float chancePerLevel;
public float baseChancePerLevel;
public string playerBuff;
public string targetPlayerBuff;
public bool useTargetBuffLevels;
public bool overrideChance;
public string cooldownBuff;
public float meleeChance;
public string weaponPerkName;
public auraData()
{
}
public auraData(string progressionName, string modName, string allyAura, string className, string targetBuff, float chancePerLevel, float baseChancePerLevel, string playerBuff, string targetPlayerBuff, bool useTargetBuffLevels, bool overrideChance, string cooldownBuff, float meleeChance, string weaponPerkName)
{
this.progressionName = progressionName;
this.modName = modName;
this.allyAura = allyAura;
this.className = className;
this.targetBuff = targetBuff;
this.chancePerLevel = chancePerLevel;
this.baseChancePerLevel = baseChancePerLevel;
this.playerBuff = playerBuff;
this.targetPlayerBuff = targetPlayerBuff;
this.useTargetBuffLevels = useTargetBuffLevels;
this.overrideChance = overrideChance;
this.cooldownBuff = cooldownBuff;
this.meleeChance = meleeChance;
this.weaponPerkName = weaponPerkName;
}
}
public class SleeperGroupRebirth
{
public int entityId = 0;
public int biome = 0;
}
public class HNPGroupRebirth
{
public int entityId = 0;
public int hordeNightChance = 10;
public int gamestageStart = 0;
public int gamestageEnd = 0;
public int entitySpecial = 0;
}
public class RebirthEntityGroup
{
public int min;
public int max;
public List<SleeperGroupRebirth> entities = new List<SleeperGroupRebirth>();
public RebirthEntityGroup()
{
}
public RebirthEntityGroup(int _min, int _max, List<SleeperGroupRebirth> _entities)
{
this.min = _min;
this.max = _max;
this.entities = _entities;
}
}
public class categoryCrafting
{
public string craftingPerk;
public List<craftingLevels> levels = new List<craftingLevels>();
public categoryCrafting()
{
}
public categoryCrafting(string craftingPerk, List<craftingLevels> levels)
{
this.craftingPerk = craftingPerk;
this.levels = levels;
}
}
public class craftingLevels
{
public float categoryLevel = 0f;
public int craftingLevel = 1;
public craftingLevels()
{
}
public craftingLevels(float categoryLevel = 0f, int craftingLevel = 1)
{
this.categoryLevel = categoryLevel;
this.craftingLevel = craftingLevel;
}
}
public class craftingIncrements
{
public float floor = 0f;
public float ceiling = 0f;
public float increment = 0f;
public craftingIncrements()
{
}
public craftingIncrements(float floor = 0f, float ceiling = 0f, float increment = 0f)
{
this.floor = floor;
this.ceiling = ceiling;
this.increment = increment;
}
}
public class classRewards
{
public int classLevel;
public List<classReward> rewards = new List<classReward>();
public classRewards()
{
}
public classRewards(int classLevel, List<classReward> rewards, int numItems = 1, int numQuality = 1, int numLocation = 0)
{
this.classLevel = classLevel;
this.rewards = rewards;
}
}
public class classReward
{
public string itemName;
public int numItems = 1;
public int numQuality = 1;
public int numLocation = 0;
public classReward()
{
}
public classReward(string itemName, int numItems = 1, int numQuality = 1, int numLocation = 0)
{
this.itemName = itemName;
this.numItems = numItems;
this.numQuality = numQuality;
this.numLocation = numLocation;
}
}
public class classMeta
{
public bool isActive;
public classMeta()
{
}
public classMeta(bool isActive)
{
this.isActive = isActive;
}
}
public class SpawnedPrefab
{
public string biome { get; set; }
public int count { get; set; }
public int difficulty { get; set; }
public SpawnedPrefab(string _biome, int _count, int _difficulty)
{
biome = _biome;
count = _count;
difficulty = _difficulty;
}
}
public class PurgeBiome
{
public string biome { get; set; }
public int count { get; set; }
public PurgeBiome(string _biome, int _count)
{
biome = _biome;
count = _count;
}
}
public class DiscoveryTier
{
public int difficulty { get; set; }
public int count { get; set; }
public DiscoveryTier(int _difficulty, int _count)
{
difficulty = _difficulty;
count = _count;
}
}
public class RebirthVariables
{
public static System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
public static string utilsPath = "";
public static XDocument ignorePrefabs;
public static bool disableFogOnFlight = true;
public static float takeDelay = 0.1f;
public static bool activateHiveDayCycle = false;
public static bool testPurge = false;
public static bool testPurge2 = false;
public static bool testPurgeDiscovery = false;
public static bool testPurgeSupplyDrops = false;
public static bool testRebirth = false;
public static bool testAuras = false;
public static bool testEvents = false;
public static int testEventsCategory = 0;
public static int testEventsType = 0;
public static int testEventsPlayerLevel = 0;
public static int testEventsClassLevel = 0;
public static bool testDismember = false;
public static bool testCropGrowth = false;
public static bool testVehicleRespawns = false;
public static bool testChickenCoops = false;
public static int testChickenCoopsRate = 10;
public static bool testHordeNightDay = false;
public static bool testVerifyFaction = false;
public static float hordeNightXPMultiplier = 0.1f;
public static float hiveLootbagDrop = 0.1f;
/*public static List<BlockChangeInfo> blockChanges = new List<BlockChangeInfo>();
public static List<BlockChangeInfo> pendingBlockChanges = new List<BlockChangeInfo>();
public static bool updatingBlocks = false;
public static readonly object lockObject = new object();*/
public static ChunkManager.ChunkObserver chunkObserver = null;
public static string NPCName = "";
/*public static List<string> hivePrefab = new List<string> {
"hive_start_bunker",
"hive_start_cabin"
};*/
public static List<string> hivePrefab = new List<string> {
"hive_start_bunker"
};
public static bool noHit = false;
public static float noHitCheck = 0f;
public static float noHitTick = 10f;
public static float navObjectCheck = 0f;
public static int waypointIconHeight = 42;
public static int waypointIconWidth = 42;
public static int waypointIconRows = 9;
public static int waypointIconColumns = 7;
public static float randomWeaponUpdateCheck = 0f;
public static float randomWeaponUpdateTick = 2400f;
public static bool randomWeaponInitiated = false;
public static bool refreshRandomWeapons = false;
public static float purgeZombieCheck = 0f;
public static float purgeZombieTick = 3f;
public static float repairWidth = 100f;
public static float repairHeight = 30f;
public static int maxGamestage = 590;
public static int HNMultiplier = 3;
public static int HNPMultiplier = 1;
public static bool createdWorld = false;
public enum WeaponType
{
Melee = 0,
Ranged = 1
}
public class RandomWeapon
{
public ItemValue Weapon { get; set; }
public WeaponType Type { get; set; }
public RandomWeapon(ItemValue weapon, WeaponType type)
{
Weapon = weapon;
Type = type;
}
}
public static List<RandomWeapon> randomWeapons = new List<RandomWeapon>();
public static bool activatingSleeperVolumes = false;
public static bool checkSleeperVolumes = false;
public static int currentSleeperEntityCount = 0;
public static int currentSleeperVolumeCount = 0;
public static float currentSleeperVolumePerc = 0f;
public static int maxSleeperVolumeCount = 0;
public static int clearedSleeperVolumeCount = 0;
public static int totalSleeperVolumeCount = 0;
public static string currentPrefab = "";
public static int currentPOITier = 0;
public static bool purgeDisplay = false;
public static bool purgePrefabCount = false;
public static string purgePrefabName = "";
public static Vector3 purgePrefabPosition = Vector3.zero;
public static bool purgePrefabsLoaded = false;
public static int purgeAirDropNumKills = 75;
public static int purgeAirDropNumKillsIncrement = 5;
public static int purgeAirDropNumKillsMax = 150;
public static float purgeDisplayPercentage = 0;
public static string purgeLabel = "";
public static float purgeBiomeThreshold = 75f;
public static List<Vector3> playerAirDrops = new List<Vector3>();
public static Dictionary<int, Tuple<float, float>> discoveryUnlocks = new Dictionary<int, Tuple<float, float>>
{
{ 0, Tuple.Create(15f, 25f) },
{ 1, Tuple.Create(25f, 35f) },
{ 2, Tuple.Create(35f, 45f) },
{ 3, Tuple.Create(45f, 55f) },
{ 4, Tuple.Create(55f, 65f) },
{ 5, Tuple.Create(65f, purgeBiomeThreshold) },
{ 6, Tuple.Create(purgeBiomeThreshold, 100f) }
};
public static List<SpawnedPrefab> trackedPrefabs = new List<SpawnedPrefab>();
public static List<PurgeBiome> purgeBiomes = new List<PurgeBiome>();
public static int displayGamestage = 0;
public static string displayGamestageLabel = "";
public static string navIconBossEventNoHealthNPC = "boss_event_npc";
public static string navIconBossEventNPC = "twitch_vote_boss";
public static string navIconBossEventNoHealth = "boss_event";
public static string navIconBossEvent = "twitch_vote_boss";
public static string navIconSupportEventNoHealth = "support_event";
public static string navIconSupportEvent = "twitch_vote_support";
public static List<Vector3i> traderDoors = new List<Vector3i>();
public static int quickStackDistance = 50;
public static float broadcastDistance = 150f;
//public static bool forceNoHit = false;
public static int gameStage = 0;
public static int wanderingHordeGameStage = 0;
public static int biomeGameStage = 0;
public static int biomeStandingOn = 0;
public static int playerLevel = 1;
public static int supplyCrateOpenTime = 20;
public static int damageGiven = 0;
public static float herdStartTime = 0f;
public static float herdDuration = 0f;
public static bool isHerd = false;
public static bool forceHerd = false;
public static bool isWHSpawned = false;
public static bool stopWHSpawns = false;
public static int spawnThresholdFeral = 100;
public static int spawnThresholdRadiated = 220;
public static int spawnThresholdTainted = 340;
public static float currentVolume = 0f;
public static AudioSource audioSource;
public static MusicControlOption controlOption = MusicControlOption.FadeIn;
public static float secondsToFadeOut = 3f;
public static float secondsToFadeIn = 3f;
public static int geneticsBlueprintToDNABoostRatio = 25;
public static float meleeExpertiseMultiplier = 1.25f;
public static Dictionary<int, string> biomes = new Dictionary<int, string>
{
{ 0, "pine_forest" },
{ 1, "desert" },
{ 2, "snow" },
{ 3, "wasteland" },
{ 4, "burnt_forest" }
};
public static Dictionary<string, int> factions;
public static Dictionary<string, float> localVariables;
public static Dictionary<string, float> localConstants;
public static Dictionary<string, int> localGenetics;
public static Dictionary<string, float> localClasses;
public static Dictionary<string, classMeta> localClassMeta;
public static Dictionary<string, int> localClassProgressionMax;
public static Dictionary<string, int> localExpertise;
public static Dictionary<string, string> localExpertiseClass;
public static Dictionary<string, string> localExpertiseLevelWithClass;
public static Dictionary<string, int> localExpertiseTier;
public static Dictionary<string, List<classPerk>> localClassPerk;
public static Dictionary<string, List<classRewards>> localClassRewards;
public static Dictionary<string, List<categoryCrafting>> localGeneticsCrafting;
public static Dictionary<string, List<categoryCrafting>> localExpertiseCrafting;
public static Dictionary<string, List<categoryCrafting>> localOtherCrafting;
public static Dictionary<string, List<craftingIncrements>> localCraftingIncrements;
public static Dictionary<string, auraData> localAuras;
public static Dictionary<string, float> localAuraChances;
public static List<string> weaponAura = new List<string>
{
"ArrowRain",
"RangedStun",
"RangedBleed",
"RangedDoubleDamage",
"RangedShock",
"RangedExplosion",
"RangedDismember",
"RangedSlashes"
};
public static Dictionary<string, string> npcWeaponCategories;
public static Dictionary<int, string> bodyTags;
public static Dictionary<RepairableVehicleSlotsEnum, VehicleParts> localVehicleParts;
public static Dictionary<string, List<RepairableVehicleSlotsEnum>> localVehicleTypes;
public static List<TileEntityOwners> accessedTileEntities = new List<TileEntityOwners>();
public static List<factionStanding> factionStandings = new List<factionStanding>();
public static List<string> commonParticles = new List<string>();
public static bool wasHordeNight = false;
public static int DayLightLength = 0;
public static int wanderingHordeCount = 0;
public static int wanderingHordeSize = 7;
public static int maxWanderingHordeMultiplier = 6;
public static int maxWanderingHordeFrequency = 4;
public static int wanderingHordeMultiplier = 1;
public static int wanderingHordeFrequency = 1;
public static AudioClip[] audioClip;
public static bool audioClipLoaded = false;
public static int musicMode = -1;
public static bool walkman = false;
public static float musicVolume = 0.2f;
public static int songIndex = -1;
public static int autoRun = 0;
public static int prefabDifficulty = 1;
public static bool loadingEntityGroups = false;
public static float playerLevelGamestageMultiplier = 2f;
public static float hordeNightCheck = 0f;
public static float auraCheck = 0f;
public static float variablesCheck = 0f;
public static float biomeCheck = 0f;
public static float forestCheck = 0f;
public static float desertCheck = 0f;
public static float snowCheck = 0f;
public static float wastelandCheck = 0f;
public static float screamerCheck = 0f;
public static float companionsCheck = 0f;
public static float hiresCheck = 0f;
public static float berserkerCheck = 0f;
public static float menuBackgroundCheck = 0f;
public static float s3Check = 0f;
public static float craftingCheck = 0f;
public static float walkmanCheck = 0f;
public static float modelLayerCheck = 0f;
public static float scenarioCheck = 0f;
public static float purgeProgressCheck = 0f;
public static float gamestageCheck = 0;
public static bool logModelLayerCheck = false;
public static float cycleArea1 = 0f;
public static string holdingItem = "";
public static int holdingItemQuality = 0;
public static string holdingItemIcon = "";
public static string holdingItemColor = "";
public static string holdingItemCraftIcon = "";
public static float holdingItemPerc = 0f;
public static bool isCraftableItem = false;
public static bool loaded = false;
public static bool inForest = false;
public static bool inDesert = false;
public static bool inSnow = false;
public static bool inWasteland = false;
public static bool inBurntForest = false;
public static string currentBiome = "";
public static bool canAuraTrigger = true;
public static bool canShotgunTrigger = true;
public static bool isHordeNight = false;
public static int talkingToNPC = 0;
public static float supplyCrateHostileSpawnDistance = 10f;
public static bool skipSupplyDrops = false;
public static bool skipHordeNight = false;
public static string customScenario = "none";
public static bool customSkipSpawnConfirmation = true;
public static string customBiomeSpawn = "forest";
public static string customJumpstart = "none";
public static bool customProtectTraderArea = true;
public static bool customLootTraderArea = false;
public static string customTornados = "hordenightonly";
public static string customTornadosMultiplier = "100";
public static int customDistanceHunting = 30;
public static int customDistanceFullControl = 10;
public static bool customRepeatPOI = true;
public static int customMaxJobs = 5;
public static bool customShareParty = true;
public static int customJobsToNextTier = 10;
public static int customMaxSamePOI = 1;
public static string customInfested = "default";
public static bool customCustomQuests = false; // true
public static bool customFeelingLucky = true;
public static bool customOverrideOpacity = true;
public static bool customConsolePopUp = true;
public static bool customCrosshairHUD = true;
public static string customPartyXPMultiplier = "0";
public static string customClassXPMultiplier = "100";
public static string customGeneticsXPMultiplier = "100";
public static string customAuraRange = "partyrange";
public static string customVehicleDensityMultiplier = "200";
public static int customVehicleRespawn = 7;
public static bool customVehiclePickUp = true;
public static bool customVehicleSecurity = true;
public static bool customRestrictiveHealing = true;
public static bool customRespawnPenalty = true;
public static string customRestrictHires = "default";
public static string customRestrictCompanionHires = "default";
public static string customCompanionInventory = "always";
public static string customQualityOfLife = "default";
public static bool customShiftToolbelt = true;
public static bool customRunToggle = false;
public static bool customPathSmoothing = true;
public static string customGore = "bloodsplatter";
public static string customTargetBarVisibility = "default";
public static bool customInstaLoot = true;
public static bool customLockPick = true;
public static bool customFireManager = false;
public static bool customProtectCrate = true;
public static bool customHeadshot = true;
public static bool customScreenShake = true;
public static bool customRebirthWeather = true;
public static string customWeatherFog = "default";
public static bool customDarkerNights = false;
public static string customTreeDensityMultiplier = "300";
public static bool customReplantTrees = false;
public static bool customAdvancedFarming = false;
public static int customAdvancedFarmingTime = 90;
public static bool customEventsNight = true;
public static string customEventRestrictions = "notquesting";
public static string customEventsFrequency = "100";
public static string customEventsDifficulty = "normal";
public static bool customEventsZombieAnimals = true;
public static bool customEventsBandits = true;
public static bool customEventsNotification = true;
public static bool customEventsLoot = true;
public static string customScreamerNights = "lower";
public static int customScreamerMax = 5;
public static bool customAscension = true;
public static bool customRebirth = true;
public static string customNaturalSelection = "nohordenight";
public static string customHordeNightXPMultiplier = "25";
public static string customHordeNightLootDropMultiplier = "70";
public static string customScreamerSignalXPMultiplier = "50";
public static bool customHordeNight = true;
public static string customGamestageMultiplier = "100";
public static string customPOIRisk = "default";
public static string customDelayNPCSpawns = "gs10";
public static string customBanditSpawnMultiplier = "100";
public static string customSurvivorSpawnMultiplier = "100";
public static string customRangedNPCAccuracyModifier = "100";
public static bool customHordeNightTurbo = true;
public static string customZombieParticles = "on";
public static string customNumZombieSpawns = "default";
public static string customFreqZombieSpawns = "default";
public static string customMutatedSpawns = "afterday14";
public static string customKamikaze = "notpoi";
public static string customDemos = "nothordenight";
public static string customSeekers = "always";
public static bool customZombieBuffers = true;
public static bool customKnockdowns = true;
public static string customEntityEvents = "always";
public static bool customXRayDetection = true;
public static string customFeralSense = "never";
public static string customPOISense = "never";
public static string customAuraDefense = "cooldown";
public static string customWanderingHordeFrequency = "random";
public static string customWanderingHordeSizeMultiplier = "random";
public static string customWanderingHordeHerdProb = "30";
public static string customWanderingHordeHerdHN = "50";
public static int customWanderingHordeHerdDur = 3;
public static string customWanderingHordeHerdRestriction = "medium";
public static void loadCommonParticles()
{
commonParticles.Add("Orb_Fire");
commonParticles.Add("Orb_Lightning");
commonParticles.Add("Orb_Radiation");
commonParticles.Add("Orb_BlockDamage");
commonParticles.Add("Orb_Explosion");
commonParticles.Add("p_onFire");
commonParticles.Add("p_electric_shock");
commonParticles.Add("burntZombieSmoke");
commonParticles.Add("p_burning_barrel");
}
public static void LoadFactionStandings()
{
factions["trader"] = 1;
factions["whiteriver"] = 2;
factions["undead"] = 3;
factions["undead2"] = 4;
factions["zombieanimals"] = 5;
factions["passiveanimalssmall"] = 6;
factions["passiveanimalsmedium"] = 7;
factions["passiveanimalslarge"] = 8;
factions["aggressiveanimalssmall"] = 9;
factions["aggressiveanimalsmedium"] = 10;
factions["aggressiveanimalslarge"] = 11;
factions["vehicles"] = 12;
factions["turrets"] = 13;
factions["bandits"] = 14;
factions["decoys"] = 15;
// only set up exceptions for factions who should not attack other factions
factionStandings.Clear();
factionStandings.Add(new factionStanding("undead", "zombieanimals", false));
factionStandings.Add(new factionStanding("undead", "undead2", false));
factionStandings.Add(new factionStanding("undead", "trader", false));
factionStandings.Add(new factionStanding("undead", "vehicles", true));
factionStandings.Add(new factionStanding("undead", "turrets", true));
factionStandings.Add(new factionStanding("undead2", "undead", false));
factionStandings.Add(new factionStanding("undead2", "zombieanimals", false));
factionStandings.Add(new factionStanding("undead2", "trader", false));
factionStandings.Add(new factionStanding("undead2", "turrets", true));
factionStandings.Add(new factionStanding("zombieanimals", "undead", false));
factionStandings.Add(new factionStanding("zombieanimals", "undead2", false));
factionStandings.Add(new factionStanding("zombieanimals", "trader", false));
factionStandings.Add(new factionStanding("zombieanimals", "vehicles", true));
factionStandings.Add(new factionStanding("zombieanimals", "turrets", true));
factionStandings.Add(new factionStanding("whiteriver", "trader", false));
factionStandings.Add(new factionStanding("whiteriver", "passiveanimalssmall", true));
factionStandings.Add(new factionStanding("whiteriver", "passiveanimalsmedium", true));
factionStandings.Add(new factionStanding("whiteriver", "passiveanimalslarge", true));
factionStandings.Add(new factionStanding("whiteriver", "vehicles", false));
factionStandings.Add(new factionStanding("whiteriver", "turrets", false));
factionStandings.Add(new factionStanding("whiteriver", "decoys", true));
factionStandings.Add(new factionStanding("bandits", "trader", false));
factionStandings.Add(new factionStanding("bandits", "passiveanimalssmall", true));
factionStandings.Add(new factionStanding("bandits", "passiveanimalsmedium", true));
factionStandings.Add(new factionStanding("bandits", "passiveanimalslarge", true));
factionStandings.Add(new factionStanding("bandits", "vehicles", false));
factionStandings.Add(new factionStanding("bandits", "turrets", true));
factionStandings.Add(new factionStanding("aggressiveanimalslarge", "trader", false));
factionStandings.Add(new factionStanding("aggressiveanimalslarge", "passiveanimalssmall", true));
factionStandings.Add(new factionStanding("aggressiveanimalslarge", "passiveanimalsmedium", true));
factionStandings.Add(new factionStanding("aggressiveanimalslarge", "aggressiveanimalssmall", true));
factionStandings.Add(new factionStanding("aggressiveanimalslarge", "aggressiveanimalsmedium", true));
factionStandings.Add(new factionStanding("aggressiveanimalslarge", "vehicles", true));
factionStandings.Add(new factionStanding("aggressiveanimalslarge", "turrets", true));
factionStandings.Add(new factionStanding("aggressiveanimalsmedium", "trader", false));
factionStandings.Add(new factionStanding("aggressiveanimalsmedium", "passiveanimalssmall", true));
factionStandings.Add(new factionStanding("aggressiveanimalsmedium", "passiveanimalslarge", true));
factionStandings.Add(new factionStanding("aggressiveanimalsmedium", "aggressiveanimalssmall", true));
factionStandings.Add(new factionStanding("aggressiveanimalsmedium", "aggressiveanimalslarge", true));
factionStandings.Add(new factionStanding("aggressiveanimalsmedium", "vehicles", true));
factionStandings.Add(new factionStanding("aggressiveanimalsmedium", "turrets", true));
factionStandings.Add(new factionStanding("aggressiveanimalssmall", "trader", false));
factionStandings.Add(new factionStanding("aggressiveanimalssmall", "passiveanimalsmedium", true));
factionStandings.Add(new factionStanding("aggressiveanimalssmall", "passiveanimalslarge", true));
factionStandings.Add(new factionStanding("aggressiveanimalssmall", "aggressiveanimalsmedium", true));
factionStandings.Add(new factionStanding("aggressiveanimalssmall", "aggressiveanimalslarge", true));
factionStandings.Add(new factionStanding("aggressiveanimalssmall", "vehicles", true));
factionStandings.Add(new factionStanding("aggressiveanimalssmall", "turrets", true));
factionStandings.Add(new factionStanding("passiveanimalssmall", "*", true));
factionStandings.Add(new factionStanding("passiveanimalsmedium", "*", true));
factionStandings.Add(new factionStanding("passiveanimalslarge", "*", true));
factionStandings.Add(new factionStanding("turrets", "trader", false));
factionStandings.Add(new factionStanding("turrets", "whiteriver", false));
factionStandings.Add(new factionStanding("turrets", "vehicles", false));
//Log.Out("LoadFactionStandings factionStandings.Count: " + factionStandings.Count);
}
public static void setConfigVariables()
{
//Log.Out("==========================================================================");
//Log.Out("RebirthVariables-setConfigVariables START");
//Log.Out("==========================================================================");
customScenario = CustomGameOptions.GetString("CustomScenario");
customSkipSpawnConfirmation = CustomGameOptions.GetBool("CustomSkipSpawnConfirmation");
customBiomeSpawn = CustomGameOptions.GetString("CustomBiomeSpawn");
customJumpstart = CustomGameOptions.GetString("CustomJumpstart");
customProtectTraderArea = CustomGameOptions.GetBool("CustomProtectTraderArea");
customLootTraderArea = CustomGameOptions.GetBool("CustomLootTraderArea");
customTornados = CustomGameOptions.GetString("CustomTornados");
customTornadosMultiplier = CustomGameOptions.GetString("CustomTornadosMultiplier").Trim().Replace("%", "");
customDistanceHunting = CustomGameOptions.GetInt("CustomDistanceHunting");
customDistanceFullControl = CustomGameOptions.GetInt("CustomDistanceFullControl");
customRepeatPOI = CustomGameOptions.GetBool("CustomRepeatPOI");
customMaxJobs = CustomGameOptions.GetInt("CustomMaxJobs");
customShareParty = CustomGameOptions.GetBool("CustomShareParty");
customJobsToNextTier = CustomGameOptions.GetInt("CustomJobsToNextTier");
customMaxSamePOI = CustomGameOptions.GetInt("CustomMaxSamePOI");
customInfested = CustomGameOptions.GetString("CustomInfested");
//customCustomQuests = CustomGameOptions.GetBool("CustomCustomQuests");
customFeelingLucky = CustomGameOptions.GetBool("CustomFeelingLucky");
customOverrideOpacity = CustomGameOptions.GetBool("CustomOverrideOpacity");
customConsolePopUp = CustomGameOptions.GetBool("CustomConsolePopUp");
customCrosshairHUD = CustomGameOptions.GetBool("CustomCrosshairHUD");
customPartyXPMultiplier = CustomGameOptions.GetString("CustomPartyXPMultiplier").Trim().Replace("%", "");
customClassXPMultiplier = CustomGameOptions.GetString("CustomClassXPMultiplier").Trim().Replace("%", "");
customGeneticsXPMultiplier = CustomGameOptions.GetString("CustomGeneticsXPMultiplier").Trim().Replace("%", "");
customAuraRange = CustomGameOptions.GetString("CustomAuraRange");
customVehicleDensityMultiplier = CustomGameOptions.GetString("CustomVehicleDensityMultiplier").Trim().Replace("%", "");
customVehicleRespawn = CustomGameOptions.GetInt("CustomVehicleRespawn");
customVehiclePickUp = CustomGameOptions.GetBool("CustomVehiclePickUp");
customVehicleSecurity = CustomGameOptions.GetBool("CustomVehicleSecurity");
customRestrictiveHealing = CustomGameOptions.GetBool("CustomRestrictiveHealing");
customRespawnPenalty = CustomGameOptions.GetBool("CustomRespawnPenalty");
customRestrictHires = CustomGameOptions.GetString("CustomRestrictHires");
customRestrictCompanionHires = CustomGameOptions.GetString("CustomRestrictHires");
customCompanionInventory = CustomGameOptions.GetString("CustomCompanionInventory");
customQualityOfLife = CustomGameOptions.GetString("CustomQualityOfLife");
customShiftToolbelt = CustomGameOptions.GetBool("CustomShiftToolbelt");
customRunToggle = CustomGameOptions.GetBool("CustomRunToggle");
customPathSmoothing = CustomGameOptions.GetBool("CustomPathSmoothing");
customTargetBarVisibility = CustomGameOptions.GetString("CustomTargetBarVisibility");
customInstaLoot = CustomGameOptions.GetBool("CustomInstaLoot");
customLockPick = CustomGameOptions.GetBool("CustomLockPick");
customFireManager = CustomGameOptions.GetBool("CustomFireManager");
customProtectCrate = CustomGameOptions.GetBool("CustomProtectCrate");
customHeadshot = CustomGameOptions.GetBool("CustomHeadshot");
customScreenShake = CustomGameOptions.GetBool("CustomScreenShake");
customRebirthWeather = CustomGameOptions.GetBool("CustomRebirthWeather");
customWeatherFog = CustomGameOptions.GetString("CustomWeatherFog");
customDarkerNights = CustomGameOptions.GetBool("CustomDarkerNights");
customTreeDensityMultiplier = CustomGameOptions.GetString("CustomTreeDensityMultiplier").Trim().Replace("%", "");
customReplantTrees = CustomGameOptions.GetBool("CustomReplantTrees");
customAdvancedFarming = CustomGameOptions.GetBool("CustomAdvancedFarming");
customAdvancedFarmingTime = CustomGameOptions.GetInt("CustomAdvancedFarmingTime");
customEventsNight = CustomGameOptions.GetBool("CustomEventsNight");
customEventRestrictions = CustomGameOptions.GetString("CustomEventRestrictions");
customEventsFrequency = CustomGameOptions.GetString("CustomEventsFrequency").Trim().Replace("%", "");
customEventsDifficulty = CustomGameOptions.GetString("CustomEventsDifficulty");
customEventsZombieAnimals = CustomGameOptions.GetBool("CustomEventsZombieAnimals");
customEventsNotification = CustomGameOptions.GetBool("CustomEventsNotification");
customEventsLoot = CustomGameOptions.GetBool("CustomEventsLoot");
customEventsBandits = CustomGameOptions.GetBool("CustomEventsBandits");
customScreamerNights = CustomGameOptions.GetString("CustomScreamerNights");
customScreamerMax = CustomGameOptions.GetInt("CustomScreamerMax");
customAscension = CustomGameOptions.GetBool("CustomAscension");
customRebirth = CustomGameOptions.GetBool("CustomRebirth");
customNaturalSelection = CustomGameOptions.GetString("CustomNaturalSelection");
customHordeNightXPMultiplier = CustomGameOptions.GetString("CustomHordeNightXPMultiplier").Trim().Replace("%", "");
customHordeNightLootDropMultiplier = CustomGameOptions.GetString("CustomHordeNightLootDropMultiplier").Trim().Replace("%", "");
customScreamerSignalXPMultiplier = CustomGameOptions.GetString("CustomScreamerSignalXPMultiplier").Trim().Replace("%", "");
customHordeNight = CustomGameOptions.GetBool("CustomHordeNight");
customGamestageMultiplier = CustomGameOptions.GetString("CustomGamestageMultiplier").Trim().Replace("%", "");
customPOIRisk = CustomGameOptions.GetString("CustomPOIRisk");
customHordeNightTurbo = CustomGameOptions.GetBool("CustomHordeNightTurbo");
customZombieParticles = CustomGameOptions.GetString("CustomZombieParticles");
customNumZombieSpawns = CustomGameOptions.GetString("CustomNumZombieSpawns");
customFreqZombieSpawns = CustomGameOptions.GetString("CustomFreqZombieSpawns");
customDelayNPCSpawns = CustomGameOptions.GetString("CustomDelayNPCSpawns");
customBanditSpawnMultiplier = CustomGameOptions.GetString("CustomBanditSpawnMultiplier").Trim().Replace("%", "");
customSurvivorSpawnMultiplier = CustomGameOptions.GetString("CustomSurvivorSpawnMultiplier").Trim().Replace("%", "");
customRangedNPCAccuracyModifier = CustomGameOptions.GetString("CustomRangedNPCAccuracyModifier").Trim().Replace("%", "");
customMutatedSpawns = CustomGameOptions.GetString("CustomMutatedSpawns");
customKamikaze = CustomGameOptions.GetString("CustomKamikaze");
customDemos = CustomGameOptions.GetString("CustomDemos");
customSeekers = CustomGameOptions.GetString("CustomSeekers");
customZombieBuffers = CustomGameOptions.GetBool("CustomZombieBuffers");
customKnockdowns = CustomGameOptions.GetBool("CustomKnockdowns");
customEntityEvents = CustomGameOptions.GetString("CustomEntityEvents");
customXRayDetection = CustomGameOptions.GetBool("CustomXRayDetection");
customFeralSense = CustomGameOptions.GetString("CustomFeralSense");
customPOISense = CustomGameOptions.GetString("CustomPOISense");
customAuraDefense = CustomGameOptions.GetString("CustomAuraDefense");
customWanderingHordeFrequency = CustomGameOptions.GetString("CustomWanderingHordeFrequency");
customWanderingHordeSizeMultiplier = CustomGameOptions.GetString("CustomWanderingHordeSizeMultiplier");
customWanderingHordeHerdProb = CustomGameOptions.GetString("CustomWanderingHordeHerdProb").Trim().Replace("%", "");
customWanderingHordeHerdDur = CustomGameOptions.GetInt("CustomWanderingHordeHerdDuration");
customWanderingHordeHerdRestriction = CustomGameOptions.GetString("CustomWanderingHordeHerdRestriction");
customWanderingHordeHerdHN = CustomGameOptions.GetString("CustomWanderingHordeHerdHN").Trim().Replace("%", "");
if (customScenario == "hive")
{
// No supply drops
skipSupplyDrops = true;
// Set Jumpstart
customJumpstart = "none";
CustomGameOptions.SetValue("CustomJumpstart", "none");
// Surprise Jobs
customInfested = "hidesurprise";
CustomGameOptions.SetValue("CustomInfested", "hidesurprise");
// Number of Jobs to the Next Tier
customJobsToNextTier = 15;
CustomGameOptions.SetValue("CustomJobsToNextTier", "15");
// POI Sense (Never - too much of a FPS hit for large POIs)
customPOISense = "never";
CustomGameOptions.SetValue("CustomPOISense", "never");
// Pitch Black
customDarkerNights = true;
CustomGameOptions.SetValue("CustomDarkerNights", "true");
// No tornados
customTornados = "never";
CustomGameOptions.SetValue("CustomTornados", "never");
// No Survivors
customBanditSpawnMultiplier = "0";
CustomGameOptions.SetValue("CustomBanditSpawnMultiplier", "0");
// No Bandits
customSurvivorSpawnMultiplier = "0";
CustomGameOptions.SetValue("CustomSurvivorSpawnMultiplier", "0");
}
else if (customScenario == "purge")
{
if (testPurgeSupplyDrops)
{
purgeAirDropNumKills = 5;
}
// No supply drops
skipSupplyDrops = true;
// No Horde Night
skipHordeNight = true;
// Span in the forest biome, next to the trader
customBiomeSpawn = "random";
CustomGameOptions.SetValue("CustomBiomeSpawn", "random");
// Set Jumpstart
customJumpstart = "none";
CustomGameOptions.SetValue("CustomJumpstart", "none");
// No starter dog
customRestrictHires = "nofollowers";
CustomGameOptions.SetValue("CustomRestrictHires", "nofollowers");
// No zombie spawns in biomes
customNumZombieSpawns = "none";
CustomGameOptions.SetValue("CustomNumZombieSpawns", "none");
// No jobs at the trader
customMaxJobs = 0;
CustomGameOptions.SetValue("CustomMaxJobs", "0");
// No trader protection
customProtectTraderArea = false;
CustomGameOptions.SetValue("CustomProtectTraderArea", "false");
// POI risk is High
customPOIRisk = "high";
CustomGameOptions.SetValue("CustomPOIRisk", "high");
// POI Sense (Never - too much of a FPS hit for large POIs)
customPOISense = "never";
CustomGameOptions.SetValue("CustomPOISense", "never");
// Pitch Black
customDarkerNights = true;
CustomGameOptions.SetValue("CustomDarkerNights", "true");
// No bandit spawns
customBanditSpawnMultiplier = "0";
CustomGameOptions.SetValue("CustomBanditSpawnMultiplier", "0");
// No survivor spawns
customSurvivorSpawnMultiplier = "0";
CustomGameOptions.SetValue("CustomSurvivorSpawnMultiplier", "0");
// No Outbreaks
customWanderingHordeHerdProb = "0";
CustomGameOptions.SetValue("CustomWanderingHordeHerdProb", "0");
// No tornados
customTornados = "never";
CustomGameOptions.SetValue("CustomTornados", "never");
}
RebirthUtilities.CheckExternalOptions();
}
public static void LoadCustomParticles()
{
/* remove?
string ModPath = "#@modfolder(BloodSpillEffect):Resources/";
string Package = "BloodSpill.unity3d?";
string particleName = "Blood_spill";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
for (int i = 1; i < 100; i++)
{
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName + " " + i);
}
particleName = "Blood_spill_M";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
for (int i = 1; i < 100; i++)
{
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName + " " + i);
}
particleName = "Blood_spill_DH";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
particleName = "Blood_spill_D";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
particleName = "Blood_spill_D 1";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
particleName = "Blood_spill_DHM";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
particleName = "Blood_spill_DM";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
particleName = "Blood_spill_DM 1";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);
particleName = "Blood_spill_E";
RebirthUtilities.LoadParticleAsset(ModPath + Package + particleName);*/
}
public static void RefreshVariables(EntityPlayerLocal ___entityPlayerLocal)
{
if (RebirthUtilities.ScenarioSkip())
{
return;
}
float classID = ___entityPlayerLocal.Buffs.GetCustomVar("$ActiveClass_FR");
string playerClass = RebirthUtilities.GetClassNameFromID(classID);
//Log.Out("RebirthVariables-RefreshVariables classID: " + classID);
localConstants["$varFuriousRamsayPerk1PercUnit"] = 0f;
localConstants["$varFuriousRamsayPerk2PercUnit"] = 0f;
localConstants["$varFuriousRamsayPerk3PercUnit"] = 0f;
foreach (var key in RebirthVariables.localExpertiseCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localExpertiseCrafting[key];
//Log.Out("RebirthVariables-RefreshVariables key: " + key);
foreach (var craftingList in CategoryCraftingList)
{
float perkValue = ___entityPlayerLocal.Buffs.GetCustomVar("$varFuriousRamsay" + key + "PercUnit");
int currentLevel = ___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk).Level;
int actualLevel = RebirthUtilities.GetActualCraftingPerksCategoryValue(craftingList.craftingPerk, perkValue);
//Log.Out("RebirthVariables-RefreshVariables perkValue: " + perkValue);
//Log.Out("RebirthVariables-RefreshVariables currentLevel: " + currentLevel);
//Log.Out("RebirthVariables-RefreshVariables actualLevel: " + actualLevel);
if (currentLevel < actualLevel)
{
//Log.Out("RebirthVariables-RefreshVariables " + key + ": " + perkValue);
//Log.Out("RebirthVariables-RefreshVariables " + craftingList.craftingPerk + ": " + currentLevel);
___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk).Level = actualLevel;
//Log.Out("RebirthVariables-RefreshVariables actualLevel: " + actualLevel);
}
break;
}
}
foreach (var key in RebirthVariables.localOtherCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localOtherCrafting[key];
//Log.Out("RebirthVariables-RefreshVariables key: " + key);
foreach (var craftingList in CategoryCraftingList)
{
float perkValue = ___entityPlayerLocal.Buffs.GetCustomVar("$varFuriousRamsay" + key + "PercUnit");
int currentLevel = ___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk).Level;
int actualLevel = RebirthUtilities.GetActualCraftingOtherCategoryValue(craftingList.craftingPerk, perkValue);
//Log.Out("RebirthVariables-RefreshVariables perkValue: " + perkValue);
//Log.Out("RebirthVariables-RefreshVariables currentLevel: " + currentLevel);
//Log.Out("RebirthVariables-RefreshVariables actualLevel: " + actualLevel);
if (currentLevel < actualLevel)
{
//Log.Out("RebirthVariables-RefreshVariables " + key + ": " + perkValue);
//Log.Out("RebirthVariables-RefreshVariables " + craftingList.craftingPerk + ": " + currentLevel);
___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk).Level = actualLevel;
//Log.Out("RebirthVariables-RefreshVariables actualLevel: " + actualLevel);
}
break;
}
}
foreach (var key in RebirthVariables.localGeneticsCrafting.Keys)
{
List<categoryCrafting> CategoryCraftingList = RebirthVariables.localGeneticsCrafting[key];
//Log.Out("RebirthVariables-RefreshVariables key: " + key);
foreach (var craftingList in CategoryCraftingList)
{
float perkValue = ___entityPlayerLocal.Buffs.GetCustomVar("$varFuriousRamsay" + key + "PercUnit");
int currentLevel = ___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk).Level;
int actualLevel = RebirthUtilities.GetActualCraftingGeneticsCategoryValue(craftingList.craftingPerk, perkValue);
//Log.Out("RebirthVariables-RefreshVariables perkValue: " + perkValue);
//Log.Out("RebirthVariables-RefreshVariables currentLevel: " + currentLevel);
//Log.Out("RebirthVariables-RefreshVariables actualLevel: " + actualLevel);
if (currentLevel < actualLevel)
{
//Log.Out("RebirthVariables-RefreshVariables " + key + ": " + perkValue);
//Log.Out("RebirthVariables-RefreshVariables " + craftingList.craftingPerk + ": " + currentLevel);
___entityPlayerLocal.Progression.GetProgressionValue(craftingList.craftingPerk).Level = actualLevel;
//Log.Out("RebirthVariables-RefreshVariables actualLevel: " + actualLevel);
}
break;
}
}
/*foreach (string key in ___entityPlayerLocal.Buffs.CVars.Keys)
{
if (key.Contains("$"))
{
Log.Out("RebirthVariables-RefreshVariables " + key + ": " + ___entityPlayerLocal.Buffs.GetCustomVar(key));
}
}*/
foreach (string classKey in localClasses.Keys)
{
if (localClasses[classKey] == classID)
{
//Log.Out("RebirthVariables-RefreshVariables classKey: " + classKey);
foreach (string expertiseKey in localExpertiseClass.Keys)
{
if (localExpertiseClass[expertiseKey] == classKey)
{
int progressionMax = 10;
//Log.Out("RebirthVariables-RefreshVariables expertiseKey: " + expertiseKey);
foreach (string expertiseClassKey in localExpertise.Keys)
{
if (expertiseClassKey == expertiseKey)
{
progressionMax = localExpertise[expertiseClassKey];
break;
}
}
//Log.Out("RebirthVariables-RefreshVariables progressionMax: " + progressionMax);
for (int i = 1; i <= progressionMax; i++)
{
float j = localVariables["$varFuriousRamsay" + expertiseKey + "PercUnit"] * 100 / i;
if (j > 100)
{
j = 100;
}
localConstants["$varFuriousRamsay" + expertiseKey + i + "Perc"] = j;
//Log.Out("RebirthVariables-RefreshVariables $varFuriousRamsay" + expertiseKey + i + "Perc: " + j);
}
foreach (string expertiseTierKey in localExpertiseTier.Keys)
{
if (expertiseTierKey == expertiseKey)
{
foreach (string localExpertiseLevelWithClass in RebirthVariables.localExpertiseLevelWithClass.Keys)
{
if (localExpertiseLevelWithClass == playerClass &&
expertiseTierKey == RebirthVariables.localExpertiseLevelWithClass[localExpertiseLevelWithClass]
)
{
//Log.Out("RebirthVariables-RefreshVariables expertiseTierKey: " + expertiseTierKey);
if (classID == 10)
{
ProgressionValue classProgressionValue = ___entityPlayerLocal.Progression.GetProgressionValue("furiousramsayatt" + playerClass.ToLower());
int progressionLevel = classProgressionValue.Level;
//Log.Out("RebirthVariables-RefreshVariables FuriousRamsay" + playerClass + "RageTier: " + progressionLevel);
___entityPlayerLocal.Buffs.RemoveBuff("FuriousRamsay" + playerClass + "RageTier" + (progressionLevel - 1));
___entityPlayerLocal.Buffs.AddBuff("FuriousRamsay" + playerClass + "RageTier" + progressionLevel);
}
localVariables["$varFuriousRamsay" + expertiseKey + "PercUnit"] = localVariables["$varFuriousRamsay" + playerClass + "PercUnit"];
break;
}
}
localConstants["$varFuriousRamsayPerk" + localExpertiseTier[expertiseTierKey] + "PercUnit"] = localVariables["$varFuriousRamsay" + expertiseKey + "PercUnit"];
//Log.Out("RebirthVariables-RefreshVariables $varFuriousRamsay" + classKey + "PercUnit: " + localVariables["$varFuriousRamsay" + classKey + "PercUnit"]);
//Log.Out("RebirthVariables-RefreshVariables $varFuriousRamsay" + expertiseKey + "PercUnit: " + localVariables["$varFuriousRamsay" + expertiseKey + "PercUnit"]);
//Log.Out("RebirthVariables-RefreshVariables $varFuriousRamsayPerk" + localExpertiseTier[expertiseTierKey] + "PercUnit: " + localConstants["$varFuriousRamsayPerk" + localExpertiseTier[expertiseTierKey] + "PercUnit"]);
break;
}
}
}
}
break;
}
}
}
public static void RefreshConstants(EntityAlive ___entityPlayerLocal)
{
//Log.Out("RebirthVariables-RefreshConstants START");
if (GameManager.IsDedicatedServer || ___entityPlayerLocal == null)
return;
localConstants["$varFuriousRamsayClassPercUnit"] = 0f;
localConstants["$varFuriousRamsayActionInProgress"] = 0f;
localConstants["$restrictNumHires"] = 1f;
localConstants["$varFuriousRamsayTheyGrowStrongerKills_Cst"] = ___entityPlayerLocal.Buffs.GetCustomVar("$NaturalSelection_FR"); //___entityPlayerLocal.KilledZombies;
foreach (string key in RebirthVariables.localVariables.Keys)
{
if (key.EndsWith("PercUnit"))
{
int units = (int)localVariables[key];
//Log.Out("RebirthVariables-RefreshConstants localVariables[key]: " + localVariables[key]);
//Log.Out("RebirthVariables-RefreshConstants units: " + units);
localConstants[key.Replace("PercUnit", "Lvl")] = units;
//Log.Out("RebirthVariables-RefreshConstants " + key.Replace("PercUnit", "Lvl") + ": " + localConstants[key.Replace("PercUnit", "Lvl")]);
localConstants[key.Replace("PercUnit", "Perc")] = localVariables[key] * 100;
/*Log.Out("RebirthVariables-RefreshConstants key: " + key);
Log.Out("RebirthVariables-RefreshConstants " + key.Replace("PercUnit", "Lvl") + ": " + localConstants[key.Replace("PercUnit", "Lvl")]);
Log.Out("RebirthVariables-RefreshConstants " + key.Replace("PercUnit", "Perc") + ": " + localConstants[key.Replace("PercUnit", "Perc")]);*/
}
else if (key.EndsWith("Exp"))
{
int max = 0;
foreach (string constantKey in localConstants.Keys)
{
if (constantKey.StartsWith(key) && !constantKey.Contains("Perc"))
{
//Log.Out("RebirthVariables-RefreshConstants constantKey: " + constantKey);
int number = int.Parse(constantKey.Replace(key, "").Replace("Lvl", "").Replace("_Cst", ""));
if (number > max)
{
max = number;
}
}
}
if (max > 0)
{
for (int i = 1; i <= max; i++)
{
float currentValue = RebirthVariables.localVariables[key];
float levelValue = RebirthVariables.localConstants[key + "Lvl" + i + "_Cst"];
if (currentValue > levelValue)
{
RebirthVariables.localConstants[key + i + "_Cst"] = levelValue;
RebirthVariables.localConstants[key + "Perc" + i + "_Cst"] = 100f;
}
else
{
RebirthVariables.localConstants[key + i + "_Cst"] = currentValue;
RebirthVariables.localConstants[key + "Perc" + i + "_Cst"] = currentValue / levelValue * 100;
}
}
}
}
}
float playerClass = ___entityPlayerLocal.Buffs.GetCustomVar("$ActiveClass_FR");
if (playerClass > 0)
{
//Log.Out("RebirthVariables-RefreshConstants playerClass: " + playerClass);
foreach (string classKey in localClasses.Keys)
{
//Log.Out("RebirthVariables-RefreshConstants classKey: " + classKey);
if (localClasses[classKey] == playerClass)
{
//Log.Out("RebirthVariables-RefreshConstants localClasses[classKey] == playerClass");
foreach (string key in localVariables.Keys)
{
//Log.Out("RebirthVariables-RefreshConstants key: " + key);
if (key.Contains(classKey) && key.EndsWith("PercUnit"))
{
//Log.Out("RebirthVariables-RefreshConstants key: " + key);
float total = localVariables[key];
float unit = total % 1;
float perc = unit * 100 % 100;
int level = (int)unit;
localConstants["$varFuriousRamsayClassPerc"] = perc;
localConstants["$varFuriousRamsayClassPercUnit"] = total;
localConstants["$varFuriousRamsayClassLvl"] = level;
//Log.Out("RebirthVariables-RefreshConstants classKey: " + classKey);
//Log.Out("RebirthVariables-RefreshConstants $varFuriousRamsayClassPerc: " + perc);
//Log.Out("RebirthVariables-RefreshConstants $varFuriousRamsayClassPercUnit: " + total);
//Log.Out("RebirthVariables-RefreshConstants $varFuriousRamsayClassLvl: " + level);
break;
}
}
}
}
}
}
public static IEnumerator UpdateLocalVariables(EntityPlayerLocal ___entityPlayerLocal, int replaceVariables = 0)
{
for (int i = 0; i < RebirthVariables.localVariables.Count; i++)
{
string key = RebirthVariables.localVariables.ElementAt(i).Key;
if (replaceVariables == 1)
{
___entityPlayerLocal.Buffs.SetCustomVar(key, RebirthVariables.localVariables[key]);
//Log.Out("STORE cvar: " + key + " / value: " + ___entityPlayerLocal.Buffs.GetCustomVar(key));
}
else
{
localVariables[key] = ___entityPlayerLocal.Buffs.GetCustomVar(key);
}
}
if (replaceVariables == 0)
{
RefreshVariables(___entityPlayerLocal);
RefreshConstants(___entityPlayerLocal);
}
loaded = true;
yield break;
}
static RebirthVariables()
{
localVehicleParts = new Dictionary<RepairableVehicleSlotsEnum, VehicleParts>
{
[RepairableVehicleSlotsEnum.Headlight_v1] = new VehicleParts("resourceHeadlight", "lblHeadlight", "resourceHeadlight", 0.1f, 2, 20, false),
[RepairableVehicleSlotsEnum.CarBattery_1] = new VehicleParts("CarBattery_FR", "lblBattery", "carBattery", 0.1f, 2, 50, true),
[RepairableVehicleSlotsEnum.MinibikeEngine_1] = new VehicleParts("MinibikeEngine_FR", "lblSmallEngine", "smallEngine", 0.15f, 2, 80, true),
[RepairableVehicleSlotsEnum.MotorcycleEngine_1] = new VehicleParts("MotorcycleEngine_FR", "lblMotorcycleEngine", "partMotorcycleEngine_FR", 0.2f, 2, 90, true),
[RepairableVehicleSlotsEnum.V6Engine_1] = new VehicleParts("V6Engine_FR", "lblV6Engine", "partV6Engine_FR", 0.15f, 2, 100, true),
[RepairableVehicleSlotsEnum.V8Engine_1] = new VehicleParts("V8Engine_FR", "lblV8Engine", "partV8Engine_FR", 0.1f, 2, 110, true),
[RepairableVehicleSlotsEnum.GyroEngine_1] = new VehicleParts("MinibikeEngine_FR", "lblSmallEngine", "smallEngine", 0.2f, 2, 80, true),
[RepairableVehicleSlotsEnum.SparkPlugs_1] = new VehicleParts("SparkPlugs_FR", "lblSparkPlugs", "partSparkPlugs_FR", 0.15f, 2, 40, true),
[RepairableVehicleSlotsEnum.CarStarter_1] = new VehicleParts("CarStarter_FR", "lblVehicleStarter", "partCarStarter_FR", 0.15f, 2, 50, true),
[RepairableVehicleSlotsEnum.FuelPump_1] = new VehicleParts("FuelPump_FR", "lblFuelPump", "partFuelPump_FR", 0.15f, 2, 50, true),
[RepairableVehicleSlotsEnum.Alternator_1] = new VehicleParts("Alternator_FR", "lblAlternator", "partAlternator_FR", 0.15f, 2, 60, true),
[RepairableVehicleSlotsEnum.Carburetor_1] = new VehicleParts("Carburetor_FR", "lblCarburetor", "partCarburetor_FR", 0.15f, 2, 60, true),
[RepairableVehicleSlotsEnum.CarTransmission_1] = new VehicleParts("CarTransmission_FR", "lblTransmission", "partCarTransmission_FR", 0.15f, 2, 80, true),
[RepairableVehicleSlotsEnum.CarRadiator_1] = new VehicleParts("CarRadiator_FR", "lblCarRadiator", "partCarRadiator_FR", 0.15f, 2, 50, true),
[RepairableVehicleSlotsEnum.TruckRadiator_1] = new VehicleParts("TruckRadiator_FR", "lblTruckRadiator", "partTruckRadiator_FR", 0.15f, 2, 80, true),
[RepairableVehicleSlotsEnum.BicycleWheel_1] = new VehicleParts("BicycleWheel_FR", "lblBicycleWheel", "partBicycleWheel_FR", 0.25f, 2, 15, true),
[RepairableVehicleSlotsEnum.MinibikeWheel_1] = new VehicleParts("MinibikeWheel_FR", "lblMinibikeWheel", "partMinibikeWheel_FR", 0.2f, 2, 40, true),
[RepairableVehicleSlotsEnum.MotorcycleWheel_1] = new VehicleParts("MotorcycleWheel_FR", "lblMotorcycleWheel", "partMotorcycleWheel_FR", 0.2f, 2, 60, true),
[RepairableVehicleSlotsEnum.MotorcycleWheel_2] = new VehicleParts("MotorcycleWheel2_FR", "lblMotorcycleWheel2", "partMotorcycleWheel2_FR", 0.2f, 2, 60, true),
[RepairableVehicleSlotsEnum.CarWheel_1] = new VehicleParts("CarWheel_FR", "lblCarWheel", "partCarWheel_FR", 0.2f, 2, 80, true),
[RepairableVehicleSlotsEnum.CarWheel_2] = new VehicleParts("CarWheel2_FR", "lblCarWheel2", "partCarWheel2_FR", 0.2f, 2, 80, true),
[RepairableVehicleSlotsEnum.TruckWheel_1] = new VehicleParts("TruckWheel_FR", "lblTruckWheel", "partTruckWheel_FR", 0.2f, 2, 100, true),
[RepairableVehicleSlotsEnum.TruckWheel_2] = new VehicleParts("TruckWheel2_FR", "lblTruckWheel2", "partTruckWheel2_FR", 0.2f, 2, 100, true),
[RepairableVehicleSlotsEnum.MilitaryTruckWheel_1] = new VehicleParts("MilitaryTruckWheel_FR", "lblMilitaryTruckWheel", "partMilitaryTruckWheel_FR", 0.15f, 2, 110, true),
[RepairableVehicleSlotsEnum.HeavyWheel_1] = new VehicleParts("HeavyWheel_FR", "lblHeavyWheel", "partHeavyWheel_FR", 0.15f, 2, 120, true),
[RepairableVehicleSlotsEnum.GyroWheel_1] = new VehicleParts("GyroWheel_FR", "lblGyroWheel", "partGyroWheel_FR", 0.2f, 2, 50, true)
};
localVehicleTypes = new Dictionary<string, List<RepairableVehicleSlotsEnum>>
{
["BicycleRepair"] = new List<RepairableVehicleSlotsEnum>
{
RepairableVehicleSlotsEnum.BicycleWheel_1,
RepairableVehicleSlotsEnum.BicycleWheel_1
},
["MinibikeRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.MinibikeEngine_1,
RepairableVehicleSlotsEnum.MinibikeWheel_1,
RepairableVehicleSlotsEnum.MinibikeWheel_1
},
["MotorcycleRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.MotorcycleEngine_1,
RepairableVehicleSlotsEnum.MotorcycleWheel_1,
RepairableVehicleSlotsEnum.MotorcycleWheel_1
},
["QuadRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.MinibikeEngine_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1
},
["V6CarRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V6Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.CarRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1
},
["V8CarRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.CarRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1,
RepairableVehicleSlotsEnum.CarWheel_1
},
["V6TruckRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V6Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2
},
["V8TruckRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2
},
["V8MilitaryTruckRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1
},
["6WheelerRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1
},
["6WheelerMilitaryRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1
},
["8WheelerRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1,
RepairableVehicleSlotsEnum.HeavyWheel_1
},
["8WheelerMilitaryRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1,
RepairableVehicleSlotsEnum.MilitaryTruckWheel_1
},
["RVRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.TruckRadiator_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.CarTransmission_1,
RepairableVehicleSlotsEnum.Alternator_1,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2,
RepairableVehicleSlotsEnum.TruckWheel_2
},
["HeliRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.V8Engine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.Carburetor_1,
RepairableVehicleSlotsEnum.Alternator_1
},
["GyroRepair"] = new List<RepairableVehicleSlotsEnum>{
RepairableVehicleSlotsEnum.Headlight_v1,
RepairableVehicleSlotsEnum.SparkPlugs_1,
RepairableVehicleSlotsEnum.CarBattery_1,
RepairableVehicleSlotsEnum.MinibikeEngine_1,
RepairableVehicleSlotsEnum.CarStarter_1,
RepairableVehicleSlotsEnum.FuelPump_1,
RepairableVehicleSlotsEnum.GyroWheel_1,
RepairableVehicleSlotsEnum.GyroWheel_1,
RepairableVehicleSlotsEnum.GyroWheel_1
}
};
factions = new Dictionary<string, int>();
localGenetics = new Dictionary<string, int>();
localClasses = new Dictionary<string, float>();
localClassMeta = new Dictionary<string, classMeta>();
localExpertise = new Dictionary<string, int>();
localVariables = new Dictionary<string, float>();
localConstants = new Dictionary<string, float>();
localExpertiseClass = new Dictionary<string, string>();
localExpertiseLevelWithClass = new Dictionary<string, string>();
localExpertiseTier = new Dictionary<string, int>();
localClassPerk = new Dictionary<string, List<classPerk>>();
localClassProgressionMax = new Dictionary<string, int>();
localClassRewards = new Dictionary<string, List<classRewards>>();
localGeneticsCrafting = new Dictionary<string, List<categoryCrafting>>();
localExpertiseCrafting = new Dictionary<string, List<categoryCrafting>>();
localOtherCrafting = new Dictionary<string, List<categoryCrafting>>();
localCraftingIncrements = new Dictionary<string, List<craftingIncrements>>();
localAuras = new Dictionary<string, auraData>();
localAuraChances = new Dictionary<string, float>();
npcWeaponCategories = new Dictionary<string, string>();
bodyTags = new Dictionary<int, string>();
// BODY TRANSFORMS
bodyTags[0] = "E_BP_Head";
bodyTags[1] = "E_BP_Body";
bodyTags[2] = "E_BP_LLeg";
bodyTags[3] = "E_BP_LLowerLeg";
bodyTags[4] = "E_BP_RLeg";
bodyTags[5] = "E_BP_RLowerLeg";
bodyTags[6] = "E_BP_Body";
bodyTags[7] = "E_BP_LArm";
bodyTags[8] = "E_BP_LLowerArm";
bodyTags[9] = "E_BP_RArm";
bodyTags[10] = "E_BP_RLowerArm";
// LOW
npcWeaponCategories["meleeWpnClubT0WoodenClub"] = "low";
npcWeaponCategories["meleeWpnBladeT1HuntingKnife"] = "low";
npcWeaponCategories["meleeWpnClubT1BaseballBat"] = "low";
npcWeaponCategories["meleeToolAxeT1IronFireaxe"] = "low";
npcWeaponCategories["meleeWpnSpearT1IronSpear"] = "low";
npcWeaponCategories["meleeWpnBladeT3Machete"] = "low";
// LOW-MEDIUM
npcWeaponCategories["gunRifleT0PipeRifle"] = "lowmed";
npcWeaponCategories["gunShotgunT0PipeShotgun"] = "lowmed";
npcWeaponCategories["gunBowT1WoodenBow"] = "lowmed";
// MEDIUM
npcWeaponCategories["gunMGT0PipeMachineGun"] = "med";
npcWeaponCategories["gunHandgunT0PipePistol"] = "med";
npcWeaponCategories["gunBowT1IronCrossbow"] = "med";
// MEDIUM-HIGH
npcWeaponCategories["gunHandgunT1Pistol"] = "medhigh";
npcWeaponCategories["gunRifleT1HuntingRifle"] = "medhigh";
npcWeaponCategories["gunShotgunT2PumpShotgun"] = "medhigh";
npcWeaponCategories["gunMGT1AK47"] = "medhigh";
// HIGH
npcWeaponCategories["gunHandgunT3DesertVulture"] = "high";
npcWeaponCategories["gunHandgunT3SMG5"] = "high";
npcWeaponCategories["gunMGT3M60"] = "high";
npcWeaponCategories["gunMGT2TacticalAR"] = "high";
npcWeaponCategories["gunRifleT3SniperRifle"] = "high";
npcWeaponCategories["gunShotgunT3AutoShotgun"] = "high";
localAuras["Healing"] = new auraData("FuriousRamsayAchievementHealingAura", "FuriousRamsayPerkHealingAuraMod", "FuriousRamsayBuffHealingAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Stamina"] = new auraData("FuriousRamsayAchievementStaminaAura", "FuriousRamsayPerkStaminaAuraMod", "FuriousRamsayBuffStaminaAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Mobility"] = new auraData("FuriousRamsayAchievementMobilityAura", "FuriousRamsayPerkMobilityAuraMod", "FuriousRamsayBuffMobilityAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["ArmorPenetration"] = new auraData("FuriousRamsayAchievementArmorPenetrationAura", "FuriousRamsayPerkArmorPenetrationAuraMod", "FuriousRamsayBuffArmorPenetrationAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["BlockDamage"] = new auraData("FuriousRamsayAchievementBlockDamageAura", "FuriousRamsayPerkBlockDamageAuraMod", "FuriousRamsayBuffBlockDamageAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["FireRate"] = new auraData("FuriousRamsayAchievementFireRateAura", "FuriousRamsayPerkFireRateAuraMod", "FuriousRamsayBuffFireRateAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["AttackSpeed"] = new auraData("FuriousRamsayAchievementAttackSpeedAura", "FuriousRamsayPerkAttackSpeedAuraMod", "FuriousRamsayBuffAttackSpeedAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Shadow"] = new auraData("FuriousRamsayAchievementShadowAura", "FuriousRamsayPerkShadowAuraMod", "FuriousRamsayBuffShadowAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Vitality"] = new auraData("FuriousRamsayAchievementVitalityAura", "FuriousRamsayPerkVitalityAuraMod", "FuriousRamsayBuffVitalityAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Agility"] = new auraData("FuriousRamsayAchievementAgilityAura", "FuriousRamsayPerkAgilityAuraMod", "FuriousRamsayBuffAgilityAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Pierce"] = new auraData("FuriousRamsayAchievementPierceAura", "FuriousRamsayPerkPierceAuraMod", "FuriousRamsayBuffPierceAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Trade"] = new auraData("FuriousRamsayAchievementTradeAura", "FuriousRamsayPerkTradeAuraMod", "FuriousRamsayBuffTradeAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Fortuity"] = new auraData("FuriousRamsayAchievementFortuityAura", "FuriousRamsayPerkFortuityAuraMod", "FuriousRamsayBuffFortuityAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["Stability"] = new auraData("FuriousRamsayAchievementStabilityAura", "FuriousRamsayPerkStabilityAuraMod", "FuriousRamsayBuffStabilityAuraAlliesLvl", "", "", 0f, 0f, "", "", false, false, "", 0f, "");
localAuras["ArrowRain"] = new auraData("FuriousRamsayPerkHunterArrowRainAura", "FuriousRamsayAuraModHunter", "FuriousRamsayBuffArrowRainAura", "Hunter", "FuriousRamsayArrowRainParticle", 3f, 2f, "", "", true, true, "", 6.5f, "FuriousRamsayPerkHunterArrowRainAura");
localAuras["RangedStun"] = new auraData("FuriousRamsayPerkThugRangedStunAura", "FuriousRamsayAuraModThug", "FuriousRamsayBuffRangedStunAura", "Thug", "FuriousRamsayRangedStun", 2f, 1.5f, "", "", true, true, "", 5f, "FuriousRamsayPerkThugRangedStunAura");
localAuras["RangedBleed"] = new auraData("FuriousRamsayPerkButcherRangedBleedAura", "FuriousRamsayAuraModButcher", "FuriousRamsayBuffRangedBleedAura", "Butcher", "FuriousRamsayRangedBleedDamage", 3f, 2f, "", "", true, true, "", 5f, "FuriousRamsayPerkButcherRangedBleedAura");
localAuras["RangedDoubleDamage"] = new auraData("FuriousRamsayPerkSoldierRangedDoubleDamageAura", "FuriousRamsayAuraModSoldier", "FuriousRamsayBuffRangedDoubleDamageAura", "Soldier", "", 3f, 2f, "FuriousRamsayRangedDoubleDamage", "", false, true, "", 5f, "FuriousRamsayPerkSoldierRangedDoubleDamageAura");
localAuras["RangedShock"] = new auraData("FuriousRamsayPerkTechnogeekRangedShockAura", "FuriousRamsayAuraModTechnogeek", "FuriousRamsayBuffRangedShockAura", "Technogeek", "FuriousRamsayAddShockAuraDamageAoE", 3f, 2f, "", "", true, true, "", 5f, "FuriousRamsayPerkTechnogeekRangedShockAura");
localAuras["RangedExplosion"] = new auraData("FuriousRamsayPerkMadmanRangedExplosionAura", "FuriousRamsayAuraModMadman", "FuriousRamsayBuffRangedExplosionAura", "Madman", "", 3f, 2f, "FuriousRamsayAddAuraMadmanExplosionDamage", "", true, true, "", 6.5f, "FuriousRamsayPerkMadmanRangedExplosionAura");
localAuras["RangedDismember"] = new auraData("FuriousRamsayPerkBuilderRangedDismemberAura", "FuriousRamsayAuraModBuilder", "FuriousRamsayBuffRangedDismemberAura", "Builder", "", 2f, 1.5f, "FuriousRamsayDismember", "", true, true, "", 5f, "FuriousRamsayPerkBuilderRangedDismemberAura");
localAuras["RangedSlashes"] = new auraData("FuriousRamsayPerkChefRangedSlashesAura", "FuriousRamsayAuraModChef", "FuriousRamsayBuffRangedSlashesAura", "Chef", "FuriousRamsayKnifeSlashesParticle", 3f, 2f, "", "", true, true, "", 6.5f, "FuriousRamsayPerkChefRangedSlashesAura");
// SET TO 2 if you want to skip NPCs
localAuraChances["ArrowRain"] = 1f;
localAuraChances["RangedStun"] = 1f;
localAuraChances["RangedBleed"] = 1f;
localAuraChances["RangedDoubleDamage"] = 1f;
localAuraChances["RangedShock"] = 1f;
localAuraChances["RangedExplosion"] = 1f;
localAuraChances["RangedDismember"] = 1f;
localAuraChances["RangedSlashes"] = 1f;
localGenetics["Strength"] = 10;
localGenetics["Dexterity"] = 10;
localGenetics["Constitution"] = 10;
localGenetics["Intelligence"] = 10;
localGenetics["Charisma"] = 10;
localGeneticsCrafting["Constitution"] = new List<categoryCrafting>{
new categoryCrafting("craftingArmor", new List<craftingLevels>{
new craftingLevels(0f, 10),
new craftingLevels(0.2f, 20),
new craftingLevels(0.4f, 30),
new craftingLevels(0.6f, 40),
new craftingLevels(0.8f, 50)}),
new categoryCrafting("craftingArmor", new List<craftingLevels>{
new craftingLevels(1f, 60),
new craftingLevels(1.4f, 70),
new craftingLevels(1.8f, 80),
new craftingLevels(2.2f, 90),
new craftingLevels(2.6f, 100)}),
new categoryCrafting("craftingArmor", new List<craftingLevels>{
new craftingLevels(3f, 110),
new craftingLevels(3.5f, 120),
new craftingLevels(4f, 130),
new craftingLevels(4.5f, 140),
new craftingLevels(5f, 150)}),
new categoryCrafting("craftingArmor", new List<craftingLevels>{
new craftingLevels(5.5f, 160),
new craftingLevels(6.1f, 170),
new craftingLevels(6.7f, 180),
new craftingLevels(7.3f, 190),
new craftingLevels(8f, 200)})
};
localCraftingIncrements["SalvageTools"] = new List<craftingIncrements>{
new craftingIncrements(0f,.2f,0.0001f),
new craftingIncrements(0.2f,1.2f,0.00001f),
new craftingIncrements(1.2f,2.2f,0.000002f),
new craftingIncrements(2.2f,3.0f,0.0000004f)
};
localOtherCrafting["SalvageTools"] = new List<categoryCrafting>{
new categoryCrafting("craftingSalvageTools", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.2f, 10),
new craftingLevels(0.4f, 20),
new craftingLevels(0.6f, 30),
new craftingLevels(0.8f, 40),
new craftingLevels(1.0f, 50)}),
new categoryCrafting("craftingSalvageTools", new List<craftingLevels>{
new craftingLevels(1.2f, 60),
new craftingLevels(1.4f, 70),
new craftingLevels(1.6f, 80),
new craftingLevels(1.8f, 90),
new craftingLevels(2.0f, 100)}),
new categoryCrafting("craftingSalvageTools", new List<craftingLevels>{
new craftingLevels(2.2f, 110),
new craftingLevels(2.4f, 120),
new craftingLevels(2.6f, 130),
new craftingLevels(2.8f, 140),
new craftingLevels(3.0f, 150)})
};
localCraftingIncrements["Mine"] = new List<craftingIncrements>{
new craftingIncrements(0f,1.0f,.0000333f),
new craftingIncrements(1.0f,2.0f,.000003f),
new craftingIncrements(2.0f,3.0f,.0000003f),
new craftingIncrements(3.0f,3.8f,.00000003f)
};
localOtherCrafting["Mine"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayMiningTools", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.2f, 10),
new craftingLevels(0.4f, 20),
new craftingLevels(0.6f, 30),
new craftingLevels(0.8f, 40)}),
new categoryCrafting("FuriousRamsayMiningTools", new List<craftingLevels>{
new craftingLevels(1.0f, 50),
new craftingLevels(1.2f, 60),
new craftingLevels(1.4f, 70),
new craftingLevels(1.6f, 80),
new craftingLevels(1.8f, 90)}),
new categoryCrafting("FuriousRamsayMiningTools", new List<craftingLevels>{
new craftingLevels(2.0f, 100),
new craftingLevels(2.2f, 110),
new craftingLevels(2.4f, 120),
new craftingLevels(2.6f, 130),
new craftingLevels(2.8f, 140)}),
new categoryCrafting("FuriousRamsayMiningTools", new List<craftingLevels>{
new craftingLevels(3.0f, 150),
new craftingLevels(3.2f, 160),
new craftingLevels(3.4f, 170),
new craftingLevels(3.6f, 180),
new craftingLevels(3.8f, 190)})
};
localCraftingIncrements["Dig"] = new List<craftingIncrements>{
new craftingIncrements(0f,1.0f,.00003f),
new craftingIncrements(1.0f,2.0f,.000003f),
new craftingIncrements(2.0f,2.8f,.0000003f)
};
localOtherCrafting["Dig"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayDiggingTools", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.2f, 10),
new craftingLevels(0.4f, 20),
new craftingLevels(0.6f, 30),
new craftingLevels(0.8f, 40)}),
new categoryCrafting("FuriousRamsayDiggingTools", new List<craftingLevels>{
new craftingLevels(1.0f, 50),
new craftingLevels(1.2f, 60),
new craftingLevels(1.4f, 70),
new craftingLevels(1.6f, 80),
new craftingLevels(1.8f, 90)}),
new categoryCrafting("FuriousRamsayDiggingTools", new List<craftingLevels>{
new craftingLevels(2.0f, 100),
new craftingLevels(2.2f, 110),
new craftingLevels(2.4f, 120),
new craftingLevels(2.6f, 130),
new craftingLevels(2.8f, 140)})
};
localCraftingIncrements["Chop"] = new List<craftingIncrements>{
new craftingIncrements(0f,0.2f,.000015f),
new craftingIncrements(0.2f,1.2f,.00001f),
new craftingIncrements(1.2f,2.2f,.000001f),
new craftingIncrements(2.2f,3.0f,.0000001f)
};
localOtherCrafting["Chop"] = new List<categoryCrafting>{
new categoryCrafting("craftingChoppingTools", new List<craftingLevels>{
new craftingLevels(0.2f, 50),
new craftingLevels(0.4f, 60),
new craftingLevels(0.6f, 70),
new craftingLevels(0.8f, 80),
new craftingLevels(1.0f, 90)}),
new categoryCrafting("craftingChoppingTools", new List<craftingLevels>{
new craftingLevels(1.2f, 100),
new craftingLevels(1.4f, 110),
new craftingLevels(1.6f, 120),
new craftingLevels(1.8f, 130),
new craftingLevels(2.0f, 140)}),
new categoryCrafting("craftingChoppingTools", new List<craftingLevels>{
new craftingLevels(2.2f, 150),
new craftingLevels(2.4f, 160),
new craftingLevels(2.6f, 170),
new craftingLevels(2.8f, 180),
new craftingLevels(3.0f, 190)})
};
localClasses["Hunter"] = 1f;
localClasses["Thug"] = 2f;
localClasses["Butcher"] = 3f;
localClasses["Soldier"] = 4f;
localClasses["Technogeek"] = 5f;
localClasses["Madman"] = 6f;
localClasses["Builder"] = 7f;
localClasses["Chef"] = 8f;
localClasses["WitchDoctor"] = 9f;
localClasses["Berserker"] = 10f;
localClassMeta["Hunter"] = new classMeta(false);
localClassMeta["Thug"] = new classMeta(false);
localClassMeta["Butcher"] = new classMeta(false);
localClassMeta["Soldier"] = new classMeta(false);
localClassMeta["Technogeek"] = new classMeta(false);
localClassMeta["Madman"] = new classMeta(false);
localClassMeta["Builder"] = new classMeta(false);
localClassMeta["Chef"] = new classMeta(false);
localClassMeta["WitchDoctor"] = new classMeta(false);
localClassMeta["Berserker"] = new classMeta(false);
localClassProgressionMax["Hunter"] = 10;
localClassProgressionMax["Thug"] = 10;
localClassProgressionMax["Butcher"] = 10;
localClassProgressionMax["Soldier"] = 10;
localClassProgressionMax["Technogeek"] = 10;
localClassProgressionMax["Madman"] = 10;
localClassProgressionMax["Builder"] = 10;
localClassProgressionMax["Chef"] = 10;
localClassProgressionMax["WitchDoctor"] = 10;
localClassProgressionMax["Berserker"] = 15;
localClassRewards["Hunter"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Thug"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Butcher"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Soldier"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Technogeek"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Madman"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Builder"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Chef"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["WitchDoctor"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
localClassRewards["Berserker"] = new List<classRewards>{
new classRewards(2, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(3, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(4, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(5, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(6, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(7, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(8, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(9, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)}),
new classRewards(10, new List<classReward>{
new classReward("FuriousRamsayGeneticsPerBook", 1),
new classReward("FuriousRamsayPillGeneric", 1)})
};
// EXPERTISE
localExpertise["Spears"] = 10;
localExpertise["Bows"] = 10;
localExpertise["LongRangeRifles"] = 10;
localExpertise["Clubs"] = 10;
localExpertise["Shotguns"] = 10;
localExpertise["Swords"] = 10;
localExpertise["AssaultRifles"] = 10;
localExpertise["Axes"] = 10;
localExpertise["MachineGuns"] = 10;
localExpertise["Batons"] = 10;
localExpertise["Revolvers"] = 10;
localExpertise["DeployableTurrets"] = 10;
localExpertise["Knuckles"] = 10;
localExpertise["SubmachineGuns"] = 10;
localExpertise["Explosives"] = 10;
localExpertise["Hammers"] = 10;
localExpertise["Pistols"] = 10;
localExpertise["ElectricTraps"] = 0;
localExpertise["Knives"] = 10;
localExpertise["HeavyHandguns"] = 10;
localExpertise["Scythes"] = 10;
localExpertise["TacticalRifles"] = 10;
localExpertise["BlackMagic"] = 0;
localExpertise["Melee"] = 15;
localExpertise["Rage"] = 15;
localExpertiseCrafting["Spears"] = new List<categoryCrafting>{
new categoryCrafting("craftingSpears", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("craftingSpears", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.646f, 60),
new craftingLevels(0.917f, 70),
new craftingLevels(1.188f, 80),
new craftingLevels(1.459f, 90)}),
new categoryCrafting("craftingSpears", new List<craftingLevels>{
new craftingLevels(1.73f, 100),
new craftingLevels(2.001f, 110),
new craftingLevels(2.272f, 120),
new craftingLevels(2.543f, 130),
new craftingLevels(2.814f, 140)}),
new categoryCrafting("craftingSpears", new List<craftingLevels>{
new craftingLevels(3.085f, 150),
new craftingLevels(3.356f, 160),
new craftingLevels(3.627f, 170),
new craftingLevels(3.898f, 180),
new craftingLevels(4.169f, 190)}),
new categoryCrafting("craftingSpears", new List<craftingLevels>{
new craftingLevels(4.44f, 200),
new craftingLevels(4.711f, 210),
new craftingLevels(4.982f, 220),
new craftingLevels(5.253f, 230),
new craftingLevels(5.524f, 240)}),
new categoryCrafting("craftingSpears", new List<craftingLevels>{
new craftingLevels(5.795f, 250),
new craftingLevels(6.066f, 260),
new craftingLevels(6.337f, 270),
new craftingLevels(6.608f, 280),
new craftingLevels(6.879f, 290)}),
new categoryCrafting("craftingSpears", new List<craftingLevels>{
new craftingLevels(7.150f, 300),
new craftingLevels(7.421f, 310),
new craftingLevels(7.692f, 320),
new craftingLevels(7.953f, 330),
new craftingLevels(8.5f, 340)})
};
localExpertiseCrafting["Bows"] = new List<categoryCrafting>{
new categoryCrafting("craftingBows", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("craftingBows", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.525f, 60),
new craftingLevels(0.675f, 70),
new craftingLevels(0.825f, 80),
new craftingLevels(0.975f, 90)}),
new categoryCrafting("craftingBows", new List<craftingLevels>{
new craftingLevels(1.125f, 100),
new craftingLevels(1.3f, 110),
new craftingLevels(1.475f, 120),
new craftingLevels(1.65f, 130),
new craftingLevels(1.825f, 140)}),
new categoryCrafting("craftingBows", new List<craftingLevels>{
new craftingLevels(2f, 150),
new craftingLevels(2.2f, 160),
new craftingLevels(2.4f, 170),
new craftingLevels(2.6f, 180),
new craftingLevels(2.8f, 190)}),
new categoryCrafting("craftingBows", new List<craftingLevels>{
new craftingLevels(3f, 200),
new craftingLevels(3.3f, 210),
new craftingLevels(3.6f, 220),
new craftingLevels(3.9f, 230),
new craftingLevels(4.2f, 240)})
};
localExpertiseCrafting["LongRangeRifles"] = new List<categoryCrafting>{
new categoryCrafting("craftingRifles", new List<craftingLevels>{
new craftingLevels(0.175f, 50),
new craftingLevels(0.3f, 60),
new craftingLevels(0.425f, 70),
new craftingLevels(0.55f, 80),
new craftingLevels(0.675f, 90)}),
new categoryCrafting("craftingRifles", new List<craftingLevels>{
new craftingLevels(0.8f, 100),
new craftingLevels(1.125f, 110),
new craftingLevels(1.425f, 120),
new craftingLevels(1.75f, 130),
new craftingLevels(2.075f, 140)}),
new categoryCrafting("craftingRifles", new List<craftingLevels>{
new craftingLevels(2.4f, 150),
new craftingLevels(2.75f, 160),
new craftingLevels(3.1f, 170),
new craftingLevels(3.45f, 180),
new craftingLevels(3.8f, 190)}),
new categoryCrafting("craftingRifles", new List<craftingLevels>{
new craftingLevels(4.15f, 200),
new craftingLevels(4.55f, 210),
new craftingLevels(4.95f, 220),
new craftingLevels(5.35f, 230),
new craftingLevels(5.75f, 240)}),
new categoryCrafting("craftingRifles", new List<craftingLevels>{
new craftingLevels(6.2f, 250),
new craftingLevels(6.7f, 260),
new craftingLevels(7.2f, 270),
new craftingLevels(7.7f, 280),
new craftingLevels(8.2f, 290)})
};
localExpertiseCrafting["Clubs"] = new List<categoryCrafting>{
new categoryCrafting("craftingClubs", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("craftingClubs", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.646f, 60),
new craftingLevels(0.917f, 70),
new craftingLevels(1.188f, 80),
new craftingLevels(1.459f, 90)}),
new categoryCrafting("craftingClubs", new List<craftingLevels>{
new craftingLevels(1.73f, 100),
new craftingLevels(2.001f, 110),
new craftingLevels(2.272f, 120),
new craftingLevels(2.543f, 130),
new craftingLevels(2.814f, 140)}),
new categoryCrafting("craftingClubs", new List<craftingLevels>{
new craftingLevels(3.085f, 150),
new craftingLevels(3.356f, 160),
new craftingLevels(3.627f, 170),
new craftingLevels(3.898f, 180),
new craftingLevels(4.169f, 190)}),
new categoryCrafting("craftingClubs", new List<craftingLevels>{
new craftingLevels(4.44f, 200),
new craftingLevels(4.711f, 210),
new craftingLevels(4.982f, 220),
new craftingLevels(5.253f, 230),
new craftingLevels(5.524f, 240)}),
new categoryCrafting("craftingClubs", new List<craftingLevels>{
new craftingLevels(5.795f, 250),
new craftingLevels(6.066f, 260),
new craftingLevels(6.337f, 270),
new craftingLevels(6.608f, 280),
new craftingLevels(6.879f, 290)}),
new categoryCrafting("craftingClubs", new List<craftingLevels>{
new craftingLevels(7.150f, 300),
new craftingLevels(7.421f, 310),
new craftingLevels(7.692f, 320),
new craftingLevels(7.953f, 330),
new craftingLevels(8.5f, 340)})
};
localExpertiseCrafting["Shotguns"] = new List<categoryCrafting>{
new categoryCrafting("craftingShotguns", new List<craftingLevels>{
new craftingLevels(0.3f, 50),
new craftingLevels(0.45f, 60),
new craftingLevels(0.6f, 70),
new craftingLevels(0.75f, 80),
new craftingLevels(0.9f, 90)}),
new categoryCrafting("craftingShotguns", new List<craftingLevels>{
new craftingLevels(1.05f, 100),
new craftingLevels(1.35f, 110),
new craftingLevels(1.7f, 120),
new craftingLevels(2.05f, 130),
new craftingLevels(2.4f, 140)}),
new categoryCrafting("craftingShotguns", new List<craftingLevels>{
new craftingLevels(2.75f, 150),
new craftingLevels(3.15f, 160),
new craftingLevels(3.55f, 170),
new craftingLevels(3.95f, 180),
new craftingLevels(4.35f, 190)}),
new categoryCrafting("craftingShotguns", new List<craftingLevels>{
new craftingLevels(4.75f, 200),
new craftingLevels(5.15f, 210),
new craftingLevels(5.55f, 220),
new craftingLevels(5.95f, 230),
new craftingLevels(6.35f, 240)}),
new categoryCrafting("craftingShotguns", new List<craftingLevels>{
new craftingLevels(6.75f, 250),
new craftingLevels(7.15f, 260),
new craftingLevels(7.55f, 270),
new craftingLevels(7.95f, 280),
new craftingLevels(8.35f, 290)})
};
localExpertiseCrafting["Swords"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingSwords", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("FuriousRamsayCraftingSwords", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.646f, 60),
new craftingLevels(0.917f, 70),
new craftingLevels(1.188f, 80),
new craftingLevels(1.459f, 90)}),
new categoryCrafting("FuriousRamsayCraftingSwords", new List<craftingLevels>{
new craftingLevels(1.73f, 100),
new craftingLevels(2.001f, 110),
new craftingLevels(2.272f, 120),
new craftingLevels(2.543f, 130),
new craftingLevels(2.814f, 140)}),
new categoryCrafting("FuriousRamsayCraftingSwords", new List<craftingLevels>{
new craftingLevels(3.085f, 150),
new craftingLevels(3.356f, 160),
new craftingLevels(3.627f, 170),
new craftingLevels(3.898f, 180),
new craftingLevels(4.169f, 190)}),
new categoryCrafting("FuriousRamsayCraftingSwords", new List<craftingLevels>{
new craftingLevels(4.44f, 200),
new craftingLevels(4.711f, 210),
new craftingLevels(4.982f, 220),
new craftingLevels(5.253f, 230),
new craftingLevels(5.524f, 240)}),
new categoryCrafting("FuriousRamsayCraftingSwords", new List<craftingLevels>{
new craftingLevels(5.795f, 250),
new craftingLevels(6.066f, 260),
new craftingLevels(6.337f, 270),
new craftingLevels(6.608f, 280),
new craftingLevels(6.879f, 290)}),
new categoryCrafting("FuriousRamsayCraftingSwords", new List<craftingLevels>{
new craftingLevels(7.150f, 300),
new craftingLevels(7.421f, 310),
new craftingLevels(7.692f, 320),
new craftingLevels(7.953f, 330),
new craftingLevels(8.5f, 340)})
};
localExpertiseCrafting["AssaultRifles"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingAssaultRifles", new List<craftingLevels>{
new craftingLevels(0.75f, 50),
new craftingLevels(1.25f, 60),
new craftingLevels(1.75f, 70),
new craftingLevels(2.25f, 80),
new craftingLevels(2.75f, 90)}),
new categoryCrafting("FuriousRamsayCraftingAssaultRifles", new List<craftingLevels>{
new craftingLevels(3.25f, 100),
new craftingLevels(3.75f, 110),
new craftingLevels(4.25f, 120),
new craftingLevels(4.75f, 130),
new craftingLevels(5.25f, 140)}),
new categoryCrafting("FuriousRamsayCraftingAssaultRifles", new List<craftingLevels>{
new craftingLevels(5.75f, 150),
new craftingLevels(6.25f, 160),
new craftingLevels(6.75f, 170),
new craftingLevels(7.25f, 180),
new craftingLevels(7.75f, 190)})
};
localExpertiseCrafting["Axes"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.607f, 60),
new craftingLevels(0.839f, 70),
new craftingLevels(1.071f, 80),
new craftingLevels(1.303f, 90)}),
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(1.535f, 100),
new craftingLevels(1.767f, 110),
new craftingLevels(1.999f, 120),
new craftingLevels(2.231f, 130),
new craftingLevels(2.463f, 140)}),
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(2.695f, 150),
new craftingLevels(2.927f, 160),
new craftingLevels(3.159f, 170),
new craftingLevels(3.391f, 180),
new craftingLevels(3.623f, 190)}),
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(3.855f, 200),
new craftingLevels(4.087f, 210),
new craftingLevels(4.319f, 220),
new craftingLevels(4.551f, 230),
new craftingLevels(4.783f, 240)}),
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(5.015f, 250),
new craftingLevels(5.247f, 260),
new craftingLevels(5.479f, 270),
new craftingLevels(5.711f, 280),
new craftingLevels(5.943f, 290)}),
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(6.175f, 300),
new craftingLevels(6.407f, 310),
new craftingLevels(6.639f, 320),
new craftingLevels(6.871f, 330),
new craftingLevels(7.103f, 340)}),
new categoryCrafting("FuriousRamsayCraftingAxes", new List<craftingLevels>{
new craftingLevels(7.335f, 350),
new craftingLevels(7.567f, 360),
new craftingLevels(7.799f, 370),
new craftingLevels(8.031f, 380),
new craftingLevels(8.5f, 390)})
};
localExpertiseCrafting["MachineGuns"] = new List<categoryCrafting>{
new categoryCrafting("craftingMachineGuns", new List<craftingLevels>{
new craftingLevels(0.75f, 50),
new craftingLevels(1.25f, 60),
new craftingLevels(1.75f, 70),
new craftingLevels(2.25f, 80),
new craftingLevels(2.75f, 90)}),
new categoryCrafting("craftingMachineGuns", new List<craftingLevels>{
new craftingLevels(3.25f, 100),
new craftingLevels(3.75f, 110),
new craftingLevels(4.25f, 120),
new craftingLevels(4.75f, 130),
new craftingLevels(5.25f, 140)}),
new categoryCrafting("craftingMachineGuns", new List<craftingLevels>{
new craftingLevels(5.75f, 150),
new craftingLevels(6.25f, 160),
new craftingLevels(6.75f, 170),
new craftingLevels(7.25f, 180),
new craftingLevels(7.75f, 190)})
};
localExpertiseCrafting["Batons"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingBatons", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("FuriousRamsayCraftingBatons", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.675f, 60),
new craftingLevels(0.975f, 70),
new craftingLevels(1.275f, 80),
new craftingLevels(1.575f, 90)}),
new categoryCrafting("FuriousRamsayCraftingBatons", new List<craftingLevels>{
new craftingLevels(1.875f, 100),
new craftingLevels(2.175f, 110),
new craftingLevels(2.475f, 120),
new craftingLevels(2.775f, 130),
new craftingLevels(3.075f, 140)}),
new categoryCrafting("FuriousRamsayCraftingBatons", new List<craftingLevels>{
new craftingLevels(3.375f, 150),
new craftingLevels(3.675f, 160),
new craftingLevels(3.975f, 170),
new craftingLevels(4.275f, 180),
new craftingLevels(4.575f, 190)}),
new categoryCrafting("FuriousRamsayCraftingBatons", new List<craftingLevels>{
new craftingLevels(4.875f, 200),
new craftingLevels(5.175f, 210),
new craftingLevels(5.475f, 220),
new craftingLevels(5.775f, 230),
new craftingLevels(6.075f, 240)}),
new categoryCrafting("FuriousRamsayCraftingBatons", new List<craftingLevels>{
new craftingLevels(6.375f, 250),
new craftingLevels(6.675f, 260),
new craftingLevels(6.975f, 270),
new craftingLevels(7.275f, 280),
new craftingLevels(8.5f, 290)})
};
localExpertiseCrafting["Revolvers"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingRevolvers", new List<craftingLevels>{
new craftingLevels(0.75f, 50),
new craftingLevels(1.2f, 60),
new craftingLevels(1.65f, 70),
new craftingLevels(2.1f, 80),
new craftingLevels(2.55f, 90)}),
new categoryCrafting("FuriousRamsayCraftingRevolvers", new List<craftingLevels>{
new craftingLevels(3.0f, 100),
new craftingLevels(3.5f, 110),
new craftingLevels(3.95f, 120),
new craftingLevels(4.4f, 130),
new craftingLevels(4.85f, 140)}),
new categoryCrafting("FuriousRamsayCraftingRevolvers", new List<craftingLevels>{
new craftingLevels(5.3f, 150),
new craftingLevels(5.75f, 160),
new craftingLevels(6.2f, 170),
new craftingLevels(6.65f, 180),
new craftingLevels(7.1f, 190)})
};
localExpertiseCrafting["DeployableTurrets"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingDeployableTurrets", new List<craftingLevels>{
new craftingLevels(0.5f, 50),
new craftingLevels(1.25f, 60),
new craftingLevels(2f, 70),
new craftingLevels(2.75f, 80),
new craftingLevels(3.5f, 90)}),
new categoryCrafting("FuriousRamsayCraftingDeployableTurrets", new List<craftingLevels>{
new craftingLevels(4.25f, 100),
new craftingLevels(5f, 110),
new craftingLevels(5.75f, 120),
new craftingLevels(6.5f, 130),
new craftingLevels(7.25f, 140)})
};
localExpertiseCrafting["Knuckles"] = new List<categoryCrafting>{
new categoryCrafting("craftingKnuckles", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("craftingKnuckles", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.675f, 60),
new craftingLevels(0.975f, 70),
new craftingLevels(1.275f, 80),
new craftingLevels(1.575f, 90)}),
new categoryCrafting("craftingKnuckles", new List<craftingLevels>{
new craftingLevels(1.875f, 100),
new craftingLevels(2.175f, 110),
new craftingLevels(2.475f, 120),
new craftingLevels(2.775f, 130),
new craftingLevels(3.075f, 140)}),
new categoryCrafting("craftingKnuckles", new List<craftingLevels>{
new craftingLevels(3.375f, 150),
new craftingLevels(3.675f, 160),
new craftingLevels(3.975f, 170),
new craftingLevels(4.275f, 180),
new craftingLevels(4.575f, 190)}),
new categoryCrafting("craftingKnuckles", new List<craftingLevels>{
new craftingLevels(4.875f, 200),
new craftingLevels(5.175f, 210),
new craftingLevels(5.475f, 220),
new craftingLevels(5.775f, 230),
new craftingLevels(6.075f, 240)}),
new categoryCrafting("craftingKnuckles", new List<craftingLevels>{
new craftingLevels(6.375f, 250),
new craftingLevels(6.675f, 260),
new craftingLevels(6.975f, 270),
new craftingLevels(7.275f, 280),
new craftingLevels(8.5f, 290)})
};
localExpertiseCrafting["SubmachineGuns"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingSubmachineGuns", new List<craftingLevels>{
new craftingLevels(0.75f, 50),
new craftingLevels(1.25f, 60),
new craftingLevels(1.75f, 70),
new craftingLevels(2.25f, 80),
new craftingLevels(2.75f, 90)}),
new categoryCrafting("FuriousRamsayCraftingSubmachineGuns", new List<craftingLevels>{
new craftingLevels(3.25f, 100),
new craftingLevels(3.75f, 110),
new craftingLevels(4.25f, 120),
new craftingLevels(4.75f, 130),
new craftingLevels(5.25f, 140)}),
new categoryCrafting("FuriousRamsayCraftingSubmachineGuns", new List<craftingLevels>{
new craftingLevels(5.75f, 150),
new craftingLevels(6.25f, 160),
new craftingLevels(6.75f, 170),
new craftingLevels(7.25f, 180),
new craftingLevels(7.75f, 190)})
};
localExpertiseCrafting["Hammers"] = new List<categoryCrafting>{
new categoryCrafting("craftingSledgehammers", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("craftingSledgehammers", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.675f, 60),
new craftingLevels(0.975f, 70),
new craftingLevels(1.275f, 80),
new craftingLevels(1.575f, 90)}),
new categoryCrafting("craftingSledgehammers", new List<craftingLevels>{
new craftingLevels(1.875f, 100),
new craftingLevels(2.175f, 110),
new craftingLevels(2.475f, 120),
new craftingLevels(2.775f, 130),
new craftingLevels(3.075f, 140)}),
new categoryCrafting("craftingSledgehammers", new List<craftingLevels>{
new craftingLevels(3.375f, 150),
new craftingLevels(3.675f, 160),
new craftingLevels(3.975f, 170),
new craftingLevels(4.275f, 180),
new craftingLevels(4.575f, 190)}),
new categoryCrafting("craftingSledgehammers", new List<craftingLevels>{
new craftingLevels(4.875f, 200),
new craftingLevels(5.175f, 210),
new craftingLevels(5.475f, 220),
new craftingLevels(5.775f, 230),
new craftingLevels(6.075f, 240)}),
new categoryCrafting("craftingSledgehammers", new List<craftingLevels>{
new craftingLevels(6.375f, 250),
new craftingLevels(6.675f, 260),
new craftingLevels(6.975f, 270),
new craftingLevels(7.275f, 280),
new craftingLevels(8.5f, 290)})
};
localExpertiseCrafting["Pistols"] = new List<categoryCrafting>{
new categoryCrafting("craftingHandguns", new List<craftingLevels>{
new craftingLevels(0.75f, 50),
new craftingLevels(1.2f, 60),
new craftingLevels(1.65f, 70),
new craftingLevels(2.1f, 80),
new craftingLevels(2.55f, 90)}),
new categoryCrafting("craftingHandguns", new List<craftingLevels>{
new craftingLevels(3.0f, 100),
new craftingLevels(3.5f, 110),
new craftingLevels(3.95f, 120),
new craftingLevels(4.4f, 130),
new craftingLevels(4.85f, 140)}),
new categoryCrafting("craftingHandguns", new List<craftingLevels>{
new craftingLevels(5.3f, 150),
new craftingLevels(5.75f, 160),
new craftingLevels(6.2f, 170),
new craftingLevels(6.65f, 180),
new craftingLevels(7.1f, 190)})
};
localExpertiseCrafting["Knives"] = new List<categoryCrafting>{
new categoryCrafting("craftingBlades", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("craftingBlades", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.646f, 60),
new craftingLevels(0.917f, 70),
new craftingLevels(1.188f, 80),
new craftingLevels(1.459f, 90)}),
new categoryCrafting("craftingBlades", new List<craftingLevels>{
new craftingLevels(1.73f, 100),
new craftingLevels(2.001f, 110),
new craftingLevels(2.272f, 120),
new craftingLevels(2.543f, 130),
new craftingLevels(2.814f, 140)}),
new categoryCrafting("craftingBlades", new List<craftingLevels>{
new craftingLevels(3.085f, 150),
new craftingLevels(3.356f, 160),
new craftingLevels(3.627f, 170),
new craftingLevels(3.898f, 180),
new craftingLevels(4.169f, 190)}),
new categoryCrafting("craftingBlades", new List<craftingLevels>{
new craftingLevels(4.44f, 200),
new craftingLevels(4.711f, 210),
new craftingLevels(4.982f, 220),
new craftingLevels(5.253f, 230),
new craftingLevels(5.524f, 240)}),
new categoryCrafting("craftingBlades", new List<craftingLevels>{
new craftingLevels(5.795f, 250),
new craftingLevels(6.066f, 260),
new craftingLevels(6.337f, 270),
new craftingLevels(6.608f, 280),
new craftingLevels(6.879f, 290)}),
new categoryCrafting("craftingBlades", new List<craftingLevels>{
new craftingLevels(7.150f, 300),
new craftingLevels(7.421f, 310),
new craftingLevels(7.692f, 320),
new craftingLevels(7.953f, 330),
new craftingLevels(8.5f, 340)})
};
localExpertiseCrafting["HeavyHandguns"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingHeavyHandguns", new List<craftingLevels>{
new craftingLevels(0.75f, 50),
new craftingLevels(1.2f, 60),
new craftingLevels(1.65f, 70),
new craftingLevels(2.1f, 80),
new craftingLevels(2.55f, 90)}),
new categoryCrafting("FuriousRamsayCraftingHeavyHandguns", new List<craftingLevels>{
new craftingLevels(3.0f, 100),
new craftingLevels(3.5f, 110),
new craftingLevels(3.95f, 120),
new craftingLevels(4.4f, 130),
new craftingLevels(4.85f, 140)}),
new categoryCrafting("FuriousRamsayCraftingHeavyHandguns", new List<craftingLevels>{
new craftingLevels(5.3f, 150),
new craftingLevels(5.75f, 160),
new craftingLevels(6.2f, 170),
new craftingLevels(6.65f, 180),
new craftingLevels(7.1f, 190)})
};
localExpertiseCrafting["Scythes"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingScythes", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.075f, 10),
new craftingLevels(0.15f, 20),
new craftingLevels(0.225f, 30),
new craftingLevels(0.3f, 40)}),
new categoryCrafting("FuriousRamsayCraftingScythes", new List<craftingLevels>{
new craftingLevels(0.375f, 50),
new craftingLevels(0.750f, 60),
new craftingLevels(1.125f, 70),
new craftingLevels(1.5f, 80),
new craftingLevels(1.875f, 90)}),
new categoryCrafting("FuriousRamsayCraftingScythes", new List<craftingLevels>{
new craftingLevels(2.375f, 100),
new craftingLevels(2.750f, 110),
new craftingLevels(3.125f, 120),
new craftingLevels(3.5f, 130),
new craftingLevels(3.875f, 140)}),
new categoryCrafting("FuriousRamsayCraftingScythes", new List<craftingLevels>{
new craftingLevels(4.5f, 150),
new craftingLevels(4.875f, 160),
new craftingLevels(5.25f, 170),
new craftingLevels(5.625f, 180),
new craftingLevels(6.0f, 190)}),
new categoryCrafting("FuriousRamsayCraftingScythes", new List<craftingLevels>{
new craftingLevels(6.750f, 200),
new craftingLevels(7.125f, 210),
new craftingLevels(7.5f, 220),
new craftingLevels(7.875f, 230),
new craftingLevels(8.5f, 240)})
};
localExpertiseCrafting["TacticalRifles"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingTacticalRifles", new List<craftingLevels>{
new craftingLevels(0.75f, 50),
new craftingLevels(1.25f, 60),
new craftingLevels(1.75f, 70),
new craftingLevels(2.25f, 80),
new craftingLevels(2.75f, 90)}),
new categoryCrafting("FuriousRamsayCraftingTacticalRifles", new List<craftingLevels>{
new craftingLevels(3.25f, 100),
new craftingLevels(3.75f, 110),
new craftingLevels(4.25f, 120),
new craftingLevels(4.75f, 130),
new craftingLevels(5.25f, 140)}),
new categoryCrafting("FuriousRamsayCraftingTacticalRifles", new List<craftingLevels>{
new craftingLevels(5.75f, 150),
new craftingLevels(6.25f, 160),
new craftingLevels(6.75f, 170),
new craftingLevels(7.25f, 180),
new craftingLevels(7.75f, 190)})
};
localExpertiseCrafting["PipeRifle"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingPipeRifle", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.03f, 10),
new craftingLevels(0.06f, 20),
new craftingLevels(0.09f, 30),
new craftingLevels(0.12f, 40),
new craftingLevels(0.15f, 50)})
};
localExpertiseCrafting["PipeShotgun"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingPipeShotgun", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.05f, 10),
new craftingLevels(0.1f, 20),
new craftingLevels(0.15f, 30),
new craftingLevels(0.2f, 40),
new craftingLevels(0.25f, 50)})
};
localExpertiseCrafting["PipePistol"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingPipePistol", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.05f, 10),
new craftingLevels(0.1f, 20),
new craftingLevels(0.15f, 30),
new craftingLevels(0.2f, 40),
new craftingLevels(0.25f, 50)})
};
localExpertiseCrafting["PipeMachinegun"] = new List<categoryCrafting>{
new categoryCrafting("FuriousRamsayCraftingPipeMachinegun", new List<craftingLevels>{
new craftingLevels(0, 1),
new craftingLevels(0.05f, 10),
new craftingLevels(0.1f, 20),
new craftingLevels(0.15f, 30),
new craftingLevels(0.2f, 40),
new craftingLevels(0.25f, 50)})
};
// EXPERTISE-CLASS
localExpertiseClass["Spears"] = "Hunter";
localExpertiseClass["Bows"] = "Hunter";
localExpertiseClass["LongRangeRifles"] = "Hunter";
localExpertiseClass["Clubs"] = "Thug";
localExpertiseClass["Shotguns"] = "Thug";
localExpertiseClass["Swords"] = "Butcher";
localExpertiseClass["AssaultRifles"] = "Butcher";
localExpertiseClass["Axes"] = "Soldier";
localExpertiseClass["MachineGuns"] = "Soldier";
localExpertiseClass["Batons"] = "Technogeek";
localExpertiseClass["Revolvers"] = "Technogeek";
localExpertiseClass["DeployableTurrets"] = "Technogeek";
localExpertiseClass["Knuckles"] = "Madman";
localExpertiseClass["SubmachineGuns"] = "Madman";
//localExpertiseClass["Explosives"] = "Madman";
localExpertiseClass["Hammers"] = "Builder";
localExpertiseClass["Pistols"] = "Builder";
localExpertiseClass["ElectricTraps"] = "Builder";
localExpertiseClass["Knives"] = "Chef";
localExpertiseClass["HeavyHandguns"] = "Chef";
localExpertiseClass["Scythes"] = "WitchDoctor";
localExpertiseClass["TacticalRifles"] = "WitchDoctor";
localExpertiseClass["BlackMagic"] = "WitchDoctor";
localExpertiseClass["Melee"] = "Berserker";
localExpertiseClass["Rage"] = "Berserker";
localExpertiseLevelWithClass["WitchDoctor"] = "BlackMagic";
localExpertiseLevelWithClass["WitchDoctor"] = "BlackMagic";
localExpertiseLevelWithClass["Builder"] = "ElectricTraps";
localExpertiseTier["Spears"] = 1;
localExpertiseTier["Bows"] = 2;
localExpertiseTier["LongRangeRifles"] = 3;
localExpertiseTier["Clubs"] = 1;
localExpertiseTier["Shotguns"] = 2;
localExpertiseTier["Swords"] = 1;
localExpertiseTier["AssaultRifles"] = 2;
localExpertiseTier["Axes"] = 1;
localExpertiseTier["MachineGuns"] = 2;
localExpertiseTier["Batons"] = 1;
localExpertiseTier["Revolvers"] = 2;
localExpertiseTier["DeployableTurrets"] = 3;
localExpertiseTier["Knuckles"] = 1;
localExpertiseTier["SubmachineGuns"] = 2;
//localExpertiseTier["Explosives"] = 3;
localExpertiseTier["Hammers"] = 1;
localExpertiseTier["Pistols"] = 2;
localExpertiseTier["ElectricTraps"] = 3;
localExpertiseTier["Knives"] = 1;
localExpertiseTier["HeavyHandguns"] = 2;
localExpertiseTier["Scythes"] = 1;
localExpertiseTier["TacticalRifles"] = 2;
localExpertiseTier["BlackMagic"] = 3;
localExpertiseTier["Melee"] = 1;
localExpertiseTier["Rage"] = 2;
localClassPerk["Hunter"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkHunterArrowRainAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("perkFromTheShadows", new List<perkLevels>{
new perkLevels(2, 1),
new perkLevels(4, 2),
new perkLevels(6, 3),
new perkLevels(8, 4),
new perkLevels(10, 5)
}),
new classPerk("perkHiddenStrike", new List<perkLevels>{
new perkLevels(2, 1),
new perkLevels(4, 2),
new perkLevels(6, 3),
new perkLevels(8, 4),
new perkLevels(10, 5)
}),
new classPerk("perkInfiltrator", new List<perkLevels>{
new perkLevels(3, 1),
new perkLevels(6, 2),
new perkLevels(9, 3),
}),
new classPerk("perkAnimalTracker", new List<perkLevels>{
new perkLevels(3, 1),
new perkLevels(5, 2),
new perkLevels(7, 3),
})
};
localClassPerk["Thug"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkThugRangedStunAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
})
};
localClassPerk["Butcher"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkButcherRangedBleedAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("perkPainTolerance", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
})
};
localClassPerk["Soldier"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkSoldierRangedDoubleDamageAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
})
};
localClassPerk["Technogeek"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkTechnogeekRangedShockAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("perkSalvageOperations", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
})
};
localClassPerk["Madman"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkMadmanRangedExplosionAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("perkFlurryOfBlows", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
})
};
localClassPerk["Builder"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkElectricTraps", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("FuriousRamsayPerkBuilderRangedDismemberAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("perkPenetrator", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("perkWellInsulated", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
})
};
localClassPerk["Chef"] = new List<classPerk>{
new classPerk("perkTheHuntsman", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(3, 2),
new perkLevels(5, 3),
new perkLevels(7, 4),
new perkLevels(10, 5)
}),
new classPerk("FuriousRamsayPerkChefRangedSlashesAura", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
}),
new classPerk("perkLivingOffTheLand", new List<perkLevels>{
new perkLevels(3, 1),
new perkLevels(6, 2),
new perkLevels(9, 3)
})
};
localClassPerk["WitchDoctor"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkBlackMagic", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10)
})
};
localClassPerk["Berserker"] = new List<classPerk>{
new classPerk("FuriousRamsayPerkRage", new List<perkLevels>{
new perkLevels(1, 1),
new perkLevels(2, 2),
new perkLevels(3, 3),
new perkLevels(4, 4),
new perkLevels(5, 5),
new perkLevels(6, 6),
new perkLevels(7, 7),
new perkLevels(8, 8),
new perkLevels(9, 9),
new perkLevels(10, 10),
new perkLevels(11, 11),
new perkLevels(12, 12),
new perkLevels(13, 13),
new perkLevels(14, 14),
new perkLevels(15, 15)
})
};
localVariables["$varFuriousRamsayAchievementHuntingExp"] = 0f;
localVariables["$varFuriousRamsayAchievementChargedAssaultExp"] = 0f;
localVariables["$varFuriousRamsayAchievementCropsExp"] = 0f;
localVariables["$varFuriousRamsayAchievementFarmerTraderExp"] = 0f;
localVariables["$varFuriousRamsayAchievementHandymanTraderExp"] = 0f;
localVariables["$varFuriousRamsayAchievementBlackShieldTraderExp"] = 0f;
localVariables["$varFuriousRamsayAchievementAgilityAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementArmorPenetrationAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementAttackSpeedAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementBlockDamageAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementFireRateAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementFortuityAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementHealingAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementMobilityAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementPierceAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementPreservationAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementShadowAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementStabilityAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementStaminaAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementTradeAuraExp"] = 0f;
localVariables["$varFuriousRamsayAchievementVitalityAuraExp"] = 0f;
localVariables["$varFuriousRamsayStrengthPercUnit"] = 0f;
localVariables["$varFuriousRamsayDexterityPercUnit"] = 0f;
localVariables["$varFuriousRamsayConstitutionPercUnit"] = 0f;
localVariables["$varFuriousRamsayIntelligencePercUnit"] = 0f;
localVariables["$varFuriousRamsayCharismaPercUnit"] = 0f;
localVariables["$varFuriousRamsaySalvageToolsPercUnit"] = 0f;
localVariables["$varFuriousRamsaySalvageVehiclesPercUnit"] = 0f;
localVariables["$varFuriousRamsayMinePercUnit"] = 0f;
localVariables["$varFuriousRamsayDigPercUnit"] = 0f;
localVariables["$varFuriousRamsayChopPercUnit"] = 0f;
localVariables["$varFuriousRamsayHunterPercUnit"] = 1f;
localVariables["$varFuriousRamsayThugPercUnit"] = 1f;
localVariables["$varFuriousRamsayButcherPercUnit"] = 1f;
localVariables["$varFuriousRamsaySoldierPercUnit"] = 1f;
localVariables["$varFuriousRamsayTechnogeekPercUnit"] = 1f;
localVariables["$varFuriousRamsayMadmanPercUnit"] = 1f;
localVariables["$varFuriousRamsayBuilderPercUnit"] = 1f;
localVariables["$varFuriousRamsayChefPercUnit"] = 1f;
localVariables["$varFuriousRamsayWitchDoctorPercUnit"] = 1f;
localVariables["$varFuriousRamsayBerserkerPercUnit"] = 1f;
localVariables["$varFuriousRamsaySpearsPercUnit"] = 0f;
localVariables["$varFuriousRamsayBowsPercUnit"] = 0f;
localVariables["$varFuriousRamsayLongRangeRiflesPercUnit"] = 0f;
localVariables["$varFuriousRamsayClubsPercUnit"] = 0f;
localVariables["$varFuriousRamsayShotgunsPercUnit"] = 0f;
localVariables["$varFuriousRamsaySwordsPercUnit"] = 0f;
localVariables["$varFuriousRamsayAssaultRiflesPercUnit"] = 0f;
localVariables["$varFuriousRamsayAxesPercUnit"] = 0f;
localVariables["$varFuriousRamsayMachineGunsPercUnit"] = 0f;
localVariables["$varFuriousRamsayBatonsPercUnit"] = 0f;
localVariables["$varFuriousRamsayRevolversPercUnit"] = 0f;
localVariables["$varFuriousRamsayDeployableTurretsPercUnit"] = 0f;
localVariables["$varFuriousRamsayKnucklesPercUnit"] = 0f;
//localVariables["$varFuriousRamsayExplosivesPercUnit"] = 0f;
localVariables["$varFuriousRamsaySubmachineGunsPercUnit"] = 0f;
localVariables["$varFuriousRamsayHammersPercUnit"] = 0f;
localVariables["$varFuriousRamsayPistolsPercUnit"] = 0f;
localVariables["$varFuriousRamsayElectricTrapsPercUnit"] = 0f;
localVariables["$varFuriousRamsayKnivesPercUnit"] = 0f;
localVariables["$varFuriousRamsayHeavyHandgunsPercUnit"] = 0f;
localVariables["$varFuriousRamsayScythesPercUnit"] = 0f;
localVariables["$varFuriousRamsayTacticalRiflesPercUnit"] = 0f;
localVariables["$varFuriousRamsayBlackMagicPercUnit"] = 0f;
localVariables["$varFuriousRamsayMeleePercUnit"] = 0f;
localVariables["$varFuriousRamsayRagePercUnit"] = 0f;
localVariables["$varFuriousRamsayPipeRiflePercUnit"] = 0f;
localVariables["$varFuriousRamsayPipeShotgunPercUnit"] = 0f;
localVariables["$varFuriousRamsayPipePistolPercUnit"] = 0f;
localVariables["$varFuriousRamsayPipeMachinegunPercUnit"] = 0f;
// RAMPAGE
localConstants["$varFuriousRamsayRampageMax_Cst"] = 0f;
// MISERY
localConstants["$varFuriousRamsayTheyGrowStrongerKills_Cst"] = 0f;
localConstants["$varFuriousRamsayNaturalSelection01_Cst"] = 500f;
localConstants["$varFuriousRamsayNaturalSelection02_Cst"] = 1250f;
localConstants["$varFuriousRamsayNaturalSelection03_Cst"] = 2000f;
localConstants["$varFuriousRamsayNaturalSelection04_Cst"] = 3500f;
localConstants["$varFuriousRamsayNaturalSelection05_Cst"] = 6000f;
localConstants["$varFuriousRamsayNaturalSelection06_Cst"] = 9000f;
localConstants["$varFuriousRamsayNaturalSelection07_Cst"] = 13500f;
localConstants["$varFuriousRamsayNaturalSelection08_Cst"] = 18000f;
localConstants["$varFuriousRamsayNaturalSelection09_Cst"] = 25000f;
localConstants["$varFuriousRamsayNaturalSelection10_Cst"] = 35000f;
localConstants["$varFuriousRamsayAscension01_Cst"] = 10f;
localConstants["$varFuriousRamsayAscension02_Cst"] = 20f;
localConstants["$varFuriousRamsayAscension03_Cst"] = 30f;
localConstants["$varFuriousRamsayAscension04_Cst"] = 40f;
localConstants["$varFuriousRamsayAscension05_Cst"] = 50f;
localConstants["$varFuriousRamsayAscension06_Cst"] = 60f;
localConstants["$varFuriousRamsayAscension07_Cst"] = 70f;
localConstants["$varFuriousRamsayAscension08_Cst"] = 80f;
localConstants["$varFuriousRamsayAscension09_Cst"] = 90f;
localConstants["$varFuriousRamsayAscension10_Cst"] = 100f;
localConstants["$varFuriousRamsayRebirth01_Cst"] = 15f;
localConstants["$varFuriousRamsayRebirth02_Cst"] = 30f;
localConstants["$varFuriousRamsayRebirth03_Cst"] = 45f;
localConstants["$varFuriousRamsayRebirth04_Cst"] = 60f;
localConstants["$varFuriousRamsayRebirth05_Cst"] = 75f;
localConstants["$varFuriousRamsayRebirth06_Cst"] = 90f;
localConstants["$varFuriousRamsayRebirth07_Cst"] = 105f;
localConstants["$varFuriousRamsayRebirth08_Cst"] = 120f;
localConstants["$varFuriousRamsayRebirth09_Cst"] = 135f;
localConstants["$varFuriousRamsayRebirth10_Cst"] = 150f;
// GLOBAL ACHIEVEMENTS
localConstants["$varFuriousRamsayAchievementHuntingExpLvl1_Cst"] = 25f;
localConstants["$varFuriousRamsayAchievementHuntingExpLvl2_Cst"] = 75f;
localConstants["$varFuriousRamsayAchievementHuntingExpLvl3_Cst"] = 150f;
localConstants["$varFuriousRamsayAchievementHuntingExpLvl4_Cst"] = 300f;
localConstants["$varFuriousRamsayAchievementHuntingExpLvl5_Cst"] = 600f;
localConstants["$varFuriousRamsayAchievementCropsExpLvl1_Cst"] = 100f;
localConstants["$varFuriousRamsayAchievementCropsExpLvl2_Cst"] = 300f;
localConstants["$varFuriousRamsayAchievementCropsExpLvl3_Cst"] = 600f;
localConstants["$varFuriousRamsayAchievementFarmerTraderExpLvl1_Cst"] = 50f;
localConstants["$varFuriousRamsayAchievementHandymanTraderExpLvl1_Cst"] = 100f;
localConstants["$varFuriousRamsayAchievementBlackShieldTraderExpLvl1_Cst"] = 150f;
localConstants["$varFuriousRamsayAchievementHealingAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementHealingAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementHealingAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementStaminaAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementStaminaAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementStaminaAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementMobilityAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementMobilityAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementMobilityAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementArmorPenetrationAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementArmorPenetrationAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementArmorPenetrationAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementBlockDamageAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementBlockDamageAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementBlockDamageAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementFireRateAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementFireRateAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementFireRateAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementAttackSpeedAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementAttackSpeedAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementAttackSpeedAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementShadowAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementShadowAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementShadowAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementVitalityAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementVitalityAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementVitalityAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementAgilityAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementAgilityAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementAgilityAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementPierceAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementPierceAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementPierceAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementTradeAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementTradeAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementTradeAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementPreservationAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementPreservationAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementPreservationAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementFortuityAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementFortuityAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementFortuityAuraExpLvl3_Cst"] = 165f;
localConstants["$varFuriousRamsayAchievementStabilityAuraExpLvl1_Cst"] = 35f;
localConstants["$varFuriousRamsayAchievementStabilityAuraExpLvl2_Cst"] = 90f;
localConstants["$varFuriousRamsayAchievementStabilityAuraExpLvl3_Cst"] = 165f;
// CLASS ACHIEVEMENTS
localConstants["$varFuriousRamsayAchievementChargedAssaultExpLvl1_Cst"] = 40f;
localConstants["$varFuriousRamsayAchievementChargedAssaultExpLvl2_Cst"] = 100f;
localConstants["$varFuriousRamsayAchievementChargedAssaultExpLvl3_Cst"] = 200f;
localConstants["$varFuriousRamsayAchievementChargedAssaultExpLvl4_Cst"] = 400f;
localConstants["$varFuriousRamsayAchievementChargedAssaultExpLvl5_Cst"] = 700f;
// MULTIPLIERS
localConstants["$varFuriousRamsayExperienceDamageBodyMultiplier_Cst"] = 0.05f;
localConstants["$varFuriousRamsayExperienceKillBodyMultiplier_Cst"] = 1f;
//localConstants["$varFuriousRamsayExperienceDamageHeadMultiplier_Cst"] = 0.1f;
//localConstants["$varFuriousRamsayExperienceKillHeadMultiplier_Cst"] = 2f;
localConstants["$varFuriousRamsayExperienceDamageHeadMultiplier_Cst"] = 0.075f;
localConstants["$varFuriousRamsayExperienceKillHeadMultiplier_Cst"] = 1.25f;
// HUD
localConstants["$varFuriousRamsayHNHeadShots_Cst"] = 0f;
localConstants["$varFuriousRamsayHNKills_Cst"] = 0f;
localConstants["$varFuriousRamsayClassPercUnit"] = 0f;
localConstants["$varFuriousRamsayActionInProgress"] = 0f;
localConstants["$restrictNumHires"] = 0f;
localConstants["$varFuriousRamsayPerk1PercUnit"] = 0f;
localConstants["$varFuriousRamsayPerk2PercUnit"] = 0f;
localConstants["$varFuriousRamsayPerk3PercUnit"] = 0f;
// GENETICS
localConstants["$varFuriousRamsayStrengthUnitPercIncrease_Cst"] = 0.1f;
localConstants["$varFuriousRamsayDexterityUnitPercIncrease_Cst"] = 0.1f;
localConstants["$varFuriousRamsayConstitutionUnitPercIncrease_Cst"] = 0.1f;
localConstants["$varFuriousRamsayIntelligenceUnitPercIncrease_Cst"] = 0.1f;
localConstants["$varFuriousRamsayCharismaUnitPercIncrease_Cst"] = 0.1f;
// CLASSES
localConstants["$varFuriousRamsayClassUnitPercIncrease_Cst"] = 0.01f;
// PLAYER LEVEL TIERS
localConstants["$varFuriousRamsayPlayerLevelTier1_Cst"] = 25f;
localConstants["$varFuriousRamsayPlayerLevelTier2_Cst"] = 50f;
localConstants["$varFuriousRamsayPlayerLevelTier3_Cst"] = 75f;
localConstants["$varFuriousRamsayPlayerLevelTier4_Cst"] = 100f;
// CROSSHAIR HUD
localConstants["$varFuriousRamsayCrossHairHUDHealthThreshold_Cst"] = 0.6f;
localConstants["$varFuriousRamsayCrossHairHUDStaminaThreshold_Cst"] = 0.8f;
localConstants["$varFuriousRamsayCrossHairHUDWaterThreshold_Cst"] = 0.6f;
localConstants["$varFuriousRamsayCrossHairHUDFoodThreshold_Cst"] = 0.5f;
// EXPERIENCE MULTIPLIERS
localConstants["$varFuriousRamsayClassMultiplierConfig_Cst"] = 0.75f;
localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"] = 4.5f;
// STRENGTH
localConstants["$varFuriousRamsayIncreaseStrengthTier1_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthTier2_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthTier3_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthTier4_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthTier5_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthTier6_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// DEXTERITY
localConstants["$varFuriousRamsayIncreaseDexterityTier1_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseDexterityTier2_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseDexterityTier3_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseDexterityTier4_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseDexterityTier5_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseDexterityTier6_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// CONSTITUTION
localConstants["$varFuriousRamsayIncreaseConstitutionTier1_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseConstitutionTier2_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseConstitutionTier3_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseConstitutionTier4_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseConstitutionTier5_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseConstitutionTier6_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// INTELLIGENCE
localConstants["$varFuriousRamsayIncreaseIntelligenceTier1_Cst"] = 0.01f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseIntelligenceTier2_Cst"] = 0.0125f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseIntelligenceTier3_Cst"] = 0.015f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseIntelligenceTier4_Cst"] = 0.0175f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseIntelligenceTier5_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseIntelligenceTier6_Cst"] = 0.0225f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// CHARISMA
localConstants["$varFuriousRamsayIncreaseCharismaTier1_Cst"] = 0.01f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCharismaTier2_Cst"] = 0.02f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCharismaTier3_Cst"] = 0.03f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCharismaTier4_Cst"] = 0.04f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCharismaTier5_Cst"] = 0.05f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCharismaTier6_Cst"] = 0.06f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// EXCEPTION
localConstants["ExceptionPipeMachineGun"] = 650f;
localConstants["ExceptionPipePistol"] = 350f;
// PIPE RIFLES
localConstants["$varFuriousRamsayPipeRifleIncrement_Cst"] = 275f;
//localConstants["$varFuriousRamsayPipeRifleMultiplier_Cst"] = 0.65f;
localConstants["$varFuriousRamsayPipeRifleMultiplier_Cst"] = 0.87f;
localConstants["$varFuriousRamsayPipeShotgunIncrement_Cst"] = 200f;
//localConstants["$varFuriousRamsayPipeShotgunMultiplier_Cst"] = 0.52f;
localConstants["$varFuriousRamsayPipeShotgunMultiplier_Cst"] = 0.69f;
localConstants["$varFuriousRamsayPipePistolIncrement_Cst"] = 220;
//localConstants["$varFuriousRamsayPipePistolMultiplier_Cst"] = 0.625f;
localConstants["$varFuriousRamsayPipePistolMultiplier_Cst"] = 0.83f;
localConstants["$varFuriousRamsayPipeMachinegunIncrement_Cst"] = 415f;
//localConstants["$varFuriousRamsayPipeMachinegunMultiplier_Cst"] = 1.08f;
localConstants["$varFuriousRamsayPipeMachinegunMultiplier_Cst"] = 1.44f;
// HUNTER
localConstants["$varFuriousRamsayHunterIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsaySpearsIncrement_Cst"] = 500f;
localConstants["$varFuriousRamsayBowsIncrement_Cst"] = 175f;
localConstants["$varFuriousRamsayLongRangeRiflesIncrement_Cst"] = 275f;
localConstants["$varFuriousRamsaySpearsMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayBowsMultiplier_Cst"] = 2f;
localConstants["$varFuriousRamsayLongRangeRiflesMultiplier_Cst"] = 1.75f;
// THUG
localConstants["varFuriousRamsayThugIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayClubsIncrement_Cst"] = 500f;
localConstants["$varFuriousRamsayShotgunsIncrement_Cst"] = 500f;
localConstants["$varFuriousRamsayClubsMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayShotgunsMultiplier_Cst"] = 2.5f;
// BUTCHER
localConstants["varFuriousRamsayButcherIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsaySwordsIncrement_Cst"] = 400f;
localConstants["$varFuriousRamsayAssaultRiflesIncrement_Cst"] = 650f;
localConstants["$varFuriousRamsaySwordsMultiplier_Cst"] = 1.75f;
localConstants["$varFuriousRamsayAssaultRiflesMultiplier_Cst"] = 2.5f;
// SOLDIER
localConstants["varFuriousRamsaySoldierIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayAxesIncrement_Cst"] = 550f;
localConstants["$varFuriousRamsayMachineGunsIncrement_Cst"] = 800f;
localConstants["$varFuriousRamsayAxesMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayMachineGunsMultiplier_Cst"] = 2.5f;
// TECHNOGEEK
localConstants["varFuriousRamsayTechnogeekIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayBatonsIncrement_Cst"] = 475f;
localConstants["$varFuriousRamsayRevolversIncrement_Cst"] = 450f;
localConstants["$varFuriousRamsayDeployableTurretsIncrement_Cst"] = 400f;
localConstants["$varFuriousRamsayBatonsMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayRevolversMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayDeployableTurretsMultiplier_Cst"] = 2.5f;
// MADMAN
localConstants["varFuriousRamsayMadmanIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayKnucklesIncrement_Cst"] = 700f;
localConstants["$varFuriousRamsayExplosivesIncrement_Cst"] = 400f;
localConstants["$varFuriousRamsaySubmachineGunsIncrement_Cst"] = 800f;
localConstants["$varFuriousRamsayKnucklesMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayExplosivesMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsaySubmachineGunsMultiplier_Cst"] = 2.5f;
// BUILDER
localConstants["varFuriousRamsayBuilderIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayHammersIncrement_Cst"] = 400f;
localConstants["$varFuriousRamsayPistolsIncrement_Cst"] = 550f;
localConstants["$varFuriousRamsayElectricTrapsIncrement_Cst"] = 999f;
localConstants["$varFuriousRamsayHammersMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayPistolsMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayElectricTrapsMultiplier_Cst"] = 2.5f;
// CHEF
localConstants["varFuriousRamsayChefIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayKnivesIncrement_Cst"] = 500f;
localConstants["$varFuriousRamsayHeavyHandgunsIncrement_Cst"] = 450f;
localConstants["$varFuriousRamsayKnivesMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayHeavyHandgunsMultiplier_Cst"] = 2.5f;
// WITCH DOCTOR
localConstants["varFuriousRamsayWitchDoctorIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayScythesIncrement_Cst"] = 400f;
localConstants["$varFuriousRamsayTacticalRiflesIncrement_Cst"] = 650f;
localConstants["$varFuriousRamsayBlackMagicIncrement_Cst"] = 999f;
localConstants["$varFuriousRamsayScythesMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayTacticalRiflesMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayBlackMagicMultiplier_Cst"] = 2.5f;
// BERSERKER
localConstants["varFuriousRamsayBerserkerIncrement_Cst"] = 100f;
localConstants["$varFuriousRamsayMeleeIncrement_Cst"] = 400f;
localConstants["$varFuriousRamsayMeleeMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayRageMultiplier_Cst"] = 2.5f;
localConstants["$varFuriousRamsayIncreaseIntelligenceReadSchematic"] = 0.0020f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseSalvageVehiclesReadMagazine"] = 0.015f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// LBD TIER 1
localConstants["$varFuriousRamsayIncreaseFightingStrengthTier1"] = 0.00066f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingDexterityTier1"] = 0.0003f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingConstitutionTier1"] = 0.0003f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingIntelligenceTier1"] = 0.0006f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingCharismaTier1"] = 0.0002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthBreakingOreTier1"] = 0.0000002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthDiggingTier1"] = 0.0000002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCutTreesTier1"] = 0.0000002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsaySalvageTier1"] = 0.0000002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseLootedTier1"] = 0.000018f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseReceivedDamageTier1"] = 0.0005f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsLowTier1"] = 0.0005f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsMediumTier1"] = 0.002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsHighTier1"] = 0.004f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseMobilityTier1"] = 0.0001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// LBD TIER 2
localConstants["$varFuriousRamsayIncreaseFightingStrengthTier2"] = 0.0006325f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingDexterityTier2"] = 0.000275f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingConstitutionTier2"] = 0.000275f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingIntelligenceTier2"] = 0.000575f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingCharismaTier2"] = 0.000175f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthBreakingOreTier2"] = 0.00000018f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthDiggingTier2"] = 0.00000018f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCutTreesTier2"] = 0.00000018f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsaySalvageTier2"] = 0.00000018f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseLootedTier2"] = 0.000014f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseReceivedDamageTier2"] = 0.0004f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsLowTier2"] = 0.001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsMediumTier2"] = 0.0075f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsHighTier2"] = 0.01f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseMobilityTier2"] = 0.00008f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// LBD TIER 3
localConstants["$varFuriousRamsayIncreaseFightingStrengthTier3"] = 0.000605f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingDexterityTier3"] = 0.00025f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingConstitutionTier3"] = 0.00025f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingIntelligenceTier3"] = 0.00055f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingCharismaTier3"] = 0.00015f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthBreakingOreTier3"] = 0.00000016f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthDiggingTier3"] = 0.00000016f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCutTreesTier3"] = 0.00000016f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsaySalvageTier3"] = 0.00000016f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseLootedTier3"] = 0.00001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseReceivedDamageTier3"] = 0.0003f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsLowTier3"] = 0.001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsMediumTier3"] = 0.0075f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsHighTier3"] = 0.01f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseMobilityTier3"] = 0.00006f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// LBD TIER 4
localConstants["$varFuriousRamsayIncreaseFightingStrengthTier4"] = 0.0005775f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingDexterityTier4"] = 0.000225f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingConstitutionTier4"] = 0.000225f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingIntelligenceTier4"] = 0.000525f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingCharismaTier4"] = 0.000125f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthBreakingOreTier4"] = 0.00000014f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthDiggingTier4"] = 0.00000014f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCutTreesTier4"] = 0.00000014f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsaySalvageTier4"] = 0.00000014f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseLootedTier4"] = 0.000008f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseReceivedDamageTier4"] = 0.0002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsLowTier4"] = 0.001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsMediumTier4"] = 0.0075f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsHighTier4"] = 0.01f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseMobilityTier4"] = 0.00004f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
// LBD TIER 5
localConstants["$varFuriousRamsayIncreaseFightingStrengthTier5"] = 0.00055f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingDexterityTier5"] = 0.0002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingConstitutionTier5"] = 0.0002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingIntelligenceTier5"] = 0.0005f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseFightingCharismaTier5"] = 0.0001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthBreakingOreTier5"] = 0.00000012f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseStrengthDiggingTier5"] = 0.00000012f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseCutTreesTier5"] = 0.00000012f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsaySalvageTier5"] = 0.00000012f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseLootedTier5"] = 0.000004f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseReceivedDamageTier5"] = 0.0001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsLowTier5"] = 0.001f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsMediumTier5"] = 0.0075f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseUseDrugsHighTier5"] = 0.01f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
localConstants["$varFuriousRamsayIncreaseMobilityTier5"] = 0.00002f * localConstants["$varFuriousRamsayGeneticsMultiplierConfig_Cst"];
}
}