mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 08:39:11 +00:00
Update all plugins to conform to Rubocop.
This commit is contained in:
@@ -3,32 +3,33 @@ require 'java'
|
||||
java_import 'org.apollo.game.message.impl.HintIconMessage'
|
||||
java_import 'org.apollo.game.message.impl.SwitchTabInterfaceMessage'
|
||||
|
||||
|
||||
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 ]
|
||||
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
|
||||
@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
|
||||
# TutorialInstructions::show_instruction(player)
|
||||
# INITIAL_TABS.each_with_index { |tab, index| player.send(SwitchTabInterfaceMessage.new(index, tab)) }
|
||||
on :login do |_event, player|
|
||||
if player.in_tutorial_island && player.privilege_level != RIGHTS_ADMIN
|
||||
TutorialInstructions.show_instruction(player)
|
||||
|
||||
if (player.tutorial_island_progress == :not_started)
|
||||
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
|
||||
|
||||
@@ -36,63 +37,66 @@ conversation :tutorial_runescape_guide do
|
||||
dialogue :greetings do
|
||||
type :npc_speech
|
||||
npc :runescape_guide
|
||||
|
||||
|
||||
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!"
|
||||
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|
|
||||
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.
|
||||
# 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
|
||||
|
||||
precondition { |player| player.tutorial_island_progress != :not_started }
|
||||
|
||||
text "Welcome back."
|
||||
text 'Welcome back.'
|
||||
|
||||
continue :dialogue => :talk_to_people
|
||||
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
|
||||
|
||||
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."
|
||||
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
|
||||
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.
|
||||
# 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
|
||||
|
||||
text "To continue the tutorial go through that door over there, and speak to your first instructor."
|
||||
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)
|
||||
if player.tutorial_island_progress < :runescape_guide_finished
|
||||
reset_hint_icon(player)
|
||||
# TODO door hint icon
|
||||
# TODO: door hint icon
|
||||
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(HintIconMessage.for_npc(@runescape_guide.index))
|
||||
@@ -100,5 +104,5 @@ end
|
||||
|
||||
# Resets the hint icon.
|
||||
def reset_hint_icon(player)
|
||||
player.send(HintIconMessage.reset_npc())
|
||||
end
|
||||
player.send(HintIconMessage.reset_npc)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
# TODO update the status to :moving_around when the door is opened
|
||||
# TODO: update the status to :moving_around when the door is opened
|
||||
|
||||
# Contains members related to the instructions issues during tutorial island.
|
||||
module TutorialInstructions
|
||||
@@ -18,104 +18,115 @@ module TutorialInstructions
|
||||
when :given_axe then :viewing_items
|
||||
when :cut_tree then :cut_tree
|
||||
when :cutting_tree then :please_wait
|
||||
else raise "No dialogue for current stage #{progress} exists."
|
||||
else fail 'No dialogue for current stage #{progress} exists.'
|
||||
end
|
||||
|
||||
dialogue = instructions.part(name)
|
||||
send_dialogue(player, dialogue)
|
||||
end
|
||||
|
||||
|
||||
# The one-sided 'conversation' of instruction instructions.
|
||||
conversation :tutorial_island_instructions do
|
||||
|
||||
# The initial instruction displayed when the player logs in, before they have spoken to the guide.
|
||||
# The initial instruction displayed when the player logs in, before they have spoken to the
|
||||
# guide.
|
||||
dialogue :getting_started do
|
||||
type :text
|
||||
|
||||
title "Getting started"
|
||||
text "To start the tutorial, use your left mouse button to click on the Runescape Guide in this room. He is indicated by "\
|
||||
"a flashing yellow arrow above his head. If you can't see him, use your keyboard's arrow keys to rotate the view."
|
||||
|
||||
title 'Getting started'
|
||||
text 'To start the tutorial, use your left mouse button to click on the Runescape Guide in '\
|
||||
'this room. He is indicated by a flashing yellow arrow above his head. If you can\'t '\
|
||||
'see him, use your keyboard\'s arrow keys to rotate the view.'
|
||||
end
|
||||
|
||||
# The instruction displayed after the player has spoken to the Runescape Guide.
|
||||
dialogue :scenery do
|
||||
type :text
|
||||
|
||||
title "Interacting with scenery"
|
||||
text "You can interact with many items of the scenery by simply clicking on them. Right clicking will also give more options. "\
|
||||
"Click on the door indicated with the yellow arrow to go through to the next area and speak with your next instructor."
|
||||
title 'Interacting with scenery'
|
||||
text 'You can interact with many items of the scenery by simply clicking on them. Right '\
|
||||
'clicking will also give more options. Click on the door indicated with the yellow '\
|
||||
'arrow to go through to the next area and speak with your next instructor.'
|
||||
end
|
||||
|
||||
## TODO !! When we have door support, the player's tutorial island progress needs to be set to :moving_around when they walk through the door !!
|
||||
# TODO: The player's tutorial island progress needs to be set to :moving_around when they walk
|
||||
# through the door !!
|
||||
|
||||
# The instruction displayed after the player has left the initial building.
|
||||
dialogue :moving_around do
|
||||
type :text
|
||||
|
||||
title "Moving around"
|
||||
text "Follow the path to find the next instructor. Clicking on the ground will walk you to that point. Talk to the survival expert "\
|
||||
"by the pond to continue the tutorial. Remember you can rotate the view by pressing the arrow keys."
|
||||
title 'Moving around'
|
||||
text 'Follow the path to find the next instructor. Clicking on the ground will walk you to '\
|
||||
'that point. Talk to the survival expert by the pond to continue the tutorial. '\
|
||||
'Remember you can rotate the view by pressing the arrow keys.'
|
||||
end
|
||||
|
||||
# The instruction displayed after the player has been given the tinderbox and bronze axe by the Survival Guide.
|
||||
# The instruction displayed after the player has been given the tinderbox and bronze axe by the
|
||||
# Survival Guide.
|
||||
dialogue :viewing_items do
|
||||
type :text
|
||||
|
||||
title "Viewing the items you were given"
|
||||
text "Click on the flashing backpack icon to the right side of the main window to view your inventory. Your inventory is a list of "\
|
||||
"everything you have in your backpack."
|
||||
end
|
||||
title 'Viewing the items you were given'
|
||||
text 'Click on the flashing backpack icon to the right side of the main window to view your '\
|
||||
'inventory. Your inventory is a list of everything you have in your backpack.'
|
||||
end
|
||||
|
||||
# The instruction displayed before the player has begun to cut the tree.
|
||||
dialogue :cut_tree do
|
||||
type :text
|
||||
# The instruction displayed before the player has begun to cut the tree.
|
||||
dialogue :cut_tree do
|
||||
type :text
|
||||
|
||||
title "Cut down a tree"
|
||||
text "You can click on the backpack icon at any time to view the items that you currently have in your inventory. You will see that you "\
|
||||
"now have an axe in your inventory. Use this to get some logs by clicking on the indicated tree."
|
||||
end
|
||||
title 'Cut down a tree'
|
||||
text 'You can click on the backpack icon at any time to view the items that you currently '\
|
||||
'have in your inventory. You will see that you now have an axe in your inventory. '\
|
||||
'Use this to get some logs by clicking on the indicated tree.'
|
||||
end
|
||||
|
||||
# The instruction displayed when the player begins to cut the tree.
|
||||
dialogue :please_wait do
|
||||
type :text
|
||||
# The instruction displayed when the player begins to cut the tree.
|
||||
dialogue :please_wait do
|
||||
type :text
|
||||
|
||||
title "Please wait..."
|
||||
text "Your character is now attempting to cut down the tree. Sit back for a moment whilst he does all the hard work." # TODO she instead of he if applicable
|
||||
end
|
||||
title 'Please wait...'
|
||||
text 'Your character is now attempting to cut down the tree. Sit back for a moment whilst '\
|
||||
'he does all the hard work.' # TODO: she instead of he if applicable
|
||||
end
|
||||
|
||||
# The instruction displayed after the player has successfully cut logs from the tree.
|
||||
dialogue :make_a_fire do
|
||||
type :text
|
||||
# The instruction displayed after the player has successfully cut logs from the tree.
|
||||
dialogue :make_a_fire do
|
||||
type :text
|
||||
|
||||
title "Making a fire"
|
||||
text "Well done! You managed to cut some logs from the tree! Next, use the tinderbox in your inventory to light the logs. First click on the "\
|
||||
"tinderbox to 'use' it. Then click on the logs in your inventory to light them."
|
||||
end
|
||||
title 'Making a fire'
|
||||
text 'Well done! You managed to cut some logs from the tree! Next, use the tinderbox in '\
|
||||
'your inventory to light the logs. First click on the tinderbox to \'use\' it.'\
|
||||
'Then click on the logs in your inventory to light them.'
|
||||
end
|
||||
|
||||
# The instruction displayed when the player begins to light the fire.
|
||||
dialogue :lighting_fire do
|
||||
type :text
|
||||
# The instruction displayed when the player begins to light the fire.
|
||||
dialogue :lighting_fire do
|
||||
type :text
|
||||
|
||||
title "Please wait..."
|
||||
text "Your character is now attempting to light the logs. Sit back for a moment whilst he does all the hard work." # TODO she instead of he if applicable
|
||||
end
|
||||
title 'Please wait...'
|
||||
# TODO: she instead of he if applicable
|
||||
text 'Your character is now attempting to light the logs. Sit back for a moment whilst he '\
|
||||
'does all the hard work.'
|
||||
end
|
||||
|
||||
# The instruction displayed when the has lit the logs.
|
||||
dialogue :gained_experience do
|
||||
type :text
|
||||
# The instruction displayed when the has lit the logs.
|
||||
dialogue :gained_experience do
|
||||
type :text
|
||||
|
||||
text "You gained some experience."\
|
||||
"Click on the flashing bar graph icon near the inventory button to see your skill stats."
|
||||
end
|
||||
text 'You gained some experience.'\
|
||||
'Click on the flashing bar graph icon near the inventory button to see your skill '\
|
||||
'stats.'
|
||||
end
|
||||
|
||||
# The dialogue displayed when the Player has clicked the flashing skill tab icon.
|
||||
dialogue :skill_stats do
|
||||
type :text
|
||||
# The dialogue displayed when the Player has clicked the flashing skill tab icon.
|
||||
dialogue :skill_stats do
|
||||
type :text
|
||||
|
||||
title "Your skill stats."
|
||||
text "" # TODO !!
|
||||
end
|
||||
title 'Your skill stats.'
|
||||
text '' # TODO: this !!
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,52 +1,40 @@
|
||||
# Information about npc spawning
|
||||
#
|
||||
# Npcs are passed to spawn npc as a hash. Every key and every non-integer value must be a Symbol. Every hash must implement the following:
|
||||
# :name - the name of the npc. If this npc shares its name with another, append the specific id after the name (e.g. :woman_4)
|
||||
# :x - the x coordinate where the npc will spawn.
|
||||
# :y - the y coordinate where the npc will spawn.
|
||||
# Optional arguments are as follows:
|
||||
# :face - the direction the npc should face when it spawns. Supported options are :north, :north_east, :east, :south_east, :south, :south_west, :west, and :north_west
|
||||
# :bounds - the rectangular bound that the npc can wander about in. Order is [bottom-left x-coordinate, bottom-left y-coordinate, top-right x-coordinate, top-right y-coordinate]
|
||||
# :delta_bounds - the rectangular bound that the npc can wander about in, as a difference from the spawn point. Order is [x-delta, y-delta]. Should not be used with :bounds.
|
||||
# :spawn_animation - the animation that will be played when the npc spawns.
|
||||
# :spawn_graphic - the graphic that will be played when the npc spawns.
|
||||
|
||||
|
||||
# Functional npcs
|
||||
|
||||
# 'Above-ground' npcs
|
||||
|
||||
spawn_npc :name => :master_chef, :x => 3076, :y => 3085
|
||||
spawn_npc :name => :quest_guide, :x => 3086, :y => 3122, :face => :north
|
||||
spawn_npc :name => :financial_advisor, :x => 3127, :y => 3124, :face => :west
|
||||
spawn_npc :name => :brother_brace, :x => 3124, :y => 3107, :face => :east
|
||||
spawn_npc :name => :magic_instructor, :x => 3140, :y => 3085
|
||||
spawn_npc name: :master_chef, x: 3076, y: 3085
|
||||
spawn_npc name: :quest_guide, x: 3086, y: 3122, face: :north
|
||||
spawn_npc name: :financial_advisor, x: 3127, y: 3124, face: :west
|
||||
spawn_npc name: :brother_brace, x: 3124, y: 3107, face: :east
|
||||
spawn_npc name: :magic_instructor, x: 3140, y: 3085
|
||||
|
||||
# 'Below-ground' npcs
|
||||
# Note: They aren't actually on a different plane, they're just in a different location that pretends to be underground.
|
||||
# Note: They aren't actually on a different plane, they're just in a different location that
|
||||
# pretends to be underground.
|
||||
|
||||
spawn_npc :name => :mining_instructor, :x => 3081, :y => 9504
|
||||
spawn_npc :name => :combat_instructor, :x => 3104, :y => 9506
|
||||
spawn_npc name: :mining_instructor, x: 3081, y: 9504
|
||||
spawn_npc name: :combat_instructor, x: 3104, y: 9506
|
||||
|
||||
# Non-humanoid npcs
|
||||
|
||||
spawn_npc :name => :fishing_spot_316, :x => 3102, :y => 3093
|
||||
|
||||
spawn_npc :name => :chicken, :x => 3140, :y => 3095
|
||||
spawn_npc :name => :chicken, :x => 3140, :y => 3093
|
||||
spawn_npc :name => :chicken, :x => 3138, :y => 3092
|
||||
spawn_npc :name => :chicken, :x => 3137, :y => 3094
|
||||
spawn_npc :name => :chicken, :x => 3138, :y => 3095
|
||||
spawn_npc name: :fishing_spot_316, x: 3102, y: 3093
|
||||
|
||||
spawn_npc name: :chicken, x: 3140, y: 3095
|
||||
spawn_npc name: :chicken, x: 3140, y: 3093
|
||||
spawn_npc name: :chicken, x: 3138, y: 3092
|
||||
spawn_npc name: :chicken, x: 3137, y: 3094
|
||||
spawn_npc name: :chicken, x: 3138, y: 3095
|
||||
|
||||
# 'Below-ground' npcs
|
||||
# Note: They aren't actually on a different plane, they're just in a different location that pretends to be underground.
|
||||
# Note: They aren't actually on a different plane, they're just in a different location that
|
||||
# pretends to be underground.
|
||||
|
||||
spawn_npc :name => :giant_rat_87, :x => 3105, :y => 9514
|
||||
spawn_npc :name => :giant_rat_87, :x => 3105, :y => 9517
|
||||
spawn_npc :name => :giant_rat_87, :x => 3106, :y => 9514
|
||||
spawn_npc :name => :giant_rat_87, :x => 3104, :y => 9514
|
||||
spawn_npc :name => :giant_rat_87, :x => 3105, :y => 9519
|
||||
spawn_npc :name => :giant_rat_87, :x => 3109, :y => 9516
|
||||
spawn_npc :name => :giant_rat_87, :x => 3108, :y => 9520
|
||||
spawn_npc :name => :giant_rat_87, :x => 3102, :y => 9517
|
||||
spawn_npc name: :giant_rat_87, x: 3105, y: 9514
|
||||
spawn_npc name: :giant_rat_87, x: 3105, y: 9517
|
||||
spawn_npc name: :giant_rat_87, x: 3106, y: 9514
|
||||
spawn_npc name: :giant_rat_87, x: 3104, y: 9514
|
||||
spawn_npc name: :giant_rat_87, x: 3105, y: 9519
|
||||
spawn_npc name: :giant_rat_87, x: 3109, y: 9516
|
||||
spawn_npc name: :giant_rat_87, x: 3108, y: 9520
|
||||
spawn_npc name: :giant_rat_87, x: 3102, y: 9517
|
||||
|
||||
@@ -5,11 +5,12 @@ private
|
||||
STAGES = []
|
||||
|
||||
# The stages that are used when interacting with the Runescape Guide.
|
||||
RUNESCAPE_GUIDE = [ :not_started, :talk_to_people, :go_through_door, :runescape_guide_finished, :moving_around ]
|
||||
RUNESCAPE_GUIDE = [:not_started, :talk_to_people, :go_through_door, :runescape_guide_finished,
|
||||
:moving_around]
|
||||
STAGES.concat(RUNESCAPE_GUIDE)
|
||||
|
||||
# The stages that are used when interacting with the Survival Expert.
|
||||
SURVIVAL_EXPERT = [ :given_axe, :cut_tree, :cutting_tree, ]
|
||||
SURVIVAL_EXPERT = [:given_axe, :cut_tree, :cutting_tree]
|
||||
STAGES.concat(SURVIVAL_EXPERT)
|
||||
|
||||
quest :tutorial_island, STAGES
|
||||
quest :tutorial_island, STAGES
|
||||
|
||||
@@ -10,7 +10,7 @@ private
|
||||
module SurvivalConstants
|
||||
|
||||
# The Survival Expert Npc.
|
||||
@survival_expert = spawn_npc :name => :survival_expert, :x => 3104, :y => 3095, :face => :north
|
||||
@survival_expert = spawn_npc name: :survival_expert, x: 3104, y: 3095, face: :north
|
||||
|
||||
# The inventory tab index.
|
||||
INVENTORY_TAB_INDEX = 3
|
||||
@@ -29,7 +29,6 @@ module SurvivalConstants
|
||||
|
||||
end
|
||||
|
||||
|
||||
# The conversation with the Survival Expert, when on tutorial island.
|
||||
conversation :tutorial_surivival_expert do
|
||||
|
||||
@@ -39,23 +38,23 @@ conversation :tutorial_surivival_expert do
|
||||
|
||||
precondition { |player| player.tutorial_island_progress == :moving_around }
|
||||
|
||||
text "Hello there, newcomer. My name is Brynna. My job is to teach you a few survival tips and tricks. First off we're "\
|
||||
"going to start with the most basic survival skill of all: making a fire."
|
||||
text 'Hello there, newcomer. My name is Brynna. My job is to teach you a few survival tips and'\
|
||||
' tricks. First off we\'re going to start with the most basic survival skill of all: '\
|
||||
'making a fire.'
|
||||
|
||||
close &:add_survival_items
|
||||
close(&:add_survival_items)
|
||||
end
|
||||
|
||||
|
||||
dialogue :hello_again do
|
||||
type :npc_speech
|
||||
npc :survival_expert
|
||||
|
||||
precondition { |player| player.tutorial_island_progress == :moving_around }
|
||||
|
||||
text "Hello again. I'm here to teach you a few survival tips and tricks. First off we're going to start with the most "\
|
||||
"basic survival skill of all: making a fire."
|
||||
text 'Hello again. I\'m here to teach you a few survival tips and tricks. First off we\'re '\
|
||||
'going to start with the most basic survival skill of all: making a fire.'
|
||||
|
||||
close &:add_survival_items
|
||||
close(&:add_survival_items)
|
||||
end
|
||||
|
||||
# The dialogue displayed when the Survival Expert gives the player a bronze axe.
|
||||
@@ -63,7 +62,7 @@ conversation :tutorial_surivival_expert do
|
||||
type :message_with_item
|
||||
item :bronze_axe
|
||||
|
||||
text "The Survival Expert gives you a bronze axe!"
|
||||
text 'The Survival Expert gives you a bronze axe!'
|
||||
|
||||
close { |player| TutorialInstructions.show_instruction(player) }
|
||||
end
|
||||
@@ -73,23 +72,28 @@ conversation :tutorial_surivival_expert do
|
||||
type :message_with_item
|
||||
item :tinderbox
|
||||
|
||||
text "The Survival Expert gives you a tinderbox!"
|
||||
text 'The Survival Expert gives you a tinderbox!'
|
||||
|
||||
close { |player| TutorialInstructions.show_instruction(player) }
|
||||
end
|
||||
|
||||
# The dialogue displayed when the Survival Expert gives the player both a bronze axe and a tinderbox.
|
||||
# The dialogue displayed when the Survival Expert gives the player both a bronze axe and a
|
||||
# tinderbox.
|
||||
dialogue :give_axe_and_tinderbox do
|
||||
type :message_with_item
|
||||
item :bronze_axe # TODO the tinderbox is also displayed - find this dialogue id. Scale looks like the default http://i.imgur.com/i1abN5X.png
|
||||
item :bronze_axe
|
||||
# TODO: the tinderbox is also displayed - find this dialogue id. Scale looks like the default
|
||||
# http://i.imgur.com/i1abN5X.png
|
||||
|
||||
text 'The Survival Expert gives you a tinderbox and a bronze axe!'
|
||||
|
||||
text "The Survival Expert gives you a tinderbox and a bronze axe!"
|
||||
|
||||
close do |player|
|
||||
if (player.tutorial_island_progress < :given_axe)
|
||||
if player.tutorial_island_progress < :given_axe
|
||||
player.tutorial_island_progress = :given_axe
|
||||
player.send(SwitchTabInterfaceMessage.new(SurvivalConstants::INVENTORY_TAB_INDEX, SurvivalConstants::INVENTORY_TAB_ID))
|
||||
player.send(FlashTabInterfaceMessage.new(SurvivalConstants::INVENTORY_TAB_INDEX))
|
||||
|
||||
index = SurvivalConstants::INVENTORY_TAB_INDEX
|
||||
player.send(SwitchTabInterfaceMessage.new(index, SurvivalConstants::INVENTORY_TAB_ID))
|
||||
player.send(FlashTabInterfaceMessage.new(index))
|
||||
end
|
||||
|
||||
TutorialInstructions.show_instruction(player)
|
||||
@@ -101,14 +105,14 @@ conversation :tutorial_surivival_expert do
|
||||
type :message_with_item
|
||||
item :logs
|
||||
|
||||
text "You get some logs."
|
||||
text 'You get some logs.'
|
||||
close { |player| TutorialInstructions.show_instruction(player) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
# Add the survival items (bronze axe and tinderbox) to the inventory of the player, if they do not already have them.
|
||||
# Add the survival items (bronze axe and tinderbox) to the inventory of the player, if they do not
|
||||
# already have them.
|
||||
def add_survival_items(player)
|
||||
inventory = player.inventory
|
||||
|
||||
@@ -125,22 +129,26 @@ def add_survival_items(player)
|
||||
send_dialogue(player, get_dialogue(:tutorial_surivival_expert, dialogue))
|
||||
end
|
||||
|
||||
# Intercept the FirstObjectActionMessage to send tutorial-only events if the player is chopping down a tree.
|
||||
# Intercept the FirstObjectActionMessage to send tutorial-only events if the player is chopping
|
||||
# down a tree.
|
||||
on :message, :first_object_action do |player, message|
|
||||
if (player.in_tutorial_island && message.id == SurvivalConstants::TREE_ID)
|
||||
if player.in_tutorial_island && message.id == SurvivalConstants::TREE_ID
|
||||
progress = player.tutorial_island_progress
|
||||
if (progress < :cut_tree)
|
||||
# TODO display "You cannot cut down this tree; you must first follow the guide's instructions."
|
||||
elsif (player.tutorial_island_progress == :cut_tree)
|
||||
player.tutorial_island_progress = :cutting_tree # Don't break the chain, so that the Woodcutting event actually happens.
|
||||
|
||||
if progress < :cut_tree
|
||||
# TODO: 'You cannot cut down this tree; you must first follow the guide's instructions.'
|
||||
elsif player.tutorial_island_progress == :cut_tree
|
||||
# Don't break the chain, so that the Woodcutting event actually happens.
|
||||
player.tutorial_island_progress = :cutting_tree
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Intercept the FlashingTabClickedMessage to update the player's progress, if applicable.
|
||||
on :message, :flashing_tab_clicked do |player, message|
|
||||
if (player.in_tutorial_island && message.tab == SurvivalConstants::INVENTORY_TAB_INDEX && player.tutorial_island_progress == :given_axe)
|
||||
if player.in_tutorial_island && message.tab == SurvivalConstants::INVENTORY_TAB_INDEX &&
|
||||
player.tutorial_island_progress == :given_axe
|
||||
player.tutorial_island_progress = :cut_tree
|
||||
message.terminate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,30 +5,26 @@ java_import 'org.apollo.game.model.entity.Player'
|
||||
# Declare the tutorial island progress attribute.
|
||||
declare_attribute(:tutorial_island_progress, :not_started, :persistent)
|
||||
|
||||
|
||||
# The existing player class.
|
||||
class Player
|
||||
|
||||
# Returns whether or not this Player is currently on tutorial island.
|
||||
def in_tutorial_island
|
||||
x, y = self.position.x, self.position.y
|
||||
|
||||
return above_ground(x, y) || below_ground(x, y)
|
||||
x = position.x
|
||||
y = position.y
|
||||
above_ground(x, y) || below_ground(x, y)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
# Returns whether or not the specified coordinate pair is above ground on tutorial island.
|
||||
def above_ground(x, y)
|
||||
return (x >= 3053 && x <= 3156 && y >= 3056 && y <= 3136)
|
||||
x >= 3053 && x <= 3156 && y >= 3056 && y <= 3136
|
||||
end
|
||||
|
||||
|
||||
# Returns whether or not the specified coordinate pair is 'below' ground on tutorial island.
|
||||
def below_ground(x, y)
|
||||
return (x >= 3072 && x <= 3118 && y >= 9492 && y <= 9535)
|
||||
end
|
||||
x >= 3072 && x <= 3118 && y >= 9492 && y <= 9535
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user