Removed redundant function
This commit is contained in:
parent
852157aabf
commit
c114d4285f
@ -2,20 +2,6 @@ import { injectable } from "tsyringe";
|
|||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class WeightedRandomHelper {
|
export class WeightedRandomHelper {
|
||||||
/**
|
|
||||||
* @deprecated USE getWeightedValue() WHERE POSSIBLE
|
|
||||||
* Gets a tplId from a weighted dictionary
|
|
||||||
* @param {tplId: weighting[]} itemArray
|
|
||||||
* @returns tplId
|
|
||||||
*/
|
|
||||||
public getWeightedInventoryItem(itemArray: { [tplId: string]: unknown } | ArrayLike<unknown>): string {
|
|
||||||
const itemKeys = Object.keys(itemArray);
|
|
||||||
const weights = Object.values(itemArray);
|
|
||||||
const chosenItem = this.weightedRandom(itemKeys, weights);
|
|
||||||
|
|
||||||
return chosenItem.item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Choos an item from the passed in array based on the weightings of each
|
* Choos an item from the passed in array based on the weightings of each
|
||||||
* @param itemArray Items and weights to use
|
* @param itemArray Items and weights to use
|
||||||
|
Loading…
Reference in New Issue
Block a user