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.
Olympiads Count down time for Restoring CP/HP/MP
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
-
- Posts: 2
- Joined: Thu Feb 24, 2011 10:27 am
- BiggBoss
- L2j Veteran
- Posts: 1104
- Joined: Wed Apr 15, 2009 3:11 pm
- Location: Spain
Re: Olympiads Count down time for Restoring CP/HP/MP
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();
-
- Posts: 2
- Joined: Thu Feb 24, 2011 10:27 am
Re: Olympiads Count down time for Restoring CP/HP/MP
Thank you very much BiggBoss!
Cheers.
Cheers.
- JIV
- 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
why not use threadpool? maybe its after appearance packet?
- BiggBoss
- L2j Veteran
- Posts: 1104
- Joined: Wed Apr 15, 2009 3:11 pm
- Location: Spain
Re: Olympiads Count down time for Restoring CP/HP/MP
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
- JIV
- 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
so you saying create whole new thread each port to arena is much more efficient for task which execution is 1ms?
- BiggBoss
- L2j Veteran
- Posts: 1104
- Joined: Wed Apr 15, 2009 3:11 pm
- Location: Spain
Re: Olympiads Count down time for Restoring CP/HP/MP
i never said anything about efficiency, but i dont see the point to let it sleep in the pool
- JIV
- 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
true, that would be bad of course but you can use in such case:
Code: Select all
com.l2jserver.gameserver.ThreadPoolManager.scheduleGeneral(Runnable, long)
- BiggBoss
- L2j Veteran
- Posts: 1104
- Joined: Wed Apr 15, 2009 3:11 pm
- Location: Spain
Re: Olympiads Count down time for Restoring CP/HP/MP
lol, i didnt mean to sleep the thread in the thread pool, but to pass the task to it