Problem with offline shops

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
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Problem with offline shops

Post 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.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
vampir
Posts: 113
Joined: Sun Mar 28, 2010 6:17 pm

Re: Problem with offline shops

Post 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 :)
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Problem with offline shops

Post by jurchiks »

I'm not sure online=1 for offline shops.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Villy90
Posts: 26
Joined: Fri Jul 29, 2011 11:40 am

Re: Problem with offline shops

Post 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 :D
I will spend all day just want to make this work :twisted:
Villy90
Posts: 26
Joined: Fri Jul 29, 2011 11:40 am

Re: Problem with offline shops

Post by Villy90 »

Update !!!!

Ignore what i posted above it took a few seconds to change the status of offline shop in character db table :mrgreen:

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.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Problem with offline shops

Post 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.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Villy90
Posts: 26
Joined: Fri Jul 29, 2011 11:40 am

Re: Problem with offline shops

Post 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 :D
Villy90
Posts: 26
Joined: Fri Jul 29, 2011 11:40 am

Re: Problem with offline shops

Post 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."
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Problem with offline shops

Post by jurchiks »

yeah, that part was left intact in both of our patches.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: Problem with offline shops

Post 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?
I have promises to keep and miles to go before I sleep.
Post Reply