diff --git a/game/engines/default/engine/Chat.lua b/game/engines/default/engine/Chat.lua index eb702e0dea54c03eddaa12596cd7d75f2a3a5e2c..841b8cffa172ea783c7b70bb7a1d1f2907966c14 100644 --- a/game/engines/default/engine/Chat.lua +++ b/game/engines/default/engine/Chat.lua @@ -24,6 +24,7 @@ require "engine.dialogs.Chat" module(..., package.seeall, class.make) function _M:init(name, npc, player, data) + self.quick_replies = 0 self.chats = {} self.npc = npc self.player = player @@ -38,6 +39,13 @@ function _M:init(name, npc, player, data) self.default_id = f() end +--- Switch the NPC talking +function _M:switchNPC(npc) + local old = self.npc + self.npc = npc + return old +end + --- Adds a chat to the list of possible chats function _M:addChat(c) assert(c.id, "no chat id") @@ -45,6 +53,15 @@ function _M:addChat(c) assert(c.answers, "no chat answers") self.chats[c.id] = c print("[CHAT] loaded", c.id, c) + + -- Parse answsers looking for quick replies + for i, a in ipairs(c.answers) do + if a.quick_reply then + a.jump = "quick_reply"..self.quick_replies + self:addChat{id="quick_reply"..self.quick_replies, text=a.quick_reply, answers={{"[leave]"}}} + self.quick_replies = self.quick_replies + 1 + end + end end --- Invokes a chat diff --git a/game/engines/default/engine/dialogs/Chat.lua b/game/engines/default/engine/dialogs/Chat.lua index a595837300b6429db4d6e90348b338b782e7ffde..8377ae981e6a2794f059eebbead51a7ff14c9aa1 100644 --- a/game/engines/default/engine/dialogs/Chat.lua +++ b/game/engines/default/engine/dialogs/Chat.lua @@ -71,6 +71,7 @@ function _M:use(item, a) if not a then return end print("[CHAT] selected", a[1], a.action, a.jump) + if a.switch_npc then self.chat:switchNPC(a.switch_npc) end if a.action then local id = a.action(self.npc, self.player, self) if id then diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 1a81f9983a67ddedb4a61c04a569d8c5d3178221..360ee474fc70a4a4ed6cecdc406aaa05100a454b 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -663,7 +663,7 @@ function _M:setupCommands() if config.settings.tome.cheat then self.player:incStat("str", 100) self.player:incStat("dex", 100) self.player:incStat("mag", 100) self.player:incStat("wil", 100) self.player:incStat("cun", 100) self.player:incStat("con", 100) self.player:learnTalent(self.player.T_HEAVY_ARMOUR_TRAINING, true) self.player:learnTalent(self.player.T_MASSIVE_ARMOUR_TRAINING, true) ---[[ +-- [[ for i, e in ipairs(self.zone.object_list) do if e.unique and e.define_as ~= "VOICE_SARUMAN" and e.define_as ~= "ORB_MANY_WAYS_DEMON" then local a = self.zone:finishEntity(self.level, "object", e) @@ -673,7 +673,7 @@ function _M:setupCommands() end end --]] --- [[ +--[[ for i = 1, 50 do local a = self.zone:makeEntity(self.level, "object", {type="ammo"}, nil, true) if a then @@ -689,7 +689,9 @@ function _M:setupCommands() if config.settings.tome.cheat then -- local m = game.zone:makeEntityByName(game.level, "actor", "TEST") -- game.zone:addEntity(game.level, m, "actor", game.player.x, game.player.y+1) - self:changeLevel(5, "crypt-kryl-feijan") + self:changeLevel(1, "town-last-hope") + game.player:grantQuest("kryl-feijan-escape") + game.player:setQuestStatus("kryl-feijan-escape", engine.Quest.DONE) end end, } diff --git a/game/modules/tome/data/chats/last-hope-melinda-father.lua b/game/modules/tome/data/chats/last-hope-melinda-father.lua new file mode 100644 index 0000000000000000000000000000000000000000..3bb6223c23cf136c07e4e0ee2b5a7941302deb16 --- /dev/null +++ b/game/modules/tome/data/chats/last-hope-melinda-father.lua @@ -0,0 +1,134 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org +local q = game.player:hasQuest("kryl-feijan-escape") +if not q or not q:isStatus(q.DONE) then + +newChat{ id="welcome", + text = [[#LIGHT_GREEN#*A man talks to you from inside, the door half open. His voice is sad.*#WHITE# +Sorry the store is closed.]], + answers = { + {"[leave]"}, + } +} + +else + +------------------------------------------------------------------ +-- Saved +------------------------------------------------------------------ + +newChat{ id="welcome", + text = [[@playername@! My daugther's savior!]], + answers = { + {"Hi, I was just checking in to see if Melinda is alright.", jump="reward", cond=function(npc, player) return not npc.rewarded_for_saving_melinda end, action=function(npc, player) npc.rewarded_for_saving_melinda = true end}, + {"Sorry I have to go!"}, + } +} + +newChat{ id="reward", + text = [[Please take this, it is nothing compared to the life of my child. Oh and she wanted to thank you in person, I will call her.]], + answers = { + {"Thank you.", jump="melinda", switch_npc={name="Melinda"}, action=function(npc, player) + local ro = game.zone:makeEntity(game.level, "object", {unique=true, not_properties={"lore"}}, nil, true) + if ro then + ro:identify(true) + game.logPlayer(player, "Melinda's father gives you: %s", ro:getName{do_color=true}) + player:addObject(player:getInven("INVEN"), ro) + end + end}, + } +} +newChat{ id="melinda", + text = [[@playername@! #LIGHT_GREEN#*She jumps of joy and hugs you while her father returns to his shop.*#WHITE#]], + answers = { + {"I am glad to see you are fine, it seems your scars are healing quite well.", jump="scars", cond=function(npc, player) + if player.undead then return false end + return true + end,}, + {"I am glad to see you well. Take care."}, + } +} + +------------------------------------------------------------------ +-- Flirting +------------------------------------------------------------------ +newChat{ id="scars", + text = [[#LIGHT_GREEN#*She presses on her lower belly in a provocative way.*#WHITE# +See, you can touch it, it is fine. No pain anymore! This is thanks to you my.. dear friend.]], + answers = { + {"I am sorry I do not think your father would approve, be well my lady.", quick_reply="I think he would, but is this is what you wish, goodbye and farewell."}, + {"#LIGHT_GREEN#[touch the spot she indicates] Yes it seems alright", jump="touch_male", cond=function(npc, player) return player.male end}, + {"#LIGHT_GREEN#[touch the spot she indicates] Yes it seems alright", jump="touch_female", cond=function(npc, player) return player.female end}, + } +} + +newChat{ id="touch_male", + text = [[#LIGHT_GREEN#*She blushes a bit.*#WHITE# +Your touch feels soft, and yet I can sense so much power in you. +This feels good, I can try to forget what those.. other men.. did to me.]], + answers = { + {"I am there if you want to talk about it, I saw them, I saw what they did. I can understand.", jump="request_explain"}, + {"I am no demon worshipper, I will not hurt you.", jump="reassurance"}, + {"You will get over it, do not worry. Goodbye Melinda, farewell.", quick_reply="It will be hard, but I know I will. Goodbye."}, + } +} + +newChat{ id="touch_female", + text = [[#LIGHT_GREEN#*She blushes a bit.*#WHITE# +I.. I did not know another woman's touch could feel so.. soft on my skin. +This feels good, I can try to forget what those.. men.. did to me.]], + answers = { + {"I am there if you want to talk about it, I saw them, I saw what they did. I can understand.", jump="request_explain"}, + {"I am no demon worshipper, I will not hurt you.", jump="reassurance"}, + {"You will get over it, do not worry. Goodbye Melinda, farewell.", quick_reply="It will be hard, but I know I will. Goodbye."}, + } +} + +newChat{ id="request_explain", + text = [[#LIGHT_GREEN#*She seems lost in her thoughts for a while, her eyes reflecting the terror she knew.*#WHITE# +Thank you for your kindness, but I am not ready to talk about it yet, it is so fresh and vivid in my mind! +#LIGHT_GREEN#*She starts to cry.*#WHITE#]], + answers = { + {"#LIGHT_GREEN#[take her in your arms] Everything is alright now, you are safe.", jump="hug"}, + {"Snap out of it! You are safe here.", quick_reply="Yes, yes. Well thank you, goodbye."}, + } +} + +newChat{ id="reassurance", + text = [[#LIGHT_GREEN#*She looks deeply in your eyes.*#WHITE# +I know you are not, when you rescued me from the horrors I knew instantly I could trust you. You might say it was fear but I like to think I touched you, and you touched me.]], + answers = { + {"#LIGHT_GREEN#[take her in your arms] Everything is alright now, you are safe.", jump="hug"}, + {"Wohh wait a minute, I am glad to have saved you but that is all.", quick_reply="Oh, sorry I was not myself. Goodbye."}, + } +} + +newChat{ id="hug", + text = [[#LIGHT_GREEN#*You take Melinda in your arms and press her against you. The warmth of the contact lightens your heart.*#WHITE# +I feel safe in your arms. Please, I know you must leave but promise to come back soon and hold me again.]], + answers = { + {"I think I would enjoy that very much. #LIGHT_GREEN#[kiss her]#WHITE#", action=function(npc, player) player:grantQuest("love-melinda") end}, + {"That tought will carry me in the dark places I shall walk. #LIGHT_GREEN#[kiss her]#WHITE#", action=function(npc, player) player:grantQuest("love-melinda") end}, + {"Oh I am sorry I think you are mistaken, I was only trying to confort you.", quick_reply="Oh, sorry I was not myself. Goodbye then, farewell."}, + } +} + +end + +return "welcome" diff --git a/game/modules/tome/data/chats/sorcerer-fight.lua b/game/modules/tome/data/chats/sorcerer-fight.lua index a65a0fc30df93355bba5e08d518dac439c3c53f7..b7139e6fc4d5ac5d2a755f6ba14e125b2eebf721 100644 --- a/game/modules/tome/data/chats/sorcerer-fight.lua +++ b/game/modules/tome/data/chats/sorcerer-fight.lua @@ -79,7 +79,7 @@ He who felt great sorrow for this world. He who shall now shatter the barriers o The staff has allowed us to drain enough energy from this world to open the portal to the Void and summon him through! It is already too late. He is coming through as we speak -- it is only a matter of hours!]], answers = { - {"I *WILL* stop you! The world will not end today!", jump="aeryn", action=aeryn_comes, cond=aeryn_alive}, + {"I *WILL* stop you! The world will not end today!", jump="aeryn", switch_npc={name="High Sun Paladin Aeryn"}, action=aeryn_comes, cond=aeryn_alive}, {"I *WILL* stop you! The world will not end today!", cond=aeryn_dead}, } } @@ -90,7 +90,7 @@ He who felt great sorrow for this world. He who shall now shatter the barriers o The staff will allow us to drain enough energy from this world to open the portal to the Void and summon him through! You cannot stop us now!]], answers = { - {"I *WILL* stop you! The world will not end today!", jump="aeryn", action=aeryn_comes, cond=aeryn_alive}, + {"I *WILL* stop you! The world will not end today!", jump="aeryn", switch_npc={name="High Sun Paladin Aeryn"}, action=aeryn_comes, cond=aeryn_alive}, {"I *WILL* stop you! The world will not end today!", cond=aeryn_dead}, } } diff --git a/game/modules/tome/data/maps/towns/last-hope.lua b/game/modules/tome/data/maps/towns/last-hope.lua index 3d39437322ccac74df2eb1fe6677c620e8c03f22..bd70e7c729d1b227667ee42a84b03af1a1028d7f 100644 --- a/game/modules/tome/data/maps/towns/last-hope.lua +++ b/game/modules/tome/data/maps/towns/last-hope.lua @@ -49,6 +49,7 @@ quickEntity('b', {show_tooltip=true, name="Hall of the King", display='*', color quickEntity('c', {show_tooltip=true, name="Closed store", display='*', color=colors.LIGHT_UMBER, block_move=true, block_sight=true, image="terrain/wood_store_closed.png"}) quickEntity('d', {show_tooltip=true, name="Closed store", display='*', color=colors.LIGHT_UMBER, block_move=true, block_sight=true, image="terrain/wood_store_closed.png"}) quickEntity('e', {show_tooltip=true, name="Rare goods", display='*', color=colors.AQUAMARINE, resolvers.store("LOST_MERCHANT"), resolvers.chatfeature("last-hope-lost-merchant"), image="terrain/wood_store_weapon.png"}) +quickEntity('g', {show_tooltip=true, name="Rich merchant", display='*', color=colors.AQUAMARINE, resolvers.chatfeature("last-hope-melinda-father"), image="terrain/wood_store_closed.png"}) quickEntity('E', {show_tooltip=true, name="The Elder", display='*', color=colors.VIOLET, resolvers.chatfeature("last-hope-elder"), image="terrain/wood_store_closed.png"}) quickEntity('f', {show_tooltip=true, name="Tannen's Tower", display='*', color=colors.VIOLET, resolvers.chatfeature("tannen"), image="terrain/wood_store_closed.png"}) @@ -72,7 +73,7 @@ return { [[#^^^-------##sssSss---OOO--#OOO--s--OOOOO--###--- ]], [[#^^^######---##sss--s--OOO-OOO--StS--OOOOO---##--- ]], [[#^^^^----###---##--ssS--OOOOO#--ssss--OOOOOO--##--- ]], -[[#^^--------###----ssSs#--OOO-##-#####--OOOOOO--##--- ---- ]], +[[#^^--------###----ssSs#--OOO-##-##g##--OOOOOO--##--- ---- ]], [[#^ ----------##--#sts#--OOOO--#---------OOOOOO--#------ -------- ]], [[#^^-----------###-#s#--OOOOOO-##-#sssss--OOOOOO,#####--- ----------- ]], [[#^^-------------##-#--OOO-OOO--#--ssssss--OOOOO,,,,,#---- ---ssssssss--- ]], diff --git a/game/modules/tome/data/quests/love-melinda.lua b/game/modules/tome/data/quests/love-melinda.lua new file mode 100644 index 0000000000000000000000000000000000000000..728a3f1aca34411f0b6b2b5b072cb5decc82176e --- /dev/null +++ b/game/modules/tome/data/quests/love-melinda.lua @@ -0,0 +1,30 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +name = "Melinda, " +desc = function(self, who) + local desc = {} + desc[#desc+1] = "After rescuing Melinda from Kryl-Feijan and the cultists you met her again in Last Hope." + if who.female then + desc[#desc+1] = "You talked for a while and it seems she has a crush for you, even if you are yourself a woman." + else + desc[#desc+1] = "You talked for a while and it seems she has a crush for you." + end + return table.concat(desc, "\n") +end diff --git a/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua b/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua index 15561360e14d7be8790c5894b6ff8ef78f096469..726d9fe23d84e27cf24c0e393564b19d2f19a695 100644 --- a/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua +++ b/game/modules/tome/data/zones/crypt-kryl-feijan/npcs.lua @@ -64,7 +64,8 @@ newEntity{ define_as = "MELINDA", name = "Melinda", type = "humanoid", subtype = "human", female=true, display = "@", color=colors.LIGHT_BLUE, - desc = [[A female human lying unconcious on a black altar, twisted sigils scored into her naked flesh.]], + desc = [[A female human lying unconcious on a black altar, twisted sigils scored into her naked flesh. +You can discern great beauty under the stains of blood covering her skin.]], autolevel = "tank", ai = "summoned", ai_real = "move_dmap", ai_state = { ai_target="target_player", talent_in=4, }, stats = { str=8, dex=7, mag=8, con=12 },