From 61bc3a616a89a1e037a5930d68c54ee64ec190ec Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 28 Aug 2017 18:12:55 +0200 Subject: [PATCH] * player sex is now configurable --- admin/template/template.php | 2 +- config.php | 8 +++++- install/template/template.php | 2 +- system/libs/pot/OTS.php | 11 +------- system/libs/pot/OTS_Player.php | 2 +- system/pages/accountmanagement.php | 42 +++++++++++++++++++----------- system/pages/admin/players.php | 4 +-- system/pages/characters.php | 8 +++--- tools/signature/mango.php | 7 +++-- 9 files changed, 50 insertions(+), 36 deletions(-) diff --git a/admin/template/template.php b/admin/template/template.php index 0c61e95f..13781c0b 100644 --- a/admin/template/template.php +++ b/admin/template/template.php @@ -87,7 +87,7 @@
diff --git a/config.php b/config.php index 32f8d69b..529821ef 100644 --- a/config.php +++ b/config.php @@ -56,7 +56,7 @@ $config = array( // cache system. by default file cache is used 'cache_engine' => 'auto', // apc, eaccelerator, xcache, file, auto, or blank to disable. - 'cache_prefix' => 'myaac_', // have to be unique if running more MyAAC instances on the same server + 'cache_prefix' => 'myaac_', // have to be unique if running more MyAAC instances on the same server (except file system cache) // database details (leave blank for auto detect from config.lua) 'database_host' => '', @@ -119,6 +119,12 @@ $config = array( 'send_mail_when_change_password' => true, // send e-mail with new password when change password to account 'send_mail_when_generate_reckey' => true, // send e-mail with rec key (key is displayed on page anyway when generate) + // genders (aka sex) + 'genders' => array( + 0 => 'Female', + 1 => 'Male' + ), + // new character config 'character_samples' => array( // vocations, format: ID_of_vocation => 'Name of Character to copy' //0 => 'Rook Sample', diff --git a/install/template/template.php b/install/template/template.php index dd6982e5..e5422831 100644 --- a/install/template/template.php +++ b/install/template/template.php @@ -40,7 +40,7 @@ \ No newline at end of file diff --git a/system/libs/pot/OTS.php b/system/libs/pot/OTS.php index f91831cb..9fb1552a 100644 --- a/system/libs/pot/OTS.php +++ b/system/libs/pot/OTS.php @@ -51,16 +51,7 @@ class POT * @since 0.0.4 */ const DB_ODBC = 4; - -/** - * Female gender. - */ - const SEX_FEMALE = 0; -/** - * Male gender. - */ - const SEX_MALE = 1; - + /** * @deprecated 0.0.5 Vocations are now loaded dynamicly from vocations.xml file. */ diff --git a/system/libs/pot/OTS_Player.php b/system/libs/pot/OTS_Player.php index b5985770..cce07abd 100644 --- a/system/libs/pot/OTS_Player.php +++ b/system/libs/pot/OTS_Player.php @@ -90,7 +90,7 @@ class OTS_Player extends OTS_Row_DAO * @version 0.1.2 * @var array */ - private $data = array('sex' => POT::SEX_FEMALE, 'vocation' => 0, 'experience' => 0, 'level' => 1, 'maglevel' => 0, 'health' => 100, 'healthmax' => 100, 'mana' => 100, 'manamax' => 100, 'manaspent' => 0, 'soul' => 0, 'lookbody' => 10, 'lookfeet' => 10, 'lookhead' => 10, 'looklegs' => 10, 'looktype' => 136, 'lookaddons' => 0, 'posx' => 0, 'posy' => 0, 'posz' => 0, 'cap' => 0, 'lastlogin' => 0, 'lastip' => 0, 'save' => true, 'skulltime' => 0, 'skull' => 0, 'balance' => 0, 'lastlogout' => 0, 'blessings' => 0, 'stamina' => 0, 'online' => 0, 'comment' => '', 'created' => 0, 'hidden' => 0); + private $data = array('sex' => 0, 'vocation' => 0, 'experience' => 0, 'level' => 1, 'maglevel' => 0, 'health' => 100, 'healthmax' => 100, 'mana' => 100, 'manamax' => 100, 'manaspent' => 0, 'soul' => 0, 'lookbody' => 10, 'lookfeet' => 10, 'lookhead' => 10, 'looklegs' => 10, 'looktype' => 136, 'lookaddons' => 0, 'posx' => 0, 'posy' => 0, 'posz' => 0, 'cap' => 0, 'lastlogin' => 0, 'lastip' => 0, 'save' => true, 'skulltime' => 0, 'skull' => 0, 'balance' => 0, 'lastlogout' => 0, 'blessings' => 0, 'stamina' => 0, 'online' => 0, 'comment' => '', 'created' => 0, 'hidden' => 0); /** * Player skills. diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php index 8410feeb..4cd4bdf4 100644 --- a/system/pages/accountmanagement.php +++ b/system/pages/accountmanagement.php @@ -876,10 +876,18 @@ Please enter your account name and your password.
logAction('Changed sex on character ' . $player->getName() . ' from ' . $sexes[$old_sex] . ' to ' . $sexes[$new_sex] . '.'); + $account_logged->logAction('Changed sex on character ' . $player->getName() . ' from ' . $old_sex_str . ' to ' . $new_sex_str . '.'); echo '
Character Sex Changed
The character '.$player->getName().' sex has been changed to ' . $sexes[$new_sex] . '.

'; } } @@ -920,9 +928,11 @@ Please enter your account name and your password.
New Sex: - '; + foreach($config['genders'] as $id => $name) { + echo ''; + } + echo ' @@ -1045,8 +1055,8 @@ Please enter your account name and your password.
1) @@ -1197,14 +1207,16 @@ Please enter your account name and your password.

