Jump to content

Recommended Posts

Posted

So I've been receiving pms this week on how to do a voicedcommand with a textbuilder html so I decide to do this rlly quick on l2jfrozen its pretty basic idea atm but you could just extend it i just leave it like this in order to ppl add their own stuff.

 

### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer
Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/HtmCmd.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/HtmCmd.java	(revision 0)
+++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/HtmCmd.java	(revision 0)
@@ -0,0 +1,153 @@
+package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
+
+
+import javolution.text.TextBuilder;
+
+
+import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
+import com.l2jfrozen.gameserver.model.L2World;
+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jfrozen.gameserver.network.SystemMessageId;
+import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
+
+
+/*
+ * @Author Mhoska
+ */
+
+
+public class HtmCmd
+implements IVoicedCommandHandler
+{
+private static final String[] VOICED_COMMANDS = 
+{ 
+	"menu", 
+	"mhoska_menu_"
+};
+
+
+@Override
+public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+{
+  if (command.equalsIgnoreCase("menu"))
+  {
+    showHtm(activeChar);
+  }
+  else if (command.startsWith("mhoska_menu_"))
+  {
+    String addcmd = command.substring(12).trim();
+        	 if (addcmd.startsWith("trade"))
+             {
+                 int flag = Integer.parseInt(addcmd.substring(5).trim());
+                 if (flag == 0)
+                 {
+                         activeChar.setExchangeRefusal(false);
+                     activeChar.sendMessage("You can receive trade invitations now");
+                 }
+                 else 
+                 {
+                         activeChar.setExchangeRefusal(true);
+                     activeChar.sendMessage("You cant receive trade invitations again");
+                 }
+                 showHtm(activeChar);
+                 return true;
+             }
+               
+             if (addcmd.startsWith("pm"))
+             {
+                 int flag = Integer.parseInt(addcmd.substring(2).trim());
+                 if (flag == 0)
+                 {
+                  activeChar.setMessageRefusal(false);
+                  activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_ACCEPTANCE_MODE));
+                 }
+                 else
+                 {
+                 activeChar.setMessageRefusal(true);
+                 activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_REFUSAL_MODE));
+                 }
+                 showHtm(activeChar);
+                 return true;
+             }
+
+        }
+return false; 
+    } 
+
+    	private void showHtm(L2PcInstance activeChar)
+    	  {    
+                NpcHtmlMessage MhoskaInfo = new NpcHtmlMessage(activeChar.getLastQuestNpcObject());
+                TextBuilder Mhoska = new TextBuilder("<html><body>");		
+				//htm start from here i just didnt decide what am i doing yet.				
+                Mhoska.append("<html><head><title>L2JHidden Menu v1</title></head><body>");
+                //elfo's part of the htm
+				Mhoska.append("<center>");
+				Mhoska.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
+				Mhoska.append("<tr>");
+				Mhoska.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
+				Mhoska.append("<td valign=\"top\"><font color=\"FF6600\">Menu</font>");
+				Mhoska.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, Welcome there are %online% online players at the moment.</td>");
+				Mhoska.append("</tr>");
+				Mhoska.append("</table>");
+				//ends here.
+				Mhoska.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center><br>");
+				Mhoska.append("</center>");
+				Mhoska.append("<br1>");
+				Mhoska.append("<table bgcolor=\"000000\">");
+				//tr that opens gotta clsoe
+				Mhoska.append("<tr>");
+				Mhoska.append("<td width=5></td>");
+				Mhoska.append("<td width=150>Trade Refusal:</td>");
+				Mhoska.append("<td width=30>%trade%</td>");
+				Mhoska.append("<td width=35><button width=35 height=15 back=\"sek.cbui94\" fore=\"sek.cbui94\" action=\"bypass -h mhoska_menu_trade 0\" value=\"ON\"></td>");
+				Mhoska.append("<td width=35><button width=35 height=15 back=\"sek.cbui94\" fore=\"sek.cbui94\" action=\"bypass -h mhoska_menu_trade 1\" value=\"OFF\"></td>");
+				Mhoska.append("</tr>");
+				//tr that opens gotta close.
+				Mhoska.append("<tr>");
+				Mhoska.append("<td width=5></td>");
+				Mhoska.append("<td width=150>Msg Refusal:</td>");
+				Mhoska.append("<td width=30>%pm%</td>");
+				Mhoska.append("<td width=35><button width=35 height=15 back=\"sek.cbui94\" fore=\"sek.cbui94\" action=\"bypass -h mhoska_menu_pm 0\" value=\"ON\"></td>");
+				Mhoska.append("<td width=35><button width=35 height=15 back=\"sek.cbui94\" fore=\"sek.cbui94\" action=\"bypass -h mhoska_menu_pm 1\" value=\"OFF\"></td>");
+				Mhoska.append("</tr>");
+				Mhoska.append("<br1>");
+				Mhoska.append("</table bgcolor=\"000000\">");
+				Mhoska.append("<br1>");
+				Mhoska.append("<center>");
+				Mhoska.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center>");
+				Mhoska.append("<font color=\"FF6600\">L2JHidden</font>");
+				Mhoska.append("</center>");
+				Mhoska.append("</body></html>");
+                MhoskaInfo.setHtml(Mhoska.toString());
+                activeChar.sendPacket(MhoskaInfo);
+                
+                L2World.getInstance();
+                int whoisonline = L2World.getAllPlayersCount();
+                String online = Integer.toString(whoisonline);
+                MhoskaInfo.replace("%online%", online );
+                
+                if (activeChar.getExchangeRefusal())
+                {
+                                MhoskaInfo.replace("%trade%", "OFF");
+                }
+                else
+                        {
+                                MhoskaInfo.replace("%trade%", "ON");
+                        }
+                if (activeChar.getMessageRefusal())
+                        {
+                                MhoskaInfo.replace("%pm%", "OFF");
+                        }
+                else
+                        {
+                                MhoskaInfo.replace("%pm%", "ON");
+                        }                
+		                       
+		  }		
+    @Override
+	public String[] getVoicedCommandList()
+    {
+        return VOICED_COMMANDS;
+    }
+}   
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java	(revision 952)
+++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java	(working copy)
@@ -28,8 +28,11 @@
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.AwayCmd;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.BankingCmd;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.CTFCmd;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.DMCmd;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.FarmPvpCmd;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.HtmCmd;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.StatsCmd;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.TvTCmd;
@@ -113,6 +116,12 @@
			registerVoicedCommandHandler(new Online());
		}

