Location: PHPKode > projects > PhpBlock > A9.8/modules/default/showfirst.php
<?php
include_once "../site.class.php";
include_once $PATH_TO_CODE."/script/connect.php";
include_once $PATH_TO_CODE."/script/fonction.php";

include_once $PATH_TO_CODE."/modules/default/objectmanager.class.php";

$locCountOfPlayerInfo=2;

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";

initSession($locPlayerId, $locCurrentCenterX, $locCurrentCenterY, $locCurrentCenterZ);

global $gloObjectManager;
$locPlayer = $gloObjectManager->getPlayer($locPlayerId);


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:processKeyUp(event);"
    onKeyPress="javascript:processKeyPress(event);"
    onMouseDown="javascript:processDownMouseButton(event);"
    onMouseUp="javascript:processUpMouseButton(event);">

<head>
    <TITLE>Dungeon</TITLE>
    <link rel="stylesheet" href="../css/phpblock.css" type="text/css" />
    <?php echoBaseHead()?>
    <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/imageupdate.js"></script>
    <script type="text/javascript" src="script/javascript/map.js"></script>
    <script type="text/javascript" src="script/javascript/message.js"></script>
</head>
<?php
    //TODO ondrag="return false;" for more ergonomy ?
    //TODO move clickOnDocument on the table of image !!! because it catched button click
    // onclick="return clickOnDocument(event);"
?>
<body ondrag="return false;" onload="javascript:bodyLoaded()">
<?php

$locArrayOfDataType = array();
//Faire des divs !!!
?>
<div id="header">
<?php
$locPlayerInfoWidth = 98/$locCountOfPlayerInfo;
for($i = 1; $i <= $locCountOfPlayerInfo; $i++) {
?>
    <textarea id="playerInfoT<?php echo $i?>" wrap="off" multiple rows="3" style="width:<?php echo $locPlayerInfoWidth?>%"></textarea>
<?php
}
?>
</div>
    <div id="rememberposition">
        <p align="center">
        <select id="positionList" size="5" multiple="multiple"
        onclick="javascript:centerToZoneWithSelect(event, $('positionList'))">
            <option value="<?php echo $locCurrentCenterX.Constante::$SEP_URL_1.$locCurrentCenterY.Constante::$SEP_URL_1.$locCurrentCenterZ?>" selected="selected"><?php echo "$locCurrentCenterX;$locCurrentCenterY;".($locCurrentCenterZ-Site::$ZONE_COORD_Z_GROUND_LEVEL)?></option>
        </select><br>
        <input type="button" value="Remove" onclick="javascript:removeOptionSelected($('positionList'));" /><br>
        <input type="button" value="Add" onclick="javascript:appendOptionFirst($('positionList'));" /><br>
        <input type="button" value="go" onclick="javascript:centerToZoneWithSelect(event, $('positionList'))" />
        </p>
    </div>
    <div id="main">
        <div id="mapactions">
<?php
$locListActionTab = array(
    "image/actiontab/move.png", Constante::$ACTION_MOVE_OBJECT,
        "move selected object"
    );

$locImagePerLineCount=4;
for($i=0; $i < count($locListActionTab); $i+=3) {
    echo "<img width=\"".Constante::$ZONE_IMAGE_SIZE."\" height=\"".Constante::$ZONE_IMAGE_SIZE."\" src=\"".$locListActionTab[$i]."\"";
    echo " onclick=\"javascript:clickOnAction(this, event, ".$locListActionTab[$i+1].")\"";
    echo " title=\"".$locListActionTab[$i+2]."\"";
    echo " />\n";
    if($i%$locImagePerLineCount==$locImagePerLineCount-1) {
         echo "<br class=\"clear\" />\n";
    }
}
?><br><br>
        <textarea id="objectInfo" cols="20" rows="10"/></textarea><br>
    </div>
</div>
<div id="footer">

<?php
    $locPlayer = $gloObjectManager->getPlayer($locPlayerId);
    $locZoom = 1.0;
?>
player name=<?php echo $locPlayer->playerName;?>
        <input type="number" size="3" id="alpha" value="<?php echo Constante::$ALPHA_OBJECT_ALLIANCE_OWNER?>" onchange="changeAlpha()"/>(0-127)
        zoom<input type="number" size="3" id="zoom" value="<?php echo $locZoom?>" onchange="changeZoom()"/>
        <input type="submit" id="updatemode" value="" onclick="changeRockUpdateSatus()"/>
        <a href="script/tick/ticker.php">tickers page</a>
        <input type="submit" value="update" onclick="updateImageNow()"/><br>
        <input type="submit" value="center" onclick="centerToZone(480, 495, 7)"/><br>
        <input type="text" id="currentpos" size="20" id="currentpos" value=""/><br>
        <input type="submit" value="display object 0"  onclick="showObjects(0, true)"/>
        <input type="submit" value="hide object 0" onclick="showObjects(0, false)"/>
        <input type="submit" value="display object 1"  onclick="showObjects(1, true)"/>
        <input type="submit" value="hide object 1" onclick="showObjects(1, false)"/>
        <input type="submit" value="display object 2"  onclick="showObjects(2, true)"/>
        <input type="submit" value="hide object 2" onclick="showObjects(2, false)"/>
    <table>
    <tr valign="top">
    <td>
    <form name="debugform" id="debugform">
        <textarea rows="10" cols="80" name="debug1">
        </textarea>
        <textarea rows="10" cols="80" name="debug2">
        </textarea>
        <textarea rows="10" cols="80" name="debug3">
        </textarea>
    </form>
    <td>
    CTRL+mouse move on map: move the map<br>
    ALT: unselect selected object<br>
    'i'+left clic on object: get info on the object
    </tr>
    </table>
