0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 02:10:44 -05:00

Update to EFT.23122 and increment version to 3.5.7 (!95)

Co-authored-by: Dev <dev@noreply.dev.sp-tarkov.com>
Reviewed-on: SPT-AKI/Server#95
This commit is contained in:
chomp 2023-05-19 16:47:24 +00:00
parent 65ba6c1080
commit 65bcee7500
16 changed files with 60460 additions and 62746 deletions

View File

@ -1,7 +1,7 @@
{ {
"akiVersion": "3.5.6", "akiVersion": "3.5.7",
"projectName": "SPT-AKI", "projectName": "SPT-AKI",
"compatibleTarkovVersion": "0.13.0.23043", "compatibleTarkovVersion": "0.13.0.23122",
"serverName": "SPT Server", "serverName": "SPT Server",
"profileSaveIntervalSeconds": 15 "profileSaveIntervalSeconds": 15
} }

File diff suppressed because it is too large Load Diff

View File

@ -136,7 +136,8 @@
"path": "", "path": "",
"rcid": "" "rcid": ""
}, },
"RequiredPlayerLevel": 0, "RequiredPlayerLevelMin": 0,
"RequiredPlayerLevelMax": 100,
"Rules": "AvoidOwnPmc", "Rules": "AvoidOwnPmc",
"SafeLocation": false, "SafeLocation": false,
"ScavMaxPlayersInGroup": 4, "ScavMaxPlayersInGroup": 4,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -54,21 +54,23 @@ export class InsuranceController
{ {
const time = this.timeUtil.getTimestamp(); const time = this.timeUtil.getTimestamp();
// Process each profile in turn
for (const sessionID in this.saveServer.getProfiles()) for (const sessionID in this.saveServer.getProfiles())
{ {
const insurance = this.saveServer.getProfile(sessionID).insurance; const insurance = this.saveServer.getProfile(sessionID).insurance;
let i = insurance.length; let insuredItemCount = insurance.length;
// Skip profile with no insurance items // Skip profile with no insurance items
if (i === 0) if (insuredItemCount === 0)
{ {
continue; continue;
} }
while (i-- > 0) // Use count as array index
while (insuredItemCount-- > 0)
{ {
const insured = insurance[i]; const insured = insurance[insuredItemCount];
const traderReturnChance = this.insuranceConfig.returnChancePercent[insured.traderId];
// Return time not reached, skip // Return time not reached, skip
if (time < insured.scheduledTime) if (time < insured.scheduledTime)
@ -76,16 +78,13 @@ export class InsuranceController
continue; continue;
} }
// Gather up items that can fail // Items to be removed from inventory
const slotIdsThatCanFail = this.insuranceConfig.slotIdsWithChanceOfNotReturning; const toDelete: string[] = [];
const toDelete = [];
// Loop over insurance items // Loop over insurance items, find items to delete from player inventory
for (const insuredItem of insured.items) for (const insuredItem of insured.items)
{ {
// Roll from 0 to 9999, then divide it by 100: 9999 = 99.99% if (this.itemShouldBeLost(insuredItem, insured.traderId, toDelete))
const returnChance = this.randomUtil.getInt(0, 9999) / 100;
if ((slotIdsThatCanFail.includes(insuredItem.slotId)) && returnChance >= traderReturnChance && !toDelete.includes(insuredItem._id))
{ {
// Skip if not an item // Skip if not an item
const itemDetails = this.itemHelper.getItem(insuredItem._tpl); const itemDetails = this.itemHelper.getItem(insuredItem._tpl);
@ -100,7 +99,7 @@ export class InsuranceController
continue; continue;
} }
// Remove item and its sub-items to prevent orphaned items // Remove item and its sub-items to prevent orphans
toDelete.push(...this.itemHelper.findAndReturnChildrenByItems(insured.items, insuredItem._id)); toDelete.push(...this.itemHelper.findAndReturnChildrenByItems(insured.items, insuredItem._id));
} }
} }
@ -123,13 +122,30 @@ export class InsuranceController
this.dialogueHelper.addDialogueMessage(insured.traderId, insured.messageContent, sessionID, insured.items); this.dialogueHelper.addDialogueMessage(insured.traderId, insured.messageContent, sessionID, insured.items);
// Remove insurance package from profile now we've processed it // Remove insurance package from profile now we've processed it
insurance.splice(i, 1); insurance.splice(insuredItemCount, 1);
} }
this.saveServer.getProfile(sessionID).insurance = insurance; this.saveServer.getProfile(sessionID).insurance = insurance;
} }
} }
/**
* Should the passed in item be removed from player inventory
* @param insuredItem Insurued item to roll to lose
* @param traderId Trader the item was insured by
* @param itemsBeingDeleted All items to remove from player
* @returns True if item should be removed
*/
protected itemShouldBeLost(insuredItem: Item, traderId: string, itemsBeingDeleted: string[]): boolean
{
// Roll from 0 to 9999, then divide it by 100: 9999 = 99.99%
const returnChance = this.randomUtil.getInt(0, 9999) / 100;
const traderReturnChance = this.insuranceConfig.returnChancePercent[traderId];
const slotIdsThatCanFail = this.insuranceConfig.slotIdsWithChanceOfNotReturning;
return (slotIdsThatCanFail.includes(insuredItem.slotId)) && returnChance >= traderReturnChance && !itemsBeingDeleted.includes(insuredItem._id);
}
/** /**
* Add insurance to an item * Add insurance to an item
* @param pmcData Player profile * @param pmcData Player profile

View File

@ -275,26 +275,22 @@ export class ScavCaseRewardGenerator
*/ */
protected getScavCaseRewardCountsAndPrices(scavCaseDetails: IHideoutScavCase): ScavCaseRewardCountsAndPrices protected getScavCaseRewardCountsAndPrices(scavCaseDetails: IHideoutScavCase): ScavCaseRewardCountsAndPrices
{ {
return { const rewardTypes: (keyof ScavCaseRewardCountsAndPrices)[] = ["common", "rare", "superrare"];
common: { const result: Partial<ScavCaseRewardCountsAndPrices> = {};
minCount: scavCaseDetails.EndProducts["Common"].min,
maxCount: scavCaseDetails.EndProducts["Common"].max, // Create reward min/max counts for each type
minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["common"].min, for (const rewardType of rewardTypes)
maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["common"].max {
}, result[rewardType] =
rare: { {
minCount: scavCaseDetails.EndProducts["Rare"].min, minCount: scavCaseDetails.EndProducts[rewardType].min,
maxCount: scavCaseDetails.EndProducts["Rare"].max, maxCount: scavCaseDetails.EndProducts[rewardType].max,
minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["rare"].min, minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub[rewardType].min,
maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["rare"].max maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub[rewardType].max
}, };
superrare: { }
minCount: scavCaseDetails.EndProducts["Superrare"].min,
maxCount: scavCaseDetails.EndProducts["Superrare"].max, return result as ScavCaseRewardCountsAndPrices;
minPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["superrare"].min,
maxPriceRub: this.scavCaseConfig.rewardItemValueRangeRub["superrare"].max
}
};
} }
/** /**

View File

@ -98,17 +98,15 @@ export class BotDifficultyHelper
*/ */
public convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string public convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string
{ {
if (dropDownDifficulty.toLowerCase() === "medium") switch (dropDownDifficulty.toLowerCase())
{ {
return "normal"; case "medium":
return "normal";
case "random":
return this.chooseRandomDifficulty();
default:
return dropDownDifficulty.toLowerCase();
} }
if (dropDownDifficulty.toLowerCase() === "random")
{
return this.chooseRandomDifficulty();
}
return dropDownDifficulty.toLowerCase();
} }
/** /**

View File

@ -241,6 +241,13 @@ class ItemHelper
return [false, undefined]; 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 * get normalized value (0-1) based on item condition
* @param item * @param item

View File

@ -51,7 +51,9 @@ export interface ILocationBase
OldSpawn: boolean OldSpawn: boolean
OpenZones: string OpenZones: string
Preview: Preview Preview: Preview
RequiredPlayerLevel: number RequiredPlayerLevelMin: number
RequiredPlayerLevelMax: number
MinPlayerLvlAccessKeys: number
PmcMaxPlayersInGroup: number PmcMaxPlayersInGroup: number
ScavMaxPlayersInGroup: number ScavMaxPlayersInGroup: number
Rules: string Rules: string