Exemple #1
0
';
// Look for nearby settlements that you can drop resources in
$mapSlot = floor($selectedUnit->get('yLoc') / 120) * 120 + floor($selectedUnit->get('xLoc') / 120);
//echo 'Mapslot is '.$mapSlot.' from '.$selectedUnit->get('xLoc').', '.$selectedUnit->get('yLoc');
$mapSlotFile = fopen($gamePath . '/mapSlotFile.slt', 'rb');
$gridList = new itemSlot($mapSlot, $mapSlotFile, 404);
//print_r($gridList->slotData);
for ($i = 1; $i <= sizeof($gridList->slotData); $i += 2) {
    if ($gridList->slotData[$i] > 0) {
        //echo 'Load unit ('.$gridList->slotData[$i].')';
        $checkObj = loadUnit($gridList->slotData[$i], $unitFile, 400);
        // Check to see if unit is a city
        if ($checkObj->get('uType') == 1) {
            // Check to get city permissions
            $credList = array_filter(unpack("i*", readSlotData($slotFile, $checkObj->unitDat[19], 40)));
            $approved = checkCred($pGameID, $credList);
            if ($approved) {
                // display the place as an option to drop the stuff
                echo 'unitList.newUnit({unitType:"town", unitID:' . $gridList->slotData[$i] . ', unitName:"Town ' . $gridList->slotData[$i] . '", actionPoints:"0", strength:75, tNum:"0"});
				var objContain = addDiv("", "selectContain", rtPnl);
				unitList.renderSum(' . $gridList->slotData[$i] . ', objContain);
				selectButton(objContain, "hai", ' . $gridList->slotData[$i] . ', [selectHead]);';
            }
        }
    }
}
fclose($mapSlotFile);
// Load what the unit/army is carrying and display slider bars for deposit amounts
echo 'groupList = [];';
$carryDat = new blockSlot($selectedUnit->get('carrySlot'), $slotFile, 40);
for ($i = 1; $i < sizeof($carryDat->slotData); $i += 2) {
Exemple #2
0
<?php

include "./slotFunctions.php";
include "./cityClass.php";
echo 'This is the garrison at the town<br>';
$cityID = $_SESSION['selectedItem'];
// Verify selection is a town
$unitFile = fopen($gamePath . '/unitDat.dat', 'r+b');
fseek($unitFile, $cityID * $defaultBlockSize);
$cityDat = unpack('i*', fread($unitFile, $unitBlockSize));
if ($cityDat[4] == 1) {
    // Verify credentials to view this town
    $slotFile = fopen($gamePath . '/gameSlots.slt', 'r+b');
    //$credList = array_filter(unpack("i*", readSlotData($slotFile, $cityDat[19], 40)));
    //$approved = array_search($pGameID, $credList);
    $credSlot = new itemSlot($cityDat[19], $slotFile, 40);
    $approved = checkCred($pGameID, $credSlot->slotData);
    // show units or show intelligence for town
    if ($approved) {
        $unitList = array_filter(unpack("N*", readSlotData($slotFile, $cityDat[18], 40)));
        echo 'Show the list';
        print_r($unitList);
        foreach ($unitList as $unitID) {
            echo '<div onclick="makeBox(\'cityMan\', \'1028,' . $unitID . '\', 500, 500, 200, 50);">Unit ' . $unitID . '</div>';
        }
    } else {
        echo 'You are not authorized to view this information';
    }
} else {
    echo 'This is an invalid selection';
}