Răsfoiți Sursa

Show Screen Message update

Zoey76 5 ani în urmă
părinte
comite
0aec9d3405

+ 18 - 0
src/main/java/com/l2jserver/gameserver/model/events/AbstractScript.java

@@ -1434,6 +1434,24 @@ public abstract class AbstractScript implements INamable {
 		player.sendPacket(new ExShowScreenMessage(systemMsg, position, time, params));
 	}
 	
+	/**
+	 * Show an on-screen message to the player.
+	 * @param player the player to display the message to
+	 * @param msgPosType he position of the message on the screen
+	 * @param unk1 unknown value
+	 * @param fontSize font size (normal, small)
+	 * @param unk2 unknown value
+	 * @param unk3 unknown value
+	 * @param showEffect if {@true} then it will show an effect
+	 * @param time the duration of the message in milliseconds
+	 * @param fade if {@true} then it will fade
+	 * @param npcStringId the NPC string to display
+	 * @param params values of parameters to replace in the NPC String
+	 */
+	public static void showOnScreenMsgFStr(L2PcInstance player, int msgPosType, int unk1, int fontSize, int unk2, int unk3, boolean showEffect, int time, boolean fade, NpcStringId npcStringId, String... params) {
+		player.sendPacket(new ExShowScreenMessage(2, -1, msgPosType, unk1, fontSize, unk2, unk3, showEffect, time, fade, null, npcStringId, params));
+	}
+	
 	/**
 	 * Add a temporary spawn of the specified NPC.
 	 * @param npcId the ID of the NPC to spawn

+ 9 - 1
src/main/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java

@@ -27,6 +27,7 @@ import com.l2jserver.gameserver.network.SystemMessageId;
 /**
  * ExShowScreenMessage server packet implementation.
  * @author Kerberos
+ * @author Zoey76
  */
 public class ExShowScreenMessage extends L2GameServerPacket {
 	private final int _type;
@@ -51,6 +52,9 @@ public class ExShowScreenMessage extends L2GameServerPacket {
 	public static final byte MIDDLE_RIGHT = 0x06;
 	public static final byte BOTTOM_CENTER = 0x07;
 	public static final byte BOTTOM_RIGHT = 0x08;
+	// Sizes
+	public static final byte NORMAL_SIZE = 0x00;
+	public static final byte SMALL_SIZE = 0x01;
 	
 	/**
 	 * Display a String on the screen for a given time.
@@ -138,7 +142,7 @@ public class ExShowScreenMessage extends L2GameServerPacket {
 	 * @param npcString
 	 * @param params the String parameters
 	 */
-	public ExShowScreenMessage(int type, int messageId, int position, int unk1, int size, int unk2, int unk3, boolean showEffect, int time, boolean fade, String text, NpcStringId npcString, String params) {
+	public ExShowScreenMessage(int type, int messageId, int position, int unk1, int size, int unk2, int unk3, boolean showEffect, int time, boolean fade, String text, NpcStringId npcString, String... params) {
 		_type = type;
 		_sysMessageId = messageId;
 		_unk1 = unk1;
@@ -151,6 +155,10 @@ public class ExShowScreenMessage extends L2GameServerPacket {
 		_size = size;
 		_effect = showEffect;
 		_npcString = npcString.getId();
+		
+		if (params != null) {
+			addStringParameter(params);
+		}
 	}
 	
 	/**