Multi skills bug

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
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Multi skills bug

Post by Naonah »

Works fine (tested).

You forgot to import Thread.... :P

...so here corrected code:

Code: Select all

Index: java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java    (revision 4411)+++ java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java    (working copy)@@ -20,6 +20,7 @@  import com.l2jserver.Config; import com.l2jserver.gameserver.SevenSignsFestival;+import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.L2GameClient;@@ -30,7 +31,6 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager; - /**  * This class ...  *@@ -41,57 +41,57 @@     private static final String _C__46_REQUESTRESTART = "[C] 46 RequestRestart";     private static final Logger _log = Logger.getLogger(RequestRestart.class.getName());     protected static final Logger _logAccounting = Logger.getLogger("accounting");-+         @Override     protected void readImpl()     {         // trigger     }-+         @Override     protected void runImpl()     {         final L2PcInstance player = getClient().getActiveChar();-+                 if (player == null)             return;--        if(player.getActiveEnchantItem() != null || player.getActiveEnchantAttrItem() != null)+        +        if (player.getActiveEnchantItem() != null || player.getActiveEnchantAttrItem() != null)         {             sendPacket(RestartResponse.valueOf(false));             return;         }-+                 if (player.isLocked())         {             _log.warning("Player " + player.getName() + " tried to restart during class change.");             sendPacket(RestartResponse.valueOf(false));             return;         }-+                 if (player.getPrivateStoreType() != 0)         {             player.sendMessage("Cannot restart while trading");             sendPacket(RestartResponse.valueOf(false));             return;         }-+                 if (player.getActiveRequester() != null)         {             player.getActiveRequester().onTradeCancel(player);             player.onTradeCancel(player.getActiveRequester());         }-+                 if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING))         {             if (Config.DEBUG)                 _log.fine("Player " + player.getName() + " tried to logout while fighting.");-+                         player.sendPacket(new SystemMessage(SystemMessageId.CANT_RESTART_WHILE_FIGHTING));             sendPacket(RestartResponse.valueOf(false));             return;         }-+                 // Prevent player from restarting if they are a festival participant         // and it is in progress, otherwise notify party members that the player         // is not longer a participant.@@ -103,9 +103,9 @@                 sendPacket(RestartResponse.valueOf(false));                 return;             }-+                         final L2Party playerParty = player.getParty();-+                         if (playerParty != null)                 player.getParty().broadcastToPartyMembers(SystemMessage.sendString(player.getName() + " has been removed from the upcoming festival."));         }@@ -113,29 +113,37 @@         player.removeFromBossZone();                  final L2GameClient client = getClient();-+                 LogRecord record = new LogRecord(Level.INFO, "Logged out");-        record.setParameters(new Object[]{client});+        record.setParameters(new Object[] { client });         _logAccounting.log(record);--        // detach the client from the char so that the connection isnt closed in the deleteMe-        player.setClient(null);--        player.logout();         -        getClient().setActiveChar(null);--        // return the client to the authed status-        client.setState(GameClientState.AUTHED);--        sendPacket(RestartResponse.valueOf(true));--        // send char list-        final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1);-        sendPacket(cl);-        client.setCharSelection(cl.getCharInfo());+        ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()+        {+            +            @Override+            public void run()+            {+                // detach the client from the char so that the connection isnt closed in the deleteMe+                player.setClient(null);+                +                player.logout();+                +                getClient().setActiveChar(null);+                +                // return the client to the authed status+                client.setState(GameClientState.AUTHED);+                +                sendPacket(RestartResponse.valueOf(true));+                +                // send char list+                final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1);+                sendPacket(cl);+                client.setCharSelection(cl.getCharInfo());+            }+        }, 5000);     }-+         /* (non-Javadoc)      * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()      */@@ -144,4 +152,4 @@     {         return _C__46_REQUESTRESTART;     }-}\ No newline at end of file+} 
....but problem is not resolved.

These codes prevent you from restarting only so you can still exit without delay.

As topic owner wrote: this bug exists during exit, not relogging.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: Multi skills bug

Post by JIV »

dont do this, you could create exploit on your server. Also your revision 4411 is old, latest epilogue is 4413.
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Multi skills bug

Post by SolidSnake »

Naonah wrote:You forgot to import Thread.... :P
SolidSnake wrote:Add proper imports..
Thx for patch with imports :P

Anyway I made it only for Restart, but now you should just re-made it for Exit, too
Also you could create a new state (like isRestarting or isLeaving) and block any kind of exploitation

EDIT:
JIV wrote:Also your revision 4411 is old, latest epilogue is 4413.
http://trac.l2jserver.com/changeset/4412
http://trac.l2jserver.com/changeset/4413
Last edited by SolidSnake on Sat Sep 11, 2010 10:28 am, edited 1 time in total.
Image
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Multi skills bug

Post by SolidSnake »

Sorry for double posts, here a new patch

Code: Select all

