// Token: 0x0600230C RID: 8972 RVA: 0x000C3B82 File Offset: 0x000C1F82 public Barricade(ushort newID, ushort newHealth, byte[] newState, ItemBarricadeAsset newAsset) { this._id = newID; this.health = newHealth; this.state = newState; this.asset = newAsset; }
public LevelBuildableObject(Vector3 newPoint, Quaternion newRotation, ushort newID) { this.point = newPoint; this.rotation = newRotation; this._id = newID; this._asset = (ItemAsset)Assets.find(EAssetType.ITEM, this.id); if (this.asset == null || this.asset.id != this.id) { this._asset = (ItemAsset)Assets.find(EAssetType.ITEM, this.id); if (this.asset == null) { return; } } if (Level.isEditor) { ItemBarricadeAsset itemBarricadeAsset = this.asset as ItemBarricadeAsset; ItemStructureAsset itemStructureAsset = this.asset as ItemStructureAsset; if (itemBarricadeAsset != null) { this._transform = Object.Instantiate <GameObject>(itemBarricadeAsset.barricade).transform; } else if (itemStructureAsset != null) { this._transform = Object.Instantiate <GameObject>(itemStructureAsset.structure).transform; } if (this.transform != null) { this.transform.name = this.id.ToString(); this.transform.parent = LevelObjects.models; this.transform.position = newPoint; this.transform.rotation = newRotation; Rigidbody rigidbody = this.transform.GetComponent <Rigidbody>(); if (rigidbody == null) { rigidbody = this.transform.gameObject.AddComponent <Rigidbody>(); rigidbody.useGravity = false; rigidbody.isKinematic = true; } this.transform.gameObject.SetActive(false); LevelBuildableObject.colliders.Clear(); this.transform.GetComponentsInChildren <Collider>(true, LevelBuildableObject.colliders); for (int i = 0; i < LevelBuildableObject.colliders.Count; i++) { if (LevelBuildableObject.colliders[i].gameObject.layer != LayerMasks.BARRICADE && LevelBuildableObject.colliders[i].gameObject.layer != LayerMasks.STRUCTURE) { Object.Destroy(LevelBuildableObject.colliders[i].gameObject); } } } } }
public void updateState(ItemBarricadeAsset asset) { this.asset = (ItemBeaconAsset)asset; }
public static Transform getBarricade(Transform parent, byte hp, Vector3 pos, Quaternion rot, ushort id, byte[] state) { ItemBarricadeAsset asset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id); return(BarricadeTool.getBarricade(parent, hp, 0UL, 0UL, pos, rot, id, state, asset)); }
public static Transform getBarricade(Transform parent, byte hp, ulong owner, ulong group, Vector3 pos, Quaternion rot, ushort id, byte[] state, ItemBarricadeAsset asset) { if (asset != null) { Transform transform; if (Dedicator.isDedicated) { transform = Object.Instantiate <GameObject>(asset.clip).transform; } else { transform = Object.Instantiate <GameObject>(asset.barricade).transform; } transform.name = id.ToString(); transform.parent = parent; transform.localPosition = pos; transform.localRotation = rot; if (Provider.isServer && asset.nav != null) { Transform transform2 = Object.Instantiate <GameObject>(asset.nav).transform; transform2.name = "Nav"; if (asset.build == EBuild.DOOR || asset.build == EBuild.GATE || asset.build == EBuild.SHUTTER || asset.build == EBuild.HATCH) { Transform transform3 = transform.FindChild("Skeleton").FindChild("Hinge"); if (transform3 != null) { transform2.parent = transform3; } else { transform2.parent = transform; } } else { transform2.parent = transform; } transform2.localPosition = Vector3.zero; transform2.localRotation = Quaternion.identity; } Transform transform4 = transform.FindChildRecursive("Burning"); if (transform4 != null) { transform4.gameObject.AddComponent <TemperatureTrigger>().temperature = EPlayerTemperature.BURNING; } Transform transform5 = transform.FindChildRecursive("Warm"); if (transform5 != null) { transform5.gameObject.AddComponent <TemperatureTrigger>().temperature = EPlayerTemperature.WARM; } if (asset.build == EBuild.DOOR || asset.build == EBuild.GATE || asset.build == EBuild.SHUTTER || asset.build == EBuild.HATCH) { InteractableDoor interactableDoor = transform.gameObject.AddComponent <InteractableDoor>(); interactableDoor.updateState(asset, state); Transform transform6 = transform.FindChild("Skeleton").FindChild("Hinge"); if (transform6 != null) { transform6.gameObject.AddComponent <InteractableDoorHinge>().door = interactableDoor; } Transform transform7 = transform.FindChild("Skeleton").FindChild("Left_Hinge"); if (transform7 != null) { transform7.gameObject.AddComponent <InteractableDoorHinge>().door = interactableDoor; } Transform transform8 = transform.FindChild("Skeleton").FindChild("Right_Hinge"); if (transform8 != null) { transform8.gameObject.AddComponent <InteractableDoorHinge>().door = interactableDoor; } } else if (asset.build == EBuild.BED) { transform.gameObject.AddComponent <InteractableBed>().updateState(asset, state); } else if (asset.build == EBuild.STORAGE || asset.build == EBuild.STORAGE_WALL) { transform.gameObject.AddComponent <InteractableStorage>().updateState(asset, state); } else if (asset.build == EBuild.FARM) { transform.gameObject.AddComponent <InteractableFarm>().updateState(asset, state); } else if (asset.build == EBuild.TORCH || asset.build == EBuild.CAMPFIRE) { transform.gameObject.AddComponent <InteractableFire>().updateState(asset, state); } else if (asset.build == EBuild.OVEN) { transform.gameObject.AddComponent <InteractableOven>().updateState(asset, state); } else if (asset.build == EBuild.SPIKE || asset.build == EBuild.WIRE) { transform.FindChild("Trap").gameObject.AddComponent <InteractableTrap>().updateState(asset, state); } else if (asset.build == EBuild.CHARGE) { InteractableCharge interactableCharge = transform.gameObject.AddComponent <InteractableCharge>(); interactableCharge.updateState(asset, state); interactableCharge.owner = owner; interactableCharge.group = group; } else if (asset.build == EBuild.GENERATOR) { transform.gameObject.AddComponent <InteractableGenerator>().updateState(asset, state); } else if (asset.build == EBuild.SPOT || asset.build == EBuild.CAGE) { transform.gameObject.AddComponent <InteractableSpot>().updateState(asset, state); } else if (asset.build == EBuild.SAFEZONE) { transform.gameObject.AddComponent <InteractableSafezone>().updateState(asset, state); } else if (asset.build == EBuild.OXYGENATOR) { transform.gameObject.AddComponent <InteractableOxygenator>().updateState(asset, state); } else if (asset.build == EBuild.SIGN || asset.build == EBuild.SIGN_WALL || asset.build == EBuild.NOTE) { transform.gameObject.AddComponent <InteractableSign>().updateState(asset, state); } else if (asset.build == EBuild.CLAIM) { InteractableClaim interactableClaim = transform.gameObject.AddComponent <InteractableClaim>(); interactableClaim.updateState(asset); interactableClaim.owner = owner; interactableClaim.group = group; } else if (asset.build == EBuild.BEACON) { transform.gameObject.AddComponent <InteractableBeacon>().updateState(asset); } else if (asset.build == EBuild.BARREL_RAIN) { transform.gameObject.AddComponent <InteractableRainBarrel>().updateState(asset, state); } else if (asset.build == EBuild.OIL) { transform.gameObject.AddComponent <InteractableOil>().updateState(asset, state); } else if (asset.build == EBuild.TANK) { transform.gameObject.AddComponent <InteractableTank>().updateState(asset, state); } else if (asset.build == EBuild.SENTRY) { InteractableSentry interactableSentry = transform.gameObject.AddComponent <InteractableSentry>(); InteractablePower power = transform.gameObject.AddComponent <InteractablePower>(); interactableSentry.power = power; interactableSentry.updateState(asset, state); } else if (asset.build == EBuild.LIBRARY) { transform.gameObject.AddComponent <InteractableLibrary>().updateState(asset, state); } else if (asset.build == EBuild.MANNEQUIN) { transform.gameObject.AddComponent <InteractableMannequin>().updateState(asset, state); } else if (asset.build == EBuild.STEREO) { transform.gameObject.AddComponent <InteractableStereo>().updateState(asset, state); } if (!asset.isUnpickupable) { Interactable2HP interactable2HP = transform.gameObject.AddComponent <Interactable2HP>(); interactable2HP.hp = hp; if (asset.build == EBuild.DOOR || asset.build == EBuild.GATE || asset.build == EBuild.SHUTTER || asset.build == EBuild.HATCH) { Transform transform9 = transform.FindChild("Skeleton").FindChild("Hinge"); if (transform9 != null) { Interactable2SalvageBarricade interactable2SalvageBarricade = transform9.gameObject.AddComponent <Interactable2SalvageBarricade>(); interactable2SalvageBarricade.root = transform; interactable2SalvageBarricade.hp = interactable2HP; interactable2SalvageBarricade.owner = owner; interactable2SalvageBarricade.group = group; } Transform transform10 = transform.FindChild("Skeleton").FindChild("Left_Hinge"); if (transform10 != null) { Interactable2SalvageBarricade interactable2SalvageBarricade2 = transform10.gameObject.AddComponent <Interactable2SalvageBarricade>(); interactable2SalvageBarricade2.root = transform; interactable2SalvageBarricade2.hp = interactable2HP; interactable2SalvageBarricade2.owner = owner; interactable2SalvageBarricade2.group = group; } Transform transform11 = transform.FindChild("Skeleton").FindChild("Right_Hinge"); if (transform11 != null) { Interactable2SalvageBarricade interactable2SalvageBarricade3 = transform11.gameObject.AddComponent <Interactable2SalvageBarricade>(); interactable2SalvageBarricade3.root = transform; interactable2SalvageBarricade3.hp = interactable2HP; interactable2SalvageBarricade3.owner = owner; interactable2SalvageBarricade3.group = group; } } else { Interactable2SalvageBarricade interactable2SalvageBarricade4 = transform.gameObject.AddComponent <Interactable2SalvageBarricade>(); interactable2SalvageBarricade4.root = transform; interactable2SalvageBarricade4.hp = interactable2HP; interactable2SalvageBarricade4.owner = owner; interactable2SalvageBarricade4.group = group; } } return(transform); } Transform transform12 = new GameObject().transform; transform12.name = id.ToString(); transform12.tag = "Barricade"; transform12.gameObject.layer = LayerMasks.BARRICADE; return(transform12); }
// Token: 0x060039D1 RID: 14801 RVA: 0x001B7FEC File Offset: 0x001B63EC private void fire() { float num = (float)base.player.equipment.quality / 100f; if (Provider.isServer) { AlertTool.alert(base.transform.position, ((ItemMeleeAsset)base.player.equipment.asset).alertRadius); if (Provider.modeConfigData.Items.Has_Durability && base.player.equipment.quality > 0 && UnityEngine.Random.value < ((ItemWeaponAsset)base.player.equipment.asset).durability) { if (base.player.equipment.quality > ((ItemWeaponAsset)base.player.equipment.asset).wear) { PlayerEquipment equipment = base.player.equipment; equipment.quality -= ((ItemWeaponAsset)base.player.equipment.asset).wear; } else { base.player.equipment.quality = 0; } base.player.equipment.sendUpdateQuality(); } } if (base.channel.isOwner) { int num2; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Shot", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Shot", num2 + 1); } Ray ray = new Ray(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, ((ItemWeaponAsset)base.player.equipment.asset).range, RayMasks.DAMAGE_CLIENT); if (raycastInfo.player != null && ((ItemMeleeAsset)base.player.equipment.asset).playerDamageMultiplier.damage > 1f && !base.player.quests.isMemberOfSameGroupAs(raycastInfo.player) && Provider.isPvP) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } if (raycastInfo.limb == ELimb.SKULL && Provider.provider.statisticsService.userStatisticsService.getStatistic("Headshots", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Headshots", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, (raycastInfo.limb != ELimb.SKULL) ? EPlayerHit.ENTITIY : EPlayerHit.CRITICAL); } else if ((raycastInfo.zombie != null && ((ItemMeleeAsset)base.player.equipment.asset).zombieDamageMultiplier.damage > 1f) || (raycastInfo.animal != null && ((ItemMeleeAsset)base.player.equipment.asset).animalDamageMultiplier.damage > 1f)) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } if (raycastInfo.limb == ELimb.SKULL && Provider.provider.statisticsService.userStatisticsService.getStatistic("Headshots", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Headshots", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, (raycastInfo.limb != ELimb.SKULL) ? EPlayerHit.ENTITIY : EPlayerHit.CRITICAL); } else if (raycastInfo.vehicle != null && ((ItemMeleeAsset)base.player.equipment.asset).vehicleDamage > 1f) { if (((ItemMeleeAsset)base.player.equipment.asset).isRepair) { if (!raycastInfo.vehicle.isExploded && !raycastInfo.vehicle.isRepaired) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } else if (!raycastInfo.vehicle.isDead && raycastInfo.vehicle.asset != null && raycastInfo.vehicle.canBeDamaged && (raycastInfo.vehicle.asset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable)) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Barricade") && ((ItemMeleeAsset)base.player.equipment.asset).barricadeDamage > 1f) { InteractableDoorHinge component = raycastInfo.transform.GetComponent <InteractableDoorHinge>(); if (component != null) { raycastInfo.transform = component.transform.parent.parent; } ushort id; if (ushort.TryParse(raycastInfo.transform.name, out id)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id); if (itemBarricadeAsset != null) { if (((ItemMeleeAsset)base.player.equipment.asset).isRepair) { Interactable2HP component2 = raycastInfo.transform.GetComponent <Interactable2HP>(); if (component2 != null && itemBarricadeAsset.isRepairable && component2.hp < 100) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } else if (itemBarricadeAsset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } } else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Structure") && ((ItemMeleeAsset)base.player.equipment.asset).structureDamage > 1f) { ushort id2; if (ushort.TryParse(raycastInfo.transform.name, out id2)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id2); if (itemStructureAsset != null) { if (((ItemMeleeAsset)base.player.equipment.asset).isRepair) { Interactable2HP component3 = raycastInfo.transform.GetComponent <Interactable2HP>(); if (component3 != null && itemStructureAsset.isRepairable && component3.hp < 100) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } else if (itemStructureAsset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } } else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Resource") && ((ItemMeleeAsset)base.player.equipment.asset).resourceDamage > 1f) { 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)base.player.equipment.asset).bladeID) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } else if (raycastInfo.transform != null && ((ItemMeleeAsset)base.player.equipment.asset).objectDamage > 1f) { InteractableObjectRubble component4 = raycastInfo.transform.GetComponent <InteractableObjectRubble>(); if (component4 != null) { raycastInfo.section = component4.getSection(raycastInfo.collider.transform); if (!component4.isSectionDead(raycastInfo.section) && (component4.asset.rubbleIsVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable)) { if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1); } PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } base.player.input.sendRaycast(raycastInfo); } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return; } InputInfo input = base.player.input.getInput(true); if (input == null) { return; } if ((input.point - base.player.look.aim.position).sqrMagnitude > Mathf.Pow(((ItemMeleeAsset)base.player.equipment.asset).range + 4f, 2f)) { return; } if (!((ItemMeleeAsset)base.player.equipment.asset).isRepair) { DamageTool.impact(input.point, input.normal, input.material, input.type != ERaycastInfoType.NONE && input.type != ERaycastInfoType.OBJECT); } EPlayerKill eplayerKill = EPlayerKill.NONE; uint num3 = 0u; float num4 = 1f; num4 *= 1f + base.channel.owner.player.skills.mastery(0, 0) * 0.5f; num4 *= ((this.swingMode != ESwingMode.STRONG) ? 1f : ((ItemMeleeAsset)base.player.equipment.asset).strength); num4 *= ((num >= 0.5f) ? 1f : (0.5f + num)); if (input.type == ERaycastInfoType.PLAYER) { if (input.player != null && !base.player.quests.isMemberOfSameGroupAs(input.player) && Provider.isPvP) { DamageTool.damage(input.player, EDeathCause.MELEE, input.limb, base.channel.owner.playerID.steamID, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).playerDamageMultiplier, num4, true, out eplayerKill); } } else if (input.type == ERaycastInfoType.ZOMBIE) { if (input.zombie != null) { DamageTool.damage(input.zombie, input.limb, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).zombieDamageMultiplier, num4, true, out eplayerKill, out num3); if (base.player.movement.nav != 255) { input.zombie.alert(base.transform.position, true); } } } else if (input.type == ERaycastInfoType.ANIMAL) { if (input.animal != null) { DamageTool.damage(input.animal, input.limb, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).animalDamageMultiplier, num4, out eplayerKill, out num3); input.animal.alertPoint(base.transform.position, true); } } else if (input.type == ERaycastInfoType.VEHICLE) { if (input.vehicle != null && input.vehicle.asset != null && input.vehicle.canBeDamaged && (input.vehicle.asset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable || ((ItemMeleeAsset)base.player.equipment.asset).isRepair)) { if (((ItemMeleeAsset)base.player.equipment.asset).isRepair) { num4 *= 1f + base.channel.owner.player.skills.mastery(2, 6); } DamageTool.damage(input.vehicle, true, input.point, ((ItemMeleeAsset)base.player.equipment.asset).isRepair, ((ItemMeleeAsset)base.player.equipment.asset).vehicleDamage, num4, true, out eplayerKill); } } else if (input.type == ERaycastInfoType.BARRICADE) { ushort id3; if (input.transform != null && input.transform.CompareTag("Barricade") && ushort.TryParse(input.transform.name, out id3)) { ItemBarricadeAsset itemBarricadeAsset2 = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id3); if (itemBarricadeAsset2 != null) { if (((ItemMeleeAsset)base.player.equipment.asset).isRepair) { if (itemBarricadeAsset2.isRepairable) { num4 *= 1f + base.channel.owner.player.skills.mastery(2, 6); DamageTool.damage(input.transform, true, ((ItemMeleeAsset)base.player.equipment.asset).barricadeDamage, num4, out eplayerKill); } } else if (itemBarricadeAsset2.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable) { DamageTool.damage(input.transform, false, ((ItemMeleeAsset)base.player.equipment.asset).barricadeDamage, num4, out eplayerKill); } } } } else if (input.type == ERaycastInfoType.STRUCTURE) { ushort id4; if (input.transform != null && input.transform.CompareTag("Structure") && ushort.TryParse(input.transform.name, out id4)) { ItemStructureAsset itemStructureAsset2 = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id4); if (itemStructureAsset2 != null) { if (((ItemMeleeAsset)base.player.equipment.asset).isRepair) { if (itemStructureAsset2.isRepairable) { num4 *= 1f + base.channel.owner.player.skills.mastery(2, 6); DamageTool.damage(input.transform, true, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).structureDamage, num4, out eplayerKill); } } else if (itemStructureAsset2.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable) { DamageTool.damage(input.transform, false, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).structureDamage, num4, out eplayerKill); } } } } else if (input.type == ERaycastInfoType.RESOURCE) { if (input.transform != null && input.transform.CompareTag("Resource")) { num4 *= 1f + base.channel.owner.player.skills.mastery(2, 2) * 0.5f; byte x2; byte y2; ushort index2; if (ResourceManager.tryGetRegion(input.transform, out x2, out y2, out index2)) { ResourceSpawnpoint resourceSpawnpoint2 = ResourceManager.getResourceSpawnpoint(x2, y2, index2); if (resourceSpawnpoint2 != null && !resourceSpawnpoint2.isDead && resourceSpawnpoint2.asset.bladeID == ((ItemWeaponAsset)base.player.equipment.asset).bladeID) { DamageTool.damage(input.transform, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).resourceDamage, num4, 1f + base.channel.owner.player.skills.mastery(2, 2) * 0.5f, out eplayerKill, out num3); } } } } else if (input.type == ERaycastInfoType.OBJECT && input.transform != null && input.section < 255) { InteractableObjectRubble component5 = input.transform.GetComponent <InteractableObjectRubble>(); if (component5 != null && !component5.isSectionDead(input.section) && (component5.asset.rubbleIsVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable)) { DamageTool.damage(input.transform, input.direction, input.section, ((ItemMeleeAsset)base.player.equipment.asset).objectDamage, num4, out eplayerKill, out num3); } } if (input.type != ERaycastInfoType.PLAYER && input.type != ERaycastInfoType.ZOMBIE && input.type != ERaycastInfoType.ANIMAL && !base.player.life.isAggressor) { float num5 = ((ItemMeleeAsset)base.player.equipment.asset).range + Provider.modeConfigData.Players.Ray_Aggressor_Distance; num5 *= num5; float num6 = Provider.modeConfigData.Players.Ray_Aggressor_Distance; num6 *= num6; Vector3 forward = base.player.look.aim.forward; for (int i = 0; i < Provider.clients.Count; i++) { if (Provider.clients[i] != base.channel.owner) { Player player = Provider.clients[i].player; if (!(player == null)) { Vector3 vector = player.look.aim.position - base.player.look.aim.position; Vector3 a = Vector3.Project(vector, forward); if (a.sqrMagnitude < num5 && (a - vector).sqrMagnitude < num6) { base.player.life.markAggressive(false, true); } } } } } if (Level.info.type == ELevelType.HORDE) { if (input.zombie != null) { if (input.limb == ELimb.SKULL) { base.player.skills.askPay(10u); } else { base.player.skills.askPay(5u); } } if (eplayerKill == EPlayerKill.ZOMBIE) { if (input.limb == ELimb.SKULL) { base.player.skills.askPay(50u); } else { base.player.skills.askPay(25u); } } } else { if (eplayerKill == EPlayerKill.PLAYER && Level.info.type == ELevelType.ARENA) { base.player.skills.askPay(100u); } base.player.sendStat(eplayerKill); if (num3 > 0u) { base.player.skills.askPay(num3); } } } }
// Token: 0x060020C1 RID: 8385 RVA: 0x000B3853 File Offset: 0x000B1C53 public void updateState(ItemBarricadeAsset asset) { }
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; } } } }
// Token: 0x060033E3 RID: 13283 RVA: 0x00151418 File Offset: 0x0014F818 public static void explode(Vector3 point, float damageRadius, EDeathCause cause, CSteamID killer, float playerDamage, float zombieDamage, float animalDamage, float barricadeDamage, float structureDamage, float vehicleDamage, float resourceDamage, float objectDamage, out List <EPlayerKill> kills, EExplosionDamageType damageType = EExplosionDamageType.CONVENTIONAL, float alertRadius = 32f, bool playImpactEffect = true, bool penetrateBuildables = false) { DamageTool.explosionKills.Clear(); kills = DamageTool.explosionKills; DamageTool.explosionRangeComparator.point = point; float num = damageRadius * damageRadius; DamageTool.regionsInRadius.Clear(); Regions.getRegionsInRadius(point, damageRadius, DamageTool.regionsInRadius); int layerMask; if (penetrateBuildables) { layerMask = RayMasks.BLOCK_EXPLOSION_PENETRATE_BUILDABLES; } else { layerMask = RayMasks.BLOCK_EXPLOSION; } if (structureDamage > 0.5f) { DamageTool.structuresInRadius.Clear(); StructureManager.getStructuresInRadius(point, num, DamageTool.regionsInRadius, DamageTool.structuresInRadius); DamageTool.structuresInRadius.Sort(DamageTool.explosionRangeComparator); for (int i = 0; i < DamageTool.structuresInRadius.Count; i++) { Transform transform = DamageTool.structuresInRadius[i]; if (!(transform == null)) { ushort id; if (ushort.TryParse(transform.name, out id)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id); if (itemStructureAsset != null && !itemStructureAsset.proofExplosion) { Vector3 a = transform.transform.position - point; float magnitude = a.magnitude; Vector3 direction = a / magnitude; if (magnitude > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction), out raycastHit, magnitude - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform.transform) { goto IL_17D; } } StructureManager.damage(transform, a.normalized, structureDamage, 1f - magnitude / damageRadius, true); } } } IL_17D :; } } if (resourceDamage > 0.5f) { DamageTool.resourcesInRadius.Clear(); ResourceManager.getResourcesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.resourcesInRadius); DamageTool.resourcesInRadius.Sort(DamageTool.explosionRangeComparator); for (int j = 0; j < DamageTool.resourcesInRadius.Count; j++) { Transform transform2 = DamageTool.resourcesInRadius[j]; if (!(transform2 == null)) { Vector3 a2 = transform2.transform.position - point; float magnitude2 = a2.magnitude; Vector3 direction2 = a2 / magnitude2; if (magnitude2 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction2), out raycastHit, magnitude2 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform2.transform) { goto IL_2A2; } } EPlayerKill eplayerKill; uint num2; ResourceManager.damage(transform2, a2.normalized, resourceDamage, 1f - magnitude2 / damageRadius, 1f, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } IL_2A2 :; } } if (objectDamage > 0.5f) { DamageTool.objectsInRadius.Clear(); ObjectManager.getObjectsInRadius(point, num, DamageTool.regionsInRadius, DamageTool.objectsInRadius); DamageTool.objectsInRadius.Sort(DamageTool.explosionRangeComparator); for (int k = 0; k < DamageTool.objectsInRadius.Count; k++) { Transform transform3 = DamageTool.objectsInRadius[k]; if (!(transform3 == null)) { InteractableObjectRubble component = transform3.GetComponent <InteractableObjectRubble>(); if (!(component == null)) { if (!component.asset.rubbleProofExplosion) { for (byte b = 0; b < component.getSectionCount(); b += 1) { Transform section = component.getSection(b); Vector3 a3 = section.position - point; if (a3.sqrMagnitude < num) { float magnitude3 = a3.magnitude; Vector3 direction3 = a3 / magnitude3; if (magnitude3 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction3), out raycastHit, magnitude3 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform3.transform) { goto IL_40B; } } EPlayerKill eplayerKill; uint num2; ObjectManager.damage(transform3, a3.normalized, b, objectDamage, 1f - magnitude3 / damageRadius, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } IL_40B :; } } } } } } if (barricadeDamage > 0.5f) { DamageTool.barricadesInRadius.Clear(); BarricadeManager.getBarricadesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.barricadesInRadius); BarricadeManager.getBarricadesInRadius(point, num, DamageTool.barricadesInRadius); DamageTool.barricadesInRadius.Sort(DamageTool.explosionRangeComparator); for (int l = 0; l < DamageTool.barricadesInRadius.Count; l++) { Transform transform4 = DamageTool.barricadesInRadius[l]; if (!(transform4 == null)) { Vector3 a4 = transform4.transform.position - point; float magnitude4 = a4.magnitude; Vector3 direction4 = a4 / magnitude4; if (magnitude4 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction4), out raycastHit, magnitude4 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform4.transform) { goto IL_568; } } ushort id2; if (ushort.TryParse(transform4.name, out id2)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id2); if (itemBarricadeAsset != null && !itemBarricadeAsset.proofExplosion) { BarricadeManager.damage(transform4, barricadeDamage, 1f - magnitude4 / damageRadius, true); } } } IL_568 :; } } if ((Provider.isPvP || damageType == EExplosionDamageType.ZOMBIE_ACID || damageType == EExplosionDamageType.ZOMBIE_FIRE || damageType == EExplosionDamageType.ZOMBIE_ELECTRIC) && playerDamage > 0.5f) { DamageTool.playersInRadius.Clear(); PlayerTool.getPlayersInRadius(point, num, DamageTool.playersInRadius); for (int m = 0; m < DamageTool.playersInRadius.Count; m++) { Player player = DamageTool.playersInRadius[m]; if (!(player == null) && !player.life.isDead) { if (damageType != EExplosionDamageType.ZOMBIE_FIRE || player.clothing.shirtAsset == null || !player.clothing.shirtAsset.proofFire || player.clothing.pantsAsset == null || !player.clothing.pantsAsset.proofFire) { Vector3 a5 = player.transform.position - point; float magnitude5 = a5.magnitude; Vector3 vector = a5 / magnitude5; if (magnitude5 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector), out raycastHit, magnitude5 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != player.transform) { goto IL_7AA; } } if (playImpactEffect) { EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, -vector); EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, Vector3.up); } float num3 = 1f - Mathf.Pow(magnitude5 / damageRadius, 2f); if (player.movement.getVehicle() != null && player.movement.getVehicle().asset != null) { num3 *= player.movement.getVehicle().asset.passengerExplosionArmor; } EPlayerKill eplayerKill; DamageTool.damage(player, cause, ELimb.SPINE, killer, vector, playerDamage, num3, out eplayerKill); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } } IL_7AA :; } } if (damageType == EExplosionDamageType.ZOMBIE_FIRE || zombieDamage > 0.5f) { DamageTool.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(point, num, DamageTool.zombiesInRadius); for (int n = 0; n < DamageTool.zombiesInRadius.Count; n++) { Zombie zombie = DamageTool.zombiesInRadius[n]; if (!(zombie == null) && !zombie.isDead) { if (damageType == EExplosionDamageType.ZOMBIE_FIRE) { if (zombie.speciality == EZombieSpeciality.NORMAL) { ZombieManager.sendZombieSpeciality(zombie, EZombieSpeciality.BURNER); } } else { Vector3 a6 = zombie.transform.position - point; float magnitude6 = a6.magnitude; Vector3 vector2 = a6 / magnitude6; if (magnitude6 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector2), out raycastHit, magnitude6 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != zombie.transform) { goto IL_964; } } if (playImpactEffect) { EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, -vector2); EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, Vector3.up); } EPlayerKill eplayerKill; uint num2; DamageTool.damage(zombie, vector2, zombieDamage, 1f - magnitude6 / damageRadius, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } } IL_964 :; } } if (animalDamage > 0.5f) { DamageTool.animalsInRadius.Clear(); AnimalManager.getAnimalsInRadius(point, num, DamageTool.animalsInRadius); for (int num4 = 0; num4 < DamageTool.animalsInRadius.Count; num4++) { Animal animal = DamageTool.animalsInRadius[num4]; if (!(animal == null) && !animal.isDead) { Vector3 a7 = animal.transform.position - point; float magnitude7 = a7.magnitude; Vector3 vector3 = a7 / magnitude7; if (magnitude7 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector3), out raycastHit, magnitude7 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != animal.transform) { goto IL_ACC; } } if (playImpactEffect) { EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, -vector3); EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, Vector3.up); } EPlayerKill eplayerKill; uint num2; DamageTool.damage(animal, vector3, animalDamage, 1f - magnitude7 / damageRadius, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } IL_ACC :; } } if (vehicleDamage > 0.5f) { DamageTool.vehiclesInRadius.Clear(); VehicleManager.getVehiclesInRadius(point, num, DamageTool.vehiclesInRadius); for (int num5 = 0; num5 < DamageTool.vehiclesInRadius.Count; num5++) { InteractableVehicle interactableVehicle = DamageTool.vehiclesInRadius[num5]; if (!(interactableVehicle == null) && !interactableVehicle.isDead) { if (interactableVehicle.asset != null && interactableVehicle.asset.isVulnerableToExplosions) { Vector3 a8 = interactableVehicle.transform.position - point; float magnitude8 = a8.magnitude; Vector3 direction5 = a8 / magnitude8; if (magnitude8 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction5), out raycastHit, magnitude8 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != interactableVehicle.transform) { goto IL_BED; } } VehicleManager.damage(interactableVehicle, vehicleDamage, 1f - magnitude8 / damageRadius, false); } } IL_BED :; } } AlertTool.alert(point, alertRadius); }
public static void explode(Vector3 point, float damageRadius, EDeathCause cause, CSteamID killer, float playerDamage, float zombieDamage, float animalDamage, float barricadeDamage, float structureDamage, float vehicleDamage, float resourceDamage, float objectDamage, EExplosionDamageType damageType = EExplosionDamageType.CONVENTIONAL, float alertRadius = 32f, bool playImpactEffect = true) { DamageTool.explosionRangeComparator.point = point; float num = damageRadius * damageRadius; DamageTool.regionsInRadius.Clear(); Regions.getRegionsInRadius(point, damageRadius, DamageTool.regionsInRadius); if (structureDamage > 0.5f) { DamageTool.structuresInRadius.Clear(); StructureManager.getStructuresInRadius(point, num, DamageTool.regionsInRadius, DamageTool.structuresInRadius); DamageTool.structuresInRadius.Sort(DamageTool.explosionRangeComparator); for (int i = 0; i < DamageTool.structuresInRadius.Count; i++) { Transform transform = DamageTool.structuresInRadius[i]; if (!(transform == null)) { ushort id; if (ushort.TryParse(transform.name, out id)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id); if (itemStructureAsset != null && !itemStructureAsset.proofExplosion) { Vector3 vector = transform.transform.position - point; float magnitude = vector.magnitude; Vector3 vector2 = vector / magnitude; if (magnitude > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector2), out raycastHit, magnitude - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != transform.transform) { goto IL_154; } } StructureManager.damage(transform, vector.normalized, structureDamage, 1f - magnitude / damageRadius, true); } } } IL_154 :; } } if (resourceDamage > 0.5f) { DamageTool.resourcesInRadius.Clear(); ResourceManager.getResourcesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.resourcesInRadius); DamageTool.resourcesInRadius.Sort(DamageTool.explosionRangeComparator); for (int j = 0; j < DamageTool.resourcesInRadius.Count; j++) { Transform transform2 = DamageTool.resourcesInRadius[j]; if (!(transform2 == null)) { Vector3 vector3 = transform2.transform.position - point; float magnitude2 = vector3.magnitude; Vector3 vector4 = vector3 / magnitude2; if (magnitude2 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector4), out raycastHit, magnitude2 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != transform2.transform) { goto IL_26D; } } EPlayerKill eplayerKill; uint num2; ResourceManager.damage(transform2, vector3.normalized, resourceDamage, 1f - magnitude2 / damageRadius, 1f, out eplayerKill, out num2); } IL_26D :; } } if (objectDamage > 0.5f) { DamageTool.objectsInRadius.Clear(); ObjectManager.getObjectsInRadius(point, num, DamageTool.regionsInRadius, DamageTool.objectsInRadius); DamageTool.objectsInRadius.Sort(DamageTool.explosionRangeComparator); for (int k = 0; k < DamageTool.objectsInRadius.Count; k++) { Transform transform3 = DamageTool.objectsInRadius[k]; if (!(transform3 == null)) { InteractableObjectRubble component = transform3.GetComponent <InteractableObjectRubble>(); if (!(component == null)) { if (!component.asset.rubbleProofExplosion) { for (byte b = 0; b < component.getSectionCount(); b += 1) { Transform section = component.getSection(b); Vector3 vector5 = section.position - point; if (vector5.sqrMagnitude < num) { float magnitude3 = vector5.magnitude; Vector3 vector6 = vector5 / magnitude3; if (magnitude3 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector6), out raycastHit, magnitude3 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != transform3.transform) { goto IL_3CA; } } EPlayerKill eplayerKill; uint num2; ObjectManager.damage(transform3, vector5.normalized, b, objectDamage, 1f - magnitude3 / damageRadius, out eplayerKill, out num2); } IL_3CA :; } } } } } } if (barricadeDamage > 0.5f) { DamageTool.barricadesInRadius.Clear(); BarricadeManager.getBarricadesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.barricadesInRadius); BarricadeManager.getBarricadesInRadius(point, num, DamageTool.barricadesInRadius); DamageTool.barricadesInRadius.Sort(DamageTool.explosionRangeComparator); for (int l = 0; l < DamageTool.barricadesInRadius.Count; l++) { Transform transform4 = DamageTool.barricadesInRadius[l]; if (!(transform4 == null)) { Vector3 vector7 = transform4.transform.position - point; float magnitude4 = vector7.magnitude; Vector3 vector8 = vector7 / magnitude4; if (magnitude4 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector8), out raycastHit, magnitude4 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != transform4.transform) { goto IL_52A; } } ushort id2; if (ushort.TryParse(transform4.name, out id2)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id2); if (itemBarricadeAsset != null && !itemBarricadeAsset.proofExplosion) { BarricadeManager.damage(transform4, barricadeDamage, 1f - magnitude4 / damageRadius, true); } } } IL_52A :; } } if ((Provider.isPvP || damageType == EExplosionDamageType.ZOMBIE_ACID || damageType == EExplosionDamageType.ZOMBIE_FIRE || damageType == EExplosionDamageType.ZOMBIE_ELECTRIC) && playerDamage > 0.5f) { DamageTool.playersInRadius.Clear(); PlayerTool.getPlayersInRadius(point, num, DamageTool.playersInRadius); for (int m = 0; m < DamageTool.playersInRadius.Count; m++) { Player player = DamageTool.playersInRadius[m]; if (!(player == null) && !player.life.isDead) { if (damageType != EExplosionDamageType.ZOMBIE_FIRE || player.clothing.shirtAsset == null || !player.clothing.shirtAsset.proofFire || player.clothing.pantsAsset == null || !player.clothing.pantsAsset.proofFire) { Vector3 vector9 = player.transform.position - point; float magnitude5 = vector9.magnitude; Vector3 vector10 = vector9 / magnitude5; if (magnitude5 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector10), out raycastHit, magnitude5 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != player.transform) { goto IL_760; } } if (playImpactEffect) { EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, -vector10); EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, Vector3.up); } float num3 = 1f - Mathf.Pow(magnitude5 / damageRadius, 2f); if (player.movement.getVehicle() != null && player.movement.getVehicle().asset != null) { num3 *= player.movement.getVehicle().asset.passengerExplosionArmor; } EPlayerKill eplayerKill; DamageTool.damage(player, cause, ELimb.SPINE, killer, vector10, playerDamage, num3, out eplayerKill); } } IL_760 :; } } if (damageType == EExplosionDamageType.ZOMBIE_FIRE || zombieDamage > 0.5f) { DamageTool.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(point, num, DamageTool.zombiesInRadius); for (int n = 0; n < DamageTool.zombiesInRadius.Count; n++) { Zombie zombie = DamageTool.zombiesInRadius[n]; if (!(zombie == null) && !zombie.isDead) { if (damageType == EExplosionDamageType.ZOMBIE_FIRE) { if (zombie.speciality == EZombieSpeciality.NORMAL) { ZombieManager.sendZombieSpeciality(zombie, EZombieSpeciality.BURNER); } } else { Vector3 vector11 = zombie.transform.position - point; float magnitude6 = vector11.magnitude; Vector3 vector12 = vector11 / magnitude6; if (magnitude6 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector12), out raycastHit, magnitude6 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != zombie.transform) { goto IL_90E; } } if (playImpactEffect) { EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, -vector12); EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, Vector3.up); } EPlayerKill eplayerKill; uint num2; DamageTool.damage(zombie, vector12, zombieDamage, 1f - magnitude6 / damageRadius, out eplayerKill, out num2); } } IL_90E :; } } if (animalDamage > 0.5f) { DamageTool.animalsInRadius.Clear(); AnimalManager.getAnimalsInRadius(point, num, DamageTool.animalsInRadius); for (int num4 = 0; num4 < DamageTool.animalsInRadius.Count; num4++) { Animal animal = DamageTool.animalsInRadius[num4]; if (!(animal == null) && !animal.isDead) { Vector3 vector13 = animal.transform.position - point; float magnitude7 = vector13.magnitude; Vector3 vector14 = vector13 / magnitude7; if (magnitude7 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector14), out raycastHit, magnitude7 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != animal.transform) { goto IL_A6A; } } if (playImpactEffect) { EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, -vector14); EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, Vector3.up); } EPlayerKill eplayerKill; uint num2; DamageTool.damage(animal, vector14, animalDamage, 1f - magnitude7 / damageRadius, out eplayerKill, out num2); } IL_A6A :; } } if (vehicleDamage > 0.5f) { DamageTool.vehiclesInRadius.Clear(); VehicleManager.getVehiclesInRadius(point, num, DamageTool.vehiclesInRadius); for (int num5 = 0; num5 < DamageTool.vehiclesInRadius.Count; num5++) { InteractableVehicle interactableVehicle = DamageTool.vehiclesInRadius[num5]; if (!(interactableVehicle == null) && !interactableVehicle.isDead) { Vector3 vector15 = interactableVehicle.transform.position - point; float magnitude8 = vector15.magnitude; Vector3 vector16 = vector15 / magnitude8; if (magnitude8 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector16), out raycastHit, magnitude8 - 0.5f, RayMasks.BLOCK_EXPLOSION, 0); if (raycastHit.transform != null && raycastHit.transform != interactableVehicle.transform) { goto IL_B6C; } } VehicleManager.damage(interactableVehicle, vehicleDamage, 1f - magnitude8 / damageRadius, false); } IL_B6C :; } } AlertTool.alert(point, alertRadius); }