mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 16:49:11 +00:00
Fix formatting throughout various plugins.
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
area :name => :duel_arena, :coordinates => [ 3327, 3200, 3392, 3286 ], :actions => :pvp
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<plugin>
|
||||
<id>areas</id>
|
||||
<version>0.9</version>
|
||||
<name>Areas</name>
|
||||
<description>Adds support for areas.</description>
|
||||
<authors>
|
||||
<author>Major</author>
|
||||
</authors>
|
||||
<scripts>
|
||||
<script>actions.rb</script>
|
||||
<script>areas.rb</script>
|
||||
</scripts>
|
||||
<dependencies />
|
||||
</plugin>
|
||||
Reference in New Issue
Block a user