Files
novgorodschi catalin e6a3bb7db7 Update log system gold
Update log system gold
2026-05-20 11:55:18 +03:00

47 lines
1.8 KiB
Smarty

<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ (Refactor incremental) ##
## File: 8.tpl ##
## Description: Crop Plus ##
## Made by: alq0rsan ##
## Improved by: evader ##
## Refactor by: Shadow ##
## ##
#################################################################################
if($session->sit == 0) {
$uid = (int)$session->uid;
$wid = (int)$village->wid;
$now = time();
$cost = 5;
$sql = "UPDATE ".TB_PREFIX."users
SET gold = gold - $cost,
b4 = IF(b4 > $now, b4 + ".PLUS_PRODUCTION.", $now + ".PLUS_PRODUCTION.")
WHERE id = $uid AND gold >= $cost";
mysqli_query($database->dblink, $sql);
if(mysqli_affected_rows($database->dblink) == 1) {
$session->gold -= $cost;
$_SESSION['gold'] = $session->gold;
$session->b4 = ($session->b4 > $now ? $session->b4 : $now) + PLUS_PRODUCTION;
// LOG pentru a2b2
mysqli_query($database->dblink,
"INSERT INTO ".TB_PREFIX."gold_fin_log
(uid, wid, action, gold, time, details)
VALUES ($uid, $wid, 'Use 5 gold for +25% Crop', -$cost, $now, '+25% Production: Crop')"
);
if(method_exists($database, 'clearUserCache')) {
$database->clearUserCache($uid);
}
}
}
header("Location: plus.php?id=3");
exit;
?>