mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-26 01:09:22 +02:00
Fix #446 TFS 1.3 premium time
which was implemented here: https://github.com/otland/forgottenserver/pull/2813 and merged 28th october 2020.
This commit is contained in:
parent
a88d3710fb
commit
fa5fac75a7
@ -1113,14 +1113,22 @@ function user_account_id_from_name($id) {
|
||||
|
||||
// Add additional premium days to account id
|
||||
function user_account_add_premdays($accid, $days) {
|
||||
global $tfs_10_hasPremDays; // Initialized in engine/init.php
|
||||
$accid = (int)$accid;
|
||||
$days = (int)$days;
|
||||
|
||||
if (config('ServerEngine') !== 'OTHIRE') {
|
||||
$data = mysql_select_single("SELECT `premdays` FROM `accounts` WHERE `id`='$accid';");
|
||||
$tmp = $data['premdays'];
|
||||
$tmp += $days;
|
||||
mysql_update("UPDATE `accounts` SET `premdays`='$tmp' WHERE `id`='$accid'");
|
||||
if ($tfs_10_hasPremDays) {
|
||||
$data = mysql_select_single("SELECT `premdays` FROM `accounts` WHERE `id`='$accid';");
|
||||
$tmp = $data['premdays'];
|
||||
$tmp += $days;
|
||||
mysql_update("UPDATE `accounts` SET `premdays`='$tmp' WHERE `id`='$accid'");
|
||||
} else {
|
||||
mysql_update(" UPDATE `accounts`
|
||||
SET `premium_ends_at` = GREATEST(CAST(`premium_ends_at` as signed) - UNIX_TIMESTAMP(CURDATE()), 0) + ({$days} * 86400) + UNIX_TIMESTAMP(CURDATE())
|
||||
WHERE `id`='{$accid}';
|
||||
");
|
||||
}
|
||||
} else {
|
||||
$data = mysql_select_single("SELECT `premend` FROM `accounts` WHERE `id`='$accid';");
|
||||
$tmp = $data['premend'];
|
||||
|
@ -50,11 +50,22 @@ if (isset($_SESSION['token'])) {
|
||||
}
|
||||
Token::generate();
|
||||
|
||||
$tfs_10_hasPremDays = true; // https://github.com/otland/forgottenserver/pull/2813
|
||||
|
||||
if (user_logged_in() === true) {
|
||||
$session_user_id = getSession('user_id');
|
||||
if ($config['ServerEngine'] !== 'OTHIRE')
|
||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
|
||||
else
|
||||
if ($config['ServerEngine'] !== 'OTHIRE') {
|
||||
if ($config['ServerEngine'] == 'TFS_10') {
|
||||
$hasPremDays = mysql_select_single("SHOW COLUMNS from `accounts` WHERE `Field` = 'premdays'");
|
||||
if ($hasPremDays === false) {
|
||||
$tfs_10_hasPremDays = false;
|
||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premium_ends_at');
|
||||
$user_data['premdays'] = ($user_data['premium_ends_at'] - time() > 0) ? floor(($user_data['premium_ends_at'] - time()) / 86400) : 0;
|
||||
} else {
|
||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
|
||||
}
|
||||
}
|
||||
} else
|
||||
$user_data = user_data($session_user_id, 'id', 'password', 'email', 'premend');
|
||||
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag' ,'active_email');
|
||||
}
|
||||
|
@ -111,10 +111,9 @@ if (user_logged_in() === true) {
|
||||
|
||||
// If character is offline
|
||||
if ($char_data['online'] == 0) {
|
||||
$acc_data = user_data($user_data['id'], 'premdays');
|
||||
|
||||
// If character is premium
|
||||
if ($config['guild_require_premium'] == false || $acc_data['premdays'] > 0) {
|
||||
if ($config['guild_require_premium'] == false || $user_data['premdays'] > 0) {
|
||||
|
||||
if (get_character_guild_rank($user_id) < 1) {
|
||||
|
||||
|
@ -32,11 +32,7 @@ if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
|
||||
|
||||
if (user_logged_in() === true && $player['account_id'] == $session_user_id) {
|
||||
// Does player have or need premium?
|
||||
$premstatus = $config['houseConfig']['requirePremium'];
|
||||
if ($premstatus) {
|
||||
$premstatus = mysql_select_single("SELECT `premdays` FROM `accounts` WHERE `id`='".$player['account_id']."' LIMIT 1;");
|
||||
$premstatus = ($premstatus['premdays'] > 0) ? true : false;
|
||||
} else $premstatus = true;
|
||||
$premstatus = ($config['houseConfig']['requirePremium'] && $user_data['premdays'] == 0) ? false : true;
|
||||
if ($premstatus) {
|
||||
// Can player have or bid on more houses?
|
||||
$pHouseCount = mysql_select_single("SELECT COUNT('id') AS `value` FROM `houses` WHERE ((`highest_bidder`='$bid_char' AND `owner`='$bid_char') OR (`highest_bidder`='$bid_char') OR (`owner`='$bid_char')) AND `id`!='".$house['id']."' LIMIT 1;");
|
||||
|
Loading…
x
Reference in New Issue
Block a user