mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-30 09:34:28 +00:00
more updates
This commit is contained in:
+33
-1
@@ -362,7 +362,15 @@
|
||||
$database->deleteAlliPermissions($post['a_user']);
|
||||
$database->deleteAlliance($session->alliance);
|
||||
// log the notice
|
||||
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $UserData['id'] . '">' . $UserData['username'] . '</a> has quit the alliance.');
|
||||
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $UserData['id'] . '">' . addslashes($post['a_user']) . '</a> has quit the alliance.');
|
||||
if($database->isAllianceOwner($UserData['id'])){
|
||||
$newowner = $database->getAllMember2($session->alliance);
|
||||
$newleader = $newowner['id'];
|
||||
$q = "UPDATE " . TB_PREFIX . "alidata set leader = ".$newleader." where id = ".$session->alliance."";
|
||||
$database->query($q);
|
||||
$database->updateAlliPermissions($newleader, 1, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
$this->updateMax($newleader);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
@@ -400,6 +408,7 @@
|
||||
$q = "UPDATE " . TB_PREFIX . "alidata set leader = ".$newleader." where id = ".$session->alliance."";
|
||||
$database->query($q);
|
||||
$database->updateAlliPermissions($newleader, 1, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
$this->updateMax($newleader);
|
||||
}
|
||||
$database->deleteAlliPermissions($session->uid);
|
||||
// log the notice
|
||||
@@ -448,6 +457,29 @@
|
||||
header("Location: banned.php");
|
||||
}
|
||||
}
|
||||
|
||||
private function updateMax($leader) {
|
||||
global $bid18, $database;
|
||||
$q = mysql_query("SELECT * FROM " . TB_PREFIX . "alidata where leader = $leader");
|
||||
if(mysql_num_rows($q) > 0){
|
||||
$villages = $database->getVillagesID2($leader);
|
||||
$max = 0;
|
||||
foreach($villages as $village){
|
||||
$field = $database->getResourceLevel($village['wref']);
|
||||
for($i=19;$i<=40;$i++){
|
||||
if($field['f'.$i.'t'] == 18){
|
||||
$level = $field['f'.$i];
|
||||
$attri = $bid18[$level]['attri'];
|
||||
}
|
||||
}
|
||||
if($attri > $max){
|
||||
$max = $attri;
|
||||
}
|
||||
}
|
||||
$q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $leader";
|
||||
$database->query($q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$alliance = new Alliance;
|
||||
|
||||
+34
-10
@@ -208,7 +208,7 @@ class Automation {
|
||||
$this->updateStore();
|
||||
$this->CheckBan();
|
||||
$this->regenerateOasisTroops();
|
||||
$this->updateMax();
|
||||
|
||||
$this->artefactOfTheFool();
|
||||
}
|
||||
|
||||
@@ -413,6 +413,7 @@ class Automation {
|
||||
$q = "UPDATE " . TB_PREFIX . "alidata set leader = ".$newleader." where id = ".$alliance."";
|
||||
$database->query($q);
|
||||
$database->updateAlliPermissions($newleader, $alliance, "Leader", 1, 1, 1, 1, 1, 1, 1);
|
||||
$this->updateMax($newleader);
|
||||
}
|
||||
$database->deleteAlliance($alliance);
|
||||
$q = "DELETE FROM ".TB_PREFIX."hero where uid = ".$need['uid'];
|
||||
@@ -660,7 +661,11 @@ class Automation {
|
||||
}
|
||||
$database->setVillageField($indi['wid'],"maxcrop",$max);
|
||||
}
|
||||
|
||||
|
||||
if($indi['type'] == 18){
|
||||
$this->updateMax($database->getVillageField($indi['wid'],"owner"));
|
||||
}
|
||||
|
||||
if($indi['type'] == 38) {
|
||||
$max=$database->getVillageField($indi['wid'],"maxstore");
|
||||
if($level=='1' && $max==STORAGE_BASE){ $max=STORAGE_BASE; }
|
||||
@@ -1915,6 +1920,9 @@ class Automation {
|
||||
$q = "UPDATE ".TB_PREFIX."vdata SET `maxcrop`='".$tmaxcrop."'*32 WHERE wref=".$data['to'];
|
||||
$database->query($q);
|
||||
}
|
||||
if ($tbgid==18){
|
||||
$this->updateMax($database->getVillageField($data['to'],'owner'));
|
||||
}
|
||||
$pop=$this->recountPop($data['to']);
|
||||
$capital = $database->getVillage($data['to']);
|
||||
if($pop=='0' && $capital['capital']=='0')
|
||||
@@ -1952,6 +1960,9 @@ class Automation {
|
||||
$q = "UPDATE ".TB_PREFIX."vdata SET `maxcrop`='".$tmaxcrop."' WHERE wref=".$data['to'];
|
||||
$database->query($q);
|
||||
}
|
||||
if ($tbgid==18){
|
||||
$this->updateMax($database->getVillageField($data['to'],'owner'));
|
||||
}
|
||||
$pop=$this->recountPop($data['to']);
|
||||
}
|
||||
$info_cat = "".$catp_pic.",".$this->procResType($tbgid).$info_cata;
|
||||
@@ -2040,6 +2051,9 @@ class Automation {
|
||||
$q = "UPDATE ".TB_PREFIX."vdata SET `maxcrop`='".$tmaxcrop."' WHERE wref=".$data['to'];
|
||||
$database->query($q);
|
||||
}
|
||||
if ($tbgid==18){
|
||||
$this->updateMax($database->getVillageField($data['to'],'owner'));
|
||||
}
|
||||
$pop=$this->recountPop($data['to']);
|
||||
if($pop=='0')
|
||||
{
|
||||
@@ -2079,6 +2093,9 @@ class Automation {
|
||||
$q = "UPDATE ".TB_PREFIX."vdata SET `maxcrop`='".$tmaxcrop."' WHERE wref=".$data['to'];
|
||||
$database->query($q);
|
||||
}
|
||||
if ($tbgid==18){
|
||||
$this->updateMax($database->getVillageField($data['to'],'owner'));
|
||||
}
|
||||
$pop=$this->recountPop($data['to']);
|
||||
}
|
||||
$info_cat = "".$catp_pic.",".$this->procResType($tbgid).$info_cata;
|
||||
@@ -2165,6 +2182,9 @@ class Automation {
|
||||
$q = "UPDATE ".TB_PREFIX."vdata SET `maxcrop`='".$tmaxcrop."' WHERE wref=".$data['to'];
|
||||
$database->query($q);
|
||||
}
|
||||
if ($tbgid==18){
|
||||
$this->updateMax($database->getVillageField($data['to'],'owner'));
|
||||
}
|
||||
$pop=$this->recountPop($data['to']);
|
||||
if($pop=='0')
|
||||
{
|
||||
@@ -2205,6 +2225,9 @@ class Automation {
|
||||
$q = "UPDATE ".TB_PREFIX."vdata SET `maxcrop`='".$tmaxcrop."' WHERE wref=".$data['to'];
|
||||
$database->query($q);
|
||||
}
|
||||
if ($tbgid==18){
|
||||
$this->updateMax($database->getVillageField($data['to'],'owner'));
|
||||
}
|
||||
$pop=$this->recountPop($data['to']);
|
||||
}
|
||||
|
||||
@@ -3800,6 +3823,9 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
||||
$q = "UPDATE ".TB_PREFIX."vdata SET `maxcrop`=800 WHERE `maxcrop`<=800 AND wref=".$vil['vref'];
|
||||
$database->query($q);
|
||||
}
|
||||
if ($type==18){
|
||||
$this->updateMax($database->getVillageField($vil['vref'],'owner'));
|
||||
}
|
||||
if ($level==1) { $clear=",f".$vil['buildnumber']."t=0"; } else { $clear=""; }
|
||||
$q = "UPDATE ".TB_PREFIX."fdata SET f".$vil['buildnumber']."=".($level-1).$clear." WHERE vref=".$vil['vref'];
|
||||
$database->query($q);
|
||||
@@ -4260,13 +4286,11 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
||||
}
|
||||
}
|
||||
|
||||
private function updateMax() {
|
||||
private function updateMax($leader) {
|
||||
global $bid18, $database;
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "alidata where leader != 0";
|
||||
$array = $database->query_return($q);
|
||||
foreach($array as $ally) {
|
||||
$owner = $ally['leader'];
|
||||
$villages = $database->getVillagesID2($owner);
|
||||
$q = mysql_query("SELECT * FROM " . TB_PREFIX . "alidata where leader = $leader");
|
||||
if(mysql_num_rows($q) > 0){
|
||||
$villages = $database->getVillagesID2($leader);
|
||||
$max = 0;
|
||||
foreach($villages as $village){
|
||||
$field = $database->getResourceLevel($village['wref']);
|
||||
@@ -4276,11 +4300,11 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
|
||||
$attri = $bid18[$level]['attri'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($attri > $max){
|
||||
$max = $attri;
|
||||
}
|
||||
$q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $owner";
|
||||
}
|
||||
$q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $leader";
|
||||
$database->query($q);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user