diff --git a/data/plugins/dialogue/dialogue.rb b/data/plugins/dialogue/dialogue.rb
index 54bf87f3..aba43f4b 100644
--- a/data/plugins/dialogue/dialogue.rb
+++ b/data/plugins/dialogue/dialogue.rb
@@ -5,13 +5,13 @@ java_import 'org.apollo.game.message.impl.CloseInterfaceMessage'
java_import 'org.apollo.game.message.impl.SetWidgetItemModelMessage'
java_import 'org.apollo.game.message.impl.SetWidgetNpcModelMessage'
java_import 'org.apollo.game.message.impl.SetWidgetPlayerModelMessage'
+java_import 'org.apollo.game.message.impl.SetWidgetModelAnimationMessage'
java_import 'org.apollo.game.message.impl.SetWidgetTextMessage'
java_import 'org.apollo.game.action.DistancedAction'
# The map of conversation names to Conversations.
CONVERSATIONS = {}
-
# Declares a conversation.
def conversation(name, &block)
conversation = Conversation.new(name)
@@ -419,23 +419,32 @@ end
# Sends a dialogue displaying the player's head.
def send_player_dialogue(player, dialogue)
- send_generic_dialogue(player, dialogue, player.username, PLAYER_DIALOGUE_IDS, ->(id) { SetWidgetPlayerModelMessage.new(id + 1) })
+ emote = dialogue.emote
+
+ send_generic_dialogue player, dialogue, player.username, PLAYER_DIALOGUE_IDS do |id|
+ player.send(SetWidgetPlayerModelMessage.new(id + 1))
+ player.send(SetWidgetModelAnimationMessage.new(id + 1, emote)) unless emote.nil?
+ end
end
# Sends a dialogue displaying the head of an npc.
def send_npc_dialogue(player, dialogue)
npc = dialogue.npc
+ emote = dialogue.emote
name = NpcDefinition.lookup(npc).name.to_s
name = "" if (name.nil? || name == "null")
- send_generic_dialogue(player, dialogue, name, NPC_DIALOGUE_IDS, ->(id) { SetWidgetNpcModelMessage.new(id + 1, npc)})
+ send_generic_dialogue player, dialogue, name, NPC_DIALOGUE_IDS do |id|
+ player.send(SetWidgetNpcModelMessage.new(id + 1, npc))
+ player.send(SetWidgetModelAnimationMessage.new(id + 1, emote)) unless emote.nil?
+ end
end
# Sends a dialogue displaying an event.
-def send_generic_dialogue(player, dialogue, title, ids, event=nil)
+def send_generic_dialogue(player, dialogue, title, ids, &event)
text = dialogue.text
dialogue_id = ids[text.size - 1]
- player.send(event.call(dialogue_id)) unless event.nil?
+ event.call(dialogue_id) if block_given?
set_text(player, dialogue_title_id(dialogue_id), title)
diff --git a/data/plugins/dialogue/emotes.rb b/data/plugins/dialogue/emotes.rb
new file mode 100644
index 00000000..4634a612
--- /dev/null
+++ b/data/plugins/dialogue/emotes.rb
@@ -0,0 +1,7 @@
+# Declares all of the possible emotes
+declare_emote(:calm, 588)
+declare_emote(:anxious, 589)
+declare_emote(:default, 591)
+
+# TODO: Properly name the rest of the facial emotes.
+# Found at http://www.rune-server.org/runescape-development/rs2-server/tutorials/518991-pi-317-player-npc-facial-dialogue-expressions.html
diff --git a/data/plugins/dialogue/plugin.xml b/data/plugins/dialogue/plugin.xml
index 667266b9..95a7402f 100644
--- a/data/plugins/dialogue/plugin.xml
+++ b/data/plugins/dialogue/plugin.xml
@@ -9,6 +9,7 @@
+
util
diff --git a/data/plugins/location/tutorial-island/guide.rb b/data/plugins/location/tutorial-island/guide.rb
index f5c93c02..ca30270e 100644
--- a/data/plugins/location/tutorial-island/guide.rb
+++ b/data/plugins/location/tutorial-island/guide.rb
@@ -37,6 +37,7 @@ conversation :tutorial_runescape_guide do
dialogue :greetings do
type :npc_speech
npc :runescape_guide
+ emote :calm
precondition { |player| player.tutorial_island_progress == :not_started }
@@ -53,6 +54,7 @@ conversation :tutorial_runescape_guide do
dialogue :welcome_back do
type :npc_speech
npc :runescape_guide
+ emote :calm
precondition { |player| player.tutorial_island_progress != :not_started }
@@ -65,6 +67,7 @@ conversation :tutorial_runescape_guide do
dialogue :talk_to_people do
type :npc_speech
npc :runescape_guide
+ emote :calm
text 'You have already learned the first thing you need to succeed in this world: talking to '\
'people!',
@@ -81,6 +84,7 @@ conversation :tutorial_runescape_guide do
dialogue :go_through_door do
type :npc_speech
npc :runescape_guide
+ emote :calm
text 'To continue the tutorial go through that door over there, and speak to your first '\
'instructor.'