Addition of custom ChangePlayerName bypass.
This commit is contained in:
		
							
								
								
									
										86
									
								
								L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/help/23622.htm
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								L2J_Mobius_4.0_GrandCrusade/dist/game/data/html/help/23622.htm
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,86 @@ | ||||
| <html noscrollbar> | ||||
| <title>Name Change Ticket</title> | ||||
| <body> | ||||
| 	<table border=0 cellpadding=1 cellspacing=1 width=292 height=358 background="l2ui_ct1.Windows_DF_TooltipBG"> | ||||
| 		<tr> | ||||
| 			<td valign="top"> | ||||
| 				<table width=290 height=355> | ||||
| 					<tr> | ||||
| 						<td height=20 valign="top" align="center" width=150 background="l2ui_ct1.Windows_DF_TooltipBG"> | ||||
| 							<table border=0 width=285> | ||||
| 								<tr> | ||||
| 									<td height=20 align=center> | ||||
| 										<font color=E75E02>Change Player Name</font> | ||||
| 									</td> | ||||
| 								</tr> | ||||
| 							</table> | ||||
| 							<table border=0 width=285 bgcolor=444444> | ||||
| 								<tr> | ||||
| 									<td valign="center" align="right" width="76" height="24"> | ||||
| 										<table cellspacing="1" cellpadding="1" width="16"> | ||||
| 											<tr> | ||||
| 												<td width="20" height="16"> | ||||
| 													<img src="l2ui_ch3.shortcut_joypad2_down" width="16" height="16"/> | ||||
| 												</td> | ||||
| 											</tr> | ||||
| 										</table> | ||||
| 									</td> | ||||
| 									<td valign="center" align="center" width="20"> | ||||
| 										<font color=CCCC33>Enter new name bellow</font> | ||||
| 									</td> | ||||
| 									<td valign="center" align="left" width="76" height="24"> | ||||
| 										<table cellspacing="1" cellpadding="1" width="16"> | ||||
| 											<tr> | ||||
| 												<td width="20" height="16"> | ||||
| 													<img src="l2ui_ch3.shortcut_joypad2_down" width="16" height="16"/> | ||||
| 												</td> | ||||
| 											</tr> | ||||
| 										</table> | ||||
| 									</td> | ||||
| 								</tr> | ||||
| 							</table> | ||||
| 							<table border=0 width=285 bgcolor=444444> | ||||
| 								<tr> | ||||
| 									<td valign="top" align="right" width="20"> | ||||
| 										<table cellspacing="1" cellpadding="1" width="1"> | ||||
| 											<tr> | ||||
| 												<td width="20" height="22"> | ||||
| 													<img src="l2ui_ch3.shortcut_minimizev_down" width="16" height="16"/> | ||||
| 												</td> | ||||
| 											</tr> | ||||
| 										</table> | ||||
| 									</td> | ||||
| 									<td valign="top" align="center" width="200" height=1> | ||||
| 										<edit var="name" type="numer" width="200" height="12" length="25"> | ||||
| 									</td> | ||||
| 									<td valign="top" align="left" width="20"> | ||||
| 										<table cellspacing="1" cellpadding="1" width="1"> | ||||
| 											<tr> | ||||
| 												<td width="20" height="18"> | ||||
| 													<img src="l2ui_ch3.shortcut_expandv_down" width="16" height="16"/> | ||||
| 												</td> | ||||
| 											</tr> | ||||
| 										</table> | ||||
| 									</td> | ||||
| 								</tr> | ||||
| 								<tr> | ||||
| 									<td></td> | ||||
| 									<td valign="top" align="center" width="20"> | ||||
| 										<button value="Change" action="bypass -h ChangePlayerName $name" width=64 height=22 back="l2ui_ch3.chatting_tab1" fore="l2ui_ch3.chatting_tab2"> | ||||
| 						 | ||||
| 									</td> | ||||
| 									<td></td> | ||||
| 								</tr> | ||||
| 							</table> | ||||
| 							<table border=0 height=26 width=283 bgcolor=444444> | ||||
| 								<tr> | ||||
| 									<td width=285><br></td> | ||||
| 								</tr> | ||||
| 							</table> | ||||
| 						</td> | ||||
| 					</tr> | ||||
| 				</table> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 	</table> | ||||
| </body></html> | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
							
								
								
									
										103
									
								
								L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/ChangePlayerName.java
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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 <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 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; | ||||
| 	} | ||||
| } | ||||
| @@ -414,10 +414,10 @@ | ||||
| 		<set name="is_dropable" val="false" /> | ||||
| 		<set name="is_destroyable" val="false" /> | ||||
| 		<set name="is_sellable" val="false" /> | ||||
| 		<set name="handler" val="ChangeCharacterNameItem" /> | ||||
| 		<set name="handler" val="Book" /> | ||||
| 		<set name="is_commissionable" val="false" /> | ||||
| 		<set name="is_private_storeable" val="false" /> | ||||
| 		<set name="default_action" val="CAPSULE" /> | ||||
| 		<set name="default_action" val="SHOW_HTML" /> | ||||
| 		<set name="is_stackable" val="true" /> | ||||
| 	</item> | ||||
| 	<item id="23623" name="Gender Change Ticket" type="EtcItem"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment