Page 2 of 2
Re: Problem with offline shops
Posted: Thu Jul 26, 2012 10:15 am
by jurchiks
That could work, but IMHO too big of a loop just for a couple of characters, better find a way to get only characters from the specific account (though reading from db is an option, it might not be the best one)...
You could, for example, do:
Code: Select all
"SELECT charId FROM characters WHERE `account_name`= " + _user;
then loop over the resultset:
Code: Select all
L2World w = L2World.getInstance();L2PcInstance tmp;while (rset.next()){ tmp = w.getPlayer(rset.getInt("charId")); if ((tmp != null) && !tmp.getClient().isDetached()) { tmp.logout(); }}
Sucks that l2j doesn't have an Account object, would help in this case.
Re: Problem with offline shops
Posted: Thu Jul 26, 2012 10:31 am
by vampir
better
Code: Select all
"SELECT charId FROM characters WHERE `account_name`= " + _user+" AND `online`=1";
It will work well i think, just need test

Re: Problem with offline shops
Posted: Thu Jul 26, 2012 11:19 am
by jurchiks
I'm not sure online=1 for offline shops.
Re: Problem with offline shops
Posted: Thu Jul 26, 2012 12:01 pm
by Villy90
i just checked now for online active character it is ,,online=1"
for offline trader/crafter it is the same

,,online=1" it is not different.
jurchiks can you make a patch/diff with that sql query and what vampir posted i can test it right now

I will spend all day just want to make this work

Re: Problem with offline shops
Posted: Thu Jul 26, 2012 12:07 pm
by Villy90
Update !!!!
Ignore what i posted above it took a few seconds to change the status of offline shop in character db table
Online active char is ,, online=1" offline is 0 obviously
and a offline shop is ,,online=2"
So this can be done with an sql query and will be very fast to check it, unlike in java with loop, if
active char 1 => 1 kick other active player
else login or something like this :-s
damn i wish i knew more java, but i am just starting to learn and its alot at once, with the size of l2j core, soo many clases and conditions.
Re: Problem with offline shops
Posted: Thu Jul 26, 2012 12:51 pm
by jurchiks
You can add the "online=2" to the query, but you should leave the rest of my posted code as it is (if you will use it, of course); it simply checks if that player is actually in server data.
P.S. I'm @work now, I only check forums here, don't have l2j code at hand.
Re: Problem with offline shops
Posted: Thu Jul 26, 2012 1:25 pm
by Villy90
Ok Jurchicks i will wait until you get home and have some time to make a patch/diff file so i can put it in core and test it, i am working on multisell npc / gm shop now so i have my hands full so many items good thing its easy to add items as it is in xml

Re: Problem with offline shops
Posted: Sat Jul 28, 2012 9:04 pm
by Villy90
I just tried now and it does not work.

It gives me errors in loginserver when i log in the account with an offline shop made.

when it throws the error in l2. ,,account is already in use.unable to login."
Re: Problem with offline shops
Posted: Sat Jul 28, 2012 9:19 pm
by jurchiks
yeah, that part was left intact in both of our patches.
Re: Problem with offline shops
Posted: Sun Jul 29, 2012 9:01 pm
by Starter
I didnt read everything but basically the author wants a system where one can log a char, create an offline shop and relogin with another char of the same account huh?
Isnt this already shared here? I mean I think I found a basic system for it here long ago and fine-tuned it so it worked just fine or what kind of wheel has to be (re-)invented here?