'; - echo '
'; + + $i = 0; + foreach(array_reverse($config['genders'], true) as $id => $name) { + echo '
'; + } + + echo ''; echo '
'; if(count($config['character_samples']) > 1) { diff --git a/system/pages/admin/players.php b/system/pages/admin/players.php index 9a110bc2..7b8ed007 100644 --- a/system/pages/admin/players.php +++ b/system/pages/admin/players.php @@ -435,8 +435,8 @@ $account = $player->getAccount(); diff --git a/system/pages/characters.php b/system/pages/characters.php index 626f9271..087ec532 100644 --- a/system/pages/characters.php +++ b/system/pages/characters.php @@ -182,10 +182,12 @@ if($player->isLoaded() && !$player->isDeleted()) '; + $player_sex = 'Unknown'; + if(isset($config['genders'][$player->getSex()])) + $player_sex = strtolower($config['genders'][$player->getSex()]); + echo - ''; + ''; if($config['characters']['marriage_info'] && fieldExist('marriage', 'players')) { diff --git a/tools/signature/mango.php b/tools/signature/mango.php index c1aa52b3..86010147 100644 --- a/tools/signature/mango.php +++ b/tools/signature/mango.php @@ -2,7 +2,7 @@ defined('MYAAC') or die('Direct access not allowed!'); /** - ALTER TABLE `players` ADD `madphp_signature` TINYINT( 4 ) NOT NULL DEFAULT '1' COMMENT 'Absolute Mango © MadPHP.org', ADD `madphp_signature_bg` VARCHAR( 50 ) NOT NULL COMMENT 'Absolute Mango © MadPHP.org' AFTER `madphp_signature`, ADD `madphp_signature_eqs` TINYINT( 4 ) NOT NULL DEFAULT '0' COMMENT 'Absolute Mango © MadPHP.org' AFTER `madphp_signature_bg`, ADD `madphp_signature_bars` TINYINT( 4 ) NOT NULL DEFAULT '1' COMMENT 'Absolute Mango © MadPHP.org' AFTER `madphp_signature_eqs`, ADD `madphp_signature_cache` INT( 11 ) NOT NULL COMMENT 'Absolute Mango © MadPHP.org' AFTER `madphp_signature_bars`; + ALTER TABLE `players` ADD `madphp_signature` TINYINT( 4 ) NOT NULL DEFAULT '1' COMMENT 'Absolute Mango � MadPHP.org', ADD `madphp_signature_bg` VARCHAR( 50 ) NOT NULL COMMENT 'Absolute Mango � MadPHP.org' AFTER `madphp_signature`, ADD `madphp_signature_eqs` TINYINT( 4 ) NOT NULL DEFAULT '0' COMMENT 'Absolute Mango � MadPHP.org' AFTER `madphp_signature_bg`, ADD `madphp_signature_bars` TINYINT( 4 ) NOT NULL DEFAULT '1' COMMENT 'Absolute Mango � MadPHP.org' AFTER `madphp_signature_eqs`, ADD `madphp_signature_cache` INT( 11 ) NOT NULL COMMENT 'Absolute Mango � MadPHP.org' AFTER `madphp_signature_bars`; **/ /** Load the MadGD class **/ @@ -50,7 +50,10 @@ $MadGD->addText( $player->getName(), ( $player->isOnline() ? array( 'color' => '5df82d' ) : array( ) ) )->setPosition( ); $i++; /** SEX **/ $MadGD->addText( 'Sex:', $MadGD->textBold )->setPosition( 10, $i * $eachRow ); - $MadGD->addText( $player->getSex() == 1 ? 'male' : 'female' )->setPosition( ); $i++; + $player_sex = 'unknown'; + if(isset($config['genders'][$player->getSex()])) + $player_sex = strtolower($config['genders'][$player->getSex()]); + $MadGD->addText($player_sex)->setPosition( ); $i++; /** PROFESSION **/ $MadGD->addText( 'Profession:', $MadGD->textBold )->setPosition( 10, $i * $eachRow ); $MadGD->addText( $config['vocations'][$player->getVocation()] )->setPosition( ); $i++;
Sex: ' . $flag . ' '.$player->getName().''.$oldName. '
Sex:'. - ($player->getSex() == 0 ? 'female' : 'male'). - '
Sex:' . $player_sex . '