fix: Fixes drag drop bounce issue (#1040)

This commit is contained in:
Kamron Batman 2022-05-30 15:47:06 -07:00 • committed by GitHub
parent aeec7f78fd
commit 98a74a89c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 23 deletions

View file

@ -2074,10 +2074,13 @@ namespace Server
MoveToWorld(from.Location, from.Map); MoveToWorld(from.Location, from.Map);
} }
} }
else if ((parent as Mobile)?.EquipItem(this) == false) else if (parent is Mobile mobile)
{
if (!mobile.EquipItem(this))
{ {
MoveToWorld(bounce.WorldLoc, bounce.Map); MoveToWorld(bounce.WorldLoc, bounce.Map);
} }
}
else else
{ {
MoveToWorld(from.Location, from.Map); MoveToWorld(from.Location, from.Map);

View file

@ -564,8 +564,11 @@ namespace Server.Items
public override bool OnDragDrop(Mobile from, Item dropped) public override bool OnDragDrop(Mobile from, Item dropped)
{ {
if (dropped is SpellScroll scroll && scroll.Amount == 1) if (dropped is not SpellScroll { Amount: 1 } scroll)
{ {
return false;
}
var type = GetTypeForSpell(scroll.SpellID); var type = GetTypeForSpell(scroll.SpellID);
if (type != SpellbookType) if (type != SpellbookType)
@ -593,7 +596,6 @@ namespace Server.Items
from.SendSound(0x249, GetWorldLocation()); from.SendSound(0x249, GetWorldLocation());
return true; return true;
} }
}
return false; return false;
} }