Jump to content

[Share]5k entering pms topics solution.


Recommended Posts

Hi everyone. I hope this will be some kind of 'solution' to 5k++ topics of entering pms.

 

I wonder why ppl hate maps. They give the admin much more options.

 

Anyway... Here:

 

Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(revision 126)
+++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java	(working copy)
@@ -18,6 +18,7 @@
 */
package net.sf.l2j.gameserver.network.clientpackets;

+import java.util.Set;
import java.util.logging.Logger;

import net.sf.l2j.Config;
@@ -48,6 +49,7 @@
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;
import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
import net.sf.l2j.gameserver.network.serverpackets.Die;
import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
@@ -262,6 +264,16 @@
				&& (!activeChar.isInSiege() || activeChar.getSiegeState() < 2) 
				&& activeChar.isInsideZone(L2Character.ZONE_SIEGE))
			activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+		
+		if (Config.ALLOW_ENTER_PMS)
+		{
+			Set<String> epks = Config.ENTER_PMS.keySet();
+			for (String i : epks)
+			{
+				CreatureSay cs = new CreatureSay(0, Config.ENTER_PMS_SYSTEM, Config.ENTER_PMS.get(i), i);
+				activeChar.sendPacket(cs);
+			}
+		}
	}

    private void engage(L2PcInstance cha)
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 126)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -29,11 +29,13 @@
import java.math.BigInteger;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.logging.Logger;

import javolution.util.FastList;
+import javolution.util.FastMap;
import net.sf.l2j.util.StringUtil;

/**
@@ -443,6 +445,11 @@
    /** Buffs */
    public static boolean STORE_SKILL_COOLTIME;
    public static byte BUFFS_MAX_AMOUNT;
+    
+    /** Entering pms */
+    public static boolean ALLOW_ENTER_PMS;
+    public static int ENTER_PMS_SYSTEM;
+    public static Map<String, String> ENTER_PMS = new FastMap<String, String>();

    //--------------------------------------------------
	// Server
@@ -1147,6 +1154,16 @@
                
    	        BUFFS_MAX_AMOUNT = Byte.parseByte(players.getProperty("MaxBuffsAmount","20"));
    	        STORE_SKILL_COOLTIME = Boolean.parseBoolean(players.getProperty("StoreSkillCooltime", "true"));
+    	        
+    	        ALLOW_ENTER_PMS = Boolean.parseBoolean(players.getProperty("AllowEnterPms", "false"));
+    	        ENTER_PMS_SYSTEM = Integer.parseInt(players.getProperty("EnterPmsSystem", "0"));
+    	        String enter_pms = players.getProperty("EnterPms", "Welcome to L2 Server!,L2Server;Don't forget to vote.,L2Server;");
+    	        String[] enter_pms_splitted_1 = enter_pms.split(";");
+    	        for (String i : enter_pms_splitted_1)
+    	        {
+    	        	String eps2[] = i.split(",");
+    	        	ENTER_PMS.put(eps2[0], eps2[1]);
+    	        }
            }
            catch (Exception e)
            {
Index: config/players.properties
===================================================================
--- config/players.properties	(revision 126)
+++ config/players.properties	(working copy)
@@ -310,4 +310,17 @@
MaxBuffsAmount = 20

# Store buffs/debuffs on user logout?
-StoreSkillCooltime = True
\ No newline at end of file
+StoreSkillCooltime = True
+
+#=============================================================
+#                        Entering pms
+#=============================================================
+# Allow entering pms?
+AllowEnterPms = False
+# Entering pms system.
+# Aka CreatureSay packet chat type.
+# Default: purple, pms' one.
+# Note: You can find them in Say2 file.
+EnterPmsSystem = 2
+# Entering pms(works like pm,name;pm,name;pm,name;).
+EnterPms = Welcome to L2 Server!,L2Server;Don't forget to vote.,L2Server;
\ No newline at end of file

 

Coded on aCis, credits to me.

 

It is not tested, but it should work.

Link to comment
Share on other sites

Stop being off-topic. I am still posting here, with the 'hope' that it will be reborned or something?

 

But anyway, i will fix it. It is dying not dead.

Yeah,you are the one who will reborn it,appreciate.

------------

 

This code isn't already shared?Just written on another way?

Btw hide it for some posts.

Link to comment
Share on other sites

Yeah,you are the one who will reborn it,appreciate.

------------

 

This code isn't already shared?Just written on another way?

Btw hide it for some posts.

Lol. Anyway.... I didn't say i will reborn it, but everyone can help.

 

Yes it's shared 5k times ++. But if you check the configs of my share, it's done in a different way, with map. So you can add as many pms as you want.

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