Move rest of config to settings

Remove config.php completely
Add new settings category: Game
Fix account_login_by_email
Min textarea size = 2 + adjusted automatically
This commit is contained in:
slawkens 2023-08-05 09:38:26 +02:00
parent eca896954c
commit cb6e777c69
9 changed files with 339 additions and 170 deletions

3
.gitignore vendored
View File

@ -2,6 +2,9 @@ Thumbs.db
.DS_Store .DS_Store
.idea .idea
#
/.htaccess
# composer # composer
composer.lock composer.lock
vendor vendor

View File

@ -143,7 +143,6 @@ if(!IS_CLI) {
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']); //define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
} }
require SYSTEM . 'config.php';
if (file_exists(BASE . 'config.local.php')) { if (file_exists(BASE . 'config.local.php')) {
require BASE . 'config.local.php'; require BASE . 'config.local.php';
} }

View File

@ -24,6 +24,12 @@ $deprecatedConfig = [
'outfit_images_wrong_looktypes', 'outfit_images_wrong_looktypes',
'item_images_url', 'item_images_url',
'account_country', 'account_country',
'towns',
'quests',
'character_samples',
'character_towns',
'characters_per_account',
'characters_search_limit',
'news_author', 'news_author',
'news_limit', 'news_limit',
'news_ticker_limit', 'news_ticker_limit',
@ -52,6 +58,8 @@ $deprecatedConfig = [
'status_ip', 'status_ip',
'status_port', 'status_port',
'mail_enabled', 'mail_enabled',
'account_login_by_email',
'account_login_by_email_fallback',
'account_mail_verify', 'account_mail_verify',
'account_create_character_create', 'account_create_character_create',
'account_change_character_name', 'account_change_character_name',
@ -70,3 +78,26 @@ foreach ($deprecatedConfig as $key => $value) {
//var_dump($settings['core.'.$value]['value']); //var_dump($settings['core.'.$value]['value']);
} }
$deprecatedConfigCharacters = [
'level',
'experience',
'magic_level',
'balance',
'marriage_info' => 'marriage',
'outfit',
'creation_date',
'quests',
'skills',
'equipment',
'frags',
'deleted',
];
$tmp = [];
foreach ($deprecatedConfigCharacters as $key => $value) {
$tmp[(is_string($key) ? $key : $value)] = setting('core.characters_'.$value);
}
config(['characters', $tmp]);
unset($tmp);

View File

@ -1,71 +0,0 @@
<?php
/**
* This is MyAAC's Main Configuration file
*
* All the default values are kept here, you should not modify it but use
* a config.local.php file instead to override the settings from here.
*
* This is a piece of PHP code so PHP syntax applies!
* For boolean values please use true/false.
*
* Minimally 'server_path' directive have to be filled, other options are optional.
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2019 MyAAC
* @link https://my-aac.org
*/
// TODO:
// this file will be deleted, once all migrated to settings
$config = array(
'account_mail_block_plus_sign' => true, // block email with '+' signs like test+box@gmail.com (help protect against spamming accounts)
'characters_per_account' => 10, // max. number of characters per account
// new character config
'character_samples' => array( // vocations, format: ID_of_vocation => 'Name of Character to copy'
//0 => 'Rook Sample',
1 => 'Sorcerer Sample',
2 => 'Druid Sample',
3 => 'Paladin Sample',
4 => 'Knight Sample'
),
'use_character_sample_skills' => false,
// it must show limited number of players after using search in character page
'characters_search_limit' => 15,
// town list used when creating character
// won't be displayed if there is only one item (rookgaard for example)
'character_towns' => array(1),
// list of towns
// if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (from MySQL database - Table - towns)
// otherwise it will try to load from your .OTBM map file
// if you don't see towns on website, then you need to fill this out
'towns' => array(
0 => 'No town',
1 => 'Sample town'
),
// characters page
'characters' => array( // what things to display on character view page (true/false in each option)
'level' => true,
'experience' => false,
'magic_level' => false,
'balance' => false,
'marriage_info' => true, // only 0.3
'outfit' => true,
'creation_date' => true,
'quests' => true,
'skills' => true,
'equipment' => true,
'frags' => false,
'deleted' => false, // should deleted characters from same account be still listed on the list of characters? When enabled it will show that character is "[DELETED]"
),
'quests' => array(
//'Some Quest' => 123,
//'Some Quest Two' => 456,
), // quests list (displayed in character view), name => storage
);

View File

@ -149,7 +149,7 @@ class CreateCharacter
$char_to_copy = new OTS_Player(); $char_to_copy = new OTS_Player();
$char_to_copy->find($char_to_copy_name); $char_to_copy->find($char_to_copy_name);
if(!$char_to_copy->isLoaded()) if(!$char_to_copy->isLoaded())
$errors[] = 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config.php and set valid characters to copy names. Character to copy: <b>'.$char_to_copy_name.'</b> doesn\'t exist.'; $errors[] = 'Wrong characters configuration. Try again or contact with admin. ADMIN: Go to Admin Panel -> Settings -> Create Character and set valid characters to copy names. Character to copy: <b>'.$char_to_copy_name.'</b> doesn\'t exist.';
} }
if(!empty($errors)) { if(!empty($errors)) {
@ -195,7 +195,7 @@ class CreateCharacter
for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++) { for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++) {
$value = 10; $value = 10;
if (config('use_character_sample_skills')) { if (setting('core.use_character_sample_skills')) {
$value = $char_to_copy->getSkill($skill); $value = $char_to_copy->getSkill($skill);
} }
@ -241,7 +241,7 @@ class CreateCharacter
if($db->hasTable('player_skills')) { if($db->hasTable('player_skills')) {
for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++) { for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++) {
$value = 10; $value = 10;
if (config('use_character_sample_skills')) { if (setting('core.use_character_sample_skills')) {
$value = $char_to_copy->getSkill($skill); $value = $char_to_copy->getSkill($skill);
} }
$skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $skill); $skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $skill);

View File

@ -248,7 +248,13 @@ class Settings implements ArrayAccess
} }
else if($setting['type'] === 'textarea') { else if($setting['type'] === 'textarea') {
echo '<textarea class="form-control" name="settings[' . $key . ']" id="' . $key . '">' . ($settingsDb[$key] ?? ($setting['default'] ?? '')) . '</textarea>'; $value = ($settingsDb[$key] ?? ($setting['default'] ?? ''));
$valueWithSpaces = array_map('trim', preg_split('/\r\n|\r|\n/', trim($value)));
$rows = count($valueWithSpaces);
if ($rows < 2) {
$rows = 2; // always min 2 rows for textarea
}
echo '<textarea class="form-control" rows="' . $rows . '" name="settings[' . $key . ']" id="' . $key . '">' . $value . '</textarea>';
} }
else if ($setting['type'] === 'options') { else if ($setting['type'] === 'options') {
@ -314,8 +320,7 @@ class Settings implements ArrayAccess
?> ?>
</td> </td>
<td> <td>
<div class="well"> <div class="well setting-default"><?php
<?php
echo ($setting['desc'] ?? ''); echo ($setting['desc'] ?? '');
echo '<br/>'; echo '<br/>';
echo '<strong>Default:</strong> '; echo '<strong>Default:</strong> ';
@ -331,8 +336,7 @@ class Settings implements ArrayAccess
echo $setting['options'][$setting['default']]; echo $setting['options'][$setting['default']];
} }
} }
?> ?></div>
</div>
</td> </td>
</tr> </tr>
<?php <?php

