The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[ITEM/FUNCTION] Account Banks
Author Message
pointhz
Journeyman
*

Posts: 148
Likes Given: 1
Likes Received: 55 in 28 posts
Joined: Oct 2013
Reputation: 1



Post: #1
[ITEM/FUNCTION] Account Banks
Hello all,

Following this topic http://forum.spherecommunity.net/Thread-...-Gold-Bank (which is also included in this script) I'm now going to share three bankbox sharing functions/item between account characters.

The two functions I'm presenting first can be used if you want all account characters to share the same bankbox between themselves.

So, the first function you can find in this script, "f_account_bank", shall be used if you want all account characters to share the same bankbox between themselves BUT you can't be sure that every account character bankbox is empty. For example, if you have a running shard and you want to implement this, you must use this function, because on every login it will check for items in other account characters bankbox and transfer them to your current character bankbox.

In the other hand, if you can be sure that every character bankbox is empty (for example in a completely new shard), then you can use the second function found in this script, "f_bank_account", because instead of checking for items in every account character bankbox, it will just check which character has items in its bankbox and then transfer them all to your current character bankbox.

Using the first function, "f_account_bank", may be the best to suit all your needs and cover up every situation.

The function you choose to use must be placed under @login at your main player event.

Thanks to Xun and Escribano for helping on those functions.

Note: There are more checks than the ones needed in the functions, but this way you probably won't ever get any console error.

Now, if instead of having all account charactesr sharing the same bankbox between themselves, you simply want a character to access another character bankbox without having to logout, what I'm presenting next may be what you are looking for.

This is scripted as a chest and can't be used in any other way, and you will realize why soon enough.

Adding a "i_account_characters_bank" will spawn a chest and double-clicking in it will prompt the following dialog:

[Image: image.jpg]

As you can see it is a very simply dialog. Clicking in the "Access Account Gold Bank" button will redirect you to my other script, which link can be found at the start of this topic. The other options are clicking in one of your account characters name and doing so will open its bankbox to yourself.

There's not much more to say about it, so I'll just try to explain how does the script work so you can understand it. Players don't notice much of what I'm going to explain next, it's mostly some "optimization" checks.

When you choose one account character to open its bankbox, what the script does is create a new chest containing all items from the chosen character bankbox (Items are moved into there, never duped) inside the scripted chest.

Then you can just move items into/from there normally, like if it was your own bankbox. (You may not be able to move containers like chests into there, because of "space" issues.)

There is a 5 minutes delay until a bankbox is updated (You can change this, just look for the timerf). What this means is: If you choose to open a character bankbox, logout your current character, and login the character whom bankbox you just opened, you will find that its bankbox is empty. This is because the items are inside the Account Bank chest.

To have your items back into your bankbox you have two options: Wait 5 minutes starting from when you accessed the character bankbox OR double-click the chest and chose to open your own bankbox. This will move the items to your bankbox and then it can be normally accessed again.

Everytime you double-click the chest and choose a character to open its bankbox the script will:

- Check if it is your own bankbox.
-- If it is and it has been accessed by another character recently (within 5 minutes before), it will move the items back into your bankbox and force your bankbox to be opened normally (.bankself)
-- If it is and it hasn't been accessed by another character recently (within 5 minutes before), it will just force your bank to be opened normally (.bankself)

- If it is not your own bankbox:
-- If it has been accessed by another character recently (within 5 minutes before), it will just open that chest
-- If it hasn't been accessed by another character recently (within 5 minutes before), it will then do what it usually does: create a new chest inside the scripted chest and move the items from the chosen character bankbox into there.

I guess I'm not forgetting anything. I tested several times and everything seems to be working as intended.

Any question just ask.

Updated:

(09-14-2015 08:47 AM)pointhz Wrote:  I've added two functions to the script: "f_merge_account_banks_up" and "f_merge_account_banks_down". They don't add anything else to the system, but I'll explain:

Basically, if you have a running server and want to use the function that will seek for a character bank with items and transfer it to your current character (The 2nd function in the script), instead of using the function that will bounce all items from all account characters bank to your current character bank (The 1st function in the script), these functions can be used as a "reset".

What they do is move all items from all account characters bank to one single character bank.

If you use "f_merge_account_banks_up", all items from all characters bankboxs will go to character 4 bankbox. If instead you use "f_merge_account_banks_down", all items from all characters bankboxs will go to character 0 bankbox.


