Natars automation system

+Natars will now spawn automatically, you can set how many day should
pass before the spawn of Natars (and artifacts), WW Villages and WW
building plans (Note: WW villages and WW building plans won't spawn
until the creation of the natar account)
+Added 3 timers under the left menu which indicate the spawn of
Natars/Artifacts, WW villages and WW building plans
+Added an option in the installation, to set the resource production of
oasis
+Fixed a bug that didn't permit to add multiple Units, Abtech and tech
rows with one query
+Added a new information to the Artifact of the fool, the next effect
reroll will now be displayed in his informations (in the treasury)
+Fixed a bug that dind't permit the correct timers flow in Dorf3.php
(Warehouse tab), they'll now flow correctly
+Timers and resources percentage of villages with a negative production
of crop will now be marked in red (in the Warehouse tab, Dorf3.php) and
will now be displayed in how much time the granary will be emptied
+Fixed a possible bug that prevented to add raids to farm lists
+Fixed a bug that didn't permit to create WW Villages from the
Multihunter control panel
+Reworked all timers, there will be only one timer field now (in
Session.php)
+Minor bug fixing and optimization

NOTE: To play this version of the game, you need to reinstall the server
OR you can simply add these lines of code into your "config.php" file:

// ***** Natars Spawn Time
define("NATARS_SPAWN_TIME",260);
define("NATARS_WW_SPAWN_TIME",260);
define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",260);

// ***** Oasis production
define("OASIS_WOOD_MULTIPLIER",40);
define("OASIS_CLAY_MULTIPLIER",40);
define("OASIS_IRON_MULTIPLIER",40);
define("OASIS_CROP_MULTIPLIER",40);
define("OASIS_WOOD_PRODUCTION",OASIS_WOOD_MULTIPLIER*SPEED);
define("OASIS_CLAY_PRODUCTION",OASIS_CLAY_MULTIPLIER*SPEED);
define("OASIS_IRON_PRODUCTION",OASIS_IRON_MULTIPLIER*SPEED);
define("OASIS_CROP_PRODUCTION",OASIS_CROP_MULTIPLIER*SPEED);

