timeofday based python script
updated existing script to use JSON notation added a "replace in all map" script added a test map updated test maps to JSON notation added helper tools: CFTimeOfDay and CFMapTransformer fixed warnings in gridarta git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@7546 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
be7e87113f
commit
42656ed898
|
@ -0,0 +1,121 @@
|
|||
# CFMapTransformer.py - CFMapTransformer class
|
||||
#
|
||||
# Copyright (C) 2007 David Delbecq
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# The author can be reached via e-mail at tchize+cfpython@gmail.com
|
||||
#
|
||||
# Small helper class. Instanciate with
|
||||
# transform = CFMapTransformer(key)
|
||||
# or
|
||||
# transform = CFMapTransformer(key, map)
|
||||
# default map value is to use The map of current event.
|
||||
#
|
||||
# The key is used to keep track of transform. Different transforms
|
||||
# on same map should use different key to prevent mixup
|
||||
|
||||
# transformAll(criteria,whatTo)
|
||||
# criteria can be a single String or a list,
|
||||
# whatTo can be a single String or a list.
|
||||
# This will scan the whole map for item's whose
|
||||
# "name" are in the list of criteria and transform
|
||||
# the to one of the whatTo objects, choosen randomly.
|
||||
# original object is kept in inventory of newly created
|
||||
# item and can be restored from there
|
||||
# untransformAll()
|
||||
# this no argument method cancel all changes that have been
|
||||
# made by transformAll
|
||||
import Crossfire
|
||||
import random
|
||||
|
||||
|
||||
def GetObjectMap(o):
|
||||
while (o.Env):
|
||||
o=o.Env
|
||||
if (o.Map):
|
||||
return o.Map
|
||||
return None
|
||||
|
||||
def MakeIdentifier(key):
|
||||
m = Crossfire.CreateObjectByName("force")
|
||||
m.Name= key
|
||||
m.Speed=0
|
||||
return m
|
||||
|
||||
class CFMapTransformer:
|
||||
key = None
|
||||
cfmap = None
|
||||
def __init__(self,key,cfmap=None):
|
||||
self.key=key
|
||||
if (cfmap):
|
||||
self.cfmap=cfmap
|
||||
else:
|
||||
o = Crossfire.WhoAmI()
|
||||
while (o.Env):
|
||||
o = o.Env
|
||||
self.cfmap = o.Map
|
||||
|
||||
def transformAll(self, criteria, whatTo):
|
||||
mustClean = False
|
||||
if (not isinstance (criteria,list)):
|
||||
criteria = [criteria]
|
||||
for x in range (self.cfmap.Width):
|
||||
for y in range (self.cfmap.Height):
|
||||
top = self.cfmap.ObjectAt(x,y)
|
||||
while (top):
|
||||
#print "testing %s at (%d %d) for match against criteria %s" %(top.Name,x,y,criteria)
|
||||
next = top.Above
|
||||
if (set([top.Name]) & set (criteria) ):
|
||||
#print "matched"
|
||||
#do the replace
|
||||
if isinstance(whatTo,list):
|
||||
ob = Crossfire.CreateObjectByName(whatTo[random.randint(0,len(whatTo)-1)])
|
||||
else:
|
||||
ob = Crossfire.CreateObjectByName(whatTo)
|
||||
force = MakeIdentifier(self.key)
|
||||
force.InsertInto(ob)
|
||||
top.InsertInto(ob)
|
||||
self.cfmap.Insert(ob,x,y)
|
||||
#handle living stuff by freezing them
|
||||
force.WriteKey("inside_speed","%f" %top.Speed,1)
|
||||
top.Speed = 0
|
||||
top=next
|
||||
def untransformAll(self):
|
||||
for x in range(self.cfmap.Width):
|
||||
for y in range(self.cfmap.Height):
|
||||
top = self.cfmap.ObjectAt(x,y)
|
||||
while (top):
|
||||
#print "checking at (%d,%d) if %s need a restore" %(x,y,top.Name)
|
||||
next = top.Above
|
||||
match = False
|
||||
inv = top.Inventory
|
||||
torestore = None
|
||||
while(inv):
|
||||
#print " checking inventory item %s" %inv.Name
|
||||
if (inv.Type == Crossfire.Type.FORCE) and (inv.Name == self.key):
|
||||
oldspeed = float(inv.ReadKey("inside_speed"))
|
||||
#print "i found the force, luke"
|
||||
match = True
|
||||
elif (inv.Type != Crossfire.Type.EVENT_CONNECTOR):
|
||||
#print "found what to restore"
|
||||
torestore = inv
|
||||
inv = inv.Below
|
||||
if match and (torestore != None):
|
||||
#print "found something to restore"
|
||||
torestore.Speed = oldspeed
|
||||
self.cfmap.Insert(torestore,x,y)
|
||||
top.Remove()
|
||||
top=next
|
|
@ -0,0 +1,20 @@
|
|||
import Crossfire
|
||||
|
||||
class TimeOfDay:
|
||||
def __init__(self):
|
||||
self.now = Crossfire.GetTime()
|
||||
self.current = [Crossfire.GetMonthName(self.now[1]),Crossfire.GetWeekdayName(self.now[5]),Crossfire.GetSeasonName(self.now[7]),Crossfire.GetPeriodofdayName(self.now[8])]
|
||||
|
||||
def matchAny(self,what):
|
||||
if isinstance(what,list):
|
||||
return bool(set(what) & set(self.current))
|
||||
else:
|
||||
return bool(set([what]) & set (self.current))
|
||||
|
||||
def matchAll(self,what):
|
||||
if isinstance(what,list):
|
||||
return bool(not (set(what) - set(self.current)))
|
||||
else:
|
||||
return bool(not (set([what]) - set (self.current)))
|
||||
def log(self):
|
||||
Crossfire.Log(Crossfire.LogDebug,"current time is seen as %s" %self.current)
|
|
@ -18,6 +18,7 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
# Uses JSON notation for parameters
|
||||
# This script make the event it is attached to (not global!)
|
||||
# works only in specific moment of year/day
|
||||
# exemple, to make an "apply" work only on
|
||||
|
@ -26,21 +27,18 @@
|
|||
# arch event_apply
|
||||
# title Python
|
||||
# slaying /python/tod/filter_all_periods.py
|
||||
# name the Day of the Moon,The Season of the Blizzard,Morning
|
||||
# msg
|
||||
# {
|
||||
# "when":["Moon","The Season of the Blizzard","Morning"]
|
||||
# }
|
||||
# endmsg
|
||||
# end
|
||||
import Crossfire
|
||||
import string
|
||||
|
||||
now = Crossfire.GetTime()
|
||||
parameters = string.split(Crossfire.ScriptParameters(),",")
|
||||
current = [Crossfire.GetMonthName(now[1]),Crossfire.GetWeekdayName(now[5]),Crossfire.GetSeasonName(now[7]),Crossfire.GetPeriodofdayName(now[8])]
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Seasons to check for are %s" %parameters)
|
||||
#Crossfire.Log(Crossfire.LogDebug , "now is %s" %current)
|
||||
|
||||
from CFTimeOfDay import TimeOfDay
|
||||
import cjson
|
||||
parameters = cjson.decode(Crossfire.WhatIsEvent().Message)
|
||||
#default: allow operation (0)
|
||||
Crossfire.SetReturnValue()
|
||||
if (set(parameters) - set(current)):
|
||||
#some parameters had no match on 'now' -> refuse operation
|
||||
Crossfire.SetReturnValue(0)
|
||||
if TimeOfDay().matchAny(parameters["when"]):
|
||||
Crossfire.SetReturnValue(1)
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
#
|
||||
#
|
||||
# Uses JSON notation for parameters
|
||||
# This script make the event it is attached to (not global!)
|
||||
# works only in specific moment of year/day. Periods are separated
|
||||
# by comas. See wiki doc list of possible values
|
||||
|
@ -26,20 +26,19 @@
|
|||
# arch event_apply
|
||||
# title Python
|
||||
# slaying /python/tod/filter_one_period.py
|
||||
# name The Season of New Year,The Season of the Blizzard,Morning
|
||||
# msg
|
||||
# {
|
||||
# "when":["The Season of New Year","The Season of the Blizzard","Morning"]
|
||||
# }
|
||||
# endmsg
|
||||
# end
|
||||
import Crossfire
|
||||
import string
|
||||
|
||||
now = Crossfire.GetTime()
|
||||
parameters = string.split(Crossfire.ScriptParameters(),",")
|
||||
current = [Crossfire.GetMonthName(now[1]),Crossfire.GetWeekdayName(now[5]),Crossfire.GetSeasonName(now[7]),Crossfire.GetPeriodofdayName(now[8])]
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Seasons to check for are %s" %parameters)
|
||||
#Crossfire.Log(Crossfire.LogDebug , "now is %s" %current)
|
||||
|
||||
#default: cancel operation (<>0). If non empty intersection, we have a match, set to continur operation (0)
|
||||
from CFTimeOfDay import TimeOfDay
|
||||
import cjson
|
||||
parameters = cjson.decode(Crossfire.WhatIsEvent().Message)
|
||||
Crossfire.SetReturnValue(1)
|
||||
if (set(parameters) & set(current)):
|
||||
if TimeOfDay().matchAny(parameters["when"]):
|
||||
Crossfire.SetReturnValue(0)
|
||||
|
||||
|
||||
|
|
|
@ -38,24 +38,25 @@
|
|||
# arch event_time
|
||||
# title Python
|
||||
# slaying /python/tod/push_all_periods.py
|
||||
# name 69,Morning,The Season of New Year
|
||||
# msg
|
||||
# {
|
||||
# "connected":69
|
||||
# "when":["Morning","The Season of New Year"]
|
||||
# }
|
||||
# endmsg
|
||||
# end
|
||||
# parameters are separated by comas. First one
|
||||
# is connected value to trigger, other ones are
|
||||
# one or more periods where state must become "pushed"
|
||||
import Crossfire
|
||||
import string
|
||||
from CFTimeOfDay import TimeOfDay
|
||||
import cjson
|
||||
event = Crossfire.WhatIsEvent()
|
||||
parameters = cjson.decode(event.Message)
|
||||
alreadymatched = (event.Value!=0)
|
||||
|
||||
parameters = string.split(Crossfire.ScriptParameters(),",")
|
||||
connected = int(parameters.pop(0))
|
||||
now = Crossfire.GetTime()
|
||||
current = [Crossfire.GetMonthName(now[1]),Crossfire.GetWeekdayName(now[5]),Crossfire.GetSeasonName(now[7]),Crossfire.GetPeriodofdayName(now[8])]
|
||||
if (set(parameters) - set(current)):
|
||||
match = False
|
||||
else:
|
||||
match=True
|
||||
connected = int(parameters["connected"]))
|
||||
match = TimeOfDay().matchAll(parameters["when"])
|
||||
#pushdown if needed
|
||||
if (match & (not alreadymatched)):
|
||||
op = event
|
||||
|
@ -73,7 +74,3 @@ if ( (not match) & alreadymatched):
|
|||
map.TriggerConnected(connected,0,Crossfire.WhoAmI())
|
||||
event.Value=0
|
||||
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Seasons to check for are %s" %parameters)
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Current seasons are %s" %current)
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Current match status is %d but will be %d" %(alreadymatched,match))
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Connecte to trigger is %i" %connected)
|
||||
|
|
|
@ -38,24 +38,25 @@
|
|||
# arch event_time
|
||||
# title Python
|
||||
# slaying /python/tod/push_one_period.py
|
||||
# name 69,Morning,Noon
|
||||
# msg
|
||||
# {
|
||||
# "connected":69
|
||||
# "when":["Morning","Noon"]
|
||||
# }
|
||||
# endmsg
|
||||
# end
|
||||
# parameters are separated by comas. First one
|
||||
# is connected value to trigger, other ones are
|
||||
# one or more periods where state must become "pushed"
|
||||
import Crossfire
|
||||
import string
|
||||
event = Crossfire.WhatIsEvent()
|
||||
from CFTimeOfDay import TimeOfDay
|
||||
import cjson
|
||||
event = Crossfire.WhatIsEvent()
|
||||
parameters = cjson.decode(event.Message)
|
||||
alreadymatched = (event.Value!=0)
|
||||
|
||||
parameters = string.split(Crossfire.ScriptParameters(),",")
|
||||
connected = int(parameters.pop(0))
|
||||
now = Crossfire.GetTime()
|
||||
current = [Crossfire.GetMonthName(now[1]),Crossfire.GetWeekdayName(now[5]),Crossfire.GetSeasonName(now[7]),Crossfire.GetPeriodofdayName(now[8])]
|
||||
if (set(parameters) & set(current)):
|
||||
match = True
|
||||
else:
|
||||
match=False
|
||||
connected = int(parameters["connected"])
|
||||
match = TimeOfDay().matchAny(parameters["when"])
|
||||
#pushdown if need
|
||||
if (match & (not alreadymatched)):
|
||||
op = event
|
||||
|
@ -72,7 +73,3 @@ if ( (not match) & alreadymatched):
|
|||
map.TriggerConnected(connected,0,Crossfire.WhoAmI())
|
||||
event.Value=0
|
||||
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Seasons to check for are %s" %parameters)
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Current seasons are %s" %current)
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Current match status is %d but will be %d" %(alreadymatched,match))
|
||||
#Crossfire.Log(Crossfire.LogDebug , "Connecte to trigger is %i" %connected)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
#
|
||||
#
|
||||
# Uses JSON notation for parameters
|
||||
# This script make the object is is attached to swap at
|
||||
# given periods of day with a specifc object in the event's inventory
|
||||
# To use it, give this event's parameter the name of
|
||||
|
@ -28,30 +28,28 @@
|
|||
#
|
||||
# arch event_time
|
||||
# title Python
|
||||
# slaying /python/tod/replace_one_period.py
|
||||
# name Morning,Noon
|
||||
# slaying /python/tod/replace_all_periods.py
|
||||
# msg
|
||||
# {
|
||||
# "when":["Morning","The Season of the Blizzard"]
|
||||
# }
|
||||
# endmsg
|
||||
# arch beholder
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# parameters are separated by comas. Those
|
||||
# are the periods of day where the swap is active
|
||||
|
||||
|
||||
import Crossfire
|
||||
import string
|
||||
from CFTimeOfDay import TimeOfDay
|
||||
import cjson
|
||||
event = Crossfire.WhatIsEvent()
|
||||
parameters = cjson.decode(event.Message)
|
||||
alreadymatched = (event.Value!=0)
|
||||
|
||||
parameters = string.split(Crossfire.ScriptParameters(),",")
|
||||
now = Crossfire.GetTime()
|
||||
current = [Crossfire.GetMonthName(now[1]),Crossfire.GetWeekdayName(now[5]),Crossfire.GetSeasonName(now[7]),Crossfire.GetPeriodofdayName(now[8])]
|
||||
if (set(parameters) - set(current)):
|
||||
match = False
|
||||
else:
|
||||
match = True
|
||||
if ( (match and (not alreadymatched)) or (alreadymatched and (not match))):
|
||||
Crossfire.Log(Crossfire.LogDebug, "replace_one_period")
|
||||
match = TimeOfDay().matchAll(parameters["when"])
|
||||
if ( match != alreadymatched ):
|
||||
#Crossfire.Log(Crossfire.LogDebug, "replace_all_periods")
|
||||
event = Crossfire.WhatIsEvent()
|
||||
current = Crossfire.WhoAmI()
|
||||
future = event.Inventory
|
||||
|
@ -61,11 +59,11 @@ if ( (match and (not alreadymatched)) or (alreadymatched and (not match))):
|
|||
while ( (future != None) & (future.Type == Crossfire.Type.EVENT_CONNECTOR)):
|
||||
future=future.Below
|
||||
if (future):
|
||||
if (future.Below):
|
||||
Crossfire.Log(Crossfire.LogDebug, "future.Below is %s" %future.Below.Name)
|
||||
Crossfire.Log(Crossfire.LogDebug, "current is %s, future is %s, event is %s" %(current.Name, future.Name, event.Name))
|
||||
#if (future.Below):
|
||||
#Crossfire.Log(Crossfire.LogDebug, "future.Below is %s" %future.Below.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "current is %s, future is %s, event is %s" %(current.Name, future.Name, event.Name))
|
||||
if (current.Env):
|
||||
Crossfire.Log(Crossfire.LogDebug, "env mode")
|
||||
#Crossfire.Log(Crossfire.LogDebug, "env mode")
|
||||
env = current.Env
|
||||
future.InsertInto(env)
|
||||
event.InsertInto(future)
|
||||
|
@ -75,19 +73,19 @@ if ( (match and (not alreadymatched)) or (alreadymatched and (not match))):
|
|||
else:
|
||||
event.Value=1
|
||||
elif (current.Map):
|
||||
Crossfire.Log(Crossfire.LogDebug, "Map mode")
|
||||
#Crossfire.Log(Crossfire.LogDebug, "Map mode")
|
||||
mymap = current.Map
|
||||
x = current.X
|
||||
y = current.Y
|
||||
Crossfire.Log(Crossfire.LogDebug, "inserting future %s in map" %future.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "inserting future %s in map" %future.Name)
|
||||
mymap.Insert(future,x,y)
|
||||
Crossfire.Log(Crossfire.LogDebug, "inserting event %s in future" %event.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "inserting event %s in future" %event.Name)
|
||||
event.InsertInto(future)
|
||||
Crossfire.Log(Crossfire.LogDebug, "inserting current %s in event" %current.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "inserting current %s in event" %current.Name)
|
||||
current.InsertInto(event)
|
||||
if (alreadymatched):
|
||||
event.Value=0
|
||||
else:
|
||||
event.Value=1
|
||||
else:
|
||||
Crossfire.Log(Crossfire.LogDebug, "neither env object nor map found")
|
||||
#else:
|
||||
#Crossfire.Log(Crossfire.LogDebug, "neither env object nor map found")
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
import Crossfire
|
||||
import random
|
||||
from CFMapTransformer import CFMapTransformer
|
||||
from CFTimeOfDay import TimeOfDay
|
||||
import cjson
|
||||
|
||||
|
||||
event = Crossfire.WhatIsEvent()
|
||||
alreadymatched = (event.Value!=0)
|
||||
parameters = cjson.decode(event.Message)
|
||||
current = TimeOfDay()
|
||||
#current.log()
|
||||
match = current.matchAny(parameters["when"])
|
||||
#print "match is %s and alreadymatched is %s" %(match,alreadymatched)
|
||||
|
||||
if (match != alreadymatched):
|
||||
transformer = CFMapTransformer(parameters["key"])
|
||||
if (match):
|
||||
Crossfire.Log(Crossfire.LogDebug,"Transforming %s into %s" %(parameters["from"],parameters["to"]))
|
||||
transformer.transformAll(parameters["from"],parameters["to"])
|
||||
event.Value=1
|
||||
else:
|
||||
transformer.untransformAll()
|
||||
event.Value=0
|
||||
|
||||
#if random.randint(0,2) == 0 :
|
||||
# print "transform mode"
|
||||
# transformer.transformAll("skeleton",["bones1","bones2","bones3","bones4"])
|
||||
#else:
|
||||
# print "untransform mode"
|
||||
# transformer.untransformAll()
|
|
@ -17,7 +17,7 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
#
|
||||
#
|
||||
# Uses JSON notation for parameters
|
||||
# This script make the object is is attached to swap at
|
||||
# given periods of day with a specifc object in the event's inventory
|
||||
# To use it, give this event's parameter the name of
|
||||
|
@ -29,28 +29,26 @@
|
|||
# arch event_time
|
||||
# title Python
|
||||
# slaying /python/tod/replace_one_period.py
|
||||
# name Morning,Noon
|
||||
# msg
|
||||
# {
|
||||
# "when":["Noon","Morning"]
|
||||
# }
|
||||
# endmsg
|
||||
# arch beholder
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# parameters are separated by comas. Those
|
||||
# are the periods of day where the swap is active
|
||||
|
||||
|
||||
import Crossfire
|
||||
import string
|
||||
from CFTimeOfDay import TimeOfDay
|
||||
import cjson
|
||||
event = Crossfire.WhatIsEvent()
|
||||
parameters = cjson.decode(event.Message)
|
||||
alreadymatched = (event.Value!=0)
|
||||
|
||||
parameters = string.split(Crossfire.ScriptParameters(),",")
|
||||
now = Crossfire.GetTime()
|
||||
current = [Crossfire.GetMonthName(now[1]),Crossfire.GetWeekdayName(now[5]),Crossfire.GetSeasonName(now[7]),Crossfire.GetPeriodofdayName(now[8])]
|
||||
if (set(parameters) & set(current)):
|
||||
match = True
|
||||
else:
|
||||
match = False
|
||||
if ( (match and (not alreadymatched)) or (alreadymatched and (not match))):
|
||||
match = TimeOfDay().matchAny(parameters["when"])
|
||||
if ( match != alreadymatched ):
|
||||
Crossfire.Log(Crossfire.LogDebug, "replace_one_period")
|
||||
event = Crossfire.WhatIsEvent()
|
||||
current = Crossfire.WhoAmI()
|
||||
|
@ -61,11 +59,11 @@ if ( (match and (not alreadymatched)) or (alreadymatched and (not match))):
|
|||
while ( (future != None) & (future.Type == Crossfire.Type.EVENT_CONNECTOR)):
|
||||
future=future.Below
|
||||
if (future):
|
||||
if (future.Below):
|
||||
Crossfire.Log(Crossfire.LogDebug, "future.Below is %s" %future.Below.Name)
|
||||
Crossfire.Log(Crossfire.LogDebug, "current is %s, future is %s, event is %s" %(current.Name, future.Name, event.Name))
|
||||
#if (future.Below):
|
||||
#Crossfire.Log(Crossfire.LogDebug, "future.Below is %s" %future.Below.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "current is %s, future is %s, event is %s" %(current.Name, future.Name, event.Name))
|
||||
if (current.Env):
|
||||
Crossfire.Log(Crossfire.LogDebug, "env mode")
|
||||
#Crossfire.Log(Crossfire.LogDebug, "env mode")
|
||||
env = current.Env
|
||||
future.InsertInto(env)
|
||||
event.InsertInto(future)
|
||||
|
@ -75,19 +73,19 @@ if ( (match and (not alreadymatched)) or (alreadymatched and (not match))):
|
|||
else:
|
||||
event.Value=1
|
||||
elif (current.Map):
|
||||
Crossfire.Log(Crossfire.LogDebug, "Map mode")
|
||||
#Crossfire.Log(Crossfire.LogDebug, "Map mode")
|
||||
mymap = current.Map
|
||||
x = current.X
|
||||
y = current.Y
|
||||
Crossfire.Log(Crossfire.LogDebug, "inserting future %s in map" %future.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "inserting future %s in map" %future.Name)
|
||||
mymap.Insert(future,x,y)
|
||||
Crossfire.Log(Crossfire.LogDebug, "inserting event %s in future" %event.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "inserting event %s in future" %event.Name)
|
||||
event.InsertInto(future)
|
||||
Crossfire.Log(Crossfire.LogDebug, "inserting current %s in event" %current.Name)
|
||||
#Crossfire.Log(Crossfire.LogDebug, "inserting current %s in event" %current.Name)
|
||||
current.InsertInto(event)
|
||||
if (alreadymatched):
|
||||
event.Value=0
|
||||
else:
|
||||
event.Value=1
|
||||
else:
|
||||
Crossfire.Log(Crossfire.LogDebug, "neither env object nor map found")
|
||||
#else:
|
||||
#Crossfire.Log(Crossfire.LogDebug, "neither env object nor map found")
|
||||
|
|
270
test/tod
270
test/tod
|
@ -5,7 +5,7 @@ width 20
|
|||
height 20
|
||||
msg
|
||||
Created: 2007-11-11 tchize
|
||||
Modified: 2007-11-17 tchize
|
||||
Modified: 2007-11-19 tchize
|
||||
endmsg
|
||||
end
|
||||
arch brush
|
||||
|
@ -196,7 +196,11 @@ x 2
|
|||
y 3
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name The Season of New Year
|
||||
msg
|
||||
{
|
||||
"when":"The Season of New Year"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -213,7 +217,11 @@ x 2
|
|||
y 4
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name The Season of Growth
|
||||
msg
|
||||
{
|
||||
"when":"The Season of Growth"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -230,7 +238,11 @@ x 2
|
|||
y 5
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name The Season of Harvest
|
||||
msg
|
||||
{
|
||||
"when":"The Season of Harvest"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -247,7 +259,11 @@ x 2
|
|||
y 6
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name The Season of Decay
|
||||
msg
|
||||
{
|
||||
"when":"The Season of Decay"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -264,7 +280,11 @@ x 2
|
|||
y 7
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name The Season of the Blizzard
|
||||
msg
|
||||
{
|
||||
"when":"The Season of the Blizzard"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -442,7 +462,11 @@ x 4
|
|||
y 3
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Winter
|
||||
msg
|
||||
{
|
||||
"when":"Month of Winter"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -459,7 +483,11 @@ x 4
|
|||
y 4
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Ice Dragon
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Ice Dragon"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -476,7 +504,11 @@ x 4
|
|||
y 5
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Frost Giant
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Frost Giant"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -493,7 +525,11 @@ x 4
|
|||
y 6
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Valriel
|
||||
msg
|
||||
{
|
||||
"when":"Month of Valriel"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -510,7 +546,11 @@ x 4
|
|||
y 7
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Lythander
|
||||
msg
|
||||
{
|
||||
"when":"Month of Lythander"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -527,7 +567,11 @@ x 4
|
|||
y 8
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Harvest
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Harvest"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -544,7 +588,11 @@ x 4
|
|||
y 9
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Gaea
|
||||
msg
|
||||
{
|
||||
"when":"Month of Gaea"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -561,7 +609,11 @@ x 4
|
|||
y 10
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Futility
|
||||
msg
|
||||
{
|
||||
"when":"Month of Futility"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -578,7 +630,11 @@ x 4
|
|||
y 11
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Dragon
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Dragon"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -595,7 +651,11 @@ x 4
|
|||
y 12
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Sun
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Sun"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -612,7 +672,11 @@ x 4
|
|||
y 13
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Great Infernus
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Great Infernus"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -629,7 +693,11 @@ x 4
|
|||
y 14
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Ruggilli
|
||||
msg
|
||||
{
|
||||
"when":"Month of Ruggilli"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -646,7 +714,11 @@ x 4
|
|||
y 15
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Dark Shades
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Dark Shades"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -663,7 +735,11 @@ x 4
|
|||
y 16
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Devourers
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Devourers"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -680,7 +756,11 @@ x 4
|
|||
y 17
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Sorig
|
||||
msg
|
||||
{
|
||||
"when":"Month of Sorig"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -697,7 +777,11 @@ x 4
|
|||
y 18
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of the Ancient Darkness
|
||||
msg
|
||||
{
|
||||
"when":"Month of the Ancient Darkness"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -714,7 +798,11 @@ x 4
|
|||
y 19
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Month of Gorokh
|
||||
msg
|
||||
{
|
||||
"when":"Month of Gorokh"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -844,7 +932,11 @@ x 6
|
|||
y 3
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name the Day of the Moon
|
||||
msg
|
||||
{
|
||||
"when":"the Day of the Moon"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -861,7 +953,11 @@ x 6
|
|||
y 4
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name the Day of the Bull
|
||||
msg
|
||||
{
|
||||
"when":"the Day of the Bull"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -878,7 +974,11 @@ x 6
|
|||
y 5
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name the Day of the Deception
|
||||
msg
|
||||
{
|
||||
"when":"the Day of the Deception"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -895,7 +995,11 @@ x 6
|
|||
y 6
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name the Day of Thunder
|
||||
msg
|
||||
{
|
||||
"when":"the Day of Thunder"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -912,7 +1016,11 @@ x 6
|
|||
y 7
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name the Day of Freedom
|
||||
msg
|
||||
{
|
||||
"when":"the Day of Freedom"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -929,7 +1037,11 @@ x 6
|
|||
y 8
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name the Day of the Great Gods
|
||||
msg
|
||||
{
|
||||
"when":"the Day of the Great Gods"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -946,7 +1058,11 @@ x 6
|
|||
y 9
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name the Day of the Sun
|
||||
msg
|
||||
{
|
||||
"when":"the Day of the Sun"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -1110,7 +1226,11 @@ x 8
|
|||
y 3
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Night
|
||||
msg
|
||||
{
|
||||
"when":"Night"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -1127,7 +1247,11 @@ x 8
|
|||
y 4
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Dawn
|
||||
msg
|
||||
{
|
||||
"when":"Dawn"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -1144,7 +1268,11 @@ x 8
|
|||
y 5
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Morning
|
||||
msg
|
||||
{
|
||||
"when":"Morning"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -1161,7 +1289,11 @@ x 8
|
|||
y 6
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Noon
|
||||
msg
|
||||
{
|
||||
"when":"Noon"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -1178,7 +1310,11 @@ x 8
|
|||
y 7
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Evening
|
||||
msg
|
||||
{
|
||||
"when":"Evening"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -1195,7 +1331,11 @@ x 8
|
|||
y 8
|
||||
move_on walk fly_low fly_high
|
||||
arch event_trigger
|
||||
name Dusk
|
||||
msg
|
||||
{
|
||||
"when":"Dusk"
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -1850,9 +1990,14 @@ y 15
|
|||
stand_still 1
|
||||
no_damage 1
|
||||
arch event_time
|
||||
name 79,Morning,Noon,Evening
|
||||
title Python
|
||||
slaying /python/tod/push_one_period.py
|
||||
msg
|
||||
{
|
||||
"connected":79,
|
||||
"when":["Morning","Noon","Evening"]
|
||||
}
|
||||
endmsg
|
||||
end
|
||||
end
|
||||
arch brush
|
||||
|
@ -1950,14 +2095,16 @@ end
|
|||
arch beholder
|
||||
x 16
|
||||
y 11
|
||||
connected 80
|
||||
arch event_trigger
|
||||
name Dusk,Night
|
||||
title Python
|
||||
slaying /python/tod/replace_one_period.py
|
||||
msg
|
||||
{
|
||||
"when" : ["Dusk","Night"]
|
||||
}
|
||||
endmsg
|
||||
subtype 8
|
||||
arch black_dragon1
|
||||
connected 80
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2074,14 +2221,16 @@ end
|
|||
arch beholder
|
||||
x 17
|
||||
y 11
|
||||
connected 80
|
||||
arch event_trigger
|
||||
name Dawn,Morning
|
||||
title Python
|
||||
slaying /python/tod/replace_one_period.py
|
||||
msg
|
||||
{
|
||||
"when" : ["Dawn","Morning"]
|
||||
}
|
||||
endmsg
|
||||
subtype 8
|
||||
arch black_dragon1
|
||||
connected 80
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2198,14 +2347,16 @@ end
|
|||
arch beholder
|
||||
x 18
|
||||
y 11
|
||||
connected 80
|
||||
arch event_trigger
|
||||
name Noon,Evening
|
||||
title Python
|
||||
slaying /python/tod/replace_one_period.py
|
||||
msg
|
||||
{
|
||||
"when" : ["Noon","Evening"]
|
||||
}
|
||||
endmsg
|
||||
subtype 8
|
||||
arch black_dragon1
|
||||
connected 80
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2260,7 +2411,11 @@ arch light_sword
|
|||
name Day sword
|
||||
x 19
|
||||
arch event_attack
|
||||
name Morning,Noon,Evening
|
||||
msg
|
||||
{
|
||||
"when":["Morning","Noon","Evening"]
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -2287,7 +2442,11 @@ name Night sword
|
|||
x 19
|
||||
y 2
|
||||
arch event_attack
|
||||
name Night,Dawn,Dusk
|
||||
msg
|
||||
{
|
||||
"when":["Night","Dawn","Dusk"]
|
||||
}
|
||||
endmsg
|
||||
title Python
|
||||
slaying /python/tod/filter_one_period.py
|
||||
end
|
||||
|
@ -2312,6 +2471,13 @@ arch brush
|
|||
x 19
|
||||
y 7
|
||||
end
|
||||
arch ladder_down
|
||||
slaying tod2
|
||||
hp 19
|
||||
sp 7
|
||||
x 19
|
||||
y 7
|
||||
end
|
||||
arch afloor_blue_right
|
||||
x 19
|
||||
y 8
|
||||
|
@ -2342,14 +2508,16 @@ end
|
|||
arch beholder
|
||||
x 19
|
||||
y 11
|
||||
connected 80
|
||||
arch event_trigger
|
||||
name Evening,Dusk
|
||||
title Python
|
||||
slaying /python/tod/replace_one_period.py
|
||||
msg
|
||||
{
|
||||
"when" : ["Dusk","Evening"]
|
||||
}
|
||||
endmsg
|
||||
subtype 8
|
||||
arch black_dragon1
|
||||
connected 80
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue