mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:30:45 -05:00
Update getPlayerStashSize()
to take into account bonus STASH_ROWS
This commit is contained in:
parent
32bca62272
commit
3bc9833e57
@ -1015,31 +1015,43 @@ export class InventoryHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Player Stash Proper Size
|
* Get Players Stash Size
|
||||||
* @param sessionID Playerid
|
* @param sessionID Players id
|
||||||
* @returns Array of 2 values, x and y stash size
|
* @returns Array of 2 values, horizontal and vertical stash size
|
||||||
*/
|
*/
|
||||||
protected getPlayerStashSize(sessionID: string): Record<number, number>
|
protected getPlayerStashSize(sessionID: string): Record<number, number>
|
||||||
{
|
{
|
||||||
|
const profile = this.profileHelper.getPmcProfile(sessionID);
|
||||||
|
const stashRowBonus = profile.Bonuses.find((bonus) => bonus.type === BonusType.STASH_ROWS);
|
||||||
|
|
||||||
// this sets automatically a stash size from items.json (its not added anywhere yet cause we still use base stash)
|
// this sets automatically a stash size from items.json (its not added anywhere yet cause we still use base stash)
|
||||||
const stashTPL = this.getStashType(sessionID);
|
const stashTPL = this.getStashType(sessionID);
|
||||||
if (!stashTPL)
|
if (!stashTPL)
|
||||||
{
|
{
|
||||||
this.logger.error(this.localisationService.getText("inventory-missing_stash_size"));
|
this.logger.error(this.localisationService.getText("inventory-missing_stash_size"));
|
||||||
}
|
}
|
||||||
const stashItemDetails = this.itemHelper.getItem(stashTPL);
|
|
||||||
if (!stashItemDetails[0])
|
const stashItemResult = this.itemHelper.getItem(stashTPL);
|
||||||
|
if (!stashItemResult[0])
|
||||||
{
|
{
|
||||||
this.logger.error(this.localisationService.getText("inventory-stash_not_found", stashTPL));
|
this.logger.error(this.localisationService.getText("inventory-stash_not_found", stashTPL));
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stashH = stashItemDetails[1]._props.Grids[0]._props.cellsH !== 0
|
const stashItemDetails = stashItemResult[1];
|
||||||
? stashItemDetails[1]._props.Grids[0]._props.cellsH
|
const firstStashItemGrid = stashItemDetails._props.Grids[0];
|
||||||
: 10;
|
|
||||||
const stashY = stashItemDetails[1]._props.Grids[0]._props.cellsV !== 0
|
const stashH = firstStashItemGrid._props.cellsH !== 0 ? firstStashItemGrid._props.cellsH : 10;
|
||||||
? stashItemDetails[1]._props.Grids[0]._props.cellsV
|
let stashV = firstStashItemGrid._props.cellsV !== 0 ? firstStashItemGrid._props.cellsV : 66;
|
||||||
: 66;
|
|
||||||
return [stashH, stashY];
|
// Player has a bonus, apply to vertical size
|
||||||
|
if (stashRowBonus)
|
||||||
|
{
|
||||||
|
stashV += stashRowBonus.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [stashH, stashV];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user