/land.php
PHP | 1175 lines | 1037 code | 79 blank | 59 comment | 112 complexity | f149849be93ad7cbc41ce1f312a62a1d MD5 | raw file
Possible License(s): AGPL-3.0, LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?php
- /* land.php - Front-end code for land view
- *
- * Copyright (C) 2006-2010 Kevin Read, Simone Schaefer
- * Copyright (C) 2010 Markus Bender
- *
- * This file is part of Selador, a browser-based fantasy strategy game
- *
- * This program is distributed under the terms of the GNU Affero General Public License.
- *
- *
- * Selador is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * Selador is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Selador. If not, see <http://www.gnu.org/licenses/>.
- **/
- // Works but could be much nicer. The land view itself is cached.
- ob_start("ob_gzhandler");
- $need_position = true;
- require_once("php/base.php");
- require_once("php/event.php");
- require_once("php/base/config.inc.php");
- $_settlecircle_fields = array (74,72,63,62,53,82,83,93);
- function highlight_settlecircle ($xy, $can_settle)
- {
- global $_settlecircle_fields;
- if (in_array ($xy, $_settlecircle_fields) && $can_settle)
- return true;
- else
- return false;
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">
- <html><head><title>Selador - <?php echo WORLDTITLE; ?></title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link type="text/css" href="styles/map.css" rel="stylesheet">
- <link type="text/css" href="styles/<?php echo $_SESSION['theme']; ?>.css" rel="stylesheet">
- <?php
- if ($_SESSION['tt'])
- echo '<script type="text/javascript" src="ol/overlibmws.js"></script><script type="text/javascript" src="ol/overlibmws_bubble.js"></script>';
- ?>
- <script type="text/javascript">
- <?php
- echo "map_x = ".$x.";\n";
- echo "map_y = ".$y.";\n";
- echo "mapsy = ".$world->sizey.";\n";
- echo "no_reload = false;\n";
- $loctime = localtime();
- // We need the hour
- $this_hour = $loctime[2];
- if (($this_hour > 19) || ($this_hour < 8))
- echo "daytime = 2;\n";
- else
- echo "daytime = 1;\n";
- /* $eh = new EventHandler ($me, $gui, $user_row, $gamedb);
- $eh->run(); */
- /*echo "vx = ".(($x + $y) * 64).";";
- echo "vy = ".(($world->sizey + -$x + $y) * 32).";"; */
- ?>
- </script>
- <script src="scripts/de.js" type="text/javascript"></script>
- </head>
- <body class="inhalt" onload="start();">
- <?php
- // Enhancing a ressource field
- if (isset ($_REQUEST['r']) && isset($_REQUEST['l']))
- {
- if (isset ($gui->building_queue))
- $buildings = count($gui->building_queue);
- else
- $buildings = 0;
- // We need to check here if the build queue isn't filled up already
- if ($buildings < 2)
- {
- // Now check if this request was already placed (i.e. this page was reloaded)
- $tolevel = $_REQUEST['l'];
- // To utilize the build queue, we would also need to know if this ressource tile is already being enhanced.
- $query = "select A.level, A.villageid, B.type, C.expansion from tileres A, map B, village C where A.x=".$x." and A.y=".$y." and B.x=".$x." and B.y=".$y." and A.uid=".$me->uid." and C.villageid=A.villageid";
- $res = mysql_query ($query);
- if ($row = mysql_fetch_array ($res))
- {
- $type = (int)($row['type']/100);
- // Don't enhance this if it is an empty field and we don't have expansion slots
- if (($row['level'] > 0) || ($row['expansion'] > 0) || $gui->on_construction)
- {
- // This is the old check
- if (!check_event_village2 ($me->uid, $me->activevillageid, $type+1000, $tolevel, $z))
- {
- // and this is the new style one
- if ($_REQUEST['c'] == $me->reload_counter)
- {
- $tolevel = $row['level']+1;
- if (isset ($gui->on_construction))
- $tolevel += $gui->on_construction;
- $go_on = false;
- // Outposts build sloowly :)
- if ($row['villageid'] == $me->activeoutpostid)
- {
- $buildspeed = BUILD_TIME_BASE;
- $outpostid = $row['villageid'];
- $go_on = true;
- }
- if (($row['villageid'] == $me->activevillageid) && !$me->activeoutpostid)
- {
- $buildspeed = $me->activevillage->speed_build;
- $outpostid = 0;
- $go_on = true;
- }
- if ($go_on)
- {
- if ($me->activevillage->building_enoughcash ($type+1000, $tolevel))
- {
- // We should also pass this on to the tutorial, if it is still going strong
- if (is_object ($tutorial))
- {
- if ($tutorial->active)
- $tutorial->land_upgraded ($z, $type, $tolevel);
- }
- $costs = building_costs ($type+1000, $tolevel);
- $newbuiltdur = (int)(($costs[1] + $costs[2] + $costs[3]) * $buildspeed / WORLD_SPEED / BUILD_SPEED);
- $newbuiltdur = max (1, $newbuiltdur) + (int)$gui->building_duration;
- $me->activevillage->spend ($costs[1], $costs[2], $costs[3]);
- //FIXME: Ist das FIXME noch relevant?
- // Insert into event queue FIXME: Type depends on tile type, timestamp depends on finish time of last building in queue
- $query = "insert into event (uid1, village1, uid2, village2, type, param, param2, timestamp, score) values (".$me->uid.", ".$me->activevillageid.", 0, ".$z.", ".(1000+$type).", ".$tolevel.", ".$outpostid.", addtime(now(), sec_to_time(".$newbuiltdur.")), ".($costs[1] + $costs[2] + $costs[3]).")";
- if (!mysql_query ($query))
- {
- log_err ("Beim Einfügen von Rohstoffeld-Event: ".$query.", ".mysql_error());
- }
- else
- {
- log_info ($eventmap[1000+$type]." (".(1000+$type).") angefangen, wird ".$newbuiltdur." Sekunden dauern. Query: ".$query);
- if (count ($gui->building_queue) == 0)
- {
- $gui->displayedtimers++;
- $gui->building_queue[$newbuiltdur] = $eventmap[1000+$type]." ".$tolevel." <span title=\"Fertig am ".date ("d.m. H:i:s", time () + $newbuiltdur)."\" id=\"timer".$gui->displayedtimers."\">";
- $gui->building_queue[$newbuiltdur] .= external_calcdur ($newbuiltdur)."</span>";
- }
- else
- $gui->building_queue[$newbuiltdur] = $eventmap[1000+$type]." ".$tolevel." <span title=\"Fertig am ".date ("d.m. H:i:s", time () + $newbuiltdur)."\">".external_calcdur ($newbuiltdur - (int)$gui->building_duration)."</span>";
- // $me->activevillage->building_build ($type+1000, $tolevel);
- // Increment the reload counter, like with every construction command
- $me->reload_counter++;
- if (($row['level'] == 0) && !$gui->on_construction)
- {
- log_debug ("Reducing expansion slots from ".$row['expansion']." to ".($row['expansion']-1));
- $query = "update village set expansion=".($row['expansion']-1)." where villageid=".$row['villageid'];
- if (!mysql_query ($query))
- {
- log_err ("Cannot reduce expansion slots when building. Query: ".$query.", ".mysql_error ());
- }
- $me->activevillage->expansion_slots = ($row['expansion']-1);
- }
- // We are definitely on a construction site now :)
- $gui->on_construction++;
- }
- }
- else
- $gui->err_string .= "Nicht genügend Rohstoffe! ";
- }
- else
- $gui->err_string .= "Dieses Feld gehört nicht zur aktiven Stadt. ";
- }
- }
- }
- else
- $gui->err_string = "Erst Bergfried ausbauen...";
- }
- else
- $gui->err_string = "Dort ist keine Stadt...";
- }
- else
- $gui->err_string .= "Bauliste voll!";
- }
- // This check is for settling new outposts
- if (isset ($_REQUEST['c']))
- {
- // and this is the new style one
- if ($_REQUEST['c'] == $me->reload_counter)
- {
- if (isset ($_REQUEST['s']))
- {
- if(!isset($_REQUEST['b']))
- {
- Formular::setConfirmationPopUp (
- 'Willst du hier wirklich einen Außenposten gründen?',
- '--> Ja, mein Reich soll größer werden!!!','land.php?s='.$_REQUEST['s'].'&z='.$_REQUEST['z'].'&c='.$_REQUEST['c'].'&b=1',
- '--> Nein, ich habe mich verklickt','land.php?z='.$_REQUEST['z']);
- }
- else
- {
- $query = "select out_expansion from village where villageid=".$me->activevillageid;
- if (!($res = mysql_query ($query)))
- log_err ("Cannot read outpost expansion slots while settling. Query: ".$query.", ".mysql_error());
- else
- {
- if (!($row = mysql_fetch_row ($res)))
- log_err ("No rows read while reading expansion slots for setting. Query: ".$query.", ".mysql_error());
- else
- {
- if ($row[0] > 0)
- {
- if ($world->CheckOutpostRess ($x, $y))
- {
- $numvillages = count ($me->allvillageids);
- $costs = pow ($numvillages, OP_EXP)*OP_FAC;
- if ($me->activevillage->can_spend ($costs, $costs, $costs, $costs/OP_GOLD_DIV))
- {
- //echo "costs: ok";
- $me->reload_counter ++;
- // FIXME: Start transaction here?
- $query = "insert into village (uid, name, x, y, resmax, ress1, ress2, ress3, ress4, stamp, buildspeed, expansion, outpost_of) values (".$me->uid.", \"".$me->user."s Außenposten\", ".$x.", ".$y.", ".BASE_STORAGE.", 0, 0, 0, 0, now(), 1.0, 0, ".$me->activevillageid.")";
- if (!($res = mysql_query ($query)))
- {
- $err = true;
- log_err ("Village insert query while settling failed: ".$query.": ".mysql_error());
- }
- else
- {
- require_once ("php/auxiliary.php");
- $villageid = mysql_insert_id ();
- $query = "delete from startvillage where x between ".($x-5)." and ".($x+5)." and y between ".($y-5)." and ".($y+5);
- // echo $query."<br>";
- if (!mysql_query ($query))
- {
- $err = true;
- log_err ("startvillage delete query failed: ".$query.": ".mysql_error());
- }
- else
- {
- AllocResTiles ($me->uid, $villageid, $x, $y);
- $query = "insert into armies (villageid,uid,flag,location) values (".$villageid.", ".$me->uid.", 0, ".$villageid.")";
- if (!mysql_query ($query))
- log_err ("Couldn't insert starting army for new user. Query: ".$query.", ".mysql_error ());
- else
- {
- $troopid = mysql_insert_id ();
- $query = "insert into troops select ".$troopid.",unitid,0 from units where raceid=".$me->race;
- if (!mysql_query ($query))
- log_err ("Couldn't insert starting troops for new outpost. Query: ".$query.", ".mysql_error ());
- $query = "insert into troops values (".$troopid.", 1000, 0)";
- if (!mysql_query ($query))
- log_err ("Couldn't insert starting hero troop for new outpost. Query: ".$query.", ".mysql_error ());
- }
- $query = "update tileres set level=1,time_exhaust=\"2038-01-01 00:00:00\" where (x=".($x-1)." and y=".$y.") or (x=".($x+1)." and y=".$y.") or (x=".$x." and y=".($y-1).") or (x=".$x." and y=".($y+1).")";
- if (!mysql_query ($query))
- {
- log_err ("Cannot update settled village ress tiles. Query: ".$query.", ".mysql_error());
- $err = true;
- }
- else
- {
- //update field to farm land as villages on mountains look funny
- $query = "select type from map where x=".$x." and y=".$y;
- if ($res = mysql_query($query))
- {
- if ($typerow = mysql_fetch_array($res))
- {
- $type = $typerow['type'];
- if ($type > 100)
- {
- if ($type >= 200 && $type < 300)
- $type = 102;
- if ($type >= 300 && $type < 400)
- $type = 103;
- if ($type >= 400 && $type < 500)
- $type = 104;
- }
- $query = "update map set type=".$type." where x=".$x." and y=".$y;
- if (!mysql_query($query))
- log_err("Could not update map when settling new outpost: ".$query);
- }
- }
- else
- {
- log_err("could not read ressource field type: ".$query);
- }
- $me->CalculateVillageProd($villageid);
- $world->ClearMapCache ($x, $y);
- $world->ClearLandCache ($x, $y);
- log_debug ("Reducing outpost expansion slots from ".$row[0]." to ".max(0, $row[0]-1));
- $query = "update village set out_expansion=".max (0, $row[0]-1)." where villageid=".$me->activevillageid;
- if (!mysql_query ($query))
- {
- log_err ("Cannot reduce outpost expansion slots when building. Query: ".$query.", ".mysql_error ());
- }
- $me->activevillage->outpost_expansion = ($row['expansion']-1);
- $me->activevillage->spend ($costs, $costs, $costs, $costs/OP_GOLD_DIV);
- $me->update_score ($costs*4);
- $me->save_score ();
- $query = "insert into eventlog (eid, uid1, village1, uid2, village2, fired, happened, type, state) select max(eid)+1, ".$me->uid.", ".$me->activevillageid.", ".$me->uid.", ".$villageid.", now(), now(), 101, 1 from eventlog";
- if (!mysql_query ($query))
- log_err ("Cannot add evenlog entry for new village. Query: ".$query.", ".mysql_error());
- $query = "select * from village where villageid=".$villageid;
- if (!($res = mysql_query ($query)))
- log_err ("Cannot read new village info after settling. Query: ".$query.", ".mysql_error());
- else
- {
- if (!($row = mysql_fetch_array ($res)))
- log_err ("No rows while reading new village info after settling. Query: ".$query.", ".mysql_error());
- else
- {
- $me->activevillage->outposts[$villageid] = new Village ($row, $me);
- $me->allvillageids[] = $villageid;
- $me->activevillage->ress_prod[1] += (int)($me->activevillage->outposts[$villageid]->ress_prod[1]/2);
- $me->activevillage->ress_prod[2] += (int)($me->activevillage->outposts[$villageid]->ress_prod[2]/2);
- $me->activevillage->ress_prod[3] += (int)($me->activevillage->outposts[$villageid]->ress_prod[3]/2);
- $me->activevillage->ress_prod[4] += (int)($me->activevillage->outposts[$villageid]->ress_prod[4]/2);
- $me->activevillage->ress_prod[5] += (int)($me->activevillage->outposts[$villageid]->ress_prod[5]/2);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- require_once ("styles/php/base_design-".$_SESSION['theme'].".php");
- //print_r($me->villages);
- echo '<div id="mapbox">';
- require_once('blocked.php');
- $theme = 2;
- $precalcpath = TILES_PATH.$z.".php";
- // Was an outpost->village upgrade requested?
- if (isset ($_REQUEST['u']))
- {
- // The outpost to be upgraded has to be the active outpost
- if ($me->activeoutpostid)
- {
- if (!isset($_REQUEST['v']))
- {
- Formular::setConfirmationPopUp('<img src="styles/'.$_SESSION['theme'].'/house.png">
- <span style="font-weight:bold">Willst du diesen Außenposten wirklich zur Stadt machen?</span>',
- '<img src="styles/'.$_SESSION['theme'].'/accept.png"> Ja, er ist doch schon so groß geworden', 'land.php?u='.$_REQUEST['u'].'&z='.$_REQUEST['z'].'&v=1',
- '<img src="styles/'.$_SESSION['theme'].'/cross.png">Nein, ich habe mich verklickt','land.php');
- }
- else
- {
- if (($me->activevillage->ress_prod[5] - $me->activeoutpost->ress_prod[5]) < $me->activevillage->sum_population ($gui))
- {
- $delerr ="<span id=\"bug\">".$me->activevillage->name." hat nicht genug Nahrung, um diesen AP (aktuelle Produktion: ".$me->activeoutpost->ress_prod[5].") zur Stadt zu machen</span><a href=\"hilfe.php?Page=544\" target=\"_blank\"> [?]</a><br>";;
- }
- else
- {
- //FIXME leider aktualisiert das jetzt die auswahlliste oben nicht mehr so schön :(
- // First we have to check if there are any active events pending for this outpost
- $query = "select * from event where type in (".ATTACK.", ".RAID.", ".SIEGE.") and (village1=".$me->activeoutpostid." or village2=".$me->activeoutpostid.")";
- if (!($res = mysql_query ($query)))
- {
- $me->log_err ("Cannot fetch list of pending events when deleting outpost. Query: ".$query.", ".mysql_error ());
- $delerr = "Leider ist ein Datenbank-Fehler aufgetreten. Bitte versuche es später nochmal.";
- }
- else
- {
- if (mysql_num_rows ($res))
- {
- $delerr = "Es bewegen sich gerade Truppen auf diesen AP oder von diesem weg. Er kann deswegen gerade nicht umgewandelt werden. Probiere es doch später noch einmal.";
- }
- else
- {
- // Fetch some infos on the outpost
- $query = "select expansion, besieged_by from village where villageid=".$me->activeoutpostid;
- if (!($res = mysql_query ($query)))
- log_err ("Cannot read expansion slots when upgrading outpost. Query: ".$query.", ".mysql_error ());
- else
- {
- if ($row = mysql_fetch_row ($res))
- {
- // Upgrade is only possible when expansion slots are here and the outpost is not under siege
- if (($row[0] > 0) && ($row[1] == 0))
- {
- $query = "update village set resmax=".BASE_STORAGE.",stamp=now(),ress1=0,ress2=0,ress3=0,ress4=0,expansion=0, outpost_of=0 where villageid=".$me->activeoutpostid;
- if (!mysql_query ($query))
- {
- log_err ("Cannot upgrade outpost to village in land.php. Query: ".$query.", ".mysql_error ());
- }
- else
- {
- $me->villages[$me->activeoutpostid] = $me->activeoutpost;
- $me->villages[$me->activeoutpostid]->outpost_of = 0;
- // print_r ($me->villages);
- unset ($me->villages[$me->activevillageid]->outposts[$me->activeoutpostid]);
- // print_r ($me->villages);
- $me->CalculateVillageProd ($me->activevillageid);
- $me->activevillage->update_production();
- $me->CalculateVillageProd ($me->activeoutpostid);
- // Move all events with the old outpost info to the new villageid
- $query = "update event set param2=0,village1=".$me->activeoutpostid." where village1=".$me->activevillageid." and param2=".$me->activeoutpostid;
- if (!mysql_query ($query))
- $me->log_err ("Cannot shift build queue items to new data after OP->village conversion");
- $me->villages[$me->activeoutpostid]->update_production();
- if (!isset ($world))
- global $world;
- $world->ClearMapCache ($me->villages[$me->activeoutpostid]->x, $me->villages[$me->activeoutpostid]->y);
- $world->ClearLandCache ($me->villages[$me->activeoutpostid]->x, $me->villages[$me->activeoutpostid]->y);
- // Now mark all outposts of this village as not-upgradeable and then recalculate upgradability
- foreach ($me->allvillageids as $this_villageid)
- {
- if (!isset ($querymid))
- {
- $querymid = $this_villageid;
- }
- else
- {
- $querymid .= ", ".$this_villageid;
- }
- }
- $query = "update village set expansion=0 where outpost_of in (".$querymid.") and besieged_by=0";
- if (!mysql_query ($query))
- $me->log_err ("Cannot mark all outposts non-upgradeable after upgrade. Query: ".$query.", ".mysql_error ());
- else
- {
- $num_vill = count ($me->villages);
- $me->log_debug ("Re-Checking upgradeability after oupost->city upgrade for all outposts of vid ".$me->activevillageid);
- foreach ($me->villages as $current_village)
- {
- foreach ($me->villages[$current_village->villageid]->outposts as $current_outpost)
- {
- $current_village->recalculate_upgrade($current_outpost->villageid, $num_vill);
- }
- }
- }
- $me->activevillageid = $me->activeoutpostid;
- $me->activeoutpostid = 0;
- $me->activeoutpost = NULL;
- $me->activevillage = $me->villages[$me->activevillageid];
- $me->activevillage->expansion_slots = 0;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- // The user can also give up outposts
- if (isset ($_REQUEST['d']))
- {
- if(!isset($_REQUEST['b']))
- {
- Formular::setConfirmationPopUp (
- '<img src="styles/'.$_SESSION['theme'].'/house.png">
- <span style="color:red;font-weight:bold">Willst du wirklich diesen Außenposten aufgeben?
- <br><br>Du kannst diese Aktion nicht rückgängig machen.</span>',
- '<img src="styles/'.$_SESSION['theme'].'/accept.png">Ja, weg mit ihm!!!', 'land.php?d='.$_REQUEST['d'].'&z='.$_REQUEST['z'].'&b=1',
- '<img src="styles/'.$_SESSION['theme'].'/cross.png">Nein, ich hab mich verklickt','land.php?z='.$_REQUEST['z']);
- }
- else
- {
- //TODO: move this to the top of file, so land view gets updated immediately
- // First we have to check if there are any active events pending for this outpost
- $query = "select * from event where type in (".ATTACK.", ".RAID.", ".SIEGE.", ".RETURNING.") and (village1=".$me->activeoutpostid." or village2=".$me->activeoutpostid.")";
- if (!($res = mysql_query ($query)))
- {
- $me->log_err ("Cannot fetch list of pending events when deleting outpost. Query: ".$query.", ".mysql_error ());
- $delerr = "Leider ist ein Datenbank-Fehler aufgetreten. Bitte versuche es später nochmal.";
- }
- else
- {
- if (mysql_num_rows ($res))
- {
- $delerr = "Es bewegen sich gerade Truppen auf diesen AP oder von diesem weg. Er kann deswegen gerade nicht aufgegeben werden. Bitte probiere es später noch einmal.";
- }
- else
- {
- // Also check if there are any supporting units in the city
- $query = "select sum(B.amount) as total from armies A, troops B where A.location=".$me->activeoutpostid." and A.troopid=B.troopid";
- if (!($res = mysql_query ($query)))
- {
- $me->log_err ("Cannot read amount of supporting troops when deleting outpost. Query: ".$query.", ".mysql_error ());
- $delerr = "Leider ist ein Datenbank-Fehler aufgetreten. Bitte versuche es später nochmal.";
- }
- else
- {
- if ($row = mysql_fetch_array ($res))
- {
- if ($row['total'] > 0)
- {
- $delerr = "Du hast noch unterstützende Einheiten in diesem Außenposten. Schicke diese zuerst heim.";
- }
- }
- }
- if (!isset ($delerr))
- {
- $numvillages = count ($me->allvillageids) - 1;
- // reduce score for abandoning outpost
- $costs = pow ($numvillages, 2)*OP_FAC;
- $me->log_debug ("NV:".$numvillages.", costs:".$costs);
- $me->update_score ($costs*(-4));
- $me->save_score ();
- // So we can delete the ole buddy. First delete the village entry, then free up the map space.
- $query = "delete from village where villageid=".$me->activeoutpostid;
- if (!mysql_query ($query))
- {
- $me->log_err ("Cannot delete outpost: ".$query.", ".mysql_error ());
- $delerr = "Leider ist ein Datenbank-Fehler aufgetreten. Bitte versuche es später nochmal.";
- }
- else
- {
- $query = "delete from tileres where villageid=".$me->activeoutpostid;
- if (!mysql_query ($query))
- {
- $me->log_err ("Cannot delete outpost: ".$query.", ".mysql_error ());
- $delerr = "Leider ist ein Datenbank-Fehler aufgetreten. Bitte versuche es später nochmal.";
- }
- else
- {
- // The next step is to delete events that may still be lying around for this village.
- // The only event type that outposts can have apart from attack/spy are ressource level upgrades
- $query = "delete from event where type in (1000,1001,1002,1003,1004) and village1=".$me->activeoutpost->outpost_of." and param2=".$me->activeoutpostid;
- if (!mysql_query ($query))
- {
- $me->log_err ("Cannot delete outpost: ".$query.", ".mysql_error ());
- $delerr = "Leider ist ein Datenbank-Fehler aufgetreten. Bitte versuche es später nochmal.";
- }
- else
- {
- //convert ressourcefield back
- $query = "select type from map where x=".$me->activeoutpost->x." and y=".$me->activeoutpost->y;
- if ($res = mysql_query($query))
- {
- if ($typerow = mysql_fetch_array($res))
- {
- $type = $typerow['type'];
- if ($type > 100)
- {
- if ($type == 102)
- $type = 200;
- if ($type == 103)
- $type = 300;
- if ($type == 104)
- $type = 400;
- $query = "update map set type=".$type." where x=".$me->activeoutpost->x." and y=".$me->activeoutpost->y;
- if (!mysql_query($query))
- log_err("could not convert ressource field type back: ".$query);
- }
- }
- }
- // Then clear up caches as long as we still have the position data
- $world->ClearMapCache ($me->activeoutpost->x, $me->activeoutpost->y);
- $world->ClearLandCache ($me->activeoutpost->x, $me->activeoutpost->y);
- // Hand back the expansion slot to the village that created this outpost
- $query = "update village set out_expansion=out_expansion+1 where villageid=".$me->activevillageid;
- if (!mysql_query ($query))
- {
- $me->log_err ("Cannot delete outpost: ".$query.", ".mysql_error ());
- $delerr = "Leider ist ein Datenbank-Fehler aufgetreten. Bitte versuche es später nochmal.";
- }
- $me->activevillage->outpost_expansion++;
- // Also remove the villageid from the global vid array
- foreach ($me->allvillageids as $idx=>$vid)
- {
- if ($vid == $me->activeoutpostid)
- unset ($me->allvillageids[$idx]);
- }
- // Finally recalculate production and clean up the village list.
- unset ($me->villages[$me->activeoutpostid]);
- unset ($me->activevillage->outposts[$me->activeoutpostid]);
- $me->CalculateVillageProd ($me->activevillageid);
- $me->activevillage->update_production();
- $me->activeoutpostid = 0;
- $me->activeoutpost = NULL;
- }
- }
- }
- }
- }
- }
- }
- }
- if (isset ($delerr))
- Formular::setConfirmationPopUp($delerr, 'Ok, dann nicht', 'land.php?z='.$_REQUEST['z'], '', '' );
- // $me->activevillage->update_stamp ();
- $todobox = "";
- $infobox = "";
- $berichtebox = "";
- if (!is_object($tutorial) || !$tutorial->active || $tutorial->seeLink("Land")) // tutorial im fullscreen modus?
- {
- // Instead of precalcing the info box, we do it on-the-fly
- // Much better error resilience
- //Infobox may display information about the current town
- $query = "select *,score/1000 as pop from village where x=".$x." and y=".$y;
- $res = mysql_query ($query);
- // Check if this is a village
- if ($villagerow = mysql_fetch_array ($res))
- {
- // ghost towns can be handled more efficiently
- if (in_array ($villagerow['uid'], $_ghost_uids))
- {
- // Yes, this is a ghost town
- $infobox .= "<span class=\"info\">Dies ist eine verlassene Stadt, die nur noch von den Geistern bevölkert wird.</span>";
- $is_ghost = true;
- }
- else
- {
- $res = mysql_query ("select A.user, B.name as class, C.name as race, A.userflags from user A, classes B, races C where A.uid=".$villagerow['uid']." and B.classid=A.class and C.raceid=A.race");
- $userrow = mysql_fetch_array ($res);
- $infobox .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\"><tr>\n";
- if ($villagerow['outpost_of'] > 0)
- $infobox .= "<tr><td class=\"inhalt\">AP :</td><td colspan=\"3\" class=\"inhalt\">".stripslashes ($villagerow['name'])."</td></tr>\n";
- else
- $infobox .= "<tr><td class=\"inhalt\">Stadt:</td><td colspan=\"3\" class=\"inhalt\">".stripslashes ($villagerow['name'])."</td></tr>\n";
- /* echo
- "<tr><td class=\"inhalt\">EW <a href=\"hilfe.php?Page=782\" target=\"_blank\"><img src=\"styles/".$_SESSION['theme']."/help.png\"></a>:</td><td colspan=\"3\" class=\"inhalt\">".(int)."</td></tr>"; */
- $query = "select A.ranking, round(B.score/1000) as score, B.aid, C.tag, B.inactivity from ranking A join user B on (A.uid=".$villagerow['uid']." and B.uid=".$villagerow['uid'].") left join allies C on (B.aid=C.aid)";
- $res = mysql_query ($query);
- $row = mysql_fetch_row ($res);
- $infobox .= "</td></tr>\n<tr><td class=\"inhalt\">Spieler:</td><td colspan=\"3\" class=\"inhalt\"><a href=\"profile.php?u=".$villagerow['uid']."\">";
- $infobox .= style_username ($villagerow['uid'], $userrow['user'], $row[4], $userrow['userflags']);
- $infobox .= "</a> (Rang: ".$row[0].")";
- $infobox .= "<tr><td class=\"inhalt\">Allianz:</td><td colspan=\"3\" class=\"inhalt\">";
- // We should also pass this on to the tutorial, if it is still going strong
- if (is_object ($tutorial))
- {
- if ($tutorial->active)
- $tutorial->land_city_position ($villagerow['uid'], $userrow['user'], $row[0]);
- }
- if ($row[2])
- $infobox .= "<a href=\"allianz.php?a=".$row[2]."\">".$row[3]."</a></td></tr>\n";
- else
- $infobox .= "Keine Allianz</td></tr>\n";
- $infobox .= "<tr><td class=\"inhalt\">Punkte:</td><td colspan=\"3\" class=\"inhalt\">".(int)$villagerow['pop']." <a href=\"hilfe.php?Page=782\" target=\"_blank\"><img src=\"styles/".$_SESSION['theme']."/help.png\"></a> von ".$row[1]."</td></tr>\n</table>";
- }
- if (($row[4] == 1) || ($row[4] == 2))
- $todobox .= "<span class=\"info\">Dieser Spieler ist inaktiv<a href=\"hilfe.php?Page=566\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a></span>";
- else
- {
- if ($row[4] == 3)
- $todobox .= "<span class=\"info\">Dieser Spieler ist wegen einem Regelverstoß gesperrt.</span>";
- }
- if ($villagerow['uid'] != $me->uid)
- {
- //sind die beiden allianzen im krieg?
- //FIXME SchuetzMich
- // echo $row[1]." ".round($me->score*4)." ".$row[4]." ".in_array ($row[2], $me->allywars);
- if (($row[1] < $me->score*4) || ($row[4] != 0) || $is_ghost || in_array ($row[2], $me->allywars))
- {
- if (($row[1]*4 > $me->score) || $row[4] || $is_ghost || in_array ($row[2], $me->allywars))
- {
- // If we are besieging this outpost, we display a different menu
- if ($villagerow['besieged_by'] == $me->uid)
- {
- $todobox .= '<a href="einheiten.php?f=3&sendtroops='; // FIXME
- }
- if ($me->sat_by)
- $todobox .= '<span class="info">Sitter dürfen nur innerhalb der eigenen Städte Truppen verschicken.</span>';
- else
- {
- $todobox .= "<a href=\"einheiten.php?f=3&sendtroops[".ATTACK."]=Angreifen&x=".$x."&y=".$y."\" class=\"dark\">Angreifen</a><a href=\"hilfe.php?Page=545\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a> ";
- $todobox .= " <a href=\"einheiten.php?f=3&sendtroops[".RAID."]=Raubzug&x=".$x."&y=".$y."\" class=\"dark\">Raubzug</a><a href=\"hilfe.php?Page=555\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a>";
- if (GROUP_ATTACK_POSSIBLE)
- $todobox .= "<a href=\"einheiten.php?f=3&sendtroops[".GROUPATTACK."]=Gruppenangriff&x=".$x."&y=".$y."\" class=\"dark\">Gruppenangriff</a><a href=\"hilfe.php?Page=790\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a>\n";
- if ($villagerow['outpost_of'] && $me->activevillage->outpost_expansion && SIEGE_POSSIBLE)
- $todobox .= "<a href=\"einheiten.php?f=3&sendtroops[".SIEGE."]=Erobern&x=".$x."&y=".$y."\" class=\"dark\">Erobern</a><a href=\"hilfe.php?Page=545\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a>\n";
- $todobox .= "<a href=\"einheiten.php?f=3&sendtroops[".SPY."]=Spionieren&x=".$x."&y=".$y."\" class=\"dark\">Spionieren</a><a href=\"hilfe.php?Page=554\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a>\n";
- }
- }
- else
- $todobox .= "<span class=\"info\">Dieser Spieler ist für dich im Noob-Schutz.<a href=\"hilfe.php?Page=540\" target=\"_blank\"><img src=\"styles/".$_SESSION['theme']."/help.png\"></a></span>";
- }
- else
- $todobox .= "<span class=\"info\">Für diesen Spieler bist du im Noob-Schutz.<a href=\"hilfe.php?Page=540\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a></span>";
- }
- if (($me->activevillageid != $villagerow['villageid']) && $me->activeoutpostid != $villagerow['villageid'] && !$me->activeoutpostid && !($me->sat_by && $villagerow['uid'] != $me->uid))
- {
- $todobox .= "<a href=\"einheiten.php?f=3&sendtroops[".SUPPORT."]=Unterstützen&x=".$x."&y=".$y."&r=1\">Unterstützen <a href=\"hilfe.php?Page=553\" target=\"_blank\"><img src=\"styles/".$_SESSION['theme']."/help.png\"></a>";
- if ($me->uid == $villagerow['uid'])
- $todobox .= "<a href=\"einheiten.php?f=3&sendtroops[".MOVE."]=Stationieren&x=".$x."&y=".$y."&r=1\">Stationieren</a> <a href=\"hilfe.php?Page=783\" target=\"_blank\"><img src=\"styles/".$_SESSION['theme']."/help.png\"></a>\n";
- }
- if (!$villagerow['outpost_of'] && !$me->activeoutpostid)
- {
- if (($villagerow['villageid'] != $me->activevillageid) && (!$row[4]))
- $todobox .= "<a href=\"handel.php?f=1&x=".$x."&y=".$y."\" class=\"dark\">Beliefern</a><br>\n";
- }
- else
- {
- if (($villagerow['villageid'] == $me->activeoutpostid) && ($villagerow['uid'] == $me->uid))
- {
- if ($villagerow['expansion'])
- {
- if (($me->activevillage->ress_prod[5] - $me->activeoutpost->ress_prod[5]) < $me->activevillage->sum_population ($gui))
- $todobox .= "<span class=\"bug\">".$me->activevillage->name." hat nicht genug Nahrung, um diesen AP (aktuelle Produktion: ".$me->activeoutpost->ress_prod[5].") zur Stadt zu machen</span><a href=\"hilfe.php?Page=544\" target=\"_blank\"> <img src=\"styles/".$_SESSION['theme']."/help.png\"></a><br>";
- else
- $todobox .= "<img src=\"styles/".$_SESSION['theme']."/accept.png\"><a href=\"land.php?u=1&z=".$z."\">Außenposten zur Stadt machen</a><br>";
- }
- else
- {
- $todobox .= '<span class="info">Umwandlung zur Stadt erst möglich, wenn alle Felder Stufe '.(count ($me->villages) * OP_LEVEL_FAC);
- $todobox .= ' <a href="hilfe.php?Page=544" target="_blank"><img src="styles/'.$_SESSION['theme']."/help.png\"></a></span>";
- }
- if (!isset ($delerr))
- $todobox .= '<a href="land.php?d=1&z='.$z.'"><img src="styles/'.$_SESSION['theme'].'/cross.png">Außenposten aufgeben</a>';
- }
- }
- $berichtebox = "";
- //berichte may display the last reports belonging to that town
- if (!is_object($tutorial) || !$tutorial->active)
- {
- if ($me->aid && !$me->sat_by)
- {
- if (count($me->allymeta) > 0)
- {
- $query = "select reportid,date_format(stamp, \"%d.%c %H:%i\") as stamp2 from reports where (touid=".$me->uid." or toaid in (".implode (",", $me->allymeta).")) and village2=".$villagerow['villageid']." and type<5 order by stamp desc limit 4";
- }
- else
- {
- $query = "select reportid,date_format(stamp, \"%d.%c %H:%i\") as stamp2 from reports where touid=".$me->uid." and village2=".$villagerow['villageid']." and type<5 order by stamp desc limit 4";
- }
- }
- else
- {
- $query = "select reportid,date_format(stamp, \"%d.%c %H:%i\") as stamp2 from reports where touid=".$me->uid." and village2=".$villagerow['villageid']." and type<5 order by stamp desc limit 4";
- }
- if (!($res = mysql_query ($query)))
- log_err ("Cannot read reports in tileview. Query: ".$query.", ".mysql_error());
- if (mysql_num_rows ($res) > 0)
- {
- while ($row = mysql_fetch_row ($res))
- $berichtebox .= "<a href=\"berichte.php?f=6&id=".$row[0]."\" alt=\"Bericht vom ".$row[1]."\">".$row[1]."</a><br>\n";
- mysql_free_result ($res);
- }
- else
- $berichtebox .= "Es liegen keine Berichte vor.";
- }
- }
- else
- {
- // So it might be a tile owned by a village
- $query = "select A.villageid, A.level, A.staff, A.resprod1, A.resprod2, A.resprod3, A.resprod4, B.name, B.uid, B.outpost_of, C.user, D.name as class, E.name as race, F.type, F.reserves, time_to_sec(timediff(now(),F.lastchange)) as lastchange2 from tileres A, village B, user C, races D, classes E, map F where A.x=".$x." and A.y=".$y." and A.villageid=B.villageid and B.uid=C.uid and D.raceid=C.race and E.classid=C.class and F.x=".$x." and F.y=".$y;
- // echo $query;
- if (!($res = mysql_query ($query)))
- $me->log_err ("Cannot fetch tile info in land dialogue. Query: ".$query.", ".mysql_error ());
- if ($row = mysql_fetch_array ($res))
- {
- $tolevel = $row['level'] + 1 + $gui->on_construction;
- // Yes, it is. We have to differentiate here in the precalc code, though
- // Here we could detect a field in the own village radius but not utilized yet
- // By checking level, I guess
- // We should also pass this on to the tutorial, if it is still going strong
- if (is_object ($tutorial))
- {
- if ($tutorial->active)
- $tutorial->land_position ($z, (int)($row['type'] / 100), $tolevel);
- }
- global $glob_costs;
- $eventtype = (int)($row['type'] / 100) + 1000;
- $fieldtype = (int)($row['type'] / 100);
- if ($row['uid'] == $me->uid)
- {
- if (($row['villageid'] == $me->activeoutpostid) || (($row['villageid'] == $me->activevillageid) && !$me->activeoutpostid))
- {
- if (($row['level'] > 0) || $gui->on_construction || ($me->villages[$row['villageid']]->expansion_slots > 0))
- {
- $villageid = $row['villageid']; // FIXME here: say something intelligent when villageid != activevillageid, but don't display build info
- if (isset ($factor))
- $this_income = $me->tile_ressource_yield (($eventtype-1000), $row['level']);
- else
- $this_income = $me->tile_ressource_yield (($eventtype-1000), $row['level']);
- $infobox .= "<table cellspacing=\"0\" >";
- $this_field_prod = $me->tile_ressource_yield ($fieldtype, $row['level']);
- switch ($fieldtype)
- {
- case 0: // enclave
- $pic = "styles/".$_SESSION['theme']."/gold.gif";
- $remaining = "unendlich";
- break;
- case 2: // woods
- $pic = "styles/".$_SESSION['theme']."/holz.gif";
- $remaining = prettynumber (max (0, (int)($row['reserves'] - ($me->hero->less_exhaust[2] * max (0, ($this_income[1] - (FOREST_REGROWTH * WORLD_SPEED))) * ($row['lastchange2']/3600)))));
- break;
- case 3:
- $pic = "styles/".$_SESSION['theme']."/stein.gif";
- $remaining = prettynumber (max (0, (int)($row['reserves'] - ($me->hero->less_exhaust[3] * $row['resprod2'] * ($row['lastchange2']/3600)))));
- break;
- case 4:
- $pic = "styles/".$_SESSION['theme']."/eisen.gif";
- $remaining = prettynumber (max (0, (int)($row['reserves'] - ($me->hero->less_exhaust[4] * $row['resprod4'] * ($row['lastchange2']/3600)))));
- break;
- case 1:
- $pic = "styles/".$_SESSION['theme']."/nahrung.gif";
- $remaining = "unendlich";
- break;
- }
- if (!is_object($tutorial) || !$tutorial->active || $tutorial->seeLandInfo (60, (int)($row['type'] / 100)))
- {
- $infobox .= "<tr><td colspan=\"5\"><span class=\"info\"><b>".$eventmap[$eventtype]."</b> Stufe ".$row['level']."</span>";
- if (FINITE_RESSOURCES)
- {
- $infobox .= "<td colspan=\"5\"><table cellspacing=\"0\"><tr><td>Rohstoff-Reserven:</td><td> <img src=\"".$pic."\" width=\"18\"></td><td>".$remaining."</td></tr></table>";
- }
- $infobox .= "</td></tr><tr><td>";
- $infobox .= "Aktuelle Produktion:</td>\n";
- if ($this_income[1])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/holz.gif\" width=\"18\" title=\"Holz\"> </td><td>".prettynumber ($this_income[1])."</td> ";
- if ($this_income[2])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/stein.gif\" width=\"18\" title=\"Stein\"> </td><td>".prettynumber ($this_income[2])."</td> ";
- if ($this_income[3])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/eisen.gif\" width=\"18\" title=\"Eisen\"> </td><td>".prettynumber ($this_income[3])."</td> ";
- if ($this_income[4])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/gold.gif\" width=\"18\" title=\"Gold\"> </td><td>".prettynumber ($this_income[4])."</td> ";
- if ($this_income[5])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/nahrung.gif\" width=\"18\" title=\"Nahrung\"> </td><td>".prettynumber ($this_income[5]);
- $infobox .= "</tr>\n";
- if (isset ($factor))
- $this_income = $me->tile_ressource_yield (($eventtype-1000), $tolevel, $factor);
- else
- $this_income = $me->tile_ressource_yield (($eventtype-1000), $tolevel);
- $infobox .= "<tr><td>Produktion auf Stufe ".$tolevel.":\n</td>";
- if ($this_income[1])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/holz.gif\" width=\"18px\" title=\"Holz\"> </td><td>".prettynumber ($this_income[1])."</td> ";
- if ($this_income[2])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/stein.gif\" width=\"18px\" title=\"Stein\"> </td><td>".prettynumber ($this_income[2])."</td> ";
- if ($this_income[3])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/eisen.gif\" width=\"18px\" title=\"Eisen\"> </td><td>".prettynumber ($this_income[3])."</td> ";
- if ($this_income[4])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/gold.gif\" width=\"18px\" title=\"Gold\"> </td><td>".prettynumber ($this_income[4])."</td> ";
- if ($this_income[5])
- $infobox .= "<td><img src=\"styles/".$_SESSION['theme']."/nahrung.gif\" width=\"18px\" title=\"Nahrung\"> </td><td>".prettynumber ($this_income[5]);
- $infobox .= "</td></tr>";
- }
- $infobox .= "</table>"; // Ende Produktions-Box
- if ($row['outpost_of'])
- {
- $thiscosts = building_costs ($eventtype, $tolevel);
- $dur = (int)(($thiscosts[1]+$thiscosts[2]+$thiscosts[3]+$thiscosts[4])*BUILD_TIME_BASE/ WORLD_SPEED / BUILD_SPEED);
- }
- else
- {
- $thiscosts = building_costs ($eventtype, $tolevel);
- $dur = (int)(($thiscosts[1]+$thiscosts[2]+$thiscosts[3]+$thiscosts[4]) * $me->villages[$row['villageid']]->speed_build/ WORLD_SPEED / BUILD_SPEED);
- }
- $dur = max (1, $dur);
- $tmp_notenough = false;
- $coststr = $me->activevillage->display_money ($thiscosts);
- $todobox .= '<span class="info">Ausbau von '.$glob_costs[$eventtype][5]." Stufe ".$tolevel.":</span>";
- $todobox .= $coststr."<br>\n";
- $todobox .= "<img src=\"gfx/hourglass.png\" > ".external_calcdur ($dur)."<br>\n";
- if (isset ($gui->building_queue))
- if (count ($gui->building_queue) >= 2)
- {
- $todobox .= "<span class=\"info\">Bauschleife voll</span>";
- $no_go = true;
- }
- if (!isset ($no_go))
- {
- if (!is_object($tutorial) || !$tutorial->active || $tutorial->seeLandInfo (70, (int)($row['type']/100)))
- {
- if ($tmp_notenough)
- $todobox .= "<span class=\"info\">Nicht genug Rohstoffe für ".$glob_costs[$eventtype][5]." ".$tolevel." </span><br>";
- else
- {
- $todobox .= "<a href=\"land.php?z=".$z."&r=1&l=".$tolevel."&c=".(int)$me->reload_counter."\" class=\"dark\"><img src=\"gfx/hammer.gif\" width=\"16\" height=\"16\">jetzt ausbauen.</a><br>";
- }
- }
- }
- }
- else
- $todobox .= '<span class="info">'.$main_buildings[$me->race]." muss ausgebaut werden, bevor ein freies Feld erschlossen werden kann</span>";
- //</div>";
- }
- else
- $todobox .= '<span class="error">Gehört nicht zur aktiven Stadt. Wechsle mit der Auswahlliste oben dorthin.</span>';
- }
- }
- else
- {
- //if (is_object($tutorial) && $tutorial->active && !$tutorial->seeLandInfo(80))
- {
- $can_settle = false;
- // This field is empty and might be ready for settlers
- // Only fields that do not border directly to the border (hah) can be settled on
- if (($x < 7) || ($x > $world->sizex - 7) || ($y < 7) || ($y > $world->sizey - 7))
- $todobox .= "<span class=\"error\">So nahe am Rand der Welt kann man nicht siedeln.</span>";
- else
- {
- if ($me->activevillage->outpost_expansion > 0)
- {
- if (($fields = $world->CheckOutpostRess ($x, $y)))
- {
- $infobox .= "<span class=\"info\">Feldverteilung:</span>";
- $infobox .= 'Steppe: '.(int)$fields[0].'<br>Grasland: '.(int)$fields[1].'<br>Wald: '.(int)$fields[2].'<br>Hügel: '.(int)$fields[3].'<br>Gebirge: '.(int)$fields[4].'';
- $numvillages = count ($me->allvillageids);
- $costs = pow ($numvillages, 2)*OP_FAC;
- $thiscosts = array (1=>$costs, 2=>$costs, 3=>$costs, 4=>$costs/OP_GOLD_DIV);
- $tmp_notenough = false;
- $coststr = $me->activevillage->display_money ($thiscosts);
- require_once("php/base/Tutorial.inc.php");
- if (!$me->activeoutpostid)
- {
- if ($tmp_notenough)
- $todobox .= '<span class="info">Nicht genug Rohstoffe, um einen Außenposten zu errichten.</span>';
- else
- {
- $can_settle = true;
- $todobox .= "<a href=\"land.php?s=1&z=".$z."&c=".$me->reload_counter."\">Außenposten gründen</a><br>";
- }
- $todobox .= $coststr;
- }
- else
- $todobox .= '<span class="error">Außenposten können keine Aussenposten gründen, das geht nur von Städten aus.<br></span>';
- }
- else
- $todobox .= "<span class=\"info\">Hier ist nicht genug Platz für einen Außenposten.</span>";
- }
- else
- {
- $todobox .= '<span class="error">' . $main_buildings[$me->race]." muss ausgebaut werden, bevor du einen Außenposten gründen kannst</span>";
- }
- }
- }
- }
- }
- // Define ressource names here
- $resnames = array (0=>"deine Enklave. Die Enklave ist eine Geländeart, die nur auf Selador vorkommt. Angeblich gibt es dort viel Gold!", 1=>"dein Farmland. Dort können deine Bauern reiche Ernten einfahren.", 2=>"dein Holzfäller. Die Bäume wachsen hier sehr dicht.", 3=>"dein Steinbruch. Der Stein wäre praktisch für die Stadtausbauten.", 4=>"deine Eisenmine. Sobald du ernsthaft Truppen ausbildest, wirst du viel Eisen brauchen.");
- }
- //the user ist still in the tutorial and may not see the map
- else
- {
- $tutorial->outputFullscreen();
- }
- if (!is_object($tutorial) || !$tutorial->active || $tutorial->seeLink("Land")) // tutorial im fullscreen modus?
- {
- echo '<div id="bottom-land">';
- if (!is_object($tutorial) || !$tutorial->active)
- {
- echo "<div id=\"koords\"><form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">
- <table border=\"0\" cellpadding=\"0\" cellspacing=\"3\" height=\"100%\">
- <tr valign=\"middle\">
- <td class=\"inhalt\">x: <br><input class=\"eingabe\" name=\"x\" type=\"text\" size=\"2\" maxlength=\"4\" value=\"".$x."\"></td>
- <td class=\"inhalt\">y: <br><input class=\"eingabe\" name=\"y\" type=\"text\" size=\"2\" maxlength=\"4\" value=\"".$y."\"></td>
- </tr>
- <tr>
- <td align=\"right\"><input class=\"eingabe\" type=\"submit\" name=\"go\" value=\"Go!\"></td>";
- echo '<td><a href="welt.php?x='.$x.'&y='.$y.'&h=true"><img src="styles/'.$_SESSION['theme'].'/world.png" title="Auf Weltkarte anzeigen"></a></td>';
- echo "</tr></table><br>";
- echo "</form></div>";
- }
- echo "<div id=\"land-infos\"";
- if (is_object($tutorial) && $tutorial->active && !$tutorial->seeLandInfo(20))
- echo ' style="visibility:hidden"';
- if (is_object($tutorial) && $tutorial->active && $tutorial->highlight(51))
- echo ' style="border: 3px solid red"';
- echo ">\n";
- echo $infobox;
- echo "</div>";
- //todo box may display
- // - Links to interact with another player
- // - Links to build a ressource field
- // - Links to upgrade an outpost
- // - Links to build an outpost
- echo "<div id=\"options\"";
- if (is_object($tutorial) && $tutorial->active && (!$tutorial->seeLandInfo(30) && !($tutorial->seeLandInfo(40, ($row['type']/100)))))
- echo ' style="visibility:hidden"';
- if (is_object($tutorial) && $tutorial->active && ($tutorial->highlight(20) || $tutorial->highlight(50)))
- echo ' style="border: 3px solid red"';
- echo ">\n";
- echo $todobox;
- echo "</div>";
- if ($berichtebox)
- {
- echo "<div id=\"berichte\" ";
- if (is_object($tutorial) && $tutorial->active && !($tutorial->seeLandInfo(50)))
- echo ' style="visibility:hidden"';
- echo tt ("Falls es zu dieser Stadt Berichte von dir oder deinen Allianzkollegen gibt, siehst du diese hier.")."";
- echo ">Letzte Berichte:<br>";
- echo $berichtebox;
- echo "</div>";
- }
- }
- echo '</div>';
- if (!file_exists ($precalcpath))
- {
- require_once ("php/tiles.php");
- draw_map ($x, $y, $precalcpath, 3, $me, 2);
- }
- if (!is_object($tutorial) || !$tutorial->active || $tutorial->seeLink("Land"))
- {
- echo '<div id="landview">
- ';
- require_once ($precalcpath);
- echo '
- </div>';
- }
- echo '</div>';
- require_once("footer.php");
- …
Large files files are truncated, but you can click here to view the full file