| 1 |
import Crossfire |
| 2 |
|
| 3 |
class TimeOfDay: |
| 4 |
def __init__(self): |
| 5 |
self.now = Crossfire.GetTime() |
| 6 |
self.current = [Crossfire.GetMonthName(self.now[1]),Crossfire.GetWeekdayName(self.now[5]),Crossfire.GetSeasonName(self.now[7]),Crossfire.GetPeriodofdayName(self.now[8])] |
| 7 |
|
| 8 |
def matchAny(self,what): |
| 9 |
if isinstance(what,list): |
| 10 |
return bool(set(what) & set(self.current)) |
| 11 |
else: |
| 12 |
return bool(set([what]) & set (self.current)) |
| 13 |
|
| 14 |
def matchAll(self,what): |
| 15 |
if isinstance(what,list): |
| 16 |
return bool(not (set(what) - set(self.current))) |
| 17 |
else: |
| 18 |
return bool(not (set([what]) - set (self.current))) |
| 19 |
def log(self): |
| 20 |
Crossfire.Log(Crossfire.LogDebug,"current time is seen as %s" %self.current) |