catching up (#4)

* fix: all languages added to installer

* fix: all languages added to installer and Admin

* fix: max crop/resources reset to level 1 value temporarily

This happened when level 1 granary / warehouse was built because of
a missing + sign in a formula.

#374

* chore: some more badges and thanks to JetBrains :)

* chore: one more badge :P

* chore: cleanup

* fix: Multihunter should have access to villages info

* fix: troops duplicate for certain tribes via raid lists

* fix: no need for WW Building Plan to start building a WW

#337

* fix: natar WW villages created without units

#392

* fix: sendunits.txt file could not be opened from Admin

* fix: WW villages created via Admin do not have any units

#392

* fix: WW building plans must be in player's village to start building WW

#337

* fix: hero training and revival misbehaving

* fix: spending hero points subtracts these from all player's heroes

#341

* fix: 2nd row of catapults firing when not allowed

#393

* fix: 2nd wave of catapults destroys targets and villages incorrectly

#393

* fix: adding new village via Admin generates incorrect fields

* chore: create default users with bcrypt enabled by default

* fix: in-game Support login fails

* fix: wrong password verify check allows for any login
This commit is contained in:
Martin Ambrus
2017-12-01 19:57:57 +01:00
committed by GitHub
parent 23c0f4f8f7
commit a321906d41
10 changed files with 166 additions and 126 deletions
+2
View File
@@ -218,6 +218,8 @@ class Account {
if ( $activateData != "" ) {
$form->addError( "activate", $_POST['user'] );
} else {
$form->addError("pw",LOGIN_PW_ERROR);
}
} else {
$form->addError("pw",LOGIN_PW_ERROR);
+1 -1
View File
@@ -181,7 +181,7 @@ class adm_DB {
$username = $database->getUserArray($uid,1);
$username = $username['username'];
$database->addVillage($wid,$uid,$username,'0');
$database->addResourceFields($wid,$database->getVillageType($wid));
$database->addResourceFields($wid,$database->getVillageType($wid, false));
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
+56 -40
View File
@@ -1090,8 +1090,8 @@ class Automation {
}
// oasis cannot be destroyed
$pop=$this->recountPop($data['to'], false);
if ($isoasis == 0) {
$pop=$this->recountPop($data['to'], false);
if($pop==0 && $can_destroy==1){
$village_destroyed = 1;
// this will ensure the right $info_cat text
@@ -2267,6 +2267,9 @@ class Automation {
else
{
// village stands, let's do the damage
/**
* FIRST CATAPULTS ROW
*/
$basearray = $data['to'];
$bdo = $database->getResourceLevel($basearray, false);
$catapultTarget = $data['ctar1'];
@@ -2277,15 +2280,12 @@ class Automation {
$catapults2TargetRandom = ($catapults2WillNotShoot || $catapultTarget2 == 99);
// we're manually targetting 1st and/or 2nd row of catapults
if (!$catapults1TargetRandom || !$catapults2TargetRandom)
if (!$catapults1TargetRandom)
{
$_catapultsTarget1Levels=array();
$__catapultsTarget1AltTargets=array();
$_catapultsTarget2Levels=array();
$__catapultsTarget2AltTargets=array();
// calculate targets for 1st and 2nd rows of catapults
// calculate targets for 1st rows of catapults
$j=0;
for ($i=1;$i<=41;$i++)
{
@@ -2298,13 +2298,6 @@ class Automation {
$_catapultsTarget1Levels[$j]=$bdo['f'.$i];
$__catapultsTarget1AltTargets[$j]=$i;
}
// 2nd row of catapults pre-selected target calculations, if needed
if (!$catapults2TargetRandom && !$catapults2WillNotShoot && $bdo['f'.$i.'t'] == $catapultTarget2 && $bdo['f'.$i] > 0 && $catapultTarget2 != 31 && $catapultTarget2 != 32 && $catapultTarget2 != 33)
{
$_catapultsTarget2Levels[$j]=$bdo['f'.$i];
$__catapultsTarget2AltTargets[$j]=$i;
}
}
// if we couldn't find a suitable target for 1st row of catapults,
@@ -2321,6 +2314,54 @@ class Automation {
$catapults1TargetRandom = true;
}
}
}
// 1st row of catapults set to target randomly
if ($catapults1TargetRandom)
{
$list=array();
for ($i=1;$i<=41;$i++)
{
if ($i==41) $i=99;
if ($bdo['f'.$i] > 0 && $catapultTarget != 31 && $catapultTarget != 32 && $catapultTarget != 33)
{
$list[]=$i;
}
}
$catapultTarget = $list[ rand(0, count($list) - 1) ];
}
/**
* resolve 1st row of catapults
*/
$village_destroyed = 0;
$this->resolveCatapultsDestruction($bdo, $battlepart, $info_cat, $data, $catapultTarget, !$catapults2WillNotShoot, false, $catp_pic, $can_destroy, $isoasis, $village_destroyed);
/**
* SECOND CATAPULTS ROW
*/
// reload resource levels, since they've changed now
$bdo = $database->getResourceLevel($basearray, false);
// we're manually targetting 2nd row of catapults
if (!$catapults2TargetRandom)
{
$_catapultsTarget2Levels=array();
$__catapultsTarget2AltTargets=array();
// calculate targets for 2nd rows of catapults
$j=0;
for ($i=1;$i<=41;$i++)
{
if ($i==41) $i=99;
// 2nd row of catapults pre-selected target calculations, if needed
if (!$catapults2TargetRandom && !$catapults2WillNotShoot && $bdo['f'.$i.'t'] == $catapultTarget2 && $bdo['f'.$i] > 0 && $catapultTarget2 != 31 && $catapultTarget2 != 32 && $catapultTarget2 != 33)
{
$_catapultsTarget2Levels[$j]=$bdo['f'.$i];
$__catapultsTarget2AltTargets[$j]=$i;
}
}
// if we couldn't find a suitable target for 2nd row of catapults,
// select a random target instead
@@ -2338,46 +2379,21 @@ class Automation {
}
}
// 1st row of catapults set to target randomly
if ($catapults1TargetRandom)
{
$list=array();
$j = 1;
for ($i=1;$i<=41;$i++)
{
if ($i==41) $i=99;
if ($bdo['f'.$i] > 0 && $catapultTarget != 31 && $catapultTarget != 32 && $catapultTarget != 33)
{
$list[$j]=$i;
$j++;
}
}
$catapultTarget = $list[ rand(1, $j - 1) ];
}
// 2nd row of catapults set to target randomly
if ($catapults2TargetRandom && !$catapults2WillNotShoot)
{
$list=array();
$j=1;
for ($i=1;$i<=41;$i++)
{
if ($i==41) $i=99;
if ($bdo['f'.$i] > 0)
{
$j++;
$list[$j]=$i;
$list[]=$i;
}
}
$catapultTarget2 = $list[ rand(1, $j - 1) ];
$catapultTarget2 = $list[ rand(0, count($list) - 1) ];
}
/**
* resolve 1st row of catapults
*/
$village_destroyed = 0;
$this->resolveCatapultsDestruction($bdo, $battlepart, $info_cat, $data, $catapultTarget, !$catapults2WillNotShoot, false, $catp_pic, $can_destroy, $isoasis, $village_destroyed);
/**
* resolve 2nd row of catapults
*/
+1 -1
View File
@@ -5535,7 +5535,7 @@ References: User ID/Message ID, Mode
$t11 = [$t11];
$type = [$type];
$ctar1 = [$ctar1];
$ctar2 = [$ctar1];
$ctar2 = [$ctar2];
$spy = [$spy];
$b1 = [$b1];
$b2 = [$b2];
+4 -2
View File
@@ -180,7 +180,7 @@ class Session {
if($user && ($admin || isset($_SESSION['sessid']))) {
// check if this is not a support user, for who only messages and statistics are available
if ($user == 1) {
if ($user == 'Support') {
$req_file = basename($_SERVER['PHP_SELF']);
if (!in_array($req_file, ['nachrichten.php', 'logout.php', 'statistiken.php', 'rules.php', 'karte.php', 'karte2.php', 'spieler.php'])) {
header('Location:nachrichten.php');
@@ -269,7 +269,9 @@ class Session {
if($this->userarray['b4'] > $this->time) {
$this->bonus4 = 1;
}
$this->CheckHeroReal();
if (!in_array($this->username, ['Support', 'Multihunter'])) {
$this->CheckHeroReal();
}
}
private function SurfControl(){