diff --git a/Server/src/main/java/core/game/component/Component.java b/Server/src/main/java/core/game/component/Component.java index 9ce427f4c..83dd11bff 100644 --- a/Server/src/main/java/core/game/component/Component.java +++ b/Server/src/main/java/core/game/component/Component.java @@ -84,11 +84,7 @@ public class Component { * @return {@code True} if the component can be closed. */ public boolean close(Player player) { - InterfaceListeners.runClose(player,this); - if (closeEvent != null && !closeEvent.close(player, this)) { - return false; - } - return true; + return (closeEvent == null || closeEvent.close(player, this)) && InterfaceListeners.runClose(player, this); } /** diff --git a/Server/src/main/java/core/game/node/entity/player/info/login/LoginConfiguration.java b/Server/src/main/java/core/game/node/entity/player/info/login/LoginConfiguration.java index f0fd51197..fd0ec114f 100644 --- a/Server/src/main/java/core/game/node/entity/player/info/login/LoginConfiguration.java +++ b/Server/src/main/java/core/game/node/entity/player/info/login/LoginConfiguration.java @@ -12,6 +12,8 @@ import core.net.packet.PacketRepository; import core.net.packet.context.InterfaceContext; import core.net.packet.out.Interface; import core.plugin.Plugin; +import rs09.ServerConstants; +import rs09.game.interaction.inter.RulesAndInfo; import rs09.game.system.SystemLogger; import rs09.game.world.GameWorld; import rs09.game.world.repository.Repository; @@ -144,6 +146,8 @@ public final class LoginConfiguration { player.getEmoteManager().unlock(Emotes.SAFETY_FIRST); } player.varpManager.sendAllVarps(); + if(ServerConstants.RULES_AND_INFO_ENABLED) + RulesAndInfo.openFor(player); /*if (GameWorld.getSettings().isPvp()) { player.getPacketDispatch().sendString("", 226, 1); }*/ diff --git a/Server/src/main/kotlin/rs09/ServerConstants.kt b/Server/src/main/kotlin/rs09/ServerConstants.kt index 5843419ca..16fc727f9 100644 --- a/Server/src/main/kotlin/rs09/ServerConstants.kt +++ b/Server/src/main/kotlin/rs09/ServerConstants.kt @@ -116,6 +116,9 @@ class ServerConstants { @JvmField var LOG_CUTSCENE = true + @JvmField + var RULES_AND_INFO_ENABLED = true + //location names for the ::to command. val TELEPORT_DESTINATIONS = arrayOf( arrayOf(Location.create(2974, 4383, 2), "corp", "corporal", "corporeal"), @@ -203,4 +206,4 @@ class ServerConstants { @JvmField var DAILY_RESTART = false } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/content/activity/gnomecooking/GnomeCookingConstants.kt b/Server/src/main/kotlin/rs09/game/content/activity/gnomecooking/GnomeCookingConstants.kt index b974b25ae..4f0979fe1 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/gnomecooking/GnomeCookingConstants.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/gnomecooking/GnomeCookingConstants.kt @@ -1,8 +1,8 @@ package rs09.game.content.activity.gnomecooking const val GC_BASE_ATTRIBUTE = "gnome_cooking" -const val GC_TUT_PROG = "tutorial:stage" -const val GC_TUT_FIN = "tutorial:complete" +const val GC_TUT_PROG = "gnome-cooking:tutorial:stage" +const val GC_TUT_FIN = "gnome-cooking:tutorial:complete" const val GC_JOB_ORDINAL = "job:job_ordinal" const val GC_JOB_COMPLETE = "job:job_complete" const val GC_HARD_JOB = "job:hard_job" diff --git a/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialMagicTutorDialogue.kt b/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialMagicTutorDialogue.kt index dac6fd5de..b4cefaa61 100644 --- a/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialMagicTutorDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialMagicTutorDialogue.kt @@ -16,6 +16,7 @@ import core.net.amsc.WorldCommunicator import core.plugin.Initializable import org.rs09.consts.Items import org.rs09.consts.NPCs +import rs09.game.interaction.inter.RulesAndInfo import rs09.game.world.GameWorld import rs09.tools.END_DIALOGUE @@ -147,7 +148,6 @@ class TutorialMagicTutorDialogue(player: Player? = null) : DialoguePlugin(player "at any time, look for a signpost or use the Lumbridge Home Port Spell." ) stage = 12 - player.unlock() if(WorldCommunicator.isEnabled()) MSPacketRepository.sendInfoUpdate(player) TutorialStage.removeHintIcon(player) @@ -158,12 +158,12 @@ class TutorialMagicTutorDialogue(player: Player? = null) : DialoguePlugin(player player.unhook(TutorialUseWithReceiver) player.unhook(TutorialInteractionReceiver) player.unhook(TutorialButtonReceiver) + RulesAndInfo.openFor(player) } 12 -> { player.setAttribute("close_c_", true) end() - sendMessage(player, "Welcome to ${GameWorld.settings!!.name}.") } } } diff --git a/Server/src/main/kotlin/rs09/game/interaction/InterfaceListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/InterfaceListeners.kt index 7145a3fa9..ab626abac 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InterfaceListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InterfaceListeners.kt @@ -55,7 +55,7 @@ object InterfaceListeners { @JvmStatic fun runClose(player: Player,component: Component): Boolean{ - val method = getCloseListener(component.id) ?: return false + val method = getCloseListener(component.id) ?: return true return method.invoke(player,component) } diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/RulesAndInfo.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/RulesAndInfo.kt new file mode 100644 index 000000000..7eeac8bdf --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/RulesAndInfo.kt @@ -0,0 +1,58 @@ +package rs09.game.interaction.inter + +import api.* +import core.game.node.entity.player.Player +import core.tools.RandomFunction +import rs09.game.interaction.InterfaceListener +import rs09.game.system.SystemLogger + +object RulesAndInfo { + val RULES = arrayOf( + "