Flash™ Posted October 28, 2010 Posted October 28, 2010 My first share I made this Admin command handler that allows GM to make NPC say whatever they want, I Don't know if this already exist but I didn' t see it in the current datapack so I made one... Gracia Epilogue http://pastebin.com/ZziQ8aQx MasterHandler.java AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminZone()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminTownWar()); + AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminNpcChat()); _log.config("Loaded " + AdminCommandHandler.getInstance().size() + " AdminCommandHandlers"); } admin_command_access_rights.sql ('admin_townwar_end','1'), + +-- Npchat +('admin_npchat_menu','1'), +('admin_npchat','1'); AdminNpcChat.java /* * 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/>. * * @author Flash */ package handlers.admincommandhandlers; import com.l2jserver.gameserver.handler.IAdminCommandHandler; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.network.serverpackets.NpcSay; public class AdminNpcChat implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_npchat", "admin_npchat_menu" }; public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (command.startsWith("admin_npchat")) handleNPChat(command, activeChar); if (command.startsWith("admin_npchat_menu")) AdminHelpPage.showHelpPage(activeChar, "Npchat_menu.htm"); return true; } public String[] getAdminCommandList() { return ADMIN_COMMANDS; } /** * @param command * @param activeChar */ private void handleNPChat(String command, L2PcInstance activeChar) { try { L2Object target = activeChar.getTarget(); L2Npc npc = null; if (target instanceof L2Npc) { int offset = 0; npc = (L2Npc) target; int npcId = npc.getNpcId(); int npcObjId = npc.getObjectId(); String text; if (command.startsWith("admin_npchat_menu")) offset = 18; else offset = 13; text = command.substring(offset); npc.broadcastPacket(new NpcSay(npcObjId, 0, npcId, text)); } else { activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET)); return; } } catch (StringIndexOutOfBoundsException e) { // empty message.. ignore } } } Npchat_menu.htm <html> <title>NPC Says</title><body> Instructions:<br> Target the NPC and write whatever you want to make the NPC say. <br> <center>Text:<multiedit var="texto" width=250 height=50></center> <table width="160"> <tr> <td><center><button value="Say" action="bypass -h admin_npchat_menu $texto" width=80 height=21 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></center></td> </tr></table><br><br><br> </body> </html>
d0ds™ Posted October 28, 2010 Posted October 28, 2010 wow.. hmm.. its new also to me! btw thanks! ill download it for test!
MasterDisaster Posted October 28, 2010 Posted October 28, 2010 Hmm seems nice!However,ep is a leeching site so it would be better for you to change the topic!
Devangell™ Posted October 28, 2010 Posted October 28, 2010 wow amazing npc is very usefull i like it a lot and this gonna help lot of niewbes "admin"i like a lot your idea and for this u got +1 for ur work keep it :)
Matim Posted October 28, 2010 Posted October 28, 2010 Nice Share Flash Its For All Clients?? Is Java different for C4.. different for Interlude etc?
Flash™ Posted October 28, 2010 Author Posted October 28, 2010 this java code for Gracia Epilogue.. new update for IL :)
ArkeyWave Posted October 28, 2010 Posted October 28, 2010 this java code for Gracia Epilogue.. new update for IL :) yey ... so you will do it for IL? ^^ i'll be waiting for that ..
Stive Posted October 28, 2010 Posted October 28, 2010 can u put some images please? +1 i understand what you write but virtual ... i cant understand where is point
Malamandre Posted October 29, 2010 Posted October 29, 2010 Nice share!I like it!!I will use it for sure!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now