mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-06 00:38:18 +00:00
Add magic plugin, more decoders and commands.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
require 'java'
|
||||
java_import 'org.apollo.game.model.Player'
|
||||
|
||||
on :command, :lookup, RIGHTS_ADMIN do |player, command|
|
||||
args = command.arguments.to_a
|
||||
unless args.length > 1
|
||||
player.send_message("Invalid syntax - ::lookup [npc/object/item] [name]")
|
||||
return
|
||||
end
|
||||
|
||||
type = args.shift.downcase
|
||||
name = args.join(" ").downcase
|
||||
|
||||
if ["npc","object","item"].index(type) == nil
|
||||
player.send_message("Invalid syntax - ::lookup [npc/object/item] [name]")
|
||||
return
|
||||
end
|
||||
|
||||
Kernel.const_get("#{type.capitalize}Definition").definitions.each do |definition|
|
||||
if definition.name.to_s.downcase == name
|
||||
player.send_message("That #{type} has id #{definition.id}.")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
player.send_message("Could not find an #{type} called #{name}.")
|
||||
end
|
||||
|
||||
on :command, :iteminfo, RIGHTS_ADMIN do |player, command|
|
||||
args = command.arguments
|
||||
unless args.length == 1
|
||||
player.send_message("Invalid syntax - ::iteminfo [item id]")
|
||||
return
|
||||
end
|
||||
|
||||
id = args[0].to_i
|
||||
definition = ItemDefinition.lookup(id)
|
||||
|
||||
members = definition.is_members_only ? "members" : "not members"
|
||||
player.send_message("Item #{id} is called #{definition.name}, is #{members} only, and a has a team of #{definition.team}.")
|
||||
player.send_message("Its description is \"#{definition.description}\".")
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<plugin>
|
||||
<id>cmd-lookup</id>
|
||||
<version>1</version>
|
||||
<name>Lookup Command</name>
|
||||
<description>Adds a ::lookup command.</description>
|
||||
<authors>
|
||||
<author>Major</author>
|
||||
</authors>
|
||||
<scripts>
|
||||
<script>lookup.rb</script>
|
||||
</scripts>
|
||||
<dependencies />
|
||||
</plugin>
|
||||
Reference in New Issue
Block a user