Why not just have the deed also increase their bank size when it sets the value on the player mobile? Nice system though.
Because, the MaxItems doesn't get serialized, and is always set to 125 in the core. If the deed did it, then next restart, it would just go back to 125. This is why this method is the way to go.
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else
{
PlayerMobile pm = from as PlayerMobile;
pm.BonusBankSlots = pm.BonusBankSlots + 50;
pm.BankBox.MaxItems = 125 + pm.BonusBankSlots;
from.SendMessage( "Your bank storage has been increased by 50." );
Delete();
}
}
Yeah, that's kinda what I meant. Adding the additional line would prevent needing to log back in, but would not replace the login hook. I think we're on the same page here. lolWould still be needed as on login it would go back to normal size. But he could increase the size of the bank by added the bit of code to the deed. Then you wouldn't HAVE to relog. Still would need the login hook though. Due to how containers/banks are serialized in the core.
private const int m_BonusSlotsPer = 2;
private const int m_BonusCap = 20;
public override void OnDoubleClick( Mobile from )
{
if ( from.Backpack == null || Parent != from.Backpack )
from.SendLocalizedMessage( 1080058 ); // This must be in your backpack to use it.
else if ( from.Account != null )
{
Account acc = (Account)from.Account;
int currentbonus = 0;
try { currentbonus = Convert.ToInt32( acc.GetTag( "Bonus Bank Slots" ) ); }
catch {}
if ( currentbonus + m_BonusSlotsPer > m_BonusCap )
from.SendMessage( "You cannot use another one of these." );
else
{
currentbonus += m_BonusSlotsPer;
acc.RemoveTag( "Bonus Bank Slots" );
acc.AddTag( "Bonus Bank Slots", currentbonus.ToString() );
from.SendMessage( "You increase your maximum item limit for your bank." );
}
}
}
You could have set an Account tag for this rather than messing with the saves.
Then, not even touching PlayerMobile but within the deed it's self you could call the Login delegate and adjust their bank storage thus making this a modless drop in and use custom.
You could add the character's name to the tag's key (TresdniBonusBankSlot for example).You most definitely could. Although, the extra slots would apply to all characters for the account.
using Server.Mobile;
LOLYou could add the character's name to the tag's key (TresdniBonusBankSlot for example).
I bet OSI copes this soon.
Edit - *cough* And by soon I mean give them three years to figure out how. *cough*