diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/html/help/23622.htm b/L2J_Mobius_1.0_Ertheia/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java index ffbca0f466..79f665f020 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EventEngine; @@ -478,6 +479,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EventEngine.class, diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 7419dba226..63c8979743 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,9 +493,9 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { - BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists."); + BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; } player.setName(val); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/23600-23699.xml index 037756142f..23b5cd7678 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/html/help/23622.htm b/L2J_Mobius_2.5_Underground/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file 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 623a8fe781..fb87ddcf73 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 @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -479,6 +480,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 85258dbdf2..bd37d544e6 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,7 +493,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/23600-23699.xml index 037756142f..23b5cd7678 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - +
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/html/help/23622.htm b/L2J_Mobius_3.0_Helios/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file 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 e79dfa02e9..129e523d17 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 @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -480,6 +481,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 85258dbdf2..bd37d544e6 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,7 +493,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/23600-23699.xml index ca0bcc8d46..afb8fa09bc 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - +
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/help/23622.htm b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file 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 e79dfa02e9..129e523d17 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 @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -480,6 +481,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 85258dbdf2..bd37d544e6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,7 +493,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/23600-23699.xml index ca0bcc8d46..afb8fa09bc 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - +
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/html/help/23622.htm b/L2J_Mobius_5.0_Salvation/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java index e79dfa02e9..129e523d17 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -480,6 +481,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index e55ff54e42..d7cd3f6199 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,7 +493,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_5.0_Salvation/dist/game/data/stats/items/23600-23699.xml index cde53e73af..7100a65e03 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - +
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/help/23622.htm b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java index e79dfa02e9..129e523d17 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -480,6 +481,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index e55ff54e42..d7cd3f6199 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,7 +493,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/items/23600-23699.xml index 8a9b0cbc59..f31631aee4 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - +
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/html/help/23622.htm b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java index b14022fadb..98aaa1a028 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -481,6 +482,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index e55ff54e42..d7cd3f6199 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,7 +493,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..fef6c1e448 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/items/23600-23699.xml index 665f5f4064..79dd219dab 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - +
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/help/23622.htm b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java index b14022fadb..98aaa1a028 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java @@ -141,6 +141,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -481,6 +482,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index e55ff54e42..d7cd3f6199 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -493,7 +493,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/items/23600-23699.xml index 665f5f4064..79dd219dab 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/stats/items/23600-23699.xml @@ -414,10 +414,10 @@ - + - +
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index deb0a1df64..41b499a45e 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -480,7 +480,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index ffba4c3f38..ee8330b957 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -485,7 +485,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 59ec1817d1..0b195cd625 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -489,7 +489,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 59ec1817d1..0b195cd625 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -489,7 +489,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 9e20240672..c0acc69ca4 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -489,7 +489,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 9e20240672..c0acc69ca4 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -489,7 +489,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 9e20240672..c0acc69ca4 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -489,7 +489,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index d9219d69c4..1cf10d25b5 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -477,7 +477,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/html/help/23622.htm b/L2J_Mobius_Classic_Interlude/dist/game/data/html/help/23622.htm new file mode 100644 index 0000000000..608c632cf8 --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/html/help/23622.htm @@ -0,0 +1,86 @@ + +Name Change Ticket + + + + + +
+ + + + +
+ + + + +
+ Change Player Name +
+ + + + + + +
+ + + + +
+ +
+
+ Enter new name bellow + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + + + +
+ +
+
+ + + + + + +
+ +
+
+
+ + + + +

+
+
+ \ No newline at end of file diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java index 70216b9080..25d313137b 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java @@ -140,6 +140,7 @@ import handlers.admincommandhandlers.AdminZone; import handlers.admincommandhandlers.AdminZones; import handlers.bypasshandlers.Augment; import handlers.bypasshandlers.Buy; +import handlers.bypasshandlers.ChangePlayerName; import handlers.bypasshandlers.ChatLink; import handlers.bypasshandlers.ClanWarehouse; import handlers.bypasshandlers.EnsoulWindow; @@ -479,6 +480,7 @@ public class MasterHandler // Bypass Handlers Augment.class, Buy.class, + ChangePlayerName.class, ChatLink.class, ClanWarehouse.class, EnsoulWindow.class, diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 59ec1817d1..0b195cd625 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -489,7 +489,7 @@ public class AdminEditChar implements IAdminCommandHandler { return false; } - if (CharNameTable.getInstance().getIdByName(val) > 0) + if (CharNameTable.getInstance().doesCharNameExist(val)) { BuilderUtil.sendSysMessage(activeChar, "Warning, player " + val + " already exists"); return false; diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java new file mode 100644 index 0000000000..e1f7e2c7ea --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java @@ -0,0 +1,103 @@ +/* + * 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.bypasshandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import org.l2jmobius.gameserver.handler.IBypassHandler; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll; +import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll; +import org.l2jmobius.gameserver.util.Util; + +/** + * @author Mobius + */ +public class ChangePlayerName implements IBypassHandler +{ + private static final int NAME_CHANGE_TICKET = 23622; + + private static final String[] COMMANDS = + { + "ChangePlayerName" + }; + + @Override + public boolean useBypass(String command, PlayerInstance player, Creature target) + { + // Need to have at least one Name Change Ticket in order to proceed. + final PlayerInventory inventory = player.getInventory(); + if (inventory.getAllItemsByItemId(NAME_CHANGE_TICKET).isEmpty()) + { + return false; + } + + final String newName = command.split(" ")[1].trim(); + if (!Util.isAlphaNumeric(newName)) + { + player.sendMessage("Name must only contain alphanumeric characters."); + return false; + } + if (CharNameTable.getInstance().doesCharNameExist(newName)) + { + player.sendMessage("Name " + newName + " already exists."); + return false; + } + + // Destroy item. + player.destroyItemByItemId("ChangePlayerName", NAME_CHANGE_TICKET, 1, player, true); + + // Set name and proceed. + player.setName(newName); + if (Config.CACHE_CHAR_NAMES) + { + CharNameTable.getInstance().addName(player); + } + player.storeMe(); + + player.sendMessage("Your name has been changed."); + player.broadcastUserInfo(); + + if (player.isInParty()) + { + // Delete party window for other party members + player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET); + for (PlayerInstance member : player.getParty().getMembers()) + { + // And re-add + if (member != player) + { + member.sendPacket(new PartySmallWindowAll(member, player.getParty())); + } + } + } + if (player.getClan() != null) + { + player.getClan().broadcastClanStatus(); + } + + return true; + } + + @Override + public String[] getBypassList() + { + return COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/items/23600-23699.xml b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/items/23600-23699.xml index e1db9a8677..afb8fa09bc 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/items/23600-23699.xml +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/items/23600-23699.xml @@ -414,9 +414,10 @@ + - +
@@ -429,6 +430,7 @@ +