View file element_function_global_battle.php

File size: 0.98Kb
<?php

	function getTimeStart() {
		
		$time = time();
		
		$time_battle = array(mktime(11, 30, 0, date("n"), date("j"), date("Y")),
                             mktime(14, 30, 0, date("n"), date("j"), date("Y")),
							 mktime(19, 30, 0, date("n"), date("j"), date("Y")));
		
		if ($time_battle[0] < $time AND $time < $time_battle[1]) {
			$start = $time_battle[1];
			// HP
		} elseif ($time > $time_battle[1] AND $time < $time_battle[2]) {
			$start = $time_battle[2];
			// Def
		} else {
			$start = $time_battle[0];
			// Str
		}
		
		return date("H:i:s", mktime(0, 0, ($start - $time)));
		
	}

	function getCacheBattle() {
		$cache = readcache('element_global_battle');
		
		if (!$cache) $cache = setCacheBattle();
		return $cache;
	}
	
	function setCacheBattle($game = 0, $type = 1) {
		$array = array();
		$array['type'] = $type;
		$array['game'] = $game;
		$array['players'] = array();
		writecache('element_global_battle', $array);
		return $array;
	}

// element_function_global_battle.php
?>