- Basically, we reserve the ordered amount of gold immediately after the payment. If there are any problems, please send an email to our
- payment account.
Username Payment Method Ordered Package
- Date and time
We strive to ensure speedy processing!
-
-
-
+ Basically, we reserve the ordered amount of gold immediately after the payment. If there are any problems, please send an email to our
+ payment account.
+ Username Payment Method Ordered Package Date and time
-
-
-
- More Info about PayPal can be found here:
- More Info
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/Templates/Plus/12.tpl b/Templates/Plus/12.tpl
index 2ea41910..19dff784 100644
--- a/Templates/Plus/12.tpl
+++ b/Templates/Plus/12.tpl
@@ -1,28 +1,43 @@
gold >= 5){
- $MyGold = mysqli_query($database->dblink,"SELECT gold, b4 FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- $golds = mysqli_fetch_array($MyGold);
- if($session->sit == 0) {
- if (mysqli_num_rows($MyGold)) {
- if($golds['gold'] >= 5) {
- if($golds['b4'] < time()) {
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set b4 = '".(time()+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- } else {
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set b4 = '".($golds['b4']+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- }
- $done1 = "+25% Production: Crop";
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set gold = ".($session->gold-5)." where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', '+25% Production: Crop')") or die(mysqli_error($database->dblink));
- } else {
- $done1 = "You need more gold";
- }
- } else {
- $done1 = "Failed crop attempt";
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', 'Failed +25% Production: Crop')") or die(mysqli_error($database->dblink));
- }
- }
- header("Location: plus.php?id=3");
- exit;
+
+#################################################################################
+## -= 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;
+ $now = time();
+ $cost = 5;
+
+ // UPDATE atomic: scade gold doar dacă ai, și prelungește b4
+ $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) or die(mysqli_error($database->dblink));
+
+ if(mysqli_affected_rows($database->dblink) == 1) {
+ // succes - update instant în sesiune
+ $session->gold -= $cost;
+
+ // log
+ mysqli_query($database->dblink, "INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', '+25% Production: Crop')") or die(mysqli_error($database->dblink));
+
+ // invalidează cache v9
+ if(method_exists($database, 'clearUserCache')) {
+ $database->clearUserCache($uid);
+ }
+ }
}
- ?>
\ No newline at end of file
+header("Location: plus.php?id=3");
+exit;
+?>
\ No newline at end of file
diff --git a/Templates/Plus/13.tpl b/Templates/Plus/13.tpl
deleted file mode 100644
index 86bbd17b..00000000
--- a/Templates/Plus/13.tpl
+++ /dev/null
@@ -1,48 +0,0 @@
-
\ No newline at end of file
diff --git a/Templates/Plus/14.tpl b/Templates/Plus/14.tpl
deleted file mode 100644
index b2dafa54..00000000
--- a/Templates/Plus/14.tpl
+++ /dev/null
@@ -1,29 +0,0 @@
-dblink,"SELECT * FROM ".TB_PREFIX."vdata WHERE `wref`='".$village->wid."'") or die(mysqli_error($database->dblink));
- $uuVilid = mysqli_fetch_array($MyVilId);
-
- $totalT = ($T1+$T2+$T3+$T4);
- $totalR = ($uuVilid['6']+$uuVilid['7']+$uuVilid['8']+$uuVilid['10']);
-
- $goldlog = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM ".TB_PREFIX."gold_fin_log"), MYSQLI_ASSOC) or die(mysqli_error($database->dblink));
-
-if($totalT <= $totalR) {
-mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."vdata set wood = '".$T1."' where `wref`='".$village->wid."'") or die(mysqli_error($database->dblink));
-mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."vdata set clay = '".$T2."' where `wref`='".$village->wid."'") or die(mysqli_error($database->dblink));
-mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."vdata set iron = '".$T3."' where `wref`='".$village->wid."'") or die(mysqli_error($database->dblink));
-mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."vdata set crop = '".$T4."' where `wref`='".$village->wid."'") or die(mysqli_error($database->dblink));
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set gold = ".($session->gold-3)." where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log VALUES ('".($goldlog['Total']+1)."', '".$village->wid."', 'trade 1:1')") or die(mysqli_error($database->dblink));
-echo "done";
-} else {
-echo "failed";
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log VALUES ('".($goldlog['Total']+1)."', '".$village->wid."', 'Failed trade 1:1')") or die(mysqli_error($database->dblink));
-
-}
-
-header("Location: plus.php?id=3");
-exit;
-
- ?>
\ No newline at end of file
diff --git a/Templates/Plus/15.tpl b/Templates/Plus/15.tpl
index 01e27972..7aa1e42f 100644
--- a/Templates/Plus/15.tpl
+++ b/Templates/Plus/15.tpl
@@ -1,8 +1,36 @@
gold >= 100 && $session->sit == 0 && $session->goldclub == 0) {
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set goldclub = 1, gold = gold - 100 where `id`='".$session->uid."'");
+// Gold Club activation – 100 gold, atomic
+$uid = (int)$session->uid;
+
+if($session->sit != 0) {
+ header("Location: plus.php?id=3"); exit;
}
+
+// un singur query care face tot
+mysqli_query($database->dblink,
+ "UPDATE ".TB_PREFIX."users
+ SET goldclub = 1, gold = gold - 100
+ WHERE id = $uid AND gold >= 100 AND goldclub = 0"
+);
+
+if(mysqli_affected_rows($database->dblink) == 1) {
+ // succes – update sesiunea
+ $session->gold -= 100;
+ $session->goldclub = 1;
+ $_SESSION['gold'] = $session->gold;
+ $_SESSION['goldclub'] = 1;
+
+ if(isset($database->cache)) {
+ $database->cache->delete('user:'.$uid);
+ }
+
+ // log
+ mysqli_query($database->dblink,
+ "INSERT INTO ".TB_PREFIX."gold_fin_log (wid, action, time)
+ VALUES (0, 'Gold Club activated', ".time().")"
+ );
+}
+
header("Location: plus.php?id=3");
exit;
?>
\ No newline at end of file
diff --git a/Templates/Plus/2.tpl b/Templates/Plus/2.tpl
index 90f30a97..822de94f 100644
--- a/Templates/Plus/2.tpl
+++ b/Templates/Plus/2.tpl
@@ -1,207 +1,54 @@
'Waiting loop for constructions', 'img'=>'p1', 'text'=>'The waiting loop enables you to give your builders another order to raise or extend a second building. After completing their first task and a short break (60s), they will start to take care of this second job.'],
+ ['title'=>'Larger map', 'img'=>'xxl_map', 'text'=>'You can enlarge the map to get a better overview. Instead of 7x7 fields you can have a map of 13x13 fields. Other alliances which are allied or have a non-aggression pact (NAP) with you are shown in special colours.'],
+ ['title'=>'Archive function for reports and messages', 'img'=>'p5', 'text'=>'Important reports and messages can be archived and thereby be looked up faster. Additionally, you can choose several messages or reports and archive or delete them at once.'],
+ ['title'=>'Sorting function for reports and messages', 'img'=>'sort', 'text'=>'By clicking the table heading "Sent" you can reverse the sorting of reports and messages. If you get many messages a day and need to look up older ones you are able to do so very fast with this function. It can also be used in the archives.'],
+ ['title'=>'Sorting function for the marketplace', 'img'=>'p6', 'text'=>'To use the marketplace more efficiently, you can filter the offers for certain resources only. Additionally you can use a ratio filter to only see 1:1 offers.'],
+ ['title'=>'Auto-completion', 'img'=>'autovv', 'text'=>'By using the auto-completion you can easily "write" a whole village name by using very few figures. Depending on your preferences you can use this function in any combination for own villages, villages of alliance members or villages of your surroundings.'],
+ ['title'=>'Report filter', 'img'=>'bfilter', 'text'=>'Thanks to the report filter unwanted reports concerning marketplace transactions are a problem of the past. Depending on your personal preferences you can easily switch off reports concerning trades from/to other villages or between your own villages.'],
+ ['title'=>'Freely definable direct links', 'img'=>'p7', 'text'=>'Thanks to these links, you can reach every page you want with just one click. Just create a link to every destination you want and get directly to your alliance\'s overview, to your barracks or to the tempting 1:1 biddings at the marketplace.'],
+ ['title'=>'Graphical statistics', 'img'=>'st1', 'text'=>'These statistics show you the chronological development of your account, e.g. the ranking, your army\'s strength or your population\'s development.'],
+ ['title'=>'Central account overview', 'img'=>'dorf3', 'text'=>'Anyone who reigns over several villages might easily miss something going on within his realm: where are those troops I built, are all my workers at work or are some of them lazy, do I lose resources because one of my warehouses isn\'t big enough? Just take a look at your central village overview and you can check out all your villages at once.'],
+ ['title'=>'Notepad', 'img'=>'p8', 'text'=>'Paper and pencil aren\'t always at hand. In order to make you don\'t forget important things or if you simply want to make a few notes, use your notebook.'],
+];
+
+$goldFeatures = [
+ ['title'=>'Production bonus for lumber', 'img'=>'p1_25', 'text'=>'With this Gold advantage all your villages\' lumber production will be increased by 25%.
The bonus will not be added to the single resource fields but to the sum of the production.'],
+ ['title'=>'Production bonus for clay', 'img'=>'p2_25', 'text'=>'With this Gold advantage all your villages\' clay production will be increased by 25%.
The bonus will not be added to the single resource fields but to the sum of the production.'],
+ ['title'=>'Production bonus for iron', 'img'=>'p3_25', 'text'=>'With this Gold advantage all your villages\' iron production will be increased by 25%.
The bonus will not be added to the single resource fields but to the sum of the production.'],
+ ['title'=>'Production bonus for crop', 'img'=>'p4_25', 'text'=>'With this Gold advantage all your villages\' crop production will be increased by 25%.
The bonus will not be added to the single resource fields but to the sum of the production.'],
+ ['title'=>'Complete construction orders & research immediately.', 'img'=>'bau0', 'text'=>'In the current village all construction orders and research in the academy as well as the blacksmith and armoury will be completed immediately.
However, the buildings Residence and Palace and villages with a wonder of the world inside them are excluded.'],
+ ['title'=>'NPC Merchant', 'img'=>'npc', 'text'=>'The NPC Merchant will exchange any desired amount of resources in a village with other resources at a ratio of 1:1.'],
+];
?>
-
-
Features of Travian Plus
+
Features of Travian Plus
+
+
+
+
= $f['title'] ?>
+
+
+
= $f['text'] ?>
+
+
+
+
-
-
-
-
-
Waiting loop for constructions
-
-
-
-
The waiting loop enables you to give your builders another order to raise or extend a second building. After completing their first task and a short break (60s), they will start to take care of this second job.
-
-
-
-
-
-
Larger map
-
-
-
-
-
You can enlarge the map to get a better overview. Instead of 7x7 fields you can have a map of 13x13 fields. Other alliances which are allied or have a non-aggression pact (NAP) with you are shown in special colours.
-
-
-
-
-
Archive function for reports and messages
-
-
-
-
-
Important reports and messages can be archived and thereby be looked up faster. Additionally, you can choose several messages or reports and archive or delete them at once.
-
-
-
-
-
Sorting function for reports and messages
-
-
-
-
-
By clicking the table heading "Sent" you can reverse the sorting of reports and messages. If you get many messages a day and need to look up older ones you are able to do so very fast with this function. It can also be used in the archives.
-
-
-
-
-
-
Sorting function for the marketplace
-
-
-
-
To use the marketplace more efficiently, you can filter the offers for certain resources only. Additionally you can use a ratio filter to only see 1:1 offers.
-
-
-
-
-
-
Auto-completion
-
-
-
-
By using the auto-completion you can easily "write" a whole village name by using very few figures. Depending on your preferences you can use this function in any combination for own villages, villages of alliance members or villages of your surroundings.
-
-
-
-
-
-
Report filter
-
-
-
-
Thanks to the report filter unwanted reports concerning marketplace transactions are a problem of the past. Depending on your personal preferences you can easily switch off reports concerning trades from/to other villages or between your own villages.
-
-
-
-
-
-
Freely definable direct links
-
-
-
-
Thanks to these links, you can reach every page you want with just one click. Just create a link to every destination you want and get directly to your alliance's overview, to your barracks or to the tempting 1:1 biddings at the marketplace.
-
-
-
-
-
-
Graphical statistics
-
-
-
-
-
These statistics show you the chronological development of your account, e.g. the ranking, your army's strength or your population's development.
-
-
-
-
-
Central account overview
-
-
-
-
-
Anyone who reigns over several villages might easily miss something going on within his realm: where are those troops I built, are all my workers at work or are some of them lazy, do I lose resources because one of my warehouses isn't big enough? Just take a look at your central village overview and you can check out all your villages at once. If you own more than one village you can reach the central village overview by clicking "Villages" directly above the list of your villages.
-
-
-
-
-
Notepad
-
-
-
-
-
Paper and pencil aren't always at hand. In order to make you don't forget important things or if you simply want to make a few notes, use your notebook.
-
-
-
Features of Travian Gold
-
-
-
-
-
-
Production bonus for lumber
-
-
-
-
-
With this Gold advantage all your villages' lumber production will be increased by 25%.
-
-The bonus will not be added to the single resource fields but to the sum of the production.
-
-This feature is NOT included in the gold club!
-
-
-
-
-
Production bonus for clay
-
-
-
-
-
With this Gold advantage all your villages' clay production will be increased by 25%.
-
-The bonus will not be added to the single resource fields but to the sum of the production.
-
-This feature is NOT included in the gold club!
-
-
-
-
-
-
Production bonus for iron
-
-
-
-
With this Gold advantage all your villages' iron production will be increased by 25%.
-
-The bonus will not be added to the single resource fields but to the sum of the production.
-
-
-This feature is NOT included in the gold club!
-
-
-
-
-
Production bonus for crop
-
-
-
-
-
With this Gold advantage all your villages' crop production will be increased by 25%.
-
-The bonus will not be added to the single resource fields but to the sum of the production.
-
-This feature is NOT included in the gold club!
-
-
-
-
-
-
Complete construction orders & research immediately.
-
-
-
-
In the current village all construction orders and research in the academy as well as the blacksmith and armoury will be completed immediately.
-
-However, the buildings Residence and Palace and villages with a wonder of the world inside them are excluded.
-
-
-This feature is NOT included in the gold club!
-
-
-
-
-
NPC Merchant
-
-
-
-
-
The NPC Merchant will exchange any desired amount of resources in a village with other resources at a ratio of 1:1.
-
-This feature is NOT included in the gold club!
-
+
+
Features of Travian Gold
+
+
+
+
= $f['title'] ?>
+
+
+
= $f['text'] ?>
This feature is NOT included in the gold club!
+
+
+
+
+
\ No newline at end of file
diff --git a/Templates/Plus/3.tpl b/Templates/Plus/3.tpl
index e14ae579..3b7ba3c0 100644
--- a/Templates/Plus/3.tpl
+++ b/Templates/Plus/3.tpl
@@ -1,454 +1,184 @@
dblink, "SELECT * FROM " . TB_PREFIX . "users WHERE `id`='" . $session->uid . "'") or die(mysqli_error($database->dblink));
-$golds = mysqli_fetch_array($MyGold);
+// TODO: Reduce this file by a lot, by using arrays
+$MyGold = mysqli_query($database->dblink, "SELECT * FROM " . TB_PREFIX . "users WHERE id='".$session->uid."'") or die(mysqli_error($database->dblink));
+$golds = mysqli_fetch_assoc($MyGold);
include ("Templates/Plus/pmenu.tpl");
-$MyGold = mysqli_query($database->dblink, "SELECT * FROM " . TB_PREFIX . "users WHERE `id`='" . $session->uid . "'") or die(mysqli_error($database->dblink));
-$golds = mysqli_fetch_array($MyGold);
+$date2 = time();
-$today = date("mdHi");
-
-if (mysqli_num_rows($MyGold)) {
- if ($session->gold == 0)
+if ($golds) {
+ if ($golds['gold'] == 0)
echo "
You currently don't own gold.
";
else
- echo "
You currently have $session->gold gold
";
+ echo "
You currently have ".$golds['gold']." gold
";
}
-?>
-
-
-
-
Plus function
-
-
-
-
-
Description
-
Duration
-
Gold
-
Action
-
-
-
-
-
-
-
Plus Account
-'.$days.' days '.$hours.' hours '.$mins.' mins '.$secs.' secs (until '.date('H:i:s', (int)$endTimestamp).')';
}
-
-if ($datetimep == 0) echo "get PLUS ";
-else
-{
- if ($datetimep <= $date2) {
- print "Your PLUS advantage has ended. ";
- mysqli_query($database->dblink, "UPDATE " . TB_PREFIX . "users set plus = '0' where `id`='" . $session->uid . "'") or die(mysqli_error($database->dblink));
- } else {
- echo "" . formatRemainingTime($datetimep, $date2) . "";
- }
-}
- ?>
-
Residence, Palace and World Wonder villages are excluded for gameplay reasons.
-
Due to game play reasons the buildings Residence and Palace are excluded from this function. The same applies to villages in which the wonders of the world can be constructed.
-
-
I activated the Plus account, however, my resource production did not increase.
-
The production did not increase because Plus is separated from these additional features.
-
-
Do I need to activate Plus before I can use any other function?
-
No, you can use every single gold feature as long as you have enough gold.
-
-
+
I activated Plus, but production did not increase.
+
Plus does not include production bonuses. You must buy +25% for each resource separately in Plus functions.
+
Do I need Plus to use other features?
+
No. Every gold feature works standalone as long as you have enough gold.
+
\ No newline at end of file
diff --git a/Templates/Plus/5.tpl b/Templates/Plus/5.tpl
index ee48f569..ea511083 100644
--- a/Templates/Plus/5.tpl
+++ b/Templates/Plus/5.tpl
@@ -1,68 +1,46 @@
uid;
+$invited = $database->getInvitedUser($session->uid);
?>
+
Invite friends and receive free Gold
+
If you get new players to open an account and settle a second village, you will receive 50 gold. You can use this gold for Plus or any gold advantage.
+To bring in new players, invite them by e-mail or share your REF link.
If you get new players to open an account and settle a second village with Travian you will receive gold. You can use this gold to purchase a plus account or plus advantages.
-
-
- To bring in new players, you can invite them by e-mail or have them click on your REF link.
+
2) Copy your personal REF-Link and share it!
+Your personal REF Link:
+= $refLink ?>
-
How is it done?
+
Progress of your invited friends
+
As soon as a player you invited founds his 2nd village, you will be credited with 50 gold.
+
\ No newline at end of file
diff --git a/Templates/Plus/7.tpl b/Templates/Plus/7.tpl
index df055223..1d06821a 100644
--- a/Templates/Plus/7.tpl
+++ b/Templates/Plus/7.tpl
@@ -1,4 +1,17 @@
finishAll('plus.php?id=3');
exit;
?>
diff --git a/Templates/Plus/8.tpl b/Templates/Plus/8.tpl
index acd0674c..b7686ae0 100644
--- a/Templates/Plus/8.tpl
+++ b/Templates/Plus/8.tpl
@@ -1,28 +1,43 @@
gold >= 10){
- $MyGold = mysqli_query($database->dblink,"SELECT gold, plus FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- $golds = mysqli_fetch_array($MyGold);
- if($session->sit == 0) {
- if (mysqli_num_rows($MyGold) == 1) {
- if($golds['gold'] >= 10) {
- if($golds['plus'] == 0) {
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set plus = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+".PLUS_TIME." where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- } else {
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set plus = '".($golds['plus']+PLUS_TIME)."' where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- }
- $done1 = " Plus Account";
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set gold = ".($session->gold-10)." where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', 'Plus Account')") or die(mysqli_error($database->dblink));
- } else {
- $done1 = " You need more gold";
- }
- } else {
- $done1 = "Failed plus attempt";
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', 'Failed Plus Account')") or die(mysqli_error($database->dblink));
- }
- }
- header("Location: plus.php?id=3");
- exit;
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Project: TravianZ (Refactor incremental) ##
+## File: 8.tpl ##
+## Description: Plus Account ##
+## Made by: alq0rsan ##
+## Improved by: evader ##
+## Refactor by: Shadow ##
+## ##
+#################################################################################
+
+if($session->sit == 0) {
+ $now = time();
+ $uid = (int)$session->uid;
+ $cost = 10;
+
+ // un singur UPDATE: scade gold DOAR dacă ai destul, și prelungește plus-ul
+ $sql = "UPDATE ".TB_PREFIX."users
+ SET gold = gold - $cost,
+ plus = IF(plus > $now, plus + ".PLUS_TIME.", $now + ".PLUS_TIME.")
+ WHERE id = '$uid' AND gold >= $cost";
+
+ mysqli_query($database->dblink, $sql) or die(mysqli_error($database->dblink));
+
+ if(mysqli_affected_rows($database->dblink) == 1) {
+ // a reușit - actualizează sesiunea instant
+ $session->gold -= $cost;
+
+ // log (opțional)
+ mysqli_query($database->dblink, "INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', 'Plus Account')") or die(mysqli_error($database->dblink));
+
+ // invalidează cache v9
+ if(method_exists($database, 'clearUserCache')) {
+ $database->clearUserCache($uid);
+ }
+ }
}
- ?>
\ No newline at end of file
+header("Location: plus.php?id=3");
+exit;
+?>
\ No newline at end of file
diff --git a/Templates/Plus/9.tpl b/Templates/Plus/9.tpl
index 71826d30..064af74a 100644
--- a/Templates/Plus/9.tpl
+++ b/Templates/Plus/9.tpl
@@ -1,28 +1,43 @@
gold >= 5){
- $MyGold = mysqli_query($database->dblink,"SELECT gold, b1 FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- $golds = mysqli_fetch_array($MyGold);
- if($session->sit == 0) {
- if (mysqli_num_rows($MyGold) == 1) {
- if($golds['gold'] >= 5) {
- if($golds['b1'] < time()) {
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set b1 = '".(time()+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- } else {
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set b1 = '".($golds['b1']+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- }
- $done1 = "+25% Production: Lumber";
- mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set gold = ".($session->gold-5)." where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', '+25% Production: Lumber')") or die(mysqli_error($database->dblink));
- } else {
- $done1 = "You need more gold";
- }
- } else {
- $done1 = "Failed lumber attempt";
- mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', 'Failed +25% Production: Lumber')") or die(mysqli_error($database->dblink));
- }
- }
- header("Location: plus.php?id=3");
- exit;
+
+#################################################################################
+## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
+## --------------------------------------------------------------------------- ##
+## Project: TravianZ (Refactor incremental) ##
+## File: 8.tpl ##
+## Description: Wood Plus ##
+## Made by: alq0rsan ##
+## Improved by: evader ##
+## Refactor by: Shadow ##
+## ##
+#################################################################################
+
+if($session->sit == 0) {
+ $uid = (int)$session->uid;
+ $now = time();
+ $cost = 5;
+
+ // UPDATE atomic: scade gold DOAR dacă ai, și prelungește b1 într-o singură operație
+ $sql = "UPDATE ".TB_PREFIX."users
+ SET gold = gold - $cost,
+ b1 = IF(b1 > $now, b1 + ".PLUS_PRODUCTION.", $now + ".PLUS_PRODUCTION.")
+ WHERE id = '$uid' AND gold >= $cost";
+
+ mysqli_query($database->dblink, $sql) or die(mysqli_error($database->dblink));
+
+ if(mysqli_affected_rows($database->dblink) == 1) {
+ // succes - actualizează sesiunea instant (nu mai aștepți cache-ul de 10 sec)
+ $session->gold -= $cost;
+
+ // log
+ mysqli_query($database->dblink, "INSERT INTO ".TB_PREFIX."gold_fin_log (wid,log) VALUES ('".$village->wid."', '+25% Production: Lumber')") or die(mysqli_error($database->dblink));
+
+ // invalidează cache v9
+ if(method_exists($database, 'clearUserCache')) {
+ $database->clearUserCache($uid);
+ }
+ }
}
+header("Location: plus.php?id=3");
+exit;
?>
\ No newline at end of file
diff --git a/Templates/Plus/getplus.tpl b/Templates/Plus/getplus.tpl
index f2c95a91..e1360145 100644
--- a/Templates/Plus/getplus.tpl
+++ b/Templates/Plus/getplus.tpl
@@ -1,122 +1,82 @@
uid;
+$plusTime = 604800; // 7 zile
- echo "
Get Plus
";
- echo " To enter you login then select the plus site. You will be redirected to the plus site.";
- echo " The plus system will be monitored. Account name, site plus on ip, and points given are logged, if caught cheating account will be banned.
";
+echo '
Get Plus
';
+echo 'Exchange gold for Plus features. All actions are logged.