Jump to content

[Share]Extended Online Command


Recommended Posts

Hello.today i decide to create something usefull and i create extended online command.

when you type .online

you can see

online players

online good players and evil players(if you have GvE system)

online hero players

online noblesse players

online donator players.

Credits to me.

 

Index: lt/equal/gameserver/handler/voicedcommandhandlers/OnlinePlayers.java
===================================================================
--- lt/equal/gameserver/handler/voicedcommandhandlers/OnlinePlayers.java	(revision 68)
+++ lt/equal/gameserver/handler/voicedcommandhandlers/OnlinePlayers.java	(working copy)
@@ -1,6 +1,7 @@
package lt.equal.gameserver.handler.voicedcommandhandlers;

import java.sql.PreparedStatement;
+import lt.equal.Config;
import lt.equal.L2DatabaseFactory;
import lt.equal.gameserver.network.L2GameClient;
import lt.equal.gameserver.handler.IVoicedCommandHandler;
@@ -20,6 +21,14 @@
		if(command.equals("online"))
		{
			activeChar.sendMessage("Online Players: " + L2World.getInstance().getAllPlayersCount());
+			if (Config.MOD_GVE_ENABLE_FACTION)
+			{
+			activeChar.sendMessage("Good Players: " + L2World.getInstance().getAllgoodPlayersCount());
+			activeChar.sendMessage("Evil Players: " + L2World.getInstance().getAllevilPlayersCount());
+			}
+			activeChar.sendMessage("Hero Players: " + L2World.getInstance().getAllheroPlayersCount());
+			activeChar.sendMessage("Noblesse Players: " + L2World.getInstance().getAllnoblesPlayersCount());
+			activeChar.sendMessage("Donator Players: " + L2World.getInstance().getAlldonatorPlayersCount());
		}
		return true;
	}
Index: lt/equal/gameserver/model/L2World.java
===================================================================
--- lt/equal/gameserver/model/L2World.java	(revision 68)
+++ lt/equal/gameserver/model/L2World.java	(working copy)
@@ -65,6 +65,9 @@
	private Map<String, L2PcInstance> _allPlayers;
	private Map<String, L2PcInstance> _allgoodPlayers;
	private Map<String, L2PcInstance> _allevilPlayers;
+	private Map<String, L2PcInstance> _allheroPlayers;
+	private Map<String, L2PcInstance> _allnoblesPlayers;	
+	private Map<String, L2PcInstance> _alldonatorPlayers;	

	/** L2ObjectHashMap(L2Object) containing all visible objects */
	private L2ObjectMap<L2Object> _allObjects;
@@ -86,6 +89,9 @@
		_allPlayers = new FastMap<String, L2PcInstance>().setShared(true);
		_allgoodPlayers = new FastMap<String, L2PcInstance>().setShared(true);
		_allevilPlayers = new FastMap<String, L2PcInstance>().setShared(true);
+		_allheroPlayers = new FastMap<String, L2PcInstance>().setShared(true);	
+		_allnoblesPlayers = new FastMap<String, L2PcInstance>().setShared(true);
+		_alldonatorPlayers = new FastMap<String, L2PcInstance>().setShared(true);		
		_petsInstance = new FastMap<Integer, L2PetInstance>().setShared(true);
		_allObjects = L2ObjectMap.createL2ObjectMap();

@@ -248,7 +254,22 @@
	{
		return _allevilPlayers.values();
	}
+	
+	public Collection<L2PcInstance> getAllheroPlayers()
+	{
+		return _allheroPlayers.values();
+	}

+	public Collection<L2PcInstance> getAllnoblesPlayers()
+	{
+		return _allnoblesPlayers.values();
+	}
+
+	public Collection<L2PcInstance> getAlldonatorPlayers()
+	{
+		return _alldonatorPlayers.values();
+	}	
+
	/**
	 * Return how many players are online.<BR>
	 * <BR>
@@ -269,7 +290,22 @@
	{
		return _allevilPlayers.size();
	}
+	
+	public int getAllheroPlayersCount()
+	{
+		return _allheroPlayers.size();
+	}

+	public int getAllnoblesPlayersCount()
+	{
+		return _allnoblesPlayers.size();
+	}
+
+	public int getAlldonatorPlayersCount()
+	{
+		return _alldonatorPlayers.size();
+	}	
+
	/**
	 * Return the player instance corresponding to the given name.<BR>
	 * <BR>
@@ -419,6 +455,14 @@
					_allevilPlayers.put(player.getName().toLowerCase(), player);
			}
			_allPlayers.put(player.getName().toLowerCase(), player);
+				if (((L2PcInstance) object).isHero())
+					_allheroPlayers.put(player.getName().toLowerCase(), player);	
+
+				if (((L2PcInstance) object).isNoble())
+					_allnoblesPlayers.put(player.getName().toLowerCase(), player);
+
+				if (((L2PcInstance) object).isDonator())
+					_alldonatorPlayers.put(player.getName().toLowerCase(), player);					
		}

		// Get all visible objects contained in the _visibleObjects of L2WorldRegions

Link to comment
Share on other sites

The only thing among these that is in L2J by default is the Hero.

Do you expect us all to have your source, where everything else is defined as well?

Link to comment
Share on other sites

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