clark71822
Member
Ok, I think I have this setup right to use the new bank system, but I would also like to have the option to use the master storage from OWLTR as a secondary option. Can anyone give me some suggestions on how I could go about this? Here's the OnTarget method from the script:
Including complete file for reference as well
Edit: Realized the script didn't check for gold in player's pack and updated it
Code:
protected override void OnTarget( Mobile from, object target )
{
Container pack = from.Backpack;
int m_Amount = pack.GetAmount( typeof( Gold ) );
int b_Amount = Banker.GetBalance(from);
if (target is BaseJewel || target is BaseArmor || target is BaseClothing || target is BaseShield || target is BaseWeapon || target is EtherealMount || target is BaseSuit || target is Item)
{
if (pack != null && m_Amount >= 1000)
{
Item item = (Item)target;
if (item.RootParent == from)
item.Hue = m_Item.Hue;
pack.ConsumeTotal(typeof(Gold), 1000);
from.SendMessage("1000 gold has been removed from your pack.");
}
else if (b_Amount >= 1000)
{
Item item = (Item)target;
if (item.RootParent == from) // Make sure its in their pack or they are wearing it
item.Hue = m_Item.Hue;
Banker.Withdraw(from, 1000, true);
}
else if (b_Amount < 1000 && m_Amount < 1000)
{
from.SendMessage("You don't have enough gold to afford this!");
}
else
from.SendMessage("You can only dye objects that are in your backpack or on your person!");
}
// Begin Enable Pets
else if (target is BaseCreature)
{
if (m_Amount >= 5000)
{
BaseCreature c = target as BaseCreature;
if (c.Controlled && c.ControlMaster == from)
{
c.Hue = m_Item.Hue;
pack.ConsumeTotal(typeof(Gold), 5000);
from.SendMessage("5000 gold has been removed from your pack.");
}
}
else if (b_Amount >= 5000)
{
BaseCreature c = target as BaseCreature;
if (c.Controlled && c.ControlMaster == from)
{
c.Hue = m_Item.Hue;
Banker.Withdraw(from, 5000, true);
}
}
else if (b_Amount < 5000 && m_Amount < 5000)
{
from.SendMessage("You don't have enough gold to afford this!");
}
else
from.SendMessage("You can only dye animals whom you control!");
} // End enable pets.
else
from.SendMessage("Invalid target.");
}
Including complete file for reference as well
Edit: Realized the script didn't check for gold in player's pack and updated it
Attachments
Last edited: