mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
Rebase the MessageHandler, MessageHandlerChain and MessageHandlerChainSet
Rebased several other pieces of code
This commit is contained in:
@@ -24,26 +24,26 @@ end
|
||||
|
||||
|
||||
# Intercepts the item on object message.
|
||||
on :message, :item_on_object do |ctx, player, message|
|
||||
on :message, :item_on_object do |player, message|
|
||||
talisman = TALISMANS[message.id]; altar = ENTRANCE_ALTARS[message.object_id]
|
||||
unless (talisman.nil? || altar.nil?)
|
||||
player.start_action(TeleportAction.new(player, message.position, 2, altar.entrance_position))
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
end
|
||||
end
|
||||
|
||||
# Intercepts the first object action message.
|
||||
on :message, :object_action do |ctx, player, message|
|
||||
on :message, :object_action do |player, message|
|
||||
if (message.option == 1)
|
||||
object_id = message.id
|
||||
|
||||
if (altar = PORTALS[object_id]) != nil # Get the altar associated with this exit portal.
|
||||
player.start_action(TeleportAction.new(player, altar.entrance_position, 1, altar.exit_position))
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
elsif (rune = RUNES[object_id]) != nil # Get the rune associated with this altar.
|
||||
altar = CRAFTING_ALTARS[object_id]
|
||||
player.start_action(RunecraftingAction.new(player, rune, altar.crafting_centre))
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,11 +30,11 @@ def append_talisman(hash)
|
||||
end
|
||||
|
||||
# Intercepts the item option message.
|
||||
on :message, :fourth_item_option do |ctx, player, message|
|
||||
on :message, :fourth_item_option do |player, message|
|
||||
talisman = TALISMANS[message.id]
|
||||
if (talisman != nil)
|
||||
player.send_message(talisman.get_message(player.position))
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ on :login do |event, player|
|
||||
end
|
||||
|
||||
# Intercepts the SecondObjectAction message to support left-click access to the altar when wielding the correct tiara.
|
||||
on :message, :second_object_action do |ctx, player, message|
|
||||
on :message, :second_object_action do |player, message|
|
||||
object_id = message.id
|
||||
tiara = TIARAS_BY_ALTAR[object_id]
|
||||
next if tiara.nil?
|
||||
@@ -73,37 +73,37 @@ on :message, :second_object_action do |ctx, player, message|
|
||||
altar = ENTRANCE_ALTARS[tiara.altar]
|
||||
player.start_action(TeleportAction.new(player, message.position, 2, altar.entrance_position)) unless altar.nil?
|
||||
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
end
|
||||
end
|
||||
|
||||
# Intercepts the SecondItemAction message to allow for config sending.
|
||||
on :message, :second_item_option do |ctx, player, message|
|
||||
on :message, :second_item_option do |player, message|
|
||||
tiara = TIARAS_BY_ID[message.id]
|
||||
|
||||
unless tiara.nil?
|
||||
tiara.send_config(player)
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
end
|
||||
end
|
||||
|
||||
# Intercepts the FirstItemAction message to allow for config sending.
|
||||
on :message, :first_item_action do |ctx, player, message|
|
||||
on :message, :first_item_action do |player, message|
|
||||
tiara = TIARAS_BY_ID[message.id]
|
||||
|
||||
unless tiara.nil?
|
||||
send_empty_config(player)
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
end
|
||||
end
|
||||
|
||||
# Intercepts the ItemOnObject message to create the tiara.
|
||||
on :message, :item_on_object do |ctx, player, message|
|
||||
on :message, :item_on_object do |player, message|
|
||||
tiara= TIARAS_BY_TALISMAN[message.id]; altar = CRAFTING_ALTARS[message.object_id]
|
||||
return if (tiara.nil? || altar.nil?)
|
||||
|
||||
player.start_action(CreateTiaraAction.new(player, message.position, tiara, altar))
|
||||
ctx.break_handler_chain
|
||||
message.terminate
|
||||
end
|
||||
|
||||
# An action lets the player create a tiara when it comes within the specified distance of a specified position.
|
||||
|
||||
Reference in New Issue
Block a user