Index: java/config/l2jmods.properties===================================================================--- java/config/l2jmods.properties   (revision 4413)+++ java/config/l2jmods.properties   (working copy)@@ -735,1 +735,46 @@# variables: $killer, $targetAnnouncePvpMsg = $killer has defeated $target-+-+# How many time the player must wait to exit server ?+# Default: 0+ExitDelay = 5000++# How many time the player must wait to restart client ?+# Default: 0+RestartDelay = 5000+# ---------------------------------------------------------------------------# Chat ModerationIndex: java/com/l2jserver/gameserver/network/clientpackets/Logout.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/Logout.java   (revision 4413)+++ java/com/l2jserver/gameserver/network/clientpackets/Logout.java   (working copy)@@ -22,1 +22,52 @@import java.util.logging.Logger; import com.l2jserver.Config;import com.l2jserver.gameserver.SevenSignsFestival;+import com.l2jserver.gameserver.ThreadPoolManager;import com.l2jserver.gameserver.model.L2Party;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;@@ -116,3 +116,30 @@        record.setParameters(new Object[]{this.getClient()});        _logAccounting.log(record);--       player.logout();++       int ExitDelay = (Config.EXIT_DELAY);+       ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()+       {+           @Override+           public void run()+           {+               player.logout();+           }+       }, ExitDelay);    }     /* (non-Javadoc)Index: java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java   (revision 4413)+++ java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java   (working copy)@@ -22,1 +22,52 @@import java.util.logging.Logger; import com.l2jserver.Config;import com.l2jserver.gameserver.SevenSignsFestival;+import com.l2jserver.gameserver.ThreadPoolManager;import com.l2jserver.gameserver.model.L2Party;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;@@ -120,3 +120,30 @@        record.setParameters(new Object[]{client});        _logAccounting.log(record);-++       int RestartDelay = (Config.RESTART_DELAY);+       ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()+       {+           @Override+           public void run()+           {+               // detach the client from the char so that the connection isnt closed in the deleteMe+               player.setClient(null);++               player.logout();+               +               getClient().setActiveChar(null);++               // return the client to the authed status+               client.setState(GameClientState.AUTHED);++               sendPacket(RestartResponse.valueOf(true));++               // send char list+               final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1);+               sendPacket(cl);+               client.setCharSelection(cl.getCharInfo());+           }+       }, RestartDelay);-       // detach the client from the char so that the connection isnt closed in the deleteMe-       player.setClient(null);--       player.logout();-       -       getClient().setActiveChar(null);--       // return the client to the authed status-       client.setState(GameClientState.AUTHED);--       sendPacket(RestartResponse.valueOf(true));--       // send char list-       final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1);-       sendPacket(cl);-       client.setCharSelection(cl.getCharInfo());    }     /* (non-Javadoc)Index: java/com/l2jserver/Config.java===================================================================--- java/com/l2jserver/Config.java   (revision 4413)+++ java/com/l2jserver/Config.java   (working copy)@@ -801,2 +801,40 @@    public static String ANNOUNCE_PK_MSG;    public static String ANNOUNCE_PVP_MSG;+   public static int EXIT_DELAY;+   public static int RESTART_DELAY;    public static boolean L2JMOD_CHAT_ADMIN;    public static boolean L2JMOD_MULTILANG_ENABLE;@@ -2957,6 +2957,102 @@                    ANNOUNCE_PVP_MSG = L2JModSettings.getProperty("AnnouncePvpMsg", "$killer has defeated $target");+                   +                   EXIT_DELAY = Integer.parseInt(L2JModSettings.getProperty("ExitDelay", "0"));+                   RESTART_DELAY = Integer.parseInt(L2JModSettings.getProperty("RestartDelay", "0"));                                        L2JMOD_CHAT_ADMIN = Boolean.parseBoolean(L2JModSettings.getProperty("ChatAdmin", "false"));                    
Imports added! BE WARNED: it isn't tested! Try it leaving server..

EDIT: Update 2 -> Added configs
EDIT: Update 3 -> Added ')' at Config.java lines (thx to angkor's report)
Last edited by SolidSnake on Mon Sep 13, 2010 11:19 am, edited 2 times in total.
Image
angkor
Posts: 99
Joined: Sat May 02, 2009 5:32 pm

Re: Multi skills bug

Post by angkor »

thx very match
I try last patch and answer in this topic.
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Multi skills bug

Post by SolidSnake »

Updated patch with config

I advice you to set restart and exit delay 1000 (1 second), so there aren't too many chances of exploitation

Also you should try to class the character in that second, so if the problem persists, I'll post a new patch with solution :D
Image
angkor
Posts: 99
Joined: Sat May 02, 2009 5:32 pm

Re: Multi skills bug

Post by angkor »

I test this patch
work fine

But if you have pressed restart and then any other action before exit game, at next start game you can't move.
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Multi skills bug

Post by SolidSnake »

Set 1000 (1 second) to limit every action during restart/exit, then when you return in game click on your stats' panel, so try to move your character..
Image
angkor
Posts: 99
Joined: Sat May 02, 2009 5:32 pm

Re: Multi skills bug

Post by angkor »

I set logout and restart 1 sec, but i do any action and dont move return in game, i click on my stats panel, bun dont move, i try scroll of escape and i move.
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Multi skills bug

Post by Naonah »

SolidSnake's patch is very good.

In my opinion it should be commited to l2jserver repo.

@angkor: use arrows on keyboard to move then use a mouse click normaly
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Multi skills bug

Post by SolidSnake »

It can be committed with a l2j core developer's revision :P
Image
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Multi skills bug

Post by Naonah »

SolidSnake wrote:It can be committed with a l2j core developer's revision :P
sry for off topic but their SVN is not a password protected? :D
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Multi skills bug

Post by SolidSnake »

Yes, but I mean that the patch could be committed with a code revision of a developer to make it better :)
Image
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Multi skills bug

Post by Naonah »

SolidSnake wrote:Yes, but I mean that the patch could be committed with a code revision of a developer to make it better :)
I meant the same :)
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Multi skills bug

Post by SolidSnake »

Naonah wrote:
SolidSnake wrote:It can be committed with a l2j core developer's revision :P
sry for off topic but their SVN is not a password protected? :D
I had understood that you had understood I meant revision (4416), not revised version of the code :mrgreen:
Image
Post Reply