コード例 #1
0
 public function showItem($id, $name)
 {
     $item = ItemTemplateManager::find($id);
     $craft = CraftManager::find($item->id);
     $itemset = ItemsetManager::find($item->panoplie);
     $itemsetObjects = $itemset ? ItemTemplateManager::where('panoplie', $itemset->ID)->orderBy('level', 'asc')->get() : [];
     $drops = DropManager::join('monsters', 'monsters.id', '=', 'drops.mob')->where('item', $item->id)->get();
     return view('encyclopedia.item', compact('item', 'craft', 'itemset', 'itemsetObjects', 'drops'));
 }
コード例 #2
0
ファイル: JsonController.php プロジェクト: synthx/infuse
 public function encodeJsonItemsets()
 {
     $itemsets = \App\Model\Itemset::select('ID', 'name', 'bonus')->get();
     $json = '{<br/>';
     foreach ($itemsets as $itemset) {
         $json .= '"' . $itemset->ID . '" : {"name" : "' . e($itemset->name) . '", "bonus" : "' . $itemset->bonus . '"},<br/>';
     }
     $json .= '}';
     return $json;
 }
コード例 #3
0
ファイル: Shop.php プロジェクト: Synthx/Acamar
 public function allItemsets($items)
 {
     $data = [];
     $string = '';
     foreach ($items as $item) {
         if ($item->panoplie != '-1') {
             if (!in_array($item->panoplie, $data)) {
                 array_push($data, $item->panoplie);
                 $string .= '<option value=".pano_' . $item->panoplie . '">' . \App\Model\Itemset::find($item->panoplie)->name . '</option>';
             }
         }
     }
     return $string;
 }
コード例 #4
0
ファイル: Code.php プロジェクト: synthx/infuse
 /**
  * Title of code page
  *
  * @param int $action
  * @param int $param
  */
 public function type($action, $param)
 {
     switch ($action) {
         case 1:
             return 'Don de ' . $param . ' points';
             break;
         case 2:
             return 'Don du ' . \App\Model\Tokens::find($param)->name;
             break;
         case 3:
             return 'Don de l\'objet ' . \App\Model\ItemTemplate::find($param)->name;
             break;
         case 4:
             return 'Don de la ' . \App\Model\Itemset::find($param)->name;
             break;
     }
 }
コード例 #5
0
ファイル: ShopController.php プロジェクト: synthx/infuse
 /**
  * Buy itemset on shop
  * POST
  *
  * @param Request $request
  * @param int $id
  * @param string $name
  * @return Response
  */
 public function buyItemset(Request $request, $id, $name)
 {
     $itemset = ItemsetManager::find($id);
     $user = UserManager::find(Auth::user()->guid);
     $this->validate($request, ['player' => 'required|numeric|exists:personnages,guid']);
     if ($user->points < $itemset->price) {
         return redirect()->back();
     }
     $user->points -= $itemset->price;
     $user->save();
     $objects = explode(',', $itemset->items);
     foreach ($objects as $id) {
         if (!empty($id)) {
             $this->_giveObject($request->player, $id);
         }
     }
     return redirect()->route('shop.itemsets');
 }
コード例 #6
0
ファイル: GiftController.php プロジェクト: synthx/infuse
 /**
  * Confirm code and give reward
  * POST
  *
  * @param Request $request
  * @param string $key
  * @return Response
  */
 public function confirmCode(Request $request, $key)
 {
     $user = UserManager::find(Auth::user()->guid);
     $code = CodeManager::find($key);
     $code->use -= 1;
     $code->accounts .= $user->guid . '|';
     $code->save();
     switch ($code->action) {
         case 1:
             //Give points
             $user->points += $code->param;
             $user->save();
             break;
         case 2:
             //Give tokens
             $token = \App\Model\TokensAccount::where('guid', $user->guid)->where('token', $code->param)->first();
             if (!$token) {
                 $token = new \App\Model\TokensAccount();
                 $token->guid = $user->guid;
                 $token->token = $code->param;
                 $token->quantity = 1;
             } else {
                 $token->quantity += 1;
             }
             $token->save();
             break;
         case 3:
             //Give item
             $this->validate($request, ['player' => 'required|numeric|exists:personnages,guid']);
             $this->GiveObject($request->player, $code->param);
             break;
         case 4:
             //Give itemsets
             $this->validate($request, ['player' => 'required|numeric|exists:personnages,guid']);
             $itemset = \App\Model\Itemset::find($code->param);
             $exp = explode(',', $itemset->items);
             foreach ($exp as $id) {
                 $this->_giveObject($request->player, $id);
             }
             break;
     }
     if ($code->use == 0) {
         $code->delete();
     }
     return redirect()->route('gift.code');
 }