Page 1 of 1

Offline trade mod

Posted: Mon Nov 30, 2009 9:14 am
by VlLight
L2J Revision GF last:

Sorry, if I post in wrong place, I could not find a more suitable.
Some teams add offline trade restore function in their servers.
I tried transfer this function from L2Dream то l2jserver, but encountered the problem.
Server loads the character. When player tries enter to this account, client reports, that account is in use, but server doesn't kick "oflline character" and player can't login.

Server loads charactes, using following code in Gameserver.java for testing puproses:

Code: Select all

 L2GameClient client = new L2GameClient(new MMOConnection<L2GameClient>(_selectorThread));client.setConnection(null);Integer id=12345678;client.setCharSelection(id);L2PcInstance p = client.loadCharFromDisk(0);client.setAccountName("testtest");p.spawnMe();p.setOnlineStatus(true);p.restoreEffects();p.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);p.broadcastUserInfo();p.closeNetConnection(); 
where id is testchar id and "testtest" is testchar login name

i also change method in L2PcInstance

Code: Select all

 	public String getAccountName()	{		if (getClient() == null || getClient().isDetached())			//return "disconnected";                       return "testtest";		return getClient().getAccountName();	} 
I slightly experienced in Java :oops:
Maybe someone gives me advice about this trouble?

Re: Offline trade mod

Posted: Mon Nov 30, 2009 1:36 pm
by _DS_
L2J have built-in offline trade system more than half of year.

Re: Offline trade mod

Posted: Mon Nov 30, 2009 1:44 pm
by qwerty13
I think he mean about restore offline traders after server reboot.

Re: Offline trade mod

Posted: Mon Nov 30, 2009 1:51 pm
by VlLight
qwerty13 wrote:I think he mean about restore offline traders after server reboot.
Yes. I mean that

Re: Offline trade mod

Posted: Mon Nov 30, 2009 2:02 pm
by janiii
if you want to get help, you have to share the code you used for the offline trade. we cannot know the code you used and help you without the code.

Re: Offline trade mod

Posted: Mon Nov 30, 2009 2:24 pm
by VlLight
I use general l2jserver offline trade code.
Above I posted code, which i use for load character with server start. And also described the trouble :)

Re: Offline trade mod

Posted: Mon Nov 30, 2009 3:02 pm
by janiii
VlLight wrote:I use general l2jserver offline trade code.
Above I posted code, which i use for load character with server start. And also described the trouble :)
the code cannot be used in l2j as some of the methods just dont exist in l2j.

try this code:

Code: Select all

L2GameClient client = new L2GameClient(null);client.setState(GameClientState.IN_GAME);CharSelectInfoPackage[] charInfoPackage = {new CharSelectInfoPackage(1234567890, "testtest")};client.setCharSelection(charInfoPackage);L2PcInstance p = client.loadCharFromDisk(0);p.spawnMe();p.setOnlineStatus(true);client.isDetached(true);p.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR);p.restoreEffects();p.broadcastUserInfo();

Re: Offline trade mod

Posted: Tue Dec 01, 2009 12:40 am
by Cinam
I might be missing something here, but how would this restore the actual trade lists the offline players are using ?

Wouldn't it just put them in-game, marked as off-line, but unable to trade ?

Re: Offline trade mod

Posted: Tue Dec 01, 2009 8:39 am
by VlLight
Thanks, janiii, I'll try as soon as I can.
Cinam wrote: Wouldn't it just put them in-game, marked as off-line, but unable to trade ?
Quite right. Without this part I see no point for other parts.

Re: Offline trade mod

Posted: Wed Dec 02, 2009 8:34 pm
by VlLight
Same trouble with new code.
If i leave method L2PcInstance.getAccountName() unmodified (see 1st post), character is loadind by server as account named "disconnected", although admin charinnfo window displays other characters from this account properly. Player can log in with "offline" account, and can enter in game with "offline" characters (server kicks both duplicate characters after this, as it should be).
If i modify method L2PcInstance.getAccountName() character is loadind by server as account named "testtest", player can not login with "offline" account at all, because client replies, that account is in use, but server doesn't kick "oflline character"

Re: Offline trade mod

Posted: Fri Jan 01, 2010 2:54 pm
by streamsss
uppppp