diff --git a/data/plugins/areas/actions.rb b/data/plugins/areas/actions.rb
index 5c8872c5..37610f06 100644
--- a/data/plugins/areas/actions.rb
+++ b/data/plugins/areas/actions.rb
@@ -25,17 +25,17 @@ class AreaAction
# Called when the player has entered an area this action is registered to.
def entered(player)
- @on_enter.call(player) unless @on_enter == nil
+ @on_enter.call(player) unless @on_enter.nil?
end
# Called while the player is in area this action is registered to.
def inside(player)
- @while_in.call(player) unless @while_in == nil
+ @while_in.call(player) unless @while_in.nil?
end
# Called when the player has exited an area this action is registered to.
def exited(player)
- @on_exit.call(player) unless @on_exit == nil
+ @on_exit.call(player) unless @on_exit.nil?
end
end
@@ -46,23 +46,23 @@ def area_action(name, &block)
action.instance_eval(&block)
end
-# Defines a pvp area action.
+# Defines the pvp area action.
area_action :pvp do
- on_entry { |player| player.set_attribute("pvp", :boolean, true ) }
- on_exit { |player| player.set_attribute("pvp", :boolean, false) }
+ on_entry { |player| player.in_pvp = true }
+ on_exit { |player| player.in_pvp = true }
end
-# Defines a multi-combat area action.
+# Defines the wilderness area action.
area_action :wilderness do
on_entry do |player|
- player.send(DisplayCrossbonesEvent.new(true))
- player.set_attribute("wilderness", :boolean, true)
+ player.send(DisplayCrossbonesEvent.new(true))
+ player.in_wilderness = true
end
on_exit do |player|
player.send(DisplayCrossbonesEvent.new(false))
- player.set_attribute("wilderness", :boolean, false)
+ player.in_wilderness = false
end
end
\ No newline at end of file
diff --git a/data/plugins/areas/areas.rb b/data/plugins/areas/areas.rb
index a43f1ce4..fd260542 100644
--- a/data/plugins/areas/areas.rb
+++ b/data/plugins/areas/areas.rb
@@ -2,6 +2,8 @@ require 'java'
java_import 'org.apollo.game.model.entity.Player'
+# Todo make 0 the default height
+
# A map of coordinates (as an array) to areas.
AREAS = []
@@ -33,12 +35,12 @@ end
# Creates a new area and registers it with the supplied coordinates.
def area(hash)
- raise "Hash must contain a name, coordinates, and actions pair." unless hash.has_key?(:name) && hash.has_key?(:coordinates) && hash.has_key?(:actions)
+ raise 'Hash must contain a name, coordinates, and actions pair.' unless hash.has_key?(:name) && hash.has_key?(:coordinates) && hash.has_key?(:actions)
name = hash[:name]; coordinates = hash[:coordinates]; actions = hash[:actions]
AREAS << Area.new(name, coordinates, actions.is_a?(Symbol) ? [actions] : actions)
end
-# Coordinates refer to the bottom-left position (min_x, min_y) and the top-right position (max_x, max_y), followed by the height.
+# Coordinates refer to the bottom-left position (min_x, min_y) and the top-right position (max_x, max_y), followed by the height (optional).
area :name => :wilderness, :coordinates => [ 2944, 3520, 3391, 3967, 0 ], :actions => [ :pvp, :multicombat, :wilderness ]
-area :name => :duel_arena, :coordinates => [ 3327, 3200, 3392, 3286, 0 ], :actions => :pvp
\ No newline at end of file
+area :name => :duel_arena, :coordinates => [ 3327, 3200, 3392, 3286 ], :actions => :pvp
\ No newline at end of file
diff --git a/data/plugins/areas/plugin.xml b/data/plugins/areas/plugin.xml
new file mode 100644
index 00000000..2c18bb32
--- /dev/null
+++ b/data/plugins/areas/plugin.xml
@@ -0,0 +1,15 @@
+
+
+ areas
+ 0.9
+ Areas
+ Adds support for areas.
+
+ Major
+
+
+
+
+
+
+
diff --git a/data/plugins/bootstrap.rb b/data/plugins/bootstrap.rb
deleted file mode 100644
index 26ee1090..00000000
--- a/data/plugins/bootstrap.rb
+++ /dev/null
@@ -1,221 +0,0 @@
-# A script to 'bootstrap' all of the other plugins, wrapping Apollo's verbose
-# Java-style API in a Ruby-style API.
-#
-# Written by Graham.
-
-# ********************************** WARNING **********************************
-# * If you do not really understand what this is for, do not edit it without *
-# * creating a backup! Many plugins rely on the behaviour of this script, and *
-# * will break if you mess it up. *
-# * *
-# * This is actually part of the core server and in an ideal world shouldn't *
-# * be changed. *
-# *****************************************************************************
-
-require 'java'
-
-java_import 'org.apollo.game.command.CommandListener'
-java_import 'org.apollo.game.event.handler.EventHandler'
-java_import 'org.apollo.game.login.LoginListener'
-java_import 'org.apollo.game.login.LogoutListener'
-java_import 'org.apollo.game.model.World'
-java_import 'org.apollo.game.model.entity.Player'
-java_import 'org.apollo.game.model.setting.PrivilegeLevel'
-java_import 'org.apollo.game.scheduling.ScheduledTask'
-
-# Alias the privilege levels.
-RIGHTS_ADMIN = PrivilegeLevel::ADMINISTRATOR
-RIGHTS_MOD = PrivilegeLevel::MODERATOR
-RIGHTS_STANDARD = PrivilegeLevel::STANDARD
-
-# Extends the (Ruby) String class with a method to convert a lower case,
-# underscore delimited string to camel-case.
-class String
- def camelize
- gsub(/(?:^|_)(.)/) { $1.upcase }
- end
-end
-
-# A CommandListener that executes a Proc object with two arguments: the player
-# and the command.
-class ProcCommandListener < CommandListener
- def initialize(rights, block)
- super rights
- @block = block
- end
-
- def execute(player, command)
- @block.call(player, command)
- end
-end
-
-# A LoginListener that executes a Proc object with the player argument.
-class ProcLoginListener
- java_implements LoginListener
-
- def initialize(block)
- super()
- @block = block
- end
-
- def execute(player)
- @block.call(player)
- end
-end
-
-# A LogoutListener that executes a Proc object with the player argument.
-class ProcLogoutListener
- java_implements LogoutListener
-
- def initialize(block)
- super()
- @block = block
- end
-
- def execute(player)
- @block.call(player)
- end
-end
-
-# An EventHandler which executes a Proc object with three arguments: the chain
-# context, the player and the event.
-class ProcEventHandler < EventHandler
- def initialize(block)
- super() # required (with brackets!), see http://jira.codehaus.org/browse/JRUBY-679
- @block = block
- end
-
- def handle(ctx, player, event)
- @block.call(ctx, player, event)
- end
-end
-
-# A ScheduledTask which executes a Proc object with one argument (itself).
-class ProcScheduledTask < ScheduledTask
- def initialize(delay, immediate, block)
- super(delay, immediate)
- @block = block
- end
-
- def execute
- @block.call(self)
- end
-end
-
-# Schedules a ScheduledTask. Can be used in two ways: passing an existing
-# ScheduledTask object or passing a block along with one or two parameters: the
-# delay (in pulses) and, optionally, the immediate flag.
-#
-# If the immediate flag is not given, it defaults to false.
-#
-# The ScheduledTask object is passed to the block so that methods such as
-# setDelay and stop can be called. execute MUST NOT be called - if it is, the
-# behaviour is undefined (and most likely it'll be bad).
-def schedule(*args, &block)
- if block_given?
- raise 'Invalid combination of arguments.' unless args.length == 1 or args.length == 2
- delay = args[0]
- immediate = args.length == 2 ? args[1] : false
- World.world.schedule(ProcScheduledTask.new(delay, immediate, block))
- elsif args.length == 1
- World.world.schedule(args[0])
- else
- raise 'Invalid combination of arguments.'
- end
-end
-
-# Defines some sort of action to take upon an event. The following types of
-# event are currently valid:
-#
-# * :command
-# * :event
-# * :button
-# * :login
-# * :logout
-#
-# A command takes one or two arguments (the command name and optionally the
-# minimum rights level to use it). The minimum rights level defaults to
-# STANDARD. The block should have two arguments: player and command.
-#
-# An event takes no arguments. The block should have three arguments: the chain
-# context, the player and the event object.
-#
-# A button takes one argument (the id). The block should have one argument: the
-# player who clicked the button.
-def on(type, *args, &block)
- case type
- when :command then on_command(args, block)
- when :event then on_event(args, block)
- when :button then on_button(args, block)
- when :login then on_login(block)
- when :logout then on_logout(block)
- else raise 'Unknown event type.'
- end
-end
-
-# Defines an action to be taken upon a button press.
-def on_button(args, proc)
- raise 'Button must have one argument.' unless args.length == 1
-
- id = args[0].to_i
-
- on :event, :button do |ctx, player, event|
- proc.call(player) if event.widget_id == id
- end
-end
-
-# Defines an action to be taken upon an event.
-# The event can either be a symbol with the lower case, underscored class name
-# or the class itself.
-def on_event(args, proc)
- raise "event must have one argument" unless args.length == 1
-
- event = args[0]
- if event.is_a?(Symbol)
- class_name = event.to_s.camelize.concat('Event')
- event = Java::JavaClass.for_name("org.apollo.game.event.impl.#{class_name}")
- end
-
- $ctx.add_last_event_handler(event, ProcEventHandler.new(proc))
-end
-
-# Defines an action to be taken upon a command.
-def on_command(args, proc)
- raise 'Command event must have one or two arguments.' unless (1..2).include?(args.length)
-
- rights = args.length == 2 ? args[1] : RIGHTS_STANDARD
- $ctx.add_command_listener(args[0].to_s, ProcCommandListener.new(rights, proc))
-end
-
-# Defines an action to be taken upon login.
-def on_login(proc)
- $ctx.add_login_listener(ProcLoginListener.new(proc))
-end
-
-# Defines an action to be taken upon logout.
-def on_logout(proc)
- $ctx.add_logout_listener(ProcLogoutListener.new(proc))
-end
-
-# Ids of in-game skills.
-ATTACK_SKILL_ID = 0
-DEFENCE_SKILL_ID = 1
-STRENGTH_SKILL_ID = 2
-HITPOINTS_SKILL_ID = 3
-RANGED_SKILL_ID = 4
-PRAYER_SKILL_ID = 5
-MAGIC_SKILL_ID = 6
-COOKING_SKILL_ID = 7
-WOODCUTTING_SKILL_ID = 8
-FLETCHING_SKILL_ID = 9
-FISHING_SKILL_ID = 10
-FIREMAKING_SKILL_ID = 11
-CRAFTING_SKILL_ID = 12
-SMITHING_SKILL_ID = 13
-MINING_SKILL_ID = 14
-HERBLORE_SKILL_ID = 15
-AGILITY_SKILL_ID = 16
-THIEVING_SKILL_ID = 17
-SLAYER_SKILL_ID = 18
-FARMING_SKILL_ID = 19
-RUNECRAFT_SKILL_ID = 20
\ No newline at end of file
diff --git a/data/plugins/cmd/item/item.rb b/data/plugins/cmd/item/item.rb
index 3c53cf19..05307ad9 100644
--- a/data/plugins/cmd/item/item.rb
+++ b/data/plugins/cmd/item/item.rb
@@ -45,7 +45,7 @@ end
# Gives the player one thousand of each rune.
on :command, :runes, RIGHTS_ADMIN do |player, command|
- (554..566).each do |i|
- player.inventory.add(i, 1000)
- end
+ (554..566).each do |i|
+ player.inventory.add(i, 1000)
+ end
end
\ No newline at end of file
diff --git a/data/plugins/private-messaging/messaging.rb b/data/plugins/private-messaging/messaging.rb
index e50a2ec6..f9b1569b 100644
--- a/data/plugins/private-messaging/messaging.rb
+++ b/data/plugins/private-messaging/messaging.rb
@@ -12,7 +12,7 @@ end
# Checks if the sender is permitted to interact with the friend they have added:
def interaction_permitted(sender, friend)
if friend == nil || friend.has_ignored(sender.username)
- return false
+ return false
end
return friend.friends_with(sender.username) ? friend.friend_privacy != PrivacyState::OFF : friend.friend_privacy == PrivacyState::ON
diff --git a/data/plugins/skill/herblore/plugin.xml b/data/plugins/skill/herblore/plugin.xml
index fa70d938..748712be 100644
--- a/data/plugins/skill/herblore/plugin.xml
+++ b/data/plugins/skill/herblore/plugin.xml
@@ -9,10 +9,10 @@
Major
-
-
-
-
+
+
+
+
\ No newline at end of file