mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +02:00
Updates + Fixes (#66)
* Updates +added account editor country list +added account editor website access flag editor. +added player blessing1-8 editor +added fav icon +added $account->setLastLogin +added $player->checkBlessings (for blessings 1-8) +bug fixes * Blessing Fix Should now detect the amount of blessings if blessings1 onwards exists.
This commit is contained in:
@@ -426,7 +426,11 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
{
|
||||
$this->data['country'] = (string) $country;
|
||||
}
|
||||
|
||||
|
||||
public function setLastLogin($lastlogin)
|
||||
{
|
||||
$this->data['lastday'] = (int) $lastlogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name.
|
||||
|
@@ -2231,6 +2231,36 @@ class OTS_Player extends OTS_Row_DAO
|
||||
$this->data['blessings'] = (int) $blessings;
|
||||
}
|
||||
|
||||
public function countBlessings()
|
||||
{
|
||||
if( !isset($this->db) )
|
||||
{
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
for( $i = 8; $i >= 1; $i-- ) {
|
||||
if ($this->db->hasColumn('players', 'blessings' . $i)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $i;
|
||||
}
|
||||
|
||||
public function checkBlessings($count)
|
||||
{
|
||||
if( !isset($this->data['id']) )
|
||||
{
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
for( $i = 1; $i <= $count; $i++ ) {
|
||||
$fields[] = 'blessings'.$i;
|
||||
}
|
||||
|
||||
$value = $this->db->query('SELECT '. implode(', ', $fields) .' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id'])->fetch();
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getStamina()
|
||||
{
|
||||
if( !isset($this->data['stamina']) )
|
||||
@@ -3608,4 +3638,4 @@ class OTS_Player extends OTS_Row_DAO
|
||||
|
||||
/**#@-*/
|
||||
|
||||
?>
|
||||
?>
|
Reference in New Issue
Block a user