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 issues

Delta

Wanderer
Bank issues

I was wondering I am working on a script but need to check things in the bank box like how much gold there is what namespace are we looking for also how to place items in the bank box?
 

Redleer

Wanderer
hmmh isn't there already bankc box or what your making? box what people can rent? or what? or making better banker?
 

Delta

Wanderer
OK here is what I have got going I am new to C# and I am trying to add the ability to create checks from bankers I started work on it and here is what I have.

[code:1]using System;
using System.Collections;
using Server.Items;
using Server.Scripts.Items;
using Server.ContextMenus;
using Server.Scripts.Misc;
using Server.Mobiles;

namespace Server.Scripts.Mobiles
{
public class Banker : Mobile
{
[Constructable]
public Banker()
{
InitStats( 100, 100, 25 );

Title = "the banker";
Hue = Utility.RandomSkinHue();

if ( this.Female = Utility.RandomBool() )
{
this.Body = 0x191;
this.Name = NameList.RandomFemaleName();
}
else
{
this.Body = 0x190;
this.Name = NameList.RandomMaleName();
}

AddItem( new FancyShirt( Utility.RandomNeutralHue() ) );
AddItem( new ShortPants( Utility.RandomNeutralHue() ) );
AddItem( new Boots( Utility.RandomNeutralHue() ) );

Item hair = new Item( Utility.RandomList( 0x203B, 0x2049, 0x2048, 0x204A ) );

hair.Hue = Utility.RandomNondyedHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
hair.Newbied = true;

AddItem( hair );

Container pack = new Backpack();

pack.DropItem( new Gold( 1000, 2000 ) );

pack.Movable = false;
pack.Newbied = true;

AddItem( pack );
}

public Banker( Serial serial ) : base( serial )
{
}

public override void OnSpeech( SpeechEventArgs e )
{
if ( e.Mobile.InRange( this, 12 ) && e.HasKeyword( 0x0002 ) )
{
BankBox box = e.Mobile.BankBox;

if ( box != null )
box.Open();
}
else if ( e.Mobile.InRange( this, 12 ) && e.HasKeyword( 0x0003 ) )
{
e.Mobile.Backpack.DropItem( new BankCheck( 1000 ) );
}

}

public override void GetContextMenuEntries( Mobile from, ArrayList list )
{
base.GetContextMenuEntries( from, list );

list.Add( new OpenBankEntry( from, this ) );
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
}
}
}[/code:1]

ok the area I added is

[code:1]else if ( e.Mobile.InRange( this, 12 ) && e.HasKeyword( 0x0003 ) )
{
e.Mobile.Backpack.DropItem( new BankCheck( 1000 ) );
}[/code:1]

ok when you say check it creates a 1k check in your backpack I am trying to get it to create in your bank also check your bank if you have enough it takes it from your amount. I want to add later the ability to specify how big of a check right now I want to start small. Also if there is any coding errors or any clean ups I need to do let me know I will continue working on it but I wanted you guys to see what I am working on.
 

Delta

Wanderer
ok I changed

[code:1]else if ( e.Mobile.InRange( this, 12 ) && e.HasKeyword( 0x0003 ) )
{
e.Mobile.Backpack.DropItem( new BankCheck( 1000 ) );
}[/code:1]

To [code:1]else if ( e.Mobile.InRange( this, 12 ) && e.HasKeyword( 0x0003 ) )
{
BankBox box = e.Mobile.BankBox;
box.DropItem( new BankCheck( 1000 ) );
}[/code:1]

And now when I say Check it puts a 1k check in my bank. :)
 

Delta

Wanderer
ok I think I can use

int ConsumeTotal( Type[] types, int[] amounts, bool recurse ) section of the bank box to take 1k away from the gold but under type what do I put for gold???
 

krrios

Administrator
All the banker commands have already been added in beta5: withdraw, balance, check, and bank.

Fyi, you can use ConsumeTotal() like this:

[code:1]if ( someContainer.ConsumeTotal( typeof( Gold ), 1000 ) )
{
// 1k gold was consumed
}
else
{
// we didn't have 1k gold
}[/code:1]
 
Top