-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] Cancel Deletion #172
Comments
@Leesneaks, do you still plan to continue this? |
Players often delete character to unlock it's name. So 'delete' action should change name of character and 'undelete' should change it back. // code from other AAC Delete player code - allows anyone to delete character: $i = 0;
$nameCheckPlayer = new Player();
$nameCheckPlayer->find($player->generateDeletedName($i));
while ($nameCheckPlayer->isLoaded()) {
$i++;
$nameCheckPlayer->find($player->generateDeletedName($i));
}
$player->setName($player->generateDeletedName($i)); Undelete code - allows undelete only if no one else is using character name already: $undeletePlayerName = $player->generateUndeletedName();
$testUndeletePlayerName = new Player($undeletePlayerName, Player::LOADTYPE_NAME);
if ($testUndeletePlayerName->isLoaded()) {
echo Website::messageError('Cannot undelete <b>' . htmlspecialchars($player->getName()) . '</b>!<br />' .
'Player with name <b>' . htmlspecialchars($undeletePlayerName) . '</b> already exists.<br />' .
'It must be renamed or deleted before you can undelete this character.');
return;
}
public function generateDeletedName($i)
{
if (substr($this->getName(), 0, 3) === '[D]')
throw new RuntimeException('Cannot generate delete name for deleted character.');
return '[D][' . $i . ']' . $this->getName();
}
public function generateUndeletedName()
{
if (substr($this->getName(), 0, 3) !== '[D]' || stripos($this->getName(), ']', 3) === false)
throw new RuntimeException('Cannot generate undelete name for not deleted character.');
return substr($this->getName(), stripos($this->getName(), ']', 3) + 1);
} |
hello you can add support to cancel deletion of characters in account page
The text was updated successfully, but these errors were encountered: