mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 08:50:43 -05:00
Formatting Change - Operator positions are now at the start of the next line (for multi-line statements).
This commit is contained in:
parent
2b826f8b1e
commit
7533d33358
@ -13,7 +13,7 @@
|
|||||||
"singleBodyPosition": "maintain",
|
"singleBodyPosition": "maintain",
|
||||||
"nextControlFlowPosition": "nextLine",
|
"nextControlFlowPosition": "nextLine",
|
||||||
"trailingCommas": "onlyMultiLine",
|
"trailingCommas": "onlyMultiLine",
|
||||||
"operatorPosition": "sameLine",
|
"operatorPosition": "nextLine",
|
||||||
"preferHanging": false,
|
"preferHanging": false,
|
||||||
"preferSingleLine": false,
|
"preferSingleLine": false,
|
||||||
"arrowFunction.useParentheses": "force",
|
"arrowFunction.useParentheses": "force",
|
||||||
|
@ -24,14 +24,13 @@ export class ItemEventCallbacks
|
|||||||
): IGetBodyResponseData<IItemEventRouterResponse>
|
): IGetBodyResponseData<IItemEventRouterResponse>
|
||||||
{
|
{
|
||||||
const eventResponse = this.itemEventRouter.handleEvents(info, sessionID);
|
const eventResponse = this.itemEventRouter.handleEvents(info, sessionID);
|
||||||
const result = (eventResponse.warnings.length > 0) ?
|
const result = (eventResponse.warnings.length > 0)
|
||||||
this.httpResponse.getBody(
|
? this.httpResponse.getBody(
|
||||||
eventResponse,
|
eventResponse,
|
||||||
this.getErrorCode(eventResponse.warnings),
|
this.getErrorCode(eventResponse.warnings),
|
||||||
eventResponse.warnings[0].errmsg,
|
eventResponse.warnings[0].errmsg,
|
||||||
) // TODO: map 228 to its enum value
|
) // TODO: map 228 to its enum value
|
||||||
:
|
: this.httpResponse.getBody(eventResponse);
|
||||||
this.httpResponse.getBody(eventResponse);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,9 @@ export class BotController
|
|||||||
public getBotPresetGenerationLimit(type: string): number
|
public getBotPresetGenerationLimit(type: string): number
|
||||||
{
|
{
|
||||||
const value = this.botConfig.presetBatch[
|
const value = this.botConfig.presetBatch[
|
||||||
(type === "assaultGroup") ?
|
(type === "assaultGroup")
|
||||||
"assault" :
|
? "assault"
|
||||||
type
|
: type
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
@ -275,9 +275,9 @@ export class BotController
|
|||||||
this.logger.warning(this.localisationService.getText("bot-missing_saved_match_info"));
|
this.logger.warning(this.localisationService.getText("bot-missing_saved_match_info"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapName = raidConfig ?
|
const mapName = raidConfig
|
||||||
raidConfig.location :
|
? raidConfig.location
|
||||||
defaultMapCapId;
|
: defaultMapCapId;
|
||||||
|
|
||||||
let botCap = this.botConfig.maxBotCap[mapName.toLowerCase()];
|
let botCap = this.botConfig.maxBotCap[mapName.toLowerCase()];
|
||||||
if (!botCap)
|
if (!botCap)
|
||||||
|
@ -704,8 +704,8 @@ export class GameController
|
|||||||
{
|
{
|
||||||
// Wave has size that makes it candidate for splitting
|
// Wave has size that makes it candidate for splitting
|
||||||
if (
|
if (
|
||||||
wave.slots_max - wave.slots_min >=
|
wave.slots_max - wave.slots_min
|
||||||
this.locationConfig.splitWaveIntoSingleSpawnsSettings.waveSizeThreshold
|
>= this.locationConfig.splitWaveIntoSingleSpawnsSettings.waveSizeThreshold
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Get count of bots to be spawned in wave
|
// Get count of bots to be spawned in wave
|
||||||
@ -777,9 +777,9 @@ export class GameController
|
|||||||
const modDetails = activeMods[modKey];
|
const modDetails = activeMods[modKey];
|
||||||
if (
|
if (
|
||||||
fullProfile.aki.mods.some((x) =>
|
fullProfile.aki.mods.some((x) =>
|
||||||
x.author === modDetails.author &&
|
x.author === modDetails.author
|
||||||
x.name === modDetails.name &&
|
&& x.name === modDetails.name
|
||||||
x.version === modDetails.version
|
&& x.version === modDetails.version
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -111,10 +111,10 @@ export class HideoutController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.paymentHelper.isMoneyTpl(item.inventoryItem._tpl) &&
|
this.paymentHelper.isMoneyTpl(item.inventoryItem._tpl)
|
||||||
item.inventoryItem.upd &&
|
&& item.inventoryItem.upd
|
||||||
item.inventoryItem.upd.StackObjectsCount &&
|
&& item.inventoryItem.upd.StackObjectsCount
|
||||||
item.inventoryItem.upd.StackObjectsCount > item.requestedItem.count
|
&& item.inventoryItem.upd.StackObjectsCount > item.requestedItem.count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
item.inventoryItem.upd.StackObjectsCount -= item.requestedItem.count;
|
item.inventoryItem.upd.StackObjectsCount -= item.requestedItem.count;
|
||||||
@ -220,8 +220,8 @@ export class HideoutController
|
|||||||
|
|
||||||
// Upgrading water collector / med station
|
// Upgrading water collector / med station
|
||||||
if (
|
if (
|
||||||
profileHideoutArea.type === HideoutAreas.WATER_COLLECTOR ||
|
profileHideoutArea.type === HideoutAreas.WATER_COLLECTOR
|
||||||
profileHideoutArea.type === HideoutAreas.MEDSTATION
|
|| profileHideoutArea.type === HideoutAreas.MEDSTATION
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.checkAndUpgradeWall(pmcData);
|
this.checkAndUpgradeWall(pmcData);
|
||||||
@ -632,8 +632,8 @@ export class HideoutController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
inventoryItem.upd?.StackObjectsCount &&
|
inventoryItem.upd?.StackObjectsCount
|
||||||
inventoryItem.upd.StackObjectsCount > requestedItem.count
|
&& inventoryItem.upd.StackObjectsCount > requestedItem.count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
inventoryItem.upd.StackObjectsCount -= requestedItem.count;
|
inventoryItem.upd.StackObjectsCount -= requestedItem.count;
|
||||||
@ -957,9 +957,9 @@ export class HideoutController
|
|||||||
{
|
{
|
||||||
id = this.presetHelper.getDefaultPreset(id)._id;
|
id = this.presetHelper.getDefaultPreset(id)._id;
|
||||||
}
|
}
|
||||||
const numOfItems = !x.upd?.StackObjectsCount ?
|
const numOfItems = !x.upd?.StackObjectsCount
|
||||||
1 :
|
? 1
|
||||||
x.upd.StackObjectsCount;
|
: x.upd.StackObjectsCount;
|
||||||
|
|
||||||
return {item_id: id, count: numOfItems};
|
return {item_id: id, count: numOfItems};
|
||||||
},
|
},
|
||||||
@ -1112,10 +1112,10 @@ export class HideoutController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.paymentHelper.isMoneyTpl(item.inventoryItem._tpl) &&
|
this.paymentHelper.isMoneyTpl(item.inventoryItem._tpl)
|
||||||
item.inventoryItem.upd &&
|
&& item.inventoryItem.upd
|
||||||
item.inventoryItem.upd.StackObjectsCount &&
|
&& item.inventoryItem.upd.StackObjectsCount
|
||||||
item.inventoryItem.upd.StackObjectsCount > item.requestedItem.count
|
&& item.inventoryItem.upd.StackObjectsCount > item.requestedItem.count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
item.inventoryItem.upd.StackObjectsCount -= item.requestedItem.count;
|
item.inventoryItem.upd.StackObjectsCount -= item.requestedItem.count;
|
||||||
|
@ -332,8 +332,8 @@ export class InraidController
|
|||||||
// Post-raid status is enum word e.g. `Started` but pmc quest status is number e.g. 2
|
// Post-raid status is enum word e.g. `Started` but pmc quest status is number e.g. 2
|
||||||
// Status values mismatch or statusTimers counts mismatch
|
// Status values mismatch or statusTimers counts mismatch
|
||||||
if (
|
if (
|
||||||
quest.status !== <any>QuestStatus[pmcQuest.status] ||
|
quest.status !== <any>QuestStatus[pmcQuest.status]
|
||||||
quest.statusTimers.length !== pmcQuest.statusTimers.length
|
|| quest.statusTimers.length !== pmcQuest.statusTimers.length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.warning(
|
this.logger.warning(
|
||||||
|
@ -164,9 +164,9 @@ export class InsuranceController
|
|||||||
{
|
{
|
||||||
const profile = this.saveServer.getProfile(sessionID);
|
const profile = this.saveServer.getProfile(sessionID);
|
||||||
profile.insurance = profile.insurance.filter((insurance) =>
|
profile.insurance = profile.insurance.filter((insurance) =>
|
||||||
insurance.messageContent.systemData.date !== packageInfo.date ||
|
insurance.messageContent.systemData.date !== packageInfo.date
|
||||||
insurance.messageContent.systemData.time !== packageInfo.time ||
|
|| insurance.messageContent.systemData.time !== packageInfo.time
|
||||||
insurance.messageContent.systemData.location !== packageInfo.location
|
|| insurance.messageContent.systemData.location !== packageInfo.location
|
||||||
);
|
);
|
||||||
|
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
|
@ -168,9 +168,9 @@ export class InventoryController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const profileToRemoveItemFrom = (!body.fromOwner || body.fromOwner.id === pmcData._id) ?
|
const profileToRemoveItemFrom = (!body.fromOwner || body.fromOwner.id === pmcData._id)
|
||||||
pmcData :
|
? pmcData
|
||||||
this.profileHelper.getFullProfile(sessionID).characters.scav;
|
: this.profileHelper.getFullProfile(sessionID).characters.scav;
|
||||||
|
|
||||||
return this.inventoryHelper.removeItem(
|
return this.inventoryHelper.removeItem(
|
||||||
profileToRemoveItemFrom,
|
profileToRemoveItemFrom,
|
||||||
@ -459,9 +459,9 @@ export class InventoryController
|
|||||||
{
|
{
|
||||||
// Fix for folding weapons while on they're in the Scav inventory
|
// Fix for folding weapons while on they're in the Scav inventory
|
||||||
if (
|
if (
|
||||||
body.fromOwner &&
|
body.fromOwner
|
||||||
body.fromOwner.type === "Profile" &&
|
&& body.fromOwner.type === "Profile"
|
||||||
body.fromOwner.id !== pmcData._id
|
&& body.fromOwner.id !== pmcData._id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
pmcData = this.profileHelper.getScavProfile(sessionID);
|
pmcData = this.profileHelper.getScavProfile(sessionID);
|
||||||
|
@ -230,8 +230,8 @@ export class QuestController
|
|||||||
|
|
||||||
// Not christmas + quest is for christmas
|
// Not christmas + quest is for christmas
|
||||||
if (
|
if (
|
||||||
!isChristmasEventActive &&
|
!isChristmasEventActive
|
||||||
this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.CHRISTMAS)
|
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.CHRISTMAS)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -239,8 +239,8 @@ export class QuestController
|
|||||||
|
|
||||||
// Not halloween + quest is for halloween
|
// Not halloween + quest is for halloween
|
||||||
if (
|
if (
|
||||||
!isHalloweenEventActive &&
|
!isHalloweenEventActive
|
||||||
this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.HALLOWEEN)
|
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.HALLOWEEN)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -248,8 +248,8 @@ export class QuestController
|
|||||||
|
|
||||||
// Should non-season event quests be shown to player
|
// Should non-season event quests be shown to player
|
||||||
if (
|
if (
|
||||||
!this.questConfig.showNonSeasonalEventQuests &&
|
!this.questConfig.showNonSeasonalEventQuests
|
||||||
this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.NONE)
|
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.NONE)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -381,8 +381,8 @@ export class QuestController
|
|||||||
|
|
||||||
// Some scav quests need to be added to scav profile for them to show up in-raid
|
// Some scav quests need to be added to scav profile for them to show up in-raid
|
||||||
if (
|
if (
|
||||||
repeatableQuestProfile.side === "Scav" &&
|
repeatableQuestProfile.side === "Scav"
|
||||||
["PickUp", "Exploration", "Elimination"].includes(repeatableQuestProfile.type)
|
&& ["PickUp", "Exploration", "Elimination"].includes(repeatableQuestProfile.type)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fullProfile = this.profileHelper.getFullProfile(sessionID);
|
const fullProfile = this.profileHelper.getFullProfile(sessionID);
|
||||||
@ -448,8 +448,10 @@ export class QuestController
|
|||||||
const change = {};
|
const change = {};
|
||||||
change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id];
|
change[repeatableQuestProfile._id] = repeatableSettings.changeRequirement[repeatableQuestProfile._id];
|
||||||
const responseData: IPmcDataRepeatableQuest = {
|
const responseData: IPmcDataRepeatableQuest = {
|
||||||
id: repeatableSettings.id ??
|
id: repeatableSettings.id
|
||||||
this.questConfig.repeatableQuests.find((x) => x.name === repeatableQuestProfile.sptRepatableGroupName)
|
?? this.questConfig.repeatableQuests.find((x) =>
|
||||||
|
x.name === repeatableQuestProfile.sptRepatableGroupName
|
||||||
|
)
|
||||||
.id,
|
.id,
|
||||||
name: repeatableSettings.name,
|
name: repeatableSettings.name,
|
||||||
endTime: repeatableSettings.endTime,
|
endTime: repeatableSettings.endTime,
|
||||||
@ -666,8 +668,8 @@ export class QuestController
|
|||||||
if (nextQuestWaitCondition)
|
if (nextQuestWaitCondition)
|
||||||
{
|
{
|
||||||
// Now + wait time
|
// Now + wait time
|
||||||
const availableAfterTimestamp = this.timeUtil.getTimestamp() +
|
const availableAfterTimestamp = this.timeUtil.getTimestamp()
|
||||||
nextQuestWaitCondition._props.availableAfter;
|
+ nextQuestWaitCondition._props.availableAfter;
|
||||||
|
|
||||||
// Update quest in profile with status of AvailableAfter
|
// Update quest in profile with status of AvailableAfter
|
||||||
const existingQuestInProfile = pmcData.Quests.find((x) => x.qid === quest._id);
|
const existingQuestInProfile = pmcData.Quests.find((x) => x.qid === quest._id);
|
||||||
@ -787,17 +789,17 @@ export class QuestController
|
|||||||
for (const condition of quest.conditions.AvailableForFinish)
|
for (const condition of quest.conditions.AvailableForFinish)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
condition._props.id === handoverQuestRequest.conditionId &&
|
condition._props.id === handoverQuestRequest.conditionId
|
||||||
handoverQuestTypes.includes(condition._parent)
|
&& handoverQuestTypes.includes(condition._parent)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
handedInCount = Number.parseInt(<string>condition._props.value);
|
handedInCount = Number.parseInt(<string>condition._props.value);
|
||||||
isItemHandoverQuest = condition._parent === handoverQuestTypes[0];
|
isItemHandoverQuest = condition._parent === handoverQuestTypes[0];
|
||||||
handoverRequirements = condition;
|
handoverRequirements = condition;
|
||||||
|
|
||||||
const profileCounter = (handoverQuestRequest.conditionId in pmcData.BackendCounters) ?
|
const profileCounter = (handoverQuestRequest.conditionId in pmcData.BackendCounters)
|
||||||
pmcData.BackendCounters[handoverQuestRequest.conditionId].value :
|
? pmcData.BackendCounters[handoverQuestRequest.conditionId].value
|
||||||
0;
|
: 0;
|
||||||
handedInCount -= profileCounter;
|
handedInCount -= profileCounter;
|
||||||
|
|
||||||
if (handedInCount <= 0)
|
if (handedInCount <= 0)
|
||||||
|
@ -256,9 +256,9 @@ export class RagfairController
|
|||||||
const assortData = traderAssorts.find((x) => x._id === assortId);
|
const assortData = traderAssorts.find((x) => x._id === assortId);
|
||||||
|
|
||||||
// Use value stored in profile, otherwise use value directly from in-memory trader assort data
|
// Use value stored in profile, otherwise use value directly from in-memory trader assort data
|
||||||
offer.buyRestrictionCurrent = profile.traderPurchases[offer.user.id][assortId] ?
|
offer.buyRestrictionCurrent = profile.traderPurchases[offer.user.id][assortId]
|
||||||
profile.traderPurchases[offer.user.id][assortId].count :
|
? profile.traderPurchases[offer.user.id][assortId].count
|
||||||
assortData.upd.BuyRestrictionCurrent;
|
: assortData.upd.BuyRestrictionCurrent;
|
||||||
|
|
||||||
offer.buyRestrictionMax = assortData.upd.BuyRestrictionMax;
|
offer.buyRestrictionMax = assortData.upd.BuyRestrictionMax;
|
||||||
}
|
}
|
||||||
@ -397,22 +397,21 @@ export class RagfairController
|
|||||||
);
|
);
|
||||||
const rootItem = offer.items[0];
|
const rootItem = offer.items[0];
|
||||||
const qualityMultiplier = this.itemHelper.getItemQualityModifier(rootItem);
|
const qualityMultiplier = this.itemHelper.getItemQualityModifier(rootItem);
|
||||||
const averageOfferPrice = this.ragfairPriceService.getFleaPriceForItem(rootItem._tpl) *
|
const averageOfferPrice = this.ragfairPriceService.getFleaPriceForItem(rootItem._tpl)
|
||||||
rootItem.upd.StackObjectsCount * qualityMultiplier;
|
* rootItem.upd.StackObjectsCount * qualityMultiplier;
|
||||||
const itemStackCount = (offerRequest.sellInOnePiece) ?
|
const itemStackCount = (offerRequest.sellInOnePiece)
|
||||||
1 :
|
? 1
|
||||||
rootItem.upd.StackObjectsCount;
|
: rootItem.upd.StackObjectsCount;
|
||||||
|
|
||||||
// Get averaged price of a single item being listed
|
// Get averaged price of a single item being listed
|
||||||
const averageSingleItemPrice = (offerRequest.sellInOnePiece) ?
|
const averageSingleItemPrice = (offerRequest.sellInOnePiece)
|
||||||
averageOfferPrice / rootItem.upd.StackObjectsCount // Packs are a single offer made of many items
|
? averageOfferPrice / rootItem.upd.StackObjectsCount // Packs are a single offer made of many items
|
||||||
:
|
: averageOfferPrice / itemStackCount;
|
||||||
averageOfferPrice / itemStackCount;
|
|
||||||
|
|
||||||
// Get averaged price of listing
|
// Get averaged price of listing
|
||||||
const averagePlayerListedPriceInRub = (offerRequest.sellInOnePiece) ?
|
const averagePlayerListedPriceInRub = (offerRequest.sellInOnePiece)
|
||||||
playerListedPriceInRub / rootItem.upd.StackObjectsCount :
|
? playerListedPriceInRub / rootItem.upd.StackObjectsCount
|
||||||
playerListedPriceInRub;
|
: playerListedPriceInRub;
|
||||||
|
|
||||||
// Packs are reduced to the average price of a single item in the pack vs the averaged single price of an item
|
// Packs are reduced to the average price of a single item in the pack vs the averaged single price of an item
|
||||||
const sellChancePercent = this.ragfairSellHelper.calculateSellChance(
|
const sellChancePercent = this.ragfairSellHelper.calculateSellChance(
|
||||||
@ -475,9 +474,9 @@ export class RagfairController
|
|||||||
{
|
{
|
||||||
// Get tax from cache hydrated earlier by client, if that's missing fall back to server calculation (inaccurate)
|
// Get tax from cache hydrated earlier by client, if that's missing fall back to server calculation (inaccurate)
|
||||||
const storedClientTaxValue = this.ragfairTaxService.getStoredClientOfferTaxValueById(offerRequest.items[0]);
|
const storedClientTaxValue = this.ragfairTaxService.getStoredClientOfferTaxValueById(offerRequest.items[0]);
|
||||||
const tax = storedClientTaxValue ?
|
const tax = storedClientTaxValue
|
||||||
storedClientTaxValue.fee :
|
? storedClientTaxValue.fee
|
||||||
this.ragfairTaxService.calculateTax(
|
: this.ragfairTaxService.calculateTax(
|
||||||
rootItem,
|
rootItem,
|
||||||
pmcData,
|
pmcData,
|
||||||
requirementsPriceInRub,
|
requirementsPriceInRub,
|
||||||
@ -549,8 +548,8 @@ export class RagfairController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
requirementsPriceInRub += this.ragfairPriceService.getDynamicPriceForItem(requestedItemTpl) *
|
requirementsPriceInRub += this.ragfairPriceService.getDynamicPriceForItem(requestedItemTpl)
|
||||||
item.count;
|
* item.count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,9 +718,9 @@ export class RagfairController
|
|||||||
// MOD: Pay flea market fee
|
// MOD: Pay flea market fee
|
||||||
if (this.ragfairConfig.sell.fees)
|
if (this.ragfairConfig.sell.fees)
|
||||||
{
|
{
|
||||||
const count = offers[index].sellInOnePiece ?
|
const count = offers[index].sellInOnePiece
|
||||||
1 :
|
? 1
|
||||||
offers[index].items.reduce((sum, item) => sum += item.upd.StackObjectsCount, 0);
|
: offers[index].items.reduce((sum, item) => sum += item.upd.StackObjectsCount, 0);
|
||||||
const tax = this.ragfairTaxService.calculateTax(
|
const tax = this.ragfairTaxService.calculateTax(
|
||||||
offers[index].items[0],
|
offers[index].items[0],
|
||||||
this.profileHelper.getPmcProfile(sessionID),
|
this.profileHelper.getPmcProfile(sessionID),
|
||||||
|
@ -99,9 +99,9 @@ export class RepeatableQuestController
|
|||||||
const currentRepeatableQuestType = this.getRepeatableQuestSubTypeFromProfile(repeatableConfig, pmcData);
|
const currentRepeatableQuestType = this.getRepeatableQuestSubTypeFromProfile(repeatableConfig, pmcData);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
repeatableConfig.side === "Pmc" &&
|
repeatableConfig.side === "Pmc"
|
||||||
pmcData.Info.Level >= repeatableConfig.minPlayerLevel ||
|
&& pmcData.Info.Level >= repeatableConfig.minPlayerLevel
|
||||||
repeatableConfig.side === "Scav" && scavQuestUnlocked
|
|| repeatableConfig.side === "Scav" && scavQuestUnlocked
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (time > currentRepeatableQuestType.endTime - 1)
|
if (time > currentRepeatableQuestType.endTime - 1)
|
||||||
@ -209,13 +209,14 @@ export class RepeatableQuestController
|
|||||||
protected getQuestCount(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): number
|
protected getQuestCount(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): number
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
repeatableConfig.name.toLowerCase() === "daily" &&
|
repeatableConfig.name.toLowerCase() === "daily"
|
||||||
this.profileHelper.hasEliteSkillLevel(SkillTypes.CHARISMA, pmcData)
|
&& this.profileHelper.hasEliteSkillLevel(SkillTypes.CHARISMA, pmcData)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Elite charisma skill gives extra daily quest(s)
|
// Elite charisma skill gives extra daily quest(s)
|
||||||
return repeatableConfig.numQuests +
|
return repeatableConfig.numQuests
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.Charisma.BonusSettings.EliteBonusSettings
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.Charisma.BonusSettings
|
||||||
|
.EliteBonusSettings
|
||||||
.RepeatableQuestExtraCount;
|
.RepeatableQuestExtraCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,9 +322,9 @@ export class RepeatableQuestController
|
|||||||
const possibleLocations = Object.keys(repeatableConfig.locations);
|
const possibleLocations = Object.keys(repeatableConfig.locations);
|
||||||
|
|
||||||
// Set possible locations for elimination task, if target is savage, exclude labs from locations
|
// Set possible locations for elimination task, if target is savage, exclude labs from locations
|
||||||
questPool.pool.Elimination.targets[probabilityObject.key] = (probabilityObject.key === "Savage") ?
|
questPool.pool.Elimination.targets[probabilityObject.key] = (probabilityObject.key === "Savage")
|
||||||
{locations: possibleLocations.filter((x) => x !== "laboratory")} :
|
? {locations: possibleLocations.filter((x) => x !== "laboratory")}
|
||||||
{locations: possibleLocations};
|
: {locations: possibleLocations};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ export class TradeController
|
|||||||
|
|
||||||
// Skip buying items when player doesn't have necessary loyalty
|
// Skip buying items when player doesn't have necessary loyalty
|
||||||
if (
|
if (
|
||||||
fleaOffer.user.memberType === MemberCategory.TRADER &&
|
fleaOffer.user.memberType === MemberCategory.TRADER
|
||||||
fleaOffer.loyaltyLevel > pmcData.TradersInfo[fleaOffer.user.id].loyaltyLevel
|
&& fleaOffer.loyaltyLevel > pmcData.TradersInfo[fleaOffer.user.id].loyaltyLevel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
@ -231,8 +231,8 @@ export class TradeController
|
|||||||
{
|
{
|
||||||
const itemDetails = this.itemHelper.getItem(itemToSell._tpl);
|
const itemDetails = this.itemHelper.getItem(itemToSell._tpl);
|
||||||
if (
|
if (
|
||||||
!(itemDetails[0] &&
|
!(itemDetails[0]
|
||||||
this.itemHelper.isOfBaseclasses(itemDetails[1]._id, traderDetails.items_buy.category))
|
&& this.itemHelper.isOfBaseclasses(itemDetails[1]._id, traderDetails.items_buy.category))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Skip if tpl isn't item OR item doesn't fulfill match traders buy categories
|
// Skip if tpl isn't item OR item doesn't fulfill match traders buy categories
|
||||||
|
@ -97,9 +97,9 @@ export class BotEquipmentModGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure submods for nvgs all spawn together
|
// Ensure submods for nvgs all spawn together
|
||||||
forceSpawn = (modSlot === "mod_nvg") ?
|
forceSpawn = (modSlot === "mod_nvg")
|
||||||
true :
|
? true
|
||||||
false;
|
: false;
|
||||||
|
|
||||||
let modTpl: string;
|
let modTpl: string;
|
||||||
let found = false;
|
let found = false;
|
||||||
@ -200,8 +200,8 @@ export class BotEquipmentModGenerator
|
|||||||
|
|
||||||
// Null guard against bad input weapon
|
// Null guard against bad input weapon
|
||||||
if (
|
if (
|
||||||
!((parentTemplate._props.Slots.length || parentTemplate._props.Cartridges?.length) ||
|
!((parentTemplate._props.Slots.length || parentTemplate._props.Cartridges?.length)
|
||||||
parentTemplate._props.Chambers?.length)
|
|| parentTemplate._props.Chambers?.length)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
@ -329,8 +329,8 @@ export class BotEquipmentModGenerator
|
|||||||
// Handguard mod can take a sub handguard mod + weapon has no UBGL (takes same slot)
|
// Handguard mod can take a sub handguard mod + weapon has no UBGL (takes same slot)
|
||||||
// Force spawn chance to be 100% to ensure it gets added
|
// Force spawn chance to be 100% to ensure it gets added
|
||||||
if (
|
if (
|
||||||
modSlot === "mod_handguard" && modToAddTemplate._props.Slots.find((x) => x._name === "mod_handguard") &&
|
modSlot === "mod_handguard" && modToAddTemplate._props.Slots.find((x) => x._name === "mod_handguard")
|
||||||
!weapon.find((x) => x.slotId === "mod_launcher")
|
&& !weapon.find((x) => x.slotId === "mod_launcher")
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Needed for handguards with lower
|
// Needed for handguards with lower
|
||||||
@ -340,8 +340,10 @@ export class BotEquipmentModGenerator
|
|||||||
// If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure sub-stock gets added
|
// If stock mod can take a sub stock mod, force spawn chance to be 100% to ensure sub-stock gets added
|
||||||
// Or if mod_stock is configured to be forced on
|
// Or if mod_stock is configured to be forced on
|
||||||
if (
|
if (
|
||||||
modSlot === "mod_stock" &&
|
modSlot === "mod_stock"
|
||||||
(modToAddTemplate._props.Slots.find((x) => x._name.includes("mod_stock") || botEquipConfig.forceStock))
|
&& (modToAddTemplate._props.Slots.find((x) =>
|
||||||
|
x._name.includes("mod_stock") || botEquipConfig.forceStock
|
||||||
|
))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Stock mod can take additional stocks, could be a locking device, force 100% chance
|
// Stock mod can take additional stocks, could be a locking device, force 100% chance
|
||||||
@ -433,8 +435,8 @@ export class BotEquipmentModGenerator
|
|||||||
"mod_scope_001",
|
"mod_scope_001",
|
||||||
"mod_scope_002",
|
"mod_scope_002",
|
||||||
"mod_scope_003",
|
"mod_scope_003",
|
||||||
].includes(modSlot.toLowerCase()) &&
|
].includes(modSlot.toLowerCase())
|
||||||
modsParentId === BaseClasses.MOUNT;
|
&& modsParentId === BaseClasses.MOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -579,9 +581,8 @@ export class BotEquipmentModGenerator
|
|||||||
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean
|
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean
|
||||||
{
|
{
|
||||||
const modSpawnChance = itemSlot._required || this.getAmmoContainers().includes(modSlot) // Required OR it is ammo
|
const modSpawnChance = itemSlot._required || this.getAmmoContainers().includes(modSlot) // Required OR it is ammo
|
||||||
?
|
? 100
|
||||||
100 :
|
: modSpawnChances[modSlot];
|
||||||
modSpawnChances[modSlot];
|
|
||||||
|
|
||||||
if (modSpawnChance === 100)
|
if (modSpawnChance === 100)
|
||||||
{
|
{
|
||||||
@ -824,8 +825,8 @@ export class BotEquipmentModGenerator
|
|||||||
|
|
||||||
// If mod id doesn't exist in slots filter list and mod id doesn't have any of the slots filters as a base class, mod isn't valid for the slot
|
// If mod id doesn't exist in slots filter list and mod id doesn't have any of the slots filters as a base class, mod isn't valid for the slot
|
||||||
if (
|
if (
|
||||||
!(itemSlot._props.filters[0].Filter.includes(modToAdd[1]._id) ||
|
!(itemSlot._props.filters[0].Filter.includes(modToAdd[1]._id)
|
||||||
this.itemHelper.isOfBaseclasses(modToAdd[1]._id, itemSlot._props.filters[0].Filter))
|
|| this.itemHelper.isOfBaseclasses(modToAdd[1]._id, itemSlot._props.filters[0].Filter))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.warning(
|
this.logger.warning(
|
||||||
@ -1114,8 +1115,8 @@ export class BotEquipmentModGenerator
|
|||||||
if (
|
if (
|
||||||
scopeSlot?.every((x) =>
|
scopeSlot?.every((x) =>
|
||||||
x._props.filters[0].Filter.every((x) =>
|
x._props.filters[0].Filter.every((x) =>
|
||||||
this.itemHelper.isOfBaseclasses(x, whitelistedSightTypes) ||
|
this.itemHelper.isOfBaseclasses(x, whitelistedSightTypes)
|
||||||
this.itemHelper.isOfBaseclass(x, BaseClasses.MOUNT)
|
|| this.itemHelper.isOfBaseclass(x, BaseClasses.MOUNT)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -115,9 +115,9 @@ export class BotGenerator
|
|||||||
|
|
||||||
// Get raw json data for bot (Cloned)
|
// Get raw json data for bot (Cloned)
|
||||||
const botJsonTemplate = this.jsonUtil.clone(this.botHelper.getBotTemplate(
|
const botJsonTemplate = this.jsonUtil.clone(this.botHelper.getBotTemplate(
|
||||||
(botGenerationDetails.isPmc) ?
|
(botGenerationDetails.isPmc)
|
||||||
bot.Info.Side :
|
? bot.Info.Side
|
||||||
botGenerationDetails.role,
|
: botGenerationDetails.role,
|
||||||
));
|
));
|
||||||
|
|
||||||
bot = this.generateBot(sessionId, bot, botJsonTemplate, botGenerationDetails);
|
bot = this.generateBot(sessionId, bot, botJsonTemplate, botGenerationDetails);
|
||||||
@ -328,9 +328,9 @@ export class BotGenerator
|
|||||||
*/
|
*/
|
||||||
protected generateHealth(healthObj: Health, playerScav = false): PmcHealth
|
protected generateHealth(healthObj: Health, playerScav = false): PmcHealth
|
||||||
{
|
{
|
||||||
const bodyParts = playerScav ?
|
const bodyParts = playerScav
|
||||||
healthObj.BodyParts[0] :
|
? healthObj.BodyParts[0]
|
||||||
this.randomUtil.getArrayValue(healthObj.BodyParts);
|
: this.randomUtil.getArrayValue(healthObj.BodyParts);
|
||||||
|
|
||||||
const newHealth: PmcHealth = {
|
const newHealth: PmcHealth = {
|
||||||
Hydration: {
|
Hydration: {
|
||||||
|
@ -262,9 +262,9 @@ export class BotInventoryGenerator
|
|||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
const spawnChance =
|
const spawnChance =
|
||||||
([EquipmentSlots.POCKETS, EquipmentSlots.SECURED_CONTAINER] as string[]).includes(equipmentSlot) ?
|
([EquipmentSlots.POCKETS, EquipmentSlots.SECURED_CONTAINER] as string[]).includes(equipmentSlot)
|
||||||
100 :
|
? 100
|
||||||
spawnChances.equipment[equipmentSlot];
|
: spawnChances.equipment[equipmentSlot];
|
||||||
if (typeof spawnChance === "undefined")
|
if (typeof spawnChance === "undefined")
|
||||||
{
|
{
|
||||||
this.logger.warning(
|
this.logger.warning(
|
||||||
@ -312,8 +312,8 @@ export class BotInventoryGenerator
|
|||||||
// use dynamic mod pool if enabled in config
|
// use dynamic mod pool if enabled in config
|
||||||
const botEquipmentRole = this.botGeneratorHelper.getBotEquipmentRole(botRole);
|
const botEquipmentRole = this.botGeneratorHelper.getBotEquipmentRole(botRole);
|
||||||
if (
|
if (
|
||||||
this.botConfig.equipment[botEquipmentRole] &&
|
this.botConfig.equipment[botEquipmentRole]
|
||||||
randomisationDetails?.randomisedArmorSlots?.includes(equipmentSlot)
|
&& randomisationDetails?.randomisedArmorSlots?.includes(equipmentSlot)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
modPool[equipmentItemTpl] = this.getFilteredDynamicModsForItem(
|
modPool[equipmentItemTpl] = this.getFilteredDynamicModsForItem(
|
||||||
@ -323,8 +323,8 @@ export class BotInventoryGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof (modPool[equipmentItemTpl]) !== "undefined" ||
|
typeof (modPool[equipmentItemTpl]) !== "undefined"
|
||||||
Object.keys(modPool[equipmentItemTpl] || {}).length > 0
|
|| Object.keys(modPool[equipmentItemTpl] || {}).length > 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const items = this.botEquipmentModGenerator.generateModsForEquipment(
|
const items = this.botEquipmentModGenerator.generateModsForEquipment(
|
||||||
@ -428,16 +428,15 @@ export class BotInventoryGenerator
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
slot: EquipmentSlots.SECOND_PRIMARY_WEAPON,
|
slot: EquipmentSlots.SECOND_PRIMARY_WEAPON,
|
||||||
shouldSpawn: shouldSpawnPrimary ?
|
shouldSpawn: shouldSpawnPrimary
|
||||||
this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon) :
|
? this.randomUtil.getChance100(equipmentChances.equipment.SecondPrimaryWeapon)
|
||||||
false,
|
: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
slot: EquipmentSlots.HOLSTER,
|
slot: EquipmentSlots.HOLSTER,
|
||||||
shouldSpawn: shouldSpawnPrimary ?
|
shouldSpawn: shouldSpawnPrimary
|
||||||
this.randomUtil.getChance100(equipmentChances.equipment.Holster) // Primary weapon = roll for chance at pistol
|
? this.randomUtil.getChance100(equipmentChances.equipment.Holster) // Primary weapon = roll for chance at pistol
|
||||||
:
|
: true, // No primary = force pistol
|
||||||
true, // No primary = force pistol
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -598,9 +598,9 @@ export class BotLootGenerator
|
|||||||
{
|
{
|
||||||
// PMCs have a different stack max size
|
// PMCs have a different stack max size
|
||||||
const minStackSize = itemTemplate._props.StackMinRandom;
|
const minStackSize = itemTemplate._props.StackMinRandom;
|
||||||
const maxStackSize = isPmc ?
|
const maxStackSize = isPmc
|
||||||
this.pmcConfig.dynamicLoot.moneyStackLimits[itemTemplate._id] :
|
? this.pmcConfig.dynamicLoot.moneyStackLimits[itemTemplate._id]
|
||||||
itemTemplate._props.StackMaxRandom;
|
: itemTemplate._props.StackMaxRandom;
|
||||||
const randomSize = this.randomUtil.getInt(minStackSize, maxStackSize);
|
const randomSize = this.randomUtil.getInt(minStackSize, maxStackSize);
|
||||||
|
|
||||||
if (!moneyItem.upd)
|
if (!moneyItem.upd)
|
||||||
@ -619,9 +619,9 @@ export class BotLootGenerator
|
|||||||
*/
|
*/
|
||||||
protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: Item): void
|
protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: Item): void
|
||||||
{
|
{
|
||||||
const randomSize = itemTemplate._props.StackMaxSize === 1 ?
|
const randomSize = itemTemplate._props.StackMaxSize === 1
|
||||||
1 :
|
? 1
|
||||||
this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
|
: this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
|
||||||
|
|
||||||
if (!ammoItem.upd)
|
if (!ammoItem.upd)
|
||||||
{
|
{
|
||||||
|
@ -207,9 +207,9 @@ export class BotWeaponGenerator
|
|||||||
|
|
||||||
// Add cartridge to gun chamber if weapon has slot for it
|
// Add cartridge to gun chamber if weapon has slot for it
|
||||||
if (
|
if (
|
||||||
weaponItemTemplate._props.Chambers?.length === 1 &&
|
weaponItemTemplate._props.Chambers?.length === 1
|
||||||
weaponItemTemplate._props.Chambers[0]?._name === "patron_in_weapon" &&
|
&& weaponItemTemplate._props.Chambers[0]?._name === "patron_in_weapon"
|
||||||
weaponItemTemplate._props.Chambers[0]?._props?.filters[0]?.Filter?.includes(ammoTpl)
|
&& weaponItemTemplate._props.Chambers[0]?._props?.filters[0]?.Filter?.includes(ammoTpl)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.addCartridgeToChamber(weaponWithModsArray, ammoTpl, "patron_in_weapon");
|
this.addCartridgeToChamber(weaponWithModsArray, ammoTpl, "patron_in_weapon");
|
||||||
@ -615,8 +615,8 @@ export class BotWeaponGenerator
|
|||||||
|
|
||||||
const chosenAmmoTpl = this.weightedRandomHelper.getWeightedValue<string>(compatibleCartridges);
|
const chosenAmmoTpl = this.weightedRandomHelper.getWeightedValue<string>(compatibleCartridges);
|
||||||
if (
|
if (
|
||||||
weaponTemplate._props.Chambers[0] &&
|
weaponTemplate._props.Chambers[0]
|
||||||
!weaponTemplate._props.Chambers[0]._props.filters[0].Filter.includes(chosenAmmoTpl)
|
&& !weaponTemplate._props.Chambers[0]._props.filters[0].Filter.includes(chosenAmmoTpl)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
|
@ -66,8 +66,8 @@ export class FenceBaseAssortGenerator
|
|||||||
if (this.traderConfig.fence.blacklist.length > 0)
|
if (this.traderConfig.fence.blacklist.length > 0)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
this.traderConfig.fence.blacklist.includes(item._id) ||
|
this.traderConfig.fence.blacklist.includes(item._id)
|
||||||
this.itemHelper.isOfBaseclasses(item._id, this.traderConfig.fence.blacklist)
|
|| this.itemHelper.isOfBaseclasses(item._id, this.traderConfig.fence.blacklist)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -133,8 +133,8 @@ export class LocationGenerator
|
|||||||
|
|
||||||
// randomisation is turned off globally or just turned off for this map
|
// randomisation is turned off globally or just turned off for this map
|
||||||
if (
|
if (
|
||||||
!(this.locationConfig.containerRandomisationSettings.enabled &&
|
!(this.locationConfig.containerRandomisationSettings.enabled
|
||||||
this.locationConfig.containerRandomisationSettings.maps[locationId])
|
&& this.locationConfig.containerRandomisationSettings.maps[locationId])
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
@ -249,8 +249,8 @@ export class LocationGenerator
|
|||||||
{
|
{
|
||||||
return staticContainers
|
return staticContainers
|
||||||
.filter((x) =>
|
.filter((x) =>
|
||||||
x.probability !== 1 && !x.template.IsAlwaysSpawn &&
|
x.probability !== 1 && !x.template.IsAlwaysSpawn
|
||||||
!this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes(
|
&& !this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes(
|
||||||
x.template.Items[0]._tpl,
|
x.template.Items[0]._tpl,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -264,8 +264,8 @@ export class LocationGenerator
|
|||||||
protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]
|
protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]
|
||||||
{
|
{
|
||||||
return staticContainersOnMap.filter((x) =>
|
return staticContainersOnMap.filter((x) =>
|
||||||
x.probability === 1 || x.template.IsAlwaysSpawn ||
|
x.probability === 1 || x.template.IsAlwaysSpawn
|
||||||
this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes(
|
|| this.locationConfig.containerRandomisationSettings.containerTypesToNotRandomise.includes(
|
||||||
x.template.Items[0]._tpl,
|
x.template.Items[0]._tpl,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -325,12 +325,12 @@ export class LocationGenerator
|
|||||||
containerIdsWithProbability: {},
|
containerIdsWithProbability: {},
|
||||||
chosenCount: this.randomUtil.getInt(
|
chosenCount: this.randomUtil.getInt(
|
||||||
Math.round(
|
Math.round(
|
||||||
groupData.minContainers *
|
groupData.minContainers
|
||||||
this.locationConfig.containerRandomisationSettings.containerGroupMinSizeMultiplier,
|
* this.locationConfig.containerRandomisationSettings.containerGroupMinSizeMultiplier,
|
||||||
),
|
),
|
||||||
Math.round(
|
Math.round(
|
||||||
groupData.maxContainers *
|
groupData.maxContainers
|
||||||
this.locationConfig.containerRandomisationSettings.containerGroupMaxSizeMultiplier,
|
* this.locationConfig.containerRandomisationSettings.containerGroupMaxSizeMultiplier,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
@ -570,8 +570,8 @@ export class LocationGenerator
|
|||||||
|
|
||||||
// Draw from random distribution
|
// Draw from random distribution
|
||||||
const desiredSpawnpointCount = Math.round(
|
const desiredSpawnpointCount = Math.round(
|
||||||
this.getLooseLootMultiplerForLocation(locationName) *
|
this.getLooseLootMultiplerForLocation(locationName)
|
||||||
this.randomUtil.randn(
|
* this.randomUtil.randn(
|
||||||
dynamicLootDist.spawnpointCount.mean,
|
dynamicLootDist.spawnpointCount.mean,
|
||||||
dynamicLootDist.spawnpointCount.std,
|
dynamicLootDist.spawnpointCount.std,
|
||||||
),
|
),
|
||||||
@ -782,15 +782,15 @@ export class LocationGenerator
|
|||||||
|
|
||||||
// Money/Ammo - don't rely on items in spawnPoint.template.Items so we can randomise it ourselves
|
// Money/Ammo - don't rely on items in spawnPoint.template.Items so we can randomise it ourselves
|
||||||
if (
|
if (
|
||||||
this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MONEY) ||
|
this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.MONEY)
|
||||||
this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO)
|
|| this.itemHelper.isOfBaseclass(chosenTpl, BaseClasses.AMMO)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const itemTemplate = this.itemHelper.getItem(chosenTpl)[1];
|
const itemTemplate = this.itemHelper.getItem(chosenTpl)[1];
|
||||||
|
|
||||||
const stackCount = itemTemplate._props.StackMaxSize === 1 ?
|
const stackCount = itemTemplate._props.StackMaxSize === 1
|
||||||
1 :
|
? 1
|
||||||
this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
|
: this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
|
||||||
|
|
||||||
itemWithMods.push(
|
itemWithMods.push(
|
||||||
{
|
{
|
||||||
@ -915,14 +915,14 @@ export class LocationGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.itemHelper.isOfBaseclass(tpl, BaseClasses.MONEY) ||
|
this.itemHelper.isOfBaseclass(tpl, BaseClasses.MONEY)
|
||||||
this.itemHelper.isOfBaseclass(tpl, BaseClasses.AMMO)
|
|| this.itemHelper.isOfBaseclass(tpl, BaseClasses.AMMO)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Edge case - some ammos e.g. flares or M406 grenades shouldn't be stacked
|
// Edge case - some ammos e.g. flares or M406 grenades shouldn't be stacked
|
||||||
const stackCount = itemTemplate._props.StackMaxSize === 1 ?
|
const stackCount = itemTemplate._props.StackMaxSize === 1
|
||||||
1 :
|
? 1
|
||||||
this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
|
: this.randomUtil.getInt(itemTemplate._props.StackMinRandom, itemTemplate._props.StackMaxRandom);
|
||||||
items[0].upd = {StackObjectsCount: stackCount};
|
items[0].upd = {StackObjectsCount: stackCount};
|
||||||
}
|
}
|
||||||
// No spawn point, use default template
|
// No spawn point, use default template
|
||||||
|
@ -93,10 +93,10 @@ export class LootGenerator
|
|||||||
|
|
||||||
// Get items from items.json that have a type of item + not in global blacklist + basetype is in whitelist
|
// Get items from items.json that have a type of item + not in global blacklist + basetype is in whitelist
|
||||||
const items = Object.entries(tables.templates.items).filter((x) =>
|
const items = Object.entries(tables.templates.items).filter((x) =>
|
||||||
!itemBlacklist.has(x[1]._id) &&
|
!itemBlacklist.has(x[1]._id)
|
||||||
x[1]._type.toLowerCase() === "item" &&
|
&& x[1]._type.toLowerCase() === "item"
|
||||||
!x[1]._props.QuestItem &&
|
&& !x[1]._props.QuestItem
|
||||||
options.itemTypeWhitelist.includes(x[1]._parent)
|
&& options.itemTypeWhitelist.includes(x[1]._parent)
|
||||||
);
|
);
|
||||||
|
|
||||||
const randomisedItemCount = this.randomUtil.getInt(options.itemCount.min, options.itemCount.max);
|
const randomisedItemCount = this.randomUtil.getInt(options.itemCount.min, options.itemCount.max);
|
||||||
@ -175,8 +175,8 @@ export class LootGenerator
|
|||||||
|
|
||||||
// Check if armor has level in allowed whitelist
|
// Check if armor has level in allowed whitelist
|
||||||
if (
|
if (
|
||||||
randomItem._parent === BaseClasses.ARMOR ||
|
randomItem._parent === BaseClasses.ARMOR
|
||||||
randomItem._parent === BaseClasses.VEST
|
|| randomItem._parent === BaseClasses.VEST
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!options.armorLevelWhitelist.includes(Number(randomItem._props.armorClass)))
|
if (!options.armorLevelWhitelist.includes(Number(randomItem._props.armorClass)))
|
||||||
@ -319,9 +319,9 @@ export class LootGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get weapon preset - default or choose a random one from all possible
|
// Get weapon preset - default or choose a random one from all possible
|
||||||
let chosenWeaponPreset = containerSettings.defaultPresetsOnly ?
|
let chosenWeaponPreset = containerSettings.defaultPresetsOnly
|
||||||
this.presetHelper.getDefaultPreset(chosenWeaponTpl) :
|
? this.presetHelper.getDefaultPreset(chosenWeaponTpl)
|
||||||
this.randomUtil.getArrayValue(this.presetHelper.getPresets(chosenWeaponTpl));
|
: this.randomUtil.getArrayValue(this.presetHelper.getPresets(chosenWeaponTpl));
|
||||||
|
|
||||||
if (!chosenWeaponPreset)
|
if (!chosenWeaponPreset)
|
||||||
{
|
{
|
||||||
@ -407,11 +407,11 @@ export class LootGenerator
|
|||||||
// Get all items of the desired type + not quest items + not globally blacklisted
|
// Get all items of the desired type + not quest items + not globally blacklisted
|
||||||
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items)
|
const rewardItemPool = Object.values(this.databaseServer.getTables().templates.items)
|
||||||
.filter((x) =>
|
.filter((x) =>
|
||||||
x._parent === rewardTypeId &&
|
x._parent === rewardTypeId
|
||||||
x._type.toLowerCase() === "item" &&
|
&& x._type.toLowerCase() === "item"
|
||||||
!this.itemFilterService.isItemBlacklisted(x._id) &&
|
&& !this.itemFilterService.isItemBlacklisted(x._id)
|
||||||
(!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id))) &&
|
&& (!(containerSettings.allowBossItems || this.itemFilterService.isBossItem(x._id)))
|
||||||
!x._props.QuestItem
|
&& !x._props.QuestItem
|
||||||
);
|
);
|
||||||
|
|
||||||
if (rewardItemPool.length === 0)
|
if (rewardItemPool.length === 0)
|
||||||
|
@ -56,12 +56,12 @@ export class PMCLootGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
const itemsToAdd = Object.values(items).filter((item) =>
|
const itemsToAdd = Object.values(items).filter((item) =>
|
||||||
allowedItemTypes.includes(item._parent) &&
|
allowedItemTypes.includes(item._parent)
|
||||||
this.itemHelper.isValidItem(item._id) &&
|
&& this.itemHelper.isValidItem(item._id)
|
||||||
!pmcItemBlacklist.includes(item._id) &&
|
&& !pmcItemBlacklist.includes(item._id)
|
||||||
!itemBlacklist.includes(item._id) &&
|
&& !itemBlacklist.includes(item._id)
|
||||||
item._props.Width === 1 &&
|
&& item._props.Width === 1
|
||||||
item._props.Height === 1
|
&& item._props.Height === 1
|
||||||
);
|
);
|
||||||
|
|
||||||
this.pocketLootPool = itemsToAdd.map((x) => x._id);
|
this.pocketLootPool = itemsToAdd.map((x) => x._id);
|
||||||
@ -94,11 +94,11 @@ export class PMCLootGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
const itemsToAdd = Object.values(items).filter((item) =>
|
const itemsToAdd = Object.values(items).filter((item) =>
|
||||||
allowedItemTypes.includes(item._parent) &&
|
allowedItemTypes.includes(item._parent)
|
||||||
this.itemHelper.isValidItem(item._id) &&
|
&& this.itemHelper.isValidItem(item._id)
|
||||||
!pmcItemBlacklist.includes(item._id) &&
|
&& !pmcItemBlacklist.includes(item._id)
|
||||||
!itemBlacklist.includes(item._id) &&
|
&& !itemBlacklist.includes(item._id)
|
||||||
this.itemFitsInto2By2Slot(item)
|
&& this.itemFitsInto2By2Slot(item)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.vestLootPool = itemsToAdd.map((x) => x._id);
|
this.vestLootPool = itemsToAdd.map((x) => x._id);
|
||||||
@ -141,10 +141,10 @@ export class PMCLootGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
const itemsToAdd = Object.values(items).filter((item) =>
|
const itemsToAdd = Object.values(items).filter((item) =>
|
||||||
allowedItemTypes.includes(item._parent) &&
|
allowedItemTypes.includes(item._parent)
|
||||||
this.itemHelper.isValidItem(item._id) &&
|
&& this.itemHelper.isValidItem(item._id)
|
||||||
!pmcItemBlacklist.includes(item._id) &&
|
&& !pmcItemBlacklist.includes(item._id)
|
||||||
!itemBlacklist.includes(item._id)
|
&& !itemBlacklist.includes(item._id)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.backpackLootPool = itemsToAdd.map((x) => x._id);
|
this.backpackLootPool = itemsToAdd.map((x) => x._id);
|
||||||
|
@ -66,9 +66,9 @@ export class PlayerScavGenerator
|
|||||||
const existingScavData = this.jsonUtil.clone(profile.characters.scav);
|
const existingScavData = this.jsonUtil.clone(profile.characters.scav);
|
||||||
|
|
||||||
// scav profile can be empty on first profile creation
|
// scav profile can be empty on first profile creation
|
||||||
const scavKarmaLevel = (Object.keys(existingScavData).length === 0) ?
|
const scavKarmaLevel = (Object.keys(existingScavData).length === 0)
|
||||||
0 :
|
? 0
|
||||||
this.getScavKarmaLevel(pmcData);
|
: this.getScavKarmaLevel(pmcData);
|
||||||
|
|
||||||
// use karma level to get correct karmaSettings
|
// use karma level to get correct karmaSettings
|
||||||
const playerScavKarmaSettings = this.playerScavConfig.karmaLevel[scavKarmaLevel];
|
const playerScavKarmaSettings = this.playerScavConfig.karmaLevel[scavKarmaLevel];
|
||||||
|
@ -62,9 +62,9 @@ export class RagfairAssortGenerator
|
|||||||
const results: Item[] = [];
|
const results: Item[] = [];
|
||||||
const items = this.itemHelper.getItems();
|
const items = this.itemHelper.getItems();
|
||||||
|
|
||||||
const weaponPresets = (this.ragfairConfig.dynamic.showDefaultPresetsOnly) ?
|
const weaponPresets = (this.ragfairConfig.dynamic.showDefaultPresetsOnly)
|
||||||
this.getDefaultPresets() :
|
? this.getDefaultPresets()
|
||||||
this.getPresets();
|
: this.getPresets();
|
||||||
|
|
||||||
const ragfairItemInvalidBaseTypes: string[] = [
|
const ragfairItemInvalidBaseTypes: string[] = [
|
||||||
BaseClasses.LOOT_CONTAINER, // safe, barrel cache etc
|
BaseClasses.LOOT_CONTAINER, // safe, barrel cache etc
|
||||||
@ -85,8 +85,8 @@ export class RagfairAssortGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.ragfairConfig.dynamic.removeSeasonalItemsWhenNotInEvent && !seasonalEventActive &&
|
this.ragfairConfig.dynamic.removeSeasonalItemsWhenNotInEvent && !seasonalEventActive
|
||||||
seasonalItemTplBlacklist.includes(item._id)
|
&& seasonalItemTplBlacklist.includes(item._id)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -126,9 +126,9 @@ export class RagfairOfferGenerator
|
|||||||
intId: 0,
|
intId: 0,
|
||||||
user: {
|
user: {
|
||||||
id: this.getTraderId(userID),
|
id: this.getTraderId(userID),
|
||||||
memberType: (userID === "ragfair") ?
|
memberType: (userID === "ragfair")
|
||||||
MemberCategory.DEFAULT :
|
? MemberCategory.DEFAULT
|
||||||
this.ragfairServerHelper.getMemberType(userID),
|
: this.ragfairServerHelper.getMemberType(userID),
|
||||||
nickname: this.ragfairServerHelper.getNickname(userID),
|
nickname: this.ragfairServerHelper.getNickname(userID),
|
||||||
rating: this.getRating(userID),
|
rating: this.getRating(userID),
|
||||||
isRatingGrowing: this.getRatingGrowing(userID),
|
isRatingGrowing: this.getRatingGrowing(userID),
|
||||||
@ -164,9 +164,9 @@ export class RagfairOfferGenerator
|
|||||||
let roublePrice = 0;
|
let roublePrice = 0;
|
||||||
for (const requirement of offerRequirements)
|
for (const requirement of offerRequirements)
|
||||||
{
|
{
|
||||||
roublePrice += this.paymentHelper.isMoneyTpl(requirement._tpl) ?
|
roublePrice += this.paymentHelper.isMoneyTpl(requirement._tpl)
|
||||||
Math.round(this.calculateRoublePrice(requirement.count, requirement._tpl)) :
|
? Math.round(this.calculateRoublePrice(requirement.count, requirement._tpl))
|
||||||
this.ragfairPriceService.getFleaPriceForItem(requirement._tpl) * requirement.count; // get flea price for barter offer items
|
: this.ragfairPriceService.getFleaPriceForItem(requirement._tpl) * requirement.count; // get flea price for barter offer items
|
||||||
}
|
}
|
||||||
|
|
||||||
return roublePrice;
|
return roublePrice;
|
||||||
@ -290,8 +290,8 @@ export class RagfairOfferGenerator
|
|||||||
|
|
||||||
// Generated fake-player offer
|
// Generated fake-player offer
|
||||||
return Math.round(
|
return Math.round(
|
||||||
time +
|
time
|
||||||
this.randomUtil.getInt(
|
+ this.randomUtil.getInt(
|
||||||
this.ragfairConfig.dynamic.endTimeSeconds.min,
|
this.ragfairConfig.dynamic.endTimeSeconds.min,
|
||||||
this.ragfairConfig.dynamic.endTimeSeconds.max,
|
this.ragfairConfig.dynamic.endTimeSeconds.max,
|
||||||
),
|
),
|
||||||
@ -307,9 +307,9 @@ export class RagfairOfferGenerator
|
|||||||
const config = this.ragfairConfig.dynamic;
|
const config = this.ragfairConfig.dynamic;
|
||||||
|
|
||||||
// get assort items from param if they exist, otherwise grab freshly generated assorts
|
// get assort items from param if they exist, otherwise grab freshly generated assorts
|
||||||
const assortItemsToProcess: Item[] = expiredOffers ?
|
const assortItemsToProcess: Item[] = expiredOffers
|
||||||
expiredOffers :
|
? expiredOffers
|
||||||
this.ragfairAssortGenerator.getAssortItems();
|
: this.ragfairAssortGenerator.getAssortItems();
|
||||||
|
|
||||||
// Store all functions to create an offer for every item and pass into Promise.all to run async
|
// Store all functions to create an offer for every item and pass into Promise.all to run async
|
||||||
const assorOffersForItemsProcesses = [];
|
const assorOffersForItemsProcesses = [];
|
||||||
@ -348,9 +348,9 @@ export class RagfairOfferGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get item + sub-items if preset, otherwise just get item
|
// Get item + sub-items if preset, otherwise just get item
|
||||||
const items: Item[] = isPreset ?
|
const items: Item[] = isPreset
|
||||||
this.ragfairServerHelper.getPresetItems(assortItem) :
|
? this.ragfairServerHelper.getPresetItems(assortItem)
|
||||||
[
|
: [
|
||||||
...[assortItem],
|
...[assortItem],
|
||||||
...this.itemHelper.findAndReturnChildrenByAssort(
|
...this.itemHelper.findAndReturnChildrenByAssort(
|
||||||
assortItem._id,
|
assortItem._id,
|
||||||
@ -360,9 +360,9 @@ export class RagfairOfferGenerator
|
|||||||
|
|
||||||
// Get number of offers to create
|
// Get number of offers to create
|
||||||
// Limit to 1 offer when processing expired
|
// Limit to 1 offer when processing expired
|
||||||
const offerCount = expiredOffers ?
|
const offerCount = expiredOffers
|
||||||
1 :
|
? 1
|
||||||
Math.round(this.randomUtil.getInt(config.offerItemCount.min, config.offerItemCount.max));
|
: Math.round(this.randomUtil.getInt(config.offerItemCount.min, config.offerItemCount.max));
|
||||||
|
|
||||||
// Store all functions to create offers for this item and pass into Promise.all to run async
|
// Store all functions to create offers for this item and pass into Promise.all to run async
|
||||||
const assortSingleOfferProcesses = [];
|
const assortSingleOfferProcesses = [];
|
||||||
@ -391,10 +391,10 @@ export class RagfairOfferGenerator
|
|||||||
items[0].upd.StackObjectsCount = this.ragfairServerHelper.calculateDynamicStackCount(items[0]._tpl, isPreset);
|
items[0].upd.StackObjectsCount = this.ragfairServerHelper.calculateDynamicStackCount(items[0]._tpl, isPreset);
|
||||||
|
|
||||||
const isBarterOffer = this.randomUtil.getChance100(this.ragfairConfig.dynamic.barter.chancePercent);
|
const isBarterOffer = this.randomUtil.getChance100(this.ragfairConfig.dynamic.barter.chancePercent);
|
||||||
const isPackOffer = this.randomUtil.getChance100(this.ragfairConfig.dynamic.pack.chancePercent) &&
|
const isPackOffer = this.randomUtil.getChance100(this.ragfairConfig.dynamic.pack.chancePercent)
|
||||||
!isBarterOffer &&
|
&& !isBarterOffer
|
||||||
items.length === 1 &&
|
&& items.length === 1
|
||||||
this.itemHelper.isOfBaseclasses(items[0]._tpl, this.ragfairConfig.dynamic.pack.itemTypeWhitelist);
|
&& this.itemHelper.isOfBaseclasses(items[0]._tpl, this.ragfairConfig.dynamic.pack.itemTypeWhitelist);
|
||||||
const randomUserId = this.hashUtil.generate();
|
const randomUserId = this.hashUtil.generate();
|
||||||
|
|
||||||
let barterScheme: IBarterScheme[];
|
let barterScheme: IBarterScheme[];
|
||||||
@ -488,9 +488,9 @@ export class RagfairOfferGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isPreset = this.presetHelper.isPreset(item._id);
|
const isPreset = this.presetHelper.isPreset(item._id);
|
||||||
const items: Item[] = isPreset ?
|
const items: Item[] = isPreset
|
||||||
this.ragfairServerHelper.getPresetItems(item) :
|
? this.ragfairServerHelper.getPresetItems(item)
|
||||||
[...[item], ...this.itemHelper.findAndReturnChildrenByAssort(item._id, assorts.items)];
|
: [...[item], ...this.itemHelper.findAndReturnChildrenByAssort(item._id, assorts.items)];
|
||||||
|
|
||||||
const barterScheme = assorts.barter_scheme[item._id];
|
const barterScheme = assorts.barter_scheme[item._id];
|
||||||
if (!barterScheme)
|
if (!barterScheme)
|
||||||
@ -762,8 +762,8 @@ export class RagfairOfferGenerator
|
|||||||
|
|
||||||
// Filter possible barters to items that match the price range + not itself
|
// Filter possible barters to items that match the price range + not itself
|
||||||
const filtered = fleaPrices.filter((x) =>
|
const filtered = fleaPrices.filter((x) =>
|
||||||
x.price >= desiredItemCost - offerCostVariance && x.price <= desiredItemCost + offerCostVariance &&
|
x.price >= desiredItemCost - offerCostVariance && x.price <= desiredItemCost + offerCostVariance
|
||||||
x.tpl !== offerItems[0]._tpl
|
&& x.tpl !== offerItems[0]._tpl
|
||||||
);
|
);
|
||||||
|
|
||||||
// No items on flea have a matching price, fall back to currency
|
// No items on flea have a matching price, fall back to currency
|
||||||
@ -816,8 +816,8 @@ export class RagfairOfferGenerator
|
|||||||
protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler = 1): IBarterScheme[]
|
protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler = 1): IBarterScheme[]
|
||||||
{
|
{
|
||||||
const currency = this.ragfairServerHelper.getDynamicOfferCurrency();
|
const currency = this.ragfairServerHelper.getDynamicOfferCurrency();
|
||||||
const price = this.ragfairPriceService.getDynamicOfferPriceForOffer(offerItems, currency, isPackOffer) *
|
const price = this.ragfairPriceService.getDynamicOfferPriceForOffer(offerItems, currency, isPackOffer)
|
||||||
multipler;
|
* multipler;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -212,8 +212,8 @@ export class RepeatableQuestGenerator
|
|||||||
// we use any also if the random condition is not met in case only "any" was in the pool
|
// we use any also if the random condition is not met in case only "any" was in the pool
|
||||||
let locationKey = "any";
|
let locationKey = "any";
|
||||||
if (
|
if (
|
||||||
locations.includes("any") &&
|
locations.includes("any")
|
||||||
(eliminationConfig.specificLocationProb < Math.random() || locations.length <= 1)
|
&& (eliminationConfig.specificLocationProb < Math.random() || locations.length <= 1)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
locationKey = "any";
|
locationKey = "any";
|
||||||
@ -290,8 +290,8 @@ export class RepeatableQuestGenerator
|
|||||||
{
|
{
|
||||||
// random distance with lower values more likely; simple distribution for starters...
|
// random distance with lower values more likely; simple distribution for starters...
|
||||||
distance = Math.floor(
|
distance = Math.floor(
|
||||||
Math.abs(Math.random() - Math.random()) * (1 + eliminationConfig.maxDist - eliminationConfig.minDist) +
|
Math.abs(Math.random() - Math.random()) * (1 + eliminationConfig.maxDist - eliminationConfig.minDist)
|
||||||
eliminationConfig.minDist,
|
+ eliminationConfig.minDist,
|
||||||
);
|
);
|
||||||
distance = Math.ceil(distance / 5) * 5;
|
distance = Math.ceil(distance / 5) * 5;
|
||||||
distanceDifficulty = maxDistDifficulty * distance / eliminationConfig.maxDist;
|
distanceDifficulty = maxDistDifficulty * distance / eliminationConfig.maxDist;
|
||||||
@ -542,8 +542,8 @@ export class RepeatableQuestGenerator
|
|||||||
itemSelection = itemSelection.filter((x) =>
|
itemSelection = itemSelection.filter((x) =>
|
||||||
{
|
{
|
||||||
// Whitelist can contain item tpls and item base type ids
|
// Whitelist can contain item tpls and item base type ids
|
||||||
return (itemIdsWhitelisted.some((v) => this.itemHelper.isOfBaseclass(x[0], v)) ||
|
return (itemIdsWhitelisted.some((v) => this.itemHelper.isOfBaseclass(x[0], v))
|
||||||
itemIdsWhitelisted.includes(x[0]));
|
|| itemIdsWhitelisted.includes(x[0]));
|
||||||
});
|
});
|
||||||
// check if items are missing
|
// check if items are missing
|
||||||
// const flatList = itemSelection.reduce((a, il) => a.concat(il[0]), []);
|
// const flatList = itemSelection.reduce((a, il) => a.concat(il[0]), []);
|
||||||
@ -561,8 +561,8 @@ export class RepeatableQuestGenerator
|
|||||||
);
|
);
|
||||||
itemSelection = itemSelection.filter((x) =>
|
itemSelection = itemSelection.filter((x) =>
|
||||||
{
|
{
|
||||||
return itemIdsBlacklisted.every((v) => !this.itemHelper.isOfBaseclass(x[0], v)) ||
|
return itemIdsBlacklisted.every((v) => !this.itemHelper.isOfBaseclass(x[0], v))
|
||||||
!itemIdsBlacklisted.includes(x[0]);
|
|| !itemIdsBlacklisted.includes(x[0]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,16 +637,16 @@ export class RepeatableQuestGenerator
|
|||||||
let minDurability = 0;
|
let minDurability = 0;
|
||||||
let onlyFoundInRaid = true;
|
let onlyFoundInRaid = true;
|
||||||
if (
|
if (
|
||||||
this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.WEAPON) ||
|
this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.WEAPON)
|
||||||
this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.ARMOR)
|
|| this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.ARMOR)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
minDurability = 80;
|
minDurability = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.DOG_TAG_USEC) ||
|
this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.DOG_TAG_USEC)
|
||||||
this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.DOG_TAG_BEAR)
|
|| this.itemHelper.isOfBaseclass(targetItemId, BaseClasses.DOG_TAG_BEAR)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
onlyFoundInRaid = false;
|
onlyFoundInRaid = false;
|
||||||
@ -744,11 +744,11 @@ export class RepeatableQuestGenerator
|
|||||||
(this.databaseServer.getTables().locations[locationKey.toLowerCase()].base as ILocationBase).exits;
|
(this.databaseServer.getTables().locations[locationKey.toLowerCase()].base as ILocationBase).exits;
|
||||||
const possibleExists = mapExits.filter(
|
const possibleExists = mapExits.filter(
|
||||||
(x) =>
|
(x) =>
|
||||||
(!("PassageRequirement" in x) ||
|
(!("PassageRequirement" in x)
|
||||||
repeatableConfig.questConfig.Exploration.specificExits.passageRequirementWhitelist.includes(
|
|| repeatableConfig.questConfig.Exploration.specificExits.passageRequirementWhitelist.includes(
|
||||||
x.PassageRequirement,
|
x.PassageRequirement,
|
||||||
)) &&
|
))
|
||||||
x.Chance > 0,
|
&& x.Chance > 0,
|
||||||
);
|
);
|
||||||
const exit = this.randomUtil.drawRandomFromList(possibleExists, 1)[0];
|
const exit = this.randomUtil.drawRandomFromList(possibleExists, 1)[0];
|
||||||
const exitCondition = this.generateExplorationExitCondition(exit);
|
const exitCondition = this.generateExplorationExitCondition(exit);
|
||||||
@ -879,20 +879,20 @@ export class RepeatableQuestGenerator
|
|||||||
|
|
||||||
// rewards are generated based on pmcLevel, difficulty and a random spread
|
// rewards are generated based on pmcLevel, difficulty and a random spread
|
||||||
const rewardXP = Math.floor(
|
const rewardXP = Math.floor(
|
||||||
difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, xpConfig) *
|
difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, xpConfig)
|
||||||
this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
|
* this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
|
||||||
);
|
);
|
||||||
const rewardRoubles = Math.floor(
|
const rewardRoubles = Math.floor(
|
||||||
difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, roublesConfig) *
|
difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, roublesConfig)
|
||||||
this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
|
* this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
|
||||||
);
|
);
|
||||||
const rewardNumItems = this.randomUtil.randInt(
|
const rewardNumItems = this.randomUtil.randInt(
|
||||||
1,
|
1,
|
||||||
Math.round(this.mathUtil.interp1(pmcLevel, levelsConfig, itemsConfig)) + 1,
|
Math.round(this.mathUtil.interp1(pmcLevel, levelsConfig, itemsConfig)) + 1,
|
||||||
);
|
);
|
||||||
const rewardReputation = Math.round(
|
const rewardReputation = Math.round(
|
||||||
100 * difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, reputationConfig) *
|
100 * difficulty * this.mathUtil.interp1(pmcLevel, levelsConfig, reputationConfig)
|
||||||
this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
|
* this.randomUtil.getFloat(1 - rewardSpreadConfig, 1 + rewardSpreadConfig),
|
||||||
) / 100;
|
) / 100;
|
||||||
const skillRewardChance = this.mathUtil.interp1(pmcLevel, levelsConfig, skillRewardChanceConfig);
|
const skillRewardChance = this.mathUtil.interp1(pmcLevel, levelsConfig, skillRewardChanceConfig);
|
||||||
const skillPointReward = this.mathUtil.interp1(pmcLevel, levelsConfig, skillPointRewardConfig);
|
const skillPointReward = this.mathUtil.interp1(pmcLevel, levelsConfig, skillPointRewardConfig);
|
||||||
@ -1124,8 +1124,8 @@ export class RepeatableQuestGenerator
|
|||||||
|
|
||||||
// Item is on repeatable or global blacklist
|
// Item is on repeatable or global blacklist
|
||||||
if (
|
if (
|
||||||
repeatableQuestConfig.rewardBlacklist.includes(tpl) ||
|
repeatableQuestConfig.rewardBlacklist.includes(tpl)
|
||||||
this.itemFilterService.isItemBlacklisted(tpl)
|
|| this.itemFilterService.isItemBlacklisted(tpl)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -1152,8 +1152,8 @@ export class RepeatableQuestGenerator
|
|||||||
|
|
||||||
// Skip globally blacklisted items + boss items
|
// Skip globally blacklisted items + boss items
|
||||||
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
||||||
valid = !this.itemFilterService.isItemBlacklisted(tpl) &&
|
valid = !this.itemFilterService.isItemBlacklisted(tpl)
|
||||||
!this.itemFilterService.isBossItem(tpl);
|
&& !this.itemFilterService.isBossItem(tpl);
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,9 @@ export class ScavCaseRewardGenerator
|
|||||||
|
|
||||||
// Skip item if item id is on blacklist
|
// Skip item if item id is on blacklist
|
||||||
if (
|
if (
|
||||||
(item._type !== "Item") ||
|
(item._type !== "Item")
|
||||||
this.scavCaseConfig.rewardItemBlacklist.includes(item._id) ||
|
|| this.scavCaseConfig.rewardItemBlacklist.includes(item._id)
|
||||||
this.itemFilterService.isItemBlacklisted(item._id)
|
|| this.itemFilterService.isItemBlacklisted(item._id)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -249,8 +249,8 @@ export class ScavCaseRewardGenerator
|
|||||||
// Is ammo handbook price between desired range
|
// Is ammo handbook price between desired range
|
||||||
const handbookPrice = this.ragfairPriceService.getStaticPriceForItem(ammo._id);
|
const handbookPrice = this.ragfairPriceService.getStaticPriceForItem(ammo._id);
|
||||||
if (
|
if (
|
||||||
handbookPrice >= this.scavCaseConfig.ammoRewards.ammoRewardValueRangeRub[rarity].min &&
|
handbookPrice >= this.scavCaseConfig.ammoRewards.ammoRewardValueRangeRub[rarity].min
|
||||||
handbookPrice <= this.scavCaseConfig.ammoRewards.ammoRewardValueRangeRub[rarity].max
|
&& handbookPrice <= this.scavCaseConfig.ammoRewards.ammoRewardValueRangeRub[rarity].max
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -332,8 +332,8 @@ export class ScavCaseRewardGenerator
|
|||||||
{
|
{
|
||||||
const handbookPrice = this.ragfairPriceService.getStaticPriceForItem(item._id);
|
const handbookPrice = this.ragfairPriceService.getStaticPriceForItem(item._id);
|
||||||
if (
|
if (
|
||||||
handbookPrice >= itemFilters.minPriceRub &&
|
handbookPrice >= itemFilters.minPriceRub
|
||||||
handbookPrice <= itemFilters.maxPriceRub
|
&& handbookPrice <= itemFilters.maxPriceRub
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -106,9 +106,9 @@ export class WeatherGenerator
|
|||||||
wind_gustiness: this.getRandomFloat("windGustiness"),
|
wind_gustiness: this.getRandomFloat("windGustiness"),
|
||||||
rain: rain,
|
rain: rain,
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
rain_intensity: (rain > 1) ?
|
rain_intensity: (rain > 1)
|
||||||
this.getRandomFloat("rainIntensity") :
|
? this.getRandomFloat("rainIntensity")
|
||||||
0,
|
: 0,
|
||||||
fog: this.getWeightedFog(),
|
fog: this.getWeightedFog(),
|
||||||
temp: this.getRandomFloat("temp"),
|
temp: this.getRandomFloat("temp"),
|
||||||
pressure: this.getRandomFloat("pressure"),
|
pressure: this.getRandomFloat("pressure"),
|
||||||
|
@ -59,8 +59,10 @@ export class ExternalInventoryMagGen implements IInventoryMagGen
|
|||||||
// and try again. Temporary workaround to Killa spawning with no extras if he spawns with a drum mag.
|
// and try again. Temporary workaround to Killa spawning with no extras if he spawns with a drum mag.
|
||||||
// TODO: Fix this properly
|
// TODO: Fix this properly
|
||||||
if (
|
if (
|
||||||
magazineTpl ===
|
magazineTpl
|
||||||
this.botWeaponGeneratorHelper.getWeaponsDefaultMagazineTpl(inventoryMagGen.getWeaponTemplate())
|
=== this.botWeaponGeneratorHelper.getWeaponsDefaultMagazineTpl(
|
||||||
|
inventoryMagGen.getWeaponTemplate(),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// We were already on default - stop here to prevent infinite looping
|
// We were already on default - stop here to prevent infinite looping
|
||||||
|
@ -38,12 +38,12 @@ export class BotDifficultyHelper
|
|||||||
{
|
{
|
||||||
const difficultySettings = this.getDifficultySettings(pmcType, difficulty);
|
const difficultySettings = this.getDifficultySettings(pmcType, difficulty);
|
||||||
|
|
||||||
const friendlyType = pmcType === "bear" ?
|
const friendlyType = pmcType === "bear"
|
||||||
bearType :
|
? bearType
|
||||||
usecType;
|
: usecType;
|
||||||
const enemyType = pmcType === "bear" ?
|
const enemyType = pmcType === "bear"
|
||||||
usecType :
|
? usecType
|
||||||
bearType;
|
: bearType;
|
||||||
|
|
||||||
this.botHelper.addBotToEnemyList(difficultySettings, this.pmcConfig.enemyTypes, friendlyType); // Add generic bot types to enemy list
|
this.botHelper.addBotToEnemyList(difficultySettings, this.pmcConfig.enemyTypes, friendlyType); // Add generic bot types to enemy list
|
||||||
this.botHelper.addBotToEnemyList(difficultySettings, [enemyType, friendlyType], ""); // add same/opposite side to enemy list
|
this.botHelper.addBotToEnemyList(difficultySettings, [enemyType, friendlyType], ""); // add same/opposite side to enemy list
|
||||||
@ -96,9 +96,9 @@ export class BotDifficultyHelper
|
|||||||
*/
|
*/
|
||||||
protected getDifficultySettings(type: string, difficulty: string): Difficulty
|
protected getDifficultySettings(type: string, difficulty: string): Difficulty
|
||||||
{
|
{
|
||||||
let difficultySetting = this.pmcConfig.difficulty.toLowerCase() === "asonline" ?
|
let difficultySetting = this.pmcConfig.difficulty.toLowerCase() === "asonline"
|
||||||
difficulty :
|
? difficulty
|
||||||
this.pmcConfig.difficulty.toLowerCase();
|
: this.pmcConfig.difficulty.toLowerCase();
|
||||||
|
|
||||||
difficultySetting = this.convertBotDifficultyDropdownToBotDifficulty(difficultySetting);
|
difficultySetting = this.convertBotDifficultyDropdownToBotDifficulty(difficultySetting);
|
||||||
|
|
||||||
|
@ -113,9 +113,9 @@ export class BotGeneratorHelper
|
|||||||
if (itemTemplate._parent === BaseClasses.FLASHLIGHT)
|
if (itemTemplate._parent === BaseClasses.FLASHLIGHT)
|
||||||
{
|
{
|
||||||
// Get chance from botconfig for bot type
|
// Get chance from botconfig for bot type
|
||||||
const lightLaserActiveChance = raidIsNight ?
|
const lightLaserActiveChance = raidIsNight
|
||||||
this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveNightChancePercent", 50) :
|
? this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveNightChancePercent", 50)
|
||||||
this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveDayChancePercent", 25);
|
: this.getBotEquipmentSettingFromConfig(botRole, "lightIsActiveDayChancePercent", 25);
|
||||||
itemProperties.Light = {IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), SelectedMode: 0};
|
itemProperties.Light = {IsActive: (this.randomUtil.getChance100(lightLaserActiveChance)), SelectedMode: 0};
|
||||||
}
|
}
|
||||||
else if (itemTemplate._parent === BaseClasses.TACTICAL_COMBO)
|
else if (itemTemplate._parent === BaseClasses.TACTICAL_COMBO)
|
||||||
@ -132,9 +132,9 @@ export class BotGeneratorHelper
|
|||||||
if (itemTemplate._parent === BaseClasses.NIGHTVISION)
|
if (itemTemplate._parent === BaseClasses.NIGHTVISION)
|
||||||
{
|
{
|
||||||
// Get chance from botconfig for bot type
|
// Get chance from botconfig for bot type
|
||||||
const nvgActiveChance = raidIsNight ?
|
const nvgActiveChance = raidIsNight
|
||||||
this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceNightPercent", 90) :
|
? this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceNightPercent", 90)
|
||||||
this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceDayPercent", 15);
|
: this.getBotEquipmentSettingFromConfig(botRole, "nvgIsActiveChanceDayPercent", 15);
|
||||||
itemProperties.Togglable = {On: (this.randomUtil.getChance100(nvgActiveChance))};
|
itemProperties.Togglable = {On: (this.randomUtil.getChance100(nvgActiveChance))};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,9 +150,9 @@ export class BotGeneratorHelper
|
|||||||
itemProperties.Togglable = {On: (this.randomUtil.getChance100(faceShieldActiveChance))};
|
itemProperties.Togglable = {On: (this.randomUtil.getChance100(faceShieldActiveChance))};
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.keys(itemProperties).length ?
|
return Object.keys(itemProperties).length
|
||||||
{upd: itemProperties} :
|
? {upd: itemProperties}
|
||||||
{};
|
: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -370,9 +370,9 @@ export class BotGeneratorHelper
|
|||||||
{
|
{
|
||||||
return ([this.pmcConfig.usecType.toLowerCase(), this.pmcConfig.bearType.toLowerCase()].includes(
|
return ([this.pmcConfig.usecType.toLowerCase(), this.pmcConfig.bearType.toLowerCase()].includes(
|
||||||
botRole.toLowerCase(),
|
botRole.toLowerCase(),
|
||||||
)) ?
|
))
|
||||||
"pmc" :
|
? "pmc"
|
||||||
botRole;
|
: botRole;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ export class BotHelper
|
|||||||
|
|
||||||
public rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean
|
public rollChanceToBePmc(role: string, botConvertMinMax: MinMax): boolean
|
||||||
{
|
{
|
||||||
return role.toLowerCase() in this.pmcConfig.convertIntoPmcChance &&
|
return role.toLowerCase() in this.pmcConfig.convertIntoPmcChance
|
||||||
this.randomUtil.getChance100(this.randomUtil.getInt(botConvertMinMax.min, botConvertMinMax.max));
|
&& this.randomUtil.getChance100(this.randomUtil.getInt(botConvertMinMax.min, botConvertMinMax.max));
|
||||||
}
|
}
|
||||||
|
|
||||||
public botRoleIsPmc(botRole: string): boolean
|
public botRoleIsPmc(botRole: string): boolean
|
||||||
@ -219,9 +219,9 @@ export class BotHelper
|
|||||||
*/
|
*/
|
||||||
public getRandomizedPmcRole(): string
|
public getRandomizedPmcRole(): string
|
||||||
{
|
{
|
||||||
return (this.randomUtil.getChance100(this.pmcConfig.isUsec)) ?
|
return (this.randomUtil.getChance100(this.pmcConfig.isUsec))
|
||||||
this.pmcConfig.usecType :
|
? this.pmcConfig.usecType
|
||||||
this.pmcConfig.bearType;
|
: this.pmcConfig.bearType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -248,8 +248,8 @@ export class BotHelper
|
|||||||
*/
|
*/
|
||||||
protected getRandomizedPmcSide(): string
|
protected getRandomizedPmcSide(): string
|
||||||
{
|
{
|
||||||
return (this.randomUtil.getChance100(this.pmcConfig.isUsec)) ?
|
return (this.randomUtil.getChance100(this.pmcConfig.isUsec))
|
||||||
"Usec" :
|
? "Usec"
|
||||||
"Bear";
|
: "Bear";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,9 +149,9 @@ export class DialogueHelper
|
|||||||
items: items,
|
items: items,
|
||||||
maxStorageTime: messageContent.maxStorageTime,
|
maxStorageTime: messageContent.maxStorageTime,
|
||||||
systemData: messageContent.systemData ? messageContent.systemData : undefined,
|
systemData: messageContent.systemData ? messageContent.systemData : undefined,
|
||||||
profileChangeEvents: (messageContent.profileChangeEvents?.length === 0) ?
|
profileChangeEvents: (messageContent.profileChangeEvents?.length === 0)
|
||||||
messageContent.profileChangeEvents :
|
? messageContent.profileChangeEvents
|
||||||
undefined,
|
: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!message.templateId)
|
if (!message.templateId)
|
||||||
|
@ -177,9 +177,9 @@ export class DurabilityLimitsHelper
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Dont let weapon dura go below the percent defined in config
|
// Dont let weapon dura go below the percent defined in config
|
||||||
return (result >= durabilityValueMinLimit) ?
|
return (result >= durabilityValueMinLimit)
|
||||||
result :
|
? result
|
||||||
durabilityValueMinLimit;
|
: durabilityValueMinLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected generateArmorDurability(botRole: string, maxDurability: number): number
|
protected generateArmorDurability(botRole: string, maxDurability: number): number
|
||||||
@ -193,9 +193,9 @@ export class DurabilityLimitsHelper
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Dont let armor dura go below the percent defined in config
|
// Dont let armor dura go below the percent defined in config
|
||||||
return (result >= durabilityValueMinLimit) ?
|
return (result >= durabilityValueMinLimit)
|
||||||
result :
|
? result
|
||||||
durabilityValueMinLimit;
|
: durabilityValueMinLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getMinWeaponDeltaFromConfig(botRole: string): number
|
protected getMinWeaponDeltaFromConfig(botRole: string): number
|
||||||
|
@ -108,8 +108,8 @@ export class HealthHelper
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
profileHealth[bodyPart] = pmcData.Health.BodyParts[bodyPart].Health.Maximum *
|
profileHealth[bodyPart] = pmcData.Health.BodyParts[bodyPart].Health.Maximum
|
||||||
this.healthConfig.healthMultipliers.death;
|
* this.healthConfig.healthMultipliers.death;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,8 +172,8 @@ export class HealthHelper
|
|||||||
{
|
{
|
||||||
// Blacked body part
|
// Blacked body part
|
||||||
target = Math.round(
|
target = Math.round(
|
||||||
pmcData.Health.BodyParts[healthModifier].Health.Maximum *
|
pmcData.Health.BodyParts[healthModifier].Health.Maximum
|
||||||
this.healthConfig.healthMultipliers.blacked,
|
* this.healthConfig.healthMultipliers.blacked,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ export class HideoutHelper
|
|||||||
return this.httpResponse.appendErrorToOutput(this.eventOutputHolder.getOutput(sessionID));
|
return this.httpResponse.appendErrorToOutput(this.eventOutputHolder.getOutput(sessionID));
|
||||||
}
|
}
|
||||||
|
|
||||||
const modifiedProductionTime = recipe.productionTime -
|
const modifiedProductionTime = recipe.productionTime
|
||||||
this.getCraftingSkillProductionTimeReduction(pmcData, recipe.productionTime);
|
- this.getCraftingSkillProductionTimeReduction(pmcData, recipe.productionTime);
|
||||||
|
|
||||||
// @Important: Here we need to be very exact:
|
// @Important: Here we need to be very exact:
|
||||||
// - normal recipe: Production time value is stored in attribute "productionType" with small "p"
|
// - normal recipe: Production time value is stored in attribute "productionType" with small "p"
|
||||||
@ -353,8 +353,8 @@ export class HideoutHelper
|
|||||||
*/
|
*/
|
||||||
protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void
|
protected updateScavCaseProductionTimer(pmcData: IPmcData, productionId: string): void
|
||||||
{
|
{
|
||||||
const timeElapsed = (this.timeUtil.getTimestamp() - pmcData.Hideout.Production[productionId].StartTimestamp) -
|
const timeElapsed = (this.timeUtil.getTimestamp() - pmcData.Hideout.Production[productionId].StartTimestamp)
|
||||||
pmcData.Hideout.Production[productionId].Progress;
|
- pmcData.Hideout.Production[productionId].Progress;
|
||||||
pmcData.Hideout.Production[productionId].Progress += timeElapsed;
|
pmcData.Hideout.Production[productionId].Progress += timeElapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,8 +398,8 @@ export class HideoutHelper
|
|||||||
{
|
{
|
||||||
// 1 resource last 14 min 27 sec, 1/14.45/60 = 0.00115
|
// 1 resource last 14 min 27 sec, 1/14.45/60 = 0.00115
|
||||||
// 10-10-2021 From wiki, 1 resource last 12 minutes 38 seconds, 1/12.63333/60 = 0.00131
|
// 10-10-2021 From wiki, 1 resource last 12 minutes 38 seconds, 1/12.63333/60 = 0.00131
|
||||||
let fuelDrainRate = this.databaseServer.getTables().hideout.settings.generatorFuelFlowRate *
|
let fuelDrainRate = this.databaseServer.getTables().hideout.settings.generatorFuelFlowRate
|
||||||
this.hideoutConfig.runIntervalSeconds;
|
* this.hideoutConfig.runIntervalSeconds;
|
||||||
// implemented moddable bonus for fuel consumption bonus instead of using solar power variable as before
|
// implemented moddable bonus for fuel consumption bonus instead of using solar power variable as before
|
||||||
const fuelBonus = pmcData.Bonuses.find((b) => b.type === "FuelConsumption");
|
const fuelBonus = pmcData.Bonuses.find((b) => b.type === "FuelConsumption");
|
||||||
const fuelBonusPercent = 1.0 - (fuelBonus ? Math.abs(fuelBonus.value) : 0) / 100;
|
const fuelBonusPercent = 1.0 - (fuelBonus ? Math.abs(fuelBonus.value) : 0) / 100;
|
||||||
@ -414,9 +414,9 @@ export class HideoutHelper
|
|||||||
{
|
{
|
||||||
if (generatorArea.slots[i].item)
|
if (generatorArea.slots[i].item)
|
||||||
{
|
{
|
||||||
let resourceValue = (generatorArea.slots[i].item[0].upd?.Resource) ?
|
let resourceValue = (generatorArea.slots[i].item[0].upd?.Resource)
|
||||||
generatorArea.slots[i].item[0].upd.Resource.Value :
|
? generatorArea.slots[i].item[0].upd.Resource.Value
|
||||||
null;
|
: null;
|
||||||
if (resourceValue === 0)
|
if (resourceValue === 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -424,9 +424,9 @@ export class HideoutHelper
|
|||||||
else if (!resourceValue)
|
else if (!resourceValue)
|
||||||
{
|
{
|
||||||
const fuelItem = HideoutHelper.expeditionaryFuelTank;
|
const fuelItem = HideoutHelper.expeditionaryFuelTank;
|
||||||
resourceValue = generatorArea.slots[i].item[0]._tpl === fuelItem ?
|
resourceValue = generatorArea.slots[i].item[0]._tpl === fuelItem
|
||||||
60 - fuelDrainRate :
|
? 60 - fuelDrainRate
|
||||||
100 - fuelDrainRate;
|
: 100 - fuelDrainRate;
|
||||||
pointsConsumed = fuelDrainRate;
|
pointsConsumed = fuelDrainRate;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -542,9 +542,9 @@ export class HideoutHelper
|
|||||||
if (waterFilterArea.slots[i].item)
|
if (waterFilterArea.slots[i].item)
|
||||||
{
|
{
|
||||||
// How many units of filter are left
|
// How many units of filter are left
|
||||||
let resourceValue = (waterFilterArea.slots[i].item[0].upd?.Resource) ?
|
let resourceValue = (waterFilterArea.slots[i].item[0].upd?.Resource)
|
||||||
waterFilterArea.slots[i].item[0].upd.Resource.Value :
|
? waterFilterArea.slots[i].item[0].upd.Resource.Value
|
||||||
null;
|
: null;
|
||||||
if (!resourceValue)
|
if (!resourceValue)
|
||||||
{
|
{
|
||||||
// None left
|
// None left
|
||||||
@ -553,8 +553,8 @@ export class HideoutHelper
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pointsConsumed = (waterFilterArea.slots[i].item[0].upd.Resource.UnitsConsumed || 0) +
|
pointsConsumed = (waterFilterArea.slots[i].item[0].upd.Resource.UnitsConsumed || 0)
|
||||||
filterDrainRate;
|
+ filterDrainRate;
|
||||||
resourceValue -= filterDrainRate;
|
resourceValue -= filterDrainRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,10 +606,9 @@ export class HideoutHelper
|
|||||||
baseFilterDrainRate: number,
|
baseFilterDrainRate: number,
|
||||||
): number
|
): number
|
||||||
{
|
{
|
||||||
const drainRateMultiplier = secondsSinceServerTick > totalProductionTime ?
|
const drainRateMultiplier = secondsSinceServerTick > totalProductionTime
|
||||||
(totalProductionTime - productionProgress) // more time passed than prod time, get total minus the current progress
|
? (totalProductionTime - productionProgress) // more time passed than prod time, get total minus the current progress
|
||||||
:
|
: secondsSinceServerTick;
|
||||||
secondsSinceServerTick;
|
|
||||||
|
|
||||||
// Multiply drain rate by calculated multiplier
|
// Multiply drain rate by calculated multiplier
|
||||||
baseFilterDrainRate *= drainRateMultiplier;
|
baseFilterDrainRate *= drainRateMultiplier;
|
||||||
@ -668,8 +667,8 @@ export class HideoutHelper
|
|||||||
Lasts for 17 hours 38 minutes and 49 seconds (23 hours 31 minutes and 45 seconds with elite hideout management skill),
|
Lasts for 17 hours 38 minutes and 49 seconds (23 hours 31 minutes and 45 seconds with elite hideout management skill),
|
||||||
300/17.64694/60/60 = 0.004722
|
300/17.64694/60/60 = 0.004722
|
||||||
*/
|
*/
|
||||||
let filterDrainRate = this.databaseServer.getTables().hideout.settings.airFilterUnitFlowRate *
|
let filterDrainRate = this.databaseServer.getTables().hideout.settings.airFilterUnitFlowRate
|
||||||
this.hideoutConfig.runIntervalSeconds;
|
* this.hideoutConfig.runIntervalSeconds;
|
||||||
// Hideout management resource consumption bonus:
|
// Hideout management resource consumption bonus:
|
||||||
const hideoutManagementConsumptionBonus = 1.0 - this.getHideoutManagementConsumptionBonus(pmcData);
|
const hideoutManagementConsumptionBonus = 1.0 - this.getHideoutManagementConsumptionBonus(pmcData);
|
||||||
filterDrainRate *= hideoutManagementConsumptionBonus;
|
filterDrainRate *= hideoutManagementConsumptionBonus;
|
||||||
@ -679,9 +678,9 @@ export class HideoutHelper
|
|||||||
{
|
{
|
||||||
if (airFilterArea.slots[i].item)
|
if (airFilterArea.slots[i].item)
|
||||||
{
|
{
|
||||||
let resourceValue = (airFilterArea.slots[i].item[0].upd?.Resource) ?
|
let resourceValue = (airFilterArea.slots[i].item[0].upd?.Resource)
|
||||||
airFilterArea.slots[i].item[0].upd.Resource.Value :
|
? airFilterArea.slots[i].item[0].upd.Resource.Value
|
||||||
null;
|
: null;
|
||||||
if (!resourceValue)
|
if (!resourceValue)
|
||||||
{
|
{
|
||||||
resourceValue = 300 - filterDrainRate;
|
resourceValue = 300 - filterDrainRate;
|
||||||
@ -781,8 +780,8 @@ export class HideoutHelper
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// BSG finally fixed their settings, they now get loaded from the settings and used in the client
|
// BSG finally fixed their settings, they now get loaded from the settings and used in the client
|
||||||
const coinCraftTimeSeconds = bitcoinProdData.productionTime /
|
const coinCraftTimeSeconds = bitcoinProdData.productionTime
|
||||||
(1 + (btcFarmCGs - 1) * this.databaseServer.getTables().hideout.settings.gpuBoostRate);
|
/ (1 + (btcFarmCGs - 1) * this.databaseServer.getTables().hideout.settings.gpuBoostRate);
|
||||||
while (btcProd.Progress > coinCraftTimeSeconds)
|
while (btcProd.Progress > coinCraftTimeSeconds)
|
||||||
{
|
{
|
||||||
if (btcProd.Products.length < coinSlotCount)
|
if (btcProd.Products.length < coinSlotCount)
|
||||||
@ -897,12 +896,12 @@ export class HideoutHelper
|
|||||||
// at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki
|
// at level 1 you already get 0.5%, so it goes up until level 50. For some reason the wiki
|
||||||
// says that it caps at level 51 with 25% but as per dump data that is incorrect apparently
|
// says that it caps at level 51 with 25% but as per dump data that is incorrect apparently
|
||||||
let roundedLevel = Math.floor(hideoutManagementSkill.Progress / 100);
|
let roundedLevel = Math.floor(hideoutManagementSkill.Progress / 100);
|
||||||
roundedLevel = (roundedLevel === 51) ?
|
roundedLevel = (roundedLevel === 51)
|
||||||
roundedLevel - 1 :
|
? roundedLevel - 1
|
||||||
roundedLevel;
|
: roundedLevel;
|
||||||
|
|
||||||
return (roundedLevel *
|
return (roundedLevel
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement
|
* this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement
|
||||||
.ConsumptionReductionPerLevel) / 100;
|
.ConsumptionReductionPerLevel) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1024,9 +1023,9 @@ export class HideoutHelper
|
|||||||
*/
|
*/
|
||||||
protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean
|
protected hideoutImprovementIsComplete(improvement: IHideoutImprovement): boolean
|
||||||
{
|
{
|
||||||
return improvement?.completed ?
|
return improvement?.completed
|
||||||
true :
|
? true
|
||||||
false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1039,8 +1038,8 @@ export class HideoutHelper
|
|||||||
{
|
{
|
||||||
const improvementDetails = pmcProfile.Hideout.Improvement[improvementId];
|
const improvementDetails = pmcProfile.Hideout.Improvement[improvementId];
|
||||||
if (
|
if (
|
||||||
improvementDetails.completed === false &&
|
improvementDetails.completed === false
|
||||||
improvementDetails.improveCompleteTimestamp < this.timeUtil.getTimestamp()
|
&& improvementDetails.improveCompleteTimestamp < this.timeUtil.getTimestamp()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
improvementDetails.completed = true;
|
improvementDetails.completed = true;
|
||||||
|
@ -379,10 +379,10 @@ export class InRaidHelper
|
|||||||
const itemsToRemovePropertyFrom = postRaidProfile.Inventory.items.filter((x) =>
|
const itemsToRemovePropertyFrom = postRaidProfile.Inventory.items.filter((x) =>
|
||||||
{
|
{
|
||||||
// Has upd object + upd.SpawnedInSession property + not a quest item
|
// Has upd object + upd.SpawnedInSession property + not a quest item
|
||||||
return "upd" in x && "SpawnedInSession" in x.upd &&
|
return "upd" in x && "SpawnedInSession" in x.upd
|
||||||
!dbItems[x._tpl]._props.QuestItem &&
|
&& !dbItems[x._tpl]._props.QuestItem
|
||||||
!(this.inRaidConfig.keepFiRSecureContainerOnDeath &&
|
&& !(this.inRaidConfig.keepFiRSecureContainerOnDeath
|
||||||
this.itemHelper.itemIsInsideContainer(x, "SecuredContainer", postRaidProfile.Inventory.items));
|
&& this.itemHelper.itemIsInsideContainer(x, "SecuredContainer", postRaidProfile.Inventory.items));
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const item of itemsToRemovePropertyFrom)
|
for (const item of itemsToRemovePropertyFrom)
|
||||||
|
@ -175,9 +175,9 @@ export class InventoryHelper
|
|||||||
catch (err)
|
catch (err)
|
||||||
{
|
{
|
||||||
// Callback failed
|
// Callback failed
|
||||||
const message = typeof err === "string" ?
|
const message = typeof err === "string"
|
||||||
err :
|
? err
|
||||||
this.localisationService.getText("http-unknown_error");
|
: this.localisationService.getText("http-unknown_error");
|
||||||
|
|
||||||
return this.httpResponse.appendErrorToOutput(output, message);
|
return this.httpResponse.appendErrorToOutput(output, message);
|
||||||
}
|
}
|
||||||
@ -405,9 +405,9 @@ export class InventoryHelper
|
|||||||
}
|
}
|
||||||
catch (err)
|
catch (err)
|
||||||
{
|
{
|
||||||
const errorText = typeof err === "string" ?
|
const errorText = typeof err === "string"
|
||||||
` -> ${err}` :
|
? ` -> ${err}`
|
||||||
"";
|
: "";
|
||||||
this.logger.error(this.localisationService.getText("inventory-fill_container_failed", errorText));
|
this.logger.error(this.localisationService.getText("inventory-fill_container_failed", errorText));
|
||||||
|
|
||||||
return this.httpResponse.appendErrorToOutput(
|
return this.httpResponse.appendErrorToOutput(
|
||||||
@ -563,13 +563,13 @@ export class InventoryHelper
|
|||||||
if (requestItem.count > itemDetails._props.StackMaxSize)
|
if (requestItem.count > itemDetails._props.StackMaxSize)
|
||||||
{
|
{
|
||||||
let remainingCountOfItemToAdd = requestItem.count;
|
let remainingCountOfItemToAdd = requestItem.count;
|
||||||
const calc = requestItem.count -
|
const calc = requestItem.count
|
||||||
(Math.floor(requestItem.count / itemDetails._props.StackMaxSize) *
|
- (Math.floor(requestItem.count / itemDetails._props.StackMaxSize)
|
||||||
itemDetails._props.StackMaxSize);
|
* itemDetails._props.StackMaxSize);
|
||||||
|
|
||||||
maxStackCount = (calc > 0) ?
|
maxStackCount = (calc > 0)
|
||||||
maxStackCount + Math.floor(remainingCountOfItemToAdd / itemDetails._props.StackMaxSize) :
|
? maxStackCount + Math.floor(remainingCountOfItemToAdd / itemDetails._props.StackMaxSize)
|
||||||
Math.floor(remainingCountOfItemToAdd / itemDetails._props.StackMaxSize);
|
: Math.floor(remainingCountOfItemToAdd / itemDetails._props.StackMaxSize);
|
||||||
|
|
||||||
// Iterate until totalCountOfPurchasedItem is 0
|
// Iterate until totalCountOfPurchasedItem is 0
|
||||||
for (let i = 0; i < maxStackCount; i++)
|
for (let i = 0; i < maxStackCount; i++)
|
||||||
@ -942,14 +942,14 @@ export class InventoryHelper
|
|||||||
const tmpSize = this.getSizeByInventoryItemHash(item._tpl, item._id, inventoryItemHash);
|
const tmpSize = this.getSizeByInventoryItemHash(item._tpl, item._id, inventoryItemHash);
|
||||||
const iW = tmpSize[0]; // x
|
const iW = tmpSize[0]; // x
|
||||||
const iH = tmpSize[1]; // y
|
const iH = tmpSize[1]; // y
|
||||||
const fH = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical" ||
|
const fH = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|
||||||
(item.location as Location).rotation === "Vertical") ?
|
|| (item.location as Location).rotation === "Vertical")
|
||||||
iW :
|
? iW
|
||||||
iH;
|
: iH;
|
||||||
const fW = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical" ||
|
const fW = ((item.location as Location).r === 1 || (item.location as Location).r === "Vertical"
|
||||||
(item.location as Location).rotation === "Vertical") ?
|
|| (item.location as Location).rotation === "Vertical")
|
||||||
iH :
|
? iH
|
||||||
iW;
|
: iW;
|
||||||
const fillTo = (item.location as Location).x + fW;
|
const fillTo = (item.location as Location).x + fW;
|
||||||
|
|
||||||
for (let y = 0; y < fH; y++)
|
for (let y = 0; y < fH; y++)
|
||||||
@ -1002,9 +1002,9 @@ export class InventoryHelper
|
|||||||
else if (request.fromOwner.type.toLocaleLowerCase() === "mail")
|
else if (request.fromOwner.type.toLocaleLowerCase() === "mail")
|
||||||
{
|
{
|
||||||
// Split requests dont use 'use' but 'splitItem' property
|
// Split requests dont use 'use' but 'splitItem' property
|
||||||
const item = "splitItem" in request ?
|
const item = "splitItem" in request
|
||||||
request.splitItem :
|
? request.splitItem
|
||||||
request.item;
|
: request.item;
|
||||||
fromInventoryItems = this.dialogueHelper.getMessageItemContents(request.fromOwner.id, sessionId, item);
|
fromInventoryItems = this.dialogueHelper.getMessageItemContents(request.fromOwner.id, sessionId, item);
|
||||||
fromType = "mail";
|
fromType = "mail";
|
||||||
}
|
}
|
||||||
@ -1077,12 +1077,12 @@ export class InventoryHelper
|
|||||||
this.logger.error(this.localisationService.getText("inventory-stash_not_found", stashTPL));
|
this.logger.error(this.localisationService.getText("inventory-stash_not_found", stashTPL));
|
||||||
}
|
}
|
||||||
|
|
||||||
const stashX = stashItemDetails[1]._props.Grids[0]._props.cellsH !== 0 ?
|
const stashX = stashItemDetails[1]._props.Grids[0]._props.cellsH !== 0
|
||||||
stashItemDetails[1]._props.Grids[0]._props.cellsH :
|
? stashItemDetails[1]._props.Grids[0]._props.cellsH
|
||||||
10;
|
: 10;
|
||||||
const stashY = stashItemDetails[1]._props.Grids[0]._props.cellsV !== 0 ?
|
const stashY = stashItemDetails[1]._props.Grids[0]._props.cellsV !== 0
|
||||||
stashItemDetails[1]._props.Grids[0]._props.cellsV :
|
? stashItemDetails[1]._props.Grids[0]._props.cellsV
|
||||||
66;
|
: 66;
|
||||||
return [stashX, stashY];
|
return [stashX, stashY];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +68,11 @@ class ItemHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is item valid
|
// Is item valid
|
||||||
return !itemDetails[1]._props.QuestItem &&
|
return !itemDetails[1]._props.QuestItem
|
||||||
itemDetails[1]._type === "Item" &&
|
&& itemDetails[1]._type === "Item"
|
||||||
invalidBaseTypes.every((x) => !this.isOfBaseclass(tpl, x)) &&
|
&& invalidBaseTypes.every((x) => !this.isOfBaseclass(tpl, x))
|
||||||
this.getItemPrice(tpl) > 0 &&
|
&& this.getItemPrice(tpl) > 0
|
||||||
!this.itemFilterService.isItemBlacklisted(tpl);
|
&& !this.itemFilterService.isItemBlacklisted(tpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -378,9 +378,9 @@ class ItemHelper
|
|||||||
|
|
||||||
// Weapon
|
// Weapon
|
||||||
// Get max dura from props, if it isnt there use repairable max dura value
|
// Get max dura from props, if it isnt there use repairable max dura value
|
||||||
const maxDurability = (itemDetails._props.MaxDurability) ?
|
const maxDurability = (itemDetails._props.MaxDurability)
|
||||||
itemDetails._props.MaxDurability :
|
? itemDetails._props.MaxDurability
|
||||||
repairable.MaxDurability;
|
: repairable.MaxDurability;
|
||||||
const durability = repairable.Durability / maxDurability;
|
const durability = repairable.Durability / maxDurability;
|
||||||
|
|
||||||
if (!durability)
|
if (!durability)
|
||||||
@ -474,8 +474,8 @@ class ItemHelper
|
|||||||
public hasBuyRestrictions(itemToCheck: Item): boolean
|
public hasBuyRestrictions(itemToCheck: Item): boolean
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
itemToCheck.upd?.BuyRestrictionCurrent !== undefined &&
|
itemToCheck.upd?.BuyRestrictionCurrent !== undefined
|
||||||
itemToCheck.upd?.BuyRestrictionMax !== undefined
|
&& itemToCheck.upd?.BuyRestrictionMax !== undefined
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -574,18 +574,18 @@ class ItemHelper
|
|||||||
public findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]
|
public findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]
|
||||||
{
|
{
|
||||||
// find required items to take after buying (handles multiple items)
|
// find required items to take after buying (handles multiple items)
|
||||||
const barterIDs = typeof barterItemId === "string" ?
|
const barterIDs = typeof barterItemId === "string"
|
||||||
[barterItemId] :
|
? [barterItemId]
|
||||||
barterItemId;
|
: barterItemId;
|
||||||
|
|
||||||
let barterItems: Item[] = [];
|
let barterItems: Item[] = [];
|
||||||
for (const barterID of barterIDs)
|
for (const barterID of barterIDs)
|
||||||
{
|
{
|
||||||
const filterResult = items.filter((item) =>
|
const filterResult = items.filter((item) =>
|
||||||
{
|
{
|
||||||
return by === "tpl" ?
|
return by === "tpl"
|
||||||
(item._tpl === barterID) :
|
? (item._tpl === barterID)
|
||||||
(item._id === barterID);
|
: (item._id === barterID);
|
||||||
});
|
});
|
||||||
|
|
||||||
barterItems = Object.assign(barterItems, filterResult);
|
barterItems = Object.assign(barterItems, filterResult);
|
||||||
@ -625,11 +625,11 @@ class ItemHelper
|
|||||||
|
|
||||||
// Do not replace important ID's
|
// Do not replace important ID's
|
||||||
if (
|
if (
|
||||||
item._id === pmcData.Inventory.equipment ||
|
item._id === pmcData.Inventory.equipment
|
||||||
item._id === pmcData.Inventory.questRaidItems ||
|
|| item._id === pmcData.Inventory.questRaidItems
|
||||||
item._id === pmcData.Inventory.questStashItems ||
|
|| item._id === pmcData.Inventory.questStashItems
|
||||||
item._id === pmcData.Inventory.sortingTable ||
|
|| item._id === pmcData.Inventory.sortingTable
|
||||||
item._id === pmcData.Inventory.stash
|
|| item._id === pmcData.Inventory.stash
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -904,9 +904,9 @@ class ItemHelper
|
|||||||
sizeUp = sizeUp < itemTemplate._props.ExtraSizeUp ? itemTemplate._props.ExtraSizeUp : sizeUp;
|
sizeUp = sizeUp < itemTemplate._props.ExtraSizeUp ? itemTemplate._props.ExtraSizeUp : sizeUp;
|
||||||
sizeDown = sizeDown < itemTemplate._props.ExtraSizeDown ? itemTemplate._props.ExtraSizeDown : sizeDown;
|
sizeDown = sizeDown < itemTemplate._props.ExtraSizeDown ? itemTemplate._props.ExtraSizeDown : sizeDown;
|
||||||
sizeLeft = sizeLeft < itemTemplate._props.ExtraSizeLeft ? itemTemplate._props.ExtraSizeLeft : sizeLeft;
|
sizeLeft = sizeLeft < itemTemplate._props.ExtraSizeLeft ? itemTemplate._props.ExtraSizeLeft : sizeLeft;
|
||||||
sizeRight = sizeRight < itemTemplate._props.ExtraSizeRight ?
|
sizeRight = sizeRight < itemTemplate._props.ExtraSizeRight
|
||||||
itemTemplate._props.ExtraSizeRight :
|
? itemTemplate._props.ExtraSizeRight
|
||||||
sizeRight;
|
: sizeRight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,9 +954,9 @@ class ItemHelper
|
|||||||
while (currentStoredCartridgeCount < ammoBoxMaxCartridgeCount)
|
while (currentStoredCartridgeCount < ammoBoxMaxCartridgeCount)
|
||||||
{
|
{
|
||||||
const remainingSpace = ammoBoxMaxCartridgeCount - currentStoredCartridgeCount;
|
const remainingSpace = ammoBoxMaxCartridgeCount - currentStoredCartridgeCount;
|
||||||
const cartridgeCountToAdd = (remainingSpace < maxPerStack) ?
|
const cartridgeCountToAdd = (remainingSpace < maxPerStack)
|
||||||
remainingSpace :
|
? remainingSpace
|
||||||
maxPerStack;
|
: maxPerStack;
|
||||||
|
|
||||||
// Add cartridge item into items array
|
// Add cartridge item into items array
|
||||||
ammoBox.push(this.createCartridges(ammoBox[0]._id, cartridgeTpl, cartridgeCountToAdd, location));
|
ammoBox.push(this.createCartridges(ammoBox[0]._id, cartridgeTpl, cartridgeCountToAdd, location));
|
||||||
@ -1057,9 +1057,9 @@ class ItemHelper
|
|||||||
while (currentStoredCartridgeCount < desiredStackCount)
|
while (currentStoredCartridgeCount < desiredStackCount)
|
||||||
{
|
{
|
||||||
// Get stack size of cartridges
|
// Get stack size of cartridges
|
||||||
let cartridgeCountToAdd = (desiredStackCount <= cartridgeMaxStackSize) ?
|
let cartridgeCountToAdd = (desiredStackCount <= cartridgeMaxStackSize)
|
||||||
desiredStackCount :
|
? desiredStackCount
|
||||||
cartridgeMaxStackSize;
|
: cartridgeMaxStackSize;
|
||||||
|
|
||||||
// Ensure we don't go over the max stackcount size
|
// Ensure we don't go over the max stackcount size
|
||||||
const remainingSpace = desiredStackCount - currentStoredCartridgeCount;
|
const remainingSpace = desiredStackCount - currentStoredCartridgeCount;
|
||||||
|
@ -85,9 +85,9 @@ export class NotificationSendHelper
|
|||||||
protected getDialog(sessionId: string, messageType: MessageType, senderDetails: IUserDialogInfo): Dialogue
|
protected getDialog(sessionId: string, messageType: MessageType, senderDetails: IUserDialogInfo): Dialogue
|
||||||
{
|
{
|
||||||
// Use trader id if sender is trader, otherwise use nickname
|
// Use trader id if sender is trader, otherwise use nickname
|
||||||
const key = (senderDetails.info.MemberCategory === MemberCategory.TRADER) ?
|
const key = (senderDetails.info.MemberCategory === MemberCategory.TRADER)
|
||||||
senderDetails._id :
|
? senderDetails._id
|
||||||
senderDetails.info.Nickname;
|
: senderDetails.info.Nickname;
|
||||||
const dialogueData = this.saveServer.getProfile(sessionId).dialogues;
|
const dialogueData = this.saveServer.getProfile(sessionId).dialogues;
|
||||||
const isNewDialogue = !(key in dialogueData);
|
const isNewDialogue = !(key in dialogueData);
|
||||||
let dialogue: Dialogue = dialogueData[key];
|
let dialogue: Dialogue = dialogueData[key];
|
||||||
|
@ -139,8 +139,8 @@ export class ProfileHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!this.sessionIdMatchesProfileId(profile.info.id, sessionID) &&
|
!this.sessionIdMatchesProfileId(profile.info.id, sessionID)
|
||||||
this.nicknameMatches(profile.characters.pmc.Info.LowerNickname, nicknameRequest.nickname)
|
&& this.nicknameMatches(profile.characters.pmc.Info.LowerNickname, nicknameRequest.nickname)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -69,9 +69,9 @@ export class QuestHelper
|
|||||||
{
|
{
|
||||||
const quest = pmcData.Quests?.find((q) => q.qid === questId);
|
const quest = pmcData.Quests?.find((q) => q.qid === questId);
|
||||||
|
|
||||||
return quest ?
|
return quest
|
||||||
quest.status :
|
? quest.status
|
||||||
QuestStatus.Locked;
|
: QuestStatus.Locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -279,9 +279,9 @@ export class QuestHelper
|
|||||||
if (item._id === reward.target)
|
if (item._id === reward.target)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(item.parentId !== undefined) && (item.parentId === "hideout") &&
|
(item.parentId !== undefined) && (item.parentId === "hideout")
|
||||||
(item.upd !== undefined) && (item.upd.StackObjectsCount !== undefined) &&
|
&& (item.upd !== undefined) && (item.upd.StackObjectsCount !== undefined)
|
||||||
(item.upd.StackObjectsCount > 1)
|
&& (item.upd.StackObjectsCount > 1)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
item.upd.StackObjectsCount = 1;
|
item.upd.StackObjectsCount = 1;
|
||||||
@ -330,9 +330,9 @@ export class QuestHelper
|
|||||||
// Iterate over all rewards with the desired status, flatten out items that have a type of Item
|
// Iterate over all rewards with the desired status, flatten out items that have a type of Item
|
||||||
const questRewards = quest.rewards[QuestStatus[status]]
|
const questRewards = quest.rewards[QuestStatus[status]]
|
||||||
.flatMap((reward: Reward) =>
|
.flatMap((reward: Reward) =>
|
||||||
reward.type === "Item" ?
|
reward.type === "Item"
|
||||||
this.processReward(reward) :
|
? this.processReward(reward)
|
||||||
[]
|
: []
|
||||||
);
|
);
|
||||||
|
|
||||||
return questRewards;
|
return questRewards;
|
||||||
@ -413,9 +413,9 @@ export class QuestHelper
|
|||||||
// e.g. Quest A passed in, quest B is looped over and has requirement of A to be started, include it
|
// e.g. Quest A passed in, quest B is looped over and has requirement of A to be started, include it
|
||||||
const acceptedQuestCondition = quest.conditions.AvailableForStart.find((x) =>
|
const acceptedQuestCondition = quest.conditions.AvailableForStart.find((x) =>
|
||||||
{
|
{
|
||||||
return x._parent === "Quest" &&
|
return x._parent === "Quest"
|
||||||
x._props.target === startedQuestId &&
|
&& x._props.target === startedQuestId
|
||||||
x._props.status[0] === QuestStatus.Started;
|
&& x._props.status[0] === QuestStatus.Started;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Not found, skip quest
|
// Not found, skip quest
|
||||||
@ -447,8 +447,8 @@ export class QuestHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Include if quest found in profile and is started or ready to hand in
|
// Include if quest found in profile and is started or ready to hand in
|
||||||
return startedQuestInProfile &&
|
return startedQuestInProfile
|
||||||
([QuestStatus.Started, QuestStatus.AvailableForFinish].includes(startedQuestInProfile.status));
|
&& ([QuestStatus.Started, QuestStatus.AvailableForFinish].includes(startedQuestInProfile.status));
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.getQuestsWithOnlyLevelRequirementStartCondition(eligibleQuests);
|
return this.getQuestsWithOnlyLevelRequirementStartCondition(eligibleQuests);
|
||||||
@ -470,9 +470,9 @@ export class QuestHelper
|
|||||||
const acceptedQuestCondition = q.conditions.AvailableForStart.find(
|
const acceptedQuestCondition = q.conditions.AvailableForStart.find(
|
||||||
(c) =>
|
(c) =>
|
||||||
{
|
{
|
||||||
return c._parent === "Quest" &&
|
return c._parent === "Quest"
|
||||||
c._props.target === failedQuestId &&
|
&& c._props.target === failedQuestId
|
||||||
c._props.status[0] === QuestStatus.Fail;
|
&& c._props.status[0] === QuestStatus.Fail;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -704,8 +704,8 @@ export class QuestHelper
|
|||||||
// blank or is a guid, use description instead
|
// blank or is a guid, use description instead
|
||||||
const startedMessageText = this.getQuestLocaleIdFromDb(startedMessageTextId);
|
const startedMessageText = this.getQuestLocaleIdFromDb(startedMessageTextId);
|
||||||
if (
|
if (
|
||||||
!startedMessageText || startedMessageText.trim() === "" || startedMessageText.toLowerCase() === "test" ||
|
!startedMessageText || startedMessageText.trim() === "" || startedMessageText.toLowerCase() === "test"
|
||||||
startedMessageText.length === 24
|
|| startedMessageText.length === 24
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return questDescriptionId;
|
return questDescriptionId;
|
||||||
@ -850,9 +850,9 @@ export class QuestHelper
|
|||||||
// Get hideout crafts and find those that match by areatype/required level/end product tpl - hope for just one match
|
// Get hideout crafts and find those that match by areatype/required level/end product tpl - hope for just one match
|
||||||
const hideoutProductions = this.databaseServer.getTables().hideout.production;
|
const hideoutProductions = this.databaseServer.getTables().hideout.production;
|
||||||
const matchingProductions = hideoutProductions.filter((x) =>
|
const matchingProductions = hideoutProductions.filter((x) =>
|
||||||
x.areaType === Number.parseInt(craftUnlockReward.traderId) &&
|
x.areaType === Number.parseInt(craftUnlockReward.traderId)
|
||||||
x.requirements.some((x) => x.requiredLevel === craftUnlockReward.loyaltyLevel) &&
|
&& x.requirements.some((x) => x.requiredLevel === craftUnlockReward.loyaltyLevel)
|
||||||
x.endProduct === craftUnlockReward.items[0]._tpl
|
&& x.endProduct === craftUnlockReward.items[0]._tpl
|
||||||
);
|
);
|
||||||
|
|
||||||
// More/less than 1 match, above filtering wasn't strict enough
|
// More/less than 1 match, above filtering wasn't strict enough
|
||||||
|
@ -73,9 +73,9 @@ export class RagfairHelper
|
|||||||
if (info.linkedSearchId)
|
if (info.linkedSearchId)
|
||||||
{
|
{
|
||||||
const data = this.ragfairLinkedItemService.getLinkedItems(info.linkedSearchId);
|
const data = this.ragfairLinkedItemService.getLinkedItems(info.linkedSearchId);
|
||||||
result = !data ?
|
result = !data
|
||||||
[] :
|
? []
|
||||||
[...data];
|
: [...data];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case: category
|
// Case: category
|
||||||
|
@ -534,8 +534,8 @@ export class RagfairOfferHelper
|
|||||||
const isDefaultUserOffer = offer.user.memberType === MemberCategory.DEFAULT;
|
const isDefaultUserOffer = offer.user.memberType === MemberCategory.DEFAULT;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pmcProfile.Info.Level < this.databaseServer.getTables().globals.config.RagFair.minUserLevel &&
|
pmcProfile.Info.Level < this.databaseServer.getTables().globals.config.RagFair.minUserLevel
|
||||||
isDefaultUserOffer
|
&& isDefaultUserOffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Skip item if player is < global unlock level (default is 15) and item is from a dynamically generated source
|
// Skip item if player is < global unlock level (default is 15) and item is from a dynamically generated source
|
||||||
@ -597,8 +597,8 @@ export class RagfairOfferHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(item.upd.MedKit || item.upd.Repairable) &&
|
(item.upd.MedKit || item.upd.Repairable)
|
||||||
!this.itemQualityInRange(item, searchRequest.conditionFrom, searchRequest.conditionTo)
|
&& !this.itemQualityInRange(item, searchRequest.conditionFrom, searchRequest.conditionTo)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -40,10 +40,12 @@ export class RagfairSellHelper
|
|||||||
|
|
||||||
const listedPriceAboveAverage = playerListedPriceRub > averageOfferPriceRub;
|
const listedPriceAboveAverage = playerListedPriceRub > averageOfferPriceRub;
|
||||||
// Get sell chance multiplier
|
// Get sell chance multiplier
|
||||||
const multiplier = listedPriceAboveAverage ?
|
const multiplier = listedPriceAboveAverage
|
||||||
this.ragfairConfig.sell.chance.overpriced // Player price is over average listing price
|
? this.ragfairConfig.sell.chance.overpriced // Player price is over average listing price
|
||||||
:
|
: this.getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(
|
||||||
this.getSellMultiplierWhenPlayerPriceIsBelowAverageListingPrice(averageOfferPriceRub, playerListedPriceRub);
|
averageOfferPriceRub,
|
||||||
|
playerListedPriceRub,
|
||||||
|
);
|
||||||
|
|
||||||
return Math.round(baseSellChancePercent * (averageOfferPriceRub / playerListedPriceRub * multiplier));
|
return Math.round(baseSellChancePercent * (averageOfferPriceRub / playerListedPriceRub * multiplier));
|
||||||
}
|
}
|
||||||
@ -59,9 +61,9 @@ export class RagfairSellHelper
|
|||||||
playerListedPriceRub: number,
|
playerListedPriceRub: number,
|
||||||
): number
|
): number
|
||||||
{
|
{
|
||||||
return (playerListedPriceRub < averageOfferPriceRub) ?
|
return (playerListedPriceRub < averageOfferPriceRub)
|
||||||
this.ragfairConfig.sell.chance.underpriced :
|
? this.ragfairConfig.sell.chance.underpriced
|
||||||
1;
|
: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,8 +96,8 @@ export class RagfairServerHelper
|
|||||||
|
|
||||||
// Don't include damaged ammo packs
|
// Don't include damaged ammo packs
|
||||||
if (
|
if (
|
||||||
this.ragfairConfig.dynamic.blacklist.damagedAmmoPacks && itemDetails[1]._parent === BaseClasses.AMMO_BOX &&
|
this.ragfairConfig.dynamic.blacklist.damagedAmmoPacks && itemDetails[1]._parent === BaseClasses.AMMO_BOX
|
||||||
itemDetails[1]._name.includes("_damaged")
|
&& itemDetails[1]._name.includes("_damaged")
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -175,8 +175,8 @@ export class RagfairServerHelper
|
|||||||
|
|
||||||
// Item Types to return one of
|
// Item Types to return one of
|
||||||
if (
|
if (
|
||||||
isWeaponPreset ||
|
isWeaponPreset
|
||||||
this.itemHelper.isOfBaseclasses(itemDetails[1]._id, this.ragfairConfig.dynamic.showAsSingleStack)
|
|| this.itemHelper.isOfBaseclasses(itemDetails[1]._id, this.ragfairConfig.dynamic.showAsSingleStack)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -75,11 +75,11 @@ export class RagfairSortHelper
|
|||||||
const nameA = locale[`${tplA} Name`] || tplA;
|
const nameA = locale[`${tplA} Name`] || tplA;
|
||||||
const nameB = locale[`${tplB} Name`] || tplB;
|
const nameB = locale[`${tplB} Name`] || tplB;
|
||||||
|
|
||||||
return (nameA < nameB) ?
|
return (nameA < nameB)
|
||||||
-1 :
|
? -1
|
||||||
(nameA > nameB) ?
|
: (nameA > nameB)
|
||||||
1 :
|
? 1
|
||||||
0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,14 +77,14 @@ export class RepairHelper
|
|||||||
// the code below generates a random degradation on the weapon durability
|
// the code below generates a random degradation on the weapon durability
|
||||||
if (applyMaxDurabilityDegradation)
|
if (applyMaxDurabilityDegradation)
|
||||||
{
|
{
|
||||||
const randomisedWearAmount = isArmor ?
|
const randomisedWearAmount = isArmor
|
||||||
this.getRandomisedArmorRepairDegradationValue(
|
? this.getRandomisedArmorRepairDegradationValue(
|
||||||
itemToRepairDetails._props.ArmorMaterial,
|
itemToRepairDetails._props.ArmorMaterial,
|
||||||
useRepairKit,
|
useRepairKit,
|
||||||
itemCurrentMaxDurability,
|
itemCurrentMaxDurability,
|
||||||
traderQualityMultipler,
|
traderQualityMultipler,
|
||||||
) :
|
)
|
||||||
this.getRandomisedWeaponRepairDegradationValue(
|
: this.getRandomisedWeaponRepairDegradationValue(
|
||||||
itemToRepairDetails._props,
|
itemToRepairDetails._props,
|
||||||
useRepairKit,
|
useRepairKit,
|
||||||
itemCurrentMaxDurability,
|
itemCurrentMaxDurability,
|
||||||
@ -117,13 +117,13 @@ export class RepairHelper
|
|||||||
{
|
{
|
||||||
const armorMaterialSettings = this.databaseServer.getTables().globals.config.ArmorMaterials[armorMaterial];
|
const armorMaterialSettings = this.databaseServer.getTables().globals.config.ArmorMaterials[armorMaterial];
|
||||||
|
|
||||||
const minMultiplier = isRepairKit ?
|
const minMultiplier = isRepairKit
|
||||||
armorMaterialSettings.MinRepairKitDegradation :
|
? armorMaterialSettings.MinRepairKitDegradation
|
||||||
armorMaterialSettings.MinRepairDegradation;
|
: armorMaterialSettings.MinRepairDegradation;
|
||||||
|
|
||||||
const maxMultiplier = isRepairKit ?
|
const maxMultiplier = isRepairKit
|
||||||
armorMaterialSettings.MaxRepairKitDegradation :
|
? armorMaterialSettings.MaxRepairKitDegradation
|
||||||
armorMaterialSettings.MaxRepairDegradation;
|
: armorMaterialSettings.MaxRepairDegradation;
|
||||||
|
|
||||||
const duraLossPercent = this.randomUtil.getFloat(minMultiplier, maxMultiplier);
|
const duraLossPercent = this.randomUtil.getFloat(minMultiplier, maxMultiplier);
|
||||||
const duraLossMultipliedByTraderMultiplier = (duraLossPercent * armorMax) * traderQualityMultipler;
|
const duraLossMultipliedByTraderMultiplier = (duraLossPercent * armorMax) * traderQualityMultipler;
|
||||||
@ -138,12 +138,12 @@ export class RepairHelper
|
|||||||
traderQualityMultipler: number,
|
traderQualityMultipler: number,
|
||||||
): number
|
): number
|
||||||
{
|
{
|
||||||
const minRepairDeg = isRepairKit ?
|
const minRepairDeg = isRepairKit
|
||||||
itemProps.MinRepairKitDegradation :
|
? itemProps.MinRepairKitDegradation
|
||||||
itemProps.MinRepairDegradation;
|
: itemProps.MinRepairDegradation;
|
||||||
let maxRepairDeg = isRepairKit ?
|
let maxRepairDeg = isRepairKit
|
||||||
itemProps.MaxRepairKitDegradation :
|
? itemProps.MaxRepairKitDegradation
|
||||||
itemProps.MaxRepairDegradation;
|
: itemProps.MaxRepairDegradation;
|
||||||
|
|
||||||
// WORKAROUND: Some items are always 0 when repairkit is true
|
// WORKAROUND: Some items are always 0 when repairkit is true
|
||||||
if (maxRepairDeg === 0)
|
if (maxRepairDeg === 0)
|
||||||
|
@ -87,9 +87,9 @@ export class TraderHelper
|
|||||||
*/
|
*/
|
||||||
public getTraderAssortsByTraderId(traderId: string): ITraderAssort
|
public getTraderAssortsByTraderId(traderId: string): ITraderAssort
|
||||||
{
|
{
|
||||||
return traderId === Traders.FENCE ?
|
return traderId === Traders.FENCE
|
||||||
this.fenceService.getRawFenceAssorts() :
|
? this.fenceService.getRawFenceAssorts()
|
||||||
this.databaseServer.getTables().traders[traderId].assort;
|
: this.databaseServer.getTables().traders[traderId].assort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,9 +199,9 @@ export class TraderHelper
|
|||||||
{
|
{
|
||||||
const newStanding = currentStanding + standingToAdd;
|
const newStanding = currentStanding + standingToAdd;
|
||||||
|
|
||||||
return newStanding < 0 ?
|
return newStanding < 0
|
||||||
0 :
|
? 0
|
||||||
newStanding;
|
: newStanding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,10 +227,10 @@ export class TraderHelper
|
|||||||
const loyalty = loyaltyLevels[level];
|
const loyalty = loyaltyLevels[level];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(loyalty.minLevel <= pmcData.Info.Level &&
|
(loyalty.minLevel <= pmcData.Info.Level
|
||||||
loyalty.minSalesSum <= pmcData.TradersInfo[traderID].salesSum &&
|
&& loyalty.minSalesSum <= pmcData.TradersInfo[traderID].salesSum
|
||||||
loyalty.minStanding <= pmcData.TradersInfo[traderID].standing) &&
|
&& loyalty.minStanding <= pmcData.TradersInfo[traderID].standing)
|
||||||
targetLevel < 4
|
&& targetLevel < 4
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// level reached
|
// level reached
|
||||||
@ -386,9 +386,9 @@ export class TraderHelper
|
|||||||
const barterScheme = traderAssorts.barter_scheme[item._id][0][0];
|
const barterScheme = traderAssorts.barter_scheme[item._id][0][0];
|
||||||
|
|
||||||
// Convert into roubles
|
// Convert into roubles
|
||||||
const roubleAmount = barterScheme._tpl === Money.ROUBLES ?
|
const roubleAmount = barterScheme._tpl === Money.ROUBLES
|
||||||
barterScheme.count :
|
? barterScheme.count
|
||||||
this.handbookHelper.inRUB(barterScheme.count, barterScheme._tpl);
|
: this.handbookHelper.inRUB(barterScheme.count, barterScheme._tpl);
|
||||||
|
|
||||||
// Existing price smaller in dict than current iteration, overwrite
|
// Existing price smaller in dict than current iteration, overwrite
|
||||||
if (this.highestTraderPriceItems[item._tpl] ?? 0 < roubleAmount)
|
if (this.highestTraderPriceItems[item._tpl] ?? 0 < roubleAmount)
|
||||||
|
@ -70,11 +70,11 @@ export class ModTypeCheck
|
|||||||
*/
|
*/
|
||||||
public isPostV3Compatible(mod: any): boolean
|
public isPostV3Compatible(mod: any): boolean
|
||||||
{
|
{
|
||||||
return this.isPreAkiLoad(mod) ||
|
return this.isPreAkiLoad(mod)
|
||||||
this.isPostAkiLoad(mod) ||
|
|| this.isPostAkiLoad(mod)
|
||||||
this.isPostDBAkiLoad(mod) ||
|
|| this.isPostDBAkiLoad(mod)
|
||||||
this.isPreAkiLoadAsync(mod) ||
|
|| this.isPreAkiLoadAsync(mod)
|
||||||
this.isPostAkiLoadAsync(mod) ||
|
|| this.isPostAkiLoadAsync(mod)
|
||||||
this.isPostDBAkiLoadAsync(mod);
|
|| this.isPostDBAkiLoadAsync(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,8 +176,8 @@ export class PreAkiModLoader implements IModLoader
|
|||||||
|
|
||||||
// if the mod has library dependencies check if these dependencies are bundled in the server, if not install them
|
// if the mod has library dependencies check if these dependencies are bundled in the server, if not install them
|
||||||
if (
|
if (
|
||||||
modToValidate.dependencies && Object.keys(modToValidate.dependencies).length > 0 &&
|
modToValidate.dependencies && Object.keys(modToValidate.dependencies).length > 0
|
||||||
!this.vfs.exists(`${this.basepath}${modFolderName}/node_modules`)
|
&& !this.vfs.exists(`${this.basepath}${modFolderName}/node_modules`)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.autoInstallDependencies(`${this.basepath}${modFolderName}`, modToValidate);
|
this.autoInstallDependencies(`${this.basepath}${modFolderName}`, modToValidate);
|
||||||
|
4
project/src/models/external/HttpFramework.ts
vendored
4
project/src/models/external/HttpFramework.ts
vendored
@ -62,8 +62,8 @@ export const Listen = (basePath: string) =>
|
|||||||
{
|
{
|
||||||
const routesHandles = this.handlers[req.method];
|
const routesHandles = this.handlers[req.method];
|
||||||
|
|
||||||
return Object.keys(this.handlers).some((meth) => meth === req.method) &&
|
return Object.keys(this.handlers).some((meth) => meth === req.method)
|
||||||
Object.keys(routesHandles).some((route) => (new RegExp(route)).test(req.url));
|
&& Object.keys(routesHandles).some((route) => (new RegExp(route)).test(req.url));
|
||||||
};
|
};
|
||||||
|
|
||||||
// The actual handle method dispatches the request to the registered handlers
|
// The actual handle method dispatches the request to the registered handlers
|
||||||
|
@ -36,9 +36,9 @@ export class ConfigServer
|
|||||||
this.logger.debug("Importing configs...");
|
this.logger.debug("Importing configs...");
|
||||||
|
|
||||||
// Get all filepaths
|
// Get all filepaths
|
||||||
const filepath = (globalThis.G_RELEASE_CONFIGURATION) ?
|
const filepath = (globalThis.G_RELEASE_CONFIGURATION)
|
||||||
"Aki_Data/Server/configs/" :
|
? "Aki_Data/Server/configs/"
|
||||||
"./assets/configs/";
|
: "./assets/configs/";
|
||||||
const files = this.vfs.getFiles(filepath);
|
const files = this.vfs.getFiles(filepath);
|
||||||
|
|
||||||
// Add file content to result
|
// Add file content to result
|
||||||
|
@ -82,9 +82,9 @@ export class WebSocketServer
|
|||||||
return this.localisationService.getRandomTextThatMatchesPartialKey("server_start_meme_");
|
return this.localisationService.getRandomTextThatMatchesPartialKey("server_start_meme_");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (globalThis.G_RELEASE_CONFIGURATION) ?
|
return (globalThis.G_RELEASE_CONFIGURATION)
|
||||||
`${this.localisationService.getText("server_start_success")}!` :
|
? `${this.localisationService.getText("server_start_success")}!`
|
||||||
this.localisationService.getText("server_start_success");
|
: this.localisationService.getText("server_start_success");
|
||||||
}
|
}
|
||||||
|
|
||||||
public isConnectionWebSocket(sessionID: string): boolean
|
public isConnectionWebSocket(sessionID: string): boolean
|
||||||
|
@ -141,9 +141,9 @@ export class AkiHttpListener implements IHttpListener
|
|||||||
if (globalThis.G_LOG_REQUESTS)
|
if (globalThis.G_LOG_REQUESTS)
|
||||||
{
|
{
|
||||||
// Parse quest info into object
|
// Parse quest info into object
|
||||||
const data = (typeof info === "object") ?
|
const data = (typeof info === "object")
|
||||||
info :
|
? info
|
||||||
this.jsonUtil.deserialize(info);
|
: this.jsonUtil.deserialize(info);
|
||||||
|
|
||||||
const log = new Request(req.method, new RequestData(req.url, req.headers, data));
|
const log = new Request(req.method, new RequestData(req.url, req.headers, data));
|
||||||
this.requestsLogger.info(`REQUEST=${this.jsonUtil.serialize(log)}`);
|
this.requestsLogger.info(`REQUEST=${this.jsonUtil.serialize(log)}`);
|
||||||
|
@ -54,9 +54,9 @@ export class BotEquipmentFilterService
|
|||||||
{
|
{
|
||||||
const pmcProfile = this.profileHelper.getPmcProfile(sessionId);
|
const pmcProfile = this.profileHelper.getPmcProfile(sessionId);
|
||||||
|
|
||||||
const botRole = (botGenerationDetails.isPmc) ?
|
const botRole = (botGenerationDetails.isPmc)
|
||||||
"pmc" :
|
? "pmc"
|
||||||
botGenerationDetails.role;
|
: botGenerationDetails.role;
|
||||||
const botEquipmentBlacklist = this.getBotEquipmentBlacklist(botRole, botLevel);
|
const botEquipmentBlacklist = this.getBotEquipmentBlacklist(botRole, botLevel);
|
||||||
const botEquipmentWhitelist = this.getBotEquipmentWhitelist(botRole, botLevel);
|
const botEquipmentWhitelist = this.getBotEquipmentWhitelist(botRole, botLevel);
|
||||||
const botWeightingAdjustments = this.getBotWeightingAdjustments(botRole, botLevel);
|
const botWeightingAdjustments = this.getBotWeightingAdjustments(botRole, botLevel);
|
||||||
@ -175,8 +175,8 @@ export class BotEquipmentFilterService
|
|||||||
|
|
||||||
// No equipment blacklist found, skip
|
// No equipment blacklist found, skip
|
||||||
if (
|
if (
|
||||||
!blacklistDetailsForBot || Object.keys(blacklistDetailsForBot).length === 0 ||
|
!blacklistDetailsForBot || Object.keys(blacklistDetailsForBot).length === 0
|
||||||
!blacklistDetailsForBot.blacklist
|
|| !blacklistDetailsForBot.blacklist
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -220,8 +220,8 @@ export class BotEquipmentFilterService
|
|||||||
|
|
||||||
// No config found, skip
|
// No config found, skip
|
||||||
if (
|
if (
|
||||||
!botEquipmentConfig || Object.keys(botEquipmentConfig).length === 0 ||
|
!botEquipmentConfig || Object.keys(botEquipmentConfig).length === 0
|
||||||
!botEquipmentConfig.weightingAdjustmentsByBotLevel
|
|| !botEquipmentConfig.weightingAdjustmentsByBotLevel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -244,8 +244,8 @@ export class BotEquipmentFilterService
|
|||||||
|
|
||||||
// No config found, skip
|
// No config found, skip
|
||||||
if (
|
if (
|
||||||
!botEquipmentConfig || Object.keys(botEquipmentConfig).length === 0 ||
|
!botEquipmentConfig || Object.keys(botEquipmentConfig).length === 0
|
||||||
!botEquipmentConfig.weightingAdjustmentsByPlayerLevel
|
|| !botEquipmentConfig.weightingAdjustmentsByPlayerLevel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -165,66 +165,66 @@ export class BotLootCacheService
|
|||||||
this.sortPoolByRagfairPrice(combinedPoolTemplates);
|
this.sortPoolByRagfairPrice(combinedPoolTemplates);
|
||||||
|
|
||||||
// use whitelist if array has values, otherwise process above sorted pools
|
// use whitelist if array has values, otherwise process above sorted pools
|
||||||
const specialLootItems = (botJsonTemplate.generation.items.specialItems.whitelist?.length > 0) ?
|
const specialLootItems = (botJsonTemplate.generation.items.specialItems.whitelist?.length > 0)
|
||||||
botJsonTemplate.generation.items.specialItems.whitelist.map((x) => this.itemHelper.getItem(x)[1]) :
|
? botJsonTemplate.generation.items.specialItems.whitelist.map((x) => this.itemHelper.getItem(x)[1])
|
||||||
specialLootTemplates.filter((template) =>
|
: specialLootTemplates.filter((template) =>
|
||||||
!(this.isBulletOrGrenade(template._props) ||
|
!(this.isBulletOrGrenade(template._props)
|
||||||
this.isMagazine(template._props))
|
|| this.isMagazine(template._props))
|
||||||
);
|
);
|
||||||
|
|
||||||
const healingItems = (botJsonTemplate.generation.items.healing.whitelist?.length > 0) ?
|
const healingItems = (botJsonTemplate.generation.items.healing.whitelist?.length > 0)
|
||||||
botJsonTemplate.generation.items.healing.whitelist.map((x) => this.itemHelper.getItem(x)[1]) :
|
? botJsonTemplate.generation.items.healing.whitelist.map((x) => this.itemHelper.getItem(x)[1])
|
||||||
combinedPoolTemplates.filter((template) =>
|
: combinedPoolTemplates.filter((template) =>
|
||||||
this.isMedicalItem(template._props) &&
|
this.isMedicalItem(template._props)
|
||||||
template._parent !== BaseClasses.STIMULATOR &&
|
&& template._parent !== BaseClasses.STIMULATOR
|
||||||
template._parent !== BaseClasses.DRUGS
|
&& template._parent !== BaseClasses.DRUGS
|
||||||
);
|
);
|
||||||
|
|
||||||
const drugItems = (botJsonTemplate.generation.items.drugs.whitelist?.length > 0) ?
|
const drugItems = (botJsonTemplate.generation.items.drugs.whitelist?.length > 0)
|
||||||
botJsonTemplate.generation.items.drugs.whitelist.map((x) => this.itemHelper.getItem(x)[1]) :
|
? botJsonTemplate.generation.items.drugs.whitelist.map((x) => this.itemHelper.getItem(x)[1])
|
||||||
combinedPoolTemplates.filter((template) =>
|
: combinedPoolTemplates.filter((template) =>
|
||||||
this.isMedicalItem(template._props) &&
|
this.isMedicalItem(template._props)
|
||||||
template._parent === BaseClasses.DRUGS
|
&& template._parent === BaseClasses.DRUGS
|
||||||
);
|
);
|
||||||
|
|
||||||
const stimItems = (botJsonTemplate.generation.items.stims.whitelist?.length > 0) ?
|
const stimItems = (botJsonTemplate.generation.items.stims.whitelist?.length > 0)
|
||||||
botJsonTemplate.generation.items.stims.whitelist.map((x) => this.itemHelper.getItem(x)[1]) :
|
? botJsonTemplate.generation.items.stims.whitelist.map((x) => this.itemHelper.getItem(x)[1])
|
||||||
combinedPoolTemplates.filter((template) =>
|
: combinedPoolTemplates.filter((template) =>
|
||||||
this.isMedicalItem(template._props) &&
|
this.isMedicalItem(template._props)
|
||||||
template._parent === BaseClasses.STIMULATOR
|
&& template._parent === BaseClasses.STIMULATOR
|
||||||
);
|
);
|
||||||
|
|
||||||
const grenadeItems = (botJsonTemplate.generation.items.grenades.whitelist?.length > 0) ?
|
const grenadeItems = (botJsonTemplate.generation.items.grenades.whitelist?.length > 0)
|
||||||
botJsonTemplate.generation.items.grenades.whitelist.map((x) => this.itemHelper.getItem(x)[1]) :
|
? botJsonTemplate.generation.items.grenades.whitelist.map((x) => this.itemHelper.getItem(x)[1])
|
||||||
combinedPoolTemplates.filter((template) => this.isGrenade(template._props));
|
: combinedPoolTemplates.filter((template) => this.isGrenade(template._props));
|
||||||
|
|
||||||
// Get loot items (excluding magazines, bullets, grenades and healing items)
|
// Get loot items (excluding magazines, bullets, grenades and healing items)
|
||||||
const backpackLootItems = backpackLootTemplates.filter((template) =>
|
const backpackLootItems = backpackLootTemplates.filter((template) =>
|
||||||
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
||||||
!this.isBulletOrGrenade(template._props) &&
|
!this.isBulletOrGrenade(template._props)
|
||||||
!this.isMagazine(template._props) &&
|
&& !this.isMagazine(template._props)
|
||||||
// && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot
|
// && !this.isMedicalItem(template._props) // Disabled for now as followSanitar has a lot of med items as loot
|
||||||
!this.isGrenade(template._props)
|
&& !this.isGrenade(template._props)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get pocket loot
|
// Get pocket loot
|
||||||
const pocketLootItems = pocketLootTemplates.filter((template) =>
|
const pocketLootItems = pocketLootTemplates.filter((template) =>
|
||||||
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
||||||
!this.isBulletOrGrenade(template._props) &&
|
!this.isBulletOrGrenade(template._props)
|
||||||
!this.isMagazine(template._props) &&
|
&& !this.isMagazine(template._props)
|
||||||
!this.isMedicalItem(template._props) &&
|
&& !this.isMedicalItem(template._props)
|
||||||
!this.isGrenade(template._props) &&
|
&& !this.isGrenade(template._props)
|
||||||
("Height" in template._props) &&
|
&& ("Height" in template._props)
|
||||||
("Width" in template._props)
|
&& ("Width" in template._props)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get vest loot items
|
// Get vest loot items
|
||||||
const vestLootItems = vestLootTemplates.filter((template) =>
|
const vestLootItems = vestLootTemplates.filter((template) =>
|
||||||
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
// biome-ignore lint/complexity/useSimplifiedLogicExpression: <explanation>
|
||||||
!this.isBulletOrGrenade(template._props) &&
|
!this.isBulletOrGrenade(template._props)
|
||||||
!this.isMagazine(template._props) &&
|
&& !this.isMagazine(template._props)
|
||||||
!this.isMedicalItem(template._props) &&
|
&& !this.isMedicalItem(template._props)
|
||||||
!this.isGrenade(template._props)
|
&& !this.isGrenade(template._props)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.lootCache[botRole].healingItems = healingItems;
|
this.lootCache[botRole].healingItems = healingItems;
|
||||||
|
@ -121,10 +121,10 @@ export class BotWeaponModLimitService
|
|||||||
|
|
||||||
// Mod is a mount that can hold only scopes and limit is reached (dont want to add empty mounts if limit is reached)
|
// Mod is a mount that can hold only scopes and limit is reached (dont want to add empty mounts if limit is reached)
|
||||||
if (
|
if (
|
||||||
this.itemHelper.isOfBaseclass(modTemplate._id, BaseClasses.MOUNT) &&
|
this.itemHelper.isOfBaseclass(modTemplate._id, BaseClasses.MOUNT)
|
||||||
modTemplate._props.Slots.some((x) => x._name === "mod_scope") &&
|
&& modTemplate._props.Slots.some((x) => x._name === "mod_scope")
|
||||||
modTemplate._props.Slots.length === 1 &&
|
&& modTemplate._props.Slots.length === 1
|
||||||
modLimits.scope.count >= modLimits.scopeMax
|
&& modLimits.scope.count >= modLimits.scopeMax
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -144,10 +144,10 @@ export class BotWeaponModLimitService
|
|||||||
|
|
||||||
// Mod is a mount that can hold only flashlights ad limit is reached (dont want to add empty mounts if limit is reached)
|
// Mod is a mount that can hold only flashlights ad limit is reached (dont want to add empty mounts if limit is reached)
|
||||||
if (
|
if (
|
||||||
this.itemHelper.isOfBaseclass(modTemplate._id, BaseClasses.MOUNT) &&
|
this.itemHelper.isOfBaseclass(modTemplate._id, BaseClasses.MOUNT)
|
||||||
modTemplate._props.Slots.some((x) => x._name === "mod_flashlight") &&
|
&& modTemplate._props.Slots.some((x) => x._name === "mod_flashlight")
|
||||||
modTemplate._props.Slots.length === 1 &&
|
&& modTemplate._props.Slots.length === 1
|
||||||
modLimits.scope.count >= modLimits.scopeMax
|
&& modLimits.scope.count >= modLimits.scopeMax
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -279,8 +279,8 @@ export class FenceService
|
|||||||
*/
|
*/
|
||||||
protected incrementPartialRefreshTime(): void
|
protected incrementPartialRefreshTime(): void
|
||||||
{
|
{
|
||||||
this.nextMiniRefreshTimestamp = this.timeUtil.getTimestamp() +
|
this.nextMiniRefreshTimestamp = this.timeUtil.getTimestamp()
|
||||||
this.traderConfig.fence.partialRefreshTimeSeconds;
|
+ this.traderConfig.fence.partialRefreshTimeSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -294,14 +294,14 @@ export class FenceService
|
|||||||
const desiredTotalCount = this.traderConfig.fence.assortSize;
|
const desiredTotalCount = this.traderConfig.fence.assortSize;
|
||||||
const actualTotalCount = this.fenceAssort.items.reduce((count, item) =>
|
const actualTotalCount = this.fenceAssort.items.reduce((count, item) =>
|
||||||
{
|
{
|
||||||
return item.slotId === "hideout" ?
|
return item.slotId === "hideout"
|
||||||
count + 1 :
|
? count + 1
|
||||||
count;
|
: count;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
return actualTotalCount < desiredTotalCount ?
|
return actualTotalCount < desiredTotalCount
|
||||||
(desiredTotalCount - actualTotalCount) + existingItemCountToReplace :
|
? (desiredTotalCount - actualTotalCount) + existingItemCountToReplace
|
||||||
existingItemCountToReplace;
|
: existingItemCountToReplace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -506,9 +506,9 @@ export class FenceService
|
|||||||
if (this.itemHelper.isOfBaseclass(itemDbDetails._id, BaseClasses.AMMO))
|
if (this.itemHelper.isOfBaseclass(itemDbDetails._id, BaseClasses.AMMO))
|
||||||
{
|
{
|
||||||
// No override, use stack max size from item db
|
// No override, use stack max size from item db
|
||||||
return itemDbDetails._props.StackMaxSize === 1 ?
|
return itemDbDetails._props.StackMaxSize === 1
|
||||||
1 :
|
? 1
|
||||||
this.randomUtil.getInt(itemDbDetails._props.StackMinRandom, itemDbDetails._props.StackMaxRandom);
|
: this.randomUtil.getInt(itemDbDetails._props.StackMinRandom, itemDbDetails._props.StackMaxRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -658,8 +658,8 @@ export class FenceService
|
|||||||
// Roll from 0 to 9999, then divide it by 100: 9999 = 99.99%
|
// Roll from 0 to 9999, then divide it by 100: 9999 = 99.99%
|
||||||
const randomChance = this.randomUtil.getInt(0, 9999) / 100;
|
const randomChance = this.randomUtil.getInt(0, 9999) / 100;
|
||||||
|
|
||||||
return randomChance > removalChance &&
|
return randomChance > removalChance
|
||||||
!itemsBeingDeleted.includes(weaponMod._id);
|
&& !itemsBeingDeleted.includes(weaponMod._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -688,12 +688,12 @@ export class FenceService
|
|||||||
|
|
||||||
// Randomise armor durability
|
// Randomise armor durability
|
||||||
if (
|
if (
|
||||||
(itemDetails._parent === BaseClasses.ARMOR ||
|
(itemDetails._parent === BaseClasses.ARMOR
|
||||||
itemDetails._parent === BaseClasses.HEADWEAR ||
|
|| itemDetails._parent === BaseClasses.HEADWEAR
|
||||||
itemDetails._parent === BaseClasses.VEST ||
|
|| itemDetails._parent === BaseClasses.VEST
|
||||||
itemDetails._parent === BaseClasses.ARMOREDEQUIPMENT ||
|
|| itemDetails._parent === BaseClasses.ARMOREDEQUIPMENT
|
||||||
itemDetails._parent === BaseClasses.FACECOVER) &&
|
|| itemDetails._parent === BaseClasses.FACECOVER)
|
||||||
itemDetails._props.MaxDurability > 0
|
&& itemDetails._props.MaxDurability > 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const armorMaxDurabilityLimits = this.traderConfig.fence.armorMaxDurabilityPercentMinMax;
|
const armorMaxDurabilityLimits = this.traderConfig.fence.armorMaxDurabilityPercentMinMax;
|
||||||
@ -740,8 +740,8 @@ export class FenceService
|
|||||||
|
|
||||||
// Mechanical key + has limited uses
|
// Mechanical key + has limited uses
|
||||||
if (
|
if (
|
||||||
this.itemHelper.isOfBaseclass(itemDetails._id, BaseClasses.KEY_MECHANICAL) &&
|
this.itemHelper.isOfBaseclass(itemDetails._id, BaseClasses.KEY_MECHANICAL)
|
||||||
itemDetails._props.MaximumNumberOfUsage > 1
|
&& itemDetails._props.MaximumNumberOfUsage > 1
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
itemToAdjust.upd.Key = {
|
itemToAdjust.upd.Key = {
|
||||||
|
@ -147,9 +147,9 @@ export class InsuranceService
|
|||||||
public sendLostInsuranceMessage(sessionId: string, locationName = ""): void
|
public sendLostInsuranceMessage(sessionId: string, locationName = ""): void
|
||||||
{
|
{
|
||||||
const dialogueTemplates = this.databaseServer.getTables().traders[Traders.PRAPOR].dialogue; // todo: get trader id instead of hard coded prapor
|
const dialogueTemplates = this.databaseServer.getTables().traders[Traders.PRAPOR].dialogue; // todo: get trader id instead of hard coded prapor
|
||||||
const randomResponseId = locationName?.toLowerCase() === "laboratory" ?
|
const randomResponseId = locationName?.toLowerCase() === "laboratory"
|
||||||
this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailedLabs) :
|
? this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailedLabs)
|
||||||
this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailed);
|
: this.randomUtil.getArrayValue(dialogueTemplates.insuranceFailed);
|
||||||
|
|
||||||
this.mailSendService.sendLocalisedNpcMessageToPlayer(
|
this.mailSendService.sendLocalisedNpcMessageToPlayer(
|
||||||
sessionId,
|
sessionId,
|
||||||
@ -202,9 +202,9 @@ export class InsuranceService
|
|||||||
}
|
}
|
||||||
|
|
||||||
const insuranceReturnTimeBonus = pmcData.Bonuses.find((b) => b.type === "InsuranceReturnTime");
|
const insuranceReturnTimeBonus = pmcData.Bonuses.find((b) => b.type === "InsuranceReturnTime");
|
||||||
const insuranceReturnTimeBonusPercent = 1.0 - (insuranceReturnTimeBonus ?
|
const insuranceReturnTimeBonusPercent = 1.0 - (insuranceReturnTimeBonus
|
||||||
Math.abs(insuranceReturnTimeBonus.value) :
|
? Math.abs(insuranceReturnTimeBonus.value)
|
||||||
0) / 100;
|
: 0) / 100;
|
||||||
|
|
||||||
const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.oneHourAsSeconds;
|
const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.oneHourAsSeconds;
|
||||||
const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.oneHourAsSeconds;
|
const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.oneHourAsSeconds;
|
||||||
|
@ -26,9 +26,9 @@ export class LocalisationService
|
|||||||
{
|
{
|
||||||
const localeFileDirectory = path.join(
|
const localeFileDirectory = path.join(
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
globalThis.G_RELEASE_CONFIGURATION ?
|
globalThis.G_RELEASE_CONFIGURATION
|
||||||
"Aki_Data/Server/database/locales/server" :
|
? "Aki_Data/Server/database/locales/server"
|
||||||
"./assets/database/locales/server",
|
: "./assets/database/locales/server",
|
||||||
);
|
);
|
||||||
this.i18n = new I18n(
|
this.i18n = new I18n(
|
||||||
{
|
{
|
||||||
|
@ -285,8 +285,8 @@ export class MailSendService
|
|||||||
// TODO: clean up old code here
|
// TODO: clean up old code here
|
||||||
// Offer Sold notifications are now separate from the main notification
|
// Offer Sold notifications are now separate from the main notification
|
||||||
if (
|
if (
|
||||||
[MessageType.NPC_TRADER, MessageType.FLEAMARKET_MESSAGE].includes(senderDialog.type) &&
|
[MessageType.NPC_TRADER, MessageType.FLEAMARKET_MESSAGE].includes(senderDialog.type)
|
||||||
messageDetails.ragfairDetails
|
&& messageDetails.ragfairDetails
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const offerSoldMessage = this.notifierHelper.createRagfairOfferSoldNotification(
|
const offerSoldMessage = this.notifierHelper.createRagfairOfferSoldNotification(
|
||||||
@ -348,9 +348,9 @@ export class MailSendService
|
|||||||
hasRewards: false, // The default dialog message has no rewards, can be added later via addRewardItemsToMessage()
|
hasRewards: false, // The default dialog message has no rewards, can be added later via addRewardItemsToMessage()
|
||||||
rewardCollected: false, // The default dialog message has no rewards, can be added later via addRewardItemsToMessage()
|
rewardCollected: false, // The default dialog message has no rewards, can be added later via addRewardItemsToMessage()
|
||||||
systemData: messageDetails.systemData ? messageDetails.systemData : undefined, // Used by ragfair / localised messages that need "location" or "time"
|
systemData: messageDetails.systemData ? messageDetails.systemData : undefined, // Used by ragfair / localised messages that need "location" or "time"
|
||||||
profileChangeEvents: (messageDetails.profileChangeEvents?.length === 0) ?
|
profileChangeEvents: (messageDetails.profileChangeEvents?.length === 0)
|
||||||
messageDetails.profileChangeEvents :
|
? messageDetails.profileChangeEvents
|
||||||
undefined, // no one knows, its never been used in any dumps
|
: undefined, // no one knows, its never been used in any dumps
|
||||||
};
|
};
|
||||||
|
|
||||||
// Clean up empty system data
|
// Clean up empty system data
|
||||||
|
@ -69,8 +69,8 @@ export class PaymentService
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If the item is money, add its count to the currencyAmounts object.
|
// If the item is money, add its count to the currencyAmounts object.
|
||||||
currencyAmounts[item._tpl] = (currencyAmounts[item._tpl] || 0) +
|
currencyAmounts[item._tpl] = (currencyAmounts[item._tpl] || 0)
|
||||||
request.scheme_items[index].count;
|
+ request.scheme_items[index].count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,9 +167,9 @@ export class PmcChatResponseService
|
|||||||
*/
|
*/
|
||||||
protected stripCapitalistion(isVictim: boolean): boolean
|
protected stripCapitalistion(isVictim: boolean): boolean
|
||||||
{
|
{
|
||||||
const chance = isVictim ?
|
const chance = isVictim
|
||||||
this.pmcResponsesConfig.victim.stripCapitalisationChancePercent :
|
? this.pmcResponsesConfig.victim.stripCapitalisationChancePercent
|
||||||
this.pmcResponsesConfig.killer.stripCapitalisationChancePercent;
|
: this.pmcResponsesConfig.killer.stripCapitalisationChancePercent;
|
||||||
|
|
||||||
return this.randomUtil.getChance100(chance);
|
return this.randomUtil.getChance100(chance);
|
||||||
}
|
}
|
||||||
@ -181,9 +181,9 @@ export class PmcChatResponseService
|
|||||||
*/
|
*/
|
||||||
protected allCaps(isVictim: boolean): boolean
|
protected allCaps(isVictim: boolean): boolean
|
||||||
{
|
{
|
||||||
const chance = isVictim ?
|
const chance = isVictim
|
||||||
this.pmcResponsesConfig.victim.allCapsChancePercent :
|
? this.pmcResponsesConfig.victim.allCapsChancePercent
|
||||||
this.pmcResponsesConfig.killer.allCapsChancePercent;
|
: this.pmcResponsesConfig.killer.allCapsChancePercent;
|
||||||
|
|
||||||
return this.randomUtil.getChance100(chance);
|
return this.randomUtil.getChance100(chance);
|
||||||
}
|
}
|
||||||
@ -195,9 +195,9 @@ export class PmcChatResponseService
|
|||||||
*/
|
*/
|
||||||
appendSuffixToMessageEnd(isVictim: boolean): boolean
|
appendSuffixToMessageEnd(isVictim: boolean): boolean
|
||||||
{
|
{
|
||||||
const chance = isVictim ?
|
const chance = isVictim
|
||||||
this.pmcResponsesConfig.victim.appendBroToMessageEndChancePercent :
|
? this.pmcResponsesConfig.victim.appendBroToMessageEndChancePercent
|
||||||
this.pmcResponsesConfig.killer.appendBroToMessageEndChancePercent;
|
: this.pmcResponsesConfig.killer.appendBroToMessageEndChancePercent;
|
||||||
|
|
||||||
return this.randomUtil.getChance100(chance);
|
return this.randomUtil.getChance100(chance);
|
||||||
}
|
}
|
||||||
@ -209,9 +209,9 @@ export class PmcChatResponseService
|
|||||||
*/
|
*/
|
||||||
protected chooseResponseType(isVictim = true): string
|
protected chooseResponseType(isVictim = true): string
|
||||||
{
|
{
|
||||||
const responseWeights = isVictim ?
|
const responseWeights = isVictim
|
||||||
this.pmcResponsesConfig.victim.responseTypeWeights :
|
? this.pmcResponsesConfig.victim.responseTypeWeights
|
||||||
this.pmcResponsesConfig.killer.responseTypeWeights;
|
: this.pmcResponsesConfig.killer.responseTypeWeights;
|
||||||
|
|
||||||
return this.weightedRandomHelper.getWeightedValue<string>(responseWeights);
|
return this.weightedRandomHelper.getWeightedValue<string>(responseWeights);
|
||||||
}
|
}
|
||||||
|
@ -82,17 +82,17 @@ export class ProfileFixerService
|
|||||||
this.reorderHideoutAreasWithResouceInputs(pmcProfile);
|
this.reorderHideoutAreasWithResouceInputs(pmcProfile);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pmcProfile.Hideout.Areas[HideoutAreas.GENERATOR].slots.length <
|
pmcProfile.Hideout.Areas[HideoutAreas.GENERATOR].slots.length
|
||||||
(6 +
|
< (6
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.Generator.Slots)
|
.Generator.Slots)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.debug("Updating generator area slots to a size of 6 + hideout management skill");
|
this.logger.debug("Updating generator area slots to a size of 6 + hideout management skill");
|
||||||
this.addEmptyObjectsToHideoutAreaSlots(
|
this.addEmptyObjectsToHideoutAreaSlots(
|
||||||
HideoutAreas.GENERATOR,
|
HideoutAreas.GENERATOR,
|
||||||
6 +
|
6
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.Generator
|
.Generator
|
||||||
.Slots,
|
.Slots,
|
||||||
pmcProfile,
|
pmcProfile,
|
||||||
@ -100,34 +100,34 @@ export class ProfileFixerService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pmcProfile.Hideout.Areas[HideoutAreas.WATER_COLLECTOR].slots.length <
|
pmcProfile.Hideout.Areas[HideoutAreas.WATER_COLLECTOR].slots.length
|
||||||
(1 +
|
< (1
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.WaterCollector.Slots)
|
.WaterCollector.Slots)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.debug("Updating water collector area slots to a size of 1 + hideout management skill");
|
this.logger.debug("Updating water collector area slots to a size of 1 + hideout management skill");
|
||||||
this.addEmptyObjectsToHideoutAreaSlots(
|
this.addEmptyObjectsToHideoutAreaSlots(
|
||||||
HideoutAreas.WATER_COLLECTOR,
|
HideoutAreas.WATER_COLLECTOR,
|
||||||
1 +
|
1
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.WaterCollector.Slots,
|
.WaterCollector.Slots,
|
||||||
pmcProfile,
|
pmcProfile,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pmcProfile.Hideout.Areas[HideoutAreas.AIR_FILTERING].slots.length <
|
pmcProfile.Hideout.Areas[HideoutAreas.AIR_FILTERING].slots.length
|
||||||
(3 +
|
< (3
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.AirFilteringUnit.Slots)
|
.AirFilteringUnit.Slots)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.debug("Updating air filter area slots to a size of 3 + hideout management skill");
|
this.logger.debug("Updating air filter area slots to a size of 3 + hideout management skill");
|
||||||
this.addEmptyObjectsToHideoutAreaSlots(
|
this.addEmptyObjectsToHideoutAreaSlots(
|
||||||
HideoutAreas.AIR_FILTERING,
|
HideoutAreas.AIR_FILTERING,
|
||||||
3 +
|
3
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.AirFilteringUnit.Slots,
|
.AirFilteringUnit.Slots,
|
||||||
pmcProfile,
|
pmcProfile,
|
||||||
);
|
);
|
||||||
@ -135,17 +135,17 @@ export class ProfileFixerService
|
|||||||
|
|
||||||
// BTC Farm doesnt have extra slots for hideout management, but we still check for modded stuff!!
|
// BTC Farm doesnt have extra slots for hideout management, but we still check for modded stuff!!
|
||||||
if (
|
if (
|
||||||
pmcProfile.Hideout.Areas[HideoutAreas.BITCOIN_FARM].slots.length <
|
pmcProfile.Hideout.Areas[HideoutAreas.BITCOIN_FARM].slots.length
|
||||||
(50 +
|
< (50
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.BitcoinFarm.Slots)
|
.BitcoinFarm.Slots)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger.debug("Updating bitcoin farm area slots to a size of 50 + hideout management skill");
|
this.logger.debug("Updating bitcoin farm area slots to a size of 50 + hideout management skill");
|
||||||
this.addEmptyObjectsToHideoutAreaSlots(
|
this.addEmptyObjectsToHideoutAreaSlots(
|
||||||
HideoutAreas.BITCOIN_FARM,
|
HideoutAreas.BITCOIN_FARM,
|
||||||
50 +
|
50
|
||||||
this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
+ this.databaseServer.getTables().globals.config.SkillsSettings.HideoutManagement.EliteSlots
|
||||||
.BitcoinFarm.Slots,
|
.BitcoinFarm.Slots,
|
||||||
pmcProfile,
|
pmcProfile,
|
||||||
);
|
);
|
||||||
@ -553,8 +553,8 @@ export class ProfileFixerService
|
|||||||
for (const currentRepeatable of pmcProfile.RepeatableQuests)
|
for (const currentRepeatable of pmcProfile.RepeatableQuests)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
!(currentRepeatable.changeRequirement &&
|
!(currentRepeatable.changeRequirement
|
||||||
currentRepeatable.activeQuests.every(
|
&& currentRepeatable.activeQuests.every(
|
||||||
(x) => (typeof x.changeCost !== "undefined" && typeof x.changeStandingCost !== "undefined"),
|
(x) => (typeof x.changeCost !== "undefined" && typeof x.changeStandingCost !== "undefined"),
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
@ -800,8 +800,8 @@ export class ProfileFixerService
|
|||||||
{
|
{
|
||||||
return profileBonuses.find(
|
return profileBonuses.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.type === bonus.type &&
|
x.type === bonus.type
|
||||||
x.templateId === bonus.templateId,
|
&& x.templateId === bonus.templateId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,16 +809,16 @@ export class ProfileFixerService
|
|||||||
{
|
{
|
||||||
return profileBonuses.find(
|
return profileBonuses.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.type === bonus.type &&
|
x.type === bonus.type
|
||||||
x.value === bonus.value &&
|
&& x.value === bonus.value
|
||||||
x.visible === bonus.visible,
|
&& x.visible === bonus.visible,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return profileBonuses.find(
|
return profileBonuses.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.type === bonus.type &&
|
x.type === bonus.type
|
||||||
x.value === bonus.value,
|
&& x.value === bonus.value,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ export class RagfairCategoriesService
|
|||||||
const itemId = offer.items[0]._tpl;
|
const itemId = offer.items[0]._tpl;
|
||||||
if (increment)
|
if (increment)
|
||||||
{
|
{
|
||||||
categories[itemId] = categories[itemId] ?
|
categories[itemId] = categories[itemId]
|
||||||
categories[itemId] + 1 :
|
? categories[itemId] + 1
|
||||||
1;
|
: 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -298,9 +298,9 @@ export class RagfairPriceService implements OnLoad
|
|||||||
|
|
||||||
// Only adjust price if difference is > a percent AND item price passes threshhold set in config
|
// Only adjust price if difference is > a percent AND item price passes threshhold set in config
|
||||||
if (
|
if (
|
||||||
priceDifferencePercent >
|
priceDifferencePercent
|
||||||
this.ragfairConfig.dynamic.offerAdjustment.maxPriceDifferenceBelowHandbookPercent &&
|
> this.ragfairConfig.dynamic.offerAdjustment.maxPriceDifferenceBelowHandbookPercent
|
||||||
itemPrice >= this.ragfairConfig.dynamic.offerAdjustment.priceThreshholdRub
|
&& itemPrice >= this.ragfairConfig.dynamic.offerAdjustment.priceThreshholdRub
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// const itemDetails = this.itemHelper.getItem(itemTpl);
|
// const itemDetails = this.itemHelper.getItem(itemTpl);
|
||||||
|
@ -62,8 +62,8 @@ export class RagfairTaxService
|
|||||||
const requirementsPrice = requirementsValue * (sellInOnePiece ? 1 : offerItemCount);
|
const requirementsPrice = requirementsValue * (sellInOnePiece ? 1 : offerItemCount);
|
||||||
|
|
||||||
const itemTaxMult = this.databaseServer.getTables().globals.config.RagFair.communityItemTax / 100.0;
|
const itemTaxMult = this.databaseServer.getTables().globals.config.RagFair.communityItemTax / 100.0;
|
||||||
const requirementTaxMult = this.databaseServer.getTables().globals.config.RagFair.communityRequirementTax /
|
const requirementTaxMult = this.databaseServer.getTables().globals.config.RagFair.communityRequirementTax
|
||||||
100.0;
|
/ 100.0;
|
||||||
|
|
||||||
let itemPriceMult = Math.log10(itemWorth / requirementsPrice);
|
let itemPriceMult = Math.log10(itemWorth / requirementsPrice);
|
||||||
let requirementPriceMult = Math.log10(requirementsPrice / itemWorth);
|
let requirementPriceMult = Math.log10(requirementsPrice / itemWorth);
|
||||||
@ -83,12 +83,12 @@ export class RagfairTaxService
|
|||||||
const hideoutFleaTaxDiscountBonus = pmcData.Bonuses.find((b) => b.type === "RagfairCommission");
|
const hideoutFleaTaxDiscountBonus = pmcData.Bonuses.find((b) => b.type === "RagfairCommission");
|
||||||
const taxDiscountPercent = hideoutFleaTaxDiscountBonus ? Math.abs(hideoutFleaTaxDiscountBonus.value) : 0;
|
const taxDiscountPercent = hideoutFleaTaxDiscountBonus ? Math.abs(hideoutFleaTaxDiscountBonus.value) : 0;
|
||||||
|
|
||||||
const tax = itemWorth * itemTaxMult * itemPriceMult +
|
const tax = itemWorth * itemTaxMult * itemPriceMult
|
||||||
requirementsPrice * requirementTaxMult * requirementPriceMult;
|
+ requirementsPrice * requirementTaxMult * requirementPriceMult;
|
||||||
const discountedTax = tax * (1.0 - taxDiscountPercent / 100.0);
|
const discountedTax = tax * (1.0 - taxDiscountPercent / 100.0);
|
||||||
const itemComissionMult = itemTemplate._props.RagFairCommissionModifier ?
|
const itemComissionMult = itemTemplate._props.RagFairCommissionModifier
|
||||||
itemTemplate._props.RagFairCommissionModifier :
|
? itemTemplate._props.RagFairCommissionModifier
|
||||||
1;
|
: 1;
|
||||||
|
|
||||||
if (item.upd.Buff)
|
if (item.upd.Buff)
|
||||||
{
|
{
|
||||||
@ -144,8 +144,8 @@ export class RagfairTaxService
|
|||||||
|
|
||||||
if ("Key" in item.upd && itemTemplate._props.MaximumNumberOfUsage > 0)
|
if ("Key" in item.upd && itemTemplate._props.MaximumNumberOfUsage > 0)
|
||||||
{
|
{
|
||||||
worth = worth / itemTemplate._props.MaximumNumberOfUsage *
|
worth = worth / itemTemplate._props.MaximumNumberOfUsage
|
||||||
(itemTemplate._props.MaximumNumberOfUsage - item.upd.Key.NumberOfUsages);
|
* (itemTemplate._props.MaximumNumberOfUsage - item.upd.Key.NumberOfUsages);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("Resource" in item.upd && itemTemplate._props.MaxResource > 0)
|
if ("Resource" in item.upd && itemTemplate._props.MaxResource > 0)
|
||||||
@ -171,10 +171,10 @@ export class RagfairTaxService
|
|||||||
if ("Repairable" in item.upd && <number>itemTemplate._props.armorClass > 0)
|
if ("Repairable" in item.upd && <number>itemTemplate._props.armorClass > 0)
|
||||||
{
|
{
|
||||||
const num2 = 0.01 * (0.0 ** item.upd.Repairable.MaxDurability);
|
const num2 = 0.01 * (0.0 ** item.upd.Repairable.MaxDurability);
|
||||||
worth = worth * ((item.upd.Repairable.MaxDurability / itemTemplate._props.Durability) - num2) -
|
worth = worth * ((item.upd.Repairable.MaxDurability / itemTemplate._props.Durability) - num2)
|
||||||
Math.floor(
|
- Math.floor(
|
||||||
itemTemplate._props.RepairCost *
|
itemTemplate._props.RepairCost
|
||||||
(item.upd.Repairable.MaxDurability - item.upd.Repairable.Durability),
|
* (item.upd.Repairable.MaxDurability - item.upd.Repairable.Durability),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ export class RepairService
|
|||||||
const priceCoef = this.traderHelper.getLoyaltyLevel(traderId, pmcData).repair_price_coef;
|
const priceCoef = this.traderHelper.getLoyaltyLevel(traderId, pmcData).repair_price_coef;
|
||||||
const traderRepairDetails = this.traderHelper.getTrader(traderId, sessionID).repair;
|
const traderRepairDetails = this.traderHelper.getTrader(traderId, sessionID).repair;
|
||||||
const repairQualityMultiplier = traderRepairDetails.quality;
|
const repairQualityMultiplier = traderRepairDetails.quality;
|
||||||
const repairRate = (priceCoef <= 0) ?
|
const repairRate = (priceCoef <= 0)
|
||||||
1 :
|
? 1
|
||||||
(priceCoef / 100 + 1);
|
: (priceCoef / 100 + 1);
|
||||||
|
|
||||||
const itemToRepairDetails = this.databaseServer.getTables().templates.items[itemToRepair._tpl];
|
const itemToRepairDetails = this.databaseServer.getTables().templates.items[itemToRepair._tpl];
|
||||||
const repairItemIsArmor = !!itemToRepairDetails._props.ArmorMaterial;
|
const repairItemIsArmor = !!itemToRepairDetails._props.ArmorMaterial;
|
||||||
@ -156,8 +156,8 @@ export class RepairService
|
|||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
repairDetails.repairedByKit &&
|
repairDetails.repairedByKit
|
||||||
this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON)
|
&& this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const skillPoints = this.getWeaponRepairSkillPoints(repairDetails);
|
const skillPoints = this.getWeaponRepairSkillPoints(repairDetails);
|
||||||
@ -167,8 +167,8 @@ export class RepairService
|
|||||||
|
|
||||||
// Handle kit repairs of armor
|
// Handle kit repairs of armor
|
||||||
if (
|
if (
|
||||||
repairDetails.repairedByKit &&
|
repairDetails.repairedByKit
|
||||||
this.itemHelper.isOfBaseclasses(repairDetails.repairedItem._tpl, [BaseClasses.ARMOR, BaseClasses.VEST])
|
&& this.itemHelper.isOfBaseclasses(repairDetails.repairedItem._tpl, [BaseClasses.ARMOR, BaseClasses.VEST])
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const itemDetails = this.itemHelper.getItem(repairDetails.repairedItem._tpl);
|
const itemDetails = this.itemHelper.getItem(repairDetails.repairedItem._tpl);
|
||||||
@ -186,11 +186,11 @@ export class RepairService
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isHeavyArmor = itemDetails[1]._props.ArmorType === "Heavy";
|
const isHeavyArmor = itemDetails[1]._props.ArmorType === "Heavy";
|
||||||
const vestSkillToLevel = isHeavyArmor ?
|
const vestSkillToLevel = isHeavyArmor
|
||||||
SkillTypes.HEAVY_VESTS :
|
? SkillTypes.HEAVY_VESTS
|
||||||
SkillTypes.LIGHT_VESTS;
|
: SkillTypes.LIGHT_VESTS;
|
||||||
const pointsToAddToVestSkill = repairDetails.repairPoints *
|
const pointsToAddToVestSkill = repairDetails.repairPoints
|
||||||
this.repairConfig.armorKitSkillPointGainPerRepairPointMultiplier;
|
* this.repairConfig.armorKitSkillPointGainPerRepairPointMultiplier;
|
||||||
|
|
||||||
this.profileHelper.addSkillPointsToPlayer(pmcData, vestSkillToLevel, pointsToAddToVestSkill);
|
this.profileHelper.addSkillPointsToPlayer(pmcData, vestSkillToLevel, pointsToAddToVestSkill);
|
||||||
}
|
}
|
||||||
@ -200,9 +200,9 @@ export class RepairService
|
|||||||
if (repairDetails.repairedByKit)
|
if (repairDetails.repairedByKit)
|
||||||
{
|
{
|
||||||
const intRepairMultiplier =
|
const intRepairMultiplier =
|
||||||
(this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON)) ?
|
(this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON))
|
||||||
this.repairConfig.repairKitIntellectGainMultiplier.weapon :
|
? this.repairConfig.repairKitIntellectGainMultiplier.weapon
|
||||||
this.repairConfig.repairKitIntellectGainMultiplier.armor;
|
: this.repairConfig.repairKitIntellectGainMultiplier.armor;
|
||||||
|
|
||||||
// limit gain to a max value defined in config.maxIntellectGainPerRepair
|
// limit gain to a max value defined in config.maxIntellectGainPerRepair
|
||||||
intellectGainedFromRepair = Math.min(
|
intellectGainedFromRepair = Math.min(
|
||||||
@ -339,8 +339,8 @@ export class RepairService
|
|||||||
const globalRepairSettings = globals.config.RepairSettings;
|
const globalRepairSettings = globals.config.RepairSettings;
|
||||||
|
|
||||||
const intellectRepairPointsPerLevel = globals.config.SkillsSettings.Intellect.RepairPointsCostReduction;
|
const intellectRepairPointsPerLevel = globals.config.SkillsSettings.Intellect.RepairPointsCostReduction;
|
||||||
const profileIntellectLevel = this.profileHelper.getSkillFromProfile(pmcData, SkillTypes.INTELLECT)?.Progress ??
|
const profileIntellectLevel = this.profileHelper.getSkillFromProfile(pmcData, SkillTypes.INTELLECT)?.Progress
|
||||||
0;
|
?? 0;
|
||||||
const intellectPointReduction = intellectRepairPointsPerLevel * Math.trunc(profileIntellectLevel / 100);
|
const intellectPointReduction = intellectRepairPointsPerLevel * Math.trunc(profileIntellectLevel / 100);
|
||||||
|
|
||||||
if (isArmor)
|
if (isArmor)
|
||||||
|
@ -237,8 +237,8 @@ export class SeasonalEventService
|
|||||||
|
|
||||||
// Current date is between start/end dates
|
// Current date is between start/end dates
|
||||||
if (
|
if (
|
||||||
currentDate >= eventStartDate &&
|
currentDate >= eventStartDate
|
||||||
currentDate <= eventEndDate
|
&& currentDate <= eventEndDate
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.christmasEventActive = SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS;
|
this.christmasEventActive = SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS;
|
||||||
|
@ -120,9 +120,9 @@ export class CustomItemService
|
|||||||
*/
|
*/
|
||||||
protected getOrGenerateIdForItem(newId: string): string
|
protected getOrGenerateIdForItem(newId: string): string
|
||||||
{
|
{
|
||||||
return (newId === "") ?
|
return (newId === "")
|
||||||
this.hashUtil.generate() :
|
? this.hashUtil.generate()
|
||||||
newId;
|
: newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,9 +45,9 @@ export class DatabaseImporter implements OnLoad
|
|||||||
*/
|
*/
|
||||||
public getSptDataPath(): string
|
public getSptDataPath(): string
|
||||||
{
|
{
|
||||||
return (globalThis.G_RELEASE_CONFIGURATION) ?
|
return (globalThis.G_RELEASE_CONFIGURATION)
|
||||||
"Aki_Data/Server/" :
|
? "Aki_Data/Server/"
|
||||||
"./assets/";
|
: "./assets/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public async onLoad(): Promise<void>
|
public async onLoad(): Promise<void>
|
||||||
@ -109,9 +109,9 @@ export class DatabaseImporter implements OnLoad
|
|||||||
(fileWithPath: string, data: string) => this.onReadValidate(fileWithPath, data),
|
(fileWithPath: string, data: string) => this.onReadValidate(fileWithPath, data),
|
||||||
);
|
);
|
||||||
|
|
||||||
const validation = (this.valid === VaildationResult.FAILED || this.valid === VaildationResult.NOT_FOUND) ?
|
const validation = (this.valid === VaildationResult.FAILED || this.valid === VaildationResult.NOT_FOUND)
|
||||||
"." :
|
? "."
|
||||||
"";
|
: "";
|
||||||
this.logger.info(`${this.localisationService.getText("importing_database_finish")}${validation}`);
|
this.logger.info(`${this.localisationService.getText("importing_database_finish")}${validation}`);
|
||||||
this.databaseServer.setTables(dataToImport);
|
this.databaseServer.setTables(dataToImport);
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ export class HttpFileUtil
|
|||||||
public sendFile(resp: ServerResponse, file: any): void
|
public sendFile(resp: ServerResponse, file: any): void
|
||||||
{
|
{
|
||||||
const pathSlic = file.split("/");
|
const pathSlic = file.split("/");
|
||||||
const type = this.httpServerHelper.getMimeText(pathSlic[pathSlic.length - 1].split(".").at(-1)) ||
|
const type = this.httpServerHelper.getMimeText(pathSlic[pathSlic.length - 1].split(".").at(-1))
|
||||||
this.httpServerHelper.getMimeText("txt");
|
|| this.httpServerHelper.getMimeText("txt");
|
||||||
const fileStream = fs.createReadStream(file);
|
const fileStream = fs.createReadStream(file);
|
||||||
|
|
||||||
fileStream.on("open", function()
|
fileStream.on("open", function()
|
||||||
|
@ -110,9 +110,9 @@ export class Watermark
|
|||||||
*/
|
*/
|
||||||
public getVersionTag(withEftVersion = false): string
|
public getVersionTag(withEftVersion = false): string
|
||||||
{
|
{
|
||||||
const versionTag = (globalThis.G_DEBUG_CONFIGURATION) ?
|
const versionTag = (globalThis.G_DEBUG_CONFIGURATION)
|
||||||
`${this.akiConfig.akiVersion} - ${this.localisationService.getText("bleeding_edge_build")}` :
|
? `${this.akiConfig.akiVersion} - ${this.localisationService.getText("bleeding_edge_build")}`
|
||||||
this.akiConfig.akiVersion;
|
: this.akiConfig.akiVersion;
|
||||||
|
|
||||||
if (withEftVersion)
|
if (withEftVersion)
|
||||||
{
|
{
|
||||||
@ -130,9 +130,9 @@ export class Watermark
|
|||||||
*/
|
*/
|
||||||
public getInGameVersionLabel(): string
|
public getInGameVersionLabel(): string
|
||||||
{
|
{
|
||||||
const versionTag = (globalThis.G_DEBUG_CONFIGURATION) ?
|
const versionTag = (globalThis.G_DEBUG_CONFIGURATION)
|
||||||
`${this.akiConfig.akiVersion} - BLEEDINGEDGE` :
|
? `${this.akiConfig.akiVersion} - BLEEDINGEDGE`
|
||||||
this.akiConfig.akiVersion;
|
: this.akiConfig.akiVersion;
|
||||||
|
|
||||||
return `${this.akiConfig.projectName} ${versionTag}`;
|
return `${this.akiConfig.projectName} ${versionTag}`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user