Resource icon

Savings account system with interest! 2020-05-05

No permission to download
Ever wanted to earn money on gold in the bank? Now you can!
I created an interest bag, when you drag gold/check on the bag, the funds are converted to an investment certificate.
(note that the gold/check has to be dragged on the un-opened bag)

The following code has to be activated by some kind of timer (im using a central hourly timer on mine). it will scan all bankboxes for investments and give interest on funds held in investment certificates.

works for RUNUO 2.1. enjoy!
C#:
// adding interest to interestbags         
            Console.WriteLine( "interest check" );

            World.Broadcast( 0x22, true, "Your bank has just given you interest on all gold in your interest bag in your bank!" );

            ArrayList bankBoxes = new ArrayList();
            foreach( Item bb in World.Items.Values )
            {

                if ( bb is BankBox )
                {
                        bankBoxes.Add( bb );
                }
            }

            foreach( BankBox ibb in bankBoxes )
            {

                    int totalGold = 0;
                    double interest = 0;
                    int interestint = 0;
                  
                    foreach( Item item in ibb.Items )
                    {

                        if( item is InterestBag )
                        {
  
                            List<Item> ItemsInBag = item.Items;
                            for( int z = 0; z < ItemsInBag.Count; z++ )
                            {
                                Item inBag = ItemsInBag[z];

                                if( inBag is InvestmentCheck )
                                {
                                    interest = ((InvestmentCheck)inBag).Worth * 0.0001;
                                    interestint = Convert.ToInt32(interest);
                                    if (interestint >= 1)
                                        ((InvestmentCheck)inBag).Worth += interestint;
                                }
                            }
                        }
                    }
            }
to-do - have some randomized events which may affect your investments! Any ideas on thematic events? Or, can also convert the investmentcheck to some kind of bond/stock that has really random returns... who knows!
  • Like
Reactions: sircapted
Author
Finaltwist
Downloads
10
Views
134
First release
Last update
Rating
0.00 star(s) 0 ratings

Latest updates

  1. new version

    updated to allow for people to drag gold into the bag when the bag is opened.