Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Bank!! (https://forums.graalonline.com/forums/showthread.php?t=79220)

[email protected] 03-28-2008 09:53 AM

Bank!!
 
PHP Code:

public function GetMoney() {
    
temp.data.loadVars(this.GetBankFilePath());
    
    return (
data.money);
}

public function 
CreateBankAccount() {
    
temp.data.money = 0;
    
    
data.account_opened = timevar2;
    
data.last_transaction = timevar2;
    
    
data.savevars(this.GetBankFilePath(), 0);
}

public function 
GetBankFilePath() {
    return 
"ServerData/Bank/" @ this.account.substring(0, 1) @ "/" @ this.account @ ".txt";
}

public function 
ResetBank() {
    
this.CreateBankAccount();
}

public function 
SetMoney(amount) {
    
temp.data.loadVars(this.GetBankFilePath());
    
temp.money = temp.amount.substring(1);
    
temp.flag = temp.amount.substring(0, 1);
       
    
data.transactions.add(log);
    
    if (
flag == "-") data.money -= amount;
    else if (
flag == "=") data.money = amount;
    else 
data.money += amount;

    
temp.flags = {"-", "+", "="};
    
temp.logs = {"Reduce", "Increase", "Set"};
    
temp.log = flags.index(flag);
    
log = flag @ (log == -1? "Increase": log) SPC money @ ". Total:" SPC data.money;
    
log.add(timevar2);
    
    
data.last_transaction = timevar2;
    
    
data.savevars(this.GetBankFilePath(), 0);
}    

public function 
GetNetWorth() {
    
temp.assets = this.obtainAssets();
    
temp.liabilities = this.obtainLiabilities();
    
    return (
liabilities - assets);
} 

^^^^^^^^^^ created for dev Litter!!

DrakilorP2P 03-28-2008 03:22 PM

PHP Code:

temp.assets = this.obtainAssets();
temp.liabilities = this.obtainLiabilities(); 

Defined where?

Tolnaftate2004 03-28-2008 08:26 PM

obj.substring(0,1) is more succinctly put as obj.charat(0).

[email protected] 03-28-2008 09:07 PM

they are my functions to obtain what the player pays out and gains he he
Quote:

Originally Posted by DrakilorP2P (Post 1382870)
PHP Code:

temp.assets = this.obtainAssets();
temp.liabilities = this.obtainLiabilities(); 

Defined where?


oh, thanks!!!!^^
Quote:

Originally Posted by Tolnaftate2004 (Post 1382900)
obj.substring(0,1) is more succinctly put as obj.charat(0).


Tolnaftate2004 03-28-2008 09:39 PM

I would also like to point out that you're using temp.log before you define it (data.transactions.add(log); and some lines down it's defined).

zokemon 03-29-2008 04:23 AM

When making accessor functions like GetBankFilePath and such, you should return either thiso.var or just plain var as if that function was called inside a with () block, it would cause problems. Same applies to some other areas where you said stuff like this.obtainAsserts().

cbk1994 03-29-2008 04:34 AM

Wow, you are getting good fast, Sydney!

Could use some work though, especially adding security.


All times are GMT +2. The time now is 08:01 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.