From aab62fb724f3ffac6c4e6f39fcc1b9e7ac7b9ad2 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 27 Jun 2023 15:02:28 +0200 Subject: [PATCH] Important fix: Not allow create char if limit is exceeded (by @anyeor ) Could have been used to spam database, now it doesn't ignore deleted characters He is not my brother :P Just same last name --- system/libs/CreateCharacter.php | 2 +- system/templates/account.create_character.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libs/CreateCharacter.php b/system/libs/CreateCharacter.php index c81893e1..60909c0f 100644 --- a/system/libs/CreateCharacter.php +++ b/system/libs/CreateCharacter.php @@ -138,7 +138,7 @@ class CreateCharacter if(empty($errors)) { - $number_of_players_on_account = $account->getPlayersList(false)->count(); + $number_of_players_on_account = $account->getPlayersList(true)->count(); if($number_of_players_on_account >= config('characters_per_account')) $errors[] = 'You have too many characters on your account ('.$number_of_players_on_account.'/'.config('characters_per_account').')!'; } diff --git a/system/templates/account.create_character.html.twig b/system/templates/account.create_character.html.twig index 8d823b2f..045c749c 100644 --- a/system/templates/account.create_character.html.twig +++ b/system/templates/account.create_character.html.twig @@ -2,7 +2,7 @@ Please choose a name{% if config.character_samples|length > 1 %}, vocation{% end {% if config.character_towns|length > 1 %}, town{% endif %} and sex for your character.
In any case the name must not violate the naming conventions stated in the {{ config.lua.serverName }} Rules, or your character might get deleted or name locked. -{% if account_logged.getPlayersList(false)|length >= config.characters_per_account %} +{% if account_logged.getPlayersList(true)|length >= config.characters_per_account %} You have maximum number of characters per account on your account. Delete one before you make new. {% endif %}