Skip to content

Instantly share code, notes, and snippets.

@St3eT
Created February 8, 2015 16:41
Show Gist options
  • Save St3eT/8d03db3b72e1647e3f1d to your computer and use it in GitHub Desktop.
Save St3eT/8d03db3b72e1647e3f1d to your computer and use it in GitHub Desktop.
Usefull methods for show effect in ExShowScreenMessage
diff --git a/L2J_Server/java/com/l2jserver/gameserver/model/events/AbstractScript.java b/L2J_Server/java/com/l2jserver/gameserver/model/events/AbstractScript.java
index 6cdb2ec..abfe642 100644
--- a/L2J_Server/java/com/l2jserver/gameserver/model/events/AbstractScript.java
+++ b/L2J_Server/java/com/l2jserver/gameserver/model/events/AbstractScript.java
@@ -1538,6 +1538,20 @@
/**
* Show an on screen message to the player.
* @param player the player to display the message to
+ * @param npcString the NPC string to display
+ * @param position the position of the message on the screen
+ * @param time the duration of the message in milliseconds
+ * @param showEffect the upper effect
+ * @param params values of parameters to replace in the NPC String (like S1, C1 etc.)
+ */
+ public static void showOnScreenMsg(L2PcInstance player, NpcStringId npcString, int position, int time, boolean showEffect, String... params)
+ {
+ player.sendPacket(new ExShowScreenMessage(npcString, position, time, showEffect, params));
+ }
+
+ /**
+ * Show an on screen message to the player.
+ * @param player the player to display the message to
* @param systemMsg the system message to display
* @param position the position of the message on the screen
* @param time the duration of the message in milliseconds
diff --git a/L2J_Server/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java b/L2J_Server/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java
index 02bc691..0fc634c 100644
--- a/L2J_Server/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java
+++ b/L2J_Server/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java
@@ -102,6 +102,34 @@
}
/**
+ * Display a NPC String on the screen for a given position and time.
+ * @param npcString the NPC String Id
+ * @param position the position on the screen
+ * @param time the display time
+ * @param showEffect upper effect
+ * @param params the String parameters
+ */
+ public ExShowScreenMessage(NpcStringId npcString, int position, int time, boolean showEffect, String... params)
+ {
+ _type = 2;
+ _sysMessageId = -1;
+ _unk1 = 0x00;
+ _unk2 = 0x00;
+ _unk3 = 0x00;
+ _fade = false;
+ _position = position;
+ _text = null;
+ _time = time;
+ _size = 0x00;
+ _effect = showEffect;
+ _npcString = npcString.getId();
+ if (params != null)
+ {
+ addStringParameter(params);
+ }
+ }
+
+ /**
* Display a System Message on the screen for a given position and time.
* @param systemMsg the System Message Id
* @param position the position on the screen
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java b/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java
index 6491ba7..3ea9cdc 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java
@@ -124,32 +124,32 @@
}
case "message1":
{
- showOnScreenMsg(player, NpcStringId.AN_INTRUDER_INTERESTING, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.AN_INTRUDER_INTERESTING, ExShowScreenMessage.TOP_CENTER, 5000, true);
break;
}
case "message2":
{
- showOnScreenMsg(player, NpcStringId.PROVE_YOUR_WORTH, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.PROVE_YOUR_WORTH, ExShowScreenMessage.TOP_CENTER, 5000, true);
break;
}
case "message3":
{
- showOnScreenMsg(player, NpcStringId.ONLY_THOSE_STRONG_ENOUGH_SHALL_PROCEED, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.ONLY_THOSE_STRONG_ENOUGH_SHALL_PROCEED, ExShowScreenMessage.TOP_CENTER, 5000, true);
break;
}
case "message4":
{
- showOnScreenMsg(player, NpcStringId.THOUGH_SMALL_THIS_POWER_WILL_HELP_YOU_GREATLY, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.THOUGH_SMALL_THIS_POWER_WILL_HELP_YOU_GREATLY, ExShowScreenMessage.TOP_CENTER, 5000, true);
break;
}
case "message5":
{
- showOnScreenMsg(player, NpcStringId.ARE_YOU_STRONG_OR_WEAK_OF_THE_LIGHT_OR_DARKNESS, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.ARE_YOU_STRONG_OR_WEAK_OF_THE_LIGHT_OR_DARKNESS, ExShowScreenMessage.TOP_CENTER, 5000, true);
break;
}
case "message6":
{
- showOnScreenMsg(player, NpcStringId.ONLY_THOSE_OF_LIGHT_MAY_PASS_OTHERS_MUST_PROVE_THEIR_STRENGTH, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.ONLY_THOSE_OF_LIGHT_MAY_PASS_OTHERS_MUST_PROVE_THEIR_STRENGTH, ExShowScreenMessage.TOP_CENTER, 5000, true);
break;
}
case "razkan_say":
@@ -313,7 +313,7 @@
}
case "spawn_wave3":
{
- showOnScreenMsg(player, NpcStringId.I_MUST_GO_HELP_SOME_MORE, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.I_MUST_GO_HELP_SOME_MORE, ExShowScreenMessage.TOP_CENTER, 5000, true);
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof HuRWorld)
{
@@ -513,7 +513,7 @@
}
case "whisper_to_player":
{
- showOnScreenMsg(player, NpcStringId.I_HERMUNCUS_GIVE_MY_POWER_TO_THOSE_WHO_FIGHT_FOR_ME, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.I_HERMUNCUS_GIVE_MY_POWER_TO_THOSE_WHO_FIGHT_FOR_ME, ExShowScreenMessage.TOP_CENTER, 5000, true);
broadcastNpcSay(npc, ChatType.WHISPER, NpcStringId.RECEIVE_THIS_POWER_FORM_THE_ANCIENT_GIANT);
broadcastNpcSay(npc, ChatType.WHISPER, NpcStringId.USE_THIS_NEW_POWER_WHEN_THE_TIME_IS_RIGHT);
@@ -749,24 +749,24 @@
{
if (!world.harnakMessage1 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) > 80))
{
- showOnScreenMsg(player, NpcStringId.FREE_ME_FROM_THIS_BINDING_OF_LIGHT, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.FREE_ME_FROM_THIS_BINDING_OF_LIGHT, ExShowScreenMessage.TOP_CENTER, 5000, true);
world.harnakMessage1 = true;
}
else if (!world.harnakMessage2 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 80))
{
- showOnScreenMsg(player, NpcStringId.DESTROY_THE_GHOST_OF_HARNAK_THIS_CORRUPTED_CREATURE, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.DESTROY_THE_GHOST_OF_HARNAK_THIS_CORRUPTED_CREATURE, ExShowScreenMessage.TOP_CENTER, 5000, true);
world.harnakMessage2 = true;
}
else if (!world.harnakMessage3 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60))
{
- showOnScreenMsg(player, NpcStringId.FREE_ME_AND_I_PROMISE_YOU_THE_POWER_OF_GIANTS, ExShowScreenMessage.TOP_CENTER, 5000);
+ showOnScreenMsg(player, NpcStringId.FREE_ME_AND_I_PROMISE_YOU_THE_POWER_OF_GIANTS, ExShowScreenMessage.TOP_CENTER, 5000, true);
world.harnakMessage3 = true;
}
else if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 50)
{
world.incStatus();
player.sendPacket(new ExSendUIEvent(player, false, false, 60, 0, NpcStringId.REMAINING_TIME));
- showOnScreenMsg(player, NpcStringId.NO_THE_SEAL_CONTROLS_HAVE_BEEN_EXPOSED_GUARDS_PROTECT_THE_SEAL_CONTROLS, ExShowScreenMessage.TOP_CENTER, 10000);
+ showOnScreenMsg(player, NpcStringId.NO_THE_SEAL_CONTROLS_HAVE_BEEN_EXPOSED_GUARDS_PROTECT_THE_SEAL_CONTROLS, ExShowScreenMessage.TOP_CENTER, 10000, true);
startQuestTimer("spawn_npc4", 1, npc, player);
cancelQuestTimer("fail_instance", null, player);
startQuestTimer("fail_instance", 60000, null, player);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment