Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Server
- Index: java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java (revision 5563)
- +++ java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java (working copy)
- @@ -100,7 +100,10 @@
- _time = time;
- _size = size;
- _effect = showEffect;
- - _npcString = npcString.getId();
- + if (npcString != null)
- + _npcString = npcString.getId();
- + else
- + _npcString = -1;
- }
- /**
- Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5563)
- +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -222,6 +222,7 @@
- import com.l2jserver.gameserver.network.serverpackets.ExOlympiadMode;
- import com.l2jserver.gameserver.network.serverpackets.ExPrivateStoreSetWholeMsg;
- import com.l2jserver.gameserver.network.serverpackets.ExSetCompassZoneCode;
- +import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
- import com.l2jserver.gameserver.network.serverpackets.ExSpawnEmitter;
- import com.l2jserver.gameserver.network.serverpackets.ExStartScenePlayer;
- import com.l2jserver.gameserver.network.serverpackets.ExStorageMaxCount;
- @@ -15471,4 +15472,95 @@
- {
- globalProfessionChangeListeners.remove(listener);
- }
- +
- + long timeForCountDown = 0;
- + ScheduledFuture<?> countDown = null;
- +
- + public enum Position {
- + None,
- + UpperLeft,
- + UpperCenter,
- + UpperRight,
- + MiddleLeft,
- + MiddleCenter,
- + MiddleRight,
- + LowerCenter,
- + LowerRight;
- + }
- + /**
- + * text can be replaced with %s (seconds), %S (seconds, with zero in the front if lower than 9), %m (minutes), %M (minutes, with zero in the front if lower than 9), %h (hours), %H (hours, with zero in the front if lower than 9)
- + * @param time
- + * @param text
- + * @param position
- + * @param textIsSmall
- + */
- + public void startCountDown(long time, String text, Position position, boolean textIsSmall) {
- + stopCountDown();
- + timeForCountDown = time;
- + long seconds = timeForCountDown % 60;
- + long minutes = timeForCountDown / 60 % 60;
- + long hours = timeForCountDown / 60 / 60 % 24;
- + String replacedText = text;
- + if (text.contains("%s"))
- + replacedText = replacedText.replace("%s", seconds + "");
- + if (text.contains("%S"))
- + replacedText = replacedText.replace("%S", seconds > 9 ? seconds + "" : "0" + seconds);
- + if (text.contains("%m"))
- + replacedText = replacedText.replace("%m", minutes + "");
- + if (text.contains("%M"))
- + replacedText = replacedText.replace("%M", minutes > 9 ? minutes + "" : "0" + minutes);
- + if (text.contains("%h"))
- + replacedText = replacedText.replace("%h", hours + "");
- + if (text.contains("%H"))
- + replacedText = replacedText.replace("%H", hours > 9 ? hours + "" : "0" + hours);
- + sendPacket(new ExShowScreenMessage(1, 0, position.ordinal(), 0, (textIsSmall ? 1 : 0), 0, 0, false, 1000, true, replacedText, null));
- + timeForCountDown--;
- + countDown = ThreadPoolManager.getInstance().scheduleGeneral(new CountDown(this, text, position.ordinal(), (textIsSmall ? 1 : 0)), 1000);
- + }
- +
- + class CountDown implements Runnable {
- + L2PcInstance player;
- + String text;
- + int position;
- + int textIsSmall;
- + public CountDown(L2PcInstance _player, String _text, int _position, int _textIsSmall) {
- + player = _player;
- + text = _text;
- + position = _position;
- + textIsSmall = _textIsSmall;
- + }
- +
- + @Override
- + public void run() {
- + if (player == null || timeForCountDown <= 0) {
- + return;
- + }
- + long seconds = timeForCountDown % 60;
- + long minutes = timeForCountDown / 60 % 60;
- + long hours = timeForCountDown / 60 / 60 % 24;
- + String replacedText = text;
- + if (text.contains("%s"))
- + replacedText = replacedText.replace("%s", seconds + "");
- + if (text.contains("%S"))
- + replacedText = replacedText.replace("%S", seconds > 9 ? seconds + "" : "0" + seconds);
- + if (text.contains("%m"))
- + replacedText = replacedText.replace("%m", minutes + "");
- + if (text.contains("%M"))
- + replacedText = replacedText.replace("%M", minutes > 9 ? minutes + "" : "0" + minutes);
- + if (text.contains("%h"))
- + replacedText = replacedText.replace("%h", hours + "");
- + if (text.contains("%H"))
- + replacedText = replacedText.replace("%H", hours > 9 ? hours + "" : "0" + hours);
- + player.sendPacket(new ExShowScreenMessage(1, 0, position, 0, textIsSmall, 0, 0, false, 1000, true, replacedText, null));
- + timeForCountDown--;
- + countDown = ThreadPoolManager.getInstance().scheduleGeneral(new CountDown(player, text, position, textIsSmall), 1000);
- + }
- + }
- +
- + public void stopCountDown() {
- + timeForCountDown = 0;
- + if (countDown != null)
- + countDown.cancel(true);
- + countDown = null;
- + }
- }
- \ No newline at end of file
- #P L2J_DataPack
- Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminTest.java
- ===================================================================
- --- dist/game/data/scripts/handlers/admincommandhandlers/AdminTest.java (revision 9067)
- +++ dist/game/data/scripts/handlers/admincommandhandlers/AdminTest.java (working copy)
- @@ -24,6 +24,7 @@
- import com.l2jserver.gameserver.model.L2Object;
- import com.l2jserver.gameserver.model.actor.L2Character;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.Position;
- import com.l2jserver.gameserver.model.skills.L2Skill;
- import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
- @@ -36,7 +37,8 @@
- {
- "admin_stats",
- "admin_skill_test",
- - "admin_known"
- + "admin_known",
- + "admin_test_countdown"
- };
- @Override
- @@ -82,6 +84,14 @@
- {
- Config.CHECK_KNOWN = false;
- }
- + else if (command.toLowerCase().startsWith("admin_test_countdown")) {
- + int start = 0;
- + start = command.length() > 20 ? Integer.parseInt(command.substring(21)) : 1;
- + if (start == 1)
- + activeChar.startCountDown(35, "The test Count Down is turned on for %s seconds!", Position.MiddleCenter, false);
- + else
- + activeChar.stopCountDown();
- + }
- return true;
- }
- Index: dist/game/config/adminCommands.xml
- ===================================================================
- --- dist/game/config/adminCommands.xml (revision 9067)
- +++ dist/game/config/adminCommands.xml (working copy)
- @@ -602,6 +602,7 @@
- <admin command="admin_stats" accessLevel="7" />
- <admin command="admin_skill_test" accessLevel="7" />
- <admin command="admin_known" accessLevel="7" />
- + <admin command="admin_test_countdown" accessLevel="7" />
- <!-- ADMIN TVT EVENT -->
- <admin command="admin_tvt_add" accessLevel="7" />
Advertisement
Add Comment
Please, Sign In to add comment