Debian Codegraph @

python/dialog/post/quest.py

raw
1 # -*- coding: utf-8 -*-
2 #quest.py
3 # This is one of the files that can be called by an npc_dialog,
4 # The following code runs when a dialog has a post rule of 'quest'
5 # The syntax is ["quest", "questname", "queststage"]
6 # All arguments are required, questname must be a quest that is
7 # defined by one of the .quests files queststage must be a step
8 # number in that quest
9 ## DIALOGCHECK
10 ## MINARGS 2
11 ## MAXARGS 2
12 ## .*
13 ## \d+
14 ## ENDDIALOGCHECK
15
16 questname = args[0]
17 stage = args[1]
18 if character.QuestGetState(questname) == 0:
19 Crossfire.Log(Crossfire.LogDebug, "CFDialog: starting quest: %s at stage %s for character %s" %(questname, stage, character.Name))
20 character.QuestStart(questname, int(stage))
21 elif int(stage) > character.QuestGetState(questname):
22 Crossfire.Log(Crossfire.LogDebug, "CFDialog: advancing quest: %s to stage %s for character %s" %(questname, stage, character.Name ))
23 character.QuestSetState(questname, int(stage))
24 else:
25 Crossfire.Log(Crossfire.LogError, "CFDialog: Tried to advance a quest backwards.")