* player sex is now configurable

This commit is contained in:
slawkens 2017-08-28 18:12:55 +02:00
parent 430351aee3
commit 61bc3a616a
9 changed files with 50 additions and 36 deletions

View File

@ -87,7 +87,7 @@
<div id="content"><?php echo $content; ?></div>
</div>
<div id="footer">
Powered by <a href="http://my-aac.org" target="_blank">MyAAC</a>
<?php echo base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4='); ?>
</div>
</div>
<?php endif; ?>

View File

@ -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',

View File

@ -40,7 +40,7 @@
</div>
<div id="footer">
<p style="text-align: center;">Powered by <a href="http://my-aac.org" target="_blank">MyAAC.</a></p>
<p style="text-align: center;"><?php echo base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4='); ?></p>
</div>
</body>
</html>

View File

@ -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.
*/

View File

@ -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.

View File

@ -876,10 +876,18 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
$sex_changed = true;
$old_sex = $player->getSex();
$player->setSex($new_sex);
$sexes = array(0 => 'Female', 1 => 'Male');
$old_sex_str = 'Unknown';
if(isset($config['genders'][$old_sex]))
$old_sex_str = $config['genders'][$old_sex];
$new_sex_str = 'Unknown';
if(isset($config['genders'][$new_sex]))
$new_sex_str = $config['genders'][$new_sex];
$player->save();
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
$account_logged->logAction('Changed sex on character <b>' . $player->getName() . '</b> from <b>' . $sexes[$old_sex] . '</b> to <b>' . $sexes[$new_sex] . '</b>.');
$account_logged->logAction('Changed sex on character <b>' . $player->getName() . '</b> from <b>' . $old_sex_str . '</b> to <b>' . $new_sex_str . '</b>.');
echo '<div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Character Sex Changed</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td>The character <b>'.$player->getName().'</b> sex has been changed to <b>' . $sexes[$new_sex] . '</b>.</td></tr> </table> </div> </table></div></td></tr><br><center><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$template_path.'/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
}
}
@ -920,9 +928,11 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
<tr>
<td class="LabelV" ><span >New Sex:</td>
<td>
<select name="new_sex">
<option value="0"' . ($player->getSex() == 0 ? ' selected' : '') . '>Female</option>
<option value="1"' . ($player->getSex() == 1 ? ' selected' : '') . '>Male</option>
<select name="new_sex">';
foreach($config['genders'] as $id => $name) {
echo '<option value="' . $id . '"' . ($player->getSex() == $id ? ' selected' : '') . '>' . $name . '</option>';
}
echo '
</select>
</td>
</tr>
@ -1045,8 +1055,8 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
if(!admin() && !check_name_new_char($newchar_name, $error)) {
$newchar_errors[] = $error;
}
if($newchar_sex != 1 && $newchar_sex != "0")
$newchar_errors[] = 'Sex must be equal <b>0 (female)</b> or <b>1 (male)</b>.';
if(!isset($config['genders'][$newchar_sex]))
$newchar_errors[] = 'Sex is invalid.';
if(!in_array($newchar_town, $config['character_towns']))
$newchar_errors[] = 'Please select valid town.';
if(count($config['character_samples']) > 1)
@ -1197,14 +1207,16 @@ Please enter your account name and your password.<br/><a href="?subtopic=createa
</font>
</td>
<td>';
echo '<input type="radio" name="newcharsex" id="newcharsex" value="1" ';
if($newchar_sex == 1)
echo 'checked="checked" ';
echo '><label for="newcharsex">male</label><br/>';
echo '<input type="radio" name="newcharsex" id="newcharsex2" value="0" ';
if($newchar_sex == "0")
echo 'checked="checked" ';
echo '><label for="newcharsex2">female</label><br/></td></tr></table></div></div></table></div>';
$i = 0;
foreach(array_reverse($config['genders'], true) as $id => $name) {
echo '<input type="radio" name="newcharsex" id="newcharsex' . ++$i . '" value="' . $id . '" ';
if($newchar_sex == "$id")
echo 'checked="checked" ';
echo '><label for="newcharsex' . $i . '">' . strtolower($name) . '</label><br/>';
}
echo '</td></tr></table></div></div></table></div>';
echo '<div class="InnerTableContainer" > <table style="width:100%;" ><tr>';
if(count($config['character_samples']) > 1)
{

View File

@ -435,8 +435,8 @@ $account = $player->getAccount();
<td>Sex:</td>
<td>
<select name="sex">
<?php foreach(array('female', 'male') as $id => $sex): ?>
<option value="<?php echo $id; ?>" <?php echo ($player->getSex() == $id ? 'selected' : ''); ?>><?php echo $sex; ?></option>
<?php foreach($config['genders'] as $id => $sex): ?>
<option value="<?php echo $id; ?>" <?php echo ($player->getSex() == $id ? 'selected' : ''); ?>><?php echo strtolower($sex); ?></option>
<?php endforeach; ?>
</select>
</td>

View File

@ -182,10 +182,12 @@ if($player->isLoaded() && !$player->isDeleted())
<TD>' . $flag . ' <font color="'.($player->isOnline() ? 'green' : 'red').'"><b>'.$player->getName().'</b></font>'.$oldName.
'</TD></TR>';
$player_sex = 'Unknown';
if(isset($config['genders'][$player->getSex()]))
$player_sex = strtolower($config['genders'][$player->getSex()]);
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Sex:</TD><TD>'.
($player->getSex() == 0 ? 'female' : 'male').
'</TD></TR>';
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Sex:</TD><TD>' . $player_sex . '</TD></TR>';
if($config['characters']['marriage_info'] && fieldExist('marriage', 'players'))
{

View File

@ -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 <EFBFBD> MadPHP.org', ADD `madphp_signature_bg` VARCHAR( 50 ) NOT NULL COMMENT 'Absolute Mango <EFBFBD> MadPHP.org' AFTER `madphp_signature`, ADD `madphp_signature_eqs` TINYINT( 4 ) NOT NULL DEFAULT '0' COMMENT 'Absolute Mango <EFBFBD> MadPHP.org' AFTER `madphp_signature_bg`, ADD `madphp_signature_bars` TINYINT( 4 ) NOT NULL DEFAULT '1' COMMENT 'Absolute Mango <EFBFBD> MadPHP.org' AFTER `madphp_signature_eqs`, ADD `madphp_signature_cache` INT( 11 ) NOT NULL COMMENT 'Absolute Mango <EFBFBD> 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++;