45 from CFTimeOfDay
import TimeOfDay
47 event = Crossfire.WhatIsEvent()
48 parameters = cjson.decode(event.Message)
49 alreadymatched = (event.Value!=0)
50 inverse =
"inverse" in parameters
and parameters[
"inverse"] ==
True
52 if not "match" in parameters:
53 Crossfire.Log(Crossfire.LogError,
"Script replace_period.py didn't get a 'match' parameter. Only got %s" %parameters)
54 elif parameters[
"match"].lower() ==
"one":
55 match=
TimeOfDay().matchAny(parameters[
"when"]) != inverse
56 elif parameters[
"match"].lower() ==
"all":
57 match=
TimeOfDay().matchAll(parameters[
"when"]) != inverse
59 Crossfire.Log(Crossfire.LogError,
"Script replace_period.py didn't get a 'match' parameter. Only got %s" %parameters)
61 if ( match != alreadymatched ):
63 event = Crossfire.WhatIsEvent()
64 current = Crossfire.WhoAmI()
65 future = event.Inventory
69 while ( (future !=
None) & (future.Type == Crossfire.Type.EVENT_CONNECTOR)):
78 future.InsertInto(env)
79 event.InsertInto(future)
80 current.InsertInto(event)
91 mymap.Insert(future,x,y)
93 event.InsertInto(future)
95 current.InsertInto(event)