Elise39u / LaravelAvontuur

A remade of my kilk game in larvael
0 stars 0 forks source link

Monster Drop system #4

Closed Elise39u closed 6 years ago

Elise39u commented 6 years ago

The chance on a item drop seems quite random now At least you have chance to get items from monsters that aren`t suppose to drop. And the items that are dropped are random too so can a Octo man drop a gold bar. But A Scoripo Can drop a paddle only And A Cerbeurs Can drop a Gold bar only

Elise39u commented 6 years ago

Solved by changeing the drop chance to be lower than monster chance. And change inventory item system when you had the item already 2.if (isset($monster_inventory)) { $inventory_id = NULL; $result = $this->checkInventory($item_id, $inventory_id); if ($result == 'success') { $inv_id = Auth::user()->inventory_id; $itemInventory = inventory_item::where('inventory_id', $inv_id)->where('item_id', $item_id)->get(); $itemInventory[0]->quantity = $itemInventory[0]->quantity + 1; $itemInventory[0]->save(); 1.if ($chance <= $random) {