From 8038833df8649718e137fc75ea0d5fce5b8d4d80 Mon Sep 17 00:00:00 2001 From: Major- Date: Fri, 14 Feb 2014 23:04:04 +0000 Subject: [PATCH] Add cmd-animate plugin. --- data/plugins/cmd-animate/animate.rb | 24 ++++++++++++++++++++++++ data/plugins/cmd-animate/plugin.xml | 14 ++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 data/plugins/cmd-animate/animate.rb create mode 100644 data/plugins/cmd-animate/plugin.xml diff --git a/data/plugins/cmd-animate/animate.rb b/data/plugins/cmd-animate/animate.rb new file mode 100644 index 00000000..9b019aaa --- /dev/null +++ b/data/plugins/cmd-animate/animate.rb @@ -0,0 +1,24 @@ +require 'java' + +java_import 'org.apollo.game.model.Animation' +java_import 'org.apollo.game.model.Graphic' + +on :command, :animate, RIGHTS_MOD do |player, command| + args = command.arguments + unless args.length == 1 + player.send_message('Invalid syntax - ::animate [animation-id]') + return + end + + player.play_animation(Animation.new(args[0].to_i)) +end + +on :command, :graphic, RIGHTS_MOD do |player, command| + args = command.arguments + unless args.length == 1 + player.send_message('Invalid syntax - ::graphic [graphic-id]') + return + end + + player.play_graphic(Graphic.new(args[0].to_i)) +end \ No newline at end of file diff --git a/data/plugins/cmd-animate/plugin.xml b/data/plugins/cmd-animate/plugin.xml new file mode 100644 index 00000000..8f08c865 --- /dev/null +++ b/data/plugins/cmd-animate/plugin.xml @@ -0,0 +1,14 @@ + + + cmd-animate + 1 + Animate Commands + Adds animation-related commands. + + Major + + + + + +