// Needs improvement. Causes a lot of lag public static void Mobs() { foreach (var hurtbox in Main.hurtBoxes) { var mob = HurtBox.FindEntityObject(hurtbox); if (mob) { Vector3 MobPosition = Camera.main.WorldToScreenPoint(mob.transform.position); var MobBoundingVector = new Vector3(MobPosition.x, MobPosition.y, MobPosition.z); float distanceToMob = Vector3.Distance(Camera.main.transform.position, mob.transform.position); if (MobBoundingVector.z > 0.01) { float width = 100f * (distanceToMob / 100); if (width > 125) { width = 125; } float height = 100f * (distanceToMob / 100); if (height > 125) { height = 125; } string mobName = mob.name.Replace("Body(Clone)", ""); int mobDistance = (int)distanceToMob; string mobBoxText = $"{mobName}\n{mobDistance}m"; GUI.Label(new Rect(MobBoundingVector.x - 50f, (float)Screen.height - MobBoundingVector.y + 50f, 100f, 50f), mobBoxText, Main.renderMobsStyle); } } } }
public static void Mobs() { for (int i = 0; i < hurtBoxes.Count; i++) { var mob = HurtBox.FindEntityObject(hurtBoxes[i]); if (mob) { Vector3 MobPosition = Camera.main.WorldToScreenPoint(mob.transform.position); var MobBoundingVector = new Vector3(MobPosition.x, MobPosition.y, MobPosition.z); float distanceToMob = Vector3.Distance(Camera.main.transform.position, mob.transform.position); if (MobBoundingVector.z > 0.01) { float width = 100f * (distanceToMob / 100); if (width > 125) { width = 125; } float height = 100f * (distanceToMob / 100); if (height > 125) { height = 125; } string mobName = mob.name.Replace("Body(Clone)", ""); int mobDistance = (int)distanceToMob; string mobBoxText = $"{mobName}\n{mobDistance}m"; GUI.Label(new Rect(MobBoundingVector.x - 50f, (float)Screen.height - MobBoundingVector.y + 50f, 100f, 50f), mobBoxText, Styles.RenderMobsStyle); ESPHelper.DrawBox(MobBoundingVector.x - width / 2, (float)Screen.height - MobBoundingVector.y - height / 2, width, height, new Color32(255, 0, 0, 255)); } } } }
public static void KillAllMobs() { var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return; } var body = controller.master.GetBody(); if (!body) { return; } var bullseyeSearch = new BullseyeSearch { filterByLoS = false, maxDistanceFilter = float.MaxValue, maxAngleFilter = float.MaxValue }; List <string> survivor_names = new List <string>(); foreach (SurvivorDef def in SurvivorCatalog.allSurvivorDefs) { survivor_names.Add(def.cachedName); } bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults(); foreach (var hurtbox in hurtBoxList) { var mob = HurtBox.FindEntityObject(hurtbox); string mobName = mob.name.Replace("Body(Clone)", ""); if (survivor_names.Contains(mobName)) { continue; } else { var health = mob.GetComponent <HealthComponent>(); health.Suicide(); Chat.AddMessage($"<color=yellow>Killed {mobName} </color>"); } } }
public static List <HurtBox> GetHurtBoxes() { string[] allowedBoxes = { "Golem", "Jellyfish", "Wisp", "Beetle", "Lemurian", "Imp", "HermitCrab", "ClayBruiser", "Bell", "BeetleGuard", "MiniMushroom", "Bison", "GreaterWisp", "LemurianBruiser", "RoboBallMini", "Vulture", /* BOSSES */ "BeetleQueen2", "ClayDunestrider", "Titan", "TitanGold", "TitanBlackBeach", "Grovetender", "Gravekeeper", "Mithrix", "Aurelionite", "Vagrant", "MagmaWorm", "ImpBoss", "ElectricWorm", "RoboBallBoss", "Nullifier", "Parent", "Scav", "ScavLunar1", "ClayBoss", "LunarGolem", "LunarWisp", "Brother", "BrotherHurt" }; var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return(null); } var body = controller.master.GetBody(); if (!body) { return(null); } var inputBank = body.GetComponent <InputBankTest>(); var aimRay = new Ray(inputBank.aimOrigin, inputBank.aimDirection); var bullseyeSearch = new BullseyeSearch(); var team = body.GetComponent <TeamComponent>(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.maxDistanceFilter = 125; bullseyeSearch.maxAngleFilter = 40f; bullseyeSearch.teamMaskFilter = TeamMask.all; bullseyeSearch.teamMaskFilter.RemoveTeam(team.teamIndex); bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults().ToList(); List <HurtBox> updatedHurtboxes = new List <HurtBox>(); for (int i = 0; i < hurtBoxList.Count; i++) { HurtBox hurtBox = hurtBoxList[i]; var mobName = HurtBox.FindEntityObject(hurtBox).name.Replace("Body(Clone)", ""); if (allowedBoxes.Contains(mobName)) { updatedHurtboxes.Add(hurtBox); } /*else * { * WriteToLog($"Blocked: {mobName}"); * }*/ } return(updatedHurtboxes); }
// Clears inventory, duh. public static void ClearInventory() { if (Main.LocalPlayerInv) { // Loops through every item in ItemIndex enum foreach (string itemName in CurrentInventory()) { ItemIndex itemIndex = (ItemIndex)Enum.Parse(typeof(ItemIndex), itemName); //Convert itemName string to and ItemIndex // If an item exists, delete the whole stack of it Main.LocalPlayerInv.itemAcquisitionOrder.Remove(itemIndex); Main.LocalPlayerInv.ResetItem(itemIndex); int itemCount = Main.LocalPlayerInv.GetItemCount(itemIndex); Main.LocalPlayerInv.RemoveItem(itemIndex, itemCount); // Destroys BeetleGuardAllies on inventory clear, other wise they dont get removed until next stage. var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return; } var body = controller.master.GetBody(); if (!body) { return; } var bullseyeSearch = new BullseyeSearch { filterByLoS = false, maxDistanceFilter = float.MaxValue, maxAngleFilter = float.MaxValue }; bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults(); foreach (var hurtbox in hurtBoxList) { var mob = HurtBox.FindEntityObject(hurtbox); string mobName = mob.name.Replace("Body(Clone)", ""); if (mobName == "BeetleGuardAlly") { var health = mob.GetComponent <HealthComponent>(); health.Suicide(); } } } Main.LocalPlayerInv.SetEquipmentIndex(EquipmentIndex.None); } PlayerMod.RemoveAllBuffs(); }
// Needs improvement. Causes a lot of lag public static void Mobs() { var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return; } var body = controller.master.GetBody(); if (!body) { return; } var inputBank = body.GetComponent <InputBankTest>(); var aimRay = new Ray(inputBank.aimOrigin, inputBank.aimDirection); var bullseyeSearch = new BullseyeSearch(); var team = body.GetComponent <TeamComponent>(); bullseyeSearch.searchOrigin = aimRay.origin; bullseyeSearch.searchDirection = aimRay.direction; bullseyeSearch.filterByLoS = false; bullseyeSearch.maxDistanceFilter = 125; bullseyeSearch.maxAngleFilter = 40f; bullseyeSearch.teamMaskFilter = TeamMask.all; bullseyeSearch.teamMaskFilter.RemoveTeam(team.teamIndex); bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults(); foreach (var hurtbox in hurtBoxList) { var mob = HurtBox.FindEntityObject(hurtbox); if (mob) { Vector3 MobPosition = Camera.main.WorldToScreenPoint(mob.transform.position); var MobBoundingVector = new Vector3(MobPosition.x, MobPosition.y, MobPosition.z); float distanceToMob = Vector3.Distance(Camera.main.transform.position, mob.transform.position); if (MobBoundingVector.z > 0.01) { string mobName = mob.name.Replace("Body(Clone)", ""); int mobDistance = (int)distanceToMob; string mobBoxText = $"{mobName}\n{mobDistance}m"; GUI.Label(new Rect(MobBoundingVector.x - 50f, (float)Screen.height - MobBoundingVector.y + 30f, 100f, 50f), mobBoxText, Main.renderMobsStyle); } } } }
public static void KillAll() { var localUser = LocalUserManager.GetFirstLocalUser(); var controller = localUser.cachedMasterController; if (!controller) { return; } var body = controller.master.GetBody(); if (!body) { return; } var bullseyeSearch = new BullseyeSearch { filterByLoS = false, maxDistanceFilter = float.MaxValue, maxAngleFilter = float.MaxValue }; var team = body.GetComponent <TeamComponent>(); bullseyeSearch.teamMaskFilter = TeamMask.AllExcept(team.teamIndex); bullseyeSearch.RefreshCandidates(); var hurtBoxList = bullseyeSearch.GetResults(); foreach (var hurtbox in hurtBoxList) { var mob = HurtBox.FindEntityObject(hurtbox); string mobName = mob.name.Replace("Body(Clone)", ""); // Create Chat message with this. var health = mob.GetComponent <HealthComponent>(); health.Suicide(); Chat.AddMessage($"<color=yellow>Killed {mobName} </color>"); } }