Offline trade mod

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
VlLight
L2j Veteran
L2j Veteran
Posts: 577
Joined: Fri Dec 14, 2007 11:58 am
Location: Russia

Offline trade mod

Post 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?
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Offline trade mod

Post by _DS_ »

L2J have built-in offline trade system more than half of year.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
qwerty13
Posts: 640
Joined: Mon Feb 02, 2009 9:57 am
Location: Europe
Contact:

Re: Offline trade mod

Post by qwerty13 »

I think he mean about restore offline traders after server reboot.
User avatar
VlLight
L2j Veteran
L2j Veteran
Posts: 577
Joined: Fri Dec 14, 2007 11:58 am
Location: Russia

Re: Offline trade mod

Post by VlLight »

qwerty13 wrote:I think he mean about restore offline traders after server reboot.
Yes. I mean that
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Offline trade mod

Post 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.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
User avatar
VlLight
L2j Veteran
L2j Veteran
Posts: 577
Joined: Fri Dec 14, 2007 11:58 am
Location: Russia

Re: Offline trade mod

Post 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 :)
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Offline trade mod

Post 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();
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
Cinam
Posts: 21
Joined: Fri Feb 09, 2007 12:48 pm

Re: Offline trade mod

Post 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 ?
User avatar
VlLight
L2j Veteran
L2j Veteran
Posts: 577
Joined: Fri Dec 14, 2007 11:58 am
Location: Russia

Re: Offline trade mod

Post 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.
User avatar
VlLight
L2j Veteran
L2j Veteran
Posts: 577
Joined: Fri Dec 14, 2007 11:58 am
Location: Russia

Re: Offline trade mod

Post 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"
streamsss
Posts: 186
Joined: Wed Jun 24, 2009 10:01 am

Re: Offline trade mod

Post by streamsss »

uppppp
Post Reply