Crossfire Server, Trunk
CFTimeOfDay.py
Go to the documentation of this file.
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)
CFTimeOfDay.TimeOfDay.matchAny
def matchAny(self, what)
Definition: CFTimeOfDay.py:8
CFTimeOfDay.TimeOfDay.current
current
Definition: CFTimeOfDay.py:6
CFTimeOfDay.TimeOfDay.__init__
def __init__(self)
Definition: CFTimeOfDay.py:4
CFTimeOfDay.TimeOfDay.now
now
Definition: CFTimeOfDay.py:5
CFTimeOfDay.TimeOfDay.matchAll
def matchAll(self, what)
Definition: CFTimeOfDay.py:14
CFTimeOfDay.TimeOfDay.log
def log(self)
Definition: CFTimeOfDay.py:19
CFTimeOfDay.TimeOfDay
Definition: CFTimeOfDay.py:3