From 105879fcd2c4a09dcb32bab74615fa0aea1ccb48 Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Sat, 15 May 2010 10:27:52 +0000 Subject: [PATCH] Questify Lursendis's Unforgettable banquet. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@13219 282e977c-c81d-0410-88c4-b93c2d0d6712 --- python/monsters/farnass.py | 115 ++++++++++++++++++++++++++++++++++- python/monsters/lursendis.py | 82 ++++++++++++++++++++++++- wolfsburg/lursendis | 7 ++- wolfsburg/wolfsburg.quests | 31 ++++++++++ world.quests | 1 + 5 files changed, 231 insertions(+), 5 deletions(-) create mode 100644 wolfsburg/wolfsburg.quests diff --git a/python/monsters/farnass.py b/python/monsters/farnass.py index 1c49475f7..9bdef306f 100644 --- a/python/monsters/farnass.py +++ b/python/monsters/farnass.py @@ -14,6 +14,9 @@ import Crossfire import random import CFMove +from CFDialog import DialogRule, Dialog + +quest_name = "wolfsburg/Lursendis" key_status = 'cook_status' st_getting = 'getting' # moving to recipient to get the ingredients @@ -47,7 +50,7 @@ def check_ingredients(): # whoami.Say('got container %s'%obj.Name) inv = obj.Inventory while inv != None: - if inv.Slaying == 'bunion' and inv.ArchName == 'mushroom_3': + if inv.Name == 'blue mushroom' and inv.ArchName == 'mushroom_3': mushroom = inv elif inv.ArchName == 'chicken_egg' and inv.NamePl == 'Combat Chicken eggs': eggs = inv @@ -101,6 +104,12 @@ def end_cooking(success): omelet.Slaying = 'Farnass\'s Special Caramel' omelet.Quantity = 1 + # quest advancer + event = omelet.CreateObject("event_pickup") + event.Name = "wolfsburg/Lursendis 40>70" + event.Title = "Python" + event.Slaying = "/python/quests/QuestAdvance.py" + def close_boiler(): '''Just tell the cook to check next time.''' Crossfire.GetPrivateDictionary()[key_need_check] = 'yes' @@ -171,11 +180,113 @@ def move_cook(): check_ingredients() return +def cook_talk(): + speech = Dialog(Crossfire.WhoIsActivator(), Crossfire.WhoAmI(), "scorn/Farnass") + + idx = 1 + + match = ["eggs"] + pre = [["quest", quest_name, "=40"]] + msg = ["My friend Sentrio lives somewhere in Lake Country, but I don't remember where exactly, sorry...\n\nI do know eggs from his chicken are the only ones worth my cooking skill!"] + post = [] + replies = [ + ["mushroom", "Where can I find the mushroom?", 2], + ["cook", "But how can you cook without arms?", 2]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["mushroom"] + pre = [["quest", quest_name, "=40"]] + msg = ["It's a blue one, I think it grows in a marsh in the west. I've heard it can be used for medicine, too."] + post = [] + replies = [ + ["eggs", "Where can I find the eggs?", 2], + ["cook", "But how can you cook without arms?", 2]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["cook"] + pre = [["quest", quest_name, "=40"]] + msg = ["You wonder how I cook without arms? Heh, rookie, that's what makes the difference between a cooker and me, Farnass! I told you already: I'm simply wonderful."] + post = [] + replies = [ + ["eggs", "Where can I find the eggs?", 2], + ["mushroom", "Where can I find the mushroom?", 2]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["*"] + pre = [["quest", quest_name, "=40"]] + msg = ["If you really want this caramel, then bring me the ingredients, please."] + post = [] + replies = [ + ["mushroom", "Where can I find the mushroom?", 2], + ["eggs", "Where can I find the eggs?", 2], + ["cook", "But how can you cook without arms?", 2]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["ingredients"] + pre = [["quest", quest_name, "=10"], ["token", "dialog", "4"]] + msg = ["You need the following:\n- 4 eggs from my friend Sentrio's chicken\n- a blue mushroom\n\nAs you can see, I've lost my both arms during the last war against the Gnolls, so would you be kind enough to put whatever you found during your travel to make the recipe in the frypan, please?"] + post = [["settoken", "dialog", "0"], ["quest", quest_name, "40"]] + replies = [ + ["mushroom", "Where can I find the mushroom?", 2], + ["eggs", "What kind of eggs?", 2], + ["cook", "But how can you cook without arms?", 2]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["caramel"] + pre = [["quest", quest_name, "=10"], ["token", "dialog", "3"]] + msg = ["Ha, if my great friend wants a caramel, then I can only oblige!"] + post = [["settoken", "dialog", "4"]] + replies = [["ingredients", "So what would the ingredients be?", 2]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["yes"] + pre = [["quest", quest_name, "=10"], ["token", "dialog", "2"]] + msg = ["How obviously from him!\n\nSo, what will he want to eat, this time?"] + post = [["settoken", "dialog", "3"]] + replies = [["caramel", "A caramel.", 1]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["lursendis"] + pre = [["quest", quest_name, "=10"], ["token", "dialog", "1"]] + msg = ["Oh, this good friend! I should go see him someday... Let me guess, he wants to eat something, he?"] + post = [["settoken", "dialog", "2"]] + replies = [["yes", "Well, yes.", 1]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["*"] + pre = [["quest", quest_name, "=10"]] + msg = ["Please don't disturb me, I'm trying a really hard recipe."] + post = [["settoken", "dialog", "1"]] + replies = [["lursendis", "Your friend Lursendis sent me here."]] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + match = ["*"] + pre = [] + msg = ["Please don't disturb me, I'm trying a really hard recipe."] + post = [] + replies = [] + speech.addRule(DialogRule(match, pre, msg, post, replies),idx) + idx = idx + 1 + + speech.speak(Crossfire.WhatIsMessage()) + Crossfire.SetReturnValue(1) + whoami = Crossfire.WhoAmI() if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.SAY: if whoami.ReadKey(key_cooking_step) != '': - whoami.Say('Keep quiet, this recipe requires concentration!') + Crossfire.NPCSay(whoami, 'Keep quiet, this recipe requires concentration!') Crossfire.SetReturnValue(1) + else: + cook_talk() elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.TIME: move_cook() elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.CLOSE: diff --git a/python/monsters/lursendis.py b/python/monsters/lursendis.py index 1b49b17ae..860e44ee4 100644 --- a/python/monsters/lursendis.py +++ b/python/monsters/lursendis.py @@ -13,6 +13,9 @@ import Crossfire import CFMove import random +from CFDialog import DialogRule, Dialog + +quest_name = "wolfsburg/Lursendis" key_status = 'gourmet_status' st_getting = 'getting' @@ -32,7 +35,7 @@ def check_plate(): while obj != None: if obj.NamePl == 'Farnass\'s Special Caramels' and obj.Slaying == 'Farnass\'s Special Caramel': if whoami.ReadKey(key_status) == st_getting: - whoami.Map.Print('%s grabs %s and starts eating with an obvious pleasure.'%(whoami.Name, obj.Name)) + whoami.Map.Print('%s grabs a %s and starts eating with an obvious pleasure.'%(whoami.Name, obj.Name)) obj.Quantity = obj.Quantity - 1 whoami.WriteKey(key_status, st_eating, 1) whoami.WriteKey(key_eating_step, str(random.randint(5, 10)), 1) @@ -77,6 +80,9 @@ def move_gourmet(): whoami.Say('Now that\'s what I call a caramel! Thank you very much!') whoami.Say('Here, take this as a token of my gratitude.') create_book() + for pl in Crossfire.GetPlayers(): + if pl.Map == whoami.Map and pl.QuestGetState(quest_name) == 70: + pl.QuestSetState(quest_name, 100) return whoami.WriteKey(key_eating_step, str(step), 1) Crossfire.SetReturnValue(1) @@ -84,5 +90,77 @@ def move_gourmet(): check_plate() +def talk_gourmet(): + pl = Crossfire.WhoIsActivator() + speech = Dialog(Crossfire.WhoIsActivator(), Crossfire.WhoAmI(), quest_name) + completed = pl.QuestWasCompleted(quest_name) + + idx = 1 + + prer = [["quest",quest_name, "10"]] + rmsg = ["So, do you have a caramel made by Farnass? If so, please put it on the plate, I'm so hungry!"] + postr = [] + speech.addRule(DialogRule(["*"], prer, rmsg, postr),idx) + idx = idx + 1 + + prer = [["quest",quest_name, "0"], ["token", "asked", "1"]] + postr = [["settoken", "asked", "0"]] + rmsg = ["Ha well, too bad... If you ever change your mind, please tell me!"] + speech.addRule(DialogRule(["no"], prer, rmsg, postr),idx) + idx = idx + 1 + + if completed: + next = "40" + else: + next = "10" + + prer = [["quest",quest_name, "0"], ["token", "asked", "1"]] + postr = [["settoken", "asked", "0"], ["quest", quest_name, next]] + rmsg = ["Thank you very much!"] + speech.addRule(DialogRule(["yes"], prer, rmsg, postr),idx) + idx = idx + 1 + + if completed: + prer = [["quest",quest_name, "0"]] + postr = [["settoken", "asked", "1"]] + rmsg = ["Hum, I'm still hungry, I could use another caramel from Farnass... Could you get me another one, please?"] + replies = [["yes", "Sure"], ["no", "Sorry, I'm really busy now, I don't have time..."]] + speech.addRule(DialogRule(["*"], prer, rmsg, postr, replies),idx) + idx = idx + 1 + else: + prer = [["quest", quest_name, "0"], ["token", "dialog", "2"]] + postr = [["settoken", "asked", "1"], ["settoken", "dialog", "0"]] + rmsg = ["Would you really be as kind as that?"] + replies = [["yes", "If you really need one caramel, yes, sure."], ["no", "Well, no, I was just joking."]] + speech.addRule(DialogRule(["farnass"], prer, rmsg, postr, replies),idx) + idx = idx + 1 + + prer = [["quest", quest_name, "0"], ["token", "dialog", "2"]] + postr = [["settoken", "dialog", "3"]] + rmsg = ["Farnass 'The Recipe Spellcrafter'. Good friend, haven't seen him in 15 years...\nI think he lived in Scorn, or some island around."] + replies = [["bring", "Should I get you one of his caramels, then?", 2]] + speech.addRule(DialogRule(["farnass"], prer, rmsg, postr, replies),idx) + idx = idx + 1 + + prer = [["quest", quest_name, "0"], ["token", "dialog", "1"]] + postr = [["settoken", "dialog", "2"]] + rmsg = ["Yes, but I would only eat a caramel made by my friend Farnass."] + replies = [["farnass", "Who is Farnass?", 2]] + speech.addRule(DialogRule(["caramel"], prer, rmsg, postr, replies),idx) + idx = idx + 1 + + prer = [["quest", quest_name, "0"]] + postr = [["settoken", "dialog", "1"]] + rmsg = ["I'm hungry, I could use a caramel."] + replies = [["caramel", "A caramel, really?", 2]] + speech.addRule(DialogRule(["*"], prer, rmsg, postr, replies),idx) + idx = idx + 1 + + speech.speak(Crossfire.WhatIsMessage()) + Crossfire.SetReturnValue(1) + whoami = Crossfire.WhoAmI() -move_gourmet() +if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.TIME: + move_gourmet() +elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.SAY: + talk_gourmet() diff --git a/wolfsburg/lursendis b/wolfsburg/lursendis index 4c263e41c..83b09a71c 100644 --- a/wolfsburg/lursendis +++ b/wolfsburg/lursendis @@ -8,7 +8,7 @@ enter_x 8 enter_y 4 msg Created: 2007-05-23 ryo -Modified: 2008-08-11 Andrew Fuchs +Modified: 2010-05-15 Nicolas Weeger endmsg maplore @quest Lursendis @@ -180,6 +180,11 @@ endmsg x 2 y 4 arch event_time +name event_time +title Python +slaying /python/monsters/lursendis.py +end +arch event_say title Python slaying /python/monsters/lursendis.py end diff --git a/wolfsburg/wolfsburg.quests b/wolfsburg/wolfsburg.quests new file mode 100644 index 000000000..1c0cd8d43 --- /dev/null +++ b/wolfsburg/wolfsburg.quests @@ -0,0 +1,31 @@ +quest wolfsburg/Lursendis +title Lursendis's unforgettable banquet +description +Lursendis, a gourmet, wants to eat a caramel by his great friend Farnass the cook. +end_description +restart 1 +step 10 +description +I need to find where Farnass, the Recipe Spellcrafter, lives. + +According to Lursendis, he lives in Scorn or some island around. +end_description +end_step +step 40 +description +I need to find 2 ingredients for Farnass: +- 4 eggs from Sentrio's farm +- one blue mushroom +end_description +end_step +step 70 +description +I have the caramel, I need to bring it back to Lursendis. +end_description +end_step +step 100 +finishes_quest +description +Lursendis is happy, the caramel was really good. +end_description +end_step diff --git a/world.quests b/world.quests index 194da9469..6da0160fc 100644 --- a/world.quests +++ b/world.quests @@ -32,3 +32,4 @@ include test/test.quests include start/start.quests +include wolfsburg/wolfsburg.quests