mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Rename Events to Messages.
This commit is contained in:
@@ -65,7 +65,7 @@ class HerbIdentificationAction < Action
|
||||
end
|
||||
end
|
||||
|
||||
# Appends a herb to the InventoryItemEvent interception.
|
||||
# Appends a herb to the InventoryItemMessage interception.
|
||||
def append_herb(item_id, unidentified, level, experience)
|
||||
herb = Herb.new(item_id, unidentified, level, experience)
|
||||
append_herblore_item(herb, unidentified)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
require 'java'
|
||||
|
||||
java_import 'org.apollo.game.event.impl.SetWidgetItemModelEvent'
|
||||
java_import 'org.apollo.game.message.impl.SetWidgetItemModelMessage'
|
||||
java_import 'org.apollo.game.model.entity.Skill'
|
||||
|
||||
HERBLORE_DIALOGUE = 4429
|
||||
@@ -25,15 +25,15 @@ module HerbloreMethod
|
||||
end
|
||||
end
|
||||
|
||||
# The ItemOnItemEvent handler for all Herblore-related functions.
|
||||
on :event, :item_on_item do |ctx, player, event|
|
||||
primary = event.id
|
||||
secondary = event.target_id
|
||||
# The ItemOnItemMessage handler for all Herblore-related functions.
|
||||
on :message, :item_on_item do |ctx, player, message|
|
||||
primary = message.id
|
||||
secondary = message.target_id
|
||||
hash = HERBLORE_ITEM_ON_ITEM[primary]
|
||||
|
||||
if hash == nil
|
||||
secondary = event.id
|
||||
primary = event.target_id
|
||||
secondary = message.id
|
||||
primary = message.target_id
|
||||
hash = HERBLORE_ITEM_ON_ITEM[primary]
|
||||
end
|
||||
|
||||
@@ -46,19 +46,19 @@ on :event, :item_on_item do |ctx, player, event|
|
||||
end
|
||||
end
|
||||
|
||||
# The ItemOptionEvent handler for all Herblore-related functions.
|
||||
on :event, :first_item_option do |ctx, player, event|
|
||||
id = event.id
|
||||
# The ItemOptionMessage handler for all Herblore-related functions.
|
||||
on :message, :first_item_option do |ctx, player, message|
|
||||
id = message.id
|
||||
method = HERBLORE_ITEM[id]
|
||||
|
||||
if method != nil
|
||||
method.invoke(player, id, event.slot)
|
||||
method.invoke(player, id, message.slot)
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
method = DRINK_ITEM[id]
|
||||
|
||||
if method != nil
|
||||
method.invoke(player, id, event.slot)
|
||||
method.invoke(player, id, message.slot)
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
@@ -83,7 +83,7 @@ def check_slot(player, slot, id, amount = 1)
|
||||
end
|
||||
|
||||
# Utility method for checking if a player's Herblore (maximum) level is at a required height. Also informs the player if this is not the case with use of the action
|
||||
# variable, like so: "You need a Herblore level of at least #{required.to_s} to #{action}."
|
||||
# variable, like so: "You need a Herblore level of at least #{required.to_s} to #{action}."
|
||||
def check_skill(player, required, action)
|
||||
if required > player.skill_set.skill(HERBLORE_SKILL_ID).current_level
|
||||
player.send_message("You need a Herblore level of at least #{required} to #{action}.")
|
||||
@@ -94,6 +94,6 @@ end
|
||||
|
||||
# Opens a 'make' dialogue for the specified player, displaying the specified item. Optionally, a listener can be used for the dialogue.
|
||||
def open_dialogue(player, item, listener = nil)
|
||||
player.send(SetWidgetItemModelEvent.new(1746, item, 170))
|
||||
player.send(SetWidgetItemModelMessage.new(1746, item, 170))
|
||||
player.interface_set.open_dialogue(listener, HERBLORE_DIALOGUE)
|
||||
end
|
||||
@@ -223,11 +223,11 @@ class GrindingAction < Action
|
||||
end
|
||||
end
|
||||
|
||||
# Appends a grinded ingredient to the ItemOnItemEvent handler interception.
|
||||
# Appends a ground ingredient to the ItemOnItemMessage handler interception.
|
||||
def append_ground(id, raw)
|
||||
grinded = GroundIngredient.new(id, raw)
|
||||
append_herblore_item(grinded, PESTLE_MORTAR, raw)
|
||||
return grinded
|
||||
ground = GroundIngredient.new(id, raw)
|
||||
append_herblore_item(ground, PESTLE_MORTAR, raw)
|
||||
return ground
|
||||
end
|
||||
|
||||
# Normal ingredients
|
||||
|
||||
@@ -310,14 +310,14 @@ class FinishedMixingAction < MixingAction
|
||||
end
|
||||
end
|
||||
|
||||
# Appends a finished potion to the ItemOnItemEvent handling interception.
|
||||
# Appends a finished potion to the ItemOnItemMessage handling interception.
|
||||
def append_finished_potion(item, unfinished, ingredient, level, experience)
|
||||
potion = FinishedPotion.new(item, [ unfinished, ingredient ], level, experience)
|
||||
append_herblore_item(potion, unfinished.item_id, ingredient.item_id)
|
||||
return potion
|
||||
end
|
||||
|
||||
# Appends an unfinished potion to the ItemOnItemEvent handling interception.
|
||||
# Appends an unfinished potion to the ItemOnItemMessage handling interception.
|
||||
def append_unfinished_potion(item, herb, level)
|
||||
potion = UnfinishedPotion.new(item, herb, level)
|
||||
append_herblore_item(potion, herb.item_id, WATER_VIAL_ID)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
require 'java'
|
||||
|
||||
java_import 'org.apollo.game.action.Action'
|
||||
java_import 'org.apollo.game.event.impl.DisplayTabInterfaceEvent'
|
||||
java_import 'org.apollo.game.message.impl.DisplayTabInterfaceMessage'
|
||||
java_import 'org.apollo.game.model.entity.EquipmentConstants'
|
||||
java_import 'org.apollo.game.model.entity.Skill'
|
||||
|
||||
DISPLAY_SPELLBOOK = DisplayTabInterfaceEvent.new(6)
|
||||
DISPLAY_SPELLBOOK = DisplayTabInterfaceMessage.new(6)
|
||||
|
||||
class Spell
|
||||
attr_reader :level, :elements, :experience
|
||||
@@ -119,31 +119,31 @@ class ItemSpellAction < SpellAction
|
||||
|
||||
end
|
||||
|
||||
# Intercepts the magic on item event.
|
||||
on :event, :magic_on_item do |ctx, player, event|
|
||||
spell = event.spell_id
|
||||
# Intercepts the magic on item message.
|
||||
on :message, :magic_on_item do |ctx, player, message|
|
||||
spell = message.spell_id
|
||||
|
||||
alch = ALCHEMY_SPELLS[spell]
|
||||
if alch != nil
|
||||
slot = event.slot
|
||||
slot = message.slot
|
||||
item = player.inventory.get(slot)
|
||||
player.start_action(AlchemyAction.new(player, alch, slot, item))
|
||||
ctx.break_handler_chain
|
||||
return
|
||||
end
|
||||
|
||||
ench = ENCHANT_SPELLS[event.id]
|
||||
ench = ENCHANT_SPELLS[message.id]
|
||||
if ench != nil and ench.button == spell
|
||||
slot = event.slot
|
||||
slot = message.slot
|
||||
item = player.inventory.get(slot)
|
||||
player.start_action(EnchantAction.new(player, ench, slot, item, ENCHANT_ITEMS[item.id]))
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
|
||||
# Intercepts the button event
|
||||
on :event, :button do |ctx, player, event|
|
||||
button = event.widget_id
|
||||
# Intercepts the button message
|
||||
on :message, :button do |ctx, player, message|
|
||||
button = message.widget_id
|
||||
|
||||
tele = TELEPORT_SPELLS[button]
|
||||
if tele != nil
|
||||
|
||||
@@ -141,18 +141,18 @@ class ProspectingAction < DistancedAction
|
||||
end
|
||||
end
|
||||
|
||||
on :event, :first_object_action do |ctx, mob, event|
|
||||
ore = ORES[event.id]
|
||||
on :message, :first_object_action do |ctx, mob, message|
|
||||
ore = ORES[message.id]
|
||||
if ore != nil
|
||||
mob.start_action(MiningAction.new(mob, event.position, ore))
|
||||
mob.start_action(MiningAction.new(mob, message.position, ore))
|
||||
end
|
||||
end
|
||||
|
||||
on :event, :second_object_action do |ctx, mob, event|
|
||||
ore = ORES[event.id]
|
||||
on :message, :second_object_action do |ctx, mob, message|
|
||||
ore = ORES[message.id]
|
||||
if ore != nil
|
||||
mob.start_action(ProspectingAction.new(mob, event.position, ore))
|
||||
elsif EXPIRED_ORES[event.id] != nil
|
||||
mob.start_action(ExpiredProspectingAction.new(mob, event.position))
|
||||
mob.start_action(ProspectingAction.new(mob, message.position, ore))
|
||||
elsif EXPIRED_ORES[message.id] != nil
|
||||
mob.start_action(ExpiredProspectingAction.new(mob, message.position))
|
||||
end
|
||||
end
|
||||
@@ -42,11 +42,11 @@ class BuryBoneAction < Action
|
||||
|
||||
end
|
||||
|
||||
# Intercepts the first item option event,
|
||||
on :event, :first_item_option do |ctx, player, event|
|
||||
bone = BONES[event.id]
|
||||
# Intercepts the first item option message,
|
||||
on :message, :first_item_option do |ctx, player, message|
|
||||
bone = BONES[message.id]
|
||||
unless bone == nil
|
||||
player.start_action(BuryBoneAction.new(player, event.slot, bone))
|
||||
player.start_action(BuryBoneAction.new(player, message.slot, bone))
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,19 +23,19 @@ class Altar
|
||||
end
|
||||
|
||||
|
||||
# Intercepts the item on object event.
|
||||
on :event, :item_on_object do |ctx, player, event|
|
||||
talisman = TALISMANS[event.id]; altar = ENTRANCE_ALTARS[event.object_id]
|
||||
# Intercepts the item on object message.
|
||||
on :message, :item_on_object do |ctx, player, message|
|
||||
talisman = TALISMANS[message.id]; altar = ENTRANCE_ALTARS[message.object_id]
|
||||
if (talisman != nil && altar != nil)
|
||||
player.start_action(TeleportAction.new(player, event.position, 2, altar.entrance_position))
|
||||
player.start_action(TeleportAction.new(player, message.position, 2, altar.entrance_position))
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
|
||||
# Intercepts the first object action event.
|
||||
on :event, :object_action do |ctx, player, event|
|
||||
if (event.option == 1)
|
||||
object_id = event.id
|
||||
# Intercepts the first object action message.
|
||||
on :message, :object_action do |ctx, 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
|
||||
|
||||
@@ -29,9 +29,9 @@ def append_talisman(hash)
|
||||
TALISMANS[id] = Talisman.new(altar_position)
|
||||
end
|
||||
|
||||
# Intercepts the item option event.
|
||||
on :event, :fourth_item_option do |ctx, player, event|
|
||||
talisman = TALISMANS[event.id]
|
||||
# Intercepts the item option message.
|
||||
on :message, :fourth_item_option do |ctx, player, message|
|
||||
talisman = TALISMANS[message.id]
|
||||
if (talisman != nil)
|
||||
player.send_message(talisman.get_message(player.position))
|
||||
ctx.break_handler_chain
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'java'
|
||||
|
||||
java_import 'org.apollo.game.event.impl.ConfigEvent'
|
||||
java_import 'org.apollo.game.message.impl.ConfigMessage'
|
||||
java_import 'org.apollo.game.model.entity.EquipmentConstants'
|
||||
java_import 'org.apollo.game.action.DistancedAction'
|
||||
|
||||
@@ -26,13 +26,13 @@ class Tiara
|
||||
end
|
||||
|
||||
def send_config(player)
|
||||
player.send(ConfigEvent.new(CHANGE_ALTAR_OBJECT_CONFIG, 1 << @bitshift))
|
||||
player.send(ConfigMessage.new(CHANGE_ALTAR_OBJECT_CONFIG, 1 << @bitshift))
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def send_empty_config(player)
|
||||
player.send(ConfigEvent.new(CHANGE_ALTAR_OBJECT_CONFIG, 0))
|
||||
player.send(ConfigMessage.new(CHANGE_ALTAR_OBJECT_CONFIG, 0))
|
||||
end
|
||||
|
||||
# Appends a tiara to the list.
|
||||
@@ -43,7 +43,7 @@ def append_tiara(hash)
|
||||
TIARAS_BY_TALISMAN[talisman] = TIARAS_BY_ID[tiara_id] = TIARAS_BY_ALTAR[altar] = Tiara.new(tiara_id, altar, talisman, bitshift, experience)
|
||||
end
|
||||
|
||||
#Set the config upon login
|
||||
# Set the config upon login
|
||||
on :login do |player|
|
||||
hat = player.equipment.get(EquipmentConstants::HAT)
|
||||
if hat != nil
|
||||
@@ -56,45 +56,45 @@ on :login do |player|
|
||||
send_empty_config(player)
|
||||
end
|
||||
|
||||
#Accesses the altar with 1 click when wielding the correct tiara.
|
||||
on :event, :second_object_action do |ctx, player, event|
|
||||
object_id = event.id
|
||||
# Access the altar with 1 click when wielding the correct tiara.
|
||||
on :message, :second_object_action do |ctx, player, message|
|
||||
object_id = message.id
|
||||
tiara = TIARAS_BY_ALTAR[object_id]
|
||||
if (tiara != nil)
|
||||
hat = player.equipment.get(EquipmentConstants::HAT)
|
||||
if (hat != nil && hat.id == tiara.tiara_id)
|
||||
altar = ENTRANCE_ALTARS[tiara.altar]
|
||||
if (altar != nil)
|
||||
player.start_action(TeleportAction.new(player, event.position, 2, altar.entrance_position))
|
||||
player.start_action(TeleportAction.new(player, message.position, 2, altar.entrance_position))
|
||||
end
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#Equip tiara
|
||||
on :event, :second_item_option do |ctx, player, event|
|
||||
tiara = TIARAS_BY_ID[event.id]
|
||||
# Equip tiara
|
||||
on :message, :second_item_option do |ctx, player, message|
|
||||
tiara = TIARAS_BY_ID[message.id]
|
||||
if (tiara != nil)
|
||||
tiara.send_config(player)
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
|
||||
#Unequip tiara
|
||||
on :event, :first_item_action do |ctx, player, event|
|
||||
tiara = TIARAS_BY_ID[event.id]
|
||||
# Unequip tiara
|
||||
on :message, :first_item_action do |ctx, player, message|
|
||||
tiara = TIARAS_BY_ID[message.id]
|
||||
if (tiara != nil)
|
||||
send_empty_config(player)
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
|
||||
#Create tiara
|
||||
on :event, :item_on_object do |ctx, player, event|
|
||||
tiara= TIARAS_BY_TALISMAN[event.id]; altar = CRAFTING_ALTARS[event.object_id]
|
||||
#C reate tiara
|
||||
on :message, :item_on_object do |ctx, player, message|
|
||||
tiara= TIARAS_BY_TALISMAN[message.id]; altar = CRAFTING_ALTARS[message.object_id]
|
||||
if (tiara != nil && altar != nil)
|
||||
player.start_action(CreateTiaraAction.new(player, event.position, tiara, altar))
|
||||
player.start_action(CreateTiaraAction.new(player, message.position, tiara, altar))
|
||||
ctx.break_handler_chain
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user