mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +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)
|
||||
|
||||
Reference in New Issue
Block a user