public bool IsInAttackRange(bool requireAllWeapons = false) { Dictionary <EquipSlot, WeaponItem> weapons = DynelManager.LocalPlayer.Weapons; if (weapons.Count > 0) { if (!requireAllWeapons) { return(weapons.Values.Any(x => x.IsDynelInRange(this))); } return(weapons.Values.Count(x => x.IsDynelInRange(this)) == weapons.Count); } else { IntPtr pWeaponHolder = DynelManager.LocalPlayer.pWeaponHolder; IntPtr dummyWeapon = WeaponHolder_t.GetDummyWeapon(pWeaponHolder, Stat.MartialArts); if (dummyWeapon == IntPtr.Zero) { return(false); } IntPtr pdummyWeaponUnk = *(IntPtr *)(dummyWeapon + 0xE4); return(WeaponHolder_t.IsDynelInWeaponRange(pWeaponHolder, pdummyWeaponUnk, Pointer) == 0x01); } }
public unsafe bool IsInRange(Dynel target) { const EquipSlot MainHand = EquipSlot.Weap_RightHand; const EquipSlot OffHand = EquipSlot.Weap_LeftHand; Dictionary <EquipSlot, WeaponItem> weapons = DynelManager.LocalPlayer.Weapons; SpecialAttack specialAttack = this == Backstab ? SpecialAttack.SneakAttack : this; if (weapons.Count > 0) { if (weapons.ContainsKey(MainHand) && weapons[MainHand].SpecialAttacks.Contains(specialAttack)) { return(weapons[MainHand].IsDynelInRange(target)); } else if (weapons.ContainsKey(OffHand) && weapons[OffHand].SpecialAttacks.Contains(specialAttack)) { return(weapons[OffHand].IsDynelInRange(target)); } else { return(false); } } else { IntPtr pWeaponHolder = DynelManager.LocalPlayer.pWeaponHolder; IntPtr dummyWeapon = WeaponHolder_t.GetDummyWeapon(pWeaponHolder, this._stat); if (dummyWeapon == null) { return(false); } IntPtr pdummyWeaponUnk = *(IntPtr *)(dummyWeapon + 0xE4); return(WeaponHolder_t.IsDynelInWeaponRange(pWeaponHolder, pdummyWeaponUnk, target.Pointer) == 0x01); } }