Fixed some report bugs

+Added the report type 23, which indicates a defence during festive days
+Festive reports in the alliance no longer duplicates
+Festive reports in the village view no longer duplicates
+Fixed a bug that didn't permit to read an allied report

General:
-Removed the possibility to view an inexistent village
+Some minor improovements
This commit is contained in:
iopietro
2018-04-21 17:28:20 +02:00
parent 65f7ad1721
commit 996f011666
9 changed files with 92 additions and 87 deletions
+8 -9
View File
@@ -3075,8 +3075,9 @@ class Automation {
$database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],$AttackArrivalTime,$endtime);
$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());
$time = time();
$database->addNotice($from['owner'], $to['wref'], $ownally, 22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'', $data2, $time);
$database->addNotice($to['owner'], $to['wref'], $targetally, 23,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'', $data2, $time);
}
//check if not natar tribe
@@ -3768,29 +3769,26 @@ class Automation {
}
private function updateRes($bountywid,$uid) {
global $session;
$this->bountyLoadTown($bountywid);
$this->bountycalculateProduction($bountywid,$uid);
$this->bountyprocessProduction($bountywid);
}
private function updateORes($bountywid) {
global $session;
$this->bountyLoadOTown($bountywid);
$this->bountycalculateOProduction($bountywid);
$this->bountyprocessOProduction($bountywid);
}
private function bountyLoadOTown($bountywid) {
global $database,$session,$logging,$technology;
global $database;
$this->bountyinfoarray = $database->getOasisV($bountywid);
$this->bountyresarray = $database->getResourceLevel($bountywid);
$this->bountypop = 2;
}
private function bountyLoadTown($bountywid) {
global $database,$session,$logging,$technology;
global $database;
$this->bountyinfoarray = $database->getVillage($bountywid);
$this->bountyresarray = $database->getResourceLevel($bountywid);
$this->bountyoasisowned = $database->getOasis($bountywid);
@@ -4802,7 +4800,7 @@ class Automation {
/************************************************
Function for starvation - by brainiacX and Shadow
Rework by ronix
Refacored by iopietro
Refactored by iopietro
References:
************************************************/
@@ -5017,6 +5015,7 @@ class Automation {
/************************************************
Function for starvation - by brainiacX and Shadow
Rework by ronix
Refactored by iopietro
References:
************************************************/
+3 -3
View File
@@ -4270,7 +4270,7 @@ References: User ID/Message ID, Mode
return self::$noticesCacheById[$id][$field];
}
function getNotice3($uid, $use_cache = true) {
function getNotice3($uid, $alliance, $use_cache = true) {
list($uid) = $this->escape_input((int) $uid);
// first of all, check if we should be using cache and whether the field
@@ -4279,8 +4279,8 @@ References: User ID/Message ID, Mode
return $cachedValue;
}
$q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC');
$result = mysqli_query($this->dblink,$q);
$q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid ".($alliance > 0 ? 'OR ally = '.$alliance.'' : '')." ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC');
$result = mysqli_query($this->dblink,$q);
$noticesCacheByUId[$uid] = $this->mysqli_fetch_all($result);
return $noticesCacheByUId[$uid];
+8 -6
View File
@@ -116,7 +116,7 @@ class Message {
}
if (!is_array($type)) { $type = array($type); }
$this->noticearray = $this->filter_by_value($database->getNotice($session->uid), "ntype", $type);
$this->notice = $this->filter_by_value($database->getNotice3($session->uid), "ntype", $type);
$this->notice = $this->filter_by_value($database->getNotice3($session->uid, $session->alliance), "ntype", $type);
}
if(isset($get['id'])) {
$this->readingNotice = $this->getReadNotice($get['id']);
@@ -228,7 +228,7 @@ class Message {
private function getNotice() {
global $database, $session;
$this->allNotice = $database->getNotice3($session->uid);
$this->allNotice = $database->getNotice3($session->uid, $session->alliance);
$this->noticearray = $this->filter_by_value_except($database->getNotice($session->uid), "ntype", 9);
$this->notice = $this->filter_by_value_except($this->allNotice, "ntype", 9);
$this->totalNotice = count($this->allNotice);
@@ -354,10 +354,10 @@ class Message {
}
private function getReadNotice($id) {
global $database;
global $database, $session;
foreach($this->allNotice as $notice) {
if($notice['id'] == $id) {
$database->noticeViewed($notice['id']);
if($notice['id'] == $id) {
if($notice['uid'] == $session->uid) $database->noticeViewed($notice['id']);
return $notice;
}
}
@@ -391,7 +391,9 @@ class Message {
case 16:
case 17: return 15;
case 19: return 3;
case 19: return 3;
case 23: return 22;
}
return $type;