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()
|
||||
|
||||
nobledata = CFDataFile.CFData('scorn_nobility', ['rank', 'title'])
|
||||
currentstep = player.QuestGetState("scorn/Aristocracy")
|
||||
currentrecord = { '#' : player.Name, 'rank' : currentstep, 'title' : player.Title }
|
||||
lastrecord = nobledata.get_record(player.Name)
|
||||
Crossfire.Log(Crossfire.LogDebug, "castle_write: previous record %s, new record %s." % (lastrecord, currentrecord))
|
||||
if lastrecord == 0:
|
||||
lastrecord = { '#' : player.Name, 'rank' : -10, 'title' : 'The Default' }
|
||||
if (currentrecord['rank'] == 0) or (currentrecord['rank'] == int(lastrecord['rank']) and currentrecord['title'] == lastrecord['title']):
|
||||
Crossfire.Log(Crossfire.LogDebug, "castle_write, no update needed for player %s." % player.Name)
|
||||
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")
|
||||
|
||||
|
||||
|
||||
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 }
|
||||
lastrecord = nobledata.get_record(player.Name)
|
||||
Crossfire.Log(Crossfire.LogDebug, "castle_write: previous record %s, new record %s." % (lastrecord, currentrecord))
|
||||
if lastrecord == 0:
|
||||
lastrecord = { '#' : player.Name, 'rank' : -10, 'title' : 'The Default' }
|
||||
if (currentrecord['rank'] == 0) or (currentrecord['rank'] == int(lastrecord['rank']) and currentrecord['title'] == lastrecord['title']):
|
||||
Crossfire.Log(Crossfire.LogDebug, "castle_write, no update needed for player %s." % player.Name)
|
||||
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")
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -12,18 +12,19 @@ player = Crossfire.WhoIsActivator()
|
|||
params = Crossfire.ScriptParameters()
|
||||
args = params.split()
|
||||
|
||||
questname = args[0]
|
||||
currentstep = player.QuestGetState(questname)
|
||||
|
||||
# by default, forbid applying
|
||||
Crossfire.SetReturnValue(1)
|
||||
|
||||
for rule in args[1:]:
|
||||
if rule.find("-") == -1:
|
||||
startstep = int(rule)
|
||||
endstep = startstep
|
||||
else:
|
||||
startstep = int(rule.split("-")[0])
|
||||
endstep= int(rule.split("-")[1])
|
||||
if currentstep >= startstep and currentstep <= endstep:
|
||||
Crossfire.SetReturnValue(0)
|
||||
if type(player) == Crossfire.Player:
|
||||
questname = args[0]
|
||||
currentstep = player.QuestGetState(questname)
|
||||
|
||||
for rule in args[1:]:
|
||||
if rule.find("-") == -1:
|
||||
startstep = int(rule)
|
||||
endstep = startstep
|
||||
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
|
||||
args = rule.split()
|
||||
|
||||
if type(killer) != Crossfire.Player:
|
||||
return False
|
||||
|
||||
currentstep = killer.QuestGetState(args[0])
|
||||
for rule in args[1:]:
|
||||
if rule.find("-") == -1:
|
||||
|
|
|
@ -30,17 +30,21 @@ import Crossfire
|
|||
item = Crossfire.WhoAmI()
|
||||
player = Crossfire.WhoIsActivator()
|
||||
args = Crossfire.ScriptParameters().split(' ')
|
||||
questname = args[0]
|
||||
stagenumber = int(args[1])
|
||||
currentstep = player.QuestGetState(questname)
|
||||
if currentstep == 0:
|
||||
Crossfire.SetReturnValue(0)
|
||||
elif currentstep >= stagenumber:
|
||||
item.GodGiven = True
|
||||
Crossfire.SetReturnValue(0)
|
||||
else:
|
||||
if item.Quantity == 1:
|
||||
player.Message("You consider dropping the "+ item.Name + " but then decide it would be better to hold on to it for now.")
|
||||
if type(player) == Crossfire.Player:
|
||||
questname = args[0]
|
||||
currentstep = player.QuestGetState(questname)
|
||||
|
||||
questname = args[0]
|
||||
stagenumber = int(args[1])
|
||||
currentstep = player.QuestGetState(questname)
|
||||
if currentstep == 0:
|
||||
Crossfire.SetReturnValue(0)
|
||||
elif currentstep >= stagenumber:
|
||||
item.GodGiven = True
|
||||
Crossfire.SetReturnValue(0)
|
||||
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)
|
||||
if item.Quantity == 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