mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-01 10:04:21 +00:00
big update (trade routes, less hungry troops artefact, somethings in hero table, fix peace reports...)
This commit is contained in:
+27
-10
@@ -169,6 +169,8 @@ class Automation {
|
||||
$this->demolitionComplete();
|
||||
}
|
||||
$this->updateStore();
|
||||
$this->delTradeRoute();
|
||||
$this->TradeRoute();
|
||||
if(!file_exists("GameEngine/Prevention/market.txt") or time()-filemtime("GameEngine/Prevention/market.txt")>10) {
|
||||
$this->marketComplete();
|
||||
}
|
||||
@@ -528,9 +530,28 @@ class Automation {
|
||||
$cp = $dataarray[($level+1)]['cp'];
|
||||
return array($pop,$cp);
|
||||
}
|
||||
|
||||
private function delTradeRoute() {
|
||||
global $database;
|
||||
$time = time();
|
||||
$q = "DELETE from ".TB_PREFIX."route where timeleft < $time";
|
||||
$database->query($q);
|
||||
}
|
||||
|
||||
private function TradeRoute() {
|
||||
global $database;
|
||||
$time = time();
|
||||
$q = "SELECT * FROM ".TB_PREFIX."route where timestamp < $time";
|
||||
$dataarray = $database->query_return($q);
|
||||
foreach($dataarray as $data) {
|
||||
$targettribe = $database->getUserField($database->getVillageField($data['from'],"owner"),"tribe",0);
|
||||
$this->sendResource2($data['wood'],$data['clay'],$data['iron'],$data['crop'],$data['from'],$data['wid'],$targettribe,$data['deliveries']);
|
||||
$database->editTradeRoute($data['id'],"timestamp",86400,1);
|
||||
}
|
||||
}
|
||||
|
||||
private function marketComplete() {
|
||||
global $database,$generator;
|
||||
global $database;
|
||||
$ourFileHandle = @fopen("GameEngine/Prevention/market.txt", 'w');
|
||||
@fclose($ourFileHandle);
|
||||
$time = time();
|
||||
@@ -2143,13 +2164,9 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
||||
}
|
||||
}else{
|
||||
//units attack string for battleraport
|
||||
$unitssend_att = ''.$data['t1'].','.$data['t2'].','.$data['t3'].','.$data['t4'].','.$data['t5'].','.$data['t6'].','.$data['t7'].','.$data['t8'].','.$data['t9'].','.$data['t10'].'';
|
||||
$unitssend_att1 = ''.$data['t1'].','.$data['t2'].','.$data['t3'].','.$data['t4'].','.$data['t5'].','.$data['t6'].','.$data['t7'].','.$data['t8'].','.$data['t9'].','.$data['t10'].'';
|
||||
$herosend_att = $data['t11'];
|
||||
if ($herosend_att>0){
|
||||
$unitssend_att_check=$unitssend_att.','.$data['t11'];
|
||||
}else{
|
||||
$unitssend_att_check=$unitssend_att;
|
||||
}
|
||||
$unitssend_att= $unitssend_att1.','.$herosend_att;
|
||||
|
||||
$speeds = array();
|
||||
|
||||
@@ -2172,8 +2189,8 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
||||
$endtime = $this->procDistanceTime($from,$to,min($speeds),1) + time();
|
||||
$database->setMovementProc($data['moveid']);
|
||||
$database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],time(),$endtime);
|
||||
|
||||
$data2 = ''.$from['owner'].','.$from['wref'].','.$to['owner'].','.$owntribe.','.$unitssend_att_check.'';
|
||||
$peace = PEACE;
|
||||
$data2 = ''.$from['owner'].','.$from['wref'].','.$to['owner'].','.$owntribe.','.$unitssend_att.','.$peace.'';
|
||||
$database->addNotice($from['owner'],$to['wref'],$ownally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
|
||||
$database->addNotice($to['owner'],$to['wref'],$targetally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
|
||||
}
|
||||
@@ -3049,7 +3066,7 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
||||
}
|
||||
$database->modifyHero("lastupdate",time(),$hdata['heroid']);
|
||||
}
|
||||
if ($hdata['experience'] > $hero_levels[$hdata['level']+1]) {
|
||||
if ($hdata['experience'] > $hero_levels[$hdata['level']+1] && $hdata['level'] < 100) {
|
||||
mysql_query("UPDATE " . TB_PREFIX ."hero SET level = level + 1 WHERE heroid = '".$hdata['heroid']."'");
|
||||
mysql_query("UPDATE " . TB_PREFIX ."hero SET points = points + 5 WHERE heroid = '".$hdata['heroid']."'");
|
||||
}
|
||||
|
||||
@@ -565,13 +565,11 @@
|
||||
}
|
||||
|
||||
function populateOasisUnitsHigh() {
|
||||
$q2 = "SELECT * FROM " . TB_PREFIX . "wdata where oasistype != 0";
|
||||
$result2 = mysql_query($q2, $this->connection);
|
||||
while($row = mysql_fetch_array($result2)) {
|
||||
$wid = $row['id'];
|
||||
$basearray = $this->getMInfo($wid);
|
||||
//each Troop is a Set for oasis type like mountains have rats spiders and snakes fields tigers elphants clay wolves so on stonger one more not so less
|
||||
switch($basearray['oasistype']) {
|
||||
$q2 = "SELECT * FROM " . TB_PREFIX . "wdata where oasistype != 0";
|
||||
$result2 = mysql_query($q2, $this->connection);
|
||||
while($row = mysql_fetch_array($result2)) {
|
||||
$wid = $row['id'];
|
||||
switch($row['oasistype']) {
|
||||
case 1:
|
||||
case 2:
|
||||
//+25% lumber per hour
|
||||
@@ -1603,6 +1601,48 @@
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return $this->mysql_fetch_all($result);
|
||||
}
|
||||
|
||||
function createTradeRoute($uid,$wid,$from,$r1,$r2,$r3,$r4,$start,$deliveries,$merchant,$time) {
|
||||
$x = "UPDATE " . TB_PREFIX . "users SET gold = gold - 2 WHERE id = ".$uid."";
|
||||
mysql_query($x, $this->connection);
|
||||
$timeleft = time()+604800;
|
||||
$q = "INSERT into " . TB_PREFIX . "route values (0,$uid,$wid,$from,$r1,$r2,$r3,$r4,$start,$deliveries,$merchant,$time,$timeleft)";
|
||||
return mysql_query($q, $this->connection);
|
||||
}
|
||||
|
||||
function getTradeRoute($uid) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "route where uid = $uid ORDER BY timestamp ASC";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return $this->mysql_fetch_all($result);
|
||||
}
|
||||
|
||||
function getTradeRoute2($id) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "route where id = $id";
|
||||
$result = mysql_query($q, $this->connection) or die(mysql_error());
|
||||
$dbarray = mysql_fetch_array($result);
|
||||
return $dbarray;
|
||||
}
|
||||
|
||||
function getTradeRouteUid($id) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "route where id = $id";
|
||||
$result = mysql_query($q, $this->connection) or die(mysql_error());
|
||||
$dbarray = mysql_fetch_array($result);
|
||||
return $dbarray['uid'];
|
||||
}
|
||||
|
||||
function editTradeRoute($id,$column,$value,$mode) {
|
||||
if(!$mode){
|
||||
$q = "UPDATE " . TB_PREFIX . "route set $column = $value where id = $id";
|
||||
}else{
|
||||
$q = "UPDATE " . TB_PREFIX . "route set $column = $column + $value where id = $id";
|
||||
}
|
||||
return mysql_query($q, $this->connection);
|
||||
}
|
||||
|
||||
function deleteTradeRoute($id) {
|
||||
$q = "DELETE FROM " . TB_PREFIX . "route where id = $id";
|
||||
return mysql_query($q, $this->connection);
|
||||
}
|
||||
|
||||
function addBuilding($wid, $field, $type, $loop, $time, $master, $level) {
|
||||
$x = "UPDATE " . TB_PREFIX . "fdata SET f" . $field . "t=" . $type . " WHERE vref=" . $wid;
|
||||
@@ -2720,7 +2760,7 @@
|
||||
}
|
||||
|
||||
function getOwnArtefactInfoByType($vref, $type) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref AND type = $type";
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref AND type = $type order by size";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return mysql_fetch_array($result);
|
||||
}
|
||||
@@ -2737,6 +2777,15 @@
|
||||
return mysql_fetch_array($result);
|
||||
}
|
||||
|
||||
function getOwnUniqueArtefactInfo2($id, $type, $size, $mode) {
|
||||
if(!$mode){
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $id AND type = $type AND size=$size";
|
||||
}else{
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $id AND type = $type AND size=$size";
|
||||
}
|
||||
return mysql_query($q, $this->connection);
|
||||
}
|
||||
|
||||
function getArtefactInfo() {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE id > 0";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
|
||||
@@ -401,7 +401,18 @@ class Technology {
|
||||
// $unit = "hero";
|
||||
// global $$unit;
|
||||
// $dataarray = $$unit;
|
||||
$upkeep += $array['hero'] * 6;
|
||||
$upkeep += $array['hero'] * 6;
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,4,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,4,2,0));
|
||||
if($artefact > 0){
|
||||
$upkeep /= 2;
|
||||
}else if($artefact1 > 1){
|
||||
$upkeep /= 2;
|
||||
}else if($artefact2 > 1){
|
||||
$upkeep /= 4;
|
||||
$upkeep *= 3;
|
||||
}
|
||||
return $upkeep;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?php if($session->gold > 2){ ?>
|
||||
<div id="build" class="gid17"><a href="#" onClick="return Popup(17,4);" class="build_logo">
|
||||
<img class="building g17" src="img/x.gif" alt="Marketplace" title="Marketplace" />
|
||||
</a>
|
||||
@@ -262,4 +263,9 @@ function testSum() {
|
||||
</br></br>
|
||||
<?php echo "You can't use NPC trade in WW village.";
|
||||
}} ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}else{
|
||||
header("Location: build.php?id=".$_GET['id']."");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php if($session->goldclub == 1 && $database->getProfileVillages($session->uid) > 1) { ?>
|
||||
<div id="build" class="gid17"><a href="#" onClick="return Popup(17,4);" class="build_logo">
|
||||
<img class="building g17" src="img/x.gif" alt="Marketplace" title="Marketplace" />
|
||||
</a>
|
||||
<h1>Marketplace <span class="level">level <?php echo $village->resarray['f'.$id]; ?></span></h1>
|
||||
<p class="build_desc">At the Marketplace you can trade resources with other players. The higher its level, the more resources can be transported at the same time.
|
||||
</p>
|
||||
|
||||
<?php include("17_menu.tpl");
|
||||
|
||||
if(isset($_GET['action'])){
|
||||
$routeaccess = 1;
|
||||
}
|
||||
if(isset($_GET['create']) && $session->gold > 1){
|
||||
$routeaccess = 1;
|
||||
include("17_create.tpl");
|
||||
}else if($_GET['action'] == 'editRoute' && isset($_GET['routeid']) && $_GET['routeid'] != ""){
|
||||
$traderoute = $database->getTradeRouteUid($_GET['routeid']);
|
||||
if($traderoute == $session->uid){
|
||||
include("17_edit.tpl");
|
||||
}
|
||||
}else{
|
||||
?>
|
||||
|
||||
<p>Trade route allows you to set up routes for your merchant that he will walk every day at a certain hour. <br /><br />
|
||||
Standard this holds on for 7 days, but you can extend it with 7 days for the cost of <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="Gold">2.</p>
|
||||
|
||||
<table id="npc" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>description</th>
|
||||
<th>start</th>
|
||||
<th>Merchants</th>
|
||||
<th>time left</th>
|
||||
</tr></thead><tbody>
|
||||
<?php
|
||||
$routes = $database->getTradeRoute($session->uid);
|
||||
if(count($routes) == 0) {
|
||||
echo "<td colspan=\"5\" class=\"none\">No active trade route.</td></tr>";
|
||||
}else{
|
||||
foreach($routes as $route){
|
||||
?>
|
||||
<tr>
|
||||
<th><label><input class="radio" type="radio" onclick="window.location.href = '?id=<?php echo $id; ?>&t=4&routeid=<?php echo $route['id']; ?>';" name="routeid" value="<?php echo $route['id']; ?>" <?php if($routeid == $route['id']) { echo "checked"; } ?>></label></th>
|
||||
<th>
|
||||
<?php
|
||||
echo "Trade route to <a href=karte.php?d=".$route['wid']."&c=".$generator->getMapCheck($route['wid']).">".$database->getVillageField($route['wid'],"name")."</a>"
|
||||
?>
|
||||
</th>
|
||||
<th><?php if($route['start'] > 9){ echo $route['start'];}else{ echo "0".$route['start'];} echo ":00"; ?></th>
|
||||
<th><?php echo $route['deliveries']."x".$route['merchant']; ?></th>
|
||||
<th><?php echo ceil(($route['timeleft']-time())/86400); echo " days"; ?></th>
|
||||
</tr>
|
||||
<?php }} ?>
|
||||
</tbody><tfoot><tr>
|
||||
<th>
|
||||
</th>
|
||||
<th colspan="4">
|
||||
<a href="build.php?action=extendRoute&routeid=<?php echo $routeid; ?>">extend</a>*
|
||||
| <a href="build.php?id=<?php echo $id; ?>&t=4&action=editRoute&routeid=<?php echo $routeid; ?>">edit</a>
|
||||
| <a href="build.php?action=delRoute&routeid=<?php echo $routeid; ?>">delete</a>
|
||||
</th></tr></tfoot></table>
|
||||
* Extend the trade route by 7 days for <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="Gold">2
|
||||
<br>
|
||||
<div class="options">
|
||||
<a class="arrow" href="build.php?gid=17&t=4&create">» Create new trade route</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}}else{
|
||||
header("Location: build.php?id=".$_GET['id']."");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,78 @@
|
||||
<form action="build.php" method="post">
|
||||
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
|
||||
<input type="hidden" name="action" value="addRoute">
|
||||
<table cellpadding="1" cellspacing="1" id="npc" class="transparent">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Create trade route</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
target village: </th>
|
||||
<td>
|
||||
|
||||
<select id="tvillage" name="tvillage">
|
||||
<?php
|
||||
if($session->villages[0] == $village->wid){
|
||||
$firstvillage = 2;
|
||||
}else{
|
||||
$firstvillage = 1;
|
||||
}
|
||||
for($i=1;$i<=count($session->villages);$i++) {
|
||||
if($i == $firstvillage){
|
||||
$select = 'selected="selected"';
|
||||
}else{
|
||||
$select = '';
|
||||
}
|
||||
if($session->villages[$i-1] != $village->wid){
|
||||
$coor = $database->getCoor($session->villages[$i-1]);
|
||||
echo "<option value=\"".$session->villages[$i-1]."\" ".$select.">".$database->getVillageField($session->villages[$i-1],'name')." (".$coor['x']."|".$coor['y'].")</option>";
|
||||
}
|
||||
}
|
||||
?> </select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Resources: </th>
|
||||
<td>
|
||||
<img src="../../<?php echo GP_LOCATE; ?>img/r/1.gif" alt="Lumber" title="Lumber"> <input class="text" type="text" name="r1" id="r1" value="" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/2.gif" alt="Clay" title="CLay"> <input class="text" type="text" name="r2" id="r2" value="" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/3.gif" alt="Iron" title="Iron"> <input class="text" type="text" name="r3" id="r3" value="" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/4.gif" alt="Crop" title="Crop"> <input class="text" type="text" name="r4" id="r4" value="" maxlength="5" tabindex="1" style="width:50px;">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
start time: </th>
|
||||
<td>
|
||||
<select name="start"><option value="0" selected="selected">00</option><option value="1">01</option><option value="2">02</option><option value="3">03</option><option value="4">04</option><option value="5">05</option><option value="6">06</option><option value="7">07</option><option value="8">08</option><option value="9">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
deliveries: </th>
|
||||
<td>
|
||||
<select name="deliveries"><option value="1" selected="selected">1</option><option value="2">2</option><option value="3">3</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
costs: </th>
|
||||
<td>
|
||||
<img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="Gold"> 2
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Duration: </th>
|
||||
<td>
|
||||
7 days
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><input type="image" value="1" name="save" id="btn_save" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK"/></p>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php $edited_route = $database->getTradeRoute2($_GET['routeid']); ?>
|
||||
<form action="build.php" method="post">
|
||||
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
|
||||
<input type="hidden" name="action" value="editRoute">
|
||||
<input type="hidden" name="routeid" value="<?php echo $_GET['routeid']; ?>">
|
||||
<table cellpadding="1" cellspacing="1" id="npc" class="transparent">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Edit trade route</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
Resources: </th>
|
||||
<td>
|
||||
<img src="../../<?php echo GP_LOCATE; ?>img/r/1.gif" alt="Lumber" title="Lumber"> <input class="text" type="text" name="r1" id="r1" value="<?php echo $edited_route['wood']; ?>" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/2.gif" alt="Clay" title="CLay"> <input class="text" type="text" name="r2" id="r2" value="<?php echo $edited_route['clay']; ?>" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/3.gif" alt="Iron" title="Iron"> <input class="text" type="text" name="r3" id="r3" value="<?php echo $edited_route['iron']; ?>" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/4.gif" alt="Crop" title="Crop"> <input class="text" type="text" name="r4" id="r4" value="<?php echo $edited_route['crop']; ?>" maxlength="5" tabindex="1" style="width:50px;">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
start time: </th>
|
||||
<td>
|
||||
<select name="start"><?php for($i=0;$i<=23;$i++){?><option value="<?php echo $i; ?>" <?php if($i == $edited_route['start']){echo "selected";} ?>><?php if($i > 9){echo $i;}else{echo "0".$i;}?></option><?php } ?></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
deliveries: </th>
|
||||
<td>
|
||||
<select name="deliveries"><?php for($i=1;$i<=3;$i++){?><option value="<?php echo $i; ?>" <?php if($i == $edited_route['deliveries']){echo "selected";} ?>><?php echo $i; ?></option><?php } ?></select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p><input type="image" value="1" name="save" id="btn_save" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK"/></p>
|
||||
</form>
|
||||
</div>
|
||||
@@ -2,10 +2,16 @@
|
||||
<a href="build.php?id=<?php echo $id; ?>"<?php if(!isset($_GET['t'])) { echo "class=\"selected\""; } ?>">Send Resouces</a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&t=1" <?php if(isset($_GET['t']) && $_GET['t'] == 1) { echo "class=\"selected\""; } ?>>Buy</a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&t=2" <?php if(isset($_GET['t']) && $_GET['t'] == 2) { echo "class=\"selected\""; } ?>>Offer</a>
|
||||
<?php if($session->userinfo['gold'] > 3) {
|
||||
<?php if($session->userinfo['gold'] > 2) {
|
||||
?>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&t=3" <?php if(isset($_GET['t']) && $_GET['t'] == 3) { echo "class=\"selected\""; } ?>>NPC trading</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if($session->goldclub == 1 && $database->getProfileVillages($session->uid) > 1) {
|
||||
?>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&t=4" <?php if(isset($_GET['t']) && $_GET['t'] == 4) { echo "class=\"selected\""; } ?>>trade routes</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -21,7 +21,6 @@ include_once("GameEngine/Data/hero_full.php");
|
||||
|
||||
?>
|
||||
<?php if ($hero_info['experience'] >= 495000) {
|
||||
mysql_query("UPDATE ".TB_PREFIX."hero SET `level` = 100 where `uid`='".$session->uid."'");
|
||||
?>
|
||||
<table id="distribution" cellpadding="1" cellspacing="1">
|
||||
<thead><tr>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
$dataarray = explode(",",$message->readingNotice['data']);
|
||||
if(isset($dataarray[14]) and $dataarray[14]!=0){$colspan="11";}else{$colspan="10";}
|
||||
if(PEACE == 1){
|
||||
if($dataarray[15] == 1){
|
||||
$image = "peace";
|
||||
}else if(PEACE == 2){
|
||||
}else if($dataarray[15] == 2){
|
||||
$image = "xmas";
|
||||
}else if(PEACE == 3){
|
||||
}else if($dataarray[15] == 3){
|
||||
$image = "newy";
|
||||
}else{
|
||||
$image = "easter";
|
||||
}
|
||||
if(PEACE == 1){
|
||||
if($dataarray[15] == 1){
|
||||
$message1 = "".$database->getUserField($dataarray[0],"username",0)." visited ".$database->getUserField($dataarray[2],"username",0)."'s troops";
|
||||
}else if(PEACE == 2){
|
||||
}else if($dataarray[15] == 2){
|
||||
$message1 = "".$database->getUserField($dataarray[0],"username",0)." wishes you Merry Christmas";
|
||||
}else if(PEACE == 3){
|
||||
}else if($dataarray[15] == 3){
|
||||
$message1 = "".$database->getUserField($dataarray[0],"username",0)." wishes you Happy New Year";
|
||||
}else{
|
||||
$message1 = "".$database->getUserField($dataarray[0],"username",0)." wishes you Happy Easter";
|
||||
|
||||
@@ -49,7 +49,121 @@ if(isset($_GET['id'])) {
|
||||
$technology->procTechno($_GET);
|
||||
}
|
||||
}
|
||||
if($session->goldclub){
|
||||
if($session->goldclub == 1 && count($session->villages) > 1){
|
||||
if(isset($_GET['routeid'])){
|
||||
$routeid = $_GET['routeid'];
|
||||
}
|
||||
if($routeaccess = 1){
|
||||
if(isset($_POST['action']) && $_POST['action'] == 'addRoute') {
|
||||
if($session->access != BANNED){
|
||||
if($session->gold >= 2) {
|
||||
for($i=1;$i<=4;$i++){
|
||||
if($_POST['r'.$i] == ""){
|
||||
$_POST['r'.$i] = 0;
|
||||
}
|
||||
}
|
||||
$totalres = $_POST['r1']+$_POST['r2']+$_POST['r3']+$_POST['r4'];
|
||||
$reqMerc = ceil(($totalres-0.1)/$market->maxcarry);
|
||||
$second = date("s");
|
||||
$minute = date("i");
|
||||
$hour = date("G")-$_POST['start'];
|
||||
if(date("G") > $_POST['start']){
|
||||
$day = 1;
|
||||
}else{
|
||||
$day = 0;
|
||||
}
|
||||
$timestamp = strtotime("-$hour hours -$second second -$minute minutes +$day day");
|
||||
if($totalres > 0){
|
||||
$database->createTradeRoute($session->uid,$_POST['tvillage'],$village->wid,$_POST['r1'],$_POST['r2'],$_POST['r3'],$_POST['r4'],$_POST['start'],$_POST['deliveries'],$reqMerc,$timestamp);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
$route = 1;
|
||||
}else{
|
||||
header("Location: build.php?gid=17&t=4&create");
|
||||
$route = 1;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
}
|
||||
}
|
||||
if(isset($_GET['action']) && $_GET['action'] == 'extendRoute') {
|
||||
if($session->access != BANNED){
|
||||
if($session->gold >= 2) {
|
||||
$traderoute = $database->getTradeRouteUid($_GET['routeid']);
|
||||
if($traderoute == $session->uid){
|
||||
$database->editTradeRoute($_GET['routeid'],"timeleft",604800,1);
|
||||
$newgold = $session->gold-2;
|
||||
$database->updateUserField($session->uid,'gold',$newgold,1);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
}else{
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
}
|
||||
}else{
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
$route = 1;
|
||||
}
|
||||
}else{
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
}
|
||||
}
|
||||
if(isset($_POST['action']) && $_POST['action'] == 'editRoute') {
|
||||
if($session->access != BANNED){
|
||||
$totalres = $_POST['r1']+$_POST['r2']+$_POST['r3']+$_POST['r4'];
|
||||
$reqMerc = ceil(($totalres-0.1)/$market->maxcarry);
|
||||
if($totalres > 0){
|
||||
$database->editTradeRoute($_POST['routeid'],"wood",$_POST['r1'],0);
|
||||
$database->editTradeRoute($_POST['routeid'],"clay",$_POST['r2'],0);
|
||||
$database->editTradeRoute($_POST['routeid'],"iron",$_POST['r3'],0);
|
||||
$database->editTradeRoute($_POST['routeid'],"crop",$_POST['r4'],0);
|
||||
$database->editTradeRoute($_POST['routeid'],"start",$_POST['start'],0);
|
||||
$database->editTradeRoute($_POST['routeid'],"deliveries",$_POST['deliveries'],0);
|
||||
$database->editTradeRoute($_POST['routeid'],"merchant",$reqMerc,0);
|
||||
$second = date("s");
|
||||
$minute = date("i");
|
||||
$hour = date("G")-$_POST['start'];
|
||||
if(date("G") > $_POST['start']){
|
||||
$day = 1;
|
||||
}else{
|
||||
$day = 0;
|
||||
}
|
||||
$timestamp = strtotime("-$hour hours -$second seconds -$minute minutes +$day day");
|
||||
$database->editTradeRoute($_POST['routeid'],"timestamp",$timestamp,0);
|
||||
}
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
}else{
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
}
|
||||
}
|
||||
if(isset($_GET['action']) && $_GET['action'] == 'delRoute') {
|
||||
if($session->access != BANNED){
|
||||
$traderoute = $database->getTradeRouteUid($_GET['routeid']);
|
||||
if($traderoute == $session->uid){
|
||||
$database->deleteTradeRoute($_GET['routeid']);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
}else{
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
}
|
||||
}else{
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($session->goldclub == 1 && $session->access != BANNED){
|
||||
if(isset($_GET['t'])==99) {
|
||||
|
||||
if($_GET['action'] == 'addList') {
|
||||
@@ -73,6 +187,9 @@ if($session->goldclub){
|
||||
}
|
||||
}else{
|
||||
$create = 0;
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['a']) == 533374 && isset($_POST['id']) == 39){
|
||||
@@ -161,7 +278,7 @@ $automation->isWinner();
|
||||
<?php include("Templates/menu.tpl"); ?>
|
||||
<div id="content" class="build">
|
||||
<?php
|
||||
if(isset($_GET['id'])) {
|
||||
if(isset($_GET['id']) or isset($_GET['gid']) or $route == 1 or isset($_GET['routeid'])) {
|
||||
if(isset($_GET['s']))
|
||||
{
|
||||
if (!ctype_digit($_GET['s'])) {
|
||||
|
||||
@@ -70,8 +70,7 @@ header("Location: banned.php");
|
||||
<div id="mid">
|
||||
<?php include("Templates/menu.tpl"); ?>
|
||||
<div id="content" class="village2">
|
||||
<h1><?php echo $village->vname; ?><br /></h1>
|
||||
|
||||
<h1><?php echo $village->vname; if($village->loyalty!='100'){ if($village->loyalty>'33'){ $color="gr"; }else{ $color="re"; } ?><div id="loyality" class="<?php echo $color; ?>"><?php echo LOYALTY; ?> <?php echo floor($village->loyalty); ?>%</div><?php } ?></h1>
|
||||
<?php include("Templates/dorf2.tpl");
|
||||
if($building->NewBuilding) {
|
||||
include("Templates/Building.tpl");
|
||||
|
||||
+32
-4
@@ -789,14 +789,14 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%gold_fin_log` (
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `%PREFIX%hero` (
|
||||
`heroid` smallint(2) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`uid` smallint(2) unsigned NOT NULL,
|
||||
`heroid` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`uid` int(11) unsigned NOT NULL,
|
||||
`unit` smallint(2) unsigned NOT NULL,
|
||||
`name` tinytext NOT NULL,
|
||||
`wref` mediumint(3) unsigned NOT NULL,
|
||||
`level` tinyint(1) unsigned NOT NULL,
|
||||
`points` smallint(2) unsigned NOT NULL,
|
||||
`experience` mediumint(3) NOT NULL,
|
||||
`points` mediumint(3) unsigned NOT NULL,
|
||||
`experience` int(11) NOT NULL,
|
||||
`dead` tinyint(1) unsigned NOT NULL,
|
||||
`health` float(12,9) unsigned NOT NULL,
|
||||
`attack` tinyint(1) unsigned NOT NULL,
|
||||
@@ -1092,6 +1092,34 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%research` (
|
||||
--
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `%prefix%route`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `%PREFIX%route` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`uid` int(11) unsigned NOT NULL,
|
||||
`wid` int(11) unsigned NOT NULL,
|
||||
`from` int(11) unsigned NOT NULL,
|
||||
`wood` int(5) unsigned NOT NULL,
|
||||
`clay` int(5) unsigned NOT NULL,
|
||||
`iron` int(5) unsigned NOT NULL,
|
||||
`crop` int(5) unsigned NOT NULL,
|
||||
`start` tinyint(2) unsigned NOT NULL,
|
||||
`deliveries` tinyint(1) unsigned NOT NULL,
|
||||
`merchant` int(11) unsigned NOT NULL,
|
||||
`timestamp` int(11) unsigned NOT NULL,
|
||||
`timeleft` int(11) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `%prefix%route`
|
||||
--
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user