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-b93c2d0d6712master
parent
fe2b325719
commit
8bab615b69
|
@ -22,19 +22,17 @@ import CFDataFile
|
||||||
|
|
||||||
player = Crossfire.WhoIsActivator()
|
player = Crossfire.WhoIsActivator()
|
||||||
|
|
||||||
nobledata = CFDataFile.CFData('scorn_nobility', ['rank', 'title'])
|
if type(player) == Crossfire.Player:
|
||||||
currentstep = player.QuestGetState("scorn/Aristocracy")
|
nobledata = CFDataFile.CFData('scorn_nobility', ['rank', 'title'])
|
||||||
currentrecord = { '#' : player.Name, 'rank' : currentstep, 'title' : player.Title }
|
currentstep = player.QuestGetState("scorn/Aristocracy")
|
||||||
lastrecord = nobledata.get_record(player.Name)
|
currentrecord = { '#' : player.Name, 'rank' : currentstep, 'title' : player.Title }
|
||||||
Crossfire.Log(Crossfire.LogDebug, "castle_write: previous record %s, new record %s." % (lastrecord, currentrecord))
|
lastrecord = nobledata.get_record(player.Name)
|
||||||
if lastrecord == 0:
|
Crossfire.Log(Crossfire.LogDebug, "castle_write: previous record %s, new record %s." % (lastrecord, currentrecord))
|
||||||
lastrecord = { '#' : player.Name, 'rank' : -10, 'title' : 'The Default' }
|
if lastrecord == 0:
|
||||||
if (currentrecord['rank'] == 0) or (currentrecord['rank'] == int(lastrecord['rank']) and currentrecord['title'] == lastrecord['title']):
|
lastrecord = { '#' : player.Name, 'rank' : -10, 'title' : 'The Default' }
|
||||||
Crossfire.Log(Crossfire.LogDebug, "castle_write, no update needed for player %s." % player.Name)
|
if (currentrecord['rank'] == 0) or (currentrecord['rank'] == int(lastrecord['rank']) and currentrecord['title'] == lastrecord['title']):
|
||||||
else:
|
Crossfire.Log(Crossfire.LogDebug, "castle_write, no update needed for player %s." % player.Name)
|
||||||
Crossfire.Log(Crossfire.LogDebug, "castle_write, updating player %s, old state %s, new state %d" %(player.Name, lastrecord['rank'], currentstep))
|
else:
|
||||||
nobledata.put_record(currentrecord)
|
Crossfire.Log(Crossfire.LogDebug, "castle_write, updating player %s, old state %s, new state %d" %(player.Name, lastrecord['rank'], currentstep))
|
||||||
player.Message("The castle sage scribbles as you walk past")
|
nobledata.put_record(currentrecord)
|
||||||
|
player.Message("The castle sage scribbles as you walk past")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ def handle():
|
||||||
if player.Type != Crossfire.Type.PLAYER:
|
if player.Type != Crossfire.Type.PLAYER:
|
||||||
player = player.Owner
|
player = player.Owner
|
||||||
|
|
||||||
|
if player.Type != Crossfire.Type.PLAYER:
|
||||||
|
return
|
||||||
|
|
||||||
params = Crossfire.ScriptParameters()
|
params = Crossfire.ScriptParameters()
|
||||||
args = params.split()
|
args = params.split()
|
||||||
questname = args[0]
|
questname = args[0]
|
||||||
|
|
|
@ -12,18 +12,19 @@ player = Crossfire.WhoIsActivator()
|
||||||
params = Crossfire.ScriptParameters()
|
params = Crossfire.ScriptParameters()
|
||||||
args = params.split()
|
args = params.split()
|
||||||
|
|
||||||
questname = args[0]
|
|
||||||
currentstep = player.QuestGetState(questname)
|
|
||||||
|
|
||||||
# by default, forbid applying
|
# by default, forbid applying
|
||||||
Crossfire.SetReturnValue(1)
|
Crossfire.SetReturnValue(1)
|
||||||
|
|
||||||
for rule in args[1:]:
|
if type(player) == Crossfire.Player:
|
||||||
if rule.find("-") == -1:
|
questname = args[0]
|
||||||
startstep = int(rule)
|
currentstep = player.QuestGetState(questname)
|
||||||
endstep = startstep
|
|
||||||
else:
|
for rule in args[1:]:
|
||||||
startstep = int(rule.split("-")[0])
|
if rule.find("-") == -1:
|
||||||
endstep= int(rule.split("-")[1])
|
startstep = int(rule)
|
||||||
if currentstep >= startstep and currentstep <= endstep:
|
endstep = startstep
|
||||||
Crossfire.SetReturnValue(0)
|
else:
|
||||||
|
startstep = int(rule.split("-")[0])
|
||||||
|
endstep= int(rule.split("-")[1])
|
||||||
|
if currentstep >= startstep and currentstep <= endstep:
|
||||||
|
Crossfire.SetReturnValue(0)
|
||||||
|
|
|
@ -19,6 +19,9 @@ def matches(rule):
|
||||||
return True
|
return True
|
||||||
args = rule.split()
|
args = rule.split()
|
||||||
|
|
||||||
|
if type(killer) != Crossfire.Player:
|
||||||
|
return False
|
||||||
|
|
||||||
currentstep = killer.QuestGetState(args[0])
|
currentstep = killer.QuestGetState(args[0])
|
||||||
for rule in args[1:]:
|
for rule in args[1:]:
|
||||||
if rule.find("-") == -1:
|
if rule.find("-") == -1:
|
||||||
|
|
|
@ -30,17 +30,21 @@ import Crossfire
|
||||||
item = Crossfire.WhoAmI()
|
item = Crossfire.WhoAmI()
|
||||||
player = Crossfire.WhoIsActivator()
|
player = Crossfire.WhoIsActivator()
|
||||||
args = Crossfire.ScriptParameters().split(' ')
|
args = Crossfire.ScriptParameters().split(' ')
|
||||||
questname = args[0]
|
if type(player) == Crossfire.Player:
|
||||||
stagenumber = int(args[1])
|
questname = args[0]
|
||||||
currentstep = player.QuestGetState(questname)
|
currentstep = player.QuestGetState(questname)
|
||||||
if currentstep == 0:
|
|
||||||
Crossfire.SetReturnValue(0)
|
questname = args[0]
|
||||||
elif currentstep >= stagenumber:
|
stagenumber = int(args[1])
|
||||||
item.GodGiven = True
|
currentstep = player.QuestGetState(questname)
|
||||||
Crossfire.SetReturnValue(0)
|
if currentstep == 0:
|
||||||
else:
|
Crossfire.SetReturnValue(0)
|
||||||
if item.Quantity == 1:
|
elif currentstep >= stagenumber:
|
||||||
player.Message("You consider dropping the "+ item.Name + " but then decide it would be better to hold on to it for now.")
|
item.GodGiven = True
|
||||||
|
Crossfire.SetReturnValue(0)
|
||||||
else:
|
else:
|
||||||
player.Message("You consider dropping the "+ item.NamePl + " but then decide it would be better to hold on to them for now.")
|
if item.Quantity == 1:
|
||||||
Crossfire.SetReturnValue(1)
|
player.Message("You consider dropping the "+ item.Name + " but then decide it would be better to hold on to it for now.")
|
||||||
|
else:
|
||||||
|
player.Message("You consider dropping the "+ item.NamePl + " but then decide it would be better to hold on to them for now.")
|
||||||
|
Crossfire.SetReturnValue(1)
|
||||||
|
|
Loading…
Reference in New Issue