Problem with offline shops

Support for the latest build of L2J Server, get help here, installations, upgrades, problems. Do not post bugs reports here, use the ticket system 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

Re: Problem with offline shops

Postby jurchiks » Thu Jul 26, 2012 11:15 am

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:
  1. "SELECT charId FROM characters WHERE `account_name`= " + _user;

then loop over the resultset:
  1. L2World w = L2World.getInstance();
  2. L2PcInstance tmp;
  3. while (rset.next())
  4. {
  5.     tmp = w.getPlayer(rset.getInt("charId"));
  6.     if ((tmp != null) && !tmp.getClient().isDetached())
  7.     {
  8.         tmp.logout();
  9.     }
  10. }


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

Re: Problem with offline shops

Postby vampir » Thu Jul 26, 2012 11:31 am

better
  1. "SELECT charId FROM characters WHERE `account_name`= " + _user+" AND `online`=1";


It will work well i think, just need test :)
vampir
 
Posts: 86
Joined: Sun Mar 28, 2010 7:17 pm

Re: Problem with offline shops

Postby jurchiks » Thu Jul 26, 2012 12:19 pm

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

Re: Problem with offline shops

Postby Villy90 » Thu Jul 26, 2012 1:01 pm

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 12:40 pm

Re: Problem with offline shops

Postby Villy90 » Thu Jul 26, 2012 1:07 pm

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.
Villy90
 
Posts: 26
Joined: Fri Jul 29, 2011 12:40 pm

Re: Problem with offline shops

Postby jurchiks » Thu Jul 26, 2012 1:51 pm

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

Re: Problem with offline shops

Postby Villy90 » Thu Jul 26, 2012 2:25 pm

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 12:40 pm

Re: Problem with offline shops

Postby Villy90 » Sat Jul 28, 2012 10:04 pm

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."
Villy90
 
Posts: 26
Joined: Fri Jul 29, 2011 12:40 pm

Re: Problem with offline shops

Postby jurchiks » Sat Jul 28, 2012 10:19 pm

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

Re: Problem with offline shops

Postby Starter » Sun Jul 29, 2012 10:01 pm

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.
Starter
 
Posts: 491
Joined: Sat Jan 23, 2010 5:42 pm

Previous

Return to High Five Server Support

Who is online

Users browsing this forum: Google [Bot] and 1 guest