Merge branch '3.8.0' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.8.0
This commit is contained in:
commit
5f74825163
@ -340,8 +340,8 @@ export class InventoryController
|
|||||||
): IItemEventRouterResponse
|
): IItemEventRouterResponse
|
||||||
{
|
{
|
||||||
const inventoryItems = this.inventoryHelper.getOwnerInventoryItems(body, sessionID);
|
const inventoryItems = this.inventoryHelper.getOwnerInventoryItems(body, sessionID);
|
||||||
const sourceItem = inventoryItems.from.find((item) => item._id == body.item);
|
const sourceItem = inventoryItems.from.find((item) => item._id === body.item);
|
||||||
const destinationItem = inventoryItems.to.find((item) => item._id == body.with);
|
const destinationItem = inventoryItems.to.find((item) => item._id === body.with);
|
||||||
|
|
||||||
if (sourceItem === null)
|
if (sourceItem === null)
|
||||||
{
|
{
|
||||||
|
@ -9,11 +9,11 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
|
|||||||
import { IWildBody } from "@spt-aki/models/eft/common/IGlobals";
|
import { IWildBody } from "@spt-aki/models/eft/common/IGlobals";
|
||||||
import {
|
import {
|
||||||
Common,
|
Common,
|
||||||
Health as PmcHealth,
|
|
||||||
IBaseJsonSkills,
|
IBaseJsonSkills,
|
||||||
IBaseSkill,
|
IBaseSkill,
|
||||||
IBotBase,
|
IBotBase,
|
||||||
Info,
|
Info,
|
||||||
|
Health as PmcHealth,
|
||||||
Skills as botSkills,
|
Skills as botSkills,
|
||||||
} from "@spt-aki/models/eft/common/tables/IBotBase";
|
} from "@spt-aki/models/eft/common/tables/IBotBase";
|
||||||
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
|
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
|
||||||
|
@ -597,7 +597,7 @@ export class LocationGenerator
|
|||||||
|
|
||||||
// Build the list of forced loot from both `spawnpointsForced` and any point marked `IsAlwaysSpawn`
|
// Build the list of forced loot from both `spawnpointsForced` and any point marked `IsAlwaysSpawn`
|
||||||
dynamicForcedSpawnPoints.push(...dynamicLootDist.spawnpointsForced);
|
dynamicForcedSpawnPoints.push(...dynamicLootDist.spawnpointsForced);
|
||||||
dynamicForcedSpawnPoints.push(...dynamicLootDist.spawnpoints.filter(point => point.template.IsAlwaysSpawn));
|
dynamicForcedSpawnPoints.push(...dynamicLootDist.spawnpoints.filter((point) => point.template.IsAlwaysSpawn));
|
||||||
|
|
||||||
// Add forced loot
|
// Add forced loot
|
||||||
this.addForcedLoot(loot, dynamicForcedSpawnPoints, locationName);
|
this.addForcedLoot(loot, dynamicForcedSpawnPoints, locationName);
|
||||||
@ -647,7 +647,7 @@ export class LocationGenerator
|
|||||||
// Add ALL loose loot with 100% chance to pool
|
// Add ALL loose loot with 100% chance to pool
|
||||||
let chosenSpawnpoints: Spawnpoint[] = [...guaranteedLoosePoints];
|
let chosenSpawnpoints: Spawnpoint[] = [...guaranteedLoosePoints];
|
||||||
|
|
||||||
const randomSpawnpointCount = desiredSpawnpointCount - chosenSpawnpoints.length
|
const randomSpawnpointCount = desiredSpawnpointCount - chosenSpawnpoints.length;
|
||||||
// only draw random spawn points if needed
|
// only draw random spawn points if needed
|
||||||
if (randomSpawnpointCount > 0 && spawnpointArray.length > 0)
|
if (randomSpawnpointCount > 0 && spawnpointArray.length > 0)
|
||||||
{
|
{
|
||||||
|
@ -789,7 +789,7 @@ export class RagfairOfferGenerator
|
|||||||
for (const armorItem of armorWithMods)
|
for (const armorItem of armorWithMods)
|
||||||
{
|
{
|
||||||
const itemDbDetails = this.itemHelper.getItem(armorItem._tpl)[1];
|
const itemDbDetails = this.itemHelper.getItem(armorItem._tpl)[1];
|
||||||
if ((parseInt(<string>itemDbDetails._props.armorClass)) > 1)
|
if ((Number.parseInt(<string>itemDbDetails._props.armorClass)) > 1)
|
||||||
{
|
{
|
||||||
this.itemHelper.addUpdObjectToItem(armorItem);
|
this.itemHelper.addUpdObjectToItem(armorItem);
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ export class WeatherGenerator
|
|||||||
|
|
||||||
protected getRandomFloat(node: string): number
|
protected getRandomFloat(node: string): number
|
||||||
{
|
{
|
||||||
return parseFloat(
|
return Number.parseFloat(
|
||||||
this.randomUtil.getFloat(this.weatherConfig.weather[node].min, this.weatherConfig.weather[node].max)
|
this.randomUtil.getFloat(this.weatherConfig.weather[node].min, this.weatherConfig.weather[node].max)
|
||||||
.toPrecision(3),
|
.toPrecision(3),
|
||||||
);
|
);
|
||||||
|
@ -158,7 +158,7 @@ export class AssortHelper
|
|||||||
{
|
{
|
||||||
if (assort.items[a]._id === idsToRemove[i])
|
if (assort.items[a]._id === idsToRemove[i])
|
||||||
{
|
{
|
||||||
assort.items.splice(parseInt(a), 1);
|
assort.items.splice(Number.parseInt(a), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ export class BotGeneratorHelper
|
|||||||
{
|
{
|
||||||
let maxDurability: number;
|
let maxDurability: number;
|
||||||
let currentDurability: number;
|
let currentDurability: number;
|
||||||
if (parseInt(`${itemTemplate._props.armorClass}`) === 0)
|
if (Number.parseInt(`${itemTemplate._props.armorClass}`) === 0)
|
||||||
{
|
{
|
||||||
maxDurability = itemTemplate._props.MaxDurability;
|
maxDurability = itemTemplate._props.MaxDurability;
|
||||||
currentDurability = itemTemplate._props.MaxDurability;
|
currentDurability = itemTemplate._props.MaxDurability;
|
||||||
|
@ -320,7 +320,7 @@ export class TraderHelper
|
|||||||
public addTraderPurchasesToPlayerProfile(
|
public addTraderPurchasesToPlayerProfile(
|
||||||
sessionID: string,
|
sessionID: string,
|
||||||
newPurchaseDetails: { items: { itemId: string; count: number; }[]; traderId: string; },
|
newPurchaseDetails: { items: { itemId: string; count: number; }[]; traderId: string; },
|
||||||
itemPurchased: Item
|
itemPurchased: Item,
|
||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
const profile = this.profileHelper.getFullProfile(sessionID);
|
const profile = this.profileHelper.getFullProfile(sessionID);
|
||||||
@ -351,7 +351,10 @@ export class TraderHelper
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( profile.traderPurchases[traderId][purchasedItem.itemId].count + purchasedItem.count > itemPurchased.upd.BuyRestrictionMax )
|
if (
|
||||||
|
profile.traderPurchases[traderId][purchasedItem.itemId].count + purchasedItem.count
|
||||||
|
> itemPurchased.upd.BuyRestrictionMax
|
||||||
|
)
|
||||||
{
|
{
|
||||||
throw new Error("Unable to purchase item, Purchase limit reached");
|
throw new Error("Unable to purchase item, Purchase limit reached");
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@ import { TraderServiceType } from "@spt-aki/models/enums/TraderServiceType";
|
|||||||
export interface ITraderServiceModel
|
export interface ITraderServiceModel
|
||||||
{
|
{
|
||||||
serviceType: TraderServiceType;
|
serviceType: TraderServiceType;
|
||||||
itemsToPay?: {[key: string]: number};
|
itemsToPay?: { [key: string]: number; };
|
||||||
itemsToReceive?: string[];
|
itemsToReceive?: string[];
|
||||||
subServices?: {[key: string]: number};
|
subServices?: { [key: string]: number; };
|
||||||
requirements?: ITraderServiceRequirementsModel;
|
requirements?: ITraderServiceRequirementsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITraderServiceRequirementsModel
|
export interface ITraderServiceRequirementsModel
|
||||||
{
|
{
|
||||||
completedQuests?: string[];
|
completedQuests?: string[];
|
||||||
standings?: {[key: string]: number};
|
standings?: { [key: string]: number; };
|
||||||
}
|
}
|
@ -560,7 +560,7 @@ export class ProfileFixerService
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quest.status && Number.isNaN(parseInt(<string><unknown>quest.status)))
|
if (quest.status && Number.isNaN(Number.parseInt(<string><unknown>quest.status)))
|
||||||
{
|
{
|
||||||
fixes[quest.status] = (fixes[quest.status] ?? 0) + 1;
|
fixes[quest.status] = (fixes[quest.status] ?? 0) + 1;
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ export class ProfileFixerService
|
|||||||
|
|
||||||
for (const statusTimer in quest.statusTimers)
|
for (const statusTimer in quest.statusTimers)
|
||||||
{
|
{
|
||||||
if (Number.isNaN(parseInt(statusTimer)))
|
if (Number.isNaN(Number.parseInt(statusTimer)))
|
||||||
{
|
{
|
||||||
timerFixes[statusTimer] = (timerFixes[statusTimer] ?? 0) + 1;
|
timerFixes[statusTimer] = (timerFixes[statusTimer] ?? 0) + 1;
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ export class RepairService
|
|||||||
const materialType = itemToRepairDetails._props.ArmorMaterial ?? "";
|
const materialType = itemToRepairDetails._props.ArmorMaterial ?? "";
|
||||||
const armorMaterial = globals.config.ArmorMaterials[materialType] as IArmorType;
|
const armorMaterial = globals.config.ArmorMaterials[materialType] as IArmorType;
|
||||||
const destructability = 1 + armorMaterial.Destructibility;
|
const destructability = 1 + armorMaterial.Destructibility;
|
||||||
const armorClass = parseInt(`${itemToRepairDetails._props.armorClass}`);
|
const armorClass = Number.parseInt(`${itemToRepairDetails._props.armorClass}`);
|
||||||
const armorClassDivisor = globals.config.RepairSettings.armorClassDivisor;
|
const armorClassDivisor = globals.config.RepairSettings.armorClassDivisor;
|
||||||
const armorClassMultiplier = 1.0 + armorClass / armorClassDivisor;
|
const armorClassMultiplier = 1.0 + armorClass / armorClassDivisor;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
|
||||||
|
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
|
||||||
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
|
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||||
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
|
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
|
||||||
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
|
|
||||||
import { inject, injectable } from "tsyringe";
|
import { inject, injectable } from "tsyringe";
|
||||||
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
|
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class TraderServicesService
|
export class TraderServicesService
|
||||||
@ -47,7 +47,7 @@ export class TraderServicesService
|
|||||||
for (const questId of service.requirements.completedQuests)
|
for (const questId of service.requirements.completedQuests)
|
||||||
{
|
{
|
||||||
const quest = pmcData.Quests.find((x) => x.qid === questId);
|
const quest = pmcData.Quests.find((x) => x.qid === questId);
|
||||||
if (!quest || quest.status != QuestStatus.Success)
|
if (!quest || quest.status !== QuestStatus.Success)
|
||||||
{
|
{
|
||||||
servicesToDelete.push(service.serviceType);
|
servicesToDelete.push(service.serviceType);
|
||||||
break;
|
break;
|
||||||
@ -57,7 +57,7 @@ export class TraderServicesService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear any unavailable services from the list
|
// Clear any unavailable services from the list
|
||||||
traderServices = traderServices.filter(x => !servicesToDelete.includes(x.serviceType));
|
traderServices = traderServices.filter((x) => !servicesToDelete.includes(x.serviceType));
|
||||||
|
|
||||||
return traderServices;
|
return traderServices;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user