mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 16:49:11 +00:00
Update all plugins to conform to Rubocop.
This commit is contained in:
@@ -29,36 +29,35 @@ MUD_RUNE = 4698
|
||||
STEAM_RUNE = 4694
|
||||
LAVA_RUNE = 4699
|
||||
|
||||
# An element of a spell.
|
||||
class Element
|
||||
attr_reader :runes, :staffs, :name
|
||||
|
||||
def initialize(runes, staffs, name="Null")
|
||||
|
||||
def initialize(runes, staffs, name = 'Null')
|
||||
@runes = runes
|
||||
@staffs = staffs
|
||||
@name = name
|
||||
end
|
||||
|
||||
|
||||
def check_remove(player, amount, remove)
|
||||
weapon = player.equipment.get(EquipmentConstants::WEAPON)
|
||||
if @staffs != nil && weapon != nil
|
||||
@staffs.each do |staff|
|
||||
return true if weapon.id == staff
|
||||
end
|
||||
unless @staffs.nil? || weapon.nil?
|
||||
@staffs.each { |staff| return true if weapon.id == staff }
|
||||
end
|
||||
|
||||
|
||||
inventory = player.inventory
|
||||
|
||||
found = {}
|
||||
counter = 0
|
||||
|
||||
|
||||
inventory.items.each do |item|
|
||||
break unless counter < amount
|
||||
next if item == nil
|
||||
|
||||
next if item.nil?
|
||||
|
||||
amt = item.amount
|
||||
@runes.each do |rune|
|
||||
break unless counter < amount
|
||||
|
||||
|
||||
id = item.id
|
||||
if id == rune
|
||||
if amt >= amount
|
||||
@@ -71,42 +70,38 @@ class Element
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if counter >= amount
|
||||
if remove
|
||||
found.each do |id, amt|
|
||||
inventory.remove(id, amt)
|
||||
end
|
||||
end
|
||||
found.each { |id, amt| inventory.remove(id, amt) } if remove
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
AIR_RUNES = [ 556, 4695, 4696, 4697 ]
|
||||
WATER_RUNES = [ 555, 4695, 4698, 4694 ]
|
||||
EARTH_RUNES = [ 557, 4696, 4697, 4698 ]
|
||||
FIRE_RUNES = [ 554, 4697, 4694, 4699 ]
|
||||
AIR_RUNES = [556, 4695, 4696, 4697]
|
||||
WATER_RUNES = [555, 4695, 4698, 4694]
|
||||
EARTH_RUNES = [557, 4696, 4697, 4698]
|
||||
FIRE_RUNES = [554, 4697, 4694, 4699]
|
||||
|
||||
AIR_STAFFS = [ 1381, 1397, 1405 ]
|
||||
WATER_STAFFS = [ 1383, 1395, 1403 ]
|
||||
EARTH_STAFFS = [ 1385, 1399, 1407, 3053, 3054 ]
|
||||
FIRE_STAFFS = [ 1387, 1393, 1401, 3053, 3054 ]
|
||||
AIR_STAFFS = [1381, 1397, 1405]
|
||||
WATER_STAFFS = [1383, 1395, 1403]
|
||||
EARTH_STAFFS = [1385, 1399, 1407, 3053, 3054]
|
||||
FIRE_STAFFS = [1387, 1393, 1401, 3053, 3054]
|
||||
|
||||
AIR = Element.new(AIR_RUNES, AIR_STAFFS, "Air rune")
|
||||
WATER = Element.new(WATER_RUNES, WATER_STAFFS, "Water rune")
|
||||
EARTH = Element.new(EARTH_RUNES, EARTH_STAFFS, "Earth rune")
|
||||
FIRE = Element.new(FIRE_RUNES, FIRE_STAFFS, "Fire rune")
|
||||
AIR = Element.new(AIR_RUNES, AIR_STAFFS, 'Air rune')
|
||||
WATER = Element.new(WATER_RUNES, WATER_STAFFS, 'Water rune')
|
||||
EARTH = Element.new(EARTH_RUNES, EARTH_STAFFS, 'Earth rune')
|
||||
FIRE = Element.new(FIRE_RUNES, FIRE_STAFFS, 'Fire rune')
|
||||
|
||||
MIND = Element.new([MIND_RUNE], nil, "Mind rune")
|
||||
CHAOS = Element.new([CHAOS_RUNE], nil, "Chaos rune")
|
||||
DEATH = Element.new([DEATH_RUNE], nil, "Death rune")
|
||||
BLOOD = Element.new([BLOOD_RUNE], nil, "Blood rune")
|
||||
MIND = Element.new([MIND_RUNE], nil, 'Mind rune')
|
||||
CHAOS = Element.new([CHAOS_RUNE], nil, 'Chaos rune')
|
||||
DEATH = Element.new([DEATH_RUNE], nil, 'Death rune')
|
||||
BLOOD = Element.new([BLOOD_RUNE], nil, 'Blood rune')
|
||||
|
||||
COSMIC = Element.new([COSMIC_RUNE], nil, "Cosmic rune")
|
||||
LAW = Element.new([LAW_RUNE], nil, "Law rune")
|
||||
NATURE = Element.new([NATURE_RUNE], nil, "Nature rune")
|
||||
SOUL = Element.new([SOUL_RUNE], nil, "Soul rune")
|
||||
COSMIC = Element.new([COSMIC_RUNE], nil, 'Cosmic rune')
|
||||
LAW = Element.new([LAW_RUNE], nil, 'Law rune')
|
||||
NATURE = Element.new([NATURE_RUNE], nil, 'Nature rune')
|
||||
SOUL = Element.new([SOUL_RUNE], nil, 'Soul rune')
|
||||
|
||||
Reference in New Issue
Block a user