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!

RunUO 2.0 RC 1 Intrest System

Murzin

Knight
RunUO 2.0 RC 1 Intrest System ( & final )

Ok, most intrest systems i have seen fail to take some things into account.

1) current intrest rate is 1g per 1,000 g in bank in loose coinage and checks in top level and containers

2) will not give intrest if they have not logged in in the last 30 days

3) will not give intrest if they are banned

majority of it is commented with whats happening at each step.

Version: 1.0, initial release
Version: 1.1, functioning recursive search for gold/checks, tested to 5 sub-containers
Version: 1.2, post #18

verified compile in 2.0 final version

for the 2.0 final version, its the one down below #18
 

Attachments

  • intrest.cs
    3.1 KB · Views: 314

Liacs

Sorceror
Sounds good. I got an older interest system. But I think it doesn't take into account the banning and the logging time... (I think ;))

Thanks!

Lia
 

arul

Sorceror
Code:
if( item is Container )  // begin recursive check of all containers

This is not a recursion. Recursion is calling a function from within its body.
Your code will check only 1st and 2nd level containers.

You can simply use the code that's already in Container.cs and do it effeciently in a two-line fashion.
Code:
int totalGold = ibb.GetAmount(typeof(Gold));
Array.ForEach<BankCheck>( ibb.FindItemsByType(typeof(BankCheck)), delegate( BankCheck check ){ totalGold += check.Worth; });
 

Murzin

Knight
the list function is actually the recursive check... i tested it with 3 nested containers and it worked properly :)
 

arul

Sorceror
What do you mean by the list function?

It checks only the top level (bank box itself) and then the next level(one-level nested container), because it doesn't do a recursive search.

In the attached image you can see that it doesn't work. It checks the containers highlighted in gray, but not the one in red.
 

Attachments

  • proof.jpg
    proof.jpg
    34.3 KB · Views: 246

Murzin

Knight
ok, new release, version 1.1 including a recursive search tested to 5 sub-packs inside a bank box.
 

Liacs

Sorceror
@Joeku: Are you mocking me? Then you are making a fool of yourself... because intErest is right :p
Have a look into the next dictionary! ;)

Lia
 

Joeku

Lord
Liacs;722526 said:
@Joeku: Are you mocking me? Then you are making a fool of yourself... because intErest is right :p
Have a look into the next dictionary! ;)

Lia
I was mocking Murzin lol <3
 

Macil

Sorceror
Murzin;722383 said:
Ok, most intrest systems i have seen fail to take some things into account.

1) current intrest rate is 1g per 1,000 g in bank in loose coinage and checks in top level and containers

2) will not give intrest if they have not logged in in the last 30 days

3) will not give intrest if they are banned

majority of it is commented with whats happening at each step.

Version: 1.0, initial release
Version: 1.1, functioning recursive search for gold/checks, tested to 5 sub-containers

I was wondering if perhaps you could add a feature to this so that the interest system is excluded per account level? I like to keep my Admin well stocked with gold but after a few days the gold in my bank box got a bit out of hand with the Admin. I don't know about anyone else but if Admins or Staff were excluded from the interest system it might make things easier.

Its not really a big deal, I was just wondering.
 

Murzin

Knight
Code:
if ( mob.BankBox != null && ( ((PlayerMobile)mob).LastOnline + inttime ) > DateTime.Now && !((PlayerMobile)mob).Account.Banned )

change that to:

Code:
if ( mob.BankBox != null && ( ((PlayerMobile)mob).LastOnline + inttime ) > DateTime.Now && !((PlayerMobile)mob).Account.Banned && from.AccessLevel == AccessLevel.Player )

that should fix it
 

Macil

Sorceror
After modifying it like you said to exclude staff I get this error.

Code:
Errors:
 + !Custom Scripts/intrest.cs:
    CS0103: Line 42: The name 'from' does not exist in the current context

Whats it mean? Heh.
 

Axhind

Sorceror
I had an older version of an interest system, and saw this one and figured I'd give it a try. I keep getting this following error.

Line 42: 'Server.Accounting.IAccount' does not contain a definition for 'Banned'

It seems that things have changed in the few years that I've been away.

-Axhind
 

greywolf79

Sorceror
I cannot remember if I posted on here before... But this package is awesome. I have it installed on my rc1 shard... Anyone know if it is compatible with rc2?

GreyWolf.
 

Murzin

Knight
i fixxed the error and now i have that error gone...


let me know if you have problems with this
 

Attachments

  • intrest.cs
    3.1 KB · Views: 68
Top