<?php
include_once "../../site.class.php";
include_once $PATH_TO_CODE."/script/connect.php";
include_once $PATH_TO_CODE."/script/disconnect.php";
include_once $PATH_TO_CODE."/script/fonction.php";
include_once $PATH_TO_CODE."/script/block.class.php";
include_once $PATH_TO_CODE."/script/lockaccount/functionlockplayer.php";
include_once $PATH_TO_CODE."/modules/dungeon/dungeonconstante.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/dungeonplayer.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/objectmanager.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/dungeonfunction.php";
$locIsDebugActivated=getGetPost("debug", "false")=="true";
// TODO http://community.xajaxproject.org/viewtopic.php?pid=23501
Log::getInstance()->logLevel=Log::$ERROR;
static $BLOCK_IMAGE_NAME="iB";
static $BLOCK_IMAGE_COLOR_NAME="iBC";
static $BLOCK_DIV_BLOCK_NAME="dB";
static $OBJECT_IMAGE_NAME="oin";
static $OBJECT_DIV_NAME="odn";
if(getGetPostWithNoEmpty("askNewUnlock")) {
$locPlayerId = getPlayerIdWithGetPost($locL, $locP);
if($locPlayerId) {
updateUnlockStr($locPlayerId);
commit();
openSessionFailed("a new email have be sent");
} else {
openSessionFailed("no player with $locL and $locP");
}
exit(0);
}
initSession($locPlayerId, $locCurrentCenterX, $locCurrentCenterY, $locCurrentCenterZ);
global $gloObjectManager;
$locPlayer = $gloObjectManager->getPlayer($locPlayerId);
dungeonInitLanguageWithPlayer($locPlayer);
$locPlayerBlockIdList = Block::getAllBlocksId($locPlayerId);
if($locPlayerId > 1 && count($locPlayerBlockIdList) == 0) {
initializeAccount($locPlayerId, $locPlayer->playerType);
$locPlayerBlockIdList = Block::getAllBlocksId($locPlayerId);
initSession($locPlayerId, $locCurrentCenterX, $locCurrentCenterY, $locCurrentCenterZ);
}
$locCurrentBlockId = Zone::getZoneId($locCurrentCenterX, $locCurrentCenterY, $locCurrentCenterZ);
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
onKeyDown="javascript:processKeyDown(event);"
onKeyUp="javascript:dungeonProcessKeyUp(event);"
onKeyPress="javascript:processKeyPress(event);">
<head>
<TITLE>Dungeon</TITLE>
<?php echoBaseHead()?>
<link rel="stylesheet" href="css/phpblock.css" type="text/css" />
<link rel="stylesheet" href="modules/dungeon/css/interface.css" type="text/css" />
<script type="text/javascript" src="script/javascript/fonction.js"></script>
<script type="text/javascript" src="script/javascript/globals.js"></script>
<script type="text/javascript" src="script/javascript/debug.js"></script>
<script type="text/javascript" src="script/javascript/message.js"></script>
<script type="text/javascript" src="script/javascript/imageupdate.js"></script>
<script type="text/javascript" src="script/javascript/map.js"></script>
<script type="text/javascript" src="script/javascript/playerobjectlist.js"></script>
<script type="text/javascript" src="script/javascript/functionfromphp.js.php"></script>
<!--<module>-->
<script type="text/javascript" src="modules/dungeon/javascript/imageupdate.js"></script>
<script type="text/javascript" src="modules/dungeon/javascript/dungeon.js"></script>
<script type="text/javascript" src="modules/dungeon/javascript/phptojavascript.php"></script>
<!--</module>-->
<script type="text/javascript" src="script/javascript/jquery-1.3.2.min.js"></script>
<!-- <script type="text/javascript" src="script/javascript/jqueryinterfaceeyecon.js"></script> -->
<script type="text/javascript" src="script/javascript/jquery.dimensions.js"></script>
<script type="text/javascript" src="script/javascript/ui.mouse.js"></script>
<script type="text/javascript" src="script/javascript/ui.draggable.js"></script>
<script type="text/javascript" src="script/javascript/ui.draggable.ext.js"></script>
<script type="text/javascript" src="script/javascript/ui.resizable.js"></script>
<script type="text/javascript" src="script/javascript/interface.js"></script>
</head>
<body ondrag="return false;">
<?php
include_once $PATH_TO_CODE."/modules/dungeon/dungeonbodycontent.inc.php";
?>
</body>
<script language="javascript">
//Initialize
$(document).ready(
function bodyLoaded() {
initwindows();
$(window).bind('resize', function() {
calculateAll();
});
setGlobals(
"<?php echo Constante::$HTTP_ZONE_ACTION_LIST_NAME?>",
<?php echo (Constante::$OBJECT_DISPLAY_MAX+1)?>,
<?php echo Site::$ZONE_COORD_Z_GROUND_LEVEL.",";?>
<?php echo Constante::$BLOCK_SIZE.",";?>
<?php echo "$locCurrentCenterX, $locCurrentCenterY, $locCurrentCenterZ";?>,
<?php
echo "0, $locPlayerId,";
echo (Constante::$ZONE_IMAGE_SIZE*Constante::$BLOCK_SIZE).",";
echo (Constante::$ZONE_IMAGE_SIZE).",";
echo "\"".Constante::$SEP_URL_1."\",";
echo "\"".Constante::$SEP_URL_2."\",";
echo "\"".Constante::$SEP_URL_3."\",";
echo "\"".Constante::$SEP_URL_4."\",";
echo "\"".Constante::$SEP_URL_5."\",";
?>
"<?php echo Constante::$HTTP_IMAGE_UPDATE_NAME?>",
"<?php echo $BLOCK_IMAGE_NAME?>",
"<?php echo $BLOCK_DIV_BLOCK_NAME?>",
"<?php echo $BLOCK_IMAGE_COLOR_NAME?>",
"<?php echo $OBJECT_IMAGE_NAME?>",
"<?php echo $OBJECT_DIV_NAME?>",
"<?php echo Constante::$URL_PARA_UNIQUE_STRING?>", 1,
<?php echo Constante::getMinZ()?>,
<?php echo Constante::getMaxZ();?>,
"modules/dungeon/imageupdate.php",
"modules/dungeon/imageobject.php",
"modules/dungeon/information.php"
);
createMap('map');
createMapWrapper('mapwrapper');
gloMapWrapper.appendChild(gloMap);
wdgId("main").appendChild(gloMapWrapper);
locMapForBlock = window.document.createElement('div');
locMapForBlock.id="mapforblock";
locMapForBlock.name="mapforblock";
locMapForRock = window.document.createElement('div');
locMapForRock.id="mapforrock";
locMapForRock.name="mapforrock";
gloMap.appendChild(locMapForBlock);
gloMap.appendChild(locMapForRock);
initDebug("debugform", "debug", 3);
setZoom(1.0, true);
globalObjectList.performUpdate=function() {
$("#realObjectListInnerContentList").empty();
$.each(this.getCurrentObjectList().list(), function(i, e) {
if(e) {
$("#realObjectListInnerContentList").append("<option>"+e.getShortDescription()+"</option>");
} else {
$("#realObjectListInnerContentList").append("<option SELECTED>no object selected</option>");
}
});
};
globalObjectList.changeSelected=function(parRealObject) {
$("#realObjectListInnerContentDescription").empty();
wdgId("realObjectListInnerContentList").selectedIndex=this.getCurrentObjectList().currentIndex;
if(parRealObject) {
$("#realObjectListInnerContentDescription").append("<div>"+parRealObject.getDescription()+"</div>");
$("#objectMapActionsValue<?php echo Constante::$ACTION_MOVE_OBJECT;?>").html(parseInt2(parRealObject.moveCost));
$("#objectMapActionsValue<?php echo Constante::$ACTION_STOP_OBJECT;?>").html("0");
$("#objectMapActionsValue<?php echo DungeonConstante::$ACTION_OBJECT_SEARCH_TRAP;?>").html(parseInt2(parRealObject.trapSearchCost));
$("#objectMapActionsValue<?php echo DungeonConstante::$ACTION_OBJECT_DIG;?>").html(parseInt2(parRealObject.digCost));
$("#objectMapActionsValue<?php echo DungeonConstante::$ACTION_KILL_OBJECT;?>").html("0");
if(this.isAutoSelect()) {
selectObject(parRealObject.realObjectId);
}
if(this.isAutoCenter()) {
centerToZoneId(parRealObject.zoneId);
}
} else {
$("#realObjectListInnerContentDescription").append("<div> no object selected</div>");
unselectCurrentObject();
}
}
//TODO : why extends for dungeon object is not ok ?
//TODO : why is it not ok ?
/*
globalObjectList.createBlockWithArray=function(parArrayInfo) {
return new DungeonBlockWithArray(parArrayOfInfo);
};*/
initUpdatePlayerObjectList();
initUpdateImage(<?php echo Constante::$DEFAULT_REFRESH_PAGE?>, <?php echo Constante::$DEFAULT_UPDATE_FUNCTION_CALL?>);
initUpdateRockImage(<?php echo Constante::$DEFAULT_REFRESH_PAGE?>*2, <?php echo Constante::$DEFAULT_UPDATE_FUNCTION_CALL?>*2);
gloMap.appendChild(gloMapPathSelectionned);
calculateMapGlobals();
setCurrentPos();
disableRockUpdate();
//TODO : put this in a method or other ... set php constants in globals ... put this in script not in modules
//Add world limit
locMapForWorldLimit = window.document.createElement('div');
gloMap.insertBefore(locMapForWorldLimit, gloMap.firstChild);
locMapForWorldLimit.id="worldlimit";
locMapForWorldLimit.name="worldlimit";
//-1 is for shift a little
locMapForWorldLimit.style.left=
(
(
<?php echo Constante::getWorldCenterX()?>-gloBlockCenterX
-((<?php echo Constante::getWorldLeftWidth()?>-(gloBlockHalfWidth-1)))*gloBlockZoneCount
)*gloZoneImageSizeInPixel-1
)+"px";
locMapForWorldLimit.style.top=
(
(
gloBlockCenterY-<?php echo Constante::getWorldCenterY()?>
-((<?php echo Constante::getWorldTopHeight()?>-(gloBlockHalfHeight-1)))*gloBlockZoneCount
)*gloZoneImageSizeInPixel-1
)+"px";
//alert("<?php echo Constante::$ZONE_IMAGE_SIZE?> : "+gloZoneImageSizeInPixel);
//+2 is for shift a little
locMapForWorldLimit.style.width=((<?php echo ((Constante::getWorldWidthInZone()+1))?>*gloZoneImageSizeInPixel)+2)+"px";
locMapForWorldLimit.style.height=((<?php echo ((Constante::getWorldHeightInZone()+1))?>*gloZoneImageSizeInPixel)+2)+"px";
<?php
foreach($locPlayer->getBarracksZoneId() as $locZoneIdBarrack) {
list($x, $y, $z) = Zone::getZoneCoord($locZoneIdBarrack);
echo "appendPositionToPositionList($x, $y, $z);";
}
?>
//add begin postition
//appendCurrentPosition();
//Update now
updateInformationNow();
//We do a selection on movement !
gloCurrentAction = <?php echo Constante::$ACTION_MOVE_OBJECT;?>;
gloTypeOfInfoSended = C_SEND_TARGET_ZONE_AND_SELECTED;
initSurfaceunderground();
changeCurrentSelectable(wdgId("objectMapActionsDiv"+gloCurrentAction));
registerFunctionForWheel(gloMap, wheelMouseAction);
}
);
</script>
</html>
<?php
disconnect();
?>