+		registerVoicedCommandHandler(new HtmCmd());

		_log.config("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");

	}
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java	(revision 952)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java	(working copy)
@@ -27,6 +27,8 @@
import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights;
import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
+import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
+import com.l2jfrozen.gameserver.handler.VoicedCommandHandler;
import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
import com.l2jfrozen.gameserver.model.L2Object;
import com.l2jfrozen.gameserver.model.L2World;
@@ -124,6 +126,7 @@
			{
				playerHelp(activeChar, _command.substring(12));
			}
+			
			else if(_command.startsWith("npc_"))
			{
				if(!activeChar.validateBypass(_command))
@@ -286,6 +289,11 @@
			{
				CommunityBoard.getInstance().handleCommands(getClient(), _command);
			}
+			else if (_command.startsWith("mhoska_menu_"))
+            {
+          IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler("mhoska_menu_");
+              vch.useVoicedCommand(_command, activeChar, null);
+            }
			else if(_command.startsWith("Quest "))
			{
				if(!activeChar.validateBypass(_command))

 

some ss

 

zb1SK.png

 

if anyone wants to add something else just try it and ill help you guys, i just want you to learn something, not to have everything done and just c/p the code.

 

credits: To me, and elfocrash cos I just steel part of his html troll.

Guest Elfocrash
Posted

Hahaha 95% of the shares after my vote system have it's html structure.

I am flattered huh

Posted

Hahaha 95% of the shares after my vote system have it's html structure.

I am flattered huh

 

its the only html I kinda like on interlude cos html suck in interlude.

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...