<?php $timeStart = microtime(true); session_start(); if (empty($_SESSION)) { exit(header("Location: ../../index.php")); } require_once $_SESSION['File_Root'] . '/Kernel/Include.php'; require_once $_SESSION['File_Root'] . '/HTML/Header.php'; redirectToLogin($accountID, $linkRoot); redirectToBattle($verifyBattle, $linkRoot); hasAdmin($accountAccess); $townID = htmlspecialchars(addslashes($_POST['townID'])); $town = newTown($bdd, $townID); $townPicture = $town->getPicture(); $townName = $town->getName(); $townDescription = $town->getDescription(); $townPriceInn = $town->getPriceInn(); $townChapter = $town->getChapter(); ?> <br> <div class="panel panel-warning"> <div class="panel-heading"></div> <div class="panel-body"> <form method="POST" action="End_Edit.php"> <?php echo $atown7; ?> <br> <input class="form-control" type="text" name="townPicture" value="<?php echo $townPicture;
<?php if (isset($_SESSION['Account_ID'])) { $account = newAccount($bdd, $_SESSION['Account_ID']); $character = newCharacter($bdd, $_SESSION['Account_ID']); $town = newTown($bdd, $character->getTownID()); $verifyBattle = verifyBattle($bdd, $character->getID()); if ($verifyBattle >= 1) { $monster = newBattleMonster($bdd, $character->getID()); $monsterID = $monster->getID(); $monsterPicture = $monster->getPicture(); $monsterName = $monster->getName(); $monsterDescription = $monster->getDescription(); $monsterLevel = $monster->getLevel(); $monsterHP = $monster->getHp(); $monsterMP = $monster->getMp(); $monsterStrength = $monster->getStrength(); $monsterMagic = $monster->getMagic(); $monsterAgility = $monster->getAgility(); $monsterDefense = $monster->getDefense(); $monsterExperience = $monster->getExperience(); $monsterGold = $monster->getGold(); $minStrength = $character->getStrength() / 1.1; $maxStrength = $character->getStrength() * 1.1; $minMagic = $character->getMagic() / 1.1; $maxMagic = $character->getMagic() * 1.1; $minDefense = $character->getDefense() / 1.1; $maxDefense = $character->getDefense() * 1.1; $monsterMinStrength = $monster->getStrength() / 1.1; $monsterMaxStrength = $monster->getStrength() * 1.1; $monsterMinDefense = $monster->getDefense() / 1.1;
echo 'Record units at slot' . $mapSlotNum; $mapSlot = new blockSlot($mapSlotNum, $mapSlotFile, 404); /// start, file, size // Create a unit slot for the player $unitSlot = startASlot($gameSlot, $gamePath . "/gameSlots.slt"); echo 'Unit slot is ' . $unitSlot . '<br>'; $unitList = new itemSlot($unitSlot, $gameSlot, 40); // Create a new town $townID = 0; $armyID = 0; $townSlot = 0; if ($startTown) { $townID = $unitIndex; $unitIndex += 4; $townDtls = [$startLocation[1], $startLocation[2], $pGameID, $postVals[1]]; $townData = newTown($townID, $unitFile, $gameSlot, $townDtls); // Record first city location in a new settlments slot $townSlot = startASlot($gameSlot, $gamePath . "/gameSlots.slt"); $mLoc = sizeof($mapSlot->slotData); for ($i = 1; $i <= sizeof($mapSlot->slotData); $i += 2) { if ($mapSlot->slotData[$i] == 0) { $mLoc = $i; break; } } $mapSlot->addItem($mapSlotFile, pack('i*', $townID, 1), $mLoc); // file, bin value, loc } else { // Create a new army unit for the items to be grouped into $armyID = $unitIndex; $unitIndex += 4;
echo $characterExperience; ?> </div> <div class="important"><?php echo $character12; ?> : <?php echo $characterSkillPoint; ?> </div> <div class="important"><?php echo $character13; ?> : <?php echo $nextLevel; ?> </div> <div class="important"><?php echo $character14; ?> : <?php echo newTown($bdd, $townID)->getName(); ?> </div> </div> </div> </div> </div> <?php require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
$slotFile = fopen($gamePath . '/gameSlots.slt', 'r+b'); $unitFile = fopen($gamePath . '/unitDat.dat', 'r+b'); fseek($unitFile, $_SESSION['selectedItem'] * $defaultBlockSize); $unitDat = unpack('i*', fread($unitFile, 400)); $newCityId = 0; // Create a new parent city ID and set parameters if (flock($unitFile, LOCK_EX)) { fseek($unitFile, 0, SEEK_END); $size = ftell($unitFile); $newCityId = $size / $defaultBlockSize; fseek($unitFile, $newCityId * $defaultBlockSize - 4); fwrite($unitFile, pack('i', 0)); echo 'New city aID is ' . $newCityId . '<br>'; $townInf = [$unitDat[1], $unitDat[2], $pGameID, $_SESSION['game_' . $gameID]['culture'], $unitDat[25]]; // X loc, Y Loc, pgameId, Culture, Population newTown($newCityId, $unitFile, $slotFile, $townInf); //($id, $townFile, $slotFile) flock($unitFile, LOCK_UN); // release the lock on the player File } // Add the parent city ID to the current city fseek($unitFile, $_SESSION['selectedItem'] * $defaultBlockSize + 112); fwrite($unitFile, pack('i', $newCityId)); // Remove the unit cart / other items from the map and change the mapslot to display the new city $mapSlotFile = fopen($gamePath . '/mapSlotFile.slt', 'r+b'); $mapSlotNum = floor($unitDat[2] / 120) * 120 + floor($unitDat[1] / 120); echo 'Mapo slot number is ' . $mapSlotNum . '<br>'; $mapSlot = new itemSlot($mapSlotNum, $mapSlotFile, 404); print_r($mapSlot->slotData); $currentPos = array_search($_SESSION['selectedItem'], $mapSlot->slotData); echo 'Current Pos: ' . $currentPos . '<br>';