Attached File(s)
.scp  p_acc_bank.scp (Size: 28.55 KB / Downloads: 29)
(This post was last modified: 09-14-2015 08:48 AM by pointhz.)
09-12-2015 12:41 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 2 users Like pointhz's post
dafty
Apprentice
*

Posts: 6
Likes Given: 6
Likes Received: 0 in 0 posts
Joined: Sep 2015
Reputation: 0



Post: #2
RE: [ITEM/FUNCTION] Account Banks
Tanks pointhz for the sharing i will test and if i find something wrong i will report. Keep the nice work

Enviado do meu GT-I9505 através de Tapatalk
09-13-2015 04:49 AM
Find all posts by this user Like Post Quote this message in a reply
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #3
RE: [ITEM/FUNCTION] Account Banks
Nici work poithz, im glad to hat i could help in something!


See yah!

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
09-14-2015 07:14 AM
Find all posts by this user Like Post Quote this message in a reply
pointhz
Journeyman
*

Posts: 148
Likes Given: 1
Likes Received: 55 in 28 posts
Joined: Oct 2013
Reputation: 1



Post: #4
RE: [ITEM/FUNCTION] Account Banks
Thanks Big Grin

I've added two functions to the script: "f_merge_account_banks_up" and "f_merge_account_banks_down". They don't add anything else to the system, but I'll explain:

Basically, if you have a running server and want to use the function that will seek for a character bank with items and transfer it to your current character (The 2nd function in the script), instead of using the function that will bounce all items from all account characters bank to your current character bank (The 1st function in the script), these functions can be used as a "reset".

What they do is move all items from all account characters bank to one single character bank.

If you use "f_merge_account_banks_up", all items from all characters bankboxs will go to character 4 bankbox. If instead you use "f_merge_account_banks_down", all items from all characters bankboxs will go to character 0 bankbox.
09-14-2015 08:47 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #5
RE: [ITEM/FUNCTION] Account Banks
It may not be really needed because you are providing functions to control items over one bank but i'll make a suggestion anyway: Providing an override to f_onchar_delete under sphere_serv_triggers.scp so when a player gets deleted (if it is not the last one on that account) Sphere moves it's items to another one ( in the case someone is using the 'f_account_bank' and 'f_bank_account' to move all items to one character ).
09-15-2015 06:24 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes XuN's post
dafty
Apprentice
*

Posts: 6
Likes Given: 6
Likes Received: 0 in 0 posts
Joined: Sep 2015
Reputation: 0



Post: #6
RE: [ITEM/FUNCTION] Account Banks
Nice idea xun

Enviado do meu GT-I9505 através de Tapatalk
09-17-2015 02:37 AM
Find all posts by this user Like Post Quote this message in a reply
pointhz
Journeyman
*

Posts: 148
Likes Given: 1
Likes Received: 55 in 28 posts
Joined: Oct 2013
Reputation: 1



Post: #7
RE: [ITEM/FUNCTION] Account Banks
This should do it I guess. It will transfer any items found in the bankbox of the char being deleted to the first char it encounters that its not the char being deleted.

This can be useful for everyone, so players don't accidentally delete a char with items in its bankbox and lose them.

[FUNCTION f_onchar_delete]
IF (<SRC.ACCOUNT.CHARS> > 1)
IF (<SRC.FINDLAYER.layer_bankbox.UID>)
FOR <SRC.ACCOUNT.CHARS>
IF !(<SRC.ACCOUNT.CHAR.<EVAL (<LOCAL._FOR>-1)>.UID>==<SRC.UID>)
LOCAL.UID1=<SRC.FINDLAYER.layer_bankbox.UID>
IF !(<SRC.ACCOUNT.CHAR.<EVAL (<LOCAL._FOR>-1)>.FINDLAYER.layer_bankbox.UID>)
SERV.NEWITEM i_bankbox
TRY UID.<SRC.ACCOUNT.CHAR.<EVAL (<LOCAL._FOR>-1)>.UID>.EQUIP <NEW.UID>
ENDIF
LOCAL.UID2=<SRC.ACCOUNT.CHAR.<EVAL (<LOCAL._FOR>-1)>.FINDLAYER.layer_bankbox.UID>
FORCONT <LOCAL.UID1> 0
LOCAL.CONTP=<CONTP>
CONT=<LOCAL.UID2>
CONTP=<LOCAL.CONTP>
ENDFOR
ENDIF
ENDFOR
ENDIF
ENDIF
RETURN 0

Easier to read: http://pastebin.com/XSe9ngPi
(This post was last modified: 09-18-2015 09:47 PM by pointhz.)
09-17-2015 04:20 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)