public void Execute(IRocketPlayer caller, string[] command) { var unturnedPlayer = (UnturnedPlayer)caller; if (coolDown.ContainsKey(unturnedPlayer.CSteamID) || coolDown.FirstOrDefault(x => x.Key == unturnedPlayer.CSteamID).Value > DateTime.Now) { var secondsLeft = coolDown.FirstOrDefault(x => x.Key == unturnedPlayer.CSteamID).Value - DateTime.Now; ChatManager.serverSendMessage( $"<b>{secondsLeft}</b> seconds left".Replace("{", "<").Replace("}", ">"), Color.yellow, null, unturnedPlayer.SteamPlayer(), EChatMode.SAY, null, true); return; } if (coolDown.FirstOrDefault(x => x.Key == unturnedPlayer.CSteamID).Value > DateTime.Now) { coolDown.Remove(unturnedPlayer.CSteamID); } if (!BarricadeManager.tryGetBed(unturnedPlayer.CSteamID, out _, out _)) { ChatManager.serverSendMessage( $"no bed", Color.yellow, null, unturnedPlayer.SteamPlayer(), EChatMode.SAY, null, true); return; } if (unturnedPlayer.Stance == EPlayerStance.DRIVING || unturnedPlayer.Stance == EPlayerStance.DRIVING) { ChatManager.serverSendMessage( $"in vehicle", Color.yellow, null, unturnedPlayer.SteamPlayer(), EChatMode.SAY, null, true); return; } unturnedPlayer.Player.teleportToBed(); ChatManager.serverSendMessage( $"teleported to bed", Color.cyan, null, unturnedPlayer.SteamPlayer(), EChatMode.SAY, null, true); coolDown.Add(unturnedPlayer.CSteamID, DateTime.Now.AddSeconds(PSRMEssentials.Instance.Configuration.Instance.HomeConfig.Cooldown)); }
public static void RunUtilityTool(UnturnedPlayer Player, RaycastResult Raycast) { if (Raycast.ParentHasComponent <InteractableCharge>()) { Raycast.TryGetEntity <InteractableCharge>().detonate(Player.CSteamID); } if (Raycast.ParentHasComponent <InteractableFire>()) { var f = Raycast.TryGetEntity <InteractableFire>(); BarricadeManager.ServerSetFireLit(f, !f.isLit); } if (Raycast.ParentHasComponent <InteractableGenerator>()) { var f = Raycast.TryGetEntity <InteractableGenerator>(); BarricadeManager.ServerSetGeneratorPowered(f, !f.isPowered); } if (Raycast.ParentHasComponent <InteractableOven>()) { var f = Raycast.TryGetEntity <InteractableOven>(); BarricadeManager.ServerSetOvenLit(f, !f.isLit); } if (Raycast.ParentHasComponent <InteractableOxygenator>()) { var f = Raycast.TryGetEntity <InteractableOxygenator>(); BarricadeManager.ServerSetOxygenatorPowered(f, !f.isPowered); } if (Raycast.ParentHasComponent <InteractableSafezone>()) { var f = Raycast.TryGetEntity <InteractableSafezone>(); BarricadeManager.ServerSetSafezonePowered(f, !f.isPowered); } if (Raycast.ParentHasComponent <InteractableSpot>()) { var f = Raycast.TryGetEntity <InteractableSpot>(); BarricadeManager.ServerSetSpotPowered(f, !f.isPowered); } if (Raycast.ParentHasComponent <InteractableVehicle>()) { var f = Raycast.TryGetEntity <InteractableVehicle>(); VehicleManager.ServerForcePassengerIntoVehicle(Player.Player, f); } if (Raycast.ParentHasComponent <InteractableBed>()) { var f = Raycast.TryGetEntity <InteractableBed>(); if (f.owner.m_SteamID != 0) { UnturnedChat.Say(Player, "PointTool_Utility_Bed_ShowOwner".Translate($"{AdminToolsPlugin.Instance.GetPlayerName(f.owner.m_SteamID, "Unknown Player")} ({f.owner})")); } else { UnturnedChat.Say(Player, "PointTool_Utility_Bed_NotClaimed".Translate());; } } if (Raycast.ParentHasComponent <InteractableDoor>()) { var f = Raycast.TryGetEntity <InteractableDoor>(); SendOpenDoor(Raycast.BarricadePlant, Raycast.BarricadeX, Raycast.BarricadeY, Raycast.BarricadeIndex, f, Raycast.BarricadeRegion); } if (Raycast.ParentHasComponent <InteractableStorage>()) { InteractableStorage Storage = Raycast.TryGetEntity <InteractableStorage>(); Player.Player.inventory.updateItems(7, Storage.items); Player.Player.inventory.sendStorage(); } }
// Token: 0x06002095 RID: 8341 RVA: 0x000B2FB8 File Offset: 0x000B13B8 public override void use() { BarricadeManager.salvageBarricade(this.root); }
// Token: 0x06002219 RID: 8729 RVA: 0x000BB8A8 File Offset: 0x000B9CA8 private void OnTriggerEnter(Collider other) { if (other.isTrigger) { return; } if (Time.realtimeSinceStartup - this.lastActive < 0.25f) { return; } if (other.transform == base.transform.parent) { return; } if (Provider.isServer) { if (this.isExplosive) { if (other.transform.CompareTag("Player")) { if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle")) { EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position); List <EPlayerKill> list; DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false); } } else { EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position); List <EPlayerKill> list2; DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list2, EExplosionDamageType.CONVENTIONAL, 32f, true, false); } } else if (other.transform.CompareTag("Player")) { if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle")) { Player player = DamageTool.getPlayer(other.transform); if (player != null) { EPlayerKill eplayerKill; DamageTool.damage(player, EDeathCause.SHRED, ELimb.SPINE, CSteamID.Nil, Vector3.up, this.playerDamage, 1f, out eplayerKill); if (this.isBroken) { player.life.breakLegs(); } EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down); BarricadeManager.damage(base.transform.parent, 5f, 1f, false); } } } else if (other.transform.CompareTag("Agent")) { Zombie zombie = DamageTool.getZombie(other.transform); if (zombie != null) { EPlayerKill eplayerKill2; uint num; DamageTool.damage(zombie, base.transform.forward, this.zombieDamage, 1f, out eplayerKill2, out num); EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down); BarricadeManager.damage(base.transform.parent, (!zombie.isHyper) ? 5f : 10f, 1f, false); } else { Animal animal = DamageTool.getAnimal(other.transform); if (animal != null) { EPlayerKill eplayerKill3; uint num2; DamageTool.damage(animal, base.transform.forward, this.animalDamage, 1f, out eplayerKill3, out num2); EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down); BarricadeManager.damage(base.transform.parent, 5f, 1f, false); } } } } }
public override void Execute(FreneticScript.CommandSystem.CommandQueue queue, CommandEntry entry) { try { TemplateObject spawned = null; LocationTag loc = LocationTag.For(entry.GetArgument(queue, 1)); if (loc == null) { queue.HandleError(entry, "Invalid location!"); return; } string targetAssetType = entry.GetArgument(queue, 0).ToLowerFast(); EntityType etype = EntityType.ValueOf(targetAssetType); if (etype == null) { queue.HandleError(entry, "Invalid entity type!"); return; } if (etype.Type == EntityAssetType.ZOMBIE) { Vector3 vec3 = loc.ToVector3(); byte reg = 0; // TODO: Optionally specifiable float closest = float.MaxValue; for (int r = 0; r < LevelZombies.zombies.Length; r++) { for (int i = 0; i < LevelZombies.zombies[r].Count; i++) { float dist = (LevelZombies.zombies[r][i].point - vec3).sqrMagnitude; if (dist < closest) { closest = dist; reg = (byte)r; } } } ZombieManager.manager.addZombie(reg, 0, 0, 0, 0, 0, 0, 0, 0, vec3, 0, false); Zombie zombie = ZombieManager.regions[reg].zombies[ZombieManager.regions[reg].zombies.Count - 1]; // TODO: Make this actually work! (See complaints file!) /* * foreach (SteamPlayer player in PlayerTool.getSteamPlayers()) * { * ZombieManager.manager.channel.openWrite(); * ZombieManager.manager.channel.write(reg); * ZombieManager.manager.channel.write((ushort)1); * ZombieManager.manager.channel.write(new object[] * { * zombie.type, * (byte)zombie.speciality, * zombie.shirt, * zombie.pants, * zombie.hat, * zombie.gear, * zombie.move, * zombie.idle, * zombie.transform.position, * MeasurementTool.angleToByte(zombie.transform.rotation.eulerAngles.y), * zombie.isDead * }); * ZombieManager.manager.channel.closeWrite("tellZombies", player.playerID.steamID, ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER); * } */ if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Successfully spawned a zombie at " + TagParser.Escape(loc.ToString()) + "! (WARNING: IT WILL BE INVISIBLE CURRENTLY - SEE THE COMPLAINTS FILE)"); } spawned = new ZombieTag(zombie); } else if (etype.Type == EntityAssetType.ANIMAL) { AnimalAssetTag asset = AnimalAssetTag.For(targetAssetType); if (asset == null) { queue.HandleError(entry, "Invalid animal type!"); return; } // TODO: Make this bit optional! RaycastHit rch; while (Physics.Raycast(loc.ToVector3(), new Vector3(0, 1, 0), out rch, 5)) { loc.Y += 3; } // END TODO AnimalManager.manager.addAnimal(asset.Internal.id, loc.ToVector3(), 0, false); Animal animal = AnimalManager.animals[AnimalManager.animals.Count - 1]; foreach (SteamPlayer player in PlayerTool.getSteamPlayers()) { AnimalManager.manager.channel.openWrite(); AnimalManager.manager.channel.write((ushort)1); AnimalManager.manager.channel.write(new object[] { animal.id, animal.transform.position, MeasurementTool.angleToByte(animal.transform.rotation.eulerAngles.y), animal.isDead }); AnimalManager.manager.channel.closeWrite("tellAnimals", player.playerID.steamID, ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER); } if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Successfully spawned a " + TagParser.Escape(asset.ToString()) + " at " + TagParser.Escape(loc.ToString()) + "! (" + animal.gameObject.GetInstanceID() + ")"); } spawned = new AnimalTag(animal); } else if (etype.Type == EntityAssetType.VEHICLE) { VehicleAssetTag asset = VehicleAssetTag.For(targetAssetType); if (asset == null) { queue.HandleError(entry, "Invalid vehicle type!"); return; } // TODO: Make this bit optional! RaycastHit rch; while (Physics.Raycast(loc.ToVector3(), new Vector3(0, 1, 0), out rch, 5)) { loc.Y += 3; } // END TODO VehicleManager.spawnVehicle(asset.Internal.id, loc.ToVector3(), Quaternion.identity); if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Successfully spawned a " + TagParser.Escape(asset.ToString()) + " at " + TagParser.Escape(loc.ToString()) + "!"); } // TODO: Get the vehicle entity! } else if (etype.Type == EntityAssetType.WORLD_OBJECT) { WorldObjectAssetTag asset = WorldObjectAssetTag.For(targetAssetType); if (asset == null) { queue.HandleError(entry, "Invalid world object type!"); return; } LevelObjects.addObject(loc.ToVector3(), Quaternion.identity, Vector3.one, asset.Internal.id, asset.Internal.name, asset.Internal.GUID, ELevelObjectPlacementOrigin.MANUAL); // TODO: Network! entry.Good(queue, "Successfully spawned a " + TagParser.Escape(asset.ToString()) + " at " + TagParser.Escape(loc.ToString()) + "! (WARNING: IT WILL BE INVISIBLE CURRENTLY - SEE THE COMPLAINTS FILE)"); // TODO: Get the world entity! } else if (etype.Type == EntityAssetType.ITEM) { ItemAssetTag asset = ItemAssetTag.For(targetAssetType); if (asset == null) { queue.HandleError(entry, "Invalid item type!"); return; } byte x; byte y; if (Regions.tryGetCoordinate(loc.ToVector3(), out x, out y)) { Item item = new Item(asset.Internal.id, 1, asset.Internal.quality); ItemData data = new ItemData(item, ++ItemManager.instanceCount, loc.ToVector3(), Dedicator.isDedicated); ItemManager.regions[x, y].items.Add(data); ItemModelTracker.Track(data, loc.ToVector3()); ItemManager.manager.channel.send("tellItem", ESteamCall.CLIENTS, x, y, ItemManager.ITEM_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { x, y, item.id, item.amount, item.quality, item.state, loc.ToVector3() }); if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Successfully spawned a " + TagParser.Escape(asset.ToString()) + " at " + TagParser.Escape(loc.ToString()) + "!"); } // TODO: Get the item entity! } else { queue.HandleError(entry, "Trying to spawn item outside any valid item regions!"); } } else if (etype.Type == EntityAssetType.BARRICADE) { ItemAssetTag asset = ItemAssetTag.For(targetAssetType.Substring("barricade_".Length)); if (asset == null || !(asset.Internal is ItemBarricadeAsset)) { queue.HandleError(entry, "Invalid item barricade type!"); return; } Barricade barric = new Barricade(asset.Internal.id); BarricadeManager.dropBarricade(barric, null, loc.ToVector3(), 0f, 0f, 0f, CSteamID.Nil.m_SteamID, CSteamID.Nil.m_SteamID); if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Successfully spawned a " + TagParser.Escape(asset.ToString()) + " at " + TagParser.Escape(loc.ToString()) + "!"); } // TODO: Get the game object! } else if (etype.Type == EntityAssetType.STRUCTURE) { ItemAssetTag asset = ItemAssetTag.For(targetAssetType.Substring("structure_".Length)); if (asset == null || !(asset.Internal is ItemStructureAsset)) { queue.HandleError(entry, "Invalid item structure type!"); return; } StructureManager.dropStructure(new Structure(asset.Internal.id), loc.ToVector3(), 0f, 0f, 0f, CSteamID.Nil.m_SteamID, CSteamID.Nil.m_SteamID); if (entry.ShouldShowGood(queue)) { entry.Good(queue, "Successfully spawned a " + TagParser.Escape(asset.ToString()) + " at " + TagParser.Escape(loc.ToString()) + "!"); } // TODO: Get the game object! } else { queue.HandleError(entry, "Invalid or unspawnable entity type!"); return; } if (spawned != null) { queue.SetVariable("spawned", spawned); } } catch (Exception ex) // TODO: Necessity? { queue.HandleError(entry, "Failed to spawn entity: " + ex.ToString()); } }
private void Update() { if (Provider.isServer && this.power != null && this.power.isWired) { Vector3 vector = base.transform.position + new Vector3(0f, 0.65f, 0f); if (Time.realtimeSinceStartup - this.lastScan > 0.1f) { this.lastScan = Time.realtimeSinceStartup; float num = 48f; if (this.hasWeapon) { num = Mathf.Min(num, ((ItemWeaponAsset)this.displayAsset).range); } float num2 = num * num; float num3 = num2; Player player = null; Zombie zombie = null; if (Provider.isPvP) { InteractableSentry.playersInRadius.Clear(); PlayerTool.getPlayersInRadius(vector, num2, InteractableSentry.playersInRadius); for (int i = 0; i < InteractableSentry.playersInRadius.Count; i++) { Player player2 = InteractableSentry.playersInRadius[i]; if (!(player2.channel.owner.playerID.steamID == base.owner) && !player2.quests.isMemberOfGroup(base.group)) { if (!player2.life.isDead && player2.animator.gesture != EPlayerGesture.ARREST_START) { if ((!player2.movement.isSafe || !player2.movement.isSafeInfo.noWeapons) && player2.movement.canAddSimulationResultsToUpdates) { if (!(player != null) || player2.animator.gesture != EPlayerGesture.SURRENDER_START) { if (this.sentryMode != ESentryMode.FRIENDLY || Time.realtimeSinceStartup - player2.equipment.lastPunching <= 2f || (player2.equipment.isSelected && player2.equipment.asset != null && player2.equipment.asset.isDangerous)) { float sqrMagnitude = (player2.look.aim.position - vector).sqrMagnitude; if (sqrMagnitude <= num3) { Vector3 vector2 = player2.look.aim.position - vector; float magnitude = vector2.magnitude; Vector3 vector3 = vector2 / magnitude; if (!(player2 != this.targetPlayer) || Vector3.Dot(vector3, this.aimTransform.forward) >= 0.5f) { if (magnitude > 0.025f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(vector, vector3), out raycastHit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, 0); if (raycastHit.transform != null && raycastHit.transform != base.transform) { goto IL_35F; } PhysicsUtility.raycast(new Ray(vector + vector3 * (magnitude - 0.025f), -vector3), out raycastHit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, 0); if (raycastHit.transform != null && raycastHit.transform != base.transform) { goto IL_35F; } } num3 = sqrMagnitude; player = player2; } } } } } } } IL_35F :; } } InteractableSentry.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(vector, num2, InteractableSentry.zombiesInRadius); for (int j = 0; j < InteractableSentry.zombiesInRadius.Count; j++) { Zombie zombie2 = InteractableSentry.zombiesInRadius[j]; if (!zombie2.isDead && zombie2.isHunting) { Vector3 vector4 = zombie2.transform.position; switch (zombie2.speciality) { case EZombieSpeciality.NORMAL: vector4 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector4 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector4 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector4 += new Vector3(0f, 1f, 0f); break; } float sqrMagnitude2 = (vector4 - vector).sqrMagnitude; if (sqrMagnitude2 <= num3) { Vector3 vector5 = vector4 - vector; float magnitude2 = vector5.magnitude; Vector3 vector6 = vector5 / magnitude2; if (!(zombie2 != this.targetZombie) || Vector3.Dot(vector6, this.aimTransform.forward) >= 0.5f) { if (magnitude2 > 0.025f) { RaycastHit raycastHit2; PhysicsUtility.raycast(new Ray(vector, vector6), out raycastHit2, magnitude2 - 0.025f, RayMasks.BLOCK_SENTRY, 0); if (raycastHit2.transform != null && raycastHit2.transform != base.transform) { goto IL_5B4; } PhysicsUtility.raycast(new Ray(vector + vector6 * (magnitude2 - 0.025f), -vector6), out raycastHit2, magnitude2 - 0.025f, RayMasks.DAMAGE_SERVER, 0); if (raycastHit2.transform != null && raycastHit2.transform != base.transform) { goto IL_5B4; } } num3 = sqrMagnitude2; player = null; zombie = zombie2; } } } IL_5B4 :; } if (player != this.targetPlayer || zombie != this.targetZombie) { this.targetPlayer = player; this.targetZombie = zombie; this.lastFire = Time.realtimeSinceStartup + 0.1f; } } if (this.targetPlayer != null) { ESentryMode esentryMode = this.sentryMode; if (esentryMode != ESentryMode.FRIENDLY && esentryMode != ESentryMode.NEUTRAL) { if (esentryMode == ESentryMode.HOSTILE) { this.isFiring = true; } } else { this.isFiring = (this.targetPlayer.animator.gesture != EPlayerGesture.SURRENDER_START); } this.isAiming = true; } else if (this.targetZombie != null) { this.isFiring = true; this.isAiming = true; } else { this.isFiring = false; this.isAiming = false; } if (this.isAiming && Time.realtimeSinceStartup - this.lastAim > Provider.UPDATE_TIME) { this.lastAim = Time.realtimeSinceStartup; Transform transform = null; Vector3 vector7 = Vector3.zero; if (this.targetPlayer != null) { transform = this.targetPlayer.transform; vector7 = this.targetPlayer.look.aim.position; } else if (this.targetZombie != null) { transform = this.targetZombie.transform; vector7 = this.targetZombie.transform.position; switch (this.targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector7 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector7 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector7 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector7 += new Vector3(0f, 1f, 0f); break; } } if (transform != null) { float num4 = Mathf.Atan2(vector7.x - vector.x, vector7.z - vector.z) * 57.29578f; float num5 = Mathf.Sin((vector7.y - vector.y) / (vector7 - vector).magnitude) * 57.29578f; BarricadeManager.sendAlertSentry(base.transform, num4, num5); } } if (this.isFiring && this.hasWeapon && this.displayItem.state[10] > 0 && !this.isOpen && Time.realtimeSinceStartup - this.lastFire > this.fireTime) { this.lastFire += this.fireTime; if (Time.realtimeSinceStartup - this.lastFire > this.fireTime) { this.lastFire = Time.realtimeSinceStartup; } float num6 = (float)this.displayItem.quality / 100f; if (this.attachments.magazineAsset == null) { return; } byte[] state = this.displayItem.state; int num7 = 10; state[num7] -= 1; if (this.attachments.barrelAsset == null || !this.attachments.barrelAsset.isSilenced || this.displayItem.state[16] == 0) { AlertTool.alert(base.transform.position, 48f); } if (Provider.modeConfigData.Items.Has_Durability && this.displayItem.quality > 0 && Random.value < ((ItemWeaponAsset)this.displayAsset).durability) { if (this.displayItem.quality > ((ItemWeaponAsset)this.displayAsset).wear) { Item displayItem = this.displayItem; displayItem.quality -= ((ItemWeaponAsset)this.displayAsset).wear; } else { this.displayItem.quality = 0; } } float num8 = ((ItemGunAsset)this.displayAsset).spreadAim * ((num6 >= 0.5f) ? 1f : (1f + (1f - num6 * 2f))); if (this.attachments.tacticalAsset != null && this.interact) { num8 *= this.attachments.tacticalAsset.spread; } if (this.attachments.gripAsset != null) { num8 *= this.attachments.gripAsset.spread; } if (this.attachments.barrelAsset != null) { num8 *= this.attachments.barrelAsset.spread; } if (this.attachments.magazineAsset != null) { num8 *= this.attachments.magazineAsset.spread; } if (((ItemGunAsset)this.displayAsset).projectile == null) { BarricadeManager.sendShootSentry(base.transform); byte pellets = this.attachments.magazineAsset.pellets; for (byte b = 0; b < pellets; b += 1) { EPlayerKill eplayerKill = EPlayerKill.NONE; uint num9 = 0u; float num10 = 1f; num10 *= ((num6 >= 0.5f) ? 1f : (0.5f + num6)); Transform transform2; float magnitude3; if (this.targetPlayer != null) { transform2 = this.targetPlayer.transform; magnitude3 = (transform2.position - base.transform.position).magnitude; } else { transform2 = this.targetZombie.transform; magnitude3 = (transform2.position - base.transform.position).magnitude; } float num11 = magnitude3 / ((ItemWeaponAsset)this.displayAsset).range; num11 = 1f - num11; num11 *= 1f - ((ItemGunAsset)this.displayAsset).spreadHip; num11 *= 0.75f; if (transform2 == null || Random.value > num11) { Vector3 vector8 = this.aimTransform.forward; vector8 += this.aimTransform.right * Random.Range(-((ItemGunAsset)this.displayAsset).spreadHip, ((ItemGunAsset)this.displayAsset).spreadHip) * num8; vector8 += this.aimTransform.up * Random.Range(-((ItemGunAsset)this.displayAsset).spreadHip, ((ItemGunAsset)this.displayAsset).spreadHip) * num8; vector8.Normalize(); Ray ray; ray..ctor(this.aimTransform.position, vector8); RaycastInfo raycastInfo = DamageTool.raycast(ray, ((ItemWeaponAsset)this.displayAsset).range, RayMasks.DAMAGE_SERVER); if (!(raycastInfo.transform == null)) { DamageTool.impact(raycastInfo.point, raycastInfo.normal, raycastInfo.material, raycastInfo.vehicle != null || raycastInfo.transform.CompareTag("Barricade") || raycastInfo.transform.CompareTag("Structure") || raycastInfo.transform.CompareTag("Resource")); if (raycastInfo.vehicle != null) { DamageTool.damage(raycastInfo.vehicle, false, Vector3.zero, false, ((ItemGunAsset)this.displayAsset).vehicleDamage, num10, true, out eplayerKill); } else if (raycastInfo.transform != null) { if (raycastInfo.transform.CompareTag("Barricade")) { ushort id; if (ushort.TryParse(raycastInfo.transform.name, out id)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id); if (itemBarricadeAsset != null && (itemBarricadeAsset.isVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, ((ItemGunAsset)this.displayAsset).barricadeDamage, num10, out eplayerKill); } } } else if (raycastInfo.transform.CompareTag("Structure")) { ushort id2; if (ushort.TryParse(raycastInfo.transform.name, out id2)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id2); if (itemStructureAsset != null && (itemStructureAsset.isVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, raycastInfo.direction * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).structureDamage, num10, out eplayerKill); } } } else if (raycastInfo.transform.CompareTag("Resource")) { byte x; byte y; ushort index; if (ResourceManager.tryGetRegion(raycastInfo.transform, out x, out y, out index)) { ResourceSpawnpoint resourceSpawnpoint = ResourceManager.getResourceSpawnpoint(x, y, index); if (resourceSpawnpoint != null && !resourceSpawnpoint.isDead && resourceSpawnpoint.asset.bladeID == ((ItemWeaponAsset)this.displayAsset).bladeID) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).resourceDamage, num10, 1f, out eplayerKill, out num9); } } } else if (raycastInfo.section < 255) { InteractableObjectRubble component = raycastInfo.transform.GetComponent <InteractableObjectRubble>(); if (component != null && !component.isSectionDead(raycastInfo.section) && (component.asset.rubbleIsVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction, raycastInfo.section, ((ItemGunAsset)this.displayAsset).objectDamage, num10, out eplayerKill, out num9); } } } } } else { Vector3 vector9 = Vector3.zero; if (this.targetPlayer != null) { vector9 = this.targetPlayer.look.aim.position; } else if (this.targetZombie != null) { vector9 = this.targetZombie.transform.position; switch (this.targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector9 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector9 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector9 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector9 += new Vector3(0f, 1f, 0f); break; } } DamageTool.impact(vector9, -this.aimTransform.forward, EPhysicsMaterial.FLESH_DYNAMIC, true); if (this.targetPlayer != null) { DamageTool.damage(this.targetPlayer, EDeathCause.SENTRY, ELimb.SPINE, base.owner, this.aimTransform.forward * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).playerDamageMultiplier, num10, true, out eplayerKill); } else if (this.targetZombie != null) { DamageTool.damage(this.targetZombie, ELimb.SPINE, this.aimTransform.forward * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).zombieDamageMultiplier, num10, true, out eplayerKill, out num9); } } } } base.rebuildState(); } } bool flag = Time.realtimeSinceStartup - this.lastAlert < 1f; if (flag != this.isAlert) { this.isAlert = flag; if (!Dedicator.isDedicated) { if (this.isAlert) { EffectManager.effect(92, base.transform.position, Vector3.up); } else { EffectManager.effect(93, base.transform.position, Vector3.up); } } if (!this.isAlert) { this.targetYaw = base.transform.localRotation.eulerAngles.y; } } if (this.power != null) { if (this.power.isWired) { if (this.isAlert) { this.lastDrift = Time.realtimeSinceStartup; this.yaw = Mathf.LerpAngle(this.yaw, this.targetYaw, 4f * Time.deltaTime); } else { this.yaw = Mathf.LerpAngle(this.yaw, this.targetYaw + Mathf.Sin(Time.realtimeSinceStartup - this.lastDrift) * 60f, 4f * Time.deltaTime); } this.pitch = Mathf.LerpAngle(this.pitch, this.targetPitch, 4f * Time.deltaTime); this.yawTransform.rotation = Quaternion.Euler(-90f, 0f, this.yaw); this.pitchTransform.localRotation = Quaternion.Euler(0f, -90f, this.pitch); } if (!Dedicator.isDedicated) { if (this.onGameObject != null) { this.onGameObject.SetActive(this.isAlert && this.power.isWired); } if (this.onModelGameObject != null) { this.onModelGameObject.SetActive(this.isAlert); if (this.onMaterial != null) { this.onMaterial.SetColor("_EmissionColor", (!this.isAlert || !this.power.isWired) ? Color.black : this.onMaterial.color); } } if (this.offGameObject != null) { this.offGameObject.SetActive(!this.isAlert && this.power.isWired); } if (this.offModelGameObject != null) { this.offModelGameObject.SetActive(!this.isAlert); if (this.offMaterial != null) { this.offMaterial.SetColor("_EmissionColor", (this.isAlert || !this.power.isWired) ? Color.black : this.offMaterial.color); } } if ((double)(Time.realtimeSinceStartup - this.lastShot) > 0.05 && this.muzzleEmitter != null) { this.muzzleEmitter.GetComponent <Light>().enabled = false; } } } }
protected override async UniTask OnExecuteAsync() { if (Context.Parameters.Length != 0) { throw new CommandWrongUsageException(Context); } UnturnedUser uPlayer = (UnturnedUser)Context.Actor; await UniTask.SwitchToMainThread(); var currentVehicle = uPlayer.Player.Player.movement.getVehicle(); if (currentVehicle != null) { if (!RefuelVehicle(currentVehicle)) { throw new UserFriendlyException(m_StringLocalizer["refuel:vehicle:no_fuel"]); } await PrintAsync(m_StringLocalizer["refuel:vehicle:success"]); return; } PlayerLook look = uPlayer.Player.Player.look; RaycastInfo raycast = DamageTool.raycast(new(look.aim.position, look.aim.forward), 100f, RayMasks.DAMAGE_SERVER); if (raycast.vehicle != null) { if (!RefuelVehicle(raycast.vehicle)) { throw new UserFriendlyException(m_StringLocalizer["refuel:vehicle:no_fuel"]); } await PrintAsync(m_StringLocalizer["refuel:vehicle:success"]); return; } if (raycast.transform == null) { throw new UserFriendlyException(m_StringLocalizer["refuel:none"]); } var interactable = raycast.transform.GetComponent <Interactable>(); if (interactable != null) { if (interactable is InteractableGenerator generator) { if (!generator.isRefillable) { throw new UserFriendlyException(m_StringLocalizer["refuel:object:no_fuel", new { Object = generator.name }]); } generator.askFill(generator.capacity); BarricadeManager.sendFuel(raycast.transform, generator.fuel); await PrintAsync(m_StringLocalizer["refuel:object:generator"]); return; } else if (interactable is InteractableOil oil) { if (!oil.isRefillable) { throw new UserFriendlyException(m_StringLocalizer["refuel:object:no_fuel", new { Object = oil.name }]); } oil.askFill(oil.capacity); BarricadeManager.sendFuel(raycast.transform, oil.fuel); await PrintAsync(m_StringLocalizer["refuel:object:oil"]); return; } else if (interactable is InteractableTank { source : ETankSource.FUEL } tank) { if (!tank.isRefillable) { throw new UserFriendlyException(m_StringLocalizer["refuel:object:no_fuel", new { Object = tank.name }]); } BarricadeManager.updateTank(raycast.transform, tank.capacity); await PrintAsync(m_StringLocalizer["refuel:object:tank"]); return; } else if (interactable is InteractableObjectResource { objectAsset : { interactability : EObjectInteractability.FUEL } } @object) { if ([email protected]) { throw new UserFriendlyException(m_StringLocalizer["refuel:object:no_fuel", new { Object = @object.name }]); } ObjectManager.updateObjectResource(interactable.transform, @object.capacity, true); // todo await PrintAsync(m_StringLocalizer["refuel:object:object"]); return; } }
public void Execute(IRocketPlayer caller, string[] args) { if (args.Length > 1) { UnturnedChat.Say(caller, "invalid arguments", Color.red); return; } else if (args.Length == 1) { bool isregistered = false; foreach (Registereddoortype doorinfo in miscstuff.Instance.Configuration.Instance.listofregistereddoors) { if (doorinfo.name == args[0]) { isregistered = true; miscstuff.Instance.Configuration.Instance.listofregistereddoors.Remove(doorinfo); UnturnedChat.Say(caller, "Door" + doorinfo.name + " Unregistered!"); miscstuff.Instance.Configuration.Save(); } } if (isregistered == false) { UnturnedChat.Say(caller, "Registered Door does not exist with that name", Color.red); } } else if (args.Length == 0) { var PlayerCaller = (UnturnedPlayer)caller; InteractableDoorHinge component = raycastdoor.Getdoor(PlayerCaller); if (component != null) { InteractableDoor door = component.door; bool flag = !door.isOpen; byte x; byte y; ushort plant; ushort index; BarricadeRegion barricadeRegion; BarricadeManager.tryGetInfo(door.transform, out x, out y, out plant, out index, out barricadeRegion); BarricadeDrop barricadedrop = barricadeRegion.drops[index]; var ID = barricadedrop.instanceID; bool isregistered = false; foreach (Registereddoortype doorinfo in miscstuff.Instance.Configuration.Instance.listofregistereddoors) { if (doorinfo.ID == ID) { isregistered = true; miscstuff.Instance.Configuration.Instance.listofregistereddoors.Remove(doorinfo); UnturnedChat.Say(caller, "Door" + doorinfo.name + " Unregistered!"); miscstuff.Instance.Configuration.Save(); } } if (isregistered == false) { UnturnedChat.Say(caller, "That door is not registered!", Color.red); } } else { UnturnedChat.Say(caller, "You are not looking at a valid object", Color.red); } } }
public override void use() { BarricadeManager.farm(base.transform); }
void OnGUI() { if (!Provider.isConnected || Provider.isLoading || (PlayerCam.IsFullScreen && PlayerCam.player != null)) { return; } #region Item Clump Boxes if (G.Settings.ItemOptions.Enabled && G.Settings.GlobalOptions.ListClumpedItems && !G.BeingSpied) { for (int i = 0; i < ItemClumps.Count; i++) { ItemClumpObject itemClumpObject = ItemClumps[i]; Vector3 pos = G.MainCamera.WorldToScreenPoint(itemClumpObject.WorldPos); pos.y = Screen.height - pos.y; if (pos.z >= 0 && (Vector3.Distance(Player.player.transform.position, itemClumpObject.WorldPos) <= G.Settings.ItemOptions.MaxDistance)) { string s = ""; foreach (InteractableItem item in itemClumpObject.ClumpedItems) { Color c1 = ItemTool.getRarityColorHighlight(item.asset.rarity); Color32 c = new Color32((byte)(c1.r * 255), (byte)(c1.g * 255), (byte)(c1.b * 255), 255); s += $"<color=#{Colors.ColorToHex(c)}>{item.asset.itemName}</color>\n"; } Vector2 TextHeight = GUIStyle.none.CalcSize(new GUIContent($"<size=10>{s}</size>")); GUILayout.BeginArea(new Rect(pos.x, pos.y, TextHeight.x + 10, TextHeight.y), style: "box"); GUILayout.Label($"<size=10>{s}</size>"); GUILayout.EndArea(); } } } GUI.skin = null; #endregion for (int i = 0; i < EObjects.Count; i++) { ESPObj obj = EObjects[i]; #region Checks if (obj.GObject != null && (!obj.Options.Enabled || T.GetDistance(obj.GObject.transform.position) > obj.Options.MaxDistance || (obj.Target == ESPObject.Item && (!T.IsItemWhitelisted((InteractableItem)obj.Object, G.Settings.MiscOptions.ESPWhitelist) || Items.IsAlreadyClumped((InteractableItem)obj.Object))))) { Highlighter h = obj.GObject.GetComponent <Highlighter>(); if (h != null) { h.ConstantOffImmediate(); } } if (obj.GObject == null || !T.InScreenView(G.MainCamera.WorldToViewportPoint(obj.GObject.transform.position)) || !obj.Options.Enabled || T.GetDistance(obj.GObject.transform.position) > obj.Options.MaxDistance) { continue; } if (G.BeingSpied) { Highlighter h = obj.GObject.GetComponent <Highlighter>(); if (h != null) { h.ConstantOffImmediate(); } T.RemoveShaders(obj.GObject); continue; } if (obj.Target == ESPObject.Player && ((SteamPlayer)obj.Object).player.life.isDead) { continue; } if (obj.Target == ESPObject.Zombie && ((Zombie)obj.Object).isDead) { continue; } if (obj.Target == ESPObject.Vehicle && ((InteractableVehicle)obj.Object).isDead) { continue; } if (obj.Target == ESPObject.Vehicle && G.Settings.GlobalOptions.OnlyUnlocked && ((InteractableVehicle)obj.Object).isLocked) { continue; } if (obj.Target == ESPObject.Bed && G.Settings.GlobalOptions.OnlyUnclaimed && ((InteractableBed)obj.Object).isClaimed) { continue; } if (obj.Target == ESPObject.Item && !T.IsItemWhitelisted((InteractableItem)obj.Object, G.Settings.MiscOptions.ESPWhitelist)) { continue; } if (obj.Target == ESPObject.Item && G.Settings.GlobalOptions.ListClumpedItems && Items.IsAlreadyClumped((InteractableItem)obj.Object)) { continue; } if (G.BeingSpied) { Highlighter h = obj.GObject.GetComponent <Highlighter>(); if (h != null) { h.ConstantOffImmediate(); } T.RemoveShaders(obj.GObject); continue; } #endregion #region Globals string LabelText = $"<size={obj.Options.FontSize}>"; string OutlineText = $"<size={obj.Options.FontSize}>"; Color32 color = Colors.GetColor(Enum.GetName(typeof(ESPObject), obj.Target) + "_ESP"); if (obj.Options.Distance) { LabelText += $"<color=white>[{T.GetDistance(obj.GObject.transform.position)}]</color> "; OutlineText += $"[{T.GetDistance(obj.GObject.transform.position)}] "; } #endregion #region Label Shit switch (obj.Target) { case ESPObject.Player: Player player = ((SteamPlayer)obj.Object).player; switch (T.GetPriority(((SteamPlayer)obj.Object).playerID.steamID.m_SteamID)) { case Priority.Friendly: color = Colors.GetColor("Friendly_Player_ESP"); break; case Priority.Marked: color = Colors.GetColor("Marked_Player_ESP"); break; } if (obj.Options.Name) { LabelText += ((SteamPlayer)obj.Object).playerID.characterName; OutlineText += ((SteamPlayer)obj.Object).playerID.characterName; } if (G.Settings.GlobalOptions.Weapon) { string Weapon = player.equipment.asset != null ? ((SteamPlayer)obj.Object).player.equipment.asset.itemName : "None"; LabelText += $"<color=white> - {Weapon}</color>"; OutlineText += " - " + Weapon; } if (G.Settings.GlobalOptions.ViewHitboxes && G.Settings.AimbotOptions.ExpandHitboxes && G.Settings.AimbotOptions.SilentAim) { Player p = ((SteamPlayer)obj.Object).player; Vector3 W2SPlayer = T.WorldToScreen(player.transform.position); if (W2SPlayer.z >= 0) { Vector3 W2SOffset = T.WorldToScreen(new Vector3(player.transform.position.x, player.transform.position.y + G.Settings.AimbotOptions.HitboxSize, player.transform.position.z)); float Distance = Vector3.Distance(W2SPlayer, W2SOffset); T.DrawCircle(Colors.GetColor("Extended_Hitbox_Circle"), new Vector2(W2SPlayer.x, W2SPlayer.y), Distance); } } break; case ESPObject.Item: if (obj.Options.Name) { LabelText += ((InteractableItem)obj.Object).asset.itemName; OutlineText += ((InteractableItem)obj.Object).asset.itemName; } break; case ESPObject.Vehicle: if (obj.Options.Name) { LabelText += ((InteractableVehicle)obj.Object).asset.vehicleName; OutlineText += ((InteractableVehicle)obj.Object).asset.vehicleName; } if (G.Settings.GlobalOptions.VehicleLocked) { if (((InteractableVehicle)obj.Object).isLocked) { LabelText += $"<color=white> - Locked</color>"; OutlineText += " - Locked"; } else { LabelText += $"<color=white> - </color><color=ff5a00>Unlocked</color>"; OutlineText += " - Unlocked"; } } break; case ESPObject.Bed: if (obj.Options.Name) { LabelText += Enum.GetName(typeof(ESPObject), obj.Target); OutlineText += Enum.GetName(typeof(ESPObject), obj.Target); } if (G.Settings.GlobalOptions.Claimed) { if (((InteractableBed)obj.Object).isClaimed) { LabelText += $"<color=white> - Claimed</color>"; OutlineText += " - Claimed"; } else { LabelText += $"<color=white> - </color><color=ff5a00>Unclaimed</color>"; OutlineText += " - Unclaimed"; } } break; case ESPObject.Storage: BarricadeData bdata = null; if (obj.Options.Name || G.Settings.GlobalOptions.ShowLocked) { try { BarricadeRegion r; if (BarricadeManager.tryGetInfo(((InteractableStorage)obj.Object).transform, out byte x, out byte y, out ushort plant, out ushort index, out r)) { bdata = r.barricades[index]; } } catch (Exception ex) { Debug.Log(ex); } } if (obj.Options.Name) { string s = "Storage"; if (bdata != null) { s = bdata.barricade.asset.name.Replace("_", " "); } LabelText += s; OutlineText += s; } if (G.Settings.GlobalOptions.ShowLocked) { if (bdata != null) { if (bdata.barricade.asset.isLocked) { LabelText += $"<color=white> - Locked</color>"; OutlineText += " - Locked"; } else { LabelText += $"<color=white> - </color><color=ff5a00>Unlocked</color>"; OutlineText += " - Unlocked"; } } else { LabelText += $"<color=white> - Unknown</color>"; OutlineText += " - Unknown"; } } break; default: if (obj.Options.Name) { LabelText += Enum.GetName(typeof(ESPObject), obj.Target); OutlineText += Enum.GetName(typeof(ESPObject), obj.Target); } break; } #endregion #region Draw LabelText += "</size>"; OutlineText += "</size>"; if (obj.Options.Tracers) { T.DrawSnapline(obj.GObject.transform.position, color); } if (!String.IsNullOrEmpty(LabelText)) { T.DrawESPLabel(obj.GObject.transform.position, color, Color.black, LabelText, OutlineText); } if (obj.Options.Box) { if (obj.Target == ESPObject.Player) { Vector3 p = obj.GObject.transform.position; Vector3 s = obj.GObject.transform.localScale; if (p != null & s != null) { T.Draw3DBox(new Bounds(p + new Vector3(0, 1.1f, 0), s + new Vector3(0, .95f, 0)), color); } } else { T.Draw3DBox(obj.GObject.GetComponent <Collider>().bounds, color); } } if (obj.Options.Glow) { Highlighter h = obj.GObject.GetComponent <Highlighter>() ?? obj.GObject.AddComponent <Highlighter>(); h.occluder = true; h.overlay = true; h.ConstantOnImmediate(color); } else { Highlighter h = obj.GObject.GetComponent <Highlighter>(); if (h != null) { h.ConstantOffImmediate(); } } #endregion } // sometimes shows localplayer glowing after your car explodes Highlighter hi = Player.player?.gameObject?.GetComponent <Highlighter>(); if (hi != null) { hi.ConstantOffImmediate(); } }
public void Execute(IRocketPlayer caller, string[] command) { var uPlayer = caller as UnturnedPlayer; if (command.Length != 1) { ChatManager.serverSendMessage(Syntax, Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true); } else { if (command[0] == "add") { if (PhysicsUtility.raycast(new Ray(uPlayer.Player.look.aim.position, uPlayer.Player.look.aim.forward), out RaycastHit ahit, Mathf.Infinity, RayMasks.BARRICADE_INTERACT)) { InteractableDoorHinge door = ahit.transform.GetComponent <InteractableDoorHinge>(); Interactable2SalvageBarricade barri = ahit.transform.GetComponent <Interactable2SalvageBarricade>(); if (door != null) { BarricadeManager.tryGetInfo(door.door.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR); var Bindex = barricadeR.barricades[bindex]; var Bx = Bindex.point.x; var By = Bindex.point.y; var Bz = Bindex.point.z; var n_blacklist = new DoorBlackList { x = Bx, y = By, z = Bz }; Main.Instance.AddPlayer(n_blacklist); ChatManager.serverSendMessage("You have successfully added this door/storage to the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true); } else if (barri != null) { BarricadeManager.tryGetInfo(ahit.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR); var Bindex = barricadeR.barricades[bindex]; var Bx = Bindex.point.x; var By = Bindex.point.y; var Bz = Bindex.point.z; var n_blacklist = new DoorBlackList { x = Bx, y = By, z = Bz }; Main.Instance.AddPlayer(n_blacklist); ChatManager.serverSendMessage("You have successfully added this door/storage to the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true); } } else if (command[0] == "remove") { if (PhysicsUtility.raycast(new Ray(uPlayer.Player.look.aim.position, uPlayer.Player.look.aim.forward), out RaycastHit rhit, Mathf.Infinity, RayMasks.BARRICADE_INTERACT)) { var rdoor = rhit.transform.GetComponent <InteractableDoorHinge>(); var rbarri = rhit.transform.GetComponent <Interactable2SalvageBarricade>(); if (rdoor != null) { BarricadeManager.tryGetInfo(rdoor.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR); var Bindex = barricadeR.barricades[bindex]; var Bx = Bindex.point.x; var By = Bindex.point.y; var Bz = Bindex.point.z; var n_blacklist = new DoorBlackList { x = Bx, y = By, z = Bz }; Main.Instance.RemovePlayer(n_blacklist); ChatManager.serverSendMessage("You have successfully removed this door/storage from the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true); } else if (rbarri != null) { BarricadeManager.tryGetInfo(rhit.transform, out byte x, out byte y, out ushort index, out ushort bindex, out BarricadeRegion barricadeR); var Bindex = barricadeR.barricades[bindex]; var Bx = Bindex.point.x; var By = Bindex.point.y; var Bz = Bindex.point.z; var n_blacklist = new DoorBlackList { x = Bx, y = By, z = Bz }; Main.Instance.RemovePlayer(n_blacklist); ChatManager.serverSendMessage("You have successfully removed this door/storage from the blacklist!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true); } } else { ChatManager.serverSendMessage("Please look at a barricade to remove it to the blacklist for picklocking!", Color.red, null, uPlayer.SteamPlayer(), EChatMode.GLOBAL, Main.Instance.Configuration.Instance.LogoImage, true); } } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer player = (UnturnedPlayer)caller; if (command.Length < 1) { Plugin.Say(player, "INVALID_SYNTAX_AUCTION_VEHICLE", Color.red); return; } if (player.CurrentVehicle == null || player.CurrentVehicle.passengers.First().player != player.Player.channel.owner) { Plugin.Say(player, "NO_VEHICLE", Color.red); return; } if (!decimal.TryParse(command[0], out var startingBid)) { Plugin.Say(player, "NOT_NUMBER", Color.red, command[0]); return; } if (startingBid < Plugin.Instance.Configuration.Instance.MinimumBid) { Plugin.Say(player, "BID_TOO_SMALL", Color.red, Plugin.Instance.Configuration.Instance.MinimumBid); return; } if (Plugin.Instance.AuctionManager.HasAnyAuction(player.CSteamID.m_SteamID)) { Plugin.Say("ALREADY_QUEUED", Color.red); return; } //NO need for lock since all operations on AuctionQuehe happens on the main thread var auction = new Auction(player.Player, new AuctionItem() { Vehicle = SerializableVehicle.Create(player.CurrentVehicle) }, startingBid, TimeSpan.FromSeconds(Plugin.Instance.Configuration.Instance.AuctionDuration)); var vehicle = player.CurrentVehicle; foreach (var currentPlayer in player.CurrentVehicle.passengers.Where(c => c.player != null)) { vehicle.forceRemovePlayer(out var seat, currentPlayer.player.playerID.steamID, out var point, out var angle); VehicleManager.sendExitVehicle(vehicle, seat, point, angle, true); } if (BarricadeManager.tryGetPlant(vehicle.transform, out byte x, out byte y, out ushort plant, out var region)) { vehicle.trunkItems.items.Clear(); region.barricades.Clear(); region.drops.Clear(); } VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, vehicle.instanceID); Plugin.Instance.AuctionManager.AuctionQueue.Add(auction); Plugin.Instance.AuctionManager.Tick(); if (Plugin.Instance.AuctionManager.AuctionQueue.Count > 0) //If it didn't automaticly get started { Plugin.Say(player, "AUCTION_QUEUED", Color.green, Plugin.Instance.AuctionManager.AuctionQueue.Count, (int)((Plugin.Instance.AuctionManager.LastCompletedAuction.AddSeconds(Plugin.Instance.Configuration.Instance.IntervalInbetween) - DateTime.UtcNow).TotalSeconds)); } }
// Token: 0x060020AE RID: 8366 RVA: 0x000B350B File Offset: 0x000B190B public override void use() { BarricadeManager.claimBed(base.transform); }
public void detonate(CSteamID killer) { EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position); DamageTool.explode(base.transform.position, this.range2, EDeathCause.CHARGE, killer, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, EExplosionDamageType.CONVENTIONAL, 32f, true); BarricadeManager.damage(base.transform, 5f, 1f, false); }
// Token: 0x06002878 RID: 10360 RVA: 0x000F5474 File Offset: 0x000F3874 private void arenaClear() { VehicleManager.askVehicleDestroyAll(); BarricadeManager.askClearAllBarricades(); StructureManager.askClearAllStructures(); ItemManager.askClearAllItems(); EffectManager.askEffectClearAll(); ObjectManager.askClearAllObjects(); LevelManager.arenaPlayers.Clear(); Vector3 vector = Vector3.zero; float num = (float)Level.size / 2f; if (Level.info.configData.Use_Arena_Compactor) { if (LevelManager.arenaNodes.Count > 0) { ArenaNode arenaNode = LevelManager.arenaNodes[UnityEngine.Random.Range(0, LevelManager.arenaNodes.Count)]; vector = arenaNode.point; vector.y = 0f; num = arenaNode.radius; } } else { num = 16384f; } float compactorSpeed = LevelManager.compactorSpeed; Vector3 vector2; float num2; if (Level.info.configData.Use_Arena_Compactor) { if (Provider.modeConfigData.Events.Arena_Use_Compactor_Pause) { this.getArenaTarget(vector, num, out vector2, out num2); } else { vector2 = vector; num2 = 0.5f; } } else { vector2 = vector; num2 = num; } base.channel.send("tellArenaOrigin", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { vector, num, vector, num, vector2, num2, compactorSpeed, (byte)(Provider.modeConfigData.Events.Arena_Clear_Timer + Provider.modeConfigData.Events.Arena_Compactor_Delay_Timer) }); LevelManager.arenaState = EArenaState.WARMUP; base.channel.send("tellLevelTimer", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { (byte)Provider.modeConfigData.Events.Arena_Clear_Timer }); }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Length > 1) { caller.SendChat(Plugin.Inst.Translate("rfgarage_command_invalid_parameter", Syntax), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); return; } var player = (UnturnedPlayer)caller; switch (command.Length) { case 0: Plugin.GarageAddAllQueueDict[player.CSteamID] = true; caller.SendChat(Plugin.Inst.Translate("rfgarage_command_gadd_all_ask_confirm"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); return; case 1: switch (command[0].ToLower()) { case "confirm" when !Plugin.GarageAddAllQueueDict[player.CSteamID]: caller.SendChat(Plugin.Inst.Translate("rfgarage_command_all_no_queue"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); return; case "confirm": { caller.SendChat(Plugin.Inst.Translate("rfgarage_command_gadd_all_confirm"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); // Tuple < availableGarage, availableSlot > var passedVehicles = new List <InteractableVehicle>(); var blacklistedVehicles = new List <InteractableVehicle>(); var availableGarages = GarageUtil.GetAllGarages(player); foreach (var interactableVehicle in VehicleManager.vehicles.Where(interactableVehicle => interactableVehicle.lockedOwner.m_SteamID == player.CSteamID.m_SteamID)) { GarageUtil.GarageAddAllChecks(player, interactableVehicle, out var response, out _); switch (response) { case EResponseType.BLACKLIST_BARRICADE: case EResponseType.BLACKLIST_TRUNK_ITEM: case EResponseType.BLACKLIST_VEHICLE: blacklistedVehicles.Add(interactableVehicle); break; case EResponseType.SUCCESS: passedVehicles.Add(interactableVehicle); break; default: throw new ArgumentOutOfRangeException(); } } var tupleGarages = (from garage in availableGarages let garageOccupiedSlot = Plugin.DbManager.GetVehicleCount(player.CSteamID.m_SteamID.ToString(), garage.Name) where garage.Slot > garageOccupiedSlot select new Tuple <GarageModel, uint>(garage, garageOccupiedSlot)).ToList(); var vehicleIndex = 0; var successVehicles = new List <InteractableVehicle>(); foreach (var(garage, occupiedSlot) in tupleGarages) { var i = 0; while (i < (garage.Slot - occupiedSlot) && vehicleIndex < passedVehicles.Count) { GarageUtil.SaveVgVehicleToSql(player.CSteamID.m_SteamID, garage.Name, passedVehicles[vehicleIndex].asset.name, passedVehicles[vehicleIndex], BarricadeManager.getRegionFromVehicle(passedVehicles[vehicleIndex])); successVehicles.Add(passedVehicles[vehicleIndex]); vehicleIndex++; i++; } } caller.SendChat(Plugin.Inst.Translate("rfgarage_command_gadd_all_success", vehicleIndex, passedVehicles.Count - vehicleIndex), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); foreach (var vehicle in successVehicles) { caller.SendChat(Plugin.Inst.Translate("rfgarage_command_all_success_vehicle", vehicle.asset.id, vehicle.asset.vehicleName), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); } foreach (var vehicle in blacklistedVehicles) { caller.SendChat(Plugin.Inst.Translate("rfgarage_command_gadd_all_blacklist_vehicle", vehicle.asset.id, vehicle.asset.vehicleName), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); } passedVehicles.RemoveRange(0, vehicleIndex); foreach (var vehicle in passedVehicles) { caller.SendChat(Plugin.Inst.Translate("rfgarage_command_all_fail_vehicle", vehicle.asset.id, vehicle.asset.vehicleName), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); } Plugin.GarageAddAllQueueDict[player.CSteamID] = false; return; } case "abort": Plugin.GarageAddAllQueueDict[player.CSteamID] = false; caller.SendChat(Plugin.Inst.Translate("rfgarage_command_all_abort"), Plugin.MsgColor, Plugin.Conf.AnnouncerIconUrl); return; } break; } }
// Token: 0x060039EC RID: 14828 RVA: 0x001BA558 File Offset: 0x001B8958 private bool fire(bool mode, out ERefillWaterType newWaterType) { newWaterType = ERefillWaterType.EMPTY; if (base.channel.isOwner) { Ray ray = new Ray(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); if (!(raycastInfo.transform != null)) { return(false); } InteractableRainBarrel component = raycastInfo.transform.GetComponent <InteractableRainBarrel>(); InteractableTank component2 = raycastInfo.transform.GetComponent <InteractableTank>(); InteractableObjectResource component3 = raycastInfo.transform.GetComponent <InteractableObjectResource>(); WaterVolume waterVolume; if (WaterUtility.isPointUnderwater(raycastInfo.point, out waterVolume)) { if (mode) { return(false); } if (this.waterType != ERefillWaterType.EMPTY) { return(false); } if (waterVolume == null) { newWaterType = ERefillWaterType.SALTY; } else { newWaterType = waterVolume.waterType; } } else if (component != null) { if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component.isFull) { return(false); } newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (!component.isFull) { return(false); } newWaterType = ERefillWaterType.CLEAN; } } else if (component2 != null) { if (component2.source != ETankSource.WATER) { return(false); } if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component2.amount == component2.capacity) { return(false); } newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (component2.amount == 0) { return(false); } newWaterType = ERefillWaterType.CLEAN; } } else { if (!(component3 != null)) { return(false); } if (component3.objectAsset.interactability != EObjectInteractability.WATER) { return(false); } if (mode) { if (this.waterType == ERefillWaterType.EMPTY) { return(false); } if (component3.amount == component3.capacity) { return(false); } newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN || this.waterType == ERefillWaterType.DIRTY) { return(false); } if (component3.amount == 0) { return(false); } newWaterType = ERefillWaterType.DIRTY; } } base.player.input.sendRaycast(raycastInfo); } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return(false); } InputInfo input = base.player.input.getInput(true); if (input == null) { return(false); } if ((input.point - base.player.look.aim.position).sqrMagnitude > 49f) { return(false); } WaterVolume waterVolume2; if (WaterUtility.isPointUnderwater(input.point, out waterVolume2)) { if (mode) { return(false); } if (this.waterType != ERefillWaterType.EMPTY) { return(false); } if (waterVolume2 == null) { newWaterType = ERefillWaterType.SALTY; } else { newWaterType = waterVolume2.waterType; } } else if (input.type == ERaycastInfoType.BARRICADE) { if (input.transform == null || !input.transform.CompareTag("Barricade")) { return(false); } InteractableRainBarrel component4 = input.transform.GetComponent <InteractableRainBarrel>(); InteractableTank component5 = input.transform.GetComponent <InteractableTank>(); if (component4 != null) { if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component4.isFull) { return(false); } BarricadeManager.updateRainBarrel(component4.transform, true, true); newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (!component4.isFull) { return(false); } BarricadeManager.updateRainBarrel(component4.transform, false, true); newWaterType = ERefillWaterType.CLEAN; } } else { if (!(component5 != null)) { return(false); } if (component5.source != ETankSource.WATER) { return(false); } if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component5.amount == component5.capacity) { return(false); } BarricadeManager.updateTank(input.transform, (ushort)((byte)(component5.amount + 1))); newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (component5.amount == 0) { return(false); } BarricadeManager.updateTank(input.transform, (ushort)((byte)(component5.amount - 1))); newWaterType = ERefillWaterType.CLEAN; } } } else if (input.type == ERaycastInfoType.OBJECT) { if (input.transform == null) { return(false); } InteractableObjectResource component6 = input.transform.GetComponent <InteractableObjectResource>(); if (component6 == null || component6.objectAsset.interactability != EObjectInteractability.WATER) { return(false); } if (mode) { if (this.waterType == ERefillWaterType.EMPTY) { return(false); } if (component6.amount == component6.capacity) { return(false); } ObjectManager.updateObjectResource(component6.transform, (ushort)((byte)(component6.amount + 1)), true); newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN || this.waterType == ERefillWaterType.DIRTY) { return(false); } if (component6.amount == 0) { return(false); } ObjectManager.updateObjectResource(component6.transform, (ushort)((byte)(component6.amount - 1)), true); newWaterType = ERefillWaterType.DIRTY; } } } return(true); }
public static async Task <OwnerModel> CheckOwner(this Transform obj) { if (obj == null) { return(null); } var transform = obj; var vehicle = obj.GetComponent <InteractableVehicle>(); if (vehicle != null) { var nameAndGroup = await CheckPair(vehicle.lockedOwner, vehicle.lockedGroup); return(new OwnerModel { Group = vehicle.lockedGroup, GroupName = nameAndGroup.Value, Hp = vehicle.health + "/" + vehicle.asset.health, Owner = vehicle.lockedOwner, OwnerName = nameAndGroup.Key, Id = vehicle.id }); } if (obj.GetComponent <InteractableDoorHinge>() != null) { transform = obj.parent.parent; } if (BarricadeManager.tryGetInfo(transform, out _, out _, out _, out var index, out var r)) { var data = r.barricades[index]; var owner = (CSteamID)data.owner; var group = (CSteamID)data.group; var nameAndGroup = await CheckPair(owner, group); return(new OwnerModel { Group = group, GroupName = nameAndGroup.Value, Hp = data.barricade.health + "/" + data.barricade.asset.health, Owner = owner, OwnerName = nameAndGroup.Key, Id = data.barricade.id }); } if (!StructureManager.tryGetInfo(transform, out _, out _, out index, out var s)) { return(null); } { var data = s.structures[index]; var owner = (CSteamID)data.owner; var group = (CSteamID)data.@group; var nameAndGroup = await CheckPair(owner, group); return(new OwnerModel { Group = group, GroupName = nameAndGroup.Value, Hp = data.structure.health + "/" + data.structure.asset.health, Owner = owner, OwnerName = nameAndGroup.Key, Id = data.structure.id }); } }
public static bool Prefix(InteractableSentry __instance) { RocketPlayer ownerPlayer = new RocketPlayer(__instance.owner.ToString()); bool hasWeapon = (bool)hasWeaponField.GetValue(__instance); bool isFiring = (bool)isFiringField.GetValue(__instance); bool isAiming = (bool)isAimingField.GetValue(__instance); float lastScan = (float)lastScanField.GetValue(__instance); float lastFire = (float)lastFireField.GetValue(__instance); float fireTime = (float)fireTimeField.GetValue(__instance); float lastAim = (float)lastAimField.GetValue(__instance); ItemWeaponAsset displayAsset = displayAssetField.GetValue(__instance) as ItemWeaponAsset; Attachments attachments = attachmentsField.GetValue(__instance) as Attachments; bool interact = (bool)interactField.GetValue(__instance); var playersInRadius = (List <Player>)playersInRadiusField.GetValue(null); var zombiesInRadius = (List <Zombie>)zombiesInRadiusField.GetValue(null); var animalsInRadius = (List <Animal>)animalsInRadiusField.GetValue(null); var targetPlayer = targetPlayerField.GetValue(__instance) as Player; var targetZombie = targetZombieField.GetValue(__instance) as Zombie; var targetAnimal = targetAnimalField.GetValue(__instance) as Animal; var aimTransform = aimTransformField.GetValue(__instance) as Transform; if (__instance.isPowered) { Vector3 vector3_1 = __instance.transform.position + new Vector3(0.0f, 0.65f, 0.0f); Vector3 vector3_2; if ((double)Time.realtimeSinceStartup - (double)lastScan > 0.100000001490116) { lastScanField.SetValue(__instance, Time.realtimeSinceStartup); float a = 48f; if (hasWeapon) { a = Mathf.Min(a, ((ItemWeaponAsset)displayAsset).range); } float sqrRadius = a * a; float num = sqrRadius; Player player = (Player)null; Zombie zombie = (Zombie)null; Animal animal = (Animal)null; if (Provider.isPvP) { playersInRadius.Clear(); PlayerTool.getPlayersInRadius(vector3_1, sqrRadius, playersInRadius); for (int index = 0; index < playersInRadius.Count; ++index) { Player playersInRadiu = playersInRadius[index]; var currentRocketPlayer = new RocketPlayer(playersInRadiu.channel.owner.playerID.steamID.ToString()); if (currentRocketPlayer.HasPermission(GodPermission)) { continue; } if (!(playersInRadiu.channel.owner.playerID.steamID == __instance.owner) && !playersInRadiu.quests.isMemberOfGroup(__instance.group) && (!playersInRadiu.life.isDead && playersInRadiu.animator.gesture != EPlayerGesture.ARREST_START) && ((!playersInRadiu.movement.isSafe || !playersInRadiu.movement.isSafeInfo.noWeapons) && playersInRadiu.movement.canAddSimulationResultsToUpdates) && (!((UnityEngine.Object)player != (UnityEngine.Object)null) || playersInRadiu.animator.gesture != EPlayerGesture.SURRENDER_START) && (__instance.sentryMode != ESentryMode.FRIENDLY || (double)Time.realtimeSinceStartup - (double)playersInRadiu.equipment.lastPunching < 2.0 || playersInRadiu.equipment.isSelected && playersInRadiu.equipment.asset != null && playersInRadiu.equipment.asset.shouldFriendlySentryTargetUser)) { vector3_2 = playersInRadiu.look.aim.position - vector3_1; float sqrMagnitude = vector3_2.sqrMagnitude; if ((double)sqrMagnitude <= (double)num) { Vector3 vector3_3 = playersInRadiu.look.aim.position - vector3_1; float magnitude = vector3_3.magnitude; Vector3 vector3_4 = vector3_3 / magnitude; if (!((UnityEngine.Object)playersInRadiu != (UnityEngine.Object)targetPlayer) || (double)Vector3.Dot(vector3_4, aimTransform.forward) >= 0.5) { if ((double)magnitude > 0.025000000372529) { RaycastHit hit; PhysicsUtility.raycast(new Ray(vector3_1, vector3_4), out hit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, QueryTriggerInteraction.UseGlobal); if (!((UnityEngine.Object)hit.transform != (UnityEngine.Object)null) || !((UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform)) { PhysicsUtility.raycast(new Ray(vector3_1 + vector3_4 * (magnitude - 0.025f), -vector3_4), out hit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, QueryTriggerInteraction.UseGlobal); if ((UnityEngine.Object)hit.transform != (UnityEngine.Object)null && (UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform) { continue; } } else { continue; } } num = sqrMagnitude; player = playersInRadiu; } } } } } zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(vector3_1, sqrRadius, zombiesInRadius); for (int index = 0; index < zombiesInRadius.Count; ++index) { Zombie zombiesInRadiu = zombiesInRadius[index]; if (!zombiesInRadiu.isDead && zombiesInRadiu.isHunting) { Vector3 position = zombiesInRadiu.transform.position; switch (zombiesInRadiu.speciality) { case EZombieSpeciality.NORMAL: position += new Vector3(0.0f, 1.75f, 0.0f); break; case EZombieSpeciality.MEGA: position += new Vector3(0.0f, 2.625f, 0.0f); break; case EZombieSpeciality.CRAWLER: position += new Vector3(0.0f, 0.25f, 0.0f); break; case EZombieSpeciality.SPRINTER: position += new Vector3(0.0f, 1f, 0.0f); break; } vector3_2 = position - vector3_1; float sqrMagnitude = vector3_2.sqrMagnitude; if ((double)sqrMagnitude <= (double)num) { Vector3 vector3_3 = position - vector3_1; float magnitude = vector3_3.magnitude; Vector3 vector3_4 = vector3_3 / magnitude; if (!((UnityEngine.Object)zombiesInRadiu != (UnityEngine.Object)targetZombie) || (double)Vector3.Dot(vector3_4, aimTransform.forward) >= 0.5) { if ((double)magnitude > 0.025000000372529) { RaycastHit hit; PhysicsUtility.raycast(new Ray(vector3_1, vector3_4), out hit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, QueryTriggerInteraction.UseGlobal); if (!((UnityEngine.Object)hit.transform != (UnityEngine.Object)null) || !((UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform)) { PhysicsUtility.raycast(new Ray(vector3_1 + vector3_4 * (magnitude - 0.025f), -vector3_4), out hit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, QueryTriggerInteraction.UseGlobal); if ((UnityEngine.Object)hit.transform != (UnityEngine.Object)null && (UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform) { continue; } } else { continue; } } num = sqrMagnitude; player = (Player)null; zombie = zombiesInRadiu; } } } } animalsInRadius.Clear(); AnimalManager.getAnimalsInRadius(vector3_1, sqrRadius, animalsInRadius); for (int index = 0; index < animalsInRadius.Count; ++index) { Animal animalsInRadiu = animalsInRadius[index]; if (!animalsInRadiu.isDead) { Vector3 position = animalsInRadiu.transform.position; vector3_2 = position - vector3_1; float sqrMagnitude = vector3_2.sqrMagnitude; if ((double)sqrMagnitude <= (double)num) { Vector3 vector3_3 = position - vector3_1; float magnitude = vector3_3.magnitude; Vector3 vector3_4 = vector3_3 / magnitude; if (!((UnityEngine.Object)animalsInRadiu != (UnityEngine.Object)targetAnimal) || (double)Vector3.Dot(vector3_4, aimTransform.forward) >= 0.5) { if ((double)magnitude > 0.025000000372529) { RaycastHit hit; PhysicsUtility.raycast(new Ray(vector3_1, vector3_4), out hit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, QueryTriggerInteraction.UseGlobal); if (!((UnityEngine.Object)hit.transform != (UnityEngine.Object)null) || !((UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform)) { PhysicsUtility.raycast(new Ray(vector3_1 + vector3_4 * (magnitude - 0.025f), -vector3_4), out hit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, QueryTriggerInteraction.UseGlobal); if ((UnityEngine.Object)hit.transform != (UnityEngine.Object)null && (UnityEngine.Object)hit.transform != (UnityEngine.Object)__instance.transform) { continue; } } else { continue; } } num = sqrMagnitude; player = (Player)null; zombie = (Zombie)null; animal = animalsInRadiu; } } } } if ((UnityEngine.Object)player != (UnityEngine.Object)targetPlayer || (UnityEngine.Object)zombie != (UnityEngine.Object)targetZombie || (UnityEngine.Object)animal != (UnityEngine.Object)targetAnimal) { targetPlayerField.SetValue(__instance, player); targetZombieField.SetValue(__instance, zombie); targetAnimalField.SetValue(__instance, animal); lastFireField.SetValue(__instance, Time.realtimeSinceStartup + 0.1f); } } if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { switch (__instance.sentryMode) { case ESentryMode.NEUTRAL: case ESentryMode.FRIENDLY: isFiringField.SetValue(__instance, targetPlayer.animator.gesture != EPlayerGesture.SURRENDER_START); break; case ESentryMode.HOSTILE: isFiringField.SetValue(__instance, true); break; } isAimingField.SetValue(__instance, true); } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { isFiringField.SetValue(__instance, true); isAimingField.SetValue(__instance, true); } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { switch (__instance.sentryMode) { case ESentryMode.NEUTRAL: case ESentryMode.FRIENDLY: isFiringField.SetValue(__instance, targetAnimal.isHunting); break; case ESentryMode.HOSTILE: isFiringField.SetValue(__instance, true); break; } isAimingField.SetValue(__instance, true); } else { isFiringField.SetValue(__instance, false); isAimingField.SetValue(__instance, false); } if (isAiming && (double)Time.realtimeSinceStartup - (double)lastAim > (double)Provider.UPDATE_TIME) { lastAimField.SetValue(__instance, Time.realtimeSinceStartup); Transform transform = (Transform)null; Vector3 vector3_3 = Vector3.zero; if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { transform = targetPlayer.transform; vector3_3 = targetPlayer.look.aim.position; } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { transform = targetZombie.transform; vector3_3 = targetZombie.transform.position; switch (targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector3_3 += new Vector3(0.0f, 1.75f, 0.0f); break; case EZombieSpeciality.MEGA: vector3_3 += new Vector3(0.0f, 2.625f, 0.0f); break; case EZombieSpeciality.CRAWLER: vector3_3 += new Vector3(0.0f, 0.25f, 0.0f); break; case EZombieSpeciality.SPRINTER: vector3_3 += new Vector3(0.0f, 1f, 0.0f); break; } } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { transform = targetAnimal.transform; vector3_3 = targetAnimal.transform.position + Vector3.up; } if ((UnityEngine.Object)transform != (UnityEngine.Object)null) { float yaw = Mathf.Atan2(vector3_3.x - vector3_1.x, vector3_3.z - vector3_1.z) * 57.29578f; double num = (double)vector3_3.y - (double)vector3_1.y; vector3_2 = vector3_3 - vector3_1; double magnitude = (double)vector3_2.magnitude; float pitch = Mathf.Sin((float)(num / magnitude)) * 57.29578f; BarricadeManager.sendAlertSentry(__instance.transform, yaw, pitch); } } if (isFiring && hasWeapon && (__instance.displayItem.state[10] > (byte)0 && !__instance.isOpen) && (double)Time.realtimeSinceStartup - (double)lastFire > (double)fireTime) { lastFireField.SetValue(__instance, lastFire + fireTime); if ((double)Time.realtimeSinceStartup - (double)lastFire > (double)fireTime) { lastFire = Time.realtimeSinceStartup; } float num1 = (float)__instance.displayItem.quality / 100f; if (attachments.magazineAsset == null) { return(false); } if (!ownerPlayer.HasPermission(IgnoreAmmoPermission)) { Console.WriteLine("Ammo reduction"); if ((__instance.sentryAsset.infiniteAmmo ? 1 : (((ItemGunAsset)displayAsset).infiniteAmmo ? 1 : 0)) == 0) { --__instance.displayItem.state[10]; } if (!__instance.sentryAsset.infiniteQuality && Provider.modeConfigData.Items.Has_Durability && (__instance.displayItem.quality > (byte)0 && (double)UnityEngine.Random.value < (double)((ItemWeaponAsset)displayAsset).durability)) { if ((int)__instance.displayItem.quality > (int)((ItemWeaponAsset)displayAsset).wear) { __instance.displayItem.quality -= ((ItemWeaponAsset)displayAsset).wear; } else { __instance.displayItem.quality = (byte)0; } } } if (attachments.barrelAsset == null || !attachments.barrelAsset.isSilenced || __instance.displayItem.state[16] == (byte)0) { AlertTool.alert(__instance.transform.position, 48f); } float num2 = ((ItemGunAsset)displayAsset).spreadAim * ((double)num1 < 0.5 ? (float)(1.0 + (1.0 - (double)num1 * 2.0)) : 1f); if (attachments.tacticalAsset != null && interact) { num2 *= attachments.tacticalAsset.spread; } if (attachments.gripAsset != null) { num2 *= attachments.gripAsset.spread; } if (attachments.barrelAsset != null) { num2 *= attachments.barrelAsset.spread; } if (attachments.magazineAsset != null) { num2 *= attachments.magazineAsset.spread; } if ((UnityEngine.Object)((ItemGunAsset)displayAsset).projectile == (UnityEngine.Object)null) { BarricadeManager.sendShootSentry(__instance.transform); byte pellets = attachments.magazineAsset.pellets; for (byte index1 = 0; (int)index1 < (int)pellets; ++index1) { EPlayerKill kill = EPlayerKill.NONE; uint xp = 0; float times = (float)(1.0 * ((double)num1 < 0.5 ? 0.5 + (double)num1 : 1.0)); Transform transform = (Transform)null; float num3 = 0.0f; if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { transform = targetPlayer.transform; } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { transform = __instance.transform; } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { transform = targetAnimal.transform; } if ((UnityEngine.Object)transform != (UnityEngine.Object)null) { vector3_2 = transform.position - __instance.transform.position; num3 = vector3_2.magnitude; } float num4 = (1f - num3 / ((ItemWeaponAsset)displayAsset).range) * (1f - ((ItemGunAsset)displayAsset).spreadHip) * 0.75f; if ((UnityEngine.Object)transform == (UnityEngine.Object)null || (double)UnityEngine.Random.value > (double)num4) { Vector3 forward = aimTransform.forward; forward += aimTransform.right * UnityEngine.Random.Range(-((ItemGunAsset)displayAsset).spreadHip, ((ItemGunAsset)displayAsset).spreadHip) * num2; forward += aimTransform.up * UnityEngine.Random.Range(-((ItemGunAsset)displayAsset).spreadHip, ((ItemGunAsset)displayAsset).spreadHip) * num2; forward.Normalize(); RaycastInfo raycastInfo = DamageTool.raycast(new Ray(aimTransform.position, forward), ((ItemWeaponAsset)displayAsset).range, RayMasks.DAMAGE_SERVER); if (!((UnityEngine.Object)raycastInfo.transform == (UnityEngine.Object)null)) { DamageTool.impact(raycastInfo.point, raycastInfo.normal, raycastInfo.material, (UnityEngine.Object)raycastInfo.vehicle != (UnityEngine.Object)null || raycastInfo.transform.CompareTag("Barricade") || raycastInfo.transform.CompareTag("Structure") || raycastInfo.transform.CompareTag("Resource")); if ((UnityEngine.Object)raycastInfo.vehicle != (UnityEngine.Object)null) { DamageTool.damage(raycastInfo.vehicle, false, Vector3.zero, false, ((ItemWeaponAsset)displayAsset).vehicleDamage, times, true, out kill, new CSteamID(), EDamageOrigin.Sentry); } else if ((UnityEngine.Object)raycastInfo.transform != (UnityEngine.Object)null) { if (raycastInfo.transform.CompareTag("Barricade")) { ushort result; if (ushort.TryParse(raycastInfo.transform.name, NumberStyles.Any, (IFormatProvider)CultureInfo.InvariantCulture, out result)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, result); if (itemBarricadeAsset != null && (itemBarricadeAsset.isVulnerable || ((ItemWeaponAsset)displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, ((ItemWeaponAsset)displayAsset).barricadeDamage, times, out kill, new CSteamID(), EDamageOrigin.Sentry); } } } else if (raycastInfo.transform.CompareTag("Structure")) { ushort result; if (ushort.TryParse(raycastInfo.transform.name, NumberStyles.Any, (IFormatProvider)CultureInfo.InvariantCulture, out result)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, result); if (itemStructureAsset != null && (itemStructureAsset.isVulnerable || ((ItemWeaponAsset)displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, raycastInfo.direction * Mathf.Ceil((float)attachments.magazineAsset.pellets / 2f), ((ItemWeaponAsset)displayAsset).structureDamage, times, out kill, new CSteamID(), EDamageOrigin.Sentry); } } } else if (raycastInfo.transform.CompareTag("Resource")) { byte x; byte y; ushort index2; if (ResourceManager.tryGetRegion(raycastInfo.transform, out x, out y, out index2)) { ResourceSpawnpoint resourceSpawnpoint = ResourceManager.getResourceSpawnpoint(x, y, index2); if (resourceSpawnpoint != null && !resourceSpawnpoint.isDead && (int)resourceSpawnpoint.asset.bladeID == (int)((ItemWeaponAsset)displayAsset).bladeID) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction * Mathf.Ceil((float)attachments.magazineAsset.pellets / 2f), ((ItemWeaponAsset)displayAsset).resourceDamage, times, 1f, out kill, out xp, new CSteamID(), EDamageOrigin.Sentry); } } } else if (raycastInfo.section < byte.MaxValue) { InteractableObjectRubble componentInParent = raycastInfo.transform.GetComponentInParent <InteractableObjectRubble>(); if ((UnityEngine.Object)componentInParent != (UnityEngine.Object)null && !componentInParent.isSectionDead(raycastInfo.section) && (componentInParent.asset.rubbleIsVulnerable || ((ItemWeaponAsset)displayAsset).isInvulnerable)) { DamageTool.damage(componentInParent.transform, raycastInfo.direction, raycastInfo.section, ((ItemWeaponAsset)displayAsset).objectDamage, times, out kill, out xp, new CSteamID(), EDamageOrigin.Sentry); } } } } } else { Vector3 point = Vector3.zero; if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { point = targetPlayer.look.aim.position; } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { point = targetZombie.transform.position; switch (targetZombie.speciality) { case EZombieSpeciality.NORMAL: point += new Vector3(0.0f, 1.75f, 0.0f); break; case EZombieSpeciality.MEGA: point += new Vector3(0.0f, 2.625f, 0.0f); break; case EZombieSpeciality.CRAWLER: point += new Vector3(0.0f, 0.25f, 0.0f); break; case EZombieSpeciality.SPRINTER: point += new Vector3(0.0f, 1f, 0.0f); break; } } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { point = targetAnimal.transform.position + Vector3.up; } DamageTool.impact(point, -aimTransform.forward, EPhysicsMaterial.FLESH_DYNAMIC, true); Vector3 direction = aimTransform.forward * Mathf.Ceil((float)attachments.magazineAsset.pellets / 2f); if ((UnityEngine.Object)targetPlayer != (UnityEngine.Object)null) { DamageTool.damage(targetPlayer, EDeathCause.SENTRY, ELimb.SPINE, __instance.owner, direction, (IDamageMultiplier)((ItemWeaponAsset)displayAsset).playerDamageMultiplier, times, true, out kill, true, ERagdollEffect.NONE); } else if ((UnityEngine.Object)targetZombie != (UnityEngine.Object)null) { IDamageMultiplier damageMultiplier = ((ItemWeaponAsset)displayAsset).zombieOrPlayerDamageMultiplier; DamageZombieParameters parameters = DamageZombieParameters.make(targetZombie, direction, damageMultiplier, ELimb.SPINE); parameters.times = times; parameters.legacyArmor = true; parameters.instigator = (object)__instance; DamageTool.damageZombie(parameters, out kill, out xp); } else if ((UnityEngine.Object)targetAnimal != (UnityEngine.Object)null) { IDamageMultiplier damageMultiplier = ((ItemWeaponAsset)displayAsset).animalOrPlayerDamageMultiplier; DamageAnimalParameters parameters = DamageAnimalParameters.make(targetAnimal, direction, damageMultiplier, ELimb.SPINE); parameters.times = times; parameters.instigator = (object)__instance; DamageTool.damageAnimal(parameters, out kill, out xp); } } } } __instance.rebuildState(); } } return(false); }
// Token: 0x06002206 RID: 8710 RVA: 0x000B8ED6 File Offset: 0x000B72D6 public override void use() { BarricadeManager.storeStorage(base.transform, Input.GetKey(ControlsSettings.other)); }
protected override async UniTask OnExecuteAsync() { if (Context.Parameters.Length == 0 || string.IsNullOrWhiteSpace(Context.Parameters[0])) { throw new CommandWrongUsageException(Context); } if (!(Context.Actor is UnturnedUser uPlayer)) { throw new CommandWrongUsageException(Context); } if (!Physics.Raycast(uPlayer.Player.Player.look.aim.position, uPlayer.Player.Player.look.aim.forward, out var hit)) { throw new UserFriendlyException(m_StringLocalizer["CommandLoadSchematic:no_target"]); return; } // Trying to get better spot where they're aiming, so the schematic doesn't just spawn straight in the floor hit.point += new Vector3(0, 1, 0); var fullcommand = string.Join(" ", Context.Parameters).ToLower(); var keepLocation = false; var keepHealth = false; var keepState = true; ulong SpecificSteamid64 = 0; ulong specificgroup = 0; if (fullcommand.Contains("-keeppos")) { keepLocation = true; } var maxdist = m_Configuration.GetSection("MaxDistanceToLoadSchematic").Get <int>(); if (keepLocation == false && maxdist != 0 && hit.distance > maxdist) { throw new UserFriendlyException(m_StringLocalizer["CommandLoadSchematic:too_far", maxdist]); } if (fullcommand.Contains("-keephealth")) { keepHealth = true; } if (fullcommand.Contains("-nostate")) { keepState = false; } if (fullcommand.Contains("-setowner")) { SpecificSteamid64 = uPlayer.SteamId.m_SteamID; } if (fullcommand.Contains("-setgroup")) { // Strange issues if the player has no group, no idea why or how the Group ID got equal to the player's Steamid, but this breaks /checkowner and a few other things // [5/15/2020 4:39:04 PM] [Info] Schematics >> Loading sillysignsandstuff for Oh Wonder with parameters Keep Position: True, Keep Health: False, Keep State: True, Set Group = 76561198138254281 Set Steamid64: 76561198138254281. if (uPlayer.Player.Player.quests.groupID != CSteamID.Nil && uPlayer.Player.Player.quests.groupID.m_SteamID != uPlayer.SteamId.m_SteamID) { specificgroup = uPlayer.Player.Player.quests.groupID.m_SteamID; } } var match = new Regex(@"[0-9]{17}", RegexOptions.IgnoreCase).Match(fullcommand); if (match.Success && ulong.TryParse(match.Value, out var result)) { SpecificSteamid64 = result; } var name = Context.Parameters[0].Replace(" ", ""); var ConfigUseDB = m_Configuration.GetSection("UseDatabase").Get <bool>(); SchematicData foundSchematic; if (ConfigUseDB) { var Schematic = await m_SchematicsInfoRepo.FindSchematicAsync(name); if (Schematic == null) { throw new UserFriendlyException(m_StringLocalizer["CommandLoadSchematic:cannot_find_schematic", new { Name = name }]); } foundSchematic = Schematic; } else { var Schematics = await m_DataStore.LoadAsync <SchematicsDataStore>("Schematics"); if (Schematics == null) { throw new UserFriendlyException(m_StringLocalizer["CommandLoadSchematic:cannot_find_schematic", new { Name = name }]); } var FindTheSchematic = Schematics.Schematics.FirstOrDefault(i => i.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); if (FindTheSchematic == null) { throw new UserFriendlyException(m_StringLocalizer["CommandLoadSchematic:cannot_find_schematic", new { Name = name }]); } foundSchematic = FindTheSchematic; } List <BarricadeToSpawn> barricadesToSpawn = new List <BarricadeToSpawn>(); List <StructureToSpawn> structuresToSpawn = new List <StructureToSpawn>(); var river = new BinaryReader(new MemoryStream(foundSchematic.Schematic)); var verison = river.ReadByte(); var useDatabase = river.ReadBoolean(); var Time = river.ReadUInt32(); var playerposition = new Vector3(river.ReadSingle(), river.ReadSingle(), river.ReadSingle()); //Loading {name} saved at {DateTimeOffset.FromUnixTimeSeconds(Time).ToLocalTime().ToString()} await Context.Actor.PrintMessageAsync(m_StringLocalizer["CommandLoadSchematic:Loading_Schematic", new { Name = name, TimeSaved = DateTimeOffset.FromUnixTimeSeconds(Time).ToLocalTime().ToString() }]); var setgroupstring = specificgroup == 0 ? "false" : specificgroup.ToString(); var setsteamid64string = SpecificSteamid64 == 0 ? "false" : SpecificSteamid64.ToString(); m_Logger.LogInformation( $"Loading {name} for {uPlayer.DisplayName} with parameters Keep Position: {keepLocation}, Keep Health: {keepHealth}, Keep State: {keepState}, Set Group = {setgroupstring} Set Steamid64: {setsteamid64string}."); var barricadecountInt32 = river.ReadInt32(); var structurecountInt32 = river.ReadInt32(); var error = 0; for (var i = 0; i < barricadecountInt32; i++) { var barricadeid = river.ReadUInt16(); var barricadehealth = river.ReadUInt16(); var barricadestate = river.ReadBytes(river.ReadUInt16()); var point = new Vector3(river.ReadSingle(), river.ReadSingle(), river.ReadSingle()); var angleX = river.ReadByte(); var angleY = river.ReadByte(); var angleZ = river.ReadByte(); var owner = river.ReadUInt64(); var group = river.ReadUInt64(); var barricade = new Barricade(barricadeid); if (keepHealth) { barricade.health = barricadehealth; } if (keepState) { barricade.state = barricadestate; } if (!keepLocation) { point = point - playerposition + hit.point; } if (SpecificSteamid64 != 0) { owner = SpecificSteamid64; } if (specificgroup != 0) { group = specificgroup; } var rotation = Quaternion.Euler(angleX * 2, angleY * 2, angleZ * 2); //rotation.eulerAngles = new Vector3(angleX, angleY, angleZ); barricadesToSpawn.Add(new BarricadeToSpawn(barricade, point, rotation, owner, group)); } if (error != 0) { m_Logger.LogInformation($"Unexpected Barricade Error occured {error} times"); } error = 0; for (var i = 0; i < structurecountInt32; i++) { var structureid = river.ReadUInt16(); var structurehealth = river.ReadUInt16(); var point = new Vector3(river.ReadSingle(), river.ReadSingle(), river.ReadSingle()); var angleX = river.ReadByte(); var angleY = river.ReadByte(); var angleZ = river.ReadByte(); var owner = river.ReadUInt64(); var group = river.ReadUInt64(); var structure = new Structure(structureid); if (keepHealth) { structure.health = structurehealth; } // For when nelson adds proper way to add structures if (!keepLocation) { point = point - playerposition + hit.point; } if (SpecificSteamid64 != 0) { owner = SpecificSteamid64; } if (specificgroup != 0) { group = specificgroup; } var rotation = Quaternion.Euler(angleX * 2, angleY * 2, angleZ * 2); //rotation.eulerAngles = new Vector3(angleX, angleY, angleZ); structuresToSpawn.Add(new StructureToSpawn(structure, point, rotation, owner, group)); } await UniTask.SwitchToMainThread(); foreach (var barricadeToSpawn in barricadesToSpawn) { var barricadetransform = BarricadeManager.dropNonPlantedBarricade(barricadeToSpawn.Barricade, barricadeToSpawn.Point, barricadeToSpawn.Rotation, barricadeToSpawn.Owner, barricadeToSpawn.Group); if (barricadetransform == null) { error++; continue; } var InteractableStorage = barricadetransform.GetComponent <InteractableStorage>(); if (InteractableStorage != null) { BarricadeManager.sendStorageDisplay(barricadetransform, InteractableStorage.displayItem, InteractableStorage.displaySkin, InteractableStorage.displayMythic, InteractableStorage.displayTags, InteractableStorage.displayDynamicProps); } } foreach (var structureToSpawn in structuresToSpawn) { if (!StructureManager.dropReplicatedStructure(structureToSpawn.Structure, structureToSpawn.Point, structureToSpawn.Rotation, structureToSpawn.Owner, structureToSpawn.Group)) { error++; } } await UniTask.SwitchToThreadPool(); if (error != 0) { m_Logger.LogInformation($"Unexpected Barricade Error occured {error} times"); } river.Dispose(); //UnturnedChat.Say(player, $"Done, we have loaded Structures: {structurecountInt32} and Barricades: {barricadecountInt32} from {name}"); await Context.Actor.PrintMessageAsync(m_StringLocalizer["CommandLoadSchematic:Loading_Schematic_Finished", new { Name = name, StructureCount = structurecountInt32, BarricadeCount = barricadecountInt32 }]); }
public static void Prefix(CSteamID steamID, byte id, PlayerAnimator __instance) { Player ply = __instance.channel.owner.player; if (ply is null) { return; } TTTPlayer tttplayer = PlayerManager.GetTTTPlayer(ply.channel.owner.playerID.steamID); if (tttplayer is null) { return; } if (tttplayer.Role == PlayerRole.TRAITOR) { return; } RaycastInfo traceResult = TraceRay(ply, 10f, RayMasks.BARRICADE_INTERACT); if (traceResult is null) { return; } if (traceResult.transform is null) { return; } InteractableCharge charge = traceResult.transform.gameObject.GetComponent <InteractableCharge>(); if (charge is null) { return; } byte x; byte y; ushort plant; ushort index; BarricadeRegion region; if (!BarricadeManager.tryGetInfo(charge.transform, out x, out y, out plant, out index, out region)) { return; } BarricadeManager.instance.channel.send("tellBarricadeOwnerAndGroup", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { x, y, plant, index, (ulong)ply.channel.owner.playerID.steamID, (ulong)0 }); if (PlayerManager.GetTTTPlayer(__instance.channel.owner.playerID.steamID).Defuser) { __instance.channel.owner.player.interact.sendSalvageTimeOverride(5f); } else { __instance.channel.owner.player.interact.sendSalvageTimeOverride(10f); } //CSteamID steamID, byte x, byte y, ushort plant, ushort index, ulong newOwner, ulong newGroup }
public override void UpdateState(List <UnturnedPlayer> players) { if (GetValue <int>() == 0) { return; } if ((DateTime.Now - _lastRun).TotalSeconds < GetValue <int>()) { return; } _lastRun = DateTime.Now; if (StructureManager.regions != null) { foreach (var region in StructureManager.regions) { if (region == null) { continue; } byte index = 0; var dropsList = region.drops.ToList(); foreach (var drop in dropsList) { if (dropsList.Count != region.drops.Count) { break; } if (dropsList.Count != region.structures.Count) { break; } var structure = region.structures.ToList().ElementAt(index); index++; if (structure?.structure == null) { continue; } if (!Region.Type.IsInRegion(new SerializablePosition(structure.point))) { continue; } var asset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, structure.structure.id); if (asset == null) { continue; } StructureManager.damage(drop.model, Vector3.zero, 10f, 1f, true); } } } if (BarricadeManager.regions == null) { return; } { foreach (var region in BarricadeManager.regions) { if (region == null) { continue; } byte index = 0; var dropsList = region.drops.ToList(); foreach (var drop in dropsList) { if (dropsList.Count != region.drops.Count) { break; } if (dropsList.Count != region.barricades.Count) { break; } var barricade = region.barricades.ToList().ElementAt(index); index++; if (barricade?.barricade == null) { continue; } if (!Region.Type.IsInRegion(new SerializablePosition(barricade.point))) { continue; } var asset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, barricade.barricade.id); if (asset == null) { continue; } BarricadeManager.damage(drop.model, 10f, 1f, true); } } } }
public void Execute(IRocketPlayer caller, string[] args) { var PlayerCaller = (UnturnedPlayer)caller; // actually get the door you are looking at if (args.Length != 2) { UnturnedChat.Say(caller, "Invalid arguments", Color.red); return; } InteractableDoorHinge component = raycastdoor.Getdoor(PlayerCaller); if (component != null) { var name = args[0]; var permissionname = args[1]; InteractableDoor door = component.door; byte x; byte y; ushort plant; ushort index; BarricadeRegion barricadeRegion; BarricadeManager.tryGetInfo(door.transform, out x, out y, out plant, out index, out barricadeRegion); var permission = "Registereddoor." + permissionname; Registereddoortype tempvar = new Registereddoortype(); tempvar.name = name; tempvar.permission = permission; tempvar.steamid = PlayerCaller.CSteamID.ToString(); tempvar.doorposition = door.transform.position; BarricadeDrop barricadedrop = barricadeRegion.drops[index]; var ID = barricadedrop.instanceID; tempvar.ID = ID; if (miscstuff.Instance.Configuration.Instance.listofregistereddoors.Count > 0) { foreach (Registereddoortype doorinfo in miscstuff.Instance.Configuration.Instance.listofregistereddoors) { if (doorinfo.name == tempvar.name) { UnturnedChat.Say(caller, "A door already exists with that name!", Color.red); return; } else if (doorinfo.ID == ID) { UnturnedChat.Say(caller, "This door " + doorinfo.name + " is already registered!", Color.red); return; } } } miscstuff.Instance.Configuration.Instance.listofregistereddoors.Add(tempvar); UnturnedChat.Say(caller, "Door Registered!", Color.blue); miscstuff.Instance.Configuration.Save(); } else { UnturnedChat.Say(caller, "Not looking at a door!"); return; } }
public override void use() { BarricadeManager.toggleSpot(base.transform); }
public override void use() { BarricadeManager.toggleDoor(this.door.transform); }
public static void SendOpenDoor(ushort plant, byte x, byte y, ushort index, InteractableDoor interactableDoor, BarricadeRegion barricadeRegion) { BarricadeManager.ServerSetDoorOpen(interactableDoor, !interactableDoor.isOpen); }
// Token: 0x06002102 RID: 8450 RVA: 0x000B450D File Offset: 0x000B290D public override void use() { BarricadeManager.toggleGenerator(base.transform); }
// Token: 0x0600339D RID: 13213 RVA: 0x0014ECF0 File Offset: 0x0014D0F0 private void OnTriggerEnter(Collider other) { if (this.isExploded) { return; } if (other.isTrigger) { return; } if (other.transform.CompareTag("Agent")) { return; } this.isExploded = true; Vector3 normalized = (base.transform.position - this.lastPos).normalized; if (Provider.isServer) { float num = Mathf.Clamp(base.transform.parent.GetComponent <Rigidbody>().velocity.magnitude, 0f, 20f); if (num < 3f) { return; } if (other.transform.CompareTag("Player")) { Player player = DamageTool.getPlayer(other.transform); if (player != null) { EPlayerKill eplayerKill; DamageTool.damage(player, EDeathCause.BOULDER, ELimb.SPINE, CSteamID.Nil, normalized, Boulder.DAMAGE_PLAYER, num, out eplayerKill); } } else if (other.transform.CompareTag("Vehicle")) { InteractableVehicle component = other.transform.GetComponent <InteractableVehicle>(); if (component != null && component.asset != null && component.asset.isVulnerableToEnvironment) { VehicleManager.damage(component, Boulder.DAMAGE_VEHICLE, num, true); } } else if (other.transform.CompareTag("Barricade")) { Transform transform = other.transform; InteractableDoorHinge component2 = transform.GetComponent <InteractableDoorHinge>(); if (component2 != null) { transform = component2.transform.parent.parent; } BarricadeManager.damage(transform, Boulder.DAMAGE_BARRICADE, num, true); } else if (other.transform.CompareTag("Structure")) { StructureManager.damage(other.transform, normalized, Boulder.DAMAGE_STRUCTURE, num, true); } else if (other.transform.CompareTag("Resource")) { EPlayerKill eplayerKill2; uint num2; ResourceManager.damage(other.transform, normalized, Boulder.DAMAGE_RESOURCE, num, 1f, out eplayerKill2, out num2); } else { InteractableObjectRubble componentInParent = other.transform.GetComponentInParent <InteractableObjectRubble>(); if (componentInParent != null) { EPlayerKill eplayerKill3; uint num3; DamageTool.damage(componentInParent.transform, normalized, componentInParent.getSection(other.transform), Boulder.DAMAGE_OBJECT, num, out eplayerKill3, out num3); } } } if (!Dedicator.isDedicated) { EffectManager.effect(52, base.transform.position, -normalized); } }
public void OnDamageBarricade(CSteamID steamid, Transform barricade, ref ushort num2, ref bool barricadebool, EDamageOrigin damageorigin) { //Logdamage(steamid, barricade,num2); byte x; byte y; ushort num; ushort index; BarricadeRegion barricadeRegion; string hq; hq = " "; UnturnedPlayer player; CSteamID steam64; ushort itemid; float bx; float by; float bz; ulong owner; string url; string barricadename; //initialize variables in case exception happens which it will and data is missing. bx = 0; by = 0; bz = 0; url = ""; itemid = 0; owner = 0; player = null; steam64.m_SteamID = 0; barricadename = " Unknown"; try { BarricadeManager.tryGetInfo(barricade, out x, out y, out num, out index, out barricadeRegion); BarricadeData barricadetargeted = barricadeRegion.barricades[index]; //if (barricadetargeted.barricade.health < num2) //{ //Rocket.Core.Logging.Logger.Log("Sqr Distance to Axis HQ: " + (barricadetargeted.point - axishq).sqrMagnitude); //Rocket.Core.Logging.Logger.Log("Sqr Distance to Allies HQ: "+ (barricadetargeted.point - allieshq).sqrMagnitude); /*if (((barricadetargeted.point - axishq).sqrMagnitude <= 3600) || * ((barricadetargeted.point - allieshq).sqrMagnitude <= 3600)) */ Vector2 barricadevector2; barricadevector2.x = barricadetargeted.point.x; barricadevector2.y = barricadetargeted.point.z; if (((barricadevector2 - axishq).magnitude <= 500) || (barricadevector2 - allieshq).magnitude <= 500) { if ((barricadevector2 - axishq).magnitude <= 500) { hq = " Axis "; } else if ((barricadevector2 - allieshq).magnitude <= 500) { hq = " Allies "; } Rocket.Core.Logging.Logger.Log("Barricade damaged in HQ: " + hq); if (steamid.m_SteamID != 0) { player = UnturnedPlayer.FromCSteamID(steamid); } else { player = null; } // Rocket.Core.Logging.Logger.Log("destroying player found"); steam64 = steamid; // itemid = barricadetargeted.barricade.id; Rocket.Core.Logging.Logger.Log("Barricade ID found"); ItemAsset itemAsset = (from i in new List <ItemAsset>(Assets.find(EAssetType.ITEM).Cast <ItemAsset>()) where i.itemName != null orderby i.itemName.Length where i.id == itemid select i).FirstOrDefault <ItemAsset>(); //stole this from rockets /i command barricadename = itemAsset.itemName; // Rocket.Core.Logging.Logger.Log("barricade name found"); bx = barricadetargeted.point.x; by = barricadetargeted.point.y; bz = barricadetargeted.point.z; // Rocket.Core.Logging.Logger.Log("barricade location found"); //and then send to discord webhook owner = barricadetargeted.owner; // Rocket.Core.Logging.Logger.Log("barricade owner found"); if (player != null) { url = player.SteamProfile.AvatarFull.ToString(); //Rocket.Core.Logging.Logger.Log("steam profile avatar found"); } else { url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Question_mark_%28black%29.svg/200px-Question_mark_%28black%29.svg.png"; // Rocket.Core.Logging.Logger.Log("no player - url not done"); } Discord.SendWebhookPost(Configuration.Instance.raidalertchannel, Discord.BuildDiscordEmbed("A barricade was damaged in" + hq + "HQ", "This barricade was damagedat " + DateTime.Now, player.DisplayName, url, 16711680, new object[] { Discord.BuildDiscordField("Destroyer steam64", steam64.ToString(), true), Discord.BuildDiscordField("Barricade ID", itemid.ToString(), true), Discord.BuildDiscordField("Barricade Name", barricadename, true), Discord.BuildDiscordField("Barricade Position", "X: " + bx + " Y: " + by + " Z: " + bz, true), Discord.BuildDiscordField("Owner of this barricade", owner.ToString(), true), })); } } catch (Exception e) { //uh oh! a barriacde has requested to break but hasn't broken!! Likely due to advanced regions nodestroy flag!! var error = e; Rocket.Core.Logging.Logger.Log("Exception caught: " + e); bool found = false; foreach (var spawner in miscstuff.Instance.Configuration.Instance.listofignoredexploitbarricades) { if (itemid == spawner) { found = true; } } if (found == false) { Discord.SendWebhookPost("https://ptb.discord.com/api/webhooks/807221467204550666/yte_hGdNflFqCtW80uhnNR1O9a0uX8GNoz5xGdur9xfLjUvRhs2sIctPypJocXdSVHRU", Discord.BuildDiscordEmbed("Possible Exploit of infinite crops detected at" + hq + "HQ", "Possible exploit detected at: " + DateTime.Now, "Unknown Player", "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Question_mark_%28black%29.svg/200px-Question_mark_%28black%29.svg.png", 16711680, new object[] { Discord.BuildDiscordField("Crop ID", itemid.ToString(), true), Discord.BuildDiscordField("Crop Name", barricadename, true), Discord.BuildDiscordField("Crop Position", "X: " + bx + " Y: " + by + " Z: " + bz, true), Discord.BuildDiscordField("Owner of this plant:", owner.ToString(), true), })); } } }