diff --git a/system/libs/CreateCharacter.php b/system/libs/CreateCharacter.php index 01fb70ac..6eb4771b 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()->count(); + $number_of_players_on_account = $account->getPlayersList(false)->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/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index e380d2fc..beed47dd 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -733,7 +733,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable * @return OTS_Players_List List of players from current account. * @throws E_OTS_NotLoaded If account is not loaded. */ - public function getPlayersList() + public function getPlayersList($withDeleted = true) { if( !isset($this->data['id']) ) { @@ -744,6 +744,15 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable $filter = new OTS_SQLFilter(); $filter->compareField('account_id', (int) $this->data['id']); + if(!$withDeleted) { + global $db; + if($db->hasColumn('players', 'deletion')) { + $filter->compareField('deletion', 0); + } else { + $filter->compareField('deleted', 0); + } + } + // creates list object $list = new OTS_Players_List(); $list->setFilter($filter); diff --git a/system/templates/account.create_character.html.twig b/system/templates/account.create_character.html.twig index f8796a94..038db541 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()|length >= config.characters_per_account %} +{% if account_logged.getPlayersList(false)|length >= config.characters_per_account %} You have maximum number of characters per account on your account. Delete one before you make new. {% endif %}

@@ -145,4 +145,4 @@ In any case the name must not violate the naming conventions stated in the - \ No newline at end of file +