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