16 from CFDialog
import DialogRule, Dialog
18 quest_name =
"wolfsburg/Lursendis"
20 key_status =
'gourmet_status'
21 st_getting =
'getting'
23 key_eating_step =
'eating_step'
27 banquet_path =
'/python/items/banquet.py'
28 banquet_archetype =
'tome'
29 event_archetype =
'event_apply'
31 color = Crossfire.MessageFlag.NDI_GREEN
34 obj = whoami.Map.ObjectAt(plate_x, plate_y)
36 if obj.NamePl ==
'Farnass\'s Special Caramels' and obj.Slaying ==
'Farnass\'s Special Caramel':
37 if whoami.ReadKey(key_status) == st_getting:
38 whoami.Map.Print(
'%s grabs a %s and starts eating with an obvious pleasure.'%(whoami.Name, obj.Name))
39 obj.Quantity = obj.Quantity - 1
40 whoami.WriteKey(key_status, st_eating, 1)
41 whoami.WriteKey(key_eating_step,
str(random.randint(5, 10)), 1)
42 Crossfire.SetReturnValue(1)
45 whoami.Say(
'Oh! Could this be...')
46 whoami.WriteKey(key_status, st_getting, 1)
47 Crossfire.SetReturnValue(1)
52 if whoami.ReadKey(key_status) == st_getting:
54 whoami.WriteKey(key_status,
'', 1)
57 book = whoami.Map.CreateObject(banquet_archetype, whoami.X, whoami.Y)
58 book.Name =
'Unforgettable Banquet of %s'%whoami.Name
59 book.NamePl =
'Unforgettable Banquets of %s'%whoami.Name
60 event = book.CreateObject(event_archetype)
61 event.Slaying = banquet_path
62 event.Title = Crossfire.WhatIsEvent().Title
65 st = whoami.ReadKey(key_status)
72 whoami.Say(
'Get outta my way!')
73 Crossfire.SetReturnValue(1)
76 step =
int(whoami.ReadKey(key_eating_step)) - 1
78 whoami.WriteKey(key_eating_step,
'', 1)
79 whoami.WriteKey(key_status,
'', 1)
80 whoami.Say(
'Now that\'s what I call a caramel! Thank you very much!')
81 whoami.Say(
'Here, take this as a token of my gratitude.')
83 for pl
in Crossfire.GetPlayers():
84 if pl.Map == whoami.Map
and pl.QuestGetState(quest_name) == 70:
85 pl.QuestSetState(quest_name, 100)
87 whoami.WriteKey(key_eating_step,
str(step), 1)
88 Crossfire.SetReturnValue(1)
94 pl = Crossfire.WhoIsActivator()
95 speech =
Dialog(Crossfire.WhoIsActivator(), Crossfire.WhoAmI(), quest_name)
96 completed = pl.QuestWasCompleted(quest_name)
100 prer = [[
"quest",quest_name,
"10"]]
101 rmsg = [
"So, do you have a caramel made by Farnass? If so, please put it on the plate, I'm so hungry!"]
103 speech.addRule(
DialogRule([
"*"], prer, rmsg, postr),idx)
106 prer = [[
"quest",quest_name,
"0"], [
"token",
"asked",
"1"]]
107 postr = [[
"settoken",
"asked",
"0"]]
108 rmsg = [
"Ha well, too bad... If you ever change your mind, please tell me!"]
109 speech.addRule(
DialogRule([
"no"], prer, rmsg, postr),idx)
117 prer = [[
"quest",quest_name,
"0"], [
"token",
"asked",
"1"]]
118 postr = [[
"settoken",
"asked",
"0"], [
"quest", quest_name, next]]
119 rmsg = [
"Thank you very much!"]
120 speech.addRule(
DialogRule([
"yes"], prer, rmsg, postr),idx)
124 prer = [[
"quest",quest_name,
"0"]]
125 postr = [[
"settoken",
"asked",
"1"]]
126 rmsg = [
"Hum, I'm still hungry, I could use another caramel from Farnass... Could you get me another one, please?"]
127 replies = [[
"yes",
"Sure"], [
"no",
"Sorry, I'm really busy now, I don't have time..."]]
128 speech.addRule(
DialogRule([
"*"], prer, rmsg, postr, replies),idx)
131 prer = [[
"quest", quest_name,
"0"], [
"token",
"dialog",
"3"]]
132 postr = [[
"settoken",
"asked",
"1"], [
"settoken",
"dialog",
"0"]]
133 rmsg = [
"Would you really be as kind as that?"]
134 replies = [[
"yes",
"If you really need one caramel, yes, sure."], [
"no",
"Well, no, I was just joking."]]
135 speech.addRule(
DialogRule([
"bring"], prer, rmsg, postr, replies),idx)
138 prer = [[
"quest", quest_name,
"0"], [
"token",
"dialog",
"2"]]
139 postr = [[
"settoken",
"dialog",
"3"]]
140 rmsg = [
"Farnass 'The Recipe Spellcrafter'. Good friend, haven't seen him in 15 years...\nI think he lived in Scorn, or some island around."]
141 replies = [[
"bring",
"Should I get you one of his caramels, then?", 2]]
142 speech.addRule(
DialogRule([
"farnass"], prer, rmsg, postr, replies),idx)
145 prer = [[
"quest", quest_name,
"0"], [
"token",
"dialog",
"1"]]
146 postr = [[
"settoken",
"dialog",
"2"]]
147 rmsg = [
"Yes, but I would only eat a caramel made by my friend Farnass."]
148 replies = [[
"farnass",
"Who is Farnass?", 2]]
149 speech.addRule(
DialogRule([
"caramel"], prer, rmsg, postr, replies),idx)
152 prer = [[
"quest", quest_name,
"0"]]
153 postr = [[
"settoken",
"dialog",
"1"]]
154 rmsg = [
"I'm hungry, I could use a caramel."]
155 replies = [[
"caramel",
"A caramel, really?", 2]]
156 speech.addRule(
DialogRule([
"*"], prer, rmsg, postr, replies),idx)
159 speech.speak(Crossfire.WhatIsMessage())
160 Crossfire.SetReturnValue(1)
162 whoami = Crossfire.WhoAmI()
163 if Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.TIME:
165 elif Crossfire.WhatIsEvent().Subtype == Crossfire.EventType.SAY: