make XP-level optional for Characters

This commit is contained in:
coderkun 2014-07-31 12:49:11 +02:00
commit 955861f528
3 changed files with 48 additions and 6 deletions

View file

@ -96,13 +96,18 @@
$characters = $this->Characters->getCharactersForSeminarySorted($seminary['id'], $sortorder, $charactername, $limit, $offset);
foreach($characters as &$character)
{
$character['xplevel'] = $this->Xplevels->getXPLevelById($character['xplevel_id']);
$character['user'] = $this->Users->getUserById($character['user_id']);
$character['characterroles'] = array_map(function($r) { return $r['name']; }, $this->Characterroles->getCharacterrolesForCharacterById($character['id']));
$character['characterfields'] = array();
foreach($this->Seminarycharacterfields->getFieldsForCharacter($character['id']) as $value) {
$character['characterfields'][$value['url']] = $value;
}
try {
$character['xplevel'] = $this->Xplevels->getXPLevelById($character['xplevel_id']);
}
catch(\nre\exceptions\IdNotFoundException $e) {
// No XP-level
}
try {
$character['avatar'] = $this->Avatars->getAvatarByTypeAndLevel($seminary['id'], $character['charactertype_url'], $character['xplevel']['level']);
}
@ -146,7 +151,12 @@
// Get Character
$character = $this->Characters->getCharacterByUrl($seminary['id'], $characterUrl);
$character['xplevel'] = $this->Xplevels->getXPLevelById($character['xplevel_id']);
try {
$character['xplevel'] = $this->Xplevels->getXPLevelById($character['xplevel_id']);
}
catch(\nre\exceptions\IdNotFoundException $e) {
// No XP-level
}
$character['rank'] = $this->Characters->getXPRank($seminary['id'], $character['xps']);
// Get User