mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 16:49:12 +00:00
Fix bug where mobs were still referred to as characters in plugins.
This commit is contained in:
@@ -81,13 +81,10 @@ end
|
|||||||
# behaviour is undefined (and most likely it'll be bad).
|
# behaviour is undefined (and most likely it'll be bad).
|
||||||
def schedule(*args, &block)
|
def schedule(*args, &block)
|
||||||
if block_given?
|
if block_given?
|
||||||
if args.length == 1 or args.length == 2
|
raise "invalid combination of arguments" unless args.length == 1 or args.length == 2
|
||||||
delay = args[0]
|
delay = args[0]
|
||||||
immediate = args.length == 2 ? args[1] : false
|
immediate = args.length == 2 ? args[1] : false
|
||||||
World.world.schedule(ProcScheduledTask.new(delay, immediate, block))
|
World.world.schedule(ProcScheduledTask.new(delay, immediate, block))
|
||||||
else
|
|
||||||
raise "invalid combination of arguments"
|
|
||||||
end
|
|
||||||
elsif args.length == 1
|
elsif args.length == 1
|
||||||
World.world.schedule(args[0])
|
World.world.schedule(args[0])
|
||||||
else
|
else
|
||||||
@@ -95,7 +92,7 @@ def schedule(*args, &block)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Defines some sort of action to take upon an event. The following 'kinds' of
|
# Defines some sort of action to take upon an event. The following types of
|
||||||
# event are currently valid:
|
# event are currently valid:
|
||||||
#
|
#
|
||||||
# * :command
|
# * :command
|
||||||
@@ -111,8 +108,8 @@ end
|
|||||||
#
|
#
|
||||||
# A button takes one argument (the id). The block should have one argument: the
|
# A button takes one argument (the id). The block should have one argument: the
|
||||||
# player who clicked the button.
|
# player who clicked the button.
|
||||||
def on(kind, *args, &block)
|
def on(type, *args, &block)
|
||||||
case kind
|
case type
|
||||||
when :command then on_command(args, block)
|
when :command then on_command(args, block)
|
||||||
when :event then on_event(args, block)
|
when :event then on_event(args, block)
|
||||||
when :button then on_button(args, block)
|
when :button then on_button(args, block)
|
||||||
|
|||||||
@@ -28,6 +28,5 @@ on :command, :xp, RIGHTS_ADMIN do |player, command|
|
|||||||
end
|
end
|
||||||
|
|
||||||
experience = args[1].to_i
|
experience = args[1].to_i
|
||||||
|
|
||||||
player.skill_set.add_experience(skill, experience)
|
player.skill_set.add_experience(skill, experience)
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
|
def dialogue(name, &block)
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
require 'java'
|
||||||
|
|
||||||
|
java_import 'org.apollo.game.model.Player'
|
||||||
|
java_import 'org.apollo.game.event.impl.PositionEvent'
|
||||||
|
java_import 'org.apollo.game.event.impl.SetTileItemEvent'
|
||||||
|
|
||||||
@@ -20,8 +20,8 @@ end
|
|||||||
class SpellAction < Action
|
class SpellAction < Action
|
||||||
attr_reader :spell, :pulses
|
attr_reader :spell, :pulses
|
||||||
|
|
||||||
def initialize(character, spell)
|
def initialize(mob, spell)
|
||||||
super(0, true, character)
|
super(0, true, mob)
|
||||||
|
|
||||||
@spell = spell
|
@spell = spell
|
||||||
@pulses = 0
|
@pulses = 0
|
||||||
@@ -44,8 +44,8 @@ class SpellAction < Action
|
|||||||
|
|
||||||
def check_skill
|
def check_skill
|
||||||
required = @spell.level
|
required = @spell.level
|
||||||
if required > character.skill_set.skill(MAGIC_ID).maximum_level
|
if required > mob.skill_set.skill(MAGIC_ID).maximum_level
|
||||||
character.send_message "You need a Magic level of at least #{required} to cast this spell."
|
mob.send_message "You need a Magic level of at least #{required} to cast this spell."
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -56,14 +56,14 @@ class SpellAction < Action
|
|||||||
elements = @spell.elements
|
elements = @spell.elements
|
||||||
|
|
||||||
elements.each do |element, amount|
|
elements.each do |element, amount|
|
||||||
unless element.check_remove(character, amount, false)
|
unless element.check_remove(mob, amount, false)
|
||||||
character.send_message "You do not have enough #{element.name}s to cast this spell."
|
mob.send_message "You do not have enough #{element.name}s to cast this spell."
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elements.each do |element, amount|
|
elements.each do |element, amount|
|
||||||
element.check_remove(character, amount, true)
|
element.check_remove(mob, amount, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -77,8 +77,8 @@ end
|
|||||||
class ItemSpellAction < SpellAction
|
class ItemSpellAction < SpellAction
|
||||||
attr_reader :slot, :item
|
attr_reader :slot, :item
|
||||||
|
|
||||||
def initialize(character, spell, slot, item)
|
def initialize(mob, spell, slot, item)
|
||||||
super(character, spell)
|
super(mob, spell)
|
||||||
|
|
||||||
@slot = slot
|
@slot = slot
|
||||||
@item = item
|
@item = item
|
||||||
@@ -88,7 +88,7 @@ class ItemSpellAction < SpellAction
|
|||||||
def execute
|
def execute
|
||||||
if @pulses == 0
|
if @pulses == 0
|
||||||
if illegal_item?
|
if illegal_item?
|
||||||
character.send_message "You cannot use that spell on this item!"
|
mob.send_message "You cannot use that spell on this item!"
|
||||||
stop
|
stop
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -98,8 +98,8 @@ class ItemSpellAction < SpellAction
|
|||||||
# TODO: There has to be a better way to do this.
|
# TODO: There has to be a better way to do this.
|
||||||
@spell.elements.each do |element, amount|
|
@spell.elements.each do |element, amount|
|
||||||
element.runes.each do |rune|
|
element.runes.each do |rune|
|
||||||
if id == rune && !element.check_remove(character, amount + 1, false)
|
if id == rune && !element.check_remove(mob, amount + 1, false)
|
||||||
character.send_message("You do not have enough " + element.name + "s to cast this spell.")
|
mob.send_message("You do not have enough " + element.name + "s to cast this spell.")
|
||||||
stop
|
stop
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ end
|
|||||||
|
|
||||||
class TeleportingAction < SpellAction
|
class TeleportingAction < SpellAction
|
||||||
|
|
||||||
def initialize(character, spell)
|
def initialize(mob, spell)
|
||||||
super(character, spell)
|
super(mob, spell)
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute_action
|
def execute_action
|
||||||
@@ -38,7 +38,7 @@ class TeleportingAction < SpellAction
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execute_modern
|
def execute_modern
|
||||||
player = character
|
player = mob
|
||||||
if @pulses == 0
|
if @pulses == 0
|
||||||
player.play_animation(MODERN_TELE_ANIM)
|
player.play_animation(MODERN_TELE_ANIM)
|
||||||
elsif @pulses == 1
|
elsif @pulses == 1
|
||||||
@@ -56,7 +56,7 @@ class TeleportingAction < SpellAction
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execute_ancient
|
def execute_ancient
|
||||||
player = character
|
player = mob
|
||||||
if @pulses == 0
|
if @pulses == 0
|
||||||
player.play_graphic(ANCIENT_TELE_GFX)
|
player.play_graphic(ANCIENT_TELE_GFX)
|
||||||
player.play_animation(ANCIENT_TELE_ANIM)
|
player.play_animation(ANCIENT_TELE_ANIM)
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
require 'java'
|
||||||
|
|
||||||
|
java_import 'org.apollo.game.model.Player'
|
||||||
|
java_import 'org.apollo.game.sync.block.SynchronizationBlock'
|
||||||
|
|
||||||
|
on :command, :headicon, RIGHTS_ADMIN do |player, command|
|
||||||
|
args = command.arguments
|
||||||
|
unless (args.length == 1)
|
||||||
|
player.send_message("Usage - ::headicon [id]")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
player.head_icon = args[0].to_i
|
||||||
|
player.send_message("Adding headicon")
|
||||||
|
player.block_set.add SynchronizationBlock.create_appearance_block(player)
|
||||||
|
end
|
||||||
|
|
||||||
|
on :command, :prayicon, RIGHTS_ADMIN do |player, command|
|
||||||
|
args = command.arguments
|
||||||
|
unless (args.length == 1)
|
||||||
|
player.send_message("Usage - ::prayicon [id]")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
player.prayer_icon = args[0].to_i
|
||||||
|
player.send_message("Adding prayicon")
|
||||||
|
player.block_set.add SynchronizationBlock.create_appearance_block(player)
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user