diff --git a/README.md b/README.md
index 7abdee2..804093c 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ Without modifying config.php, enter the website and wait for mysql connection er
This will show you the rest of the instructions as well as the mysql schema.
2: Edit config.php and:
-- modify $config['TFSVersion'] with correct TFS version you are running. (TFS_02, TFS_03, TFS_10).
+- modify $config['ServerEngine'] with correct TFS version you are running. (TFS_02, TFS_03, TFS_10).
- modify $config['page_admin_access'] with your admin account username(s).
3: Before inserting correct SQL connection details, visit the website ( http://127.0.0.1/ ), it will generate a mysql schema you should import to your OT servers database.
@@ -56,6 +56,7 @@ This will show you the rest of the instructions as well as the mysql schema.
Znote AAC is very rich feature wise, here is an attempt at summarizing what we offer.
#### Server distribution compatibility:
+- OTHire
- TFS 0.2
- TFS 0.3/4
- TFS 1.x
diff --git a/admin.php b/admin.php
index 98291b3..8e727af 100644
--- a/admin.php
+++ b/admin.php
@@ -50,9 +50,9 @@ if (empty($_POST) === false) {
$acc_id = user_character_account_id($_POST['reset_pass']);
if ($acc_id != $session_user_id) {
- if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
+ if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
user_change_password($acc_id, $_POST['new_pass']);
- } else if ($config['TFSVersion'] == 'TFS_03') {
+ } else if ($config['ServerEngine'] == 'TFS_03') {
user_change_password03($acc_id, $_POST['new_pass']);
}
$errors[] = 'The password to the account of character name: '. getValue($_POST['reset_pass']) .' has been set to: '. getValue($_POST['new_pass']) .'.';
@@ -89,9 +89,9 @@ if (empty($_POST) === false) {
if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
if (user_character_exist($_POST['position_name'])) {
if (array_key_exists($_POST['position_type'], $config['ingame_positions'])) {
- if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
+ if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
set_ingame_position($_POST['position_name'], $_POST['position_type']);
- } else if ($config['TFSVersion'] == 'TFS_03') {
+ } else if ($config['ServerEngine'] == 'TFS_03') {
set_ingame_position03($_POST['position_name'], $_POST['position_type']);
}
$pos = 'Undefined';
@@ -239,7 +239,7 @@ echo "Last cached on: ". getClock($basic['cached'], true) .".
";
Set character name to position:
ERROR: You forgot to add (Senior Tutor) rank in config.php!
0) {
$pid = (int)$_POST['pid'];
- if ($config['TFSVersion'] != 'TFS_10') $status = user_is_online($pid);
+ if ($config['ServerEngine'] != 'TFS_10') $status = user_is_online($pid);
else $status = user_is_online_10($pid);
if (!$status) {
@@ -46,7 +46,7 @@ if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) {
$newcap = $playercnf['base']['cap'] + ($statgain['cap'] * $LevelsFromBase);
// Calibrate hp/mana/cap
- if ($config['TFSVersion'] != 'TFS_10') {
+ if ($config['ServerEngine'] != 'TFS_10') {
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['fist'] ."' WHERE `player_id`='$pid' AND `skillid`='0' LIMIT 1;");
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['club'] ."' WHERE `player_id`='$pid' AND `skillid`='1' LIMIT 1;");
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['sword'] ."' WHERE `player_id`='$pid' AND `skillid`='2' LIMIT 1;");
@@ -86,7 +86,7 @@ if ($name !== false) {
if (user_character_exist($name)) {
$pid = user_character_id($name);
- if ($config['TFSVersion'] != 'TFS_10') {
+ if ($config['ServerEngine'] != 'TFS_10') {
$skills = mysql_select_multi("SELECT `value` FROM `player_skills` WHERE `player_id`='$pid' LIMIT 7;");
$player = mysql_select_single("SELECT `maglevel`, `level`, `vocation` FROM `players` WHERE `id`='$pid' LIMIT 1;");
$skills[] = array('value' => $player['maglevel']);
diff --git a/api/api.php b/api/api.php
index 90f130b..6f2091f 100644
--- a/api/api.php
+++ b/api/api.php
@@ -17,7 +17,7 @@ if (!isset($config['api']['debug'])) $config['api']['debug'] = false;
$response = array(
'version' => array(
'znote' => $version,
- 'ot' => $config['TFSVersion']
+ 'ot' => $config['ServerEngine']
),
);
diff --git a/api/index.php b/api/index.php
index e3739e8..aded8f2 100644
--- a/api/index.php
+++ b/api/index.php
@@ -39,7 +39,7 @@ $response['data']['accounts'] = ($accounts !== false) ? (int)$accounts['count']
$players = mysql_select_single("SELECT COUNT('id') AS `count` FROM `players`;");
$response['data']['players'] = ($players !== false) ? (int)$players['count'] : 0;
// online player count
-if ($config['TFSVersion'] != 'TFS_10') {
+if ($config['ServerEngine'] != 'TFS_10') {
$online = mysql_select_single("SELECT COUNT('id') AS `count`, COUNT(DISTINCT `lastip`) AS `unique` FROM `players` WHERE `online`='1';");
} else {
$online = mysql_select_single("SELECT COUNT(`o`.`player_id`) AS `count`, COUNT(DISTINCT `p`.`lastip`) AS `unique` FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id`;");
diff --git a/changepassword.php b/changepassword.php
index 8c698ec..144470e 100644
--- a/changepassword.php
+++ b/changepassword.php
@@ -21,10 +21,10 @@ if (empty($_POST) === false) {
// $_POST['']
// .3 compatibility
- if ($config['TFSVersion'] == 'TFS_03' && $config['salt'] === true) {
+ if ($config['ServerEngine'] == 'TFS_03' && $config['salt'] === true) {
$salt = user_data($session_user_id, 'salt');
}
- if (sha1($_POST['current_password']) === $pass_data['password'] || $config['TFSVersion'] == 'TFS_03' && $config['salt'] === true && sha1($salt['salt'].$_POST['current_password']) === $pass_data['password']) {
+ if (sha1($_POST['current_password']) === $pass_data['password'] || $config['ServerEngine'] == 'TFS_03' && $config['salt'] === true && sha1($salt['salt'].$_POST['current_password']) === $pass_data['password']) {
if (trim($_POST['new_password']) !== trim($_POST['new_password_again'])) {
$errors[] = 'Your new passwords do not match.';
} else if (strlen($_POST['new_password']) < 6) {
@@ -50,9 +50,9 @@ if (isset($_GET['success']) && empty($_GET['success'])) {
} else {
if (empty($_POST) === false && empty($errors) === true) {
//Posted the form without errors
- if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
+ if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
user_change_password($session_user_id, $_POST['new_password']);
- } else if ($config['TFSVersion'] == 'TFS_03') {
+ } else if ($config['ServerEngine'] == 'TFS_03') {
user_change_password03($session_user_id, $_POST['new_password']);
}
header('Location: changepassword.php?success');
diff --git a/characterprofile.php b/characterprofile.php
index 77df8b8..548d4fa 100644
--- a/characterprofile.php
+++ b/characterprofile.php
@@ -11,7 +11,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
if ($user_id !== false) {
$loadOutfits = $config['show_outfits']['characterprofile'];
- if ($config['TFSVersion'] == 'TFS_10') {
+ if ($config['ServerEngine'] == 'TFS_10') {
if (!$loadOutfits) {
$profile_data = user_character_data($user_id, 'account_id', 'name', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'sex', 'lastlogin');
} else { // Load outfits
@@ -27,7 +27,10 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
if (!$loadOutfits) {
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex');
} else { // Load outfits
- $profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype', 'lookaddons');
+ if ($config['ServerEngine'] !== 'OTHIRE')
+ $profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype', 'lookaddons');
+ else
+ $profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype');
}
}
@@ -142,9 +145,14 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
Status:
Death List:
This player has never died.';
}
}
- else if ($config['TFSVersion'] == 'TFS_10')
+ else if ($config['ServerEngine'] == 'TFS_10')
{
$deaths = mysql_select_multi("SELECT
`player_id`, `time`, `level`, `killed_by`, `is_player`,
@@ -355,7 +363,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
echo 'This player has never died.';
}
}
- else if ($config['TFSVersion'] == 'TFS_03')
+ else if ($config['ServerEngine'] == 'TFS_03' || $config['ServerEngine'] == 'OTHIRE')
{
//mysql_select_single("SELECT * FROM players WHERE name='TEST DEBUG';");
$array = user_fetch_deathlist03($user_id);
diff --git a/config.php b/config.php
index 0847b2f..afef684 100644
--- a/config.php
+++ b/config.php
@@ -8,12 +8,13 @@
// Tested with TFS items.xml master (1.3)
$config['items'] = false;
- // Available options: TFS_02, TFS_03
+ // Available options: TFS_02, TFS_03, OTHIRE
+ // OTHire = OTHIRE
// TFS 0.2 = TFS_02
// TFS 0.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)!
// TFS 0.4 = TFS_03
// TFS 1.0 = TFS_10 (Under developement)
- $config['TFSVersion'] = 'TFS_10';
+ $config['ServerEngine'] = 'TFS_10';
// As far as I know, OTX is based on TFS_03, so make sure TFS version is configured TFS_03
$config['CustomVersion'] = false;
@@ -28,6 +29,9 @@
// MYSQL CONNECTION DETAILS \\
// ------------------------ \\
+ if ($config['ServerEngine'] !== 'OTHIRE') {
+
+ // TFS DATABASE CONFIGS
// phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
$config['sqlUser'] = 'tfs13';
@@ -39,6 +43,21 @@
// Hostname is usually localhost or 127.0.0.1.
$config['sqlHost'] = '127.0.0.1';
+ } else {
+
+ // OTHIRE DATABASE CONFIG
+ // phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
+ $config['sql_user'] = 'tfs13';
+
+ // phpmyadmin password for OT server:
+ $config['sql_pass'] = 'tfs13';
+
+ // The database name to connect to. (This is usually same as username).
+ $config['sql_db'] = 'tfs13';
+
+ // Hostname is usually localhost or 127.0.0.1.
+ $config['sql_host'] = '127.0.0.1';
+ }
// QR code authenticator Only works with TFS 1.2+
$config['twoFactorAuthenticator'] = false;
diff --git a/deaths.php b/deaths.php
index 56c6a57..0c5f666 100644
--- a/deaths.php
+++ b/deaths.php
@@ -2,9 +2,9 @@
$cache = new Cache('engine/cache/deaths');
if ($cache->hasExpired()) {
- if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
+ if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10') {
$deaths = fetchLatestDeaths();
- } else if ($config['TFSVersion'] == 'TFS_03') {
+ } else if ($config['ServerEngine'] == 'TFS_03' || $config['ServerEngine'] == 'OTHIRE') {
$deaths = fetchLatestDeaths_03(30);
}
$cache->setContent($deaths);
@@ -27,7 +27,7 @@ if ($deaths) {
echo "". getClock($death['time'], true) ." | ";
if ($death['is_player'] == 1) echo "Player: ". $death['killed_by'] ." | ";
else if ($death['is_player'] == 0) {
- if ($config['TFSVersion'] == 'TFS_03') echo "Monster: ". ucfirst(str_replace("a ", "", $death['killed_by'])) ." | ";
+ if ($config['ServerEngine'] == 'TFS_03') echo "Monster: ". ucfirst(str_replace("a ", "", $death['killed_by'])) ." | ";
else echo "Monster: ". ucfirst($death['killed_by']) ." | ";
}
else echo "". $death['killed_by'] ." | ";
diff --git a/engine/database/connect.php b/engine/database/connect.php
index 89911b2..ef594f6 100644
--- a/engine/database/connect.php
+++ b/engine/database/connect.php
@@ -274,8 +274,11 @@ CREATE TABLE IF NOT EXISTS `znote_global_storage` (
";
+if ($config['ServerEngine'] !== 'OTHIRE')
+ $connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);
+else
+ $connect = new mysqli($config['sql_host'], $config['sql_user'], $config['sql_pass'], $config['sql_db']);
-$connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);
if ($connect->connect_errno) {
die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install);
}
diff --git a/engine/function/users.php b/engine/function/users.php
index be2f4c6..6cfcd13 100644
--- a/engine/function/users.php
+++ b/engine/function/users.php
@@ -123,7 +123,7 @@ function bomberman_highscores() {
// Support list
function support_list() {
- $TFS = Config('TFSVersion');
+ $TFS = Config('ServerEngine');
if ($TFS == 'TFS_10') $staffs = mysql_select_multi("SELECT `id`, `group_id`, `name`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
else $staffs = mysql_select_multi("SELECT `group_id`, `name`, `online`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
@@ -286,7 +286,7 @@ function guild_change_leader($nCid, $oCid) {
if ($status) {
// Update players and set their new rank id
- if (config('TFSVersion') !== 'TFS_10') {
+ if (config('ServerEngine') !== 'TFS_10') {
mysql_update("UPDATE `players` SET `rank_id`='$leader_rid' WHERE `id`=$nCid LIMIT 1;");
mysql_update("UPDATE `players` SET `rank_id`='$vice_rid' WHERE `id`=$oCid LIMIT 1;");
} else {
@@ -305,20 +305,29 @@ function guild_change_leader($nCid, $oCid) {
function guild_new_leader($new_leader, $gid) {
$new_leader = (int)$new_leader;
$gid = (int)$gid;
- mysql_update("UPDATE `guilds` SET `ownerid`='$new_leader' WHERE `id`=$gid");
+ if (config('ServerEngine') !== 'OTHIRE')
+ mysql_update("UPDATE `guilds` SET `ownerid`='$new_leader' WHERE `id`=$gid");
+ else
+ mysql_update("UPDATE `guilds` SET `owner_id`='$new_leader' WHERE `id`=$gid");
}
// Returns $gid of a guild leader($cid).
function guild_leader_gid($leader) {
$leader = (int)$leader;
- $data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `ownerid`='$leader';");
+ if (config('ServerEngine') !== 'OTHIRE')
+ $data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `ownerid`='$leader';");
+ else
+ $data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `owner_id`='$leader';");
return ($data === false) ? false : $data['id'];
}
// Returns guild leader(charID) of a guild. (parameter: guild_ID)
function guild_leader($gid) {
$gid = (int)$gid;
- $data = mysql_select_single("SELECT `ownerid` FROM `guilds` WHERE `id`='$gid';");
+ if (config('ServerEngine') !== 'OTHIRE')
+ $data = mysql_select_single("SELECT `ownerid` FROM `guilds` WHERE `id`='$gid';");
+ else
+ $data = mysql_select_single("SELECT `owner_id` FROM `guilds` WHERE `id`='$gid';");
return ($data !== false) ? $data['ownerid'] : false;
}
@@ -351,7 +360,7 @@ function guild_player_join($cid, $gid) {
// Create a status we can return depending on results.
$status = false;
- if (config('TFSVersion') !== 'TFS_10') {
+ if (config('ServerEngine') !== 'TFS_10') {
// Get rank data
$ranks = get_guild_rank_data($gid);
// Locate rank id for regular member position in this guild
@@ -450,7 +459,10 @@ function create_guild($cid, $name) {
$time = time();
// Create the guild
- mysql_insert("INSERT INTO `guilds` (`name`, `ownerid`, `creationdata`, `motd`) VALUES ('$name', '$cid', '$time', '');");
+ if (config('ServerEngine') !== 'OTHIRE')
+ mysql_insert("INSERT INTO `guilds` (`name`, `ownerid`, `creationdata`, `motd`) VALUES ('$name', '$cid', '$time', '');");
+ else
+ mysql_insert("INSERT INTO `guilds` (`name`, `owner_id`, `creationdate`) VALUES ('$name', '$cid', '$time');");
// Get guild id
$gid = get_guild_id($name);
@@ -460,14 +472,14 @@ function create_guild($cid, $name) {
$rid = ($data !== false) ? $data['id'] : false;
// Give player rank id for leader of his guild
- if (config('TFSVersion') !== 'TFS_10') mysql_update("UPDATE `players` SET `rank_id`='$rid' WHERE `id`='$cid' LIMIT 1;");
+ if (config('ServerEngine') !== 'TFS_10') mysql_update("UPDATE `players` SET `rank_id`='$rid' WHERE `id`='$cid' LIMIT 1;");
else mysql_insert("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES ('$cid', '$gid', '$rid', '');");
}
// Search player table on cid for his rank_id, returns rank_id
function get_character_guild_rank($cid) {
$cid = (int)$cid;
- if (config('TFSVersion') !== 'TFS_10') {
+ if (config('ServerEngine') !== 'TFS_10') {
$data = mysql_select_single("SELECT `rank_id` FROM `players` WHERE `id`='$cid';");
return ($data !== false && $data['rank_id'] > 0) ? $data['rank_id'] : false;
} else {
@@ -493,7 +505,7 @@ function get_guild_position($rid) {
// Get a players rank_id, guild_id, rank_level(ID), rank_name(string), using cid(player id)
function get_player_guild_data($cid) {
$cid = (int)$cid;
- if (config('TFSVersion') !== 'TFS_10') $playerdata = mysql_select_single("SELECT `rank_id` FROM `players` WHERE `id`='$cid' LIMIT 1;");
+ if (config('ServerEngine') !== 'TFS_10') $playerdata = mysql_select_single("SELECT `rank_id` FROM `players` WHERE `id`='$cid' LIMIT 1;");
else $playerdata = mysql_select_single("SELECT `rank_id` FROM `guild_membership` WHERE `player_id`='$cid' LIMIT 1;");
if ($playerdata !== false) {
@@ -523,25 +535,31 @@ function get_guild_id($name) {
// Returns guild data from name
function get_guild_data($name) {
$name = sanitize($name);
- return mysql_select_single("SELECT `id`, `name`, `ownerid`, `creationdata`, `motd` FROM `guilds` WHERE `name`='$name' LIMIT 1;");
+ if (config('ServerEngine') !== 'OTHIRE')
+ return mysql_select_single("SELECT `id`, `name`, `ownerid`, `creationdata`, `motd` FROM `guilds` WHERE `name`='$name' LIMIT 1;");
+ else
+ return mysql_select_single("SELECT `id`, `name`, `owner_id`, `creationdate` FROM `guilds` WHERE `name`='$name' LIMIT 1;");
}
// Get complete list of guilds
function get_guilds_list() {
- return mysql_select_multi("SELECT `id`, `name`, `creationdata` FROM `guilds` ORDER BY `name`;");
+ if (config('ServerEngine') !== 'OTHIRE')
+ return mysql_select_multi("SELECT `id`, `name`, `creationdata` FROM `guilds` ORDER BY `name`;");
+ else
+ return mysql_select_multi("SELECT `id`, `name`, `creationdate` FROM `guilds` ORDER BY `name`;");
}
// Get array of player data related to a guild.
function get_guild_players($gid) {
$gid = (int)$gid; // Sanitizing the parameter id
- if (config('TFSVersion') !== 'TFS_10') return mysql_select_multi("SELECT `p`.`rank_id`, `p`.`name`, `p`.`level`, `p`.`guildnick`, `p`.`vocation`, `p`.`online`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` ='$gid' ORDER BY `gr`.`id`, `p`.`name`;");
+ if (config('ServerEngine') !== 'TFS_10') return mysql_select_multi("SELECT `p`.`rank_id`, `p`.`name`, `p`.`level`, `p`.`guildnick`, `p`.`vocation`, `p`.`online`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` ='$gid' ORDER BY `gr`.`id`, `p`.`name`;");
else return mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `gm`.`rank_id`, `gm`.`nick` AS `guildnick`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `gm`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `gm`.`rank_id` WHERE `gm`.`guild_id` = '$gid' ORDER BY `gm`.`rank_id`, `p`.`name`");
}
// Get guild level data (avg level, total level, count of players)
function get_guild_level_data($gid) {
$gid = (int)$gid;
- $data = (config('TFSVersion') !== 'TFS_10') ? mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id ='$gid';") : mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_membership AS gm ON gm.player_id = p.id WHERE gm.guild_id = '$gid' ORDER BY gm.rank_id, p.name;");
+ $data = (config('ServerEngine') !== 'TFS_10') ? mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id ='$gid';") : mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_membership AS gm ON gm.player_id = p.id WHERE gm.guild_id = '$gid' ORDER BY gm.rank_id, p.name;");
$members = 0;
$totallevels = 0;
if ($data !== false) {
@@ -556,7 +574,7 @@ function get_guild_level_data($gid) {
// Returns total members in a guild (integer)
function count_guild_members($gid) {
$gid = (int)$gid;
- if (config('TFSVersion') !== 'TFS_10') {
+ if (config('ServerEngine') !== 'TFS_10') {
$data = mysql_select_single("SELECT COUNT(p.id) AS total FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =$gid");
return ($data !== false) ? $data['total'] : false;
} else {
@@ -636,6 +654,7 @@ function gesior_sql_killer($did) {
}
// end gesior
// END GUILD WAR
+
// ADMIN FUNCTIONS
function set_ingame_position($name, $acctype) {
$acctype = (int)$acctype;
@@ -690,9 +709,9 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
if (user_character_exist($bannedby)) {
$bannedby = user_character_id($bannedby);
- if (Config('TFSVersion') === 'TFS_02')
+ if (Config('ServerEngine') === 'TFS_02')
mysql_insert("INSERT INTO `bans` (`type` ,`ip` ,`mask` ,`player` ,`account` ,`time` ,`reason_id` ,`action_id` ,`comment` ,`banned_by`) VALUES ('$typeid', '$charip', '4294967295', '$charid', '$accountid', '$time', '$reasonid', '$actionid', '$comment', '$bannedby');");
- elseif (Config('TFSVersion') === 'TFS_03') {
+ elseif (Config('ServerEngine') === 'TFS_03') {
$now = time();
switch ($typeid) {
case 1: // IP ban
@@ -716,7 +735,7 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
break;
}
}
- elseif (Config('TFSVersion') === 'TFS_10') {
+ elseif (Config('ServerEngine') === 'TFS_10') {
$now = time();
switch ($typeid) {
@@ -751,6 +770,7 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
}
// -- END admin
+
// Fetch deathlist
function user_fetch_deathlist($char_id) {
$char_id = (int)$char_id;
@@ -839,7 +859,7 @@ function user_character_list($account_id) {
//$count = user_character_list_count($account_id);
$account_id = (int)$account_id;
- if (config('TFSVersion') == 'TFS_10') {
+ if (config('ServerEngine') == 'TFS_10') {
$characters = mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `p`.`town_id`, `p`.`lastlogin`, `gm`.`rank_id`, `po`.`player_id` AS `online` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `p`.`id`=`gm`.`player_id` LEFT JOIN `players_online` AS `po` ON `p`.`id`=`po`.`player_id` WHERE `p`.`account_id`='$account_id' ORDER BY `p`.`level` DESC");
if ($characters !== false) {
for ($i = 0; $i < count($characters); $i++) {
@@ -996,16 +1016,30 @@ function user_recover($mode, $edom, $email, $character, $ip) {
$ip = character IP
*/
// Structure verify array data correctly
- if ($mode === 'username') {
- $verify_data = array(
- 'password' => sha1($edom),
- 'email' => $email
- );
+ if (config('ServerEngine') !== 'OTHIRE') {
+ if ($mode === 'username') {
+ $verify_data = array(
+ 'password' => sha1($edom),
+ 'email' => $email
+ );
+ } else {
+ $verify_data = array(
+ 'name' => $edom,
+ 'email' => $email
+ );
+ }
} else {
- $verify_data = array(
- 'name' => $edom,
- 'email' => $email
- );
+ if ($mode === 'username') {
+ $verify_data = array(
+ 'password' => sha1($edom),
+ 'email' => $email
+ );
+ } else {
+ $verify_data = array(
+ 'id' => $edom,
+ 'email' => $email
+ );
+ }
}
// Determine if the submitted information is correct and herit from same account
if (user_account_fields_verify_value($verify_data)) {
@@ -1014,7 +1048,10 @@ function user_recover($mode, $edom, $email, $character, $ip) {
if ($mode == 'username') {
$account_id = user_account_id_from_password($verify_data['password']);
} else {
- $account_id = user_id($verify_data['name']);
+ if (config('ServerEngine') !== 'OTHIRE')
+ $account_id = user_id($verify_data['name']);
+ else
+ $account_id = user_id($verify_data['id']);
}
// get account id from character name
$player_account_id = user_character_account_id($character);
@@ -1028,8 +1065,13 @@ function user_recover($mode, $edom, $email, $character, $ip) {
// IP Match, time to stop verifying SHIT and get on
// With giving the visitor his goddamn username/password!
if ($mode == 'username') {
- $name_data = user_data($account_id, 'name');
- echo '
Your username is:
'. $name_data['name'] .'
';
+ if (config('ServerEngine') !== 'OTHIRE') {
+ $name_data = user_data($account_id, 'name');
+ echo '
Your username is:
'. $name_data['name'] .'
';
+ } else {
+ $name_data = user_data($account_id, 'id');
+ echo '
Your account number is:
'. $name_data['id'] .'
';
+ }
} else {
$newpass = substr(sha1(rand(1000000, 99999999)), 8);
echo '
Your new password is:
'. $newpass .'
Remember to login and change it!
';
@@ -1051,18 +1093,34 @@ function user_account_id_from_password($password) {
// Get account name from id.
function user_account_id_from_name($id) {
$id = (int)$id;;
- $result = mysql_select_single("SELECT `name` FROM `accounts` WHERE `id` = '" . $id . "' LIMIT 1;");
- return $result['name'];
+ if (config('ServerEngine') !== 'OTHIRE') {
+ $result = mysql_select_single("SELECT `name` FROM `accounts` WHERE `id` = '" . $id . "' LIMIT 1;");
+ return $result['name'];
+ } else {
+ $result = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id` = '" . $id . "' LIMIT 1;");
+ return $result['id'];
+ }
}
// Add additional premium days to account id
function user_account_add_premdays($accid, $days) {
$accid = (int)$accid;
$days = (int)$days;
- $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 (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'");
+ } else {
+ $data = mysql_select_single("SELECT `premend` FROM `accounts` WHERE `id`='$accid';");
+ $tmp = $data['premend'];
+ if($tmp == 0)
+ $tmp = time() + ($days * 24 * 60 * 60);
+ else
+ $tmp = $tmp + ($days * 24 * 60 * 60);
+ mysql_update("UPDATE `accounts` SET `premend`='$tmp' WHERE `id`='$accid'");
+ }
}
// Name = char name. Changes from male to female & vice versa.
@@ -1154,7 +1212,7 @@ function user_character_set_hide($char_id, $value) {
function user_create_account($register_data, $maildata) {
array_walk($register_data, 'array_sanitize');
- if (config('TFSVersion') == 'TFS_03' && config('salt') === true) {
+ if (config('ServerEngine') == 'TFS_03' && config('salt') === true) {
$register_data['salt'] = generate_recovery_key(18);
$register_data['password'] = sha1($register_data['salt'].$register_data['password']);
} else $register_data['password'] = sha1($register_data['password']);
@@ -1167,7 +1225,7 @@ function user_create_account($register_data, $maildata) {
unset($register_data['created']);
unset($register_data['flag']);
- if (config('TFSVersion') == 'TFS_10') $register_data['creation'] = $created;
+ if (config('ServerEngine') == 'TFS_10') $register_data['creation'] = $created;
$fields = '`'. implode('`, `', array_keys($register_data)) .'`';
$data = '\''. implode('\', \'', $register_data) .'\'';
@@ -1219,53 +1277,98 @@ function user_create_character($character_data) {
$cap = $base['cap'] + ( $gains['cap'] * $leveldiff );
// This is TFS 0.2 compatible import data with Znote AAC mysql schema
- $import_data = array(
- 'name' => $character_data['name'],
- 'group_id' => 1,
- 'account_id' => $character_data['account_id'],
- 'level' => $create['level'],
- 'vocation' => $vocation,
- 'health' => $health,
- 'healthmax' => $health,
- 'experience' => level_to_experience($create['level']),
- 'lookbody' => $outfit['body'], /* STARTER OUTFITS */
- 'lookfeet' => $outfit['feet'],
- 'lookhead' => $outfit['head'],
- 'looklegs' => $outfit['legs'],
- 'looktype' => $outfit['id'],
- 'lookaddons' => 0,
- 'maglevel' => $skills['magic'],
- 'mana' => $mana,
- 'manamax' => $mana,
- 'manaspent' => 0,
- 'soul' => $base['soul'],
- 'town_id' => $character_data['town_id'],
- 'posx' => $cnf['default_pos']['x'],
- 'posy' => $cnf['default_pos']['y'],
- 'posz' => $cnf['default_pos']['z'],
- 'conditions' => '',
- 'cap' => $cap,
- 'sex' => $character_data['sex'],
- 'lastlogin' => 0,
- 'lastip' => $character_data['lastip'],
- 'save' => 1,
- 'skull' => 0,
- 'skulltime' => 0,
- 'rank_id' => 0,
- 'guildnick' => '',
- 'lastlogout' => 0,
- 'blessings' => 0,
- 'direction' => 0,
- 'loss_experience' => 10,
- 'loss_mana' => 10,
- 'loss_skills' => 10,
- 'premend' => 0,
- 'online' => 0,
- 'balance' => 0
- );
+ if (config('ServerEngine') !== 'OTHIRE') {
+ $import_data = array(
+ 'name' => $character_data['name'],
+ 'group_id' => 1,
+ 'account_id' => $character_data['account_id'],
+ 'level' => $create['level'],
+ 'vocation' => $vocation,
+ 'health' => $health,
+ 'healthmax' => $health,
+ 'experience' => level_to_experience($create['level']),
+ 'lookbody' => $outfit['body'], /* STARTER OUTFITS */
+ 'lookfeet' => $outfit['feet'],
+ 'lookhead' => $outfit['head'],
+ 'looklegs' => $outfit['legs'],
+ 'looktype' => $outfit['id'],
+ 'lookaddons' => 0,
+ 'maglevel' => $skills['magic'],
+ 'mana' => $mana,
+ 'manamax' => $mana,
+ 'manaspent' => 0,
+ 'soul' => $base['soul'],
+ 'town_id' => $character_data['town_id'],
+ 'posx' => $cnf['default_pos']['x'],
+ 'posy' => $cnf['default_pos']['y'],
+ 'posz' => $cnf['default_pos']['z'],
+ 'conditions' => '',
+ 'cap' => $cap,
+ 'sex' => $character_data['sex'],
+ 'lastlogin' => 0,
+ 'lastip' => $character_data['lastip'],
+ 'save' => 1,
+ 'skull' => 0,
+ 'skulltime' => 0,
+ 'rank_id' => 0,
+ 'guildnick' => '',
+ 'lastlogout' => 0,
+ 'blessings' => 0,
+ 'direction' => 0,
+ 'loss_experience' => 10,
+ 'loss_mana' => 10,
+ 'loss_skills' => 10,
+ 'premend' => 0,
+ 'online' => 0,
+ 'balance' => 0
+ );
+ } else {
+ $import_data = array(
+ 'name' => $character_data['name'],
+ 'group_id' => 1,
+ 'account_id' => $character_data['account_id'],
+ 'level' => $create['level'],
+ 'vocation' => $vocation,
+ 'health' => $health,
+ 'healthmax' => $health,
+ 'experience' => level_to_experience($create['level']),
+ 'lookbody' => $outfit['body'], /* STARTER OUTFITS */
+ 'lookfeet' => $outfit['feet'],
+ 'lookhead' => $outfit['head'],
+ 'looklegs' => $outfit['legs'],
+ 'looktype' => $outfit['id'],
+ 'maglevel' => $skills['magic'],
+ 'mana' => $mana,
+ 'manamax' => $mana,
+ 'manaspent' => 0,
+ 'soul' => $base['soul'],
+ 'town_id' => $character_data['town_id'],
+ 'posx' => $cnf['default_pos']['x'],
+ 'posy' => $cnf['default_pos']['y'],
+ 'posz' => $cnf['default_pos']['z'],
+ 'conditions' => '',
+ 'cap' => $cap,
+ 'sex' => $character_data['sex'],
+ 'lastlogin' => 0,
+ 'lastip' => $character_data['lastip'],
+ 'save' => 1,
+ 'skull_type' => 0,
+ 'skull_time' => 0,
+ 'rank_id' => 0,
+ 'guildnick' => '',
+ 'lastlogout' => 0,
+ 'direction' => 0,
+ 'loss_experience' => 100,
+ 'loss_mana' => 100,
+ 'loss_skills' => 100,
+ 'loss_items' => 10,
+ 'online' => 0,
+ 'balance' => 0
+ );
+ }
// TFS 1.0 variations
- if ($cnf['TFSVersion'] === 'TFS_10') {
+ if ($cnf['ServerEngine'] === 'TFS_10') {
unset($import_data['rank_id']);
unset($import_data['guildnick']);
unset($import_data['direction']);
@@ -1309,7 +1412,7 @@ function user_create_character($character_data) {
mysql_insert("INSERT INTO `znote_players`(`player_id`, `created`, `hide_char`, `comment`) VALUES ('$charid', '$created', '0', '');");
// Player skills TFS 0.2, 0.3/4. (TFS 1.0 is done above character creation)
- if ($cnf['TFSVersion'] != 'TFS_10') {
+ if ($cnf['ServerEngine'] != 'TFS_10') {
mysql_delete("DELETE FROM `player_skills` WHERE `player_id`='{$charid}';");
mysql_insert("INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES ('{$charid}', '0', '".$skills['fist']."'), ('{$charid}', '1', '".$skills['club']."'), ('{$charid}', '2', '".$skills['sword']."'), ('{$charid}', '3', '".$skills['axe']."'), ('{$charid}', '4', '".$skills['dist']."'), ('{$charid}', '5', '".$skills['shield']."'), ('{$charid}', '6', '".$skills['fishing']."');");
}
@@ -1317,7 +1420,7 @@ function user_create_character($character_data) {
// Returns counted value of all players online
function user_count_online() {
- if (config('TFSVersion') == 'TFS_10') {
+ if (config('ServerEngine') == 'TFS_10') {
$online = mysql_select_single("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;");
return ($online !== false) ? $online['value'] : 0;
} else {
@@ -1464,7 +1567,10 @@ function user_activated($username) {
// Checks that username exist in database
function user_exist($username) {
$username = sanitize($username);
- $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username';");
+ if (config('ServerEngine') !== 'OTHIRE')
+ $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username';");
+ else
+ $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id`='$username';");
return ($data !== false) ? true : false;
}
@@ -1514,7 +1620,10 @@ function user_password_match($password, $account_id) {
// Get user ID from name
function user_id($username) {
$username = sanitize($username);
- $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' LIMIT 1;");
+ if (config('ServerEngine') !== 'OTHIRE')
+ $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' LIMIT 1;");
+ else
+ $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id`='$username' LIMIT 1;");
if ($data !== false) return $data['id'];
else return false;
}
@@ -1523,7 +1632,10 @@ function user_id($username) {
function user_login_id($username, $password) {
$username = sanitize($username);
$password = sha1($password);
- $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' AND `password`='$password' LIMIT 1;");
+ if (config('ServerEngine') !== 'OTHIRE')
+ $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' AND `password`='$password' LIMIT 1;");
+ else
+ $data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id`='$username' AND `password`='$password' LIMIT 1;");
if ($data !== false) return $data['id'];
else return false;
}
@@ -1573,7 +1685,10 @@ function user_character_hide($username) {
function user_login($username, $password) {
$username = sanitize($username);
$password = sha1($password);
- $data = mysql_select_single("SELECT `id` FROM accounts WHERE name='$username' AND password='$password';");
+ if (config('ServerEngine') !== 'OTHIRE')
+ $data = mysql_select_single("SELECT `id` FROM accounts WHERE name='$username' AND password='$password';");
+ else
+ $data = mysql_select_single("SELECT `id` FROM accounts WHERE id='$username' AND password='$password';");
return ($data !== false) ? $data['id'] : false;
}
diff --git a/engine/init.php b/engine/init.php
index 7bcb070..ef8555e 100644
--- a/engine/init.php
+++ b/engine/init.php
@@ -32,6 +32,11 @@ if ($config['use_captcha'] && !extension_loaded('openssl')) {
die("php openSSL is not enabled. It is required to for captcha services.
1. Find your php.ini file.
2. Uncomment extension=php_openssl
Restart web server.
If you don't want this then disable use_captcha in config.php.");
}
+// References ( & ) works as an alias for a variable,
+// they point to the same memmory, instead of duplicating it.
+if (!isset($config['TFSVersion'])) $config['TFSVersion'] = &$config['ServerEngine'];
+if (!isset($config['ServerEngine'])) $config['ServerEngine'] = &$config['TFSVersion'];
+
require_once 'database/connect.php';
require_once 'function/general.php';
require_once 'function/users.php';
@@ -47,7 +52,10 @@ Token::generate();
if (user_logged_in() === true) {
$session_user_id = getSession('user_id');
- $user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
+ if ($config['ServerEngine'] !== 'OTHIRE')
+ $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');
}
$errors = array();
@@ -152,4 +160,4 @@ if ($config['allowSubPages']) {
\ No newline at end of file
+?>
diff --git a/forum.php b/forum.php
index 772e07b..2a636ed 100644
--- a/forum.php
+++ b/forum.php
@@ -57,7 +57,7 @@ if ($admin) $yourChars = mysql_select_multi("SELECT `id`, `name`, `group_id` FRO
else $yourChars = mysql_select_multi("SELECT `id`, `name`, `group_id` FROM `players` WHERE `level`>='". $config['forum']['level'] ."' AND `account_id`='". $user_data['id'] ."';");
if (!$yourChars) $yourChars = array();
$charCount = count($yourChars);
-$yourAccess = accountAccess($user_data['id'], $config['TFSVersion']);
+$yourAccess = accountAccess($user_data['id'], $config['ServerEngine']);
if ($admin) {
if (!empty($_POST)) {
$guilds = mysql_select_multi("SELECT `id`, `name` FROM `guilds` ORDER BY `name`;");
diff --git a/guilds.php b/guilds.php
index 640a572..f89cef1 100644
--- a/guilds.php
+++ b/guilds.php
@@ -5,8 +5,13 @@ $isOtx = ($config['CustomVersion'] == 'OTX') ? true : false;
function guild_list($TFSVersion) {
$cache = new Cache('engine/cache/guildlist');
if ($cache->hasExpired()) {
- if ($TFSVersion != 'TFS_10') $guilds = mysql_select_multi("SELECT `t`.`id`, `t`.`name`, `t`.`creationdata`, `motd`, (SELECT count(p.rank_id) FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =`t`.`id`) AS `total` FROM `guilds` as `t` ORDER BY `t`.`name`;");
- else $guilds = mysql_select_multi("SELECT `id`, `name`, `creationdata`, `motd`, (SELECT COUNT('guild_id') FROM `guild_membership` WHERE `guild_id`=`id`) AS `total` FROM `guilds` ORDER BY `name`;");
+ if ($TFSVersion != 'TFS_10')
+ if ($TFSVersion === 'OTHIRE')
+ $guilds = mysql_select_multi("SELECT `t`.`id`, `t`.`name`, `t`.`creationdate`, (SELECT count(p.rank_id) FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =`t`.`id`) AS `total` FROM `guilds` as `t` ORDER BY `t`.`name`;");
+ else
+ $guilds = mysql_select_multi("SELECT `t`.`id`, `t`.`name`, `t`.`creationdata`, `motd`, (SELECT count(p.rank_id) FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =`t`.`id`) AS `total` FROM `guilds` as `t` ORDER BY `t`.`name`;");
+ else
+ $guilds = mysql_select_multi("SELECT `id`, `name`, `creationdata`, `motd`, (SELECT COUNT('guild_id') FROM `guild_membership` WHERE `guild_id`=`id`) AS `total` FROM `guilds` ORDER BY `name`;");
// Add level data info to guilds
if ($guilds !== false)
@@ -47,7 +52,7 @@ if (empty($_GET['name'])) {
//data_dump($guild, false, "guild data");
-$guilds = guild_list($config['TFSVersion']);
+$guilds = guild_list($config['ServerEngine']);
if (isset($guilds) && !empty($guilds) && $guilds !== false) {
//data_dump($guilds, false, "Guilds");
@@ -95,7 +100,7 @@ if (user_logged_in() === true) {
//code here
$name = sanitize($_POST['selected_char']);
$user_id = user_character_id($name);
- if ($config['TFSVersion'] !== 'TFS_10') $char_data = user_character_data($user_id, 'level', 'online');
+ if ($config['ServerEngine'] !== 'TFS_10') $char_data = user_character_data($user_id, 'level', 'online');
else {
$char_data = user_character_data($user_id, 'level');
$char_data['online'] = (user_is_online_10($user_id)) ? 1 : 0;
@@ -123,7 +128,7 @@ if (user_logged_in() === true) {
if ($gid === false) {
create_guild($user_id, $guildname);
// Re-cache the guild list
- $guilds = guild_list($config['TFSVersion']);
+ $guilds = guild_list($config['ServerEngine']);
header('Location: success.php');
exit();
} else echo 'A guild with that name already exist.';
@@ -232,7 +237,7 @@ if (user_logged_in() === true) {
Status: |
';
@@ -356,7 +361,7 @@ if (user_logged_in() === true) {
//
foreach ($inv_data as $inv) {
if ($inv['player_id'] == $_POST['joinguild']) {
- if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($_POST['joinguild'], 'online');
+ if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($_POST['joinguild'], 'online');
else $chardata['online'] = (user_is_online_10($_POST['joinguild'])) ? 1 : 0;
if ($chardata['online'] == 0) {
if (guild_player_join($_POST['joinguild'], $gid)) {
@@ -372,10 +377,10 @@ if (user_logged_in() === true) {
$name = sanitize($_POST['leave_guild']);
$cidd = user_character_id($name);
// If character is offline
- if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($cidd, 'online');
+ if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($cidd, 'online');
else $chardata['online'] = (user_is_online_10($cidd)) ? 1 : 0;
if ($chardata['online'] == 0) {
- if ($config['TFSVersion'] !== 'TFS_10') guild_player_leave($cidd);
+ if ($config['ServerEngine'] !== 'TFS_10') guild_player_leave($cidd);
else guild_player_leave_10($cidd);
header('Location: guilds.php?name='. $_GET['name']);
exit();
@@ -393,10 +398,10 @@ if ($highest_access >= 2) {
// Only allow normal symbols as guild nick
$p_nick = sanitize($_POST['guildnick']);
if ($p_guild['guild_id'] == $gid) {
- if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online');
+ if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online');
else $chardata['online'] = (user_is_online_10($p_cid)) ? 1 : 0;
if ($chardata['online'] == 0) {
- if ($config['TFSVersion'] !== 'TFS_10') update_player_guildnick($p_cid, $p_nick);
+ if ($config['ServerEngine'] !== 'TFS_10') update_player_guildnick($p_cid, $p_nick);
else update_player_guildnick_10($p_cid, $p_nick);
header('Location: guilds.php?name='. $_GET['name']);
exit();
@@ -414,10 +419,10 @@ if ($highest_access >= 2) {
if ($p_guild['guild_id'] == $gid) {
// Do the magic.
- if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online');
+ if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online');
else $chardata['online'] = (user_is_online_10($p_cid)) ? 1 : 0;
if ($chardata['online'] == 0) {
- if ($config['TFSVersion'] !== 'TFS_10') update_player_guild_position($p_cid, $p_rid);
+ if ($config['ServerEngine'] !== 'TFS_10') update_player_guild_position($p_cid, $p_rid);
else update_player_guild_position_10($p_cid, $p_rid);
header('Location: guilds.php?name='. $_GET['name']);
exit();
@@ -429,7 +434,7 @@ if ($highest_access >= 2) {
if (user_character_exist($_POST['invite'])) {
// Make sure they are not in another guild
- if ($config['TFSVersion'] != 'TFS_10') {
+ if ($config['ServerEngine'] != 'TFS_10') {
$charname = sanitize($_POST['invite']);
$playerdata = mysql_select_single("SELECT `id`, `rank_id` FROM `players` WHERE `name`='$charname' LIMIT 1;");
$charid = $playerdata['id'];
@@ -475,7 +480,7 @@ if ($highest_access >= 2) {
// First figure out if anyone are online.
foreach ($members as $member) {
- if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data(user_character_id($member['name']), 'online');
+ if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data(user_character_id($member['name']), 'online');
else $chardata['online'] = (user_is_online_10(user_character_id($member['name']))) ? 1 : 0;
if ($chardata['online'] == 1) {
$online = true;
@@ -484,7 +489,7 @@ if ($highest_access >= 2) {
if (!$online) {
// Then remove guild rank from every player.
- if ($config['TFSVersion'] !== 'TFS_10') foreach ($members as $member) guild_player_leave(user_character_id($member['name']));
+ if ($config['ServerEngine'] !== 'TFS_10') foreach ($members as $member) guild_player_leave(user_character_id($member['name']));
else foreach ($members as $member) guild_player_leave_10(user_character_id($member['name']));
// Remove all guild invitations to this guild
@@ -502,7 +507,7 @@ if ($highest_access >= 2) {
$old_leader = guild_leader($gid);
$online = false;
- if ($config['TFSVersion'] !== 'TFS_10') {
+ if ($config['ServerEngine'] !== 'TFS_10') {
$newData = user_character_data($new_leader, 'online');
$oldData = user_character_data($old_leader, 'online');
} else {
@@ -546,7 +551,7 @@ if ($highest_access >= 2) {
$name = sanitize($_POST['remove_member']);
$cid = user_character_id($name);
- if ($config['TFSVersion'] !== 'TFS_10') guild_remove_member($cid);
+ if ($config['ServerEngine'] !== 'TFS_10') guild_remove_member($cid);
else guild_remove_member_10($cid);
header('Location: guilds.php?name='. $_GET['name']);
exit();
@@ -571,7 +576,7 @@ if ($highest_access >= 2) {
}
}
- if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10' && $config['guildwar_enabled'] === true) {
+ if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10' && $config['guildwar_enabled'] === true) {
if (!empty($_POST['warinvite'])) {
if (get_guild_id($_POST['warinvite'])) {
$status = false;
@@ -814,7 +819,7 @@ if ($highest_access >= 2) {
-
+
Guild War Management: