diff --git a/GameEngine/Admin/welcome.tpl b/GameEngine/Admin/welcome.tpl index 7ee23c6a..a3ce3e6c 100755 --- a/GameEngine/Admin/welcome.tpl +++ b/GameEngine/Admin/welcome.tpl @@ -16,16 +16,15 @@ The taskmaster will help you on your way to establishing your empire with advice Game World Timeline -This game world is expected to run until approximately %WORLD_END_DATE% -. -The estimated end date is calculated dynamically from the World Wonder Construction Plan release, the time required to construct the World Wonder from level 0 to level 100 at the current server speed, and an additional 5 days to allow for final attacks and possible World Wonder setbacks. +This game world is expected to run until approximately %WORLD_END_DATE%. The estimated end date is calculated dynamically, following the timeline below, plus an additional 5 days to allow for final attacks and possible World Wonder setbacks. Natars diff --git a/GameEngine/Database/DatabaseBuildingQueries.php b/GameEngine/Database/DatabaseBuildingQueries.php index 2c6528ed..4f12c7b1 100644 --- a/GameEngine/Database/DatabaseBuildingQueries.php +++ b/GameEngine/Database/DatabaseBuildingQueries.php @@ -217,7 +217,7 @@ trait DatabaseBuildingQueries { if($job['id'] == $d) $jobToDelete = $job; } - if($canBeRemoved && $jobToDelete['field'] > 18 && $jobToDelete['field'] != 99 && $jobToDelete['level'] - 1 == 0){ + if($canBeRemoved && !empty($jobToDelete) && $jobToDelete['field'] > 18 && $jobToDelete['field'] != 99 && $jobToDelete['level'] - 1 == 0){ $this->setVillageLevel($wid, ["f".$jobToDelete['field']."t"], [0]); } diff --git a/GameEngine/Database/DatabaseVillageQueries.php b/GameEngine/Database/DatabaseVillageQueries.php index f48044bd..78967bff 100644 --- a/GameEngine/Database/DatabaseVillageQueries.php +++ b/GameEngine/Database/DatabaseVillageQueries.php @@ -1563,7 +1563,7 @@ trait DatabaseVillageQueries { $y1 = intval($coor['y']); $prevdist = 0; $array2 = $this->getVillage(0, 4); - $vill = $array2['wref']; + $vill = $array2['wref'] ?? 0; if ($array && count($array)){ foreach($array as $village){ diff --git a/GameEngine/Generator.php b/GameEngine/Generator.php index 3b0c6d52..2c585bae 100755 --- a/GameEngine/Generator.php +++ b/GameEngine/Generator.php @@ -289,7 +289,7 @@ class MyGenerator */ public function getMapCheck($wref) { - return substr(md5($wref), 5, 2); + return substr(md5((string) $wref), 5, 2); } /** diff --git a/GameEngine/Message.php b/GameEngine/Message.php index 5899f770..ff143cde 100755 --- a/GameEngine/Message.php +++ b/GameEngine/Message.php @@ -740,6 +740,14 @@ class Message public function sendWelcome($uid, $username){ global $database; + /* + * FIX: $bid40 / $bid15 sunt deja incarcate global de Session.php + * (include_once("Data/buidata.php")), care ruleaza pe orice pagina. + * Fara "global" aici, require_once() de mai jos e no-op (fisierul + * e deja inclus o data in script), iar $bid40/$bid15 raman nesetate + * local -> blocul de calcul WW e sarit -> wwBuildSeconds = 0. + */ + global $bid40, $bid15; $welcomemsg = file_get_contents("GameEngine/Admin/welcome.tpl"); diff --git a/GameEngine/Units.php b/GameEngine/Units.php index 798e94df..80ea21dd 100755 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -138,6 +138,12 @@ class Units { if(!empty($post['dname']) && $post['x'] != "" && $post['y'] != "") return "Insert name or coordinates"; + // Neither a village name nor coordinates were provided at all -> $id would + // otherwise stay undefined and reach array_push() below unset. + if(empty($post['dname']) && (!isset($post['x']) || !isset($post['y']) || $post['x'] === "" || $post['y'] === "")) { + return "Insert name or coordinates"; + } + if(isset($post['dname']) && !empty($post['dname'])) { $id = $database->resolveVillageInput(stripslashes($post['dname']), (int) ($session->uid ?? 0)); // accepta si "Nume (x|y)" diff --git a/Templates/Build/10.tpl b/Templates/Build/10.tpl index f1d4494d..1de8d989 100644 --- a/Templates/Build/10.tpl +++ b/Templates/Build/10.tpl @@ -25,7 +25,8 @@ $field = 'f' . $id; $currentLevel = (int) ($village->resarray[$field] ?? 0); $buildingType = $village->resarray[$field . 't'] ?? 0; -$currentCapacity = $bid10[$currentLevel]['attri'] * STORAGE_MULTIPLIER; +// $bid10 is keyed from level 1 upward; at level 0 (not built yet) fall back to the base capacity +$currentCapacity = ($currentLevel > 0) ? $bid10[$currentLevel]['attri'] * STORAGE_MULTIPLIER : STORAGE_BASE; $isMax = $building->isMax($buildingType, $id); $maxLevel = 20; diff --git a/Templates/Build/11.tpl b/Templates/Build/11.tpl index ba65f69d..a10d61ea 100644 --- a/Templates/Build/11.tpl +++ b/Templates/Build/11.tpl @@ -25,7 +25,8 @@ $field = 'f' . $id; $currentLevel = (int) ($village->resarray[$field] ?? 0); $buildingType = $village->resarray[$field . 't'] ?? 0; -$currentCapacity = $bid11[$currentLevel]['attri'] * STORAGE_MULTIPLIER; +// $bid11 is keyed from level 1 upward; at level 0 (not built yet) fall back to the base capacity +$currentCapacity = ($currentLevel > 0) ? $bid11[$currentLevel]['attri'] * STORAGE_MULTIPLIER : STORAGE_BASE; $isMax = $building->isMax($buildingType, $id); $maxLevel = 20; diff --git a/festival.php b/festival.php index 90936261..254e8725 100644 --- a/festival.php +++ b/festival.php @@ -41,7 +41,7 @@ if($village->capital == 1 && $village->resarray['f'.$_GET['id'].'t'] == 35 && $s $clay = $festival['clay']; $iron = $festival['iron']; $crop = $festival['crop']; - $database->modifyResource($village->resarray['vref'],$wood,$clay,$iron,$crop,$mode); + $database->modifyResource($village->resarray['vref'],$wood,$clay,$iron,$crop,0); $database->addFestival($village->resarray['vref'],$endtime); } } diff --git a/support.php b/support.php index c87254f1..09a0e0e6 100644 --- a/support.php +++ b/support.php @@ -27,7 +27,7 @@ use App\Utils\AccessLogger; include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$amount = $_SESSION['amount']; +$amount = $_SESSION['amount'] ?? 0; if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']); diff --git a/version.php b/version.php index 1682deac..bbadaf15 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ use App\Utils\AccessLogger; include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$amount = $_SESSION['amount']; +$amount = $_SESSION['amount'] ?? 0; if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']);