Allow armor items without plates to be listed on flea
This commit is contained in:
parent
8816e27298
commit
b766fa1220
@ -19,6 +19,16 @@ export class RagfairAssortGenerator
|
|||||||
protected generatedAssortItems: Item[] = [];
|
protected generatedAssortItems: Item[] = [];
|
||||||
protected ragfairConfig: IRagfairConfig;
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
|
||||||
|
protected ragfairItemInvalidBaseTypes: string[] = [
|
||||||
|
BaseClasses.LOOT_CONTAINER, // Safe, barrel cache etc
|
||||||
|
BaseClasses.STASH, // Player inventory stash
|
||||||
|
BaseClasses.SORTING_TABLE,
|
||||||
|
BaseClasses.INVENTORY,
|
||||||
|
BaseClasses.STATIONARY_CONTAINER,
|
||||||
|
BaseClasses.POCKETS,
|
||||||
|
BaseClasses.BUILT_IN_INSERTS,
|
||||||
|
];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
||||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||||
@ -62,34 +72,34 @@ export class RagfairAssortGenerator
|
|||||||
protected generateRagfairAssortItems(): Item[]
|
protected generateRagfairAssortItems(): Item[]
|
||||||
{
|
{
|
||||||
const results: Item[] = [];
|
const results: Item[] = [];
|
||||||
const items = this.itemHelper.getItems().filter(item => item._type !== "Node");
|
|
||||||
|
|
||||||
const presets = (this.ragfairConfig.dynamic.showDefaultPresetsOnly)
|
/** Get cloned items from db */
|
||||||
? Object.values(this.presetHelper.getDefaultPresets())
|
const dbItemsClone = this.itemHelper.getItems().filter(item => item._type !== "Node");
|
||||||
: this.presetHelper.getAllPresets()
|
|
||||||
|
|
||||||
const ragfairItemInvalidBaseTypes: string[] = [
|
|
||||||
BaseClasses.LOOT_CONTAINER, // safe, barrel cache etc
|
|
||||||
BaseClasses.STASH, // player inventory stash
|
|
||||||
BaseClasses.SORTING_TABLE,
|
|
||||||
BaseClasses.INVENTORY,
|
|
||||||
BaseClasses.STATIONARY_CONTAINER,
|
|
||||||
BaseClasses.POCKETS,
|
|
||||||
BaseClasses.BUILT_IN_INSERTS,
|
|
||||||
BaseClasses.ARMOR, // Handled by presets
|
|
||||||
BaseClasses.VEST, // Handled by presets
|
|
||||||
BaseClasses.HEADWEAR, // Handled by presets
|
|
||||||
];
|
|
||||||
|
|
||||||
|
const processedArmorItems: string[] = [];
|
||||||
const seasonalEventActive = this.seasonalEventService.seasonalEventEnabled();
|
const seasonalEventActive = this.seasonalEventService.seasonalEventEnabled();
|
||||||
const seasonalItemTplBlacklist = this.seasonalEventService.getInactiveSeasonalEventItems();
|
const seasonalItemTplBlacklist = this.seasonalEventService.getInactiveSeasonalEventItems();
|
||||||
for (const item of items)
|
|
||||||
|
const presets = this.getPresetsToAdd();
|
||||||
|
for (const preset of presets)
|
||||||
{
|
{
|
||||||
if (!this.itemHelper.isValidItem(item._id, ragfairItemInvalidBaseTypes))
|
const presetItemTpl = preset._items[0]._tpl;
|
||||||
|
|
||||||
|
// Add presets base item tpl to the processed list so its skipped later on when processing items
|
||||||
|
processedArmorItems.push(presetItemTpl)
|
||||||
|
|
||||||
|
// Preset id must be passed through to ensure flea shows preset
|
||||||
|
results.push(this.createRagfairAssortItem(presetItemTpl, preset._id));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of dbItemsClone)
|
||||||
|
{
|
||||||
|
if (!this.itemHelper.isValidItem(item._id, this.ragfairItemInvalidBaseTypes))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip seasonal items when not in-season
|
||||||
if (
|
if (
|
||||||
this.ragfairConfig.dynamic.removeSeasonalItemsWhenNotInEvent && !seasonalEventActive
|
this.ragfairConfig.dynamic.removeSeasonalItemsWhenNotInEvent && !seasonalEventActive
|
||||||
&& seasonalItemTplBlacklist.includes(item._id)
|
&& seasonalItemTplBlacklist.includes(item._id)
|
||||||
@ -98,17 +108,30 @@ export class RagfairAssortGenerator
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (processedArmorItems.includes(item._id))
|
||||||
|
{
|
||||||
|
// Already processed
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
results.push(this.createRagfairAssortItem(item._id, item._id)); // tplid and id must be the same so hideout recipe rewards work
|
results.push(this.createRagfairAssortItem(item._id, item._id)); // tplid and id must be the same so hideout recipe rewards work
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const preset of presets)
|
|
||||||
{
|
|
||||||
results.push(this.createRagfairAssortItem(preset._items[0]._tpl, preset._id)); // Preset id must be passed through to ensure flea shows preset
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get presets from globals to add to flea
|
||||||
|
* ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults
|
||||||
|
* @returns IPreset array
|
||||||
|
*/
|
||||||
|
protected getPresetsToAdd(): IPreset[]
|
||||||
|
{
|
||||||
|
return (this.ragfairConfig.dynamic.showDefaultPresetsOnly)
|
||||||
|
? Object.values(this.presetHelper.getDefaultPresets())
|
||||||
|
: this.presetHelper.getAllPresets()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true
|
* Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true
|
||||||
* @param tplId tplid to add to item
|
* @param tplId tplid to add to item
|
||||||
|
@ -757,7 +757,7 @@ export class RagfairOfferGenerator
|
|||||||
for (const item of armorWithMods)
|
for (const item of armorWithMods)
|
||||||
{
|
{
|
||||||
const itemDbDetails = this.itemHelper.getItem(item._tpl)[1];
|
const itemDbDetails = this.itemHelper.getItem(item._tpl)[1];
|
||||||
if ((parseInt(<string>itemDbDetails._props.armorClass)) > 0)
|
if ((parseInt(<string>itemDbDetails._props.armorClass)) > 1)
|
||||||
{
|
{
|
||||||
if (!item.upd)
|
if (!item.upd)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user