Olympiads Count down time for Restoring CP/HP/MP

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
Iruel
Posts: 2
Joined: Thu Feb 24, 2011 10:27 am

Olympiads Count down time for Restoring CP/HP/MP

Post by Iruel »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number: 4654
L2JDP Revision Number: 8046

Greetings,

I would gladly creat this topic on another section but I failed cause of my post number count. Anyway,

Once players get inside olympiads, they got 60 seconds to buff up and, at least on my l2j server version, I am having full CP/HP/MP restoration on the moment I port (60s) while it should only be restored, those status, at 50s. This is how retail olympiad restoration count down works. I do not intend to make a point on this, I just would like to have some information on how to get to that time. Any idea would be highly appreciated.
User avatar
BiggBoss
L2j Veteran
L2j Veteran
Posts: 1104
Joined: Wed Apr 15, 2009 3:11 pm
Location: Spain

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by BiggBoss »

remove restoration from teleport and scheduled it in 10 seconds

Code: Select all

 Index: java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java===================================================================--- java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java  (revision 4684)+++ java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java  (working copy)@@ -220,6 +220,10 @@            player.setCurrentHp(player.getMaxHp());            player.setCurrentMp(player.getMaxMp());            +           Thread restoreThread = new Thread(new RestoreStats(player));+           restoreThread.setPriority(7);+           restoreThread.start();+                       // Remove Summon's Buffs            final L2Summon summon = player.getPet();            if (summon != null)@@ -407,6 +411,36 @@            _log.log(Level.WARNING, e.getMessage(), e);        }    }+   +   private static class RestoreStats implements Runnable+   {+       private L2PcInstance _plr;+       +       private RestoreStats(L2PcInstance p)+       {+           _plr = p;+       }+       +       @Override+       public void run()+       {+           try+           {+               Thread.sleep(10000);+           }+           catch(InterruptedException ie)+           {+               ie.printStackTrace();+           }+           +           if(_plr.isInOlympiadMode())+           {+               _plr.setCurrentCp(_plr.getMaxCp());+               _plr.setCurrentHp(_plr.getMaxHp());+               _plr.setCurrentMp(_plr.getMaxMp());+           }+       }+   }     public abstract CompetitionType getType();  
Iruel
Posts: 2
Joined: Thu Feb 24, 2011 10:27 am

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by Iruel »

Thank you very much BiggBoss!

Cheers.
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by JIV »

why not use threadpool? maybe its after appearance packet?
User avatar
BiggBoss
L2j Veteran
L2j Veteran
Posts: 1104
Joined: Wed Apr 15, 2009 3:11 pm
Location: Spain

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by BiggBoss »

its a trivial task (also, the restoration could be done in catch clause to ensure its done), so i though not to pass it to the threadpool
Image
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by JIV »

so you saying create whole new thread each port to arena is much more efficient for task which execution is 1ms?
User avatar
BiggBoss
L2j Veteran
L2j Veteran
Posts: 1104
Joined: Wed Apr 15, 2009 3:11 pm
Location: Spain

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by BiggBoss »

i never said anything about efficiency, but i dont see the point to let it sleep in the pool
Image
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by JIV »

true, that would be bad of course but you can use in such case:

Code: Select all

com.l2jserver.gameserver.ThreadPoolManager.scheduleGeneral(Runnable, long)
User avatar
BiggBoss
L2j Veteran
L2j Veteran
Posts: 1104
Joined: Wed Apr 15, 2009 3:11 pm
Location: Spain

Re: Olympiads Count down time for Restoring CP/HP/MP

Post by BiggBoss »

lol, i didnt mean to sleep the thread in the thread pool, but to pass the task to it
Image
Post Reply