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:
Lee
2018-12-26 10:32:58 +00:00
committed by slawkens
parent 1b539f82ac
commit 2667d2b41c
6 changed files with 189 additions and 124 deletions

View File

@@ -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.

View File

@@ -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
/**#@-*/
?>
?>