diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java
index 4736bff5de..413ea22833 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java
@@ -84,9 +84,11 @@ import handlers.admincommandhandlers.AdminFortSiege;
import handlers.admincommandhandlers.AdminGeodata;
import handlers.admincommandhandlers.AdminGm;
import handlers.admincommandhandlers.AdminGmChat;
+import handlers.admincommandhandlers.AdminGmSpeed;
import handlers.admincommandhandlers.AdminGraciaSeeds;
import handlers.admincommandhandlers.AdminGrandBoss;
import handlers.admincommandhandlers.AdminHeal;
+import handlers.admincommandhandlers.AdminHide;
import handlers.admincommandhandlers.AdminHtml;
import handlers.admincommandhandlers.AdminHwid;
import handlers.admincommandhandlers.AdminInstance;
@@ -126,6 +128,7 @@ import handlers.admincommandhandlers.AdminShutdown;
import handlers.admincommandhandlers.AdminSkill;
import handlers.admincommandhandlers.AdminSpawn;
import handlers.admincommandhandlers.AdminSummon;
+import handlers.admincommandhandlers.AdminSuperHaste;
import handlers.admincommandhandlers.AdminTarget;
import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
@@ -414,9 +417,11 @@ public class MasterHandler
AdminGeodata.class,
AdminGm.class,
AdminGmChat.class,
+ AdminGmSpeed.class,
AdminGraciaSeeds.class,
AdminGrandBoss.class,
AdminHeal.class,
+ AdminHide.class,
AdminHtml.class,
AdminHwid.class,
AdminInstance.class,
@@ -456,6 +461,7 @@ public class MasterHandler
AdminSkill.class,
AdminSpawn.class,
AdminSummon.class,
+ AdminSuperHaste.class,
AdminTarget.class,
AdminTargetSay.class,
AdminTeleport.class,
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
index 6b1bb7ac43..72c01c3cf8 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
@@ -19,7 +19,6 @@ package handlers.actionshifthandlers;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IActionShiftHandler;
-import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -37,11 +36,7 @@ public class L2PcInstanceActionShift implements IActionShiftHandler
activeChar.setTarget(target);
}
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_character_info");
- if (ach != null)
- {
- ach.useAdminCommand("admin_character_info " + target.getName(), activeChar);
- }
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_character_info " + target.getName(), true);
}
return true;
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
index 67d403c9b3..6ee8a1173e 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
@@ -19,7 +19,6 @@ package handlers.actionshifthandlers;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IActionShiftHandler;
-import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -36,11 +35,7 @@ public class L2SummonActionShift implements IActionShiftHandler
activeChar.setTarget(target);
}
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_summon_info");
- if (ach != null)
- {
- ach.useAdminCommand("admin_summon_info", activeChar);
- }
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_summon_info", true);
}
return true;
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
index 6c2b00db74..467875568d 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
@@ -19,7 +19,6 @@ package handlers.admincommandhandlers;
import java.util.Arrays;
import java.util.StringTokenizer;
-import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
@@ -34,7 +33,6 @@ import com.l2jmobius.gameserver.model.html.PageBuilder;
import com.l2jmobius.gameserver.model.html.PageResult;
import com.l2jmobius.gameserver.model.html.styles.ButtonsStyle;
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
-import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.Earthquake;
import com.l2jmobius.gameserver.network.serverpackets.ExRedSky;
@@ -81,8 +79,6 @@ public class AdminEffects implements IAdminCommandHandler
"admin_earthquake_menu",
"admin_bighead",
"admin_shrinkhead",
- "admin_gmspeed",
- "admin_gmspeed_menu",
"admin_unpara_all",
"admin_para_all",
"admin_unpara",
@@ -351,35 +347,6 @@ public class AdminEffects implements IAdminCommandHandler
{
}
}
- else if (command.startsWith("admin_gmspeed"))
- {
- try
- {
- final int val = Integer.parseInt(st.nextToken());
- final boolean sendMessage = activeChar.isAffectedBySkill(7029);
- activeChar.stopSkillEffects((val == 0) && sendMessage, 7029);
- if ((val >= 1) && (val <= 4))
- {
- int time = 0;
- if (st.hasMoreTokens())
- {
- time = Integer.parseInt(st.nextToken());
- }
-
- final Skill gmSpeedSkill = SkillData.getInstance().getSkill(7029, val);
- gmSpeedSkill.applyEffects(activeChar, activeChar, true, time);
- }
- }
- catch (Exception e)
- {
- activeChar.sendMessage("Usage: //gmspeed ");
- }
- if (command.contains("_menu"))
- {
- command = "";
- AdminHtml.showAdminHtml(activeChar, "gm_menu.htm");
- }
- }
else if (command.startsWith("admin_polyself"))
{
try
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java
new file mode 100644
index 0000000000..5ab5f39a9b
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import com.l2jmobius.Config;
+import com.l2jmobius.gameserver.handler.AdminCommandHandler;
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.L2Object;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.stats.Stats;
+import com.l2jmobius.gameserver.util.BuilderUtil;
+import com.l2jmobius.gameserver.util.Util;
+
+/**
+ * A retail-like implementation of //gmspeed builder command.
+ * @author lord_rex
+ */
+public final class AdminGmSpeed implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_gmspeed",
+ };
+
+ private static final Set SPEED_STATS = EnumSet.of(Stats.RUN_SPEED, Stats.WALK_SPEED, Stats.SWIM_RUN_SPEED, Stats.SWIM_WALK_SPEED, Stats.FLY_RUN_SPEED, Stats.FLY_WALK_SPEED);
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ final String cmd = st.nextToken();
+
+ if (cmd.equals("admin_gmspeed"))
+ {
+ if (!st.hasMoreTokens())
+ {
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+ final String token = st.nextToken();
+
+ // Rollback feature for old custom way, in order to make everyone happy.
+ if (Config.USE_SUPER_HASTE_AS_GM_SPEED)
+ {
+ AdminCommandHandler.getInstance().useAdminCommand(player, AdminSuperHaste.ADMIN_COMMANDS[0] + " " + token, false);
+ return true;
+ }
+
+ if (!Util.isDouble(token))
+ {
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+ final double runSpeedBoost = Double.parseDouble(token);
+ if ((runSpeedBoost < 0) || (runSpeedBoost > 10))
+ {
+ // Custom limit according to SDW's request - real retail limit is unknown.
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+
+ final L2Character targetCharacter;
+ final L2Object target = player.getTarget();
+ if ((target != null) && target.isCharacter())
+ {
+ targetCharacter = (L2Character) target;
+ }
+ else
+ {
+ // If there is no target, let's use the command executer.
+ targetCharacter = player;
+ }
+
+ SPEED_STATS.forEach(speedStat -> targetCharacter.getStat().removeFixedValue(speedStat));
+ if (runSpeedBoost > 0)
+ {
+ SPEED_STATS.forEach(speedStat -> targetCharacter.getStat().addFixedValue(speedStat, targetCharacter.getTemplate().getBaseValue(speedStat, 120) * runSpeedBoost));
+ }
+
+ targetCharacter.getStat().recalculateStats(false);
+ if (targetCharacter.isPlayer())
+ {
+ ((L2PcInstance) targetCharacter).broadcastUserInfo();
+ }
+ else
+ {
+ targetCharacter.broadcastInfo();
+ }
+
+ BuilderUtil.sendSysMessage(player, "[" + targetCharacter.getName() + "] speed is [" + (runSpeedBoost * 100) + "0]% fast.");
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java
new file mode 100644
index 0000000000..600cbe1639
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.util.BuilderUtil;
+
+/**
+ * @author lord_rex
+ */
+public final class AdminHide implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_hide"
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ st.nextToken();
+
+ try
+ {
+ final String param = st.nextToken();
+ switch (param)
+ {
+ case "on":
+ {
+ if (!BuilderUtil.setHiding(player, true))
+ {
+ BuilderUtil.sendSysMessage(player, "Currently, you cannot be seen.");
+ return true;
+ }
+
+ BuilderUtil.sendSysMessage(player, "Now, you cannot be seen.");
+ return true;
+ }
+ case "off":
+ {
+ if (!BuilderUtil.setHiding(player, false))
+ {
+ BuilderUtil.sendSysMessage(player, "Currently, you can be seen.");
+ return true;
+ }
+
+ BuilderUtil.sendSysMessage(player, "Now, you can be seen.");
+ return true;
+ }
+ default:
+ {
+ BuilderUtil.sendSysMessage(player, "//hide [on|off]");
+ return true;
+ }
+ }
+ }
+ catch (final Exception e)
+ {
+ BuilderUtil.sendSysMessage(player, "//hide [on|off]");
+ return true;
+ }
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
index 5ab19d4b39..8c735f4265 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
@@ -21,7 +21,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Clan;
@@ -187,14 +186,7 @@ public class AdminMenu implements IAdminCommandHandler
if (st.countTokens() > 1)
{
final String subCommand = "admin_ban_char";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + command.substring(14), activeChar);
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + command.substring(14), true);
}
showMainPage(activeChar);
}
@@ -204,14 +196,7 @@ public class AdminMenu implements IAdminCommandHandler
if (st.countTokens() > 1)
{
final String subCommand = "admin_unban_char";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + command.substring(16), activeChar);
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + command.substring(16), true);
}
showMainPage(activeChar);
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
index a818e7f3d3..f27d63e949 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
@@ -16,9 +16,6 @@
*/
package handlers.admincommandhandlers;
-import java.util.logging.Logger;
-
-import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -28,8 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
*/
public class AdminSummon implements IAdminCommandHandler
{
- private static final Logger LOGGER = Logger.getLogger(AdminSummon.class.getName());
-
public static final String[] ADMIN_COMMANDS =
{
"admin_summon"
@@ -62,34 +57,24 @@ public class AdminSummon implements IAdminCommandHandler
return false;
}
- String subCommand;
+ final String subCommand;
if (id < 1000000)
{
subCommand = "admin_create_item";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
}
else
{
subCommand = "admin_spawn_once";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
activeChar.sendMessage("This is only a temporary spawn. The mob(s) will NOT respawn.");
id -= 1000000;
- ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
}
+
+ if ((id > 0) && (count > 0))
+ {
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + " " + id + " " + count, true);
+ }
+
return true;
}
}
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java
new file mode 100644
index 0000000000..4a3eb0c809
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java
@@ -0,0 +1,92 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.skills.Skill;
+
+/**
+ * The classical custom L2J implementation of the old //gmspeed GM command.
+ * @author lord_rex (No, it wasn't me at all. Eclipse added my name there.)
+ */
+public final class AdminSuperHaste implements IAdminCommandHandler
+{
+ public static final String[] ADMIN_COMMANDS =
+ {
+ "admin_superhaste",
+ "admin_superhaste_menu",
+ "admin_speed",
+ "admin_speed_menu",
+ };
+
+ private static final int SUPER_HASTE_ID = 7029;
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ final String cmd = st.nextToken();
+ switch (cmd)
+ {
+ case "admin_superhaste":
+ case "admin_speed":
+ {
+ try
+ {
+ final int val = Integer.parseInt(st.nextToken());
+ final boolean sendMessage = player.isAffectedBySkill(SUPER_HASTE_ID);
+ player.stopSkillEffects((val == 0) && sendMessage, SUPER_HASTE_ID);
+ if ((val >= 1) && (val <= 4))
+ {
+ int time = 0;
+ if (st.hasMoreTokens())
+ {
+ time = Integer.parseInt(st.nextToken());
+ }
+
+ final Skill superHasteSkill = SkillData.getInstance().getSkill(SUPER_HASTE_ID, val);
+ superHasteSkill.applyEffects(player, player, true, time);
+ }
+ }
+ catch (final Exception e)
+ {
+ player.sendMessage("Usage: //superhaste ");
+ }
+
+ break;
+ }
+ case "admin_superhaste_menu":
+ case "admin_speed_menu":
+ {
+ AdminHtml.showAdminHtml(player, "gm_menu.htm");
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java
index 436c7acaef..695c880245 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/Config.java
@@ -400,6 +400,7 @@ public final class Config
public static int DEFAULT_ACCESS_LEVEL;
public static boolean SERVER_GMONLY;
public static boolean GM_HERO_AURA;
+ public static boolean GM_STARTUP_BUILDER_HIDE;
public static boolean GM_STARTUP_INVULNERABLE;
public static boolean GM_STARTUP_INVISIBLE;
public static boolean GM_STARTUP_SILENCE;
@@ -413,6 +414,7 @@ public final class Config
public static boolean GM_CRITANNOUNCER_NAME;
public static boolean GM_GIVE_SPECIAL_SKILLS;
public static boolean GM_GIVE_SPECIAL_AURA_SKILLS;
+ public static boolean USE_SUPER_HASTE_AS_GM_SPEED;
public static boolean GAMEGUARD_ENFORCE;
public static boolean GAMEGUARD_PROHIBITACTION;
public static boolean LOG_CHAT;
@@ -1814,6 +1816,7 @@ public final class Config
DEFAULT_ACCESS_LEVEL = General.getInt("DefaultAccessLevel", 0);
SERVER_GMONLY = General.getBoolean("ServerGMOnly", false);
GM_HERO_AURA = General.getBoolean("GMHeroAura", false);
+ GM_STARTUP_BUILDER_HIDE = General.getBoolean("GMStartupBuilderHide", false);
GM_STARTUP_INVULNERABLE = General.getBoolean("GMStartupInvulnerable", false);
GM_STARTUP_INVISIBLE = General.getBoolean("GMStartupInvisible", false);
GM_STARTUP_SILENCE = General.getBoolean("GMStartupSilence", false);
@@ -1827,6 +1830,7 @@ public final class Config
GM_CRITANNOUNCER_NAME = General.getBoolean("GMShowCritAnnouncerName", false);
GM_GIVE_SPECIAL_SKILLS = General.getBoolean("GMGiveSpecialSkills", false);
GM_GIVE_SPECIAL_AURA_SKILLS = General.getBoolean("GMGiveSpecialAuraSkills", false);
+ USE_SUPER_HASTE_AS_GM_SPEED = General.getBoolean("UseSuperHasteAsGMSpeed", false);
GAMEGUARD_ENFORCE = General.getBoolean("GameGuardEnforce", false);
GAMEGUARD_PROHIBITACTION = General.getBoolean("GameGuardProhibitAction", false);
LOG_CHAT = General.getBoolean("LogChat", false);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
index adf6462b78..c4faf3bd6d 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
@@ -18,12 +18,26 @@ package com.l2jmobius.gameserver.handler;
import java.util.HashMap;
import java.util.Map;
+import java.util.logging.Logger;
+
+import com.l2jmobius.Config;
+import com.l2jmobius.commons.concurrent.ThreadPool;
+import com.l2jmobius.gameserver.data.xml.impl.AdminData;
+import com.l2jmobius.gameserver.enums.PlayerAction;
+import com.l2jmobius.gameserver.model.L2Object;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.network.SystemMessageId;
+import com.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
+import com.l2jmobius.gameserver.util.GMAudit;
+import com.l2jmobius.gameserver.util.TimeAmountInterpreter;
/**
* @author UnAfraid
*/
public class AdminCommandHandler implements IHandler
{
+ private static final Logger LOGGER = Logger.getLogger(AdminCommandHandler.class.getName());
+
private final Map _datatable;
protected AdminCommandHandler()
@@ -49,10 +63,85 @@ public class AdminCommandHandler implements IHandler
+ {
+ final long begin = System.currentTimeMillis();
+ try
+ {
+ if (Config.GMAUDIT)
+ {
+ final L2Object target = player.getTarget();
+ GMAudit.auditGMAction(player.getName() + " [" + player.getObjectId() + "]", fullCommand, (target != null ? target.getName() : "no-target"));
+ }
+
+ handler.useAdminCommand(fullCommand, player);
+ }
+ catch (RuntimeException e)
+ {
+ player.sendMessage("Exception during execution of '" + fullCommand + "': " + e.toString());
+ LOGGER.warning("Exception during execution of " + fullCommand + " " + e);
+ }
+ finally
+ {
+ final long runtime = System.currentTimeMillis() - begin;
+
+ if (runtime < 5000)
+ {
+ return;
+ }
+
+ player.sendMessage("The execution of '" + fullCommand + "' took " + TimeAmountInterpreter.consolidateMillis(runtime) + ".");
+ }
+ });
+ }
}
@Override
@@ -63,11 +152,11 @@ public class AdminCommandHandler implements IHandler.
+ */
+package com.l2jmobius.gameserver.util;
+
+import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
+import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoAbnormalVisualEffect;
+
+/**
+ * @author lord_rex
+ */
+public final class BuilderUtil
+{
+ private BuilderUtil()
+ {
+ // utility class
+ }
+
+ /**
+ * Sends builder system message to the player.
+ * @param player
+ * @param message
+ */
+ public static void sendSysMessage(L2PcInstance player, String message)
+ {
+ player.sendPacket(new CreatureSay(0, ChatType.GENERAL, "SYS", message));
+ }
+
+ /**
+ * Changes player's hiding state.
+ * @param player
+ * @param hide
+ * @return {@code true} if hide state was changed, otherwise {@code false}
+ */
+ public static boolean setHiding(L2PcInstance player, boolean hide)
+ {
+ if (player.isInvisible() && hide)
+ {
+ // already hiding
+ return false;
+ }
+
+ if (!player.isInvisible() && !hide)
+ {
+ // already visible
+ return false;
+ }
+
+ player.setSilenceMode(hide);
+ player.setIsInvul(hide);
+ player.setInvisible(hide);
+
+ player.broadcastUserInfo();
+ player.sendPacket(new ExUserInfoAbnormalVisualEffect(player));
+ return true;
+ }
+}
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java
new file mode 100644
index 0000000000..a9f8029b98
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 1999 CERN - European Organization for Nuclear Research.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation. CERN makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without expressed or implied warranty.
+ */
+package com.l2jmobius.gameserver.util;
+
+import static java.util.concurrent.TimeUnit.DAYS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+import java.io.IOException;
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Allows to present time intervals in a standardized, user friendly manner.
+ * @author _dev_
+ */
+public class TimeAmountInterpreter
+{
+ private static final TimeUnit[] UNIT_CACHE = TimeUnit.values();
+
+ private TimeAmountInterpreter()
+ {
+ // utility class
+ }
+
+ /**
+ * Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#NANOSECONDS}.
+ * @param timeAmountInNanos amount of time in nanoseconds
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidateNanos(long timeAmountInNanos)
+ {
+ return consolidate(timeAmountInNanos, NANOSECONDS);
+ }
+
+ /**
+ * Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#MILLISECONDS}.
+ * @param timeAmountInMillis amount of time in milliseconds
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidateMillis(long timeAmountInMillis)
+ {
+ return consolidate(timeAmountInMillis, MILLISECONDS);
+ }
+
+ /**
+ * Constructs an user-friendly description of the given amount of time, specifying the number of days (if any), hours (if any), minutes (if any), seconds (if any) and milliseconds (if any). Otherwise, returns the string value {@code 0}.
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidate(long timeAmount, TimeUnit timeUnit)
+ {
+ return consolidate(timeAmount, timeUnit, timeUnit, DAYS, "0 " + timeUnit.name().toLowerCase(Locale.ENGLISH));
+ }
+
+ /**
+ * Constructs an user-friendly description of the given amount of time.
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @param minConsolidationUnit smallest unit to be included within the description
+ * @param maxConsolidationUnit largest unit to be included within the description
+ * @param noTimeUsedIndicator text to be written if the amount is not positive
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidate(long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator)
+ {
+ return appendConsolidated(new StringBuilder(), timeAmount, timeUnit, minConsolidationUnit, maxConsolidationUnit, noTimeUsedIndicator).toString();
+ }
+
+ /**
+ * Appends an user-friendly description of the given amount of time to the specified text builder.
+ *
+ * Please keep in mind, that this method is primarily designed to be used with heap text builders. Therefore, if the given text builder throws an {@link IOException}, this exception will be wrapped in a {@link RuntimeException} and returned to the caller as an unchecked exception.
+ * @param
+ * @param textBuilder a character sequence builder
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @param minConsolidationUnit smallest unit to be included within the description
+ * @param maxConsolidationUnit largest unit to be included within the description
+ * @param noTimeUsedIndicator text to be written if the amount is not positive
+ * @return {@code textBuilder}
+ * @throws RuntimeException if {@code textBuilder} throws an {@link IOException}
+ */
+ @SuppressWarnings("unchecked")
+ public static T appendConsolidated(T textBuilder, long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator) throws RuntimeException
+ {
+ try
+ {
+ if (timeAmount < 1)
+ {
+ return (T) textBuilder.append(noTimeUsedIndicator);
+ }
+
+ final int len = textBuilder.length();
+ for (int i = maxConsolidationUnit.ordinal(); i >= minConsolidationUnit.ordinal(); --i)
+ {
+ final TimeUnit activeUnit = UNIT_CACHE[i];
+ final long num = activeUnit.convert(timeAmount, timeUnit);
+ if (num == 0)
+ {
+ continue;
+ }
+
+ if (textBuilder.length() > len)
+ {
+ textBuilder.append(", ");
+ }
+ textBuilder.append(String.valueOf(num)).append(' ');
+ final String unit = activeUnit.name().toLowerCase(Locale.ENGLISH);
+ textBuilder.append(unit, 0, num == 1 ? unit.length() - 1 : unit.length());
+
+ timeAmount -= timeUnit.convert(num, activeUnit);
+ }
+
+ if (textBuilder.length() == len)
+ {
+ return (T) textBuilder.append(noTimeUsedIndicator).append(' ').append(minConsolidationUnit.name().toLowerCase(Locale.ENGLISH));
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return textBuilder;
+ }
+}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/AdminCommands.xml b/L2J_Mobius_3.0_Helios/dist/game/config/AdminCommands.xml
index 14882ea07a..8b4096bd34 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/config/AdminCommands.xml
@@ -158,8 +158,6 @@
-
-
@@ -189,6 +187,13 @@
+
+
+
+
+
+
+
@@ -615,4 +620,7 @@
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/General.ini b/L2J_Mobius_3.0_Helios/dist/game/config/General.ini
index 832fb08b17..106b6e6078 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/config/General.ini
+++ b/L2J_Mobius_3.0_Helios/dist/game/config/General.ini
@@ -25,6 +25,10 @@ ServerGMOnly = False
# Default: False
GMHeroAura = False
+# Whether GM logins in builder hide mode by default.
+# Default: True
+GMStartupBuilderHide = True
+
# Auto set invulnerable status to a GM on login.
# Default: False
GMStartupInvulnerable = True
@@ -79,6 +83,11 @@ GMGiveSpecialSkills = False
# Default: False
GMGiveSpecialAuraSkills = False
+# In case you are not satisfied with the retail-like implementation of //gmspeed",
+# with this config you can rollback it to the old custom L2J version of the GM Speed.
+# Default: False
+UseSuperHasteAsGMSpeed = False
+
# ---------------------------------------------------------------------------
# Server Security
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/html/admin/gm_menu.htm b/L2J_Mobius_3.0_Helios/dist/game/data/html/admin/gm_menu.htm
index ffe3e3d025..5a8f77eaba 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/html/admin/gm_menu.htm
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/html/admin/gm_menu.htm
@@ -38,11 +38,11 @@
Super Haste:
-
-
-
-
-
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java
index 8ff587ff17..fa9c716767 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java
@@ -84,9 +84,11 @@ import handlers.admincommandhandlers.AdminFortSiege;
import handlers.admincommandhandlers.AdminGeodata;
import handlers.admincommandhandlers.AdminGm;
import handlers.admincommandhandlers.AdminGmChat;
+import handlers.admincommandhandlers.AdminGmSpeed;
import handlers.admincommandhandlers.AdminGraciaSeeds;
import handlers.admincommandhandlers.AdminGrandBoss;
import handlers.admincommandhandlers.AdminHeal;
+import handlers.admincommandhandlers.AdminHide;
import handlers.admincommandhandlers.AdminHtml;
import handlers.admincommandhandlers.AdminHwid;
import handlers.admincommandhandlers.AdminInstance;
@@ -126,6 +128,7 @@ import handlers.admincommandhandlers.AdminShutdown;
import handlers.admincommandhandlers.AdminSkill;
import handlers.admincommandhandlers.AdminSpawn;
import handlers.admincommandhandlers.AdminSummon;
+import handlers.admincommandhandlers.AdminSuperHaste;
import handlers.admincommandhandlers.AdminTarget;
import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
@@ -415,9 +418,11 @@ public class MasterHandler
AdminGeodata.class,
AdminGm.class,
AdminGmChat.class,
+ AdminGmSpeed.class,
AdminGraciaSeeds.class,
AdminGrandBoss.class,
AdminHeal.class,
+ AdminHide.class,
AdminHtml.class,
AdminHwid.class,
AdminInstance.class,
@@ -457,6 +462,7 @@ public class MasterHandler
AdminSkill.class,
AdminSpawn.class,
AdminSummon.class,
+ AdminSuperHaste.class,
AdminTarget.class,
AdminTargetSay.class,
AdminTeleport.class,
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
index 6b1bb7ac43..72c01c3cf8 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
@@ -19,7 +19,6 @@ package handlers.actionshifthandlers;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IActionShiftHandler;
-import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -37,11 +36,7 @@ public class L2PcInstanceActionShift implements IActionShiftHandler
activeChar.setTarget(target);
}
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_character_info");
- if (ach != null)
- {
- ach.useAdminCommand("admin_character_info " + target.getName(), activeChar);
- }
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_character_info " + target.getName(), true);
}
return true;
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
index 67d403c9b3..6ee8a1173e 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
@@ -19,7 +19,6 @@ package handlers.actionshifthandlers;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IActionShiftHandler;
-import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -36,11 +35,7 @@ public class L2SummonActionShift implements IActionShiftHandler
activeChar.setTarget(target);
}
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_summon_info");
- if (ach != null)
- {
- ach.useAdminCommand("admin_summon_info", activeChar);
- }
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_summon_info", true);
}
return true;
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
index 6c2b00db74..467875568d 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
@@ -19,7 +19,6 @@ package handlers.admincommandhandlers;
import java.util.Arrays;
import java.util.StringTokenizer;
-import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
@@ -34,7 +33,6 @@ import com.l2jmobius.gameserver.model.html.PageBuilder;
import com.l2jmobius.gameserver.model.html.PageResult;
import com.l2jmobius.gameserver.model.html.styles.ButtonsStyle;
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
-import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.Earthquake;
import com.l2jmobius.gameserver.network.serverpackets.ExRedSky;
@@ -81,8 +79,6 @@ public class AdminEffects implements IAdminCommandHandler
"admin_earthquake_menu",
"admin_bighead",
"admin_shrinkhead",
- "admin_gmspeed",
- "admin_gmspeed_menu",
"admin_unpara_all",
"admin_para_all",
"admin_unpara",
@@ -351,35 +347,6 @@ public class AdminEffects implements IAdminCommandHandler
{
}
}
- else if (command.startsWith("admin_gmspeed"))
- {
- try
- {
- final int val = Integer.parseInt(st.nextToken());
- final boolean sendMessage = activeChar.isAffectedBySkill(7029);
- activeChar.stopSkillEffects((val == 0) && sendMessage, 7029);
- if ((val >= 1) && (val <= 4))
- {
- int time = 0;
- if (st.hasMoreTokens())
- {
- time = Integer.parseInt(st.nextToken());
- }
-
- final Skill gmSpeedSkill = SkillData.getInstance().getSkill(7029, val);
- gmSpeedSkill.applyEffects(activeChar, activeChar, true, time);
- }
- }
- catch (Exception e)
- {
- activeChar.sendMessage("Usage: //gmspeed ");
- }
- if (command.contains("_menu"))
- {
- command = "";
- AdminHtml.showAdminHtml(activeChar, "gm_menu.htm");
- }
- }
else if (command.startsWith("admin_polyself"))
{
try
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java
new file mode 100644
index 0000000000..5ab5f39a9b
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import com.l2jmobius.Config;
+import com.l2jmobius.gameserver.handler.AdminCommandHandler;
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.L2Object;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.stats.Stats;
+import com.l2jmobius.gameserver.util.BuilderUtil;
+import com.l2jmobius.gameserver.util.Util;
+
+/**
+ * A retail-like implementation of //gmspeed builder command.
+ * @author lord_rex
+ */
+public final class AdminGmSpeed implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_gmspeed",
+ };
+
+ private static final Set SPEED_STATS = EnumSet.of(Stats.RUN_SPEED, Stats.WALK_SPEED, Stats.SWIM_RUN_SPEED, Stats.SWIM_WALK_SPEED, Stats.FLY_RUN_SPEED, Stats.FLY_WALK_SPEED);
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ final String cmd = st.nextToken();
+
+ if (cmd.equals("admin_gmspeed"))
+ {
+ if (!st.hasMoreTokens())
+ {
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+ final String token = st.nextToken();
+
+ // Rollback feature for old custom way, in order to make everyone happy.
+ if (Config.USE_SUPER_HASTE_AS_GM_SPEED)
+ {
+ AdminCommandHandler.getInstance().useAdminCommand(player, AdminSuperHaste.ADMIN_COMMANDS[0] + " " + token, false);
+ return true;
+ }
+
+ if (!Util.isDouble(token))
+ {
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+ final double runSpeedBoost = Double.parseDouble(token);
+ if ((runSpeedBoost < 0) || (runSpeedBoost > 10))
+ {
+ // Custom limit according to SDW's request - real retail limit is unknown.
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+
+ final L2Character targetCharacter;
+ final L2Object target = player.getTarget();
+ if ((target != null) && target.isCharacter())
+ {
+ targetCharacter = (L2Character) target;
+ }
+ else
+ {
+ // If there is no target, let's use the command executer.
+ targetCharacter = player;
+ }
+
+ SPEED_STATS.forEach(speedStat -> targetCharacter.getStat().removeFixedValue(speedStat));
+ if (runSpeedBoost > 0)
+ {
+ SPEED_STATS.forEach(speedStat -> targetCharacter.getStat().addFixedValue(speedStat, targetCharacter.getTemplate().getBaseValue(speedStat, 120) * runSpeedBoost));
+ }
+
+ targetCharacter.getStat().recalculateStats(false);
+ if (targetCharacter.isPlayer())
+ {
+ ((L2PcInstance) targetCharacter).broadcastUserInfo();
+ }
+ else
+ {
+ targetCharacter.broadcastInfo();
+ }
+
+ BuilderUtil.sendSysMessage(player, "[" + targetCharacter.getName() + "] speed is [" + (runSpeedBoost * 100) + "0]% fast.");
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java
new file mode 100644
index 0000000000..600cbe1639
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.util.BuilderUtil;
+
+/**
+ * @author lord_rex
+ */
+public final class AdminHide implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_hide"
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ st.nextToken();
+
+ try
+ {
+ final String param = st.nextToken();
+ switch (param)
+ {
+ case "on":
+ {
+ if (!BuilderUtil.setHiding(player, true))
+ {
+ BuilderUtil.sendSysMessage(player, "Currently, you cannot be seen.");
+ return true;
+ }
+
+ BuilderUtil.sendSysMessage(player, "Now, you cannot be seen.");
+ return true;
+ }
+ case "off":
+ {
+ if (!BuilderUtil.setHiding(player, false))
+ {
+ BuilderUtil.sendSysMessage(player, "Currently, you can be seen.");
+ return true;
+ }
+
+ BuilderUtil.sendSysMessage(player, "Now, you can be seen.");
+ return true;
+ }
+ default:
+ {
+ BuilderUtil.sendSysMessage(player, "//hide [on|off]");
+ return true;
+ }
+ }
+ }
+ catch (final Exception e)
+ {
+ BuilderUtil.sendSysMessage(player, "//hide [on|off]");
+ return true;
+ }
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
index 5ab19d4b39..8c735f4265 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
@@ -21,7 +21,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Clan;
@@ -187,14 +186,7 @@ public class AdminMenu implements IAdminCommandHandler
if (st.countTokens() > 1)
{
final String subCommand = "admin_ban_char";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + command.substring(14), activeChar);
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + command.substring(14), true);
}
showMainPage(activeChar);
}
@@ -204,14 +196,7 @@ public class AdminMenu implements IAdminCommandHandler
if (st.countTokens() > 1)
{
final String subCommand = "admin_unban_char";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + command.substring(16), activeChar);
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + command.substring(16), true);
}
showMainPage(activeChar);
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
index a818e7f3d3..f27d63e949 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
@@ -16,9 +16,6 @@
*/
package handlers.admincommandhandlers;
-import java.util.logging.Logger;
-
-import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -28,8 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
*/
public class AdminSummon implements IAdminCommandHandler
{
- private static final Logger LOGGER = Logger.getLogger(AdminSummon.class.getName());
-
public static final String[] ADMIN_COMMANDS =
{
"admin_summon"
@@ -62,34 +57,24 @@ public class AdminSummon implements IAdminCommandHandler
return false;
}
- String subCommand;
+ final String subCommand;
if (id < 1000000)
{
subCommand = "admin_create_item";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
}
else
{
subCommand = "admin_spawn_once";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
activeChar.sendMessage("This is only a temporary spawn. The mob(s) will NOT respawn.");
id -= 1000000;
- ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
}
+
+ if ((id > 0) && (count > 0))
+ {
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + " " + id + " " + count, true);
+ }
+
return true;
}
}
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java
new file mode 100644
index 0000000000..4a3eb0c809
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java
@@ -0,0 +1,92 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.skills.Skill;
+
+/**
+ * The classical custom L2J implementation of the old //gmspeed GM command.
+ * @author lord_rex (No, it wasn't me at all. Eclipse added my name there.)
+ */
+public final class AdminSuperHaste implements IAdminCommandHandler
+{
+ public static final String[] ADMIN_COMMANDS =
+ {
+ "admin_superhaste",
+ "admin_superhaste_menu",
+ "admin_speed",
+ "admin_speed_menu",
+ };
+
+ private static final int SUPER_HASTE_ID = 7029;
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ final String cmd = st.nextToken();
+ switch (cmd)
+ {
+ case "admin_superhaste":
+ case "admin_speed":
+ {
+ try
+ {
+ final int val = Integer.parseInt(st.nextToken());
+ final boolean sendMessage = player.isAffectedBySkill(SUPER_HASTE_ID);
+ player.stopSkillEffects((val == 0) && sendMessage, SUPER_HASTE_ID);
+ if ((val >= 1) && (val <= 4))
+ {
+ int time = 0;
+ if (st.hasMoreTokens())
+ {
+ time = Integer.parseInt(st.nextToken());
+ }
+
+ final Skill superHasteSkill = SkillData.getInstance().getSkill(SUPER_HASTE_ID, val);
+ superHasteSkill.applyEffects(player, player, true, time);
+ }
+ }
+ catch (final Exception e)
+ {
+ player.sendMessage("Usage: //superhaste ");
+ }
+
+ break;
+ }
+ case "admin_superhaste_menu":
+ case "admin_speed_menu":
+ {
+ AdminHtml.showAdminHtml(player, "gm_menu.htm");
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java
index a4e05e7f84..b49c72d33b 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/Config.java
@@ -400,6 +400,7 @@ public final class Config
public static int DEFAULT_ACCESS_LEVEL;
public static boolean SERVER_GMONLY;
public static boolean GM_HERO_AURA;
+ public static boolean GM_STARTUP_BUILDER_HIDE;
public static boolean GM_STARTUP_INVULNERABLE;
public static boolean GM_STARTUP_INVISIBLE;
public static boolean GM_STARTUP_SILENCE;
@@ -413,6 +414,7 @@ public final class Config
public static boolean GM_CRITANNOUNCER_NAME;
public static boolean GM_GIVE_SPECIAL_SKILLS;
public static boolean GM_GIVE_SPECIAL_AURA_SKILLS;
+ public static boolean USE_SUPER_HASTE_AS_GM_SPEED;
public static boolean GAMEGUARD_ENFORCE;
public static boolean GAMEGUARD_PROHIBITACTION;
public static boolean LOG_CHAT;
@@ -1822,6 +1824,7 @@ public final class Config
DEFAULT_ACCESS_LEVEL = General.getInt("DefaultAccessLevel", 0);
SERVER_GMONLY = General.getBoolean("ServerGMOnly", false);
GM_HERO_AURA = General.getBoolean("GMHeroAura", false);
+ GM_STARTUP_BUILDER_HIDE = General.getBoolean("GMStartupBuilderHide", false);
GM_STARTUP_INVULNERABLE = General.getBoolean("GMStartupInvulnerable", false);
GM_STARTUP_INVISIBLE = General.getBoolean("GMStartupInvisible", false);
GM_STARTUP_SILENCE = General.getBoolean("GMStartupSilence", false);
@@ -1835,6 +1838,7 @@ public final class Config
GM_CRITANNOUNCER_NAME = General.getBoolean("GMShowCritAnnouncerName", false);
GM_GIVE_SPECIAL_SKILLS = General.getBoolean("GMGiveSpecialSkills", false);
GM_GIVE_SPECIAL_AURA_SKILLS = General.getBoolean("GMGiveSpecialAuraSkills", false);
+ USE_SUPER_HASTE_AS_GM_SPEED = General.getBoolean("UseSuperHasteAsGMSpeed", false);
GAMEGUARD_ENFORCE = General.getBoolean("GameGuardEnforce", false);
GAMEGUARD_PROHIBITACTION = General.getBoolean("GameGuardProhibitAction", false);
LOG_CHAT = General.getBoolean("LogChat", false);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
index adf6462b78..c4faf3bd6d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
@@ -18,12 +18,26 @@ package com.l2jmobius.gameserver.handler;
import java.util.HashMap;
import java.util.Map;
+import java.util.logging.Logger;
+
+import com.l2jmobius.Config;
+import com.l2jmobius.commons.concurrent.ThreadPool;
+import com.l2jmobius.gameserver.data.xml.impl.AdminData;
+import com.l2jmobius.gameserver.enums.PlayerAction;
+import com.l2jmobius.gameserver.model.L2Object;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.network.SystemMessageId;
+import com.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
+import com.l2jmobius.gameserver.util.GMAudit;
+import com.l2jmobius.gameserver.util.TimeAmountInterpreter;
/**
* @author UnAfraid
*/
public class AdminCommandHandler implements IHandler
{
+ private static final Logger LOGGER = Logger.getLogger(AdminCommandHandler.class.getName());
+
private final Map _datatable;
protected AdminCommandHandler()
@@ -49,10 +63,85 @@ public class AdminCommandHandler implements IHandler
+ {
+ final long begin = System.currentTimeMillis();
+ try
+ {
+ if (Config.GMAUDIT)
+ {
+ final L2Object target = player.getTarget();
+ GMAudit.auditGMAction(player.getName() + " [" + player.getObjectId() + "]", fullCommand, (target != null ? target.getName() : "no-target"));
+ }
+
+ handler.useAdminCommand(fullCommand, player);
+ }
+ catch (RuntimeException e)
+ {
+ player.sendMessage("Exception during execution of '" + fullCommand + "': " + e.toString());
+ LOGGER.warning("Exception during execution of " + fullCommand + " " + e);
+ }
+ finally
+ {
+ final long runtime = System.currentTimeMillis() - begin;
+
+ if (runtime < 5000)
+ {
+ return;
+ }
+
+ player.sendMessage("The execution of '" + fullCommand + "' took " + TimeAmountInterpreter.consolidateMillis(runtime) + ".");
+ }
+ });
+ }
}
@Override
@@ -63,11 +152,11 @@ public class AdminCommandHandler implements IHandler.
+ */
+package com.l2jmobius.gameserver.util;
+
+import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
+import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoAbnormalVisualEffect;
+
+/**
+ * @author lord_rex
+ */
+public final class BuilderUtil
+{
+ private BuilderUtil()
+ {
+ // utility class
+ }
+
+ /**
+ * Sends builder system message to the player.
+ * @param player
+ * @param message
+ */
+ public static void sendSysMessage(L2PcInstance player, String message)
+ {
+ player.sendPacket(new CreatureSay(0, ChatType.GENERAL, "SYS", message));
+ }
+
+ /**
+ * Changes player's hiding state.
+ * @param player
+ * @param hide
+ * @return {@code true} if hide state was changed, otherwise {@code false}
+ */
+ public static boolean setHiding(L2PcInstance player, boolean hide)
+ {
+ if (player.isInvisible() && hide)
+ {
+ // already hiding
+ return false;
+ }
+
+ if (!player.isInvisible() && !hide)
+ {
+ // already visible
+ return false;
+ }
+
+ player.setSilenceMode(hide);
+ player.setIsInvul(hide);
+ player.setInvisible(hide);
+
+ player.broadcastUserInfo();
+ player.sendPacket(new ExUserInfoAbnormalVisualEffect(player));
+ return true;
+ }
+}
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java
new file mode 100644
index 0000000000..a9f8029b98
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 1999 CERN - European Organization for Nuclear Research.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation. CERN makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without expressed or implied warranty.
+ */
+package com.l2jmobius.gameserver.util;
+
+import static java.util.concurrent.TimeUnit.DAYS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+import java.io.IOException;
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Allows to present time intervals in a standardized, user friendly manner.
+ * @author _dev_
+ */
+public class TimeAmountInterpreter
+{
+ private static final TimeUnit[] UNIT_CACHE = TimeUnit.values();
+
+ private TimeAmountInterpreter()
+ {
+ // utility class
+ }
+
+ /**
+ * Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#NANOSECONDS}.
+ * @param timeAmountInNanos amount of time in nanoseconds
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidateNanos(long timeAmountInNanos)
+ {
+ return consolidate(timeAmountInNanos, NANOSECONDS);
+ }
+
+ /**
+ * Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#MILLISECONDS}.
+ * @param timeAmountInMillis amount of time in milliseconds
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidateMillis(long timeAmountInMillis)
+ {
+ return consolidate(timeAmountInMillis, MILLISECONDS);
+ }
+
+ /**
+ * Constructs an user-friendly description of the given amount of time, specifying the number of days (if any), hours (if any), minutes (if any), seconds (if any) and milliseconds (if any). Otherwise, returns the string value {@code 0}.
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidate(long timeAmount, TimeUnit timeUnit)
+ {
+ return consolidate(timeAmount, timeUnit, timeUnit, DAYS, "0 " + timeUnit.name().toLowerCase(Locale.ENGLISH));
+ }
+
+ /**
+ * Constructs an user-friendly description of the given amount of time.
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @param minConsolidationUnit smallest unit to be included within the description
+ * @param maxConsolidationUnit largest unit to be included within the description
+ * @param noTimeUsedIndicator text to be written if the amount is not positive
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidate(long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator)
+ {
+ return appendConsolidated(new StringBuilder(), timeAmount, timeUnit, minConsolidationUnit, maxConsolidationUnit, noTimeUsedIndicator).toString();
+ }
+
+ /**
+ * Appends an user-friendly description of the given amount of time to the specified text builder.
+ *
+ * Please keep in mind, that this method is primarily designed to be used with heap text builders. Therefore, if the given text builder throws an {@link IOException}, this exception will be wrapped in a {@link RuntimeException} and returned to the caller as an unchecked exception.
+ * @param
+ * @param textBuilder a character sequence builder
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @param minConsolidationUnit smallest unit to be included within the description
+ * @param maxConsolidationUnit largest unit to be included within the description
+ * @param noTimeUsedIndicator text to be written if the amount is not positive
+ * @return {@code textBuilder}
+ * @throws RuntimeException if {@code textBuilder} throws an {@link IOException}
+ */
+ @SuppressWarnings("unchecked")
+ public static T appendConsolidated(T textBuilder, long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator) throws RuntimeException
+ {
+ try
+ {
+ if (timeAmount < 1)
+ {
+ return (T) textBuilder.append(noTimeUsedIndicator);
+ }
+
+ final int len = textBuilder.length();
+ for (int i = maxConsolidationUnit.ordinal(); i >= minConsolidationUnit.ordinal(); --i)
+ {
+ final TimeUnit activeUnit = UNIT_CACHE[i];
+ final long num = activeUnit.convert(timeAmount, timeUnit);
+ if (num == 0)
+ {
+ continue;
+ }
+
+ if (textBuilder.length() > len)
+ {
+ textBuilder.append(", ");
+ }
+ textBuilder.append(String.valueOf(num)).append(' ');
+ final String unit = activeUnit.name().toLowerCase(Locale.ENGLISH);
+ textBuilder.append(unit, 0, num == 1 ? unit.length() - 1 : unit.length());
+
+ timeAmount -= timeUnit.convert(num, activeUnit);
+ }
+
+ if (textBuilder.length() == len)
+ {
+ return (T) textBuilder.append(noTimeUsedIndicator).append(' ').append(minConsolidationUnit.name().toLowerCase(Locale.ENGLISH));
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return textBuilder;
+ }
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/AdminCommands.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/AdminCommands.xml
index 14882ea07a..8b4096bd34 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/AdminCommands.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/AdminCommands.xml
@@ -158,8 +158,6 @@
-
-
@@ -189,6 +187,13 @@
+
+
+
+
+
+
+
@@ -615,4 +620,7 @@
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini
index 832fb08b17..106b6e6078 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini
@@ -25,6 +25,10 @@ ServerGMOnly = False
# Default: False
GMHeroAura = False
+# Whether GM logins in builder hide mode by default.
+# Default: True
+GMStartupBuilderHide = True
+
# Auto set invulnerable status to a GM on login.
# Default: False
GMStartupInvulnerable = True
@@ -79,6 +83,11 @@ GMGiveSpecialSkills = False
# Default: False
GMGiveSpecialAuraSkills = False
+# In case you are not satisfied with the retail-like implementation of //gmspeed",
+# with this config you can rollback it to the old custom L2J version of the GM Speed.
+# Default: False
+UseSuperHasteAsGMSpeed = False
+
# ---------------------------------------------------------------------------
# Server Security
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/admin/gm_menu.htm b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/admin/gm_menu.htm
index ffe3e3d025..5a8f77eaba 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/admin/gm_menu.htm
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/admin/gm_menu.htm
@@ -38,11 +38,11 @@
Super Haste:
-
-
-
-
-
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java
index 8ff587ff17..fa9c716767 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java
@@ -84,9 +84,11 @@ import handlers.admincommandhandlers.AdminFortSiege;
import handlers.admincommandhandlers.AdminGeodata;
import handlers.admincommandhandlers.AdminGm;
import handlers.admincommandhandlers.AdminGmChat;
+import handlers.admincommandhandlers.AdminGmSpeed;
import handlers.admincommandhandlers.AdminGraciaSeeds;
import handlers.admincommandhandlers.AdminGrandBoss;
import handlers.admincommandhandlers.AdminHeal;
+import handlers.admincommandhandlers.AdminHide;
import handlers.admincommandhandlers.AdminHtml;
import handlers.admincommandhandlers.AdminHwid;
import handlers.admincommandhandlers.AdminInstance;
@@ -126,6 +128,7 @@ import handlers.admincommandhandlers.AdminShutdown;
import handlers.admincommandhandlers.AdminSkill;
import handlers.admincommandhandlers.AdminSpawn;
import handlers.admincommandhandlers.AdminSummon;
+import handlers.admincommandhandlers.AdminSuperHaste;
import handlers.admincommandhandlers.AdminTarget;
import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
@@ -415,9 +418,11 @@ public class MasterHandler
AdminGeodata.class,
AdminGm.class,
AdminGmChat.class,
+ AdminGmSpeed.class,
AdminGraciaSeeds.class,
AdminGrandBoss.class,
AdminHeal.class,
+ AdminHide.class,
AdminHtml.class,
AdminHwid.class,
AdminInstance.class,
@@ -457,6 +462,7 @@ public class MasterHandler
AdminSkill.class,
AdminSpawn.class,
AdminSummon.class,
+ AdminSuperHaste.class,
AdminTarget.class,
AdminTargetSay.class,
AdminTeleport.class,
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
index 6b1bb7ac43..72c01c3cf8 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2PcInstanceActionShift.java
@@ -19,7 +19,6 @@ package handlers.actionshifthandlers;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IActionShiftHandler;
-import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -37,11 +36,7 @@ public class L2PcInstanceActionShift implements IActionShiftHandler
activeChar.setTarget(target);
}
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_character_info");
- if (ach != null)
- {
- ach.useAdminCommand("admin_character_info " + target.getName(), activeChar);
- }
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_character_info " + target.getName(), true);
}
return true;
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
index 67d403c9b3..6ee8a1173e 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/L2SummonActionShift.java
@@ -19,7 +19,6 @@ package handlers.actionshifthandlers;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IActionShiftHandler;
-import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -36,11 +35,7 @@ public class L2SummonActionShift implements IActionShiftHandler
activeChar.setTarget(target);
}
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler("admin_summon_info");
- if (ach != null)
- {
- ach.useAdminCommand("admin_summon_info", activeChar);
- }
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_summon_info", true);
}
return true;
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
index 6c2b00db74..467875568d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java
@@ -19,7 +19,6 @@ package handlers.admincommandhandlers;
import java.util.Arrays;
import java.util.StringTokenizer;
-import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
@@ -34,7 +33,6 @@ import com.l2jmobius.gameserver.model.html.PageBuilder;
import com.l2jmobius.gameserver.model.html.PageResult;
import com.l2jmobius.gameserver.model.html.styles.ButtonsStyle;
import com.l2jmobius.gameserver.model.skills.AbnormalVisualEffect;
-import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.Earthquake;
import com.l2jmobius.gameserver.network.serverpackets.ExRedSky;
@@ -81,8 +79,6 @@ public class AdminEffects implements IAdminCommandHandler
"admin_earthquake_menu",
"admin_bighead",
"admin_shrinkhead",
- "admin_gmspeed",
- "admin_gmspeed_menu",
"admin_unpara_all",
"admin_para_all",
"admin_unpara",
@@ -351,35 +347,6 @@ public class AdminEffects implements IAdminCommandHandler
{
}
}
- else if (command.startsWith("admin_gmspeed"))
- {
- try
- {
- final int val = Integer.parseInt(st.nextToken());
- final boolean sendMessage = activeChar.isAffectedBySkill(7029);
- activeChar.stopSkillEffects((val == 0) && sendMessage, 7029);
- if ((val >= 1) && (val <= 4))
- {
- int time = 0;
- if (st.hasMoreTokens())
- {
- time = Integer.parseInt(st.nextToken());
- }
-
- final Skill gmSpeedSkill = SkillData.getInstance().getSkill(7029, val);
- gmSpeedSkill.applyEffects(activeChar, activeChar, true, time);
- }
- }
- catch (Exception e)
- {
- activeChar.sendMessage("Usage: //gmspeed ");
- }
- if (command.contains("_menu"))
- {
- command = "";
- AdminHtml.showAdminHtml(activeChar, "gm_menu.htm");
- }
- }
else if (command.startsWith("admin_polyself"))
{
try
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java
new file mode 100644
index 0000000000..6c47b71637
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminGmSpeed.java
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import com.l2jmobius.Config;
+import com.l2jmobius.gameserver.handler.AdminCommandHandler;
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.L2Object;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.stats.Stats;
+import com.l2jmobius.gameserver.util.BuilderUtil;
+import com.l2jmobius.gameserver.util.Util;
+
+/**
+ * A retail-like implementation of //gmspeed builder command.
+ * @author lord_rex
+ */
+public final class AdminGmSpeed implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_gmspeed",
+ };
+
+ private static final Set SPEED_STATS = EnumSet.of(Stats.RUN_SPEED, Stats.WALK_SPEED, Stats.SWIM_RUN_SPEED, Stats.SWIM_WALK_SPEED, Stats.FLY_RUN_SPEED, Stats.FLY_WALK_SPEED);
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ final String cmd = st.nextToken();
+
+ if (cmd.equals("admin_gmspeed"))
+ {
+ if (!st.hasMoreTokens())
+ {
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+ final String token = st.nextToken();
+
+ // Rollback feature for old custom way, in order to make everyone happy.
+ if (Config.USE_SUPER_HASTE_AS_GM_SPEED)
+ {
+ AdminCommandHandler.getInstance().useAdminCommand(player, AdminSuperHaste.ADMIN_COMMANDS[0] + " " + token, false);
+ return true;
+ }
+
+ if (!Util.isDouble(token))
+ {
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+ final double runSpeedBoost = Double.parseDouble(token);
+ if ((runSpeedBoost < 0) || (runSpeedBoost > 10))
+ {
+ // Custom limit according to SDW's request - real retail limit is unknown.
+ BuilderUtil.sendSysMessage(player, "//gmspeed [0...10]");
+ return false;
+ }
+
+ final L2Character targetCharacter;
+ final L2Object target = player.getTarget();
+ if ((target != null) && target.isCharacter())
+ {
+ targetCharacter = (L2Character) target;
+ }
+ else
+ {
+ // If there is no target, let's use the command executer.
+ targetCharacter = player;
+ }
+
+ SPEED_STATS.forEach(speedStat -> targetCharacter.getStat().removeFixedValue(speedStat));
+ if (runSpeedBoost > 0)
+ {
+ SPEED_STATS.forEach(speedStat -> targetCharacter.getStat().addFixedValue(speedStat, targetCharacter.getTemplate().getBaseValue(speedStat, 120) * runSpeedBoost));
+ }
+
+ targetCharacter.getStat().recalculateStats(false);
+ if (targetCharacter.isPlayer())
+ {
+ ((L2PcInstance) targetCharacter).broadcastUserInfo();
+ }
+ else
+ {
+ targetCharacter.broadcastInfo();
+ }
+
+ BuilderUtil.sendSysMessage(player, "[" + targetCharacter.getName() + "] speed is [" + (runSpeedBoost * 100) + "0]% fast.");
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java
new file mode 100644
index 0000000000..ce8238db1d
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminHide.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.util.BuilderUtil;
+
+/**
+ * @author lord_rex
+ */
+public final class AdminHide implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_hide"
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ st.nextToken();
+
+ try
+ {
+ final String param = st.nextToken();
+ switch (param)
+ {
+ case "on":
+ {
+ if (!BuilderUtil.setHiding(player, true))
+ {
+ BuilderUtil.sendSysMessage(player, "Currently, you cannot be seen.");
+ return true;
+ }
+
+ BuilderUtil.sendSysMessage(player, "Now, you cannot be seen.");
+ return true;
+ }
+ case "off":
+ {
+ if (!BuilderUtil.setHiding(player, false))
+ {
+ BuilderUtil.sendSysMessage(player, "Currently, you can be seen.");
+ return true;
+ }
+
+ BuilderUtil.sendSysMessage(player, "Now, you can be seen.");
+ return true;
+ }
+ default:
+ {
+ BuilderUtil.sendSysMessage(player, "//hide [on|off]");
+ return true;
+ }
+ }
+ }
+ catch (final Exception e)
+ {
+ BuilderUtil.sendSysMessage(player, "//hide [on|off]");
+ return true;
+ }
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
index 5ab19d4b39..8c735f4265 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminMenu.java
@@ -21,7 +21,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Clan;
@@ -187,14 +186,7 @@ public class AdminMenu implements IAdminCommandHandler
if (st.countTokens() > 1)
{
final String subCommand = "admin_ban_char";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + command.substring(14), activeChar);
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + command.substring(14), true);
}
showMainPage(activeChar);
}
@@ -204,14 +196,7 @@ public class AdminMenu implements IAdminCommandHandler
if (st.countTokens() > 1)
{
final String subCommand = "admin_unban_char";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + command.substring(16), activeChar);
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + command.substring(16), true);
}
showMainPage(activeChar);
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
index a818e7f3d3..f27d63e949 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminSummon.java
@@ -16,9 +16,6 @@
*/
package handlers.admincommandhandlers;
-import java.util.logging.Logger;
-
-import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.handler.AdminCommandHandler;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@@ -28,8 +25,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
*/
public class AdminSummon implements IAdminCommandHandler
{
- private static final Logger LOGGER = Logger.getLogger(AdminSummon.class.getName());
-
public static final String[] ADMIN_COMMANDS =
{
"admin_summon"
@@ -62,34 +57,24 @@ public class AdminSummon implements IAdminCommandHandler
return false;
}
- String subCommand;
+ final String subCommand;
if (id < 1000000)
{
subCommand = "admin_create_item";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
- ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
}
else
{
subCommand = "admin_spawn_once";
- if (!AdminData.getInstance().hasAccess(subCommand, activeChar.getAccessLevel()))
- {
- activeChar.sendMessage("You don't have the access right to use this command!");
- LOGGER.warning("Character " + activeChar.getName() + " tryed to use admin command " + subCommand + ", but have no access to it!");
- return false;
- }
- final IAdminCommandHandler ach = AdminCommandHandler.getInstance().getHandler(subCommand);
activeChar.sendMessage("This is only a temporary spawn. The mob(s) will NOT respawn.");
id -= 1000000;
- ach.useAdminCommand(subCommand + " " + id + " " + count, activeChar);
}
+
+ if ((id > 0) && (count > 0))
+ {
+ AdminCommandHandler.getInstance().useAdminCommand(activeChar, subCommand + " " + id + " " + count, true);
+ }
+
return true;
}
}
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java
new file mode 100644
index 0000000000..7a782b6004
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminSuperHaste.java
@@ -0,0 +1,92 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package handlers.admincommandhandlers;
+
+import java.util.StringTokenizer;
+
+import com.l2jmobius.gameserver.data.xml.impl.SkillData;
+import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.skills.Skill;
+
+/**
+ * The classical custom L2J implementation of the old //gmspeed GM command.
+ * @author lord_rex (No, it wasn't me at all. Eclipse added my name there.)
+ */
+public final class AdminSuperHaste implements IAdminCommandHandler
+{
+ public static final String[] ADMIN_COMMANDS =
+ {
+ "admin_superhaste",
+ "admin_superhaste_menu",
+ "admin_speed",
+ "admin_speed_menu",
+ };
+
+ private static final int SUPER_HASTE_ID = 7029;
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance player)
+ {
+ final StringTokenizer st = new StringTokenizer(command);
+ final String cmd = st.nextToken();
+ switch (cmd)
+ {
+ case "admin_superhaste":
+ case "admin_speed":
+ {
+ try
+ {
+ final int val = Integer.parseInt(st.nextToken());
+ final boolean sendMessage = player.isAffectedBySkill(SUPER_HASTE_ID);
+ player.stopSkillEffects((val == 0) && sendMessage, SUPER_HASTE_ID);
+ if ((val >= 1) && (val <= 4))
+ {
+ int time = 0;
+ if (st.hasMoreTokens())
+ {
+ time = Integer.parseInt(st.nextToken());
+ }
+
+ final Skill superHasteSkill = SkillData.getInstance().getSkill(SUPER_HASTE_ID, val);
+ superHasteSkill.applyEffects(player, player, true, time);
+ }
+ }
+ catch (final Exception e)
+ {
+ player.sendMessage("Usage: //superhaste ");
+ }
+
+ break;
+ }
+ case "admin_superhaste_menu":
+ case "admin_speed_menu":
+ {
+ AdminHtml.showAdminHtml(player, "gm_menu.htm");
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java
index d6007721e8..e07ff54bde 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/Config.java
@@ -400,6 +400,7 @@ public final class Config
public static int DEFAULT_ACCESS_LEVEL;
public static boolean SERVER_GMONLY;
public static boolean GM_HERO_AURA;
+ public static boolean GM_STARTUP_BUILDER_HIDE;
public static boolean GM_STARTUP_INVULNERABLE;
public static boolean GM_STARTUP_INVISIBLE;
public static boolean GM_STARTUP_SILENCE;
@@ -413,6 +414,7 @@ public final class Config
public static boolean GM_CRITANNOUNCER_NAME;
public static boolean GM_GIVE_SPECIAL_SKILLS;
public static boolean GM_GIVE_SPECIAL_AURA_SKILLS;
+ public static boolean USE_SUPER_HASTE_AS_GM_SPEED;
public static boolean GAMEGUARD_ENFORCE;
public static boolean GAMEGUARD_PROHIBITACTION;
public static boolean LOG_CHAT;
@@ -1820,6 +1822,7 @@ public final class Config
DEFAULT_ACCESS_LEVEL = General.getInt("DefaultAccessLevel", 0);
SERVER_GMONLY = General.getBoolean("ServerGMOnly", false);
GM_HERO_AURA = General.getBoolean("GMHeroAura", false);
+ GM_STARTUP_BUILDER_HIDE = General.getBoolean("GMStartupBuilderHide", false);
GM_STARTUP_INVULNERABLE = General.getBoolean("GMStartupInvulnerable", false);
GM_STARTUP_INVISIBLE = General.getBoolean("GMStartupInvisible", false);
GM_STARTUP_SILENCE = General.getBoolean("GMStartupSilence", false);
@@ -1833,6 +1836,7 @@ public final class Config
GM_CRITANNOUNCER_NAME = General.getBoolean("GMShowCritAnnouncerName", false);
GM_GIVE_SPECIAL_SKILLS = General.getBoolean("GMGiveSpecialSkills", false);
GM_GIVE_SPECIAL_AURA_SKILLS = General.getBoolean("GMGiveSpecialAuraSkills", false);
+ USE_SUPER_HASTE_AS_GM_SPEED = General.getBoolean("UseSuperHasteAsGMSpeed", false);
GAMEGUARD_ENFORCE = General.getBoolean("GameGuardEnforce", false);
GAMEGUARD_PROHIBITACTION = General.getBoolean("GameGuardProhibitAction", false);
LOG_CHAT = General.getBoolean("LogChat", false);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
index adf6462b78..c4faf3bd6d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java
@@ -18,12 +18,26 @@ package com.l2jmobius.gameserver.handler;
import java.util.HashMap;
import java.util.Map;
+import java.util.logging.Logger;
+
+import com.l2jmobius.Config;
+import com.l2jmobius.commons.concurrent.ThreadPool;
+import com.l2jmobius.gameserver.data.xml.impl.AdminData;
+import com.l2jmobius.gameserver.enums.PlayerAction;
+import com.l2jmobius.gameserver.model.L2Object;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.network.SystemMessageId;
+import com.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
+import com.l2jmobius.gameserver.util.GMAudit;
+import com.l2jmobius.gameserver.util.TimeAmountInterpreter;
/**
* @author UnAfraid
*/
public class AdminCommandHandler implements IHandler
{
+ private static final Logger LOGGER = Logger.getLogger(AdminCommandHandler.class.getName());
+
private final Map _datatable;
protected AdminCommandHandler()
@@ -49,10 +63,85 @@ public class AdminCommandHandler implements IHandler
+ {
+ final long begin = System.currentTimeMillis();
+ try
+ {
+ if (Config.GMAUDIT)
+ {
+ final L2Object target = player.getTarget();
+ GMAudit.auditGMAction(player.getName() + " [" + player.getObjectId() + "]", fullCommand, (target != null ? target.getName() : "no-target"));
+ }
+
+ handler.useAdminCommand(fullCommand, player);
+ }
+ catch (RuntimeException e)
+ {
+ player.sendMessage("Exception during execution of '" + fullCommand + "': " + e.toString());
+ LOGGER.warning("Exception during execution of " + fullCommand + " " + e);
+ }
+ finally
+ {
+ final long runtime = System.currentTimeMillis() - begin;
+
+ if (runtime < 5000)
+ {
+ return;
+ }
+
+ player.sendMessage("The execution of '" + fullCommand + "' took " + TimeAmountInterpreter.consolidateMillis(runtime) + ".");
+ }
+ });
+ }
}
@Override
@@ -63,11 +152,11 @@ public class AdminCommandHandler implements IHandler.
+ */
+package com.l2jmobius.gameserver.util;
+
+import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.network.serverpackets.CreatureSay;
+import com.l2jmobius.gameserver.network.serverpackets.ExUserInfoAbnormalVisualEffect;
+
+/**
+ * @author lord_rex
+ */
+public final class BuilderUtil
+{
+ private BuilderUtil()
+ {
+ // utility class
+ }
+
+ /**
+ * Sends builder system message to the player.
+ * @param player
+ * @param message
+ */
+ public static void sendSysMessage(L2PcInstance player, String message)
+ {
+ player.sendPacket(new CreatureSay(0, ChatType.GENERAL, "SYS", message));
+ }
+
+ /**
+ * Changes player's hiding state.
+ * @param player
+ * @param hide
+ * @return {@code true} if hide state was changed, otherwise {@code false}
+ */
+ public static boolean setHiding(L2PcInstance player, boolean hide)
+ {
+ if (player.isInvisible() && hide)
+ {
+ // already hiding
+ return false;
+ }
+
+ if (!player.isInvisible() && !hide)
+ {
+ // already visible
+ return false;
+ }
+
+ player.setSilenceMode(hide);
+ player.setIsInvul(hide);
+ player.setInvisible(hide);
+
+ player.broadcastUserInfo();
+ player.sendPacket(new ExUserInfoAbnormalVisualEffect(player));
+ return true;
+ }
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java
new file mode 100644
index 0000000000..4afbb96199
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/TimeAmountInterpreter.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 1999 CERN - European Organization for Nuclear Research.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation. CERN makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without expressed or implied warranty.
+ */
+package com.l2jmobius.gameserver.util;
+
+import static java.util.concurrent.TimeUnit.DAYS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+import java.io.IOException;
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Allows to present time intervals in a standardized, user friendly manner.
+ * @author _dev_
+ */
+public class TimeAmountInterpreter
+{
+ private static final TimeUnit[] UNIT_CACHE = TimeUnit.values();
+
+ private TimeAmountInterpreter()
+ {
+ // utility class
+ }
+
+ /**
+ * Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#NANOSECONDS}.
+ * @param timeAmountInNanos amount of time in nanoseconds
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidateNanos(long timeAmountInNanos)
+ {
+ return consolidate(timeAmountInNanos, NANOSECONDS);
+ }
+
+ /**
+ * Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#MILLISECONDS}.
+ * @param timeAmountInMillis amount of time in milliseconds
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidateMillis(long timeAmountInMillis)
+ {
+ return consolidate(timeAmountInMillis, MILLISECONDS);
+ }
+
+ /**
+ * Constructs an user-friendly description of the given amount of time, specifying the number of days (if any), hours (if any), minutes (if any), seconds (if any) and milliseconds (if any). Otherwise, returns the string value {@code 0}.
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidate(long timeAmount, TimeUnit timeUnit)
+ {
+ return consolidate(timeAmount, timeUnit, timeUnit, DAYS, "0 " + timeUnit.name().toLowerCase(Locale.ENGLISH));
+ }
+
+ /**
+ * Constructs an user-friendly description of the given amount of time.
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @param minConsolidationUnit smallest unit to be included within the description
+ * @param maxConsolidationUnit largest unit to be included within the description
+ * @param noTimeUsedIndicator text to be written if the amount is not positive
+ * @return an user-friendly description of the given time amount
+ */
+ public static String consolidate(long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator)
+ {
+ return appendConsolidated(new StringBuilder(), timeAmount, timeUnit, minConsolidationUnit, maxConsolidationUnit, noTimeUsedIndicator).toString();
+ }
+
+ /**
+ * Appends an user-friendly description of the given amount of time to the specified text builder.
+ *
+ * Please keep in mind, that this method is primarily designed to be used with heap text builders. Therefore, if the given text builder throws an {@link IOException}, this exception will be wrapped in a {@link RuntimeException} and returned to the caller as an unchecked exception.
+ * @param
+ * @param textBuilder a character sequence builder
+ * @param timeAmount amount of time to be written
+ * @param timeUnit unit of the given amount
+ * @param minConsolidationUnit smallest unit to be included within the description
+ * @param maxConsolidationUnit largest unit to be included within the description
+ * @param noTimeUsedIndicator text to be written if the amount is not positive
+ * @return {@code textBuilder}
+ * @throws RuntimeException if {@code textBuilder} throws an {@link IOException}
+ */
+ @SuppressWarnings("unchecked")
+ public static T appendConsolidated(T textBuilder, long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator) throws RuntimeException
+ {
+ try
+ {
+ if (timeAmount < 1)
+ {
+ return (T) textBuilder.append(noTimeUsedIndicator);
+ }
+
+ final int len = textBuilder.length();
+ for (int i = maxConsolidationUnit.ordinal(); i >= minConsolidationUnit.ordinal(); --i)
+ {
+ final TimeUnit activeUnit = UNIT_CACHE[i];
+ final long num = activeUnit.convert(timeAmount, timeUnit);
+ if (num == 0)
+ {
+ continue;
+ }
+
+ if (textBuilder.length() > len)
+ {
+ textBuilder.append(", ");
+ }
+ textBuilder.append(String.valueOf(num)).append(' ');
+ final String unit = activeUnit.name().toLowerCase(Locale.ENGLISH);
+ textBuilder.append(unit, 0, num == 1 ? unit.length() - 1 : unit.length());
+
+ timeAmount -= timeUnit.convert(num, activeUnit);
+ }
+
+ if (textBuilder.length() == len)
+ {
+ return (T) textBuilder.append(noTimeUsedIndicator).append(' ').append(minConsolidationUnit.name().toLowerCase(Locale.ENGLISH));
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return textBuilder;
+ }
+}
diff --git a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/admin_command_access_rights.sql b/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/admin_command_access_rights.sql
index 6017cc40ab..4e1a433bcb 100644
--- a/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/admin_command_access_rights.sql
+++ b/L2J_Mobius_C6_Interlude/dist/db_installer/sql/game/admin_command_access_rights.sql
@@ -217,8 +217,11 @@ INSERT IGNORE INTO `admin_command_access_rights` VALUES
('admin_bighead','3'),
('admin_shrinkhead','3'),
('admin_gmspeed','3'),
-('admin_gmspeed_menu','3'),
-('admin_gmspeed_menu_main','3'),
+('admin_superhaste','3'),
+('admin_superhaste_menu','3'),
+('admin_speed','3'),
+('admin_speed_menu','3'),
+('admin_hide','3'),
('admin_unpara_all','3'),
('admin_para_all','3'),
('admin_unpara','3'),
diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/main/access.ini b/L2J_Mobius_C6_Interlude/dist/game/config/main/access.ini
index 88c7155340..a7097ee797 100644
--- a/L2J_Mobius_C6_Interlude/dist/game/config/main/access.ini
+++ b/L2J_Mobius_C6_Interlude/dist/game/config/main/access.ini
@@ -19,10 +19,10 @@ MasterAccessLevel = 1
# Default = 0 - Max. 255
UserAccessLevel = 0
-# -----------------------------------
-# Section: GM'S Rights
-# -----------------------------------
-# # The way //admin panel looks can be "modern" or "classic"
+# --------------------------------------
+# Section: GM Rights
+# --------------------------------------
+# The way //admin panel looks can be "modern" or "classic"
# (default is modern while classic provides more compatibility)
GMAdminMenuStyle = modern
@@ -32,7 +32,7 @@ MasterNameColorEnabled = True
# This option will set the Default NameColor for MasterAccess
MasterNameColor = 00CCFF
-#Turn on MasterTitleColor config.
+# Turn on MasterTitleColor config.
MasterTitleColorEnabled = True
# This option will set the Default TitleColor for MasterAccess
@@ -41,6 +41,10 @@ MasterTitleColor = 00CCFF
# Enable GMs to have the glowing aura of a Hero character.
GMHeroAura = False
+# Whether GM logins in builder hide mode by default.
+# Default: True
+GMStartupBuilderHide = True
+
# Show message when GM Login and GM will not invis/silence as default
ShowGMLogin = False
@@ -63,5 +67,10 @@ GMStartupSilence = False
# Auto list GMs in GM list (/gmlist) on login.
GMStartupAutoList = True
-# # Auto set invulnerable status to a GM on login.
-GMStartupInvulnerable = True
\ No newline at end of file
+# Auto set invulnerable status to a GM on login.
+GMStartupInvulnerable = True
+
+# In case you are not satisfied with the retail-like implementation of //gmspeed",
+# with this config you can rollback it to the old custom L2J version of the GM Speed.
+# Default: False
+UseSuperHasteAsGMSpeed = False
diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/html/admin/main_menu.htm b/L2J_Mobius_C6_Interlude/dist/game/data/html/admin/main_menu.htm
index 0004442056..28be9a610a 100644
--- a/L2J_Mobius_C6_Interlude/dist/game/data/html/admin/main_menu.htm
+++ b/L2J_Mobius_C6_Interlude/dist/game/data/html/admin/main_menu.htm
@@ -62,11 +62,11 @@