fix: Fix direction change speed hack (#1194)

This commit is contained in:
Kamron Batman 2022-10-16 20:17:18 -07:00 • committed by GitHub
parent 9b2b34f5fb
commit d5416b6dec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 92 additions and 164 deletions

View file

@ -53,31 +53,33 @@ namespace Server.Items
private static void Shoot(PlayerMobile from, Mobile target, INinjaWeapon weapon)
{
if (from != target && CanUseWeapon(from, weapon) && from.CanBeHarmful(target))
if (from == target || !CanUseWeapon(from, weapon) || !from.CanBeHarmful(target))
{
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
return;
}
if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange))
{
from.NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
{
from.NinjaWepCooldown = true;
from.Direction = from.GetDirectionTo(target);
from.RevealingAction();
weapon.AttackAnimation(from, target);
ConsumeUse(weapon);
if (CombatCheck(from, target))
{
Timer.StartTimer(TimeSpan.FromSeconds(1.0), () => OnHit(from, target, weapon));
}
Timer.StartTimer(TimeSpan.FromSeconds(2.5), () => from.NinjaWepCooldown = false);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
Timer.StartTimer(TimeSpan.FromSeconds(1.0), () => OnHit(from, target, weapon));
}
Timer.StartTimer(TimeSpan.FromSeconds(2.5), () => from.NinjaWepCooldown = false);
}
else
{
from.SendLocalizedMessage(1063303); // Your target is too close!
}
}

View file

@ -71,11 +71,13 @@ public class Lockpick : Item
if (targeted is ILockpickable lockpickable)
{
var item = lockpickable as Item;
from.Direction = from.GetDirectionTo(item);
if (lockpickable.Locked)
if (lockpickable is Item item && lockpickable.Locked)
{
if (item.RootParent != from)
{
from.Direction = from.GetDirectionTo(item);
}
from.PlaySound(0x241);
new InternalTimer(from, lockpickable, m_Item).Start();