Move setting of the generated
bools to inside the cache methods (!298)
Also make `generateDynamicPrices` public to match the static method, and allow mods to refresh the cache Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/298 Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com> Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
820a5caccb
commit
0d553e8ea6
@ -56,13 +56,11 @@ export class RagfairPriceService implements OnLoad
|
|||||||
if (!this.generatedStaticPrices)
|
if (!this.generatedStaticPrices)
|
||||||
{
|
{
|
||||||
this.generateStaticPrices();
|
this.generateStaticPrices();
|
||||||
this.generatedStaticPrices = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.generatedDynamicPrices)
|
if (!this.generatedDynamicPrices)
|
||||||
{
|
{
|
||||||
this.generateDynamicPrices();
|
this.generateDynamicPrices();
|
||||||
this.generatedDynamicPrices = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,14 +82,18 @@ export class RagfairPriceService implements OnLoad
|
|||||||
{
|
{
|
||||||
this.prices.static[item._id] = Math.round(this.handbookHelper.getTemplatePrice(item._id));
|
this.prices.static[item._id] = Math.round(this.handbookHelper.getTemplatePrice(item._id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.generatedStaticPrices = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a dictionary and store prices from prices.json in it
|
* Create a dictionary and store prices from prices.json in it
|
||||||
*/
|
*/
|
||||||
protected generateDynamicPrices(): void
|
public generateDynamicPrices(): void
|
||||||
{
|
{
|
||||||
Object.assign(this.prices.dynamic, this.databaseServer.getTables().templates.prices);
|
Object.assign(this.prices.dynamic, this.databaseServer.getTables().templates.prices);
|
||||||
|
|
||||||
|
this.generatedDynamicPrices = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user