IsXmas

From IvanWiki
Jump to navigation Jump to search

Coding: This article contains code which is for experienced users only, and may reveal game secrets


IsXmas checks to see whether the current day is either Christmas or Christmas Eve.

truth game::IsXMas() // returns true if date is christmaseve or day 
{ 
  time_t Time = time(0); 
  struct tm* TM = localtime(&Time); 
  return (TM->tm_mon == 11 && (TM->tm_mday == 24 || TM->tm_mday == 25)); 
} 

Use

Currently IsXmas is only used to give the player a gift of a banana when they start the game:

if(IsXMas()) 
{ 
  item* Present = banana::Spawn(); 
  Player->GetStack()->AddItem(Present); 
  ADD_MESSAGE("Atavus is happy today! He gives you %s.", Present->CHAR_NAME(INDEFINITE)); 
} 

IsXmas could be easily used to modify other events in game though, such as spawning christmas lights in Attnam or similar.