コード例 #1
0
ファイル: Tokens.php プロジェクト: synthx/infuse
 /**
  * Get item's image of token
  *
  * @param string $itemString
  */
 public function getItems($itemString)
 {
     $itemLib = new Item();
     $html = '';
     $itemArray = [];
     if (!empty($itemString)) {
         $items = explode(',', $itemString);
         foreach ($items as $item) {
             if (!empty($item)) {
                 array_push($itemArray, $item);
             }
         }
         $objects = ItemTemplateManager::whereIn('id', $itemArray)->orderByRaw('RAND()')->take(6)->get();
         foreach ($objects as $object) {
             $html .= $itemLib->generateTooltip($object->id, $object->name, $object->level, $object->type, $object->icon, $object->statsTemplate, 52);
         }
     }
     return $html;
 }
コード例 #2
0
ファイル: Item.php プロジェクト: synthx/infuse
 /**
  * Show if item is use in another recipe
  *
  * @param int $id
  */
 public function useInCraft($id)
 {
     $text = '';
     $itemArray = [];
     $crafts = \App\Model\Craft::all();
     foreach ($crafts as $craft) {
         if (!empty($craft->craft)) {
             $objects = explode(';', $craft);
             foreach ($objects as $object) {
                 if (!empty($object)) {
                     list($itemId) = explode('*', $object);
                     if ($itemId == $id) {
                         array_push($itemArray, $craft->id);
                     }
                 }
             }
         }
     }
     if (count($itemArray) > 0) {
         $text .= '<div class="ak-container ak-panel"><div class="ak-panel-title"><span class="ak-panel-title-icon"></span>Est utilisé dans la recette</div><div class="ak-panel-content"><div class="ak-container ak-content-list ak-displaymode-image-col"><div class="row ak-container">';
         $items = \App\Model\ItemTemplate::whereIn('id', $itemArray)->orderBy('level', 'asc')->get();
         foreach ($items as $item) {
             $text .= '<div class="ak-column ak-container col-xs-12 col-md-6"><div class="ak-list-element"><div class="ak-main"><div class="ak-main-content"><div class="ak-image"><span class="ak-linker">' . $this->generateTooltip($item->id, $item->name, $item->level, $item->type, $item->icon, $item->statsTemplate, 48) . '</span></div><div class="ak-content"><div class="ak-title"><a href="' . route('encyclopedia.' . $this->routeName($item->type), [$item->id, str_slug($item->name)]) . '">' . $item->name . '</a></div><div class="ak-text">' . $this->type($item->type) . '</div></div><div class="ak-aside">Niv. ' . $item->level . '</div></div></div></div></div><div class="clearfix  visible-xs visible-sm"></div>';
         }
         $text .= '</div></div></div></div>';
     }
     return $text;
 }
コード例 #3
0
ファイル: TokensController.php プロジェクト: synthx/infuse
 /**
  * Show token of user
  * GET
  *
  * @param int $id
  * @param string $name
  * @return Response
  */
 public function showToken($id, $name)
 {
     $token = TokensAccountManager::join('cms_tokens', 'cms_tokens.id', '=', 'token')->where('guid', Auth::user()->guid)->where('token', $id)->first();
     $players = PlayerManager::where('account', Auth::user()->guid)->get();
     $ids = explode(',', $token->items);
     $objectArray = [];
     foreach ($ids as $id) {
         if (!empty($id)) {
             array_push($objectArray, $id);
         }
     }
     $objects = ItemTemplateManager::whereIn('id', $objectArray)->orderBy('level', 'asc')->get();
     return view('tokens.page', compact('token', 'objects', 'players'));
 }