<?php
$PATH_TO_IMAGE = "$PATH_TO_CODE/image";
//Note : use a sempahore here and in generateConstante ?
include $PATH_TO_CODE."/writable/constante.generate.inc";
class Constante
{
public static function getPathToImageCache() {
global $PATH_TO_CODE;
return "$PATH_TO_CODE/writable/imagecache";
}
public static function getPathToImage() {
global $PATH_TO_IMAGE;
return $PATH_TO_IMAGE;
}
public static $PLAYER_FREE_LOGIN="free";
public static function generateConstante($parMinZ, $parMaxZ, $parWorldCenterX, $parWorldCenterY, $parWorldLeftWidth, $parWorldTopHeight) {
global $PATH_TO_CODE;
$locFileContent = "<?php
class GeneratedConstante {
public static \$ZONE_COORD_Z_MAX_LEVEL = $parMaxZ;
public static \$ZONE_COORD_Z_MIN_LEVEL = $parMinZ;
public static \$WORLD_CENTER_X = $parWorldCenterX;
public static \$WORLD_CENTER_Y = $parWorldCenterY;
public static \$WORLD_LEFT_WIDTH = $parWorldLeftWidth;
public static \$WORLD_TOP_HEIGHT = $parWorldTopHeight;
}
?>";
$fh = fopen($PATH_TO_CODE."/writable/constante.generate.inc", "w+") or die("Can't open file: ".$PATH_TO_CODE."/writable/constante.generate.inc");
fwrite($fh, $locFileContent);
fclose($fh);
}
public static $MAP_MODE_SATELLITE_VIEW = 0;
public static $ZONE_TYPE_PLAIN = 0;
public static $REF_MAX_ACTION_POINT = 20000;
public static $REF_MAX_FIGHT_ACTION_POINT = 10000;
public static $EARN_ACTION_POINT_PER_TURN = 0.01;
public static $EARN_FIGHT_ACTION_POINT_PER_TURN = 0.02;
public static $MIN_TIME_MS_BEFORE_A_DECISION = 1000;
public static $MAX_TIME_MS_BEFORE_A_DECISION = 7200000;
public static $MOVE_Z_COST = 2.0;
public static $REAL_OBJECT_DAMAGE_MUX_FOR_ACTION_POINT_LOST=500;
public static $OBJECT_DISPLAY_MAX=2;
public static $DISPLAY_PRIORITY_LOW=0;
//<action list>
public static $ACTION_CHANGE_ZONE_TYPE_PLAIN = 0;
public static $ACTION_MOVE_OBJECT = 1;
public static $ACTION_STOP_OBJECT = 2;
public static $ACTION_NO_ACTION = 3;
//</action list>
public static $DIMENSION_LETTER=array('', 'k', 'M', 'G', 'T', 'P');
public static $BLOCK_SIZE = 5;
public static $HALF_BLOCK_SIZE = 2;
public static $ZONE_IMAGE_SIZE=32;
public static $BLOCK_IMAGE_SIZE=160;
public static $HTTP_ZONE_ACTION_LIST_NAME = "a";
public static $HTTP_IMAGE_UPDATE_NAME = "b";
//Jamais '-' car il y a les nombres n�gatifs
public static $SEP_URL_1 = '|';
public static $SEP_URL_2 = '*';
public static $SEP_URL_3 = ',';
public static $SEP_URL_4 = ':';
public static $SEP_URL_5 = '$';
public static $URL_PARA_UNIQUE_STRING = "u";
public static $URL_PARA_TIMESTAMP_STRING = "t";
public static $SEP_URL_UNIQUE_STRING = '-';
public static $BLOCK_TIMESTAMP_MARGE = 2;
public static $OBJECT_TIMESTAMP_MARGE = 2;
public static $DEFAULT_UPDATE_FUNCTION_CALL = 100;
public static $DEFAULT_REFRESH_PAGE = 3000;
//public static $DEFAULT_UPDATE_FUNCTION_CALL = 100;
//public static $DEFAULT_REFRESH_PAGE = 500;
/*milliseconds?*/
public static $ACTION_REFRESH_TIME = 5000;
/*milliseconds?*/
public static $MOVE_REFRESH_TIME = 10000;
/*milliseconds?*/
public static $FIRE_REFRESH_TIME = 5000;
/*milliseconds?*/
public static $DELETED_REFRESH_TIME = 1000;
/*Seconds*/
public static $SYNC_OUT_TIME = 20;
/*milliseconds?*/
public static $DEFAULT_TTL_FOR_ATTACK_TEMP = 10000;
/*milliseconds?*/
public static $DEFAULT_TTL_FOR_DELETE_BODY = 30000;
public static $ZONE_COORD_STRING_SIZE = 3;
public static $ZONE_COORD_Z_STRING_SIZE = 1;
public static function minMaxZ($parZ) {
$parZ = max(Constante::getMinZ(), $parZ);
$parZ = min(Constante::getMaxZ(), $parZ);
return $parZ;
}
public static function normalizeZ($parZ) {
return $parZ-Site::$ZONE_COORD_Z_GROUND_LEVEL;
}
public static function getWorldCenterY() {
return GeneratedConstante::$WORLD_CENTER_Y;
}
public static function getWorldCenterX() {
return GeneratedConstante::$WORLD_CENTER_X;
}
public static function getWorldWidthInZone() {
return Constante::getMaxX()-Constante::getMinX();
}
public static function getWorldHeightInZone() {
return Constante::getMaxY()-Constante::getMinY();
}
public static function getMaxX() {
return Constante::getMaxBlockX() + Constante::$HALF_BLOCK_SIZE;
}
public static function getMinX() {
return Constante::getMinBlockX() - Constante::$HALF_BLOCK_SIZE;
}
public static function getMaxY() {
return Constante::getMaxBlockY() + Constante::$HALF_BLOCK_SIZE;
}
public static function getMinY() {
return Constante::getMinBlockY() - Constante::$HALF_BLOCK_SIZE;
}
public static function getMaxBlockX() {
return GeneratedConstante::$WORLD_CENTER_X + GeneratedConstante::$WORLD_LEFT_WIDTH*Constante::$BLOCK_SIZE;
}
public static function getMinBlockX() {
return GeneratedConstante::$WORLD_CENTER_X - GeneratedConstante::$WORLD_LEFT_WIDTH*Constante::$BLOCK_SIZE;
}
public static function getMaxBlockY() {
return GeneratedConstante::$WORLD_CENTER_Y + GeneratedConstante::$WORLD_TOP_HEIGHT*Constante::$BLOCK_SIZE;
}
public static function getMinBlockY() {
return GeneratedConstante::$WORLD_CENTER_Y - GeneratedConstante::$WORLD_TOP_HEIGHT*Constante::$BLOCK_SIZE;
}
public static function getMaxZ() {
return GeneratedConstante::$ZONE_COORD_Z_MAX_LEVEL;
}
public static function getMinZ() {
return GeneratedConstante::$ZONE_COORD_Z_MIN_LEVEL;
}
public static function getWorldLeftWidth() {
return GeneratedConstante::$WORLD_LEFT_WIDTH;
}
public static function getWorldTopHeight() {
return GeneratedConstante::$WORLD_TOP_HEIGHT;
}
public static function getWorldWidth() {
return GeneratedConstante::$WORLD_LEFT_WIDTH*2+1;
}
public static function getWorldHeight() {
return GeneratedConstante::$WORLD_TOP_HEIGHT*2+1;
}
public static $WEAPON_RATIO_Z=0.3;
//Message
public static $MAX_MESSAGE_GET=100;
public static $ALPHA_BLOCK_OWNER = 100;
public static $ALPHA_OBJECT_PLAYER_OWNER = 10;
public static $ALPHA_OBJECT_ALLIANCE_OWNER = 90;
public static $ALPHA_FULL = 127;
public static function getColor($parColorNum) {
return Constante::$COLOR_LIST[$parColorNum];
}
public static $COLOR_LIST = array(
//black
"000000",
//gray
"808080",
//silver
//"c0c0c0",
//white
"ffffff",
//navy
"000080",
//blue
"0000ff",
//teal
"008080",
//aqua
"00ffff",
//green
"008000",
//lime
"00ff00",
//olive
"808000",
//yellow
"ffff00",
//maroon
"800000",
//red
"ff0000",
//purple
"800080",
//fuchsia
"ff00ff");
}
?>