Jump to content

Recommended Posts

Posted

Howdy,i'm here to share something today.

I know showing online player count to html page is useless but hey its just an idea :D

Have Fun.

 

Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 4652)
+++ java/config/l2jmods.properties	(working copy)
@@ -348,6 +348,9 @@
# variables: $killer, $target
AnnouncePvpMsg = $killer has defeated $target

+# Show online players vcmd
+# Default: False
+ShowOnlinePlayers = False

# ---------------------------------------------------------------------------
# Chat Moderation
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java	(revision 4652)
+++ java/com/l2jserver/Config.java	(working copy)
@@ -1018,6 +1018,8 @@
	//chatfilter
	public static ArrayList<String>	FILTER_LIST;

+	public static boolean SHOW_ONLINE_PLAYERS;
+	
	/**
	 * This class initializes all global variables for configuration.<br>
	 * If the key doesn't appear in properties file, a default value is set by this class.
@@ -2442,6 +2444,7 @@
					ANNOUNCE_PK_MSG = L2JModSettings.getProperty("AnnouncePkMsg", "$killer has slaughtered $target");
					ANNOUNCE_PVP_MSG = L2JModSettings.getProperty("AnnouncePvpMsg", "$killer has defeated $target");

+					SHOW_ONLINE_PLAYERS = Boolean.parseBoolean(L2JModSettings.getProperty("ShowOnlinePlayers","False"));
					L2JMOD_CHAT_ADMIN = Boolean.parseBoolean(L2JModSettings.getProperty("ChatAdmin", "false"));

					L2JMOD_MULTILANG_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("MultiLangEnable", "false"));
#P L2J_DataPack
Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java	(revision 8046)
+++ data/scripts/handlers/MasterHandler.java	(working copy)
@@ -245,6 +245,7 @@
import handlers.voicedcommandhandlers.ChatAdmin;
import handlers.voicedcommandhandlers.Debug;
import handlers.voicedcommandhandlers.Lang;
+import handlers.voicedcommandhandlers.Online;
import handlers.voicedcommandhandlers.TvTVoicedInfo;
import handlers.voicedcommandhandlers.Wedding;
import handlers.voicedcommandhandlers.stats;
@@ -546,6 +547,8 @@
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Banking());
		if (Config.TVT_ALLOW_VOICED_COMMAND)
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new TvTVoicedInfo());
+		if (Config.SHOW_ONLINE_PLAYERS)
+			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Online());
		if (Config.L2JMOD_CHAT_ADMIN)
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new ChatAdmin());
		if (Config.L2JMOD_MULTILANG_ENABLE && Config.L2JMOD_MULTILANG_VOICED_ALLOW)
Index: data/html/mods/online/OnlineStatus.htm
===================================================================
--- data/html/mods/online/OnlineStatus.htm	(revision 0)
+++ data/html/mods/online/OnlineStatus.htm	(revision 0)
@@ -0,0 +1,4 @@
+<html><title>Online players status</title>
+<body><center>There are %playernumber% players online.<br>
+<font color="333333">by Voqus</font><br>
+<button value="Exit" action="bypass -h Close" width=45 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_ct1.button_df">
+</center></body></html>
Index: data/scripts/handlers/voicedcommandhandlers/Online.java
===================================================================
--- data/scripts/handlers/voicedcommandhandlers/Online.java	(revision 0)
+++ data/scripts/handlers/voicedcommandhandlers/Online.java	(revision 0)
@@ -0,0 +1,44 @@
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.cache.HtmCache;
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+
+/**
+ * @author Voqus
+ */
+
+public class Online implements IVoicedCommandHandler
+{
+	public static final String[] VOICED_COMMANDS = { "online" };
+
+	private static final boolean USE_STATIC_HTML = true;
+	private static final String HTML_LINK = HtmCache.getInstance().getHtm(null, "data/html/mods/online/OnlineStatus.htm");
+	
+	public boolean useVoicedCommand(String command, L2PcInstance player, String params)
+	{
+		String htmContent = (USE_STATIC_HTML && !HTML_LINK.isEmpty()) ? HTML_LINK :
+		HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/mods/online/OnlineStatus.htm");
+		
+		if(command.equalsIgnoreCase("online"))
+		{
+			NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
+			
+			npcHtmlMessage.setHtml(htmContent);
+			npcHtmlMessage.replace("%playernumber%", String.valueOf(L2World.getInstance().getAllPlayers().size()));
+			player.sendPacket(npcHtmlMessage);
+			}
+			else
+			{
+				player.sendPacket(ActionFailed.STATIC_PACKET);
+			}
+		return true;
+	}
+	
+	public String[] getVoicedCommandList()
+	{
+		return VOICED_COMMANDS;
+	}
+}

 

Credits: me

Posted

good job mate but it is uselless :>

 

Is not useless, if you want to see the players online without the community board because it makes lag, so, thats a light code who dont make lag and its useful for me. Any1 haves a different way to use it.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Hello everyone, I am looking to purchase a Premium Lineage 2 High Five server pack. My main requirements are: Stability & Quality (Most Important): The pack must be highly stable with no system errors or major bugs. Custom Features: It must include ready-to-use custom features such as a fully functional Community Board, custom NPC Buffers, and Custom Item Sellers (GM Shops), etc. Complete Files: It is absolutely necessary that the full source code (src) and complete Geodata are included. If you are selling a pack that meets these criteria, please send me a PM or leave a reply with the following information: Brief details and key features of the pack Price Test server availability (I would like to test it before buying) Thank you!
    • L2jmobiusDevClon — Classic Interlude p110 Emulator L2jmobiusDevClon is actively developing a Lineage 2 Classic Interlude p110 emulator. Development is done in free time with a strong focus on: • Stability • Authentic Classic mechanics • Clean and optimized architecture The project is based on the L2jMobius source and is continuously evolving and improving. System Requirements: • Java 25 • MariaDB 12.0 • Client p110 Current Revision: 3.0 Development Status: Active Distribution: Free Official Website: https://www.l2jmobiusdevclon.pp.ua Discord Server: https://discord.gg/23a9S8g4Bn Contact: Telegram — @L2jmobiusDevClon Also available via private messages Project Goals: ✔ Improved stability ✔ Maximum Classic accuracy ✔ Core optimization We are currently looking for: • Testers • Server administrators Suggestions, bug reports, and ideas are always welcome. Contact us via: ✔ Discord ✔ Telegram ✔ Private Messages
    • i guess loading only the effects that are needed it will maybe work, like removing from reshade shader folder the ones that are not needed, depends on the pc also i guess, also limithing the game at 30fps can be better maybe
    • Up   SELL CHARACTERS L2 REBORN FRANZ x1     destroyer 74 lvl naked - 120 euro sws 71 lvl naked - 120 euro pp 66 skills - 120 euro se 64 lvl - 90 euro   Characters are legit with mail   i can wtt the characters for adena server franz   sell adena franz 250kk stock     add discord topeseller4081  
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..