P.S: from the next version, the possibility to add manual WWs, WW
building plans and to create the natar account will be REMOVED.
This commit is contained in:
iopietro
2018-05-10 17:45:27 +02:00
parent ec63b04587
commit 90221cf19f
40 changed files with 1222 additions and 1236 deletions
+65 -99
View File
@@ -6,22 +6,6 @@
</thead>
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
/*-------------------------------------------------------*\
| ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* |
+---------------------------------------------------------+
@@ -31,69 +15,63 @@
\*-------------------------------------------------------*/
// check if there is a hero in revive already
$reviving = false;
$training = false;
$reviving = $training = false;
foreach ($heroes as $hero_datarow) {
if ($hero_datarow['inrevive']) {
$reviving = true;
}
if ($hero_datarow['intraining']) {
$training = true;
}
if ($hero_datarow['inrevive']) $reviving = true;
if ($hero_datarow['intraining']) $training = true;
}
foreach ($heroes as $hero_datarow) {
if($hero_datarow['unit'] == 1) {
$name = U1;
} else if($hero_datarow['unit'] == 2) {
$name = U2;
} else if($hero_datarow['unit'] == 3) {
$name = U3;
} else if($hero_datarow['unit'] == 5) {
$name = U5;
} else if($hero_datarow['unit'] == 6) {
$name = U6;
} else if($hero_datarow['unit'] == 11) {
$name = U11;
} else if($hero_datarow['unit'] == 12) {
$name = U12;
} else if($hero_datarow['unit'] == 13) {
$name = U13;
} else if($hero_datarow['unit'] == 15) {
$name = U15;
} else if($hero_datarow['unit'] == 16) {
$name = U16;
} else if($hero_datarow['unit'] == 21) {
$name = U21;
} else if($hero_datarow['unit'] == 22) {
$name = U22;
} else if($hero_datarow['unit'] == 24) {
$name = U24;
} else if($hero_datarow['unit'] == 25) {
$name = U25;
} else if($hero_datarow['unit'] == 26) {
$name = U26;
}
if($hero_datarow['level'] <= 60){
$wood = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['crop']);
$timeToTrain = round((${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}else{
$wood = (${'h'.$hero_datarow['unit'].'_full'}[60]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[60]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[60]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[60]['crop']);
$timeToTrain = round((${'h'.$hero_datarow['unit'].'_full'}[60]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}
if($hero_datarow['unit'] == 1){
$name = U1;
}else if($hero_datarow['unit'] == 2){
$name = U2;
}else if($hero_datarow['unit'] == 3){
$name = U3;
}else if($hero_datarow['unit'] == 5){
$name = U5;
}else if($hero_datarow['unit'] == 6){
$name = U6;
}else if($hero_datarow['unit'] == 11){
$name = U11;
}else if($hero_datarow['unit'] == 12){
$name = U12;
}else if($hero_datarow['unit'] == 13){
$name = U13;
}else if($hero_datarow['unit'] == 15){
$name = U15;
}else if($hero_datarow['unit'] == 16){
$name = U16;
}else if($hero_datarow['unit'] == 21){
$name = U21;
}else if($hero_datarow['unit'] == 22){
$name = U22;
}else if($hero_datarow['unit'] == 24){
$name = U24;
}else if($hero_datarow['unit'] == 25){
$name = U25;
}else if($hero_datarow['unit'] == 26){
$name = U26;
}
if($hero_datarow['level'] <= 60){
$wood = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['crop']);
$timeToTrain = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['time']) / SPEED);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}else{
$wood = (${'h'.$hero_datarow['unit'].'_full'}[60]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[60]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[60]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[60]['crop']);
$timeToTrain = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, (${'h'.$hero_datarow['unit'].'_full'}[60]['time']) / SPEED);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}
if($hero_datarow['inrevive'] == 1) {
$timeleft = $generator->getTimeFormat($hero_datarow['trainingtime'] - time());
@@ -101,7 +79,7 @@
<table id="distribution" cellpadding="1" cellspacing="1">
<thead>
<tr>
<?php echo "<tr class='next'><th>".HERO_READY." <span id=timer1>" . $timeleft . "</span></th></tr>"; ?>
<?php echo "<tr class='next'><th>".HERO_READY." <span id=timer".++$session->timer.">".$timeleft."</span></th></tr>"; ?>
</tr>
</thead>
@@ -117,12 +95,12 @@
</tr>
</table>
<?php }else if (!$reviving) { if($hero_datarow['unit'] == 1 OR 11 OR 21){ ?>
<?php }else if (!$reviving) if(in_array($hero_datarow['unit'], [1, 11, 21])){ ?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $hero_datarow['unit']; ?>" src="img/x.gif" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
<?php echo $name . " (Level " . $hero_datarow['level'] . ")"; ?>
<?php echo $name." (Level ".$hero_datarow['level'].")"; ?>
</div>
<div class="details">
<img class="r1" src="img/x.gif" alt="Wood" title="<?php echo LUMBER; ?>" /><?php echo $wood; ?>|
@@ -142,15 +120,15 @@
</div>
</td>
<td class="val" width="20%"><center>
<td class="val" width="20%" style="text-align: center">
<?php
if($village->awood < $wood OR $village->aclay < $clay OR $village->airon < $iron OR $village->acrop < $crop) {
if($village->awood < $wood || $village->aclay < $clay || $village->airon < $iron || $village->acrop < $crop) {
echo "<span class=\"none\">".NOT."".ENOUGH_RESOURCES."</span>";
}else {
echo "<a href=\"build.php?id=".$id."&amp;revive=1&amp;hid=".$hero_datarow['heroid']."\">".REVIVE."</a>";
}
?></center></td>
?></td>
</tr>
<?php }else { ?>
@@ -160,7 +138,7 @@
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $hero_datarow['unit']; ?>" src="img/x.gif" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
<?php echo $name . " (Level " . $hero_datarow['level'] . ")"; ?>
<?php echo $name." (Level ".$hero_datarow['level'].")"; ?>
</div>
<div class="details">
<img class="r1" src="img/x.gif" alt="Wood" title="<?php echo LUMBER; ?>" /><?php echo $wood; ?>|
@@ -180,16 +158,16 @@
</div>
</td>
<td class="val" width="20%"><center>
<td class="val" width="20%" style="text-align: center">
<?php
if($village->awood < $wood OR $village->aclay < $clay OR $village->airon < $iron OR $village->acrop < $crop) {
if($village->awood < $wood || $village->aclay < $clay || $village->airon < $iron || $village->acrop < $crop) {
echo "<span class=\"none\">".NOT."".ENOUGH_RESOURCES."</span>";
}else {
echo "<a href=\"build.php?id=".$id."&amp;revive=1&amp;hid=".$hero_datarow['heroid']."\">".REVIVE."</a>";
}
?>
</center></td>
</td>
</tr>
<?php }
}
@@ -198,15 +176,7 @@
if(isset($_GET['revive']) && $_GET['revive'] == 1 && isset($_GET['hid']) && $_GET['hid'] == $hero_datarow['heroid'] && $hero_datarow['inrevive'] == 0 && $hero_datarow['intraining'] == 0 && $hero_datarow['dead'] == 1){
if($session->access != BANNED){
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."hero SET `inrevive` = '1', `trainingtime` = '".(int) $training_time2."', `wref` = '".(int) $village->wid."' WHERE `heroid` = ".(int) $_GET['hid']." AND `uid` = '".(int) $session->uid."'");
mysqli_query($database->dblink,"
UPDATE " . TB_PREFIX . "vdata
SET
`wood` = `wood` - ".(int) $wood.",
`clay` = `clay` - ".(int) $clay.",
`iron` = `iron` - ".(int) $iron .",
`crop` = `crop` - ".(int) $crop."
WHERE
`wref` = '" . (int) $village->wid . "'");
$database->modifyResource($village->wid, $wood, $clay, $iron, $crop, 0);
header("Location: build.php?id=".$id."");
exit;
} else {
@@ -214,15 +184,11 @@
exit;
}
}
}
?>
</table>
</table><br />
<?php
if(!$reviving && !$training) {
include ("37_train.tpl");
}
if(!$reviving && !$training) include ("37_train.tpl");
?>