RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Bank Storage Increase Deeds

Tresdni

Squire
Another side note (I'm typing it here also because the formatting always breaks on code tags when I edit my post) - A player must log out, and log in for the deeds to take affect. They will only need to do this after they use a deed, as the bonus slots get added at each login.

- Bank MaxItems do not get serialized like you think (they are also in the server core from what I know), so it must be done this way.
 

Pure Insanity

Sorceror
Why not just have the deed also increase their bank size when it sets the value on the player mobile? Nice system though.
 

Tresdni

Squire
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.
 
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.

I think what he is saying is; why not modify your script like the following so logout and login isn't needed.

Code:
        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();
            }
        }
 

Pure Insanity

Sorceror
Would 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.
 
Would 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.
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. lol
 

Pakko

Traveler
hi im havig trouble with loginstats.cs i would really like to get some support on this as i have nearly all of tresdini scripts installed i love his work here is my error,

Errors:
+ Misc/LoginStats.cs:
CS1513: Line 35: } expected
CS1513: Line 35: } expected

And the loginstats script is attached thanx guys for all the help.
 

Attachments

  • LoginStats.cs
    1.1 KB · Views: 29

Peoharen

Sorceror
You could have set an Account tag for this rather than messing with the saves.

IE
Code:
        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." );
                }
            }
        }

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.
 

Tresdni

Squire
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 most definitely could. Although, the extra slots would apply to all characters for the account.

An even more affective technique would be to use xml attachments, if you really don't want to do the playermobile edits.

By all means guys, tear it apart :) It's doing just what I need it to for my server atm.
 

Peoharen

Sorceror
You most definitely could. Although, the extra slots would apply to all characters for the account.
You 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*
 

Pure Insanity

Sorceror
That wouldn't be very effective Peoharen...what if they get a name change? Sure it's nice having drag and drop, but some times it's easier to serialize exactly what you need. Although...again like it was mentioned before. You could also simply use xml attachments or the ACC module system to handle the stuff. Or if you actually know what you're doing, the playermobile edits won't be hard to pull off.
 

Deadperson

Wanderer
I tried to implement this into my shard and I got the following error:

Scripts: Compiling C# scripts...ScriptCompiler: CS0246: The type or namespace na
me 'PlayerMobile' could not be found (are you missing a using directive or an as
sembly reference?)
ScriptCompiler: CS0246: The type or namespace name 'PlayerMobile' could not be f
ound (are you missing a using directive or an assembly reference?)
ScriptCompiler: CS0246: The type or namespace name 'PlayerMobile' could not be f
ound (are you missing a using directive or an assembly reference?)
ScriptCompiler: CS0103: The name 'BroadcastMessage' does not exist in the curren
t context
done (0 errors, 0 warnings)

It happened after I made the changes to LoginStats.cs, can anybody provide some insight on the issue?
 

Deadperson

Wanderer
using System;
using Server.Network;

namespace Server.Misc
{
public class LoginStats
{
public static void Initialize()
{
// Register our event handler
EventSink.Login += new LoginEventHandler( EventSink_Login );
}

private static void EventSink_Login( LoginEventArgs e )
{
if (e.Mobile != null && e.Mobile is PlayerMobile)
{
PlayerMobile pm = e.Mobile as PlayerMobile;

if (pm.Young)
{ BroadcastMessage( AccessLevel.Counselor, 43, "A young player has logged in: [{0}]", pm.Name ); }

if (e.Mobile.BankBox != null) //supports adding extra bank slots via deed
{
if( pm.BonusBankSlots >= 10 ) //we do not use deeds less than 20 anyways. Fail safe.
{
e.Mobile.BankBox.MaxItems = 125 + pm.BonusBankSlots;
}
else
{
e.Mobile.BankBox.MaxItems = 125;
}
}
}
}
}
}

There you go, whole thing. :confused:
 
Top