17 from CFDialog
import DialogRule, Dialog
19 quest_name =
"wolfsburg/Lursendis"
21 key_status =
'cook_status'
22 st_getting =
'getting'
24 st_cooking =
'cooking'
26 key_cooking_step =
'cooking_step'
28 key_need_check =
'check_ingredients'
30 color = Crossfire.MessageFlag.NDI_GREEN
32 recipe_arch =
'caramel'
41 ''' Finds the ingredients in the recipient. Used when recipient is closed, and when Farnass
42 arrives on the recipient (to avoid player picking up items)'''
47 obj = whoami.Map.ObjectAt(recipient_x, recipient_y)
49 if obj.Type == Crossfire.Type.CONTAINER:
53 if inv.Name ==
'blue mushroom' and inv.ArchName ==
'mushroom_3':
55 elif inv.ArchName ==
'chicken_egg' and inv.NamePl ==
'Combat Chicken eggs':
57 if mushroom !=
None and eggs !=
None:
69 if mushroom ==
None or eggs ==
None or eggs.Quantity < eggs_count:
70 if whoami.ReadKey(key_status) == st_getting:
71 whoami.Say(
'Haha, you tried to trick me!')
72 whoami.WriteKey(key_status,
'', 1)
75 if whoami.ReadKey(key_status) != st_getting:
76 whoami.Say(
'Oh, great, you found what I need to make my special caramel!')
77 whoami.WriteKey(key_status, st_getting, 1)
81 whoami.Map.Print(
'%s expertly opens the frypan with a leg, and grabs the ingredient using two sticks in his mouth!'%whoami.Name, color)
83 mushroom.Quantity = mushroom.Quantity - 1
84 eggs.Quantity = eggs.Quantity - eggs_count
86 Crossfire.SetReturnValue(1)
87 whoami.WriteKey(key_status, st_stove, 1)
90 ''' Everything is finish, let's decide if cooking was successful or not.'''
91 whoami.WriteKey(key_status,
'', 1)
92 whoami.WriteKey(key_cooking_step,
'', 1)
96 if random.randint(1, 100) < failure_chance:
97 whoami.Map.Print(
'%s throws the ingredients in the bin.'%whoami.Name)
98 whoami.Say(
'I can *tell* you shook the eggs. The yellows were so badly stressed inside that this could not work, even in my own hands... err, teeth.')
100 whoami.Say(
'The caramel is ready!')
101 omelet = whoami.Map.CreateObject(recipe_arch, whoami.X, whoami.Y)
102 omelet.Name =
'Farnass\'s Special Caramel'
103 omelet.NamePl =
'Farnass\'s Special Caramels'
104 omelet.Slaying =
'Farnass\'s Special Caramel'
108 event = omelet.CreateObject(
"event_pickup")
109 event.Name =
"wolfsburg/Lursendis 40>70"
110 event.Title =
"Python"
111 event.Slaying =
"/python/quests/QuestAdvance.py"
114 '''Just tell the cook to check next time.'''
115 Crossfire.GetPrivateDictionary()[key_need_check] =
'yes'
118 '''Cancel next check.'''
119 d = Crossfire.GetPrivateDictionary()
120 if key_need_check
in d:
121 del d[key_need_check]
124 '''Main moving routine.'''
127 status = whoami.ReadKey(key_status)
128 if status == st_getting:
130 Crossfire.SetReturnValue(1)
135 whoami.Say(
'Get off my way! You want me to cook this caramel or what?')
138 if status == st_cooking:
140 Crossfire.SetReturnValue(1)
142 if whoami.X != stove_x
or whoami.Y != stove_y:
143 whoami.Say(
'You fool! The ingredients are wasted, now!')
147 step =
int(whoami.ReadKey(key_cooking_step)) - 1
152 whoami.Map.Print(
'%s skillfully mixes the ingredients with his left toe while controlling the fire under the boiler with his right one!'%whoami.Name, color)
154 whoami.Map.Print(
'Knife griped by the mouth, %s cuts the mushroom in small slices, and puts them in the stove!'%whoami.Name, color)
155 whoami.WriteKey(key_cooking_step,
str(random.randint(25, 35)), 1)
157 whoami.Say(
'Let\'s pour the sulphur in now! Hey, wait, did I say sulphur? Ok, getting some dwarven shampoo to neutralize this!')
159 whoami.Map.Print(
'%s breaks the eggs over the stove by expertly throwing them, the shells bouncing away!'%whoami.Name, color)
160 whoami.WriteKey(key_cooking_step,
str(random.randint(60, 69)), 1)
161 whoami.WriteKey(key_cooking_step,
str(step), 1)
164 if status == st_stove:
168 whoami.WriteKey(key_cooking_step,
str(random.randint(80, 100)), 1)
169 whoami.Map.Print(
'%s makes the stove hotter.'%whoami.Name, color)
170 whoami.WriteKey(key_status, st_cooking, 1)
172 whoami.Say(
'Get off my way, I need to get to the stove!')
173 Crossfire.SetReturnValue(1)
176 d = Crossfire.GetPrivateDictionary()
177 if key_need_check
in d:
178 whoami.Map.Print(
'You see %s look at the frypan.'%whoami.Name, color)
179 del d[key_need_check]
184 speech =
Dialog(Crossfire.WhoIsActivator(), Crossfire.WhoAmI(),
"scorn/Farnass")
189 pre = [[
"quest", quest_name,
"=40"]]
190 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!"]
193 [
"mushroom",
"Where can I find the mushroom?", 2],
194 [
"cook",
"But how can you cook without arms?", 2]]
195 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
199 pre = [[
"quest", quest_name,
"=40"]]
200 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."]
203 [
"eggs",
"Where can I find the eggs?", 2],
204 [
"cook",
"But how can you cook without arms?", 2]]
205 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
209 pre = [[
"quest", quest_name,
"=40"]]
210 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."]
213 [
"eggs",
"Where can I find the eggs?", 2],
214 [
"mushroom",
"Where can I find the mushroom?", 2]]
215 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
219 pre = [[
"quest", quest_name,
"=40"]]
220 msg = [
"If you really want this caramel, then bring me the ingredients, please."]
223 [
"mushroom",
"Where can I find the mushroom?", 2],
224 [
"eggs",
"Where can I find the eggs?", 2],
225 [
"cook",
"But how can you cook without arms?", 2]]
226 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
229 match = [
"ingredients"]
230 pre = [[
"quest", quest_name,
"=10"], [
"token",
"dialog",
"4"]]
231 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?"]
232 post = [[
"settoken",
"dialog",
"0"], [
"quest", quest_name,
"40"]]
234 [
"mushroom",
"Where can I find the mushroom?", 2],
235 [
"eggs",
"What kind of eggs?", 2],
236 [
"cook",
"But how can you cook without arms?", 2]]
237 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
241 pre = [[
"quest", quest_name,
"=10"], [
"token",
"dialog",
"3"]]
242 msg = [
"Ha, if my great friend wants a caramel, then I can only oblige!"]
243 post = [[
"settoken",
"dialog",
"4"]]
244 replies = [[
"ingredients",
"So what would the ingredients be?", 2]]
245 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
249 pre = [[
"quest", quest_name,
"=10"], [
"token",
"dialog",
"2"]]
250 msg = [
"How obviously from him!\n\nSo, what will he want to eat, this time?"]
251 post = [[
"settoken",
"dialog",
"3"]]
252 replies = [[
"caramel",
"A caramel.", 1]]
253 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
256 match = [
"lursendis"]
257 pre = [[
"quest", quest_name,
"=10"], [
"token",
"dialog",
"1"]]
258 msg = [
"Oh, this good friend! I should go see him someday... Let me guess, he wants to eat something, he?"]
259 post = [[
"settoken",
"dialog",
"2"]]
260 replies = [[
"yes",
"Well, yes.", 1]]
261 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
265 pre = [[
"quest", quest_name,
"=10"]]
266 msg = [
"Please don't disturb me, I'm trying a really hard recipe."]
267 post = [[
"settoken",
"dialog",
"1"]]
268 replies = [[
"lursendis",
"Your friend Lursendis sent me here."]]
269 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
274 msg = [
"Please don't disturb me, I'm trying a really hard recipe."]
277 speech.addRule(
DialogRule(match, pre, msg, post, replies),idx)
280 speech.speak(Crossfire.WhatIsMessage())
281 Crossfire.SetReturnValue(1)
283 whoami = Crossfire.WhoAmI()
284 if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.SAY:
285 if whoami.ReadKey(key_cooking_step) !=
'':
286 Crossfire.NPCSay(whoami,
'Keep quiet, this recipe requires concentration!')
287 Crossfire.SetReturnValue(1)
290 elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.TIME:
292 elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.CLOSE: