13440130
Member
When using the Gold Ledger script, you need to modify the code in the Container. CS script
But after modification, when container items such as backpacks, boxes and gift boxes are thrown onto NPCs without backpacks (such as Chyloth, Dryad), the server will crash.
But after modification, when container items such as backpacks, boxes and gift boxes are thrown onto NPCs without backpacks (such as Chyloth, Dryad), the server will crash.
Code:
/*public override bool OnDroppedInto(Mobile from, Container target, Point3D p)
{
bool canDrop = base.OnDroppedInto(from, target, p);
if (canDrop && target is BankBox)
{
CheckBank((BankBox)target, from);
}
return canDrop;
}*/
#region Alpha Gold Ledger Edit 1
public override bool OnDroppedToMobile(Mobile from, Mobile target)
{
Item gitem = target.Backpack.FindItemByType(typeof(GoldLedger));
Item thisgitem = this.FindItemByType(typeof(GoldLedger));
if (gitem != null && thisgitem != null)
{
if (target == from)
from.SendMessage("You can only carry one gold ledger!");
else
from.SendMessage("That player can only carry one gold ledger!");
return false;
}
return false;
}
public override bool OnDroppedInto(Mobile from, Container target, Point3D p)
{
if (from == null || target == null)
{
return false;
}
Item gitem = target.FindItemByType(typeof(GoldLedger));
Item thisgitem = FindItemByType(typeof(GoldLedger));
if (target == from.Backpack)
{
if (gitem != null && thisgitem != null)
{
from.SendMessage("You can only carry one gold ledger!");
return false;
}
}
else if (target.IsChildOf(from.Backpack))
{
if (gitem != null && thisgitem != null)
{
from.SendMessage("You can only carry one gold ledger!");
return false;
}
}
return target.OnDragDropInto(from, this, p);
}
public override bool OnDroppedOnto(Mobile from, Item target)
{
Item gitem = from.Backpack.FindItemByType(typeof(GoldLedger));
Item thisgitem = this.FindItemByType(typeof(GoldLedger));
if (target == from.Backpack)
{
if (gitem != null && thisgitem != null)
{
from.SendMessage("You can only carry one gold ledger!");
return false;
}
}
else if (target.IsChildOf(from.Backpack))
{
if (gitem != null && thisgitem != null)
{
from.SendMessage("You can only carry one gold ledger!");
return false;
}
}
return target.OnDragDrop(from, this);
}
#endregion