Check object is player before calling QuestGetState()

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@21064 282e977c-c81d-0410-88c4-b93c2d0d6712
master
partmedia 2019-12-27 04:57:31 +00:00
parent fe2b325719
commit 8bab615b69
5 changed files with 50 additions and 41 deletions

View File

@ -22,6 +22,7 @@ import CFDataFile
player = Crossfire.WhoIsActivator()
if type(player) == Crossfire.Player:
nobledata = CFDataFile.CFData('scorn_nobility', ['rank', 'title'])
currentstep = player.QuestGetState("scorn/Aristocracy")
currentrecord = { '#' : player.Name, 'rank' : currentstep, 'title' : player.Title }
@ -35,6 +36,3 @@ else:
Crossfire.Log(Crossfire.LogDebug, "castle_write, updating player %s, old state %s, new state %d" %(player.Name, lastrecord['rank'], currentstep))
nobledata.put_record(currentrecord)
player.Message("The castle sage scribbles as you walk past")

View File

@ -51,6 +51,9 @@ def handle():
if player.Type != Crossfire.Type.PLAYER:
player = player.Owner
if player.Type != Crossfire.Type.PLAYER:
return
params = Crossfire.ScriptParameters()
args = params.split()
questname = args[0]

View File

@ -12,12 +12,13 @@ player = Crossfire.WhoIsActivator()
params = Crossfire.ScriptParameters()
args = params.split()
questname = args[0]
currentstep = player.QuestGetState(questname)
# by default, forbid applying
Crossfire.SetReturnValue(1)
if type(player) == Crossfire.Player:
questname = args[0]
currentstep = player.QuestGetState(questname)
for rule in args[1:]:
if rule.find("-") == -1:
startstep = int(rule)

View File

@ -19,6 +19,9 @@ def matches(rule):
return True
args = rule.split()
if type(killer) != Crossfire.Player:
return False
currentstep = killer.QuestGetState(args[0])
for rule in args[1:]:
if rule.find("-") == -1:

View File

@ -30,6 +30,10 @@ import Crossfire
item = Crossfire.WhoAmI()
player = Crossfire.WhoIsActivator()
args = Crossfire.ScriptParameters().split(' ')
if type(player) == Crossfire.Player:
questname = args[0]
currentstep = player.QuestGetState(questname)
questname = args[0]
stagenumber = int(args[1])
currentstep = player.QuestGetState(questname)