View File

@ -117,7 +117,7 @@ class Validator
return false; return false;
} }
if(config('account_mail_block_plus_sign')) { if(setting('core.account_mail_block_plus_sign')) {
$explode = explode('@', $email); $explode = explode('@', $email);
if(isset($explode[0]) && (strpos($explode[0],'+') !== false)) { if(isset($explode[0]) && (strpos($explode[0],'+') !== false)) {
self::$lastError = 'Please do not use plus (+) sign in your e-mail.'; self::$lastError = 'Please do not use plus (+) sign in your e-mail.';

View File

@ -26,11 +26,11 @@ return [
'name' => 'App Environment', 'name' => 'App Environment',
'type' => 'options', 'type' => 'options',
'options' => ['prod' => 'Production', 'dev' => 'Development'], 'options' => ['prod' => 'Production', 'dev' => 'Development'],
'desc' => 'if you use this script on your live server - set production<br/> 'desc' => 'if you use this script on your live server - set production<br/>' .
* if you want to test and debug the script locally, or develop plugins, set to development<br/> '* if you want to test and debug the script locally, or develop plugins, set to development<br/>' .
* WARNING: on "development" cache is disabled, so site will be significantly slower !!!<br/> '* WARNING: on "development" cache is disabled, so site will be significantly slower !!!<br/>' .
* WARNING2: on "development" all PHP errors/warnings are displayed<br/> '* WARNING2: on "development" all PHP errors/warnings are displayed<br/>' .
* Recommended: "production" cause of speed (page load time is better)', '* Recommended: "production" cause of speed (page load time is better)',
'default' => 'prod', 'default' => 'prod',
'is_config' => true, 'is_config' => true,
], ],
@ -41,28 +41,6 @@ return [
'default' => '', 'default' => '',
'is_config' => true, 'is_config' => true,
], ],
'gzip_output' => [
'name' => 'gzip Output',
'type' => 'boolean',
'desc' => 'gzip page content before sending it to the browser, uses less bandwidth but more cpu cycles',
'default' => false,
'is_config' => true,
],
'cache_engine' => [
'name' => 'Cache Engine',
'type' => 'options',
'options' => ['auto' => 'Auto', 'file' => 'Files', 'apc' => 'APC', 'apcu' => 'APCu', 'eaccelerator' => 'eAccelerator', 'disable' => 'Disable'],
'desc' => 'Auto is most reasonable. It will detect the best cache engine',
'default' => 'auto',
'is_config' => true,
],
'cache_prefix' => [
'name' => 'Cache Prefix',
'type' => 'text',
'desc' => 'Have to be unique if running more MyAAC instances on the same server (except file system cache)',
'default' => 'myaac_' . generateRandomString(8, true, false, true),
'is_config' => true,
],
'date_timezone' => [ 'date_timezone' => [
'name' => 'Date Timezone', 'name' => 'Date Timezone',
'type' => 'options', 'type' => 'options',
@ -70,27 +48,22 @@ return [
'desc' => 'Timezone of the server, more info at http://php.net/manual/en/timezones.php', 'desc' => 'Timezone of the server, more info at http://php.net/manual/en/timezones.php',
'default' => 'Europe/Warsaw', 'default' => 'Europe/Warsaw',
], ],
'genders' => [ 'friendly_urls' => [
'name' => 'Genders (aka sex)', 'name' => 'Friendly URLs',
'type' => 'textarea', 'type' => 'boolean',
'desc' => 'Separated with comma', 'desc' => 'It makes links looks more elegant to eye, and also are SEO friendly<br/><br/>' .
'default' => 'Female, Male', 'yes: http://example.net/guilds/Testing<br/>' .
'callbacks' => [ 'no: http://example.net/index.php/guilds/Testing<br/><br/>' .
'get' => function ($value) { '<strong>apache2:</strong> mod_rewrite is required for this + remember to rename .htaccess.dist to .htaccess<br/>' .
return array_map('trim', explode(',', $value)); '<strong>nginx:</strong> check included nginx-sample.conf',
}, 'default' => false,
],
], ],
'account_types' => [ 'gzip_output' => [
'name' => 'Account Types', 'name' => 'gzip Output',
'type' => 'textarea', 'type' => 'boolean',
'desc' => 'Separated with comma, you may need to adjust this for older tfs versions by removing Community Manager', 'desc' => 'gzip page content before sending it to the browser, uses less bandwidth but more cpu cycles',
'default' => 'None, Normal, Tutor, Senior Tutor, Gamemaster, Community Manager, God', 'default' => false,
'callbacks' => [ 'is_config' => true,
'get' => function ($value) {
return array_map('trim', explode(',', $value));
},
],
], ],
'google_analytics_id' => [ 'google_analytics_id' => [
'name' => 'Google Analytics ID', 'name' => 'Google Analytics ID',
@ -204,6 +177,103 @@ return [
'type' => 'section', 'type' => 'section',
'title' => 'Misc' 'title' => 'Misc'
], ],
'cache_engine' => [
'name' => 'Cache Engine',
'type' => 'options',
'options' => ['auto' => 'Auto', 'file' => 'Files', 'apc' => 'APC', 'apcu' => 'APCu', 'eaccelerator' => 'eAccelerator', 'disable' => 'Disable'],
'desc' => 'Auto is most reasonable. It will detect the best cache engine',
'default' => 'auto',
'is_config' => true,
],
'cache_prefix' => [
'name' => 'Cache Prefix',
'type' => 'text',
'desc' => 'Have to be unique if running more MyAAC instances on the same server (except file system cache)',
'default' => 'myaac_' . generateRandomString(8, true, false, true),
'is_config' => true,
],
'session_prefix' => [
'name' => 'Session Prefix',
'type' => 'text',
'desc' => 'must be unique for every site on your server',
'default' => 'myaac_',
],
'backward_support' => [
'name' => 'Gesior Backward Support',
'type' => 'boolean',
'desc' => 'gesior backward support (templates & pages)<br/>' .
'allows using gesior templates and pages with myaac<br/>' .
'might bring some performance when disabled',
'default' => true,
],
'anonymous_usage_statistics' => [
'name' => 'Anonymous Usage Statistics',
'type' => 'boolean',
'desc' => 'Allow MyAAC to report anonymous usage statistics to developers? The data is sent only once per 30 days and is fully confidential. It won\'t affect the performance of your website',
'default' => true,
],
[
'type' => 'category',
'title' => 'Game',
],
[
'type' => 'section',
'title' => 'Game'
],
'client' => [
'name' => 'Client Version',
'type' => 'options',
'options' => '$clients',
'desc' => 'what client version are you using on this OT?<br/>used for the Downloads page and some templates aswell',
'default' => 710
],
'towns' => [
'name' => 'Towns',
'type' => 'textarea',
'desc' => "if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (from MySQL database - Table - towns)<br/>" .
"otherwise it will try to load from your .OTBM map file<br/>" .
"if you don't see towns on website, then you need to fill this out",
'default' => "0=No Town\n1=Sample Town",
'callbacks' => [
'get' => function ($value) {
$ret = [];
$towns = array_map('trim', preg_split('/\r\n|\r|\n/', trim($value)));
foreach ($towns as $town) {
if (empty($town)) {
continue;
}
$explode = explode('=', $town);
$ret[$explode[0]] = $explode[1];
}
return $ret;
},
],
],
'genders' => [
'name' => 'Genders (aka sex)',
'type' => 'textarea',
'desc' => 'Separated with comma',
'default' => 'Female, Male',
'callbacks' => [
'get' => function ($value) {
return array_map('trim', explode(',', $value));
},
],
],
'account_types' => [
'name' => 'Account Types',
'type' => 'textarea',
'desc' => 'Separated with comma, you may need to adjust this for older tfs versions by removing Community Manager',
'default' => 'None, Normal, Tutor, Senior Tutor, Gamemaster, Community Manager, God',
'callbacks' => [
'get' => function ($value) {
return array_map('trim', explode(',', $value));
},
],
],
'vocations_amount' => [ 'vocations_amount' => [
'name' => 'Vocations Amount', 'name' => 'Vocations Amount',
'type' => 'number', 'type' => 'number',
@ -221,43 +291,6 @@ return [
}, },
], ],
], ],
'client' => [
'name' => 'Client Version',
'type' => 'options',
'options' => '$clients',
'desc' => 'what client version are you using on this OT?<br/>used for the Downloads page and some templates aswell',
'default' => 710
],
'session_prefix' => [
'name' => 'Session Prefix',
'type' => 'text',
'desc' => 'must be unique for every site on your server',
'default' => 'myaac_',
],
'friendly_urls' => [
'name' => 'Friendly URLs',
'type' => 'boolean',
'desc' => 'It makes links looks more elegant to eye, and also are SEO friendly<br/><br/>
yes: http://example.net/guilds/Testing<br/>
no: http://example.net/?subtopic=guilds&name=Testing<br/><br/>
<strong>apache2:</strong> mod_rewrite is required for this + remember to rename .htaccess.dist to .htaccess<br/>
<strong>nginx:</strong> check included nginx-sample.conf',
'default' => false,
],
'backward_support' => [
'name' => 'Gesior Backward Support',
'type' => 'boolean',
'desc' => 'gesior backward support (templates & pages)<br/>
allows using gesior templates and pages with myaac<br/>
might bring some performance when disabled',
'default' => true,
],
'anonymous_usage_statistics' => [
'name' => 'Anonymous Usage Statistics',
'type' => 'boolean',
'desc' => 'Allow MyAAC to report anonymous usage statistics to developers? The data is sent only once per 30 days and is fully confidential. It won\'t affect the performance of your website',
'default' => true,
],
[ [
'type' => 'category', 'type' => 'category',
'title' => 'Database', 'title' => 'Database',
@ -552,7 +585,7 @@ Sent by MyAAC,<br/>
], ],
], ],
'mail_lost_account_interval' => [ 'mail_lost_account_interval' => [
'name' => 'Default Account Premium Days', 'name' => 'Mail Lost Interface Interval',
'type' => 'number', 'type' => 'number',
'desc' => 'Time in seconds between e-mails to one account from lost account interface, block spam', 'desc' => 'Time in seconds between e-mails to one account from lost account interface, block spam',
'default' => 60, 'default' => 60,
@ -585,6 +618,9 @@ Sent by MyAAC,<br/>
'type' => 'boolean', 'type' => 'boolean',
'desc' => "allow also additionally login by Account Name/Number (for users that might forget their email). Works only if Account Login By E-Mail is also enabled", 'desc' => "allow also additionally login by Account Name/Number (for users that might forget their email). Works only if Account Login By E-Mail is also enabled",
'default' => false, 'default' => false,
'show_if' => [
'account_login_by_email', '=', 'true'
],
], ],
'account_create_auto_login' => [ 'account_create_auto_login' => [
'name' => 'Account Create Auto Login', 'name' => 'Account Create Auto Login',
@ -622,6 +658,12 @@ Sent by MyAAC,<br/>
'desc' => 'How many days user need to change email to account - block hackers', 'desc' => 'How many days user need to change email to account - block hackers',
'default' => 2, 'default' => 2,
], ],
'account_mail_block_plus_sign' => [
'name' => 'Account Mail Block Plus Sign (+)',
'type' => 'boolean',
'desc' => "Block E-Mails with '+' signs like test+box@gmail.com (help protect against spamming accounts)",
'default' => true,
],
'account_country' => [ 'account_country' => [
'name' => 'Account Country', 'name' => 'Account Country',
'type' => 'boolean', 'type' => 'boolean',
@ -634,10 +676,52 @@ Sent by MyAAC,<br/>
'desc' => 'should country of user be automatically recognized by his IP? This makes an external API call to http://ipinfo.io', 'desc' => 'should country of user be automatically recognized by his IP? This makes an external API call to http://ipinfo.io',
'default' => true, 'default' => true,
], ],
'characters_per_account' => [
'name' => 'Characters per Account',
'type' => 'number',
'desc' => 'Max. number of characters per account',
'default' => 10,
],
'create_character' => [ 'create_character' => [
'type' => 'section', 'type' => 'section',
'title' => 'Create Character', 'title' => 'Create Character',
], ],
'character_samples' => [
'name' => 'Character Samples',
'type' => 'textarea',
'desc' => "Character Samples used when creating character.<br/>" .
"Format: <strong>ID_of_vocation =Name of Character to copy</strong><br/>" .
"For Rook use - <strong>0=Rook Sample</strong>",
'default' => "1=Sorcerer Sample\n2=Druid Sample\n3=Paladin Sample\n4=Knight Sample",
'callbacks' => [
'get' => function ($value) {
$ret = [];
$vocs = array_map('trim', preg_split('/\r\n|\r|\n/', trim($value)));
foreach ($vocs as $voc) {
if (empty($voc)) {
continue;
}
$explode = explode('=', $voc);
$ret[$explode[0]] = $explode[1];
}
return $ret;
},
],
],
'character_towns' => [
'name' => 'Towns List',
'type' => 'text',
'desc' => "Towns List used when creating character separated by comma (,). Won't be displayed if there is only one item (rookgaard for example)",
'default' => '1,2',
'callbacks' => [
'get' => function ($value) {
return array_map('trim', explode(',', $value));
},
],
],
'create_character_name_min_length' => [ 'create_character_name_min_length' => [
'name' => 'Name Min Length', 'name' => 'Name Min Length',
'type' => 'number', 'type' => 'number',
@ -701,6 +785,12 @@ Sent by MyAAC,<br/>
'desc' => 'Should spells names and words be blocked when creating character?', 'desc' => 'Should spells names and words be blocked when creating character?',
'default' => true, 'default' => true,
], ],
'use_character_sample_skills' => [
'name' => 'Use Character Sample Skills',
'type' => 'boolean',
'desc' => 'No = default skill = 10, yes - use sample skills',
'default' => false,
],
'account_mail_confirmed_reward' => [ 'account_mail_confirmed_reward' => [
'type' => 'section', 'type' => 'section',
'title' => 'Reward Users for confirming their E-Mails. Works only with Account Mail Verify enabled', 'title' => 'Reward Users for confirming their E-Mails. Works only with Account Mail Verify enabled',
@ -709,7 +799,7 @@ Sent by MyAAC,<br/>
], ],
], ],
'account_mail_confirmed_reward_premium_days' => [ 'account_mail_confirmed_reward_premium_days' => [
'name' => 'Reward Premium Points', 'name' => 'Reward Premium Days',
'type' => 'number', 'type' => 'number',
'desc' => '0 to disable', 'desc' => '0 to disable',
'default' => 0, 'default' => 0,
@ -727,7 +817,7 @@ Sent by MyAAC,<br/>
], ],
], ],
'account_mail_confirmed_reward_coins' => [ 'account_mail_confirmed_reward_coins' => [
'name' => 'Reward Premium Points', 'name' => 'Reward Coins',
'type' => 'number', 'type' => 'number',
'desc' => '0 to disable. Works only with servers that supports coins', 'desc' => '0 to disable. Works only with servers that supports coins',
'default' => 0, 'default' => 0,
@ -980,6 +1070,114 @@ Sent by MyAAC,<br/>
}, },
], ],
], ],
[
'type' => 'section',
'title' => 'Characters Page',
],
'characters_search_limit' => [
'name' => 'Characters Search Limit',
'type' => 'number',
'desc' => "How many characters (players) to show when using search function",
'default' => 15,
],
'characters_level' => [
'name' => 'Display Level',
'type' => 'boolean',
'desc' => 'Show characters level',
'default' => true,
],
'characters_experience' => [
'name' => 'Display Experience',
'type' => 'boolean',
'desc' => 'Show characters experience points',
'default' => false,
],
'characters_magic_level' => [
'name' => 'Display Magic Level',
'type' => 'boolean',
'desc' => 'Show characters magic level',
'default' => false,
],
'characters_balance' => [
'name' => 'Display Balance',
'type' => 'boolean',
'desc' => 'Show characters bank balance',
'default' => false,
],
'characters_marriage' => [
'name' => 'Display Marriage',
'type' => 'boolean',
'desc' => 'Show characters marriage info. Works only in TFS 0.3',
'default' => true,
],
'characters_outfit' => [
'name' => 'Display Outfit',
'type' => 'boolean',
'desc' => 'Show characters outfit',
'default' => true,
],
'characters_creation_date' => [
'name' => 'Display Creation Date',
'type' => 'boolean',
'desc' => 'Show characters date of creation',
'default' => true,
],
'characters_quests' => [
'name' => 'Display Quests',
'type' => 'boolean',
'desc' => 'Show characters quests. Can be configured below',
'default' => true,
],
'quests' => [
'name' => 'Quests List',
'type' => 'textarea',
'desc' => 'Character Quests List. Format: NameOfQuest=StorageValue',
'default' => "Some Quest=123\nSome Quest Two=456",
'show_if' => [
'characters_quests', '=', 'true'
],
'callbacks' => [
'get' => function ($value) {
$ret = [];
$quests = array_map('trim', preg_split('/\r\n|\r|\n/', trim($value)));
foreach ($quests as $quest) {
if (empty($quest)) {
continue;
}
$explode = explode('=', $quest);
$ret[$explode[0]] = $explode[1];
}
return $ret;
},
],
],
'characters_skills' => [
'name' => 'Display Skills',
'type' => 'boolean',
'desc' => 'Show characters skills',
'default' => true,
],
'characters_equipment' => [
'name' => 'Display Equipment',
'type' => 'boolean',
'desc' => 'Show characters equipment',
'default' => true,
],
'characters_frags' => [
'name' => 'Display Frags',
'type' => 'boolean',
'desc' => 'Show characters frags',
'default' => false,
],
'characters_deleted' => [
'name' => 'Display Deleted',
'type' => 'boolean',
'desc' => 'Should deleted characters from same account be still listed on the list of characters? When enabled it will show that character is "[DELETED]',
'default' => false,
],
[ [
'type' => 'section', 'type' => 'section',
'title' => 'Online Page' 'title' => 'Online Page'
@ -1192,7 +1390,7 @@ Sent by MyAAC,<br/>
'monsters_images_preview' => [ 'monsters_images_preview' => [
'name' => 'Monsters Images Preview', 'name' => 'Monsters Images Preview',
'type' => 'boolean', 'type' => 'boolean',
'desc' => 'Set to true to allow picture previews for creatures', 'desc' => 'Set to yes to allow picture previews for creatures',
'default' => false, 'default' => false,
], ],
'monsters_items_url' => [ 'monsters_items_url' => [
@ -1204,7 +1402,7 @@ Sent by MyAAC,<br/>
'monsters_loot_percentage' => [ 'monsters_loot_percentage' => [
'name' => 'Monsters Items URL', 'name' => 'Monsters Items URL',
'type' => 'boolean', 'type' => 'boolean',
'desc' => 'Set to true to show the loot tooltip percent', 'desc' => 'Set to yes to show the loot tooltip percent',
'default' => true, 'default' => true,
], ],
// this is hidden, because no implemented yet // this is hidden, because no implemented yet

View File

@ -18,6 +18,11 @@
</form> </form>
</div> </div>
</div> </div>
<style>
.setting-default {
white-space: pre-wrap;
}
</style>
<script> <script>
function doShowHide(el, show) function doShowHide(el, show)
{ {