Update all plugins to conform to Rubocop.

This commit is contained in:
Major-
2015-08-27 18:17:58 +01:00
parent 424d2bda29
commit 8f3fd75b33
75 changed files with 1625 additions and 1537 deletions
@@ -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