// Token: 0x060018BA RID: 6330 RVA: 0x0008A1AC File Offset: 0x000885AC public void askDamage(byte amount, Vector3 newRagdoll, out EPlayerKill kill, out uint xp, bool trackKill = true) { kill = EPlayerKill.NONE; xp = 0u; if (amount == 0 || this.isDead) { return; } if (!this.isDead) { if ((ushort)amount >= this.health) { this.health = 0; } else { this.health -= (ushort)amount; } this.ragdoll = newRagdoll; if (this.health == 0) { kill = EPlayerKill.ANIMAL; if (this.asset != null) { xp = this.asset.rewardXP; } AnimalManager.dropLoot(this); AnimalManager.sendAnimalDead(this, this.ragdoll); if (trackKill) { for (int i = 0; i < Provider.clients.Count; i++) { SteamPlayer steamPlayer = Provider.clients[i]; if (!(steamPlayer.player == null) && !(steamPlayer.player.movement == null) && !(steamPlayer.player.life == null) && !steamPlayer.player.life.isDead) { if ((steamPlayer.player.transform.position - base.transform.position).sqrMagnitude < 262144f) { steamPlayer.player.quests.trackAnimalKill(this); } } } } } else if (this.asset != null && this.asset.panics != null && this.asset.panics.Length > 0) { AnimalManager.sendAnimalPanic(this); } this.lastRegen = Time.time; } }
// Token: 0x06002AAE RID: 10926 RVA: 0x00108C98 File Offset: 0x00107098 public void sendStat(EPlayerKill kill) { if (kill == EPlayerKill.PLAYER) { this.sendStat(EPlayerStat.KILLS_PLAYERS); } else if (kill == EPlayerKill.ZOMBIE) { this.sendStat(EPlayerStat.KILLS_ZOMBIES_NORMAL); } else if (kill == EPlayerKill.MEGA) { this.sendStat(EPlayerStat.KILLS_ZOMBIES_MEGA); } else if (kill == EPlayerKill.ANIMAL) { this.sendStat(EPlayerStat.KILLS_ANIMALS); } else if (kill == EPlayerKill.RESOURCE) { this.sendStat(EPlayerStat.FOUND_RESOURCES); } }
public void askDamage(byte amount, Vector3 newRagdoll, out EPlayerKill kill, out uint xp) { kill = EPlayerKill.NONE; xp = 0u; if (amount == 0 || this.isDead) { return; } if (!this.isDead) { if ((ushort)amount >= this.health) { this.health = 0; } else { this.health -= (ushort)amount; } this.ragdoll = newRagdoll; if (this.health == 0) { kill = EPlayerKill.ANIMAL; if (this.asset != null) { xp = this.asset.rewardXP; } AnimalManager.dropLoot(this); AnimalManager.sendAnimalDead(this, this.ragdoll); } else if (this.asset != null && this.asset.panics != null && this.asset.panics.Length > 0) { AnimalManager.sendAnimalPanic(this); } this.lastRegen = Time.time; } }
static void Postfix(Transform resource, Vector3 direction, float damage, float times, float drop, ref EPlayerKill kill, ref uint xp, CSteamID instigatorSteamID, EDamageOrigin damageOrigin, bool trackKill) { if (kill == EPlayerKill.RESOURCE) { Player ply = PlayerTool.getPlayer(instigatorSteamID); List <RegionCoordinate> region = new List <RegionCoordinate>(); region.Add(new RegionCoordinate(ply.movement.region_x, ply.movement.region_y)); List <ItemData> searchResult = new List <ItemData>(); getItemsInRadius(ply.transform.position, 500f, region, searchResult); foreach (ItemData item in searchResult) { ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.ITEM, item.item.id); byte page; byte x; byte y; byte rot; if (ply.inventory.tryFindSpace(itemAsset.size_x, itemAsset.size_y, out page, out x, out y, out rot)) { if (!autoPickupItems.Contains(item.item.id)) { return; } ItemManager.instance.askTakeItem(ply.channel.owner.playerID.steamID, ply.movement.region_x, ply.movement.region_y, item.instanceID, x, y, rot, page); } } } }
private static void doDamage(this PlayerLife life, byte amount, Vector3 newRagdoll, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, out EPlayerKill kill) { UnturnedPlayer ply = UnturnedPlayer.Get(newKiller); bool cancel = false; kill = EPlayerKill.NONE; PlayerEvents.RunPlayerHurt(life.channel.owner, ref amount, ref newCause, ref newLimb, ref ply, ref cancel); if (cancel) { return; } object[] paramaters = new object[] { amount, newRagdoll, newCause, newLimb, newKiller, null }; DetourManager.CallOriginal(typeof(PlayerLife).GetMethod("doDamage", BindingFlags.NonPublic | BindingFlags.Instance), life, paramaters); kill = (EPlayerKill)paramaters[5]; }
public void punch(EPlayerPunch mode) { if (Player.player.channel.isOwner) { Player.player.playSound((AudioClip)Resources.Load("Sounds/General/Punch")); Ray ray = new Ray(Player.player.look.aim.position, Player.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, MP_Player.farPunch ? 12f : 1.75f, RayMasks.DAMAGE_CLIENT); //1.75 default if (raycastInfo.player != null && DAMAGE_PLAYER_MULTIPLIER.damage > 1f && (Player.player.channel.owner.playerID.group == CSteamID.Nil || raycastInfo.player.channel.owner.playerID.group != Player.player.channel.owner.playerID.group) && Provider.isPvP) { PlayerUI.hitmark(0, raycastInfo.point, false, (raycastInfo.limb != ELimb.SKULL) ? EPlayerHit.ENTITIY : EPlayerHit.CRITICAL); } else if ((raycastInfo.zombie != null && DAMAGE_ZOMBIE_MULTIPLIER.damage > 1f) || (raycastInfo.animal != null && DAMAGE_ANIMAL_MULTIPLIER.damage > 1f)) { PlayerUI.hitmark(0, raycastInfo.point, false, (raycastInfo.limb != ELimb.SKULL) ? EPlayerHit.ENTITIY : EPlayerHit.CRITICAL); } else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Barricade") && DAMAGE_BARRICADE > 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 && itemBarricadeAsset.isVulnerable) { PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Structure") && DAMAGE_STRUCTURE > 1f) { ushort id2; if (ushort.TryParse(raycastInfo.transform.name, out id2)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id2); if (itemStructureAsset != null && itemStructureAsset.isVulnerable) { PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } else if (raycastInfo.vehicle != null && !raycastInfo.vehicle.isDead && DAMAGE_VEHICLE > 1f) { if (raycastInfo.vehicle.asset != null && raycastInfo.vehicle.asset.isVulnerable) { PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Resource") && DAMAGE_RESOURCE > 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) { PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } else if (raycastInfo.transform != null && DAMAGE_OBJECT > 1f) { InteractableObjectRubble component2 = raycastInfo.transform.GetComponent <InteractableObjectRubble>(); if (component2 != null) { raycastInfo.section = component2.getSection(raycastInfo.collider.transform); if (!component2.isSectionDead(raycastInfo.section)) { PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD); } } } Player.player.input.sendRaycast(raycastInfo); } if (mode == EPlayerPunch.LEFT) { Player.player.animator.play("Punch_Left", false); if (Provider.isServer) { Player.player.animator.sendGesture(EPlayerGesture.PUNCH_LEFT, false); } } else if (mode == EPlayerPunch.RIGHT) { Player.player.animator.play("Punch_Right", false); if (Provider.isServer) { Player.player.animator.sendGesture(EPlayerGesture.PUNCH_RIGHT, false); } } if (Provider.isServer) { if (!Player.player.input.hasInputs()) { return; } InputInfo input = Player.player.input.getInput(true); if (input == null) { return; } if ((input.point - Player.player.look.aim.position).sqrMagnitude > 36f) { return; } DamageTool.impact(input.point, input.normal, input.material, input.type != ERaycastInfoType.NONE && input.type != ERaycastInfoType.OBJECT); EPlayerKill ePlayerKill = EPlayerKill.NONE; uint num = 0u; float num2 = 1f; num2 *= 1f + Player.player.channel.owner.player.skills.mastery(0, 0) * 0.5f; if (input.type == ERaycastInfoType.PLAYER) { typeof(PlayerEquipment).GetField("lastPunching", BindingFlags.Instance | BindingFlags.Public).SetValue(null, Time.realtimeSinceStartup); if (input.player != null && (Player.player.channel.owner.playerID.group == CSteamID.Nil || input.player.channel.owner.playerID.group != Player.player.channel.owner.playerID.group) && Provider.isPvP) { DamageTool.damage(input.player, EDeathCause.PUNCH, input.limb, Player.player.channel.owner.playerID.steamID, input.direction, DAMAGE_PLAYER_MULTIPLIER, num2, true, out ePlayerKill); } } else if (input.type == ERaycastInfoType.ZOMBIE) { if (input.zombie != null) { DamageTool.damage(input.zombie, input.limb, input.direction, DAMAGE_ZOMBIE_MULTIPLIER, num2, true, out ePlayerKill, out num); if (Player.player.movement.nav != 255) { input.zombie.alert(base.transform.position, true); } } } else if (input.type == ERaycastInfoType.ANIMAL) { typeof(PlayerEquipment).GetField("lastPunching", BindingFlags.Instance | BindingFlags.Public).SetValue(null, Time.realtimeSinceStartup); if (input.animal != null) { DamageTool.damage(input.animal, input.limb, input.direction, DAMAGE_ANIMAL_MULTIPLIER, num2, out ePlayerKill, out num); input.animal.alertPoint(base.transform.position, true); } } else if (input.type == ERaycastInfoType.VEHICLE) { typeof(PlayerEquipment).GetField("lastPunching", BindingFlags.Instance | BindingFlags.Public).SetValue(null, Time.realtimeSinceStartup); if (input.vehicle != null && input.vehicle.asset != null && input.vehicle.asset.isVulnerable) { DamageTool.damage(input.vehicle, false, DAMAGE_VEHICLE, num2, true, out ePlayerKill); } } else if (input.type == ERaycastInfoType.BARRICADE) { typeof(PlayerEquipment).GetField("lastPunching", BindingFlags.Instance | BindingFlags.Public).SetValue(null, Time.realtimeSinceStartup); 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 && itemBarricadeAsset2.isVulnerable) { DamageTool.damage(input.transform, false, DAMAGE_BARRICADE, num2, out ePlayerKill); } } } else if (input.type == ERaycastInfoType.STRUCTURE) { typeof(PlayerEquipment).GetField("lastPunching", BindingFlags.Instance | BindingFlags.Public).SetValue(null, Time.realtimeSinceStartup); 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 && itemStructureAsset2.isVulnerable) { DamageTool.damage(input.transform, false, input.direction, DAMAGE_STRUCTURE, num2, out ePlayerKill); } } } else if (input.type == ERaycastInfoType.RESOURCE) { typeof(PlayerEquipment).GetField("lastPunching", BindingFlags.Instance | BindingFlags.Public).SetValue(null, Time.realtimeSinceStartup); byte x2; byte y2; ushort index2; if (input.transform != null && input.transform.CompareTag("Resource") && ResourceManager.tryGetRegion(input.transform, out x2, out y2, out index2)) { ResourceSpawnpoint resourceSpawnpoint2 = ResourceManager.getResourceSpawnpoint(x2, y2, index2); if (resourceSpawnpoint2 != null && !resourceSpawnpoint2.isDead) { DamageTool.damage(input.transform, input.direction, DAMAGE_RESOURCE, num2, 1f, out ePlayerKill, out num); } } } else if (input.type == ERaycastInfoType.OBJECT && input.transform != null && input.section < 255) { InteractableObjectRubble component3 = input.transform.GetComponent <InteractableObjectRubble>(); if (component3 != null && !component3.isSectionDead(input.section)) { DamageTool.damage(input.transform, input.direction, input.section, DAMAGE_OBJECT, num2, out ePlayerKill, out num); } } if (Level.info.type == ELevelType.HORDE) { if (input.zombie != null) { if (input.limb == ELimb.SKULL) { Player.player.skills.askPay(10u); } else { Player.player.skills.askPay(5u); } } if (ePlayerKill == EPlayerKill.ZOMBIE) { if (input.limb == ELimb.SKULL) { Player.player.skills.askPay(50u); } else { Player.player.skills.askPay(25u); } } } else { if (ePlayerKill == EPlayerKill.PLAYER) { Player.player.sendStat(EPlayerStat.KILLS_PLAYERS); if (Level.info.type == ELevelType.ARENA) { Player.player.skills.askPay(100u); } } else if (ePlayerKill == EPlayerKill.ZOMBIE) { Player.player.sendStat(EPlayerStat.KILLS_ZOMBIES_NORMAL); } else if (ePlayerKill == EPlayerKill.MEGA) { Player.player.sendStat(EPlayerStat.KILLS_ZOMBIES_MEGA); } else if (ePlayerKill == EPlayerKill.ANIMAL) { Player.player.sendStat(EPlayerStat.KILLS_ANIMALS); } else if (ePlayerKill == EPlayerKill.RESOURCE) { Player.player.sendStat(EPlayerStat.FOUND_RESOURCES); } if (num > 0u) { Player.player.skills.askPay(num); } } } }
public static void damage(Player player, EDeathCause cause, ELimb limb, CSteamID killer, Vector3 direction, float damage, float times, out EPlayerKill kill) { if (player == null) { kill = EPlayerKill.NONE; return; } times *= Provider.modeConfigData.Players.Armor_Multiplier; byte b = (byte)(damage * times); player.life.askDamage(b, direction * (float)b, cause, limb, killer, out kill); }
public static void Prefix(byte amount, Vector3 newRagdoll, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, ERagdollEffect newRagdollEffect, bool canCauseBleeding, PlayerLife __instance) { Player ply = __instance.channel.owner.player; if (ply is null) { return; } TTTPlayer player = PlayerManager.GetTTTPlayer(ply.channel.owner.playerID.steamID); if (player is null) { return; } if (player.Armor) { amount = (byte)Math.Floor(amount * 0.70f); } }
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: 0x060033D8 RID: 13272 RVA: 0x00151108 File Offset: 0x0014F508 public static void damage(Player player, EDeathCause cause, ELimb limb, CSteamID killer, Vector3 direction, float damage, float times, out EPlayerKill kill) { if (player == null) { kill = EPlayerKill.NONE; return; } bool flag = true; if (DamageTool.playerDamaged != null) { DamageTool.playerDamaged(player, ref cause, ref limb, ref killer, ref direction, ref damage, ref times, ref flag); } if (!flag) { kill = EPlayerKill.NONE; return; } times *= Provider.modeConfigData.Players.Armor_Multiplier; byte b = (byte)(damage * times); player.life.askDamage(b, direction * (float)b, cause, limb, killer, out kill); }
public static void Prefix(byte amount, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, bool canCauseBleeding, PlayerLife __instance) { if (PlayerTool.getSteamPlayer(newKiller) == null) { return; } CombatManager.CombatTracker[__instance.channel.owner] = new Combat(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), PlayerTool.getSteamPlayer(newKiller)); }
// Token: 0x060033DD RID: 13277 RVA: 0x001512B7 File Offset: 0x0014F6B7 public static void damage(Animal animal, ELimb limb, Vector3 direction, AnimalDamageMultiplier multiplier, float times, out EPlayerKill kill, out uint xp) { if (animal == null) { kill = EPlayerKill.NONE; xp = 0u; return; } DamageTool.damage(animal, direction, multiplier.multiply(limb), times, out kill, out xp); }
// Token: 0x060033DC RID: 13276 RVA: 0x0015127C File Offset: 0x0014F67C public static void damage(Animal animal, Vector3 direction, float damage, float times, out EPlayerKill kill, out uint xp) { if (animal == null) { kill = EPlayerKill.NONE; xp = 0u; return; } byte b = (byte)(damage * times); animal.askDamage(b, direction * (float)b, out kill, out xp, true); }
// Token: 0x060033DB RID: 13275 RVA: 0x00151208 File Offset: 0x0014F608 public static void damage(Zombie zombie, ELimb limb, Vector3 direction, ZombieDamageMultiplier multiplier, float times, bool armor, out EPlayerKill kill, out uint xp) { if (zombie == null) { kill = EPlayerKill.NONE; xp = 0u; return; } if (armor) { times *= multiplier.armor(limb, zombie); if ((double)Vector3.Dot(zombie.transform.forward, direction) > 0.5) { times *= 1.25f; } } DamageTool.damage(zombie, direction, multiplier.multiply(limb), times, out kill, out xp); }
// Token: 0x060033DA RID: 13274 RVA: 0x001511CC File Offset: 0x0014F5CC public static void damage(Zombie zombie, Vector3 direction, float damage, float times, out EPlayerKill kill, out uint xp) { if (zombie == null) { kill = EPlayerKill.NONE; xp = 0u; return; } byte b = (byte)(damage * times); zombie.askDamage((ushort)b, direction * (float)b, out kill, out xp, true, true); }
// Token: 0x060033D9 RID: 13273 RVA: 0x0015118B File Offset: 0x0014F58B public static void damage(Player player, EDeathCause cause, ELimb limb, CSteamID killer, Vector3 direction, PlayerDamageMultiplier multiplier, float times, bool armor, out EPlayerKill kill) { if (player == null) { kill = EPlayerKill.NONE; return; } if (armor) { times *= multiplier.armor(limb, player); } DamageTool.damage(player, cause, limb, killer, direction, multiplier.multiply(limb), times, out kill); }
public static void Prefix(byte amount, Vector3 newRagdoll, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, ERagdollEffect newRagdollEffect, bool canCauseBleeding, PlayerLife __instance) { Player ply = __instance.channel.owner.player; if (ply is null) return; if (amount >= ply.life.health) { Transform deathboxTransform = BarricadeManager.dropBarricade(new Barricade(1283),ply.transform, ply.transform.position, 0f, 0f, 0f, (ulong) ply.channel.owner.playerID.steamID, 0UL); byte x; byte y; ushort plant; ushort index; BarricadeRegion region; if (!BarricadeManager.tryGetInfo(deathboxTransform, out x, out y, out plant, out index, out region)) return; InteractableStorage storage = deathboxTransform.GetComponent<InteractableStorage>(); storage.items.resize(10, 10); for (byte page = 0; page < 6; page++) { for (byte i = 0; i < ply.inventory.items[page].getItemCount(); i++) { ItemJar item = ply.inventory.items[page].getItem(i); storage.items.tryAddItem(item.item); } } TTTPlayer.ClearInventoryUnsafe(__instance.channel.owner); // Clears clothing to prevent players aqquiring detective vest ect. } }
// Token: 0x060033DE RID: 13278 RVA: 0x001512E4 File Offset: 0x0014F6E4 public static void damage(InteractableVehicle vehicle, bool damageTires, Vector3 position, bool isRepairing, float vehicleDamage, float times, bool canRepair, out EPlayerKill kill) { kill = EPlayerKill.NONE; if (vehicle == null) { return; } if (isRepairing) { if (!vehicle.isExploded && !vehicle.isRepaired) { VehicleManager.repair(vehicle, vehicleDamage, times); } } else { if (!vehicle.isDead) { VehicleManager.damage(vehicle, vehicleDamage, times, canRepair); } if (damageTires && !vehicle.isExploded) { int hitTireIndex = vehicle.getHitTireIndex(position); if (hitTireIndex != -1) { vehicle.askDamageTire(hitTireIndex); } } } }
// Token: 0x060028D0 RID: 10448 RVA: 0x000F81A8 File Offset: 0x000F65A8 public static void damage(Transform obj, Vector3 direction, byte section, float damage, float times, out EPlayerKill kill, out uint xp) { kill = EPlayerKill.NONE; xp = 0u; byte b; byte b2; ushort num; if (ObjectManager.tryGetRegion(obj, out b, out b2, out num)) { InteractableObjectRubble rubble = LevelObjects.objects[(int)b, (int)b2][(int)num].rubble; if (rubble != null && !rubble.isSectionDead(section)) { ushort num2 = (ushort)(damage * times); rubble.askDamage(section, num2); if (rubble.isSectionDead(section)) { kill = EPlayerKill.OBJECT; if (LevelObjects.objects[(int)b, (int)b2][(int)num].asset != null) { xp = LevelObjects.objects[(int)b, (int)b2][(int)num].asset.rubbleRewardXP; } byte[] state = LevelObjects.objects[(int)b, (int)b2][(int)num].state; if (section == 255) { state[state.Length - 1] = 0; } else { state[state.Length - 1] = (state[state.Length - 1] & ~Types.SHIFTS[(int)section]); } ObjectManager.manager.channel.send("tellObjectRubble", ESteamCall.ALL, b, b2, ObjectManager.OBJECT_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { b, b2, num, section, false, direction * (float)num2 }); } } } }
public static void Prefix(byte amount, Vector3 newRagdoll, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, ERagdollEffect newRagdollEffect, bool canCauseBleeding, PlayerLife __instance) { Player ply = __instance.channel.owner.player; if (ply is null) { return; } if (amount >= ply.life.health && ply.clothing.vest == 1013) { ply.clothing.askWearVest(0, 0, new byte[0], true); InventorySearch foundVest = ply.inventory.has(1013); if (foundVest is null) { return; } ply.inventory.removeItem(foundVest.page, ply.inventory.getIndex(foundVest.page, foundVest.jar.x, foundVest.jar.y)); ExplosionParameters explodParams = new ExplosionParameters(ply.transform.position, 10f, EDeathCause.KILL, CSteamID.Nil); explodParams.penetrateBuildables = true; explodParams.playerDamage = 150; explodParams.damageRadius = 32; explodParams.barricadeDamage = 1000; List <EPlayerKill> deadPlayers = new List <EPlayerKill>(); EffectManager.sendEffect(45, byte.MaxValue, byte.MaxValue, byte.MaxValue, ply.transform.position); DamageTool.explode(explodParams, out deadPlayers); } }
// Token: 0x060033DF RID: 13279 RVA: 0x0015136B File Offset: 0x0014F76B public static void damage(Transform barricade, bool isRepairing, float barricadeDamage, float times, out EPlayerKill kill) { kill = EPlayerKill.NONE; if (barricade == null) { return; } if (isRepairing) { BarricadeManager.repair(barricade, barricadeDamage, times); } else { BarricadeManager.damage(barricade, barricadeDamage, times, true); } }
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: 0x060033E0 RID: 13280 RVA: 0x0015139A File Offset: 0x0014F79A public static void damage(Transform structure, bool isRepairing, Vector3 direction, float structureDamage, float times, out EPlayerKill kill) { kill = EPlayerKill.NONE; if (structure == null) { return; } if (isRepairing) { StructureManager.repair(structure, structureDamage, times); } else { StructureManager.damage(structure, direction, structureDamage, times, true); } }
// 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: 0x060033E1 RID: 13281 RVA: 0x001513CC File Offset: 0x0014F7CC public static void damage(Transform resource, Vector3 direction, float resourceDamage, float times, float drops, out EPlayerKill kill, out uint xp) { if (resource == null) { kill = EPlayerKill.NONE; xp = 0u; return; } ResourceManager.damage(resource, direction, resourceDamage, times, drops, out kill, out xp); }
// Token: 0x060028FE RID: 10494 RVA: 0x000FA378 File Offset: 0x000F8778 public static void damage(Transform resource, Vector3 direction, float damage, float times, float drop, out EPlayerKill kill, out uint xp) { xp = 0u; kill = EPlayerKill.NONE; byte b; byte b2; if (Regions.tryGetCoordinate(resource.position, out b, out b2)) { List <ResourceSpawnpoint> list = LevelGround.trees[(int)b, (int)b2]; ushort num = 0; while ((int)num < list.Count) { if (resource == list[(int)num].model) { if (!list[(int)num].isDead) { ushort num2 = (ushort)(damage * times); list[(int)num].askDamage(num2); if (list[(int)num].isDead) { kill = EPlayerKill.RESOURCE; ResourceAsset asset = list[(int)num].asset; if (list[(int)num].asset != null) { if (asset.explosion != 0) { if (asset.hasDebris) { EffectManager.sendEffect(asset.explosion, b, b2, ResourceManager.RESOURCE_REGIONS, resource.position + Vector3.up * 8f); } else { EffectManager.sendEffect(asset.explosion, b, b2, ResourceManager.RESOURCE_REGIONS, resource.position); } } if (asset.rewardID != 0) { direction.y = 0f; direction.Normalize(); int num3 = (int)((float)UnityEngine.Random.Range((int)asset.rewardMin, (int)(asset.rewardMax + 1)) * drop); for (int i = 0; i < num3; i++) { ushort num4 = SpawnTableTool.resolve(asset.rewardID); if (num4 != 0) { if (asset.hasDebris) { ItemManager.dropItem(new Item(num4, EItemOrigin.NATURE), resource.position + direction * (float)(2 + i) + new Vector3(0f, 2f, 0f), false, Dedicator.isDedicated, true); } else { ItemManager.dropItem(new Item(num4, EItemOrigin.NATURE), resource.position + new Vector3(UnityEngine.Random.Range(-2f, 2f), 2f, UnityEngine.Random.Range(-2f, 2f)), false, Dedicator.isDedicated, true); } } } } else { if (asset.log != 0) { int num5 = (int)((float)UnityEngine.Random.Range(3, 7) * drop); for (int j = 0; j < num5; j++) { ItemManager.dropItem(new Item(asset.log, EItemOrigin.NATURE), resource.position + direction * (float)(2 + j * 2) + Vector3.up, false, Dedicator.isDedicated, true); } } if (asset.stick != 0) { int num6 = (int)((float)UnityEngine.Random.Range(2, 5) * drop); for (int k = 0; k < num6; k++) { float f = UnityEngine.Random.Range(0f, 6.28318548f); ItemManager.dropItem(new Item(asset.stick, EItemOrigin.NATURE), resource.position + new Vector3(Mathf.Sin(f) * 3f, 1f, Mathf.Cos(f) * 3f), false, Dedicator.isDedicated, true); } } } xp = asset.rewardXP; } ResourceManager.manager.channel.send("tellResourceDead", ESteamCall.ALL, b, b2, ResourceManager.RESOURCE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { b, b2, num, direction * (float)num2 }); } } break; } num += 1; } } }
// Token: 0x060033E2 RID: 13282 RVA: 0x001513F2 File Offset: 0x0014F7F2 public static void damage(Transform obj, Vector3 direction, byte section, float objectDamage, float times, out EPlayerKill kill, out uint xp) { if (obj == null) { kill = EPlayerKill.NONE; xp = 0u; return; } ObjectManager.damage(obj, direction, section, objectDamage, times, out kill, out xp); }