Table of Contents

Class: TimeManager mudlib/mudtime.py

Handles in-game world time and how it's represented.

Base Classes   
MudObject
Methods   
__init__
addMetaIncrement
createTimeManager
displayTime
formatTime
getIncrementDescription
getMudTime
setIncrementDescriptions
setStartInRealTime
  __init__ 
__init__ ( self )

  addMetaIncrement 
addMetaIncrement (
        self,
        incrementValue,
        incrementName,
        )

Add increments in progressively bigger order.

If you want one second = one second mudtime then addMetaIncrement( 1, "second" )

sixty seconds = one minute mudtime then addMetaIncrement( 60, "minute" )

thirty six hundred secs = one hour mudtime then addMetaIncrement( 60*60, "hour" )

or to make the mud faster then real time, fifteen seconds = one mud minute then addMetaIncrement( 15, "minute" )

arguments:

incrementValue
(int) how many increments for this metaincrement
incrementName
(string) name of the metaincrement
  createTimeManager 
createTimeManager ( self )

Override this for subclasses of the TimeManager class.

  displayTime 
displayTime ( self )

This will return the formated time of the mud in string form.

returns:

(string) human readable form of the current time

  formatTime 
formatTime ( self,  timeIncrements )

This should be overriden to format time however the mud wishes.

arguments:

timeIncrements
(int) increments since the "epoch"

returns:

(string) human readable form of a given time

  getIncrementDescription 
getIncrementDescription (
        self,
        incrementName,
        incrementNumber,
        )

This allows you to fetch the appropriate description for an increment. If I want the 2(nd) "day" (using the examples in setIncrementDescriptions and addMetaIncrement I would do getIncrememntName( "day", 2 ).

arguments:

incrementName
(string) the name of the meta increment
incrementNumber
(int) which increment value to retrieve

returns:

(string) the name of the increment value

  getMudTime 
getMudTime ( self )

This will calculate the current mudtime and return a dictionary where the key is the increment name and the value is the amount.

[ ("day", 2), ("month", 5), ("Year", 2001) ] would be equaivalent to The second day of the fifth month of the year 2001.

returns:

list of (string, int) tuples

  setIncrementDescriptions 
setIncrementDescriptions (
        self,
        incrementName,
        incrementDescs,
        )

For each MetaIncrement you can define a set of descriptions. So for 7 days = {Sunday, Monday, Tuesday, Wednesday, etc.} do setIncrementDescriptions( "day", ["Sunday", "Monday", "Tuesday", etc.] )

arguments:

incrementName
(string) the name of the increment
incrementDescs
(list of strings) the names of the various increment values

  setStartInRealTime 
setStartInRealTime ( self,  seconds )

This sets the date the mud will starting counting from in order to calculate the mudtime.

arguments:

seconds
(int) ???


Table of Contents

This document was automatically generated on Thu Jan 24 08:57:43 2002 by HappyDoc version 2.0