mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 16:49:11 +00:00
437a664f00
- Split HintIconMessage into two separate classes (PositionHintIconMessage and MobHintIconMessage) - Split HintIconMessageEncoder into two separate encoders (PositionHintIconMessageEncoder and MobHintIconMessageEncoder) This resolves #179 Add PositionHintIconMessage#reset Fix parse errors introduced in e799577 This also resolves #181 Order enumerators by value Clean up PositionHintIconHintMessageEncoder for 377/317
118 lines
3.8 KiB
Ruby
118 lines
3.8 KiB
Ruby
require 'java'
|
|
|
|
java_import 'org.apollo.game.message.impl.HintIconMessage'
|
|
java_import 'org.apollo.game.message.impl.MobHintIconMessage'
|
|
java_import 'org.apollo.game.message.impl.PositionHintIconMessage'
|
|
java_import 'org.apollo.game.message.impl.SwitchTabInterfaceMessage'
|
|
java_import 'org.apollo.game.model.entity.EntityType'
|
|
java_import 'org.apollo.game.model.Position'
|
|
|
|
private
|
|
|
|
# The ids of tabs that are displayed when the player has yet to start the tutorial.
|
|
INITIAL_TABS = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2449, 904, -1, -1]
|
|
|
|
# The character design interface id.
|
|
CHARACTER_DESIGN = 3559
|
|
|
|
# The Runescape guide Npc
|
|
@runescape_guide = spawn_npc name: :runescape_guide, x: 3093, y: 3107
|
|
|
|
# Sends the appropriate data to the client when the player logs in to the game.
|
|
on :login do |_event, player|
|
|
if player.in_tutorial_island && player.privilege_level != RIGHTS_ADMIN
|
|
TutorialInstructions.show_instruction(player)
|
|
|
|
INITIAL_TABS.each_with_index do |tab, index|
|
|
player.send(SwitchTabInterfaceMessage.new(index, tab))
|
|
end
|
|
|
|
if player.tutorial_island_progress == :not_started
|
|
show_hint_icon(player)
|
|
player.interface_set.open_window(CHARACTER_DESIGN)
|
|
end
|
|
end
|
|
end
|
|
|
|
# The conversation with the Runescape Guide, when on tutorial island.
|
|
conversation :tutorial_runescape_guide do
|
|
|
|
# The first dialogue of the Runescape Guide, greeting the Player.
|
|
dialogue :greetings do
|
|
type :npc_speech
|
|
npc :runescape_guide
|
|
emote :calm
|
|
|
|
precondition { |player| player.tutorial_island_progress == :not_started }
|
|
|
|
text 'Greetings! I see you are a new arrival to this land. My job is to welcome all new '\
|
|
'visitors. So welcome!'
|
|
|
|
continue dialogue: :talk_to_people do |player|
|
|
player.tutorial_island_progress = :talk_to_people
|
|
end
|
|
end
|
|
|
|
# The Guide welcomes back the Player if they speak to him after they have already gone through
|
|
# the conversation once.
|
|
dialogue :welcome_back do
|
|
type :npc_speech
|
|
npc :runescape_guide
|
|
emote :calm
|
|
|
|
precondition { |player| player.tutorial_island_progress != :not_started }
|
|
|
|
text 'Welcome back.'
|
|
|
|
continue dialogue: :talk_to_people
|
|
end
|
|
|
|
# The Guide tells Players to speak to people in order to succeed.
|
|
dialogue :talk_to_people do
|
|
type :npc_speech
|
|
npc :runescape_guide
|
|
emote :calm
|
|
|
|
text 'You have already learned the first thing you need to succeed in this world: talking to '\
|
|
'people!',
|
|
'You will find many inhabitants of this world have useful things to say to you. By '\
|
|
'clicking on them with your mouse you can talk to them.',
|
|
'I would also suggest reading through some of the supporting information on the website.'\
|
|
' There you can find maps, a bestiary, and much more.'
|
|
|
|
continue dialogue: :go_through_door
|
|
end
|
|
|
|
# The Guide tells Players to go through the door, advancing the tutorial progress if this is the
|
|
# first time the Player has heard this.
|
|
dialogue :go_through_door do
|
|
type :npc_speech
|
|
npc :runescape_guide
|
|
emote :calm
|
|
|
|
text 'To continue the tutorial go through that door over there, and speak to your first '\
|
|
'instructor.'
|
|
|
|
close do |player|
|
|
if player.tutorial_island_progress < :runescape_guide_finished
|
|
reset_hint_icon(player)
|
|
# TODO: Maybe move this, define a constant for the Position and height
|
|
player.send(PositionHintIconMessage.new(HintIconMessage::Type::SOUTH, Position.new(3097, 3107), 120))
|
|
player.tutorial_island_progress = :runescape_guide_finished
|
|
end
|
|
|
|
TutorialInstructions.show_instruction(player)
|
|
end
|
|
end
|
|
end
|
|
|
|
# Enables the hint icon above the Runescape guide.
|
|
def show_hint_icon(player)
|
|
player.send(MobHintIconMessage.create(@runescape_guide))
|
|
end
|
|
|
|
# Resets the hint icon.
|
|
def reset_hint_icon(player)
|
|
player.send(MobHintIconMessage.reset(EntityType::NPC))
|
|
end
|