deannv / php-gachapon
A gachapon-like system, easy to integrate and play with.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/deannv/php-gachapon
README
A wild, basic gachapon system that I highly doubt will be working.
Installation
Install the package
composer require deannv/php-gachapon
Basic usage
note This package only accept associative array or key value pair data.
- Simple use case
// item_name => drop_rate_in_percentage Gacha::from(['a' => 2, 'b' => 10])->pull();
or if you want to get more than 1 result
Gacha::from(['a' => 2, 'b' => 10])->pull(2);
- Using object
$data = [ ["name" => "item1", "drop_rate" => 3], ["name" => "item2", "drop_rate" => 5], ["name" => "item3", "drop_rate" => 2] ]; Gacha::from($data)->pull();
- Or just using pull
Gacha::pull(2, ['a' => 2, 'b' => 10]);
this is the result (array)
Array
(
[0] => item2
)
that's it!