mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
Plugin cleanup.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
require 'java'
|
||||
|
||||
java_import 'org.apollo.game.model.def.NpcDefinition'
|
||||
java_import 'org.apollo.game.model.Npc'
|
||||
java_import 'org.apollo.game.model.World'
|
||||
java_import 'org.apollo.game.model.Position'
|
||||
@@ -9,8 +8,7 @@ blacklist = []
|
||||
|
||||
on :command, :spawn, RIGHTS_ADMIN do |player, command|
|
||||
args = command.arguments
|
||||
id = args[0].to_i
|
||||
unless [1, 3].include? args.length and id > -1
|
||||
unless [1, 3].include? args.length and (id = args[0].to_i) > -1
|
||||
player.send_message("Invalid syntax - ::spawn [npc id] [x] [y]")
|
||||
return
|
||||
end
|
||||
@@ -20,27 +18,19 @@ on :command, :spawn, RIGHTS_ADMIN do |player, command|
|
||||
return
|
||||
end
|
||||
|
||||
definition = NpcDefinition.lookup(id)
|
||||
position = args.length == 1 ? player.position : Position.new(args[1].to_i, args[2].to_i, player.position.height)
|
||||
|
||||
World.world.register(Npc.new(definition, position))
|
||||
World.world.register(Npc.new(id, position))
|
||||
end
|
||||
|
||||
|
||||
on :command, :mass, RIGHTS_ADMIN do |player, command|
|
||||
args = command.arguments
|
||||
unless args.length == 2
|
||||
unless args.length == 2 and (id = args[0].to_i) > -1 and (1..5).include? (range = args[1].to_i)
|
||||
player.send_message("Invalid syntax - ::spawn [npc id] [range (1-5)]")
|
||||
return
|
||||
end
|
||||
|
||||
id = args[0].to_i
|
||||
range = args[1].to_i
|
||||
|
||||
unless (id > -1 and (1..5).include? range)
|
||||
return player.send_message("Invalid syntax - ::spawn [npc id] [range (1-5)]")
|
||||
end
|
||||
|
||||
if blacklist.include? id
|
||||
player.send_message("Sorry, that npc is blacklisted!")
|
||||
return
|
||||
@@ -55,7 +45,7 @@ on :command, :mass, RIGHTS_ADMIN do |player, command|
|
||||
|
||||
for x in minX..maxX do
|
||||
for y in minY..maxY do
|
||||
World.world.register(Npc.new(NpcDefinition.lookup(id), Position.new(x, y, center_position.height)))
|
||||
World.world.register(Npc.new(id, Position.new(x, y, center_position.height)))
|
||||
end
|
||||
end
|
||||
player.send_message("Mass spawning npcs with id #{id}.")
|
||||
|
||||
Reference in New Issue
Block a user