diff --git a/app/controllers/SeminaryController.inc b/app/controllers/SeminaryController.inc index 8b722e33..cd647aad 100644 --- a/app/controllers/SeminaryController.inc +++ b/app/controllers/SeminaryController.inc @@ -31,7 +31,7 @@ * * @var array */ - public $models = array('seminaries', 'characters', 'characterroles', 'achievements'); + public $models = array('seminaries', 'characters', 'characterroles', 'xplevels', 'avatars', 'achievements'); /** * Current Seminary * @@ -84,6 +84,13 @@ { self::$character = $this->Characters->getCharacterForUserAndSeminary(self::$user['id'], self::$seminary['id']); self::$character['characterroles'] = array_map(function($r) { return $r['name']; }, $this->Characterroles->getCharacterrolesForCharacterById(self::$character['id'])); + try { + self::$character['xplevel'] = $this->Xplevels->getXPLevelById(self::$character['xplevel_id']); + self::$character['avatar'] = $this->Avatars->getAvatarByTypeAndLevel(self::$seminary['id'], self::$character['charactertype_url'], self::$character['xplevel']['level']); + } + catch(\nre\exceptions\IdNotFoundException $e) { + // No Avatar available + } } } catch(\nre\exceptions\IdNotFoundException $e) { diff --git a/controllers/CharactersController.inc b/controllers/CharactersController.inc index c13d571e..c8487629 100644 --- a/controllers/CharactersController.inc +++ b/controllers/CharactersController.inc @@ -103,6 +103,12 @@ foreach($this->Seminarycharacterfields->getFieldsForCharacter($character['id']) as $value) { $character['characterfields'][$value['url']] = $value; } + try { + $character['avatar'] = $this->Avatars->getAvatarByTypeAndLevel($seminary['id'], $character['charactertype_url'], $character['xplevel']['level']); + } + catch(\nre\exceptions\IdNotFoundException $e) { + // No Avatar available + } } diff --git a/controllers/SeminariesController.inc b/controllers/SeminariesController.inc index 2d1b73b3..93a31b8b 100644 --- a/controllers/SeminariesController.inc +++ b/controllers/SeminariesController.inc @@ -24,7 +24,7 @@ * * @var array */ - public $models = array('seminaries', 'users', 'characterroles', 'charactertypes', 'questgroupshierarchy', 'questgroups', 'questgrouptexts', 'media'); + public $models = array('seminaries', 'users', 'characterroles', 'charactertypes', 'xplevels', 'questgroupshierarchy', 'questgroups', 'questgrouptexts', 'media'); /** * Required components * @@ -76,6 +76,7 @@ $seminary['description'] = $description.(strlen($description) < strlen($seminary['description']) ? ' …' : null); $seminary['creator'] = $this->Users->getUserById($seminary['created_user_id']); $seminary['charactertypes'] = $this->Charactertypes->getCharacterTypesForSeminary($seminary['id']); + $seminary['xplevels'] = $this->Xplevels->getXPLevelsForSeminary($seminary['id']); // Character of currently logged-in user try { diff --git a/controllers/SeminarybarController.inc b/controllers/SeminarybarController.inc index c2b9b14d..00e7ee70 100644 --- a/controllers/SeminarybarController.inc +++ b/controllers/SeminarybarController.inc @@ -49,7 +49,6 @@ if(is_null($character)) { return; } - $character['xplevel'] = $this->Xplevels->getXPLevelById($character['xplevel_id']); $character['rank'] = $this->Characters->getXPRank($seminary['id'], $character['xps']); // Get “last” Quest diff --git a/views/html/characters/index.tpl b/views/html/characters/index.tpl index e79f1dd0..97e48e55 100644 --- a/views/html/characters/index.tpl +++ b/views/html/characters/index.tpl @@ -36,7 +36,9 @@