mardi 1 septembre 2020

Create Droptable Javascript

Lets say i have a different set of items, as example Item1, that drops 1 in 5000, item2, that drops 1 in 3, item3 that drops 1 in 750 and item4 that drops 1 in 40

Is there some sort of function i could make(if so how(?)), that would generate this for me?

example:

let droprates: [
{name: 'item1', dropin: 1, dropof: 5000},
{name: 'item2', dropin: 1, dropof: 3},
{name: 'item3', dropin: 1, dropof: 750},
{name: 'item4', dropin: 1, dropof: 40}];

function FunctionThatChecksMydrops() {

 //get droptable
//run droptable calculations
//outputs if any item dropped.

}

call FunctionThatChecksMydrops() // output if any of these items dropped for me.

Question 1: What would be the best way to impliment a drop table like this? that would allow different droprates and do a droprate check to see if any is dropped?

Question 2: What would i need to do to make it only get 1 drop? example:

let droprates: [
{name: 'item1', dropin: 1, dropof: 5000, id: 1},
{name: 'item2', dropin: 1, dropof: 3, id: 2},
{name: 'item3', dropin: 1, dropof: 750, id: 3},
{name: 'item4', dropin: 1, dropof: 40}, id: 4];

-> call droprates -> do some calculations -> if id 1 didnt drop, continue to id2, if id2 didnt drop, continue to 3, if any dropped, return the first dropped one.




Aucun commentaire:

Enregistrer un commentaire