3 from CFMapTransformer
import CFMapTransformer
4 from CFTimeOfDay
import TimeOfDay
9 event = Crossfire.WhatIsEvent()
10 alreadymatched = (event.Value!=0)
11 parameters = cjson.decode(event.Message)
14 inverse =
"inverse" in parameters
and parameters[
"inverse"] ==
True
16 if not "match" in parameters:
17 Crossfire.Log(Crossfire.LogError,
"Script replace_in_map.py didn't get a 'match' parameter. Only got %s" %parameters)
18 elif parameters[
"match"].lower() ==
"one":
19 match=
TimeOfDay().matchAny(parameters[
"when"]) != inverse
20 elif parameters[
"match"].lower() ==
"all":
21 match=
TimeOfDay().matchAll(parameters[
"when"]) != inverse
23 Crossfire.Log(Crossfire.LogError,
"Script replace_in_map.py didn't get a 'match' parameter. Only got %s" %parameters)
27 if (match != alreadymatched):
30 Crossfire.Log(Crossfire.LogDebug,
"Transforming %s into %s" %(parameters[
"from"],parameters[
"to"]))
31 transformer.transformAll(parameters[
"from"],parameters[
"to"])
34 transformer.untransformAll()