public static void Postfix(ItemActionAttack __instance, ItemActionAttack.AttackHitInfo _attackDetails, ref float _weaponCondition, int _attackerEntityId, ItemValue damagingItemValue) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return; } EntityAlive entityAlive = GameManager.Instance.World.GetEntity(_attackerEntityId) as EntityAlive; if (entityAlive) { bool isWearingGloves = false; // Throw weapon, skipping if (damagingItemValue != null && damagingItemValue.ItemClass.HasAnyTags(FastTags.Parse("thrownWeapon"))) { return; } // Check if its the player hand if (entityAlive.inventory.holdingItem.GetItemName() == "meleeHandPlayer" && _attackDetails.damageGiven > 0 && !isWearingGloves) { AdvLogging.DisplayLog(AdvFeatureClass, "Attacking Entity is an EntityAlive: " + entityAlive.inventory.holdingItemItemValue.ItemClass.GetItemName() + " Inflicting Damage"); DamageSource dmg = new DamageSource(EnumDamageSource.Internal, EnumDamageTypes.Bashing); entityAlive.DamageEntity(dmg, 1, false, 1f); } } return; }
static bool Prefix(ItemActionAttack __instance, WorldRayHitInfo hitInfo, int _attackerEntityId) { if (hitInfo == null || hitInfo.tag == null) { return(false); } string text3; Entity entity = ItemActionAttack.FindHitEntityNoTagCheck(hitInfo, out text3); if (entity != null) { if (EntityUtilities.IsAnAlly(entity.entityId, _attackerEntityId)) { return(false); } } return(true); }
public static bool Prefix(float __result, ItemActionAttack __instance, float _strength, float _condition) { // If it's full, then just work with the base class. if (_condition == 1f) { return(true); } // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return(true); } // Condition will be the Percent left of the item // Reduce damage based on durability left. __result = _strength * _condition; AdvLogging.DisplayLog(AdvFeatureClass, "New Calculated Damage: " + __result); return(false); }
public static bool Prefix(ItemActionAttack __instance, ItemActionAttack.AttackHitInfo _attackDetails, ref float _weaponCondition, int _attackerEntityId) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return(true); } EntityAlive entityAlive = GameManager.Instance.World.GetEntity(_attackerEntityId) as EntityAlive; if (entityAlive) { ItemValue itemValue = entityAlive.inventory.holdingItemItemValue; if (itemValue.HasQuality && entityAlive is EntityPlayerLocal) // this checks if it has any passive effects, like degradation { String strDisplay = ""; if (_attackDetails.WeaponTypeTag.Equals(ItemActionAttack.MeleeTag)) { strDisplay += " Melee "; float percent = itemValue.PercentUsesLeft; if (percent > 0.8f) { _weaponCondition = 1f; } else if (percent > 0) // Perfecent left will be 0 on non-degradation things { _weaponCondition = percent; } } else if (_attackDetails.WeaponTypeTag.Equals(ItemActionAttack.RangedTag)) { strDisplay += " Ranged "; } strDisplay += itemValue.ItemClass.GetItemName() + " Percent Left: " + itemValue.PercentUsesLeft + " Weapon Condition: " + _weaponCondition; AdvLogging.DisplayLog(AdvFeatureClass, strDisplay); } } return(true); }
public static void Postfix(ItemActionAttack __instance, ItemActionAttack.AttackHitInfo _attackDetails, ref float _weaponCondition, int _attackerEntityId) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return; } EntityAlive entityAlive = GameManager.Instance.World.GetEntity(_attackerEntityId) as EntityAlive; if (entityAlive) { bool isWearingGloves = false; //LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityAlive as EntityPlayerLocal); //if(uiforPlayer) //{ // // Grab a hand item to see if its being worn. // ItemValue handItems = ItemClass.GetItem("armorClothGloves", false ); // if(uiforPlayer.xui.PlayerEquipment.IsEquipmentTypeWorn( handItems )) // isWearingGloves = true; //} //BlockValue blockValue = _attackDetails.blockBeingDamaged; //if (blockValue.type != 0 ) //{ // if (blockValue.Block.blockMaterial.MaxDamage <= 1) // isWearingGloves = true; //} // Check if its the player hand if (entityAlive.inventory.holdingItem.GetItemName() == "meleeHandPlayer" && _attackDetails.damageGiven > 0 && !isWearingGloves) { AdvLogging.DisplayLog(AdvFeatureClass, "Attacking Entity is an EntityAlive: " + entityAlive.inventory.holdingItemItemValue.ItemClass.GetItemName() + " Inflicting Damage"); DamageSource dmg = new DamageSource(EnumDamageSource.Internal, EnumDamageTypes.Bashing); entityAlive.DamageEntity(dmg, 1, false, 1f); } } return; }
private void Update() { /*if (!Input.anyKey || !Input.anyKeyDown) { * return; * }*/ if (noWeaponBob && O.localPlayer) { vp_FPWeapon weapon = O.localPlayer.vp_FPWeapon; if (weapon) { weapon.BobRate = Vector4.zero; weapon.ShakeAmplitude = Vector3.zero; weapon.RenderingFieldOfView = 120f; weapon.StepForceScale = 0f; } } if (Input.GetKeyDown(KeyCode.O)) { if (!O.localPlayer) { return; } Inventory inventory = O.localPlayer.inventory; if (inventory != null) { ItemActionAttack gun = inventory.GetHoldingGun(); if (gun != null) { gun.InfiniteAmmo = !gun.InfiniteAmmo; } } } if (Input.GetKey(KeyCode.LeftAlt) && magicBullet) { MagicBullet(); } if (Input.GetKey(KeyCode.LeftAlt) && O.zombieList.Count > 0 && aimbot) { Aimbot(); } if (Input.GetKeyDown(KeyCode.F2)) { speed = !speed; Time.timeScale = speed ? 6f : 1f; } if (Time.time >= lastChamTime && chams) { foreach (Entity entity in FindObjectsOfType <Entity>()) { if (!entity) { continue; } switch (entity.entityType) { case EntityType.Zombie: ApplyChams(entity, Color.red); break; case EntityType.Player: ApplyChams(entity, Color.cyan); break; case EntityType.Animal: ApplyChams(entity, Color.yellow); break; case EntityType.Unknown: ApplyChams(entity, Color.white); break; } } lastChamTime = Time.time + 10f; } }