mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
General fixes
+Fixed some errors in Automation.php +Some clean up in the alliance templates directory
This commit is contained in:
+53
-45
@@ -5041,7 +5041,7 @@ class Automation {
|
||||
foreach($array as $user){
|
||||
$newrank = $ranking->getUserRank($user['id']);
|
||||
if($week > 1){
|
||||
for($i=$newrank+1;$i<count($climbers);$i++) {
|
||||
for($i = $newrank + 1; $i < count($climbers); $i++) {
|
||||
if(isset($climbers[$i]['userid'])){
|
||||
$oldrank = $ranking->getUserRank($climbers[$i]['userid']);
|
||||
$totalpoints = $oldrank - $climbers[$i]['oldrank'];
|
||||
@@ -5054,7 +5054,7 @@ class Automation {
|
||||
$totalpoints = count($climbers) - $newrank;
|
||||
$database->setclimberrankpop($user['id'], $totalpoints);
|
||||
$database->updateoldrank($user['id'], $newrank);
|
||||
for($i=1;$i<$newrank;$i++){
|
||||
for($i = 1; $i < $newrank; $i++){
|
||||
if(isset($climbers[$i]['userid'])){
|
||||
$oldrank = $ranking->getUserRank($climbers[$i]['userid']);
|
||||
$totalpoints = count($climbers) - $oldrank;
|
||||
@@ -5062,7 +5062,7 @@ class Automation {
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
}
|
||||
}
|
||||
for($i=$newrank+1;$i<count($climbers);$i++){
|
||||
for($i = $newrank + 1; $i < count($climbers); $i++){
|
||||
if(isset($climbers[$i]['userid'])){
|
||||
$oldrank = $ranking->getUserRank($climbers[$i]['userid']);
|
||||
$totalpoints = count($climbers) - $oldrank;
|
||||
@@ -5086,56 +5086,64 @@ class Automation {
|
||||
$q = "SELECT week FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
if(mysqli_num_rows($result)) {
|
||||
$row=mysqli_fetch_assoc($result);
|
||||
$week=($row['week']+1);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$week = ($row['week'] + 1);
|
||||
} else {
|
||||
$week='1';
|
||||
$week = 1;
|
||||
}
|
||||
$myrank = $ranking->getUserRank($uid);
|
||||
if(isset($climbers[$myrank]['oldrank']) && $climbers[$myrank]['oldrank'] > $myrank){
|
||||
for($i=$myrank+1;$i<=$climbers[$myrank]['oldrank'];$i++) {
|
||||
$oldrank = $ranking->getUserRank($climbers[$i]['userid']);
|
||||
for($i = $myrank + 1; $i <= $climbers[$myrank]['oldrank']; $i++) {
|
||||
if(isset($climbers[$i]['oldrank'])){
|
||||
$oldrank = $ranking->getUserRank($climbers[$i]['userid']);
|
||||
if($week > 1){
|
||||
$totalpoints = $oldrank - $climbers[$i]['oldrank'];
|
||||
$database->removeclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
}else{
|
||||
$totalpoints = count($ranking->getRank()) - $oldrank;
|
||||
$database->setclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($climbers[$myrank]['oldrank'])){
|
||||
if($week > 1){
|
||||
$totalpoints = $oldrank - $climbers[$i]['oldrank'];
|
||||
$database->removeclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
$totalpoints = $climbers[$myrank]['oldrank'] - $myrank;
|
||||
$database->addclimberrankpop($climbers[$myrank]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank]['userid'], $myrank);
|
||||
}else{
|
||||
$totalpoints = count($ranking->getRank()) - $oldrank;
|
||||
$database->setclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
$totalpoints = count($ranking->getRank()) - $myrank;
|
||||
$database->setclimberrankpop($climbers[$myrank]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank]['userid'], $myrank);
|
||||
}
|
||||
}
|
||||
if($week > 1){
|
||||
$totalpoints = $climbers[$myrank]['oldrank'] - $myrank;
|
||||
$database->addclimberrankpop($climbers[$myrank]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank]['userid'], $myrank);
|
||||
}else{
|
||||
$totalpoints = count($ranking->getRank()) - $myrank;
|
||||
$database->setclimberrankpop($climbers[$myrank]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank]['userid'], $myrank);
|
||||
}
|
||||
}
|
||||
}else if(isset($climbers[$myrank]['oldrank']) && $climbers[$myrank]['oldrank'] < $myrank){
|
||||
for($i=$climbers[$myrank]['oldrank'];$i<$myrank;$i++) {
|
||||
$oldrank = $ranking->getUserRank($climbers[$i]['userid']);
|
||||
for($i = $climbers[$myrank]['oldrank']; $i < $myrank; $i++) {
|
||||
if(isset($climbers[$i]['oldrank'])){
|
||||
$oldrank = $ranking->getUserRank($climbers[$i]['userid']);
|
||||
if($week > 1){
|
||||
$totalpoints = $climbers[$i]['oldrank'] - $oldrank;
|
||||
$database->addclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
}else{
|
||||
$totalpoints = count($ranking->getRank()) - $oldrank;
|
||||
$database->setclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($climbers[$myrank-1]['oldrank'])){
|
||||
if($week > 1){
|
||||
$totalpoints = $climbers[$i]['oldrank'] - $oldrank;
|
||||
$database->addclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
$totalpoints = $myrank - $climbers[$myrank-1]['oldrank'];
|
||||
$database->removeclimberrankpop($climbers[$myrank-1]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank-1]['userid'], $myrank);
|
||||
}else{
|
||||
$totalpoints = count($ranking->getRank()) - $oldrank;
|
||||
$database->setclimberrankpop($climbers[$i]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$i]['userid'], $oldrank);
|
||||
$totalpoints = count($ranking->getRank()) - $myrank;
|
||||
$database->setclimberrankpop($climbers[$myrank-1]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank-1]['userid'], $myrank);
|
||||
}
|
||||
}
|
||||
if($week > 1){
|
||||
$totalpoints = $myrank - $climbers[$myrank-1]['oldrank'];
|
||||
$database->removeclimberrankpop($climbers[$myrank-1]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank-1]['userid'], $myrank);
|
||||
}else{
|
||||
$totalpoints = count($ranking->getRank()) - $myrank;
|
||||
$database->setclimberrankpop($climbers[$myrank-1]['userid'], $totalpoints);
|
||||
$database->updateoldrank($climbers[$myrank-1]['userid'], $myrank);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$ranking->procARankArray();
|
||||
@@ -5220,7 +5228,7 @@ class Automation {
|
||||
|
||||
foreach($villages as $village){
|
||||
$field = $database->getResourceLevel($village['wref'], false);
|
||||
for($i=19;$i<=40;$i++){
|
||||
for($i = 19; $i <= 40; $i++){
|
||||
if($field['f'.$i.'t'] == 18){
|
||||
$level = $field['f'.$i];
|
||||
$attri = $bid18[$level]['attri'];
|
||||
@@ -5237,8 +5245,8 @@ class Automation {
|
||||
|
||||
private function checkReviveHero(){
|
||||
global $database,$session;
|
||||
$herodata=$database->getHero($session->uid,1);
|
||||
if ($herodata[0]['dead']==1){
|
||||
$herodata = $database->getHero($session->uid, 1);
|
||||
if ($herodata[0]['dead'] == 1){
|
||||
mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "units SET hero = 0 WHERE vref = ".(int) $session->villages[0]."");
|
||||
}
|
||||
if($herodata[0]['trainingtime'] <= time()) {
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
<?php
|
||||
$sql = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."ndata WHERE ally = ".(int) $session->alliance." AND (ntype != 0 AND ntype < 4 OR ntype > 17 AND ntype != 20 AND ntype != 21) ORDER BY time DESC LIMIT 20");
|
||||
$filterType = $_GET['f'];
|
||||
if($filterType == 31) $sql = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."ndata WHERE ally = ".(int) $session->alliance." AND (ntype != 0 AND ntype < 4 OR ntype > 17 AND ntype != 20 AND ntype != 21) ORDER BY time DESC LIMIT 20");
|
||||
elseif($filterType == 32) $sql = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."ndata WHERE ally = ".(int) $session->alliance." AND (ntype < 1 OR ntype > 3 AND ntype < 8 OR ntype > 19) ORDER BY time DESC LIMIT 20");
|
||||
|
||||
$query = mysqli_num_rows($sql);
|
||||
$outputList = '';
|
||||
$name = 1;
|
||||
if($query == 0) {
|
||||
$outputList .= "<td colspan=\"4\" class=\"none\">There are no reports available.</td>";
|
||||
}else{
|
||||
|
||||
if(!$query) $outputList .= "<td colspan=\"4\" class=\"none\">There are no reports available.</td>";
|
||||
else
|
||||
{
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$dataarray = explode(",",$row['data']);
|
||||
$id = $row["id"];
|
||||
@@ -20,21 +25,20 @@ while($row = mysqli_fetch_array($sql)){
|
||||
|
||||
$outputList .= "<tr>";
|
||||
$outputList .= "<td class=\"sub\">";
|
||||
if($ntype==4 || $ntype==5 || $ntype==6 || $ntype==7){
|
||||
$type2 = '32';
|
||||
}else{
|
||||
$type2 = '31';
|
||||
}
|
||||
|
||||
if($ntype >= 4 && $ntype <= 7) $type2 = 32;
|
||||
else $type2 = 31;
|
||||
|
||||
$outputList .= "<a href=\"allianz.php?s=3&f=".$type2."\">";
|
||||
$type = (isset($_GET['t']) && $_GET['t'] == 5)? $archive : $ntype;
|
||||
if($type==18 or $type==19){
|
||||
if((($type == 18 || $type == 19) && $filterType == 31) || (($type == 20 || $type == 21) && $filterType == 32)){
|
||||
$outputList .= "<img src=\"gpack/travian_default/img/scouts/$type.gif\" title=\"".$topic."\" />";
|
||||
}else{
|
||||
}else{
|
||||
$outputList .= "<img src=\"img/x.gif\" class=\"iReport iReport$type\" title=\"".$topic."\">";
|
||||
}
|
||||
$outputList .= "</a>";
|
||||
$outputList .= "<div><a href=\"berichte.php?id=".$id."&aid=".$ally."\">";
|
||||
if($ntype==0){ $nn = " scouts "; }else{ $nn = " attacks "; }
|
||||
if((($type == 18 || $type == 19) && $filterType == 31) || (($type == 20 || $type == 21) && $filterType == 32)) $nn = " scouts "; else $nn = " attacks ";
|
||||
|
||||
$outputList .= $database->getUserField($dataarray[0], "username", 0);
|
||||
|
||||
@@ -43,12 +47,9 @@ if($ntype==4 || $ntype==5 || $ntype==6 || $ntype==7){
|
||||
$getUserAlly = $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "alliance", 0);
|
||||
$getAllyName = $database->getAllianceName($getUserAlly);
|
||||
|
||||
if($getUserAlly==$session->alliance || !$getUserAlly){
|
||||
$allyName = "-";
|
||||
}else{
|
||||
$allyName = "<a href=\"allianz.php?aid=".$getUserAlly."\">".$getAllyName."</a>";
|
||||
}
|
||||
|
||||
if(!$getUserAlly) $allyName = "-";
|
||||
else $allyName = "<a href=\"allianz.php?aid=".$getUserAlly."\">".$getAllyName."</a>";
|
||||
|
||||
$outputList .= "<td class=\"al\">".$allyName."</td>";
|
||||
$date = $generator->procMtime($time);
|
||||
$outputList .= "<td class=\"dat\">".$date[0]." ".date('H:i',$time)."</td>";
|
||||
@@ -17,18 +17,19 @@ include("alli_menu.tpl");
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
if($_GET['f']==31){
|
||||
include "Templates/Alliance/attack-attacker.tpl";
|
||||
}elseif($_GET['f']==32){
|
||||
include "Templates/Alliance/attack-defender.tpl";
|
||||
}else{
|
||||
if($_GET['f'] == 31 || $_GET['f'] == 32) include "Templates/Alliance/attack-filtered.tpl";
|
||||
else
|
||||
{
|
||||
|
||||
$sql = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."ndata WHERE ally = ".(int) $session->alliance." AND (ntype < 8 OR ntype > 17) ORDER BY time DESC LIMIT 20");
|
||||
$query = mysqli_num_rows($sql);
|
||||
$outputList = '';
|
||||
$name = 1;
|
||||
if($query == 0) {
|
||||
$outputList .= "<td colspan=\"4\" class=\"none\">There are no reports available.</td>";
|
||||
}else{
|
||||
|
||||
if(!$query) $outputList .= "<td colspan=\"4\" class=\"none\">There are no reports available.</td>";
|
||||
else
|
||||
{
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$dataarray = explode(",",$row['data']);
|
||||
$id = $row["id"];
|
||||
@@ -44,27 +45,26 @@ while($row = mysqli_fetch_array($sql)){
|
||||
|
||||
$outputList .= "<tr>";
|
||||
$outputList .= "<td class=\"sub\">";
|
||||
if($ntype==4 || $ntype==5 || $ntype==6 || $ntype==7){
|
||||
$type2 = '32';
|
||||
}else{
|
||||
$type2 = '31';
|
||||
}
|
||||
|
||||
if($ntype >= 4 && $ntype <= 7) $type2 = 32;
|
||||
else $type2 = 31;
|
||||
|
||||
$outputList .= "<a href=\"allianz.php?s=3&f=".$type2."\">";
|
||||
$type = (isset($_GET['t']) && $_GET['t'] == 5)? $archive : $ntype;
|
||||
if($type==18 or $type==19 or $type==20 or $type==21){
|
||||
if($type >= 18 && $type <= 21){
|
||||
$outputList .= "<img src=\"gpack/travian_default/img/scouts/$type.gif\" title=\"".$topic."\" />";
|
||||
}else{
|
||||
$outputList .= "<img src=\"img/x.gif\" class=\"iReport iReport$type\" title=\"".$topic."\">";
|
||||
}
|
||||
$outputList .= "</a>";
|
||||
$outputList .= "<div><a href=\"berichte.php?id=".$id."&aid=".$ally."\">";
|
||||
if($ntype==0){ $nn = " scouts "; }else{ $nn = " attacks "; }
|
||||
if($ntype >= 18 && $ntype <= 21) $nn = " scouts "; else $nn = " attacks ";
|
||||
|
||||
$outputList .= $database->getUserField($dataarray[0], "username", 0);
|
||||
|
||||
$outputList .= $nn;
|
||||
$outputList .= $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "username", 0);
|
||||
if($ntype==0){
|
||||
if($ntype == 0){
|
||||
$isoasis = $database->isVillageOases($toWref);
|
||||
if($isoasis == 0){
|
||||
if($toWref != $village->wid){
|
||||
@@ -80,18 +80,15 @@ if($ntype==4 || $ntype==5 || $ntype==6 || $ntype==7){
|
||||
}
|
||||
}
|
||||
$getUserAlly = $database->getUserField($getUser, "alliance", 0);
|
||||
}else if($ntype==1 or $ntype==2 or $ntype==3 or $ntype==18 or $ntype==19){
|
||||
}else if($ntype == 1 || $ntype == 2 || $ntype == 3 || $ntype == 18 || $ntype == 19){
|
||||
$getUserAlly = $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "alliance", 0);
|
||||
}else{
|
||||
$getUserAlly = $database->getUserField($type != 22 ? $dataarray[28] : $dataarray[2], "alliance", 0);
|
||||
}
|
||||
$getAllyName = $database->getAllianceName($getUserAlly);
|
||||
|
||||
if($getUserAlly==$session->alliance || !$getUserAlly){
|
||||
$allyName = "-";
|
||||
}else{
|
||||
$allyName = "<a href=\"allianz.php?aid=".$getUserAlly."\">".$getAllyName."</a>";
|
||||
}
|
||||
if(!$getUserAlly) $allyName = "-";
|
||||
else $allyName = "<a href=\"allianz.php?aid=".$getUserAlly."\">".$getAllyName."</a>";
|
||||
|
||||
$outputList .= "<td class=\"al\">".$allyName."</td>";
|
||||
$date = $generator->procMtime($time);
|
||||
|
||||
Reference in New Issue
Block a user