mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Fix: do not count deleted characters
On create new character page
This commit is contained in:
parent
a271edec47
commit
855e9aa3b9
@ -103,7 +103,7 @@ class CreateCharacter
|
|||||||
|
|
||||||
if(empty($errors))
|
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'))
|
if($number_of_players_on_account >= config('characters_per_account'))
|
||||||
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
|
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
* @return OTS_Players_List List of players from current account.
|
* @return OTS_Players_List List of players from current account.
|
||||||
* @throws E_OTS_NotLoaded If account is not loaded.
|
* @throws E_OTS_NotLoaded If account is not loaded.
|
||||||
*/
|
*/
|
||||||
public function getPlayersList()
|
public function getPlayersList($withDeleted = true)
|
||||||
{
|
{
|
||||||
if( !isset($this->data['id']) )
|
if( !isset($this->data['id']) )
|
||||||
{
|
{
|
||||||
@ -737,6 +737,15 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
$filter = new OTS_SQLFilter();
|
$filter = new OTS_SQLFilter();
|
||||||
$filter->compareField('account_id', (int) $this->data['id']);
|
$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
|
// creates list object
|
||||||
$list = new OTS_Players_List();
|
$list = new OTS_Players_List();
|
||||||
$list->setFilter($filter);
|
$list->setFilter($filter);
|
||||||
|
@ -2,7 +2,7 @@ Please choose a name{% if config.character_samples|length > 1 %}, vocation{% end
|
|||||||
{% if config.character_towns|length > 1 %}, town{% endif %}
|
{% if config.character_towns|length > 1 %}, town{% endif %}
|
||||||
and sex for your character. <br/>
|
and sex for your character. <br/>
|
||||||
In any case the name must not violate the naming conventions stated in the <a href="?subtopic=rules" target="_blank" >{{ config.lua.serverName }} Rules</a>, or your character might get deleted or name locked.
|
In any case the name must not violate the naming conventions stated in the <a href="?subtopic=rules" target="_blank" >{{ config.lua.serverName }} Rules</a>, 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 %}
|
||||||
<b><span style="color: red"> You have maximum number of characters per account on your account. Delete one before you make new.</span></b>
|
<b><span style="color: red"> You have maximum number of characters per account on your account. Delete one before you make new.</span></b>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user