mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
More changes to deleted characters (Account, guilds)
Account: Cannot change name, comment, gender + Cannot be deleted if owns a guild Guilds: Cannot create, cannot be invited, cannot accept invite, cannot be passed leadership to
This commit is contained in:
parent
aab62fb724
commit
24ff5684cd
@ -994,7 +994,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
$access = 0;
|
||||
|
||||
// finds ranks of all characters
|
||||
foreach($this->getPlayersList() as $player)
|
||||
foreach($this->getPlayersList(false) as $player)
|
||||
{
|
||||
$rank = $player->getRank();
|
||||
|
||||
|
@ -28,15 +28,22 @@ if($player_name != null) {
|
||||
if ($player->isLoaded()) {
|
||||
$player_account = $player->getAccount();
|
||||
if ($account_logged->getId() == $player_account->getId()) {
|
||||
if ($player->isDeleted()) {
|
||||
$errors[] = 'This character is deleted.';
|
||||
$player = null;
|
||||
}
|
||||
|
||||
if (isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) {
|
||||
$player->setCustomField("hidden", $new_hideacc);
|
||||
$player->setCustomField("comment", $new_comment);
|
||||
$account_logged->logAction('Changed comment for character <b>' . $player->getName() . '</b>.');
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Information Changed',
|
||||
'description' => 'The character information has been changed.'
|
||||
));
|
||||
$show_form = false;
|
||||
if(empty($errors)) {
|
||||
$player->setCustomField("hidden", $new_hideacc);
|
||||
$player->setCustomField("comment", $new_comment);
|
||||
$account_logged->logAction('Changed comment for character <b>' . $player->getName() . '</b>.');
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Information Changed',
|
||||
'description' => 'The character information has been changed.'
|
||||
));
|
||||
$show_form = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errors[] = 'Error. Character <b>' . $player_name . '</b> is not on your account.';
|
||||
|
@ -50,6 +50,10 @@ else
|
||||
if($player->isLoaded()) {
|
||||
$player_account = $player->getAccount();
|
||||
if($account_logged->getId() == $player_account->getId()) {
|
||||
if ($player->isDeleted()) {
|
||||
$errors[] = 'This character is deleted.';
|
||||
}
|
||||
|
||||
if($player->isOnline()) {
|
||||
$errors[] = 'This character is online.';
|
||||
}
|
||||
@ -91,7 +95,7 @@ else
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[] = 'Character <b>' . $player_name . '</b> is not on your account.';
|
||||
$errors[] = 'Character is not on your account.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -41,6 +41,10 @@ else
|
||||
$player_account = $player->getAccount();
|
||||
|
||||
if($account_logged->getId() == $player_account->getId()) {
|
||||
if ($player->isDeleted()) {
|
||||
$errors[] = 'This character is deleted.';
|
||||
}
|
||||
|
||||
if($player->isOnline()) {
|
||||
$errors[] = 'This character is online.';
|
||||
}
|
||||
@ -71,7 +75,7 @@ else
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[] = 'Character <b>'.$player_name.'</b> is not on your account.';
|
||||
$errors[] = 'Character is not on your account.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -85,7 +89,7 @@ else
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
$twig->display('account.change_sex.html.twig', array(
|
||||
'players' => $account_logged->getPlayersList(),
|
||||
'players' => $account_logged->getPlayersList(false),
|
||||
'player_sex' => isset($player) ? $player->getSex() : -1,
|
||||
'points' => $points
|
||||
));
|
||||
|
@ -61,6 +61,14 @@ if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
|
||||
}
|
||||
}
|
||||
|
||||
$ownerid = 'ownerid';
|
||||
if($db->hasColumn('guilds', 'owner_id'))
|
||||
$ownerid = 'owner_id';
|
||||
$guild = $db->query('SELECT `name` FROM `guilds` WHERE `' . $ownerid . '` = '.$player->getId());
|
||||
if($guild->rowCount() > 0) {
|
||||
$errors[] = 'You cannot delete a character when they own a guild.';
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
//dont show table "delete character" again
|
||||
$show_form = false;
|
||||
|
@ -45,6 +45,8 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
$errors[] = 'Character with name <b> ' . $name. ' </b> is not in your account.';
|
||||
}else if ($player->getRank()->isLoaded()){
|
||||
$errors[] = 'Character with name <b>'.$name.'</b> is already in guild. You must leave guild before you join other guild.';
|
||||
} else if ($player->isDeleted()) {
|
||||
$errors[] = "Character with name <b>$name</b> has been deleted.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,7 +74,7 @@ else
|
||||
{
|
||||
if(empty($errors)) {
|
||||
$acc_invited = false;
|
||||
$account_players = $account_logged->getPlayers();
|
||||
$account_players = $account_logged->getPlayersList(false);
|
||||
include(SYSTEM . 'libs/pot/InvitesDriver.php');
|
||||
new InvitesDriver($guild);
|
||||
$invited_list = $guild->listInvites();
|
||||
|
@ -22,7 +22,7 @@ if(!$logged) {
|
||||
$array_of_player_nig = array();
|
||||
if(empty($guild_errors))
|
||||
{
|
||||
$account_players = $account_logged->getPlayers();
|
||||
$account_players = $account_logged->getPlayersList(false);
|
||||
foreach($account_players as $player)
|
||||
{
|
||||
$player_rank = $player->getRank();
|
||||
@ -73,6 +73,10 @@ if($todo == 'save')
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($guild_errors) && $player->isDeleted()) {
|
||||
$guild_errors[] = "Character <b>$name</b> has been deleted.";
|
||||
}
|
||||
|
||||
if(empty($guild_errors))
|
||||
{
|
||||
$bad_char = true;
|
||||
@ -132,5 +136,3 @@ else {
|
||||
'players' => $array_of_player_nig
|
||||
));
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -72,6 +72,8 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
$player->find($name);
|
||||
if(!$player->isLoaded()) {
|
||||
$errors[] = 'Player with name <b>' . $name . '</b> doesn\'t exist.';
|
||||
} else if ($player->isDeleted()) {
|
||||
$errors[] = "Character with name <b>$name</b> has been deleted.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -36,6 +36,8 @@ if(empty($guild_errors)) {
|
||||
$to_player->find($pass_to);
|
||||
if(!$to_player->isLoaded()) {
|
||||
$guild_errors2[] = 'Player with name <b>'.$pass_to.'</b> doesn\'t exist.';
|
||||
} else if ($to_player->isDeleted()) {
|
||||
$guild_errors2[] = "Character with name <b>$pass_to</b> has been deleted.";
|
||||
}
|
||||
|
||||
if(empty($guild_errors2)) {
|
||||
|
@ -25,7 +25,7 @@ To change a name of character select player and choose a new name.<br/>
|
||||
<td class="LabelV" ><span>Character:</span></td>
|
||||
<td style="width:90%;" >
|
||||
<select name="player_id">
|
||||
{% for player in account_logged.getPlayersList() %}
|
||||
{% for player in account_logged.getPlayersList(false) %}
|
||||
<option value="{{ player.getId() }}">{{ player.getName() }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
@ -74,4 +74,4 @@ To change a name of character select player and choose a new name.<br/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript" src="tools/check_name.js"></script>
|
||||
<script type="text/javascript" src="tools/check_name.js"></script>
|
||||
|
@ -179,7 +179,7 @@
|
||||
<td>{% if player.getLastLogin() > 0 %}{{ player.getLastLogin|date('d F Y (H:i)') }}{% else %}Never.{% endif %}</td>
|
||||
<td>{% if player.isOnline() %}<span style="color: green">ONLINE</span>{% else %}<span style="color: red">Offline</span>{% endif %}</td>
|
||||
<td>{% if player.isHidden() %}Hidden{% else %}Visible{% endif %}</td>
|
||||
<td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td>
|
||||
<td>{% if not player.isDeleted() %}[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -442,7 +442,7 @@
|
||||
{% else %}
|
||||
<td><span style="color: red"><b>Offline</b></span></td>
|
||||
{% endif %}
|
||||
<td>[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]</td>
|
||||
<td>{% if not player.isDeleted() %}[<a href="{{ getLink('account/character/comment/' ~ player.getName|urlencode) }}" >Edit</a>]{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
Loading…
x
Reference in New Issue
Block a user