Jump to content

Recommended Posts

Posted

New Away + Back Command System. Is really simple and nice.

 

How it works:

Version 1: When you type .away: You get a Green title " *Away * ", this commands also informs the players that you are away , also it costs 500Milion. Just to avoid spam

 

Version 2: Added Some useful protections. Changed Announcements text + Message to player.

 

Version 1: When you type .back: Away title is removed, also this command " .back " informs the players that you are back .back is free.

 

Version 2: Added Some useful protections. Changed Announcements text + Message to player.

 

 

Patch:

Version 2.

### Eclipse Workspace Patch 1.0
#P L2JEclipse-Private
Index: trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/away.java
===================================================================
--- trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/away.java	(revision 0)
+++ trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/away.java	(revision 0)
@@ -0,0 +1,114 @@
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+public class away implements IVoicedCommandHandler
+{
+    private static final String[] VOICED_COMMANDS = { "away", "back" };
+
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+    {
+        if (command.equalsIgnoreCase("away"))
+        {
+            else if(activeChar.isInJail())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in Jail!");
+                return false;
+            }
+            else if(activeChar.isInOlympiadMode())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the Olympiad now.");
+                return false;
+            }
+            else if(activeChar.atEvent)
+            {
+                activeChar.sendMessage("You cannot use this command while you are in an event.");
+                return false;
+            }
+            else  if (activeChar.isInDuel())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a duel!");
+                return false;
+            }
+            else if (activeChar.inObserverMode())
+            {
+               activeChar.sendMessage("You cannot use this command while you are in Observer Mode.");
+            }
+            else if (activeChar.isFestivalParticipant())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a festival.");
+                return false;
+            }
+            else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the dimensional rift.");
+                return false;
+            }
+            
+        	if(activeChar.getInventory().getItemByItemId(57) != null && activeChar.getInventory().getItemByItemId(57).getCount() >= 500000000)
+            {
+            activeChar.getInventory().destroyItemByItemId("Away", 57, 500000000, activeChar, activeChar.getTarget());
+			Announcements.getInstance().announceToAll("AWAY: " + activeChar + " is away");
+            activeChar.sendMessage("You are away from keyboard, 500Milion adena dissapeared, players informed.");
+            activeChar.getAppearance().setTitleColor(0xFF000);
+            activeChar.setTitle("*Away*"); // Title text when somebody is away.
+            activeChar.broadcastUserInfo();
+            }
+        }
+    
+        else
+        	
+        if (command.equalsIgnoreCase("back"))
+        {
+            else if(activeChar.isInJail())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in Jail!");
+                return false;
+            }
+            else if(activeChar.isInOlympiadMode())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the Olympiad now.");
+                return false;
+            }
+            else if(activeChar.atEvent)
+            {
+                activeChar.sendMessage("You cannot use this command while you are in an event.");
+                return false;
+            }
+            else  if (activeChar.isInDuel())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a duel!");
+                return false;
+            }
+            else if (activeChar.inObserverMode())
+            {
+               activeChar.sendMessage("You cannot use this command while you are in Observer Mode.");
+            }
+            else if (activeChar.isFestivalParticipant())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a festival.");
+                return false;
+            }
+            else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the dimensional rift.");
+                return false;
+            }
+            
+            Announcements.getInstance().announceToAll("BACK: " + activeChar + " is back.");
+            activeChar.sendMessage("You are back. Players informed.");
+            activeChar.setTitle(" ");
+            activeChar.broadcastUserInfo();
+        }
+        return true;
+         		
+    }
+    
+    public String[] getVoicedCommandList()
+    {
+        return VOICED_COMMANDS;
+    }
+
+}
\ No newline at end of file
Index: trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java	(revision 223)
+++ trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -199,6 +199,7 @@
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.TvT;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.trade;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.pm;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.away;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Info;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Cl;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.karma;
@@ -616,6 +617,7 @@
       
       _voicedCommandHandler.registerVoicedCommandHandler(new karma());

+       _voicedCommandHandler.registerVoicedCommandHandler(new away());
                
		_log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");

 

Credits: ehh me.

  • 1 year later...
Posted

you should delete: Announcements.getInstance().announceToAll("BACK: " + activeChar + " is back.");

and add to chatPM.java or something like that code that will not allow to pm players which are away

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...