feature(rally-point): mark incoming attacks + show per-troop travel time [#245] (#248)

This commit is contained in:
Ferywir
2026-06-22 05:54:41 +02:00
committed by GitHub
parent afbba3f841
commit f581add125
7 changed files with 86 additions and 4 deletions
+19 -2
View File
@@ -5895,7 +5895,7 @@ $q = "INSERT INTO ".TB_PREFIX."demolition VALUES (
$pairs[] = '(0, '.(int) $typeValue.', '.(int) $from[$index].', '.(int) $to[$index].', '.(int) $ref[$index].', '.(int) $ref2[$index].', '.(int) $time[$index].', '.(int) $endtime[$index].', 0, '.(int) $send[$index].', '.(int) $wood[$index].', '.(int) $clay[$index].', '.(int) $iron[$index].', '.(int) $crop[$index].')';
if ($counter++ > 25) {
$q = "INSERT INTO " . TB_PREFIX . "movement VALUES ".implode(', ', $pairs);
$q = "INSERT INTO " . TB_PREFIX . "movement (moveid, sort_type, `from`, `to`, ref, ref2, starttime, endtime, proc, send, wood, clay, iron, crop) VALUES ".implode(', ', $pairs);
mysqli_query($this->dblink,$q);
$pairs = [];
@@ -5904,7 +5904,7 @@ $q = "INSERT INTO ".TB_PREFIX."demolition VALUES (
}
if ($counter > 0) {
$q = "INSERT INTO " . TB_PREFIX . "movement VALUES " . implode( ', ', $pairs );
$q = "INSERT INTO " . TB_PREFIX . "movement (moveid, sort_type, `from`, `to`, ref, ref2, starttime, endtime, proc, send, wood, clay, iron, crop) VALUES " . implode( ', ', $pairs );
return mysqli_query( $this->dblink, $q );
} else {
return true;
@@ -8039,6 +8039,23 @@ $q = "INSERT INTO ".TB_PREFIX."demolition VALUES (
return $array;
}
// Rally-point attack marker (issue #245): a defender can tag an incoming
// attack green/yellow/red. The WHERE clause restricts the update to a
// movement whose target village (`to`) belongs to $uid, so a player can
// only mark attacks incoming on their own villages.
function setMovementMarker($moveid, $marker, $uid) {
$moveid = (int) $moveid;
$marker = (int) $marker;
$uid = (int) $uid;
if ($marker < 0 || $marker > 3 || $moveid <= 0 || $uid <= 0) {
return false;
}
$q = "UPDATE ".TB_PREFIX."movement SET marker = ".$marker.
" WHERE moveid = ".$moveid.
" AND `to` IN (SELECT wref FROM ".TB_PREFIX."vdata WHERE owner = ".$uid.")";
return mysqli_query($this->dblink, $q) && mysqli_affected_rows($this->dblink) > 0;
}
// no need to cache this method
function getLinks($id) {
list($id) = $this->escape_input((int) $id);
+1
View File
@@ -805,6 +805,7 @@ tz_def('RETURNFROM', 'Return from');
tz_def('REINFORCEMENTFOR', 'Reinforcement to');
tz_def('ATTACK_ON', 'Attack to');
tz_def('RAID_ON', 'Raid to');
tz_def('MARK_ATTACK', 'Mark this attack (severity)');
tz_def('SCOUTING', 'Scouting');
tz_def('PRISONERS', 'Prisoners');
tz_def('PRISONERSIN', 'Prisoners in');
+1
View File
@@ -801,6 +801,7 @@ define('RETURNFROM', 'Retour de');
define('REINFORCEMENTFOR', 'Renfort vers');
define('ATTACK_ON', 'Attaque sur');
define('RAID_ON', 'Pillage sur');
define('MARK_ATTACK', 'Marquer cette attaque (gravité)');
define('SCOUTING', 'Espionnage');
define('PRISONERS', 'Prisonniers');
define('PRISONERSIN', 'Prisonniers à');
+1
View File
@@ -801,6 +801,7 @@ define('RETURNFROM', 'Întoarcere din');
define('REINFORCEMENTFOR', 'Întărire către');
define('ATTACK_ON', 'Atac către');
define('RAID_ON', 'Raid către');
define('MARK_ATTACK', 'Marchează acest atac (gravitate)');
define('SCOUTING', 'Explorare');
define('PRISONERS', 'Prizonieri');
define('PRISONERSIN', 'Prizonieri în');