Add npcinfo command.

This commit is contained in:
Major-
2014-01-26 21:18:59 +00:00
parent c9dc1c72ad
commit 5162ca680a
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -42,4 +42,19 @@ on :command, :iteminfo, RIGHTS_ADMIN do |player, command|
members = definition.is_members_only ? "members" : "not members"
player.send_message("Item #{id} is called #{definition.name}, is #{members} only, and has a team of #{definition.team}.")
player.send_message("Its description is \"#{definition.description}\".")
end
on :command, :npcinfo, RIGHTS_ADMIN do |player, command|
args = command.arguments
unless args.length == 1
player.send_message("Invalid syntax - ::npcinfo [npc id]")
return
end
id = args[0].to_i
definition = NpcDefinition.lookup(id)
is_combative = definition.has_combat_level ? "has a combat level of #{definition.combat_level}" : "does not have a combat level"
player.send_message("Npc #{id} is called #{definition.name} and #{is_combative}.")
player.send_message("Its description is \"#{definition.description}\".")
end
@@ -43,7 +43,7 @@ public final class NpcDefinition {
for (int id = 0; id < definitions.length; id++) {
NpcDefinition def = definitions[id];
if (def.getId() != id) {
throw new RuntimeException("NPC definition id mismatch");
throw new RuntimeException("npc definition id mismatch");
}
}
}