</div>
</body>
<?php
//reset all information
$locTimestamp=0;

//Toujours impaire
$locImageWidthCount = 7;
$locImageHeightCount = 5;
?>
<script language="javascript">
    function clickOnBlockImage(parEvent){
        alert("CLICK button number=" + parEvent.button);
        if(parEvent.button==MOUSE_RIGHT_CLICK) {
            unselectCurrentObject();
        }
        if(parEvent.button==MOUSE_LEFT_CLICK) {

            locDivMap = window.document.getElementById('map');
            locDivMapXInPixel = findPosX(locDivMap);
            locDivMapYInPixel = findPosY(locDivMap);
            
            locDivMapCenterXInPixel = locDivMapXInPixel + gloBlockWidthCount*gloImageSizeInPixel/2.0;
            locDivMapCenterYInPixel = locDivMapYInPixel + gloBlockHeightCount*gloImageSizeInPixel/2.0;
            logDebug("locDivMapCenterXInPixel " + locDivMapCenterXInPixel + " locDivMapCenterYInPixel " +locDivMapCenterYInPixel, true);

            locScreenCenterX = gloBlockCenterInitialX;
            locScreenCenterY = gloBlockCenterInitialY;

            locXClickedInPixel = parEvent.clientX;
            locYClickedInPixel = parEvent.clientY;
            logDebug("findPosX(parEvent.target) " + findPosX(parEvent.target) + " findPosY(parEvent.target) " + findPosY(parEvent.target), true);

            logDebug("parEvent.clientX " + parEvent.clientX + " parEvent.clientY " + parEvent.clientY, true);
            logDebug("locXClickedInPixel " + locXClickedInPixel + " locYClickedInPixel " + locYClickedInPixel, true);
            locXOffsetInPixel = locXClickedInPixel - locDivMapCenterXInPixel + gloImageSizeInPixel;
            locYOffsetInPixel = locYClickedInPixel - locDivMapCenterYInPixel + gloImageSizeInPixel;
            locXZoneClicked = locScreenCenterX + (locXOffsetInPixel/gloZoneImageSizeInPixel);
            locYZoneClicked = locScreenCenterY - (locYOffsetInPixel/gloZoneImageSizeInPixel);
            logDebug("locXZoneClicked " + locXZoneClicked + " locYZoneClicked " + locYZoneClicked + gloZoneImageSizeInPixel, true);

            //Adjustement for zone center
            locXZoneClicked -= -0.5;
            locYZoneClicked -= -0.5;
            //Cast in Integer
            locXZoneClicked -= (locXZoneClicked)%1;
            locYZoneClicked -= (locYZoneClicked)%1;

            setInfo("locXZoneClicked " + locXZoneClicked + " locYZoneClicked " + locYZoneClicked + " locZZoneClicked " + gloBlockCenterZ, true);
        }
        return true;
    }

    //Fonction à part

    function resetAllImages() {
        resetImages();
    }

    function bodyLoaded() {
        setGlobals(
            <?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 ($locImageWidthCount).",";
            echo ($locImageHeightCount).",";
            echo "$locTimestamp, $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::$ZONE_COORD_Z_MIN_LEVEL?>,
            <?php echo Constante::$ZONE_COORD_Z_MAX_LEVEL;?>,
            "modules/default/imageupdate.php",
            "modules/default/imageobject.php",
            "modules/default/information.php"
            );

        gloMap = createMap('map');
        gloMapWrapper = createMapWrapper('mapwrapper');

        gloMapWrapper.appendChild(gloMap);
        $("main").appendChild(gloMapWrapper);

        locMapForBlock = window.document.createElement('div');
        locMapForBlock.id="mapforblock";
        locMapForBlock.name="mapforblock";

        gloMap.appendChild(locMapForBlock);


        initDebug("debugform", "debug", 3);
        setZoom(1.0, true);

        initUpdateImage(<?php echo Constante::$DEFAULT_REFRESH_PAGE?>, <?php echo Constante::$DEFAULT_UPDATE_FUNCTION_CALL?>);

        calculateMapGlobals();
        setCurrentPos();
        
        gloMap.zVision = dungeonZVision();
    }
</script>
</html>
Return current item: PhpBlock