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
+15 -13
View File
@@ -1,4 +1,4 @@
# Thanks to Sillhouette <http://www.rune-server.org/members/silhouette/> for posting
# Thanks to Sillhouette <http://www.rune-server.org/members/silhouette> for posting
# a large amount of Herblore skill data which has been thankfully used in this plugin.
require 'java'
@@ -13,15 +13,14 @@ HERBLORE_ITEM_ON_ITEM = {}
DRINK_ITEM = {}
# A module which describes an invocable method of the Herblore skill.
module HerbloreMethod
def self.new
raise 'You cannot instantiate this module!'
fail 'You cannot instantiate this module!'
end
def invoke(player, primary, secondary)
raise NotImplementedError.new('You must implement the invocation of HerbloreMethod!')
def invoke(_player, _primary, _secondary)
fail 'You must implement the invocation of HerbloreMethod!'
end
end
@@ -76,25 +75,28 @@ def append_herblore_item(method, key, secondary = -1)
end
end
# Utility method for checking if a player's inventory has an item of the specified id, with optionally the specified amount (1 by default), at the specified slot.
# Utility method for checking if a player's inventory has a of the specified id, with optionally
# the specified amount (1 by default), at the specified slot.
def check_slot(player, slot, id, amount = 1)
item = player.inventory.get(slot)
return (!item.nil? and item.id == id and item.amount >= amount)
!item.nil? && item.id == id && item.amount >= amount
end
# Utility method for checking if a player's Herblore (maximum) level is at a required height. Also informs the player if this is not the case with use of the action
# variable, like so: "You need a Herblore level of at least #{required.to_s} to #{action}."
# Utility method for checking if a player's Herblore (maximum) level is at the required level. Also
# informs the player if this is not the case with use of the action variable, like so:
# "You need a Herblore level of at least #{required.to_s} to #{action}."
def check_skill(player, required, action)
if (required > player.skill_set.get_skill(Skill::HERBLORE).current_level)
if required > player.skill_set.get_skill(Skill::HERBLORE).current_level
player.send_message("You need a Herblore level of at least #{required} to #{action}.")
return false
end
return true
true
end
# Opens a 'make' dialogue for the specified player, displaying the specified item. Optionally, a listener can be used for the dialogue.
# Opens a 'make' dialogue for the specified player, displaying the specified item. Optionally, a
# listener can be used for the dialogue.
def open_dialogue(player, item, listener = nil)
player.send(SetWidgetItemModelMessage.new(1746, item, 170))
player.interface_set.open_dialogue(listener, HERBLORE_DIALOGUE)
end
end