Fix/consume - Closes #10 (#14)

* Fixes stacking, consumption instead of deletion, and a few other minor issues. Server-side only.
* Fixes stacking of ore.
* Fixes cooking consumption.
This commit is contained in:
Kamron Batman 2018-02-22 00:57:07 -08:00 • committed by GitHub
parent f6d5689dee
commit 0d9fe76b2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 163 additions and 91 deletions

View file

@ -1525,6 +1525,11 @@ namespace Server
}
}
public virtual bool CanStackWith( Item dropped )
{
return dropped.Stackable && Stackable && dropped.GetType() == GetType() && dropped.ItemID == ItemID && dropped.Hue == Hue && dropped.Name == Name && (dropped.Amount + Amount) <= 60000 && dropped != this;
}
public bool StackWith( Mobile from, Item dropped )
{
return StackWith( from, dropped, true );
@ -1532,7 +1537,7 @@ namespace Server
public virtual bool StackWith( Mobile from, Item dropped, bool playSound )
{
if ( dropped.Stackable && Stackable && dropped.GetType() == GetType() && dropped.ItemID == ItemID && dropped.Hue == Hue && dropped.Name == Name && (dropped.Amount + Amount) <= 60000 && dropped != this && !dropped.Nontransferable && !Nontransferable )
if ( CanStackWith( dropped ) )
{
if ( m_LootType != dropped.m_LootType )
m_LootType = LootType.Regular;
@ -1558,10 +1563,19 @@ namespace Server
public virtual bool OnDragDrop( Mobile from, Item dropped )
{
bool success = false;
if ( Parent is Container )
return ((Container)Parent).OnStackAttempt( from, this, dropped );
success = ((Container)Parent).OnStackAttempt( from, this, dropped );
else
success = StackWith( from, dropped );
return StackWith( from, dropped );
if ( success && Spawner != null )
{
Spawner.Remove( this );
Spawner = null;
}
return success;
}
public Rectangle2D GetGraphicBounds()