Refactor ScavCaseRewardGenerator.getScavCaseRewardCountsAndPrices()
This commit is contained in:
parent
dcd1da28a6
commit
08f2bdb27e
@ -275,26 +275,22 @@ export class ScavCaseRewardGenerator
|
||||
*/
|
||||
protected getScavCaseRewardCountsAndPrices(scavCaseDetails: IHideoutScavCase): ScavCaseRewardCountsAndPrices
|
||||
{
|
||||
return {
|
||||
common: {
|
||||
minCount: scavCaseDetails.EndProducts["Common"].min,
|
||||
maxCount: scavCaseDetails.EndProducts["Common"].max,
|
||||
minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["common"].min,
|
||||
maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["common"].max
|
||||
},
|
||||
rare: {
|
||||
minCount: scavCaseDetails.EndProducts["Rare"].min,
|
||||
maxCount: scavCaseDetails.EndProducts["Rare"].max,
|
||||
minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["rare"].min,
|
||||
maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["rare"].max
|
||||
},
|
||||
superrare: {
|
||||
minCount: scavCaseDetails.EndProducts["Superrare"].min,
|
||||
maxCount: scavCaseDetails.EndProducts["Superrare"].max,
|
||||
minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["superrare"].min,
|
||||
maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["superrare"].max
|
||||
}
|
||||
};
|
||||
const rewardTypes: (keyof ScavCaseRewardCountsAndPrices)[] = ["common", "rare", "superrare"];
|
||||
const result: Partial<ScavCaseRewardCountsAndPrices> = {};
|
||||
|
||||
// Create reward min/max counts for each type
|
||||
for (const rewardType of rewardTypes)
|
||||
{
|
||||
result[rewardType] =
|
||||
{
|
||||
minCount: scavCaseDetails.EndProducts[rewardType].min,
|
||||
maxCount: scavCaseDetails.EndProducts[rewardType].max,
|
||||
minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub[rewardType].min,
|
||||
maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub[rewardType].max
|
||||
};
|
||||
}
|
||||
|
||||
return result as ScavCaseRewardCountsAndPrices;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,6 +241,13 @@ class ItemHelper
|
||||
return [false, undefined];
|
||||
}
|
||||
|
||||
public isItemInDb(tpl: string): boolean
|
||||
{
|
||||
const itemDetails = this.getItem(tpl);
|
||||
|
||||
return itemDetails[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* get normalized value (0-1) based on item condition
|
||||
* @param item
|
||||
|
Loading…
Reference in New Issue
Block a user