Prevent giving player 0 intellet as reward after repairing item
This commit is contained in:
parent
73cfc16699
commit
2cebf5f2ee
@ -147,6 +147,7 @@ export class RepairService
|
|||||||
*/
|
*/
|
||||||
public addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData): void
|
public addRepairSkillPoints(sessionId: string, repairDetails: RepairDetails, pmcData: IPmcData): void
|
||||||
{
|
{
|
||||||
|
// Handle kit repair of weapon
|
||||||
if (
|
if (
|
||||||
repairDetails.repairedByKit
|
repairDetails.repairedByKit
|
||||||
&& this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON)
|
&& this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON)
|
||||||
@ -160,7 +161,7 @@ export class RepairService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle kit repairs of armor
|
// Handle kit repair of armor
|
||||||
if (
|
if (
|
||||||
repairDetails.repairedByKit
|
repairDetails.repairedByKit
|
||||||
&& this.itemHelper.isOfBaseclasses(repairDetails.repairedItem._tpl, [BaseClasses.ARMOR, BaseClasses.VEST])
|
&& this.itemHelper.isOfBaseclasses(repairDetails.repairedItem._tpl, [BaseClasses.ARMOR, BaseClasses.VEST])
|
||||||
@ -189,16 +190,25 @@ export class RepairService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle giving INT to player - differs if using kit/trader and weapon vs armor
|
// Handle giving INT to player - differs if using kit/trader and weapon vs armor
|
||||||
let intellectGainedFromRepair: number;
|
const intellectGainedFromRepair = this.getIntellectGainedFromRepair(repairDetails);
|
||||||
|
if (intellectGainedFromRepair > 0)
|
||||||
|
{
|
||||||
|
this.profileHelper.addSkillPointsToPlayer(pmcData, SkillTypes.INTELLECT, intellectGainedFromRepair);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getIntellectGainedFromRepair(repairDetails: RepairDetails): number
|
||||||
|
{
|
||||||
if (repairDetails.repairedByKit)
|
if (repairDetails.repairedByKit)
|
||||||
{
|
{
|
||||||
|
// Weapons/armor have different multipliers
|
||||||
const intRepairMultiplier =
|
const intRepairMultiplier =
|
||||||
(this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON))
|
(this.itemHelper.isOfBaseclass(repairDetails.repairedItem._tpl, BaseClasses.WEAPON))
|
||||||
? this.repairConfig.repairKitIntellectGainMultiplier.weapon
|
? this.repairConfig.repairKitIntellectGainMultiplier.weapon
|
||||||
: this.repairConfig.repairKitIntellectGainMultiplier.armor;
|
: this.repairConfig.repairKitIntellectGainMultiplier.armor;
|
||||||
|
|
||||||
// limit gain to a max value defined in config.maxIntellectGainPerRepair
|
// Limit gain to a max value defined in config.maxIntellectGainPerRepair
|
||||||
intellectGainedFromRepair = Math.min(
|
return Math.min(
|
||||||
repairDetails.repairPoints * intRepairMultiplier,
|
repairDetails.repairPoints * intRepairMultiplier,
|
||||||
this.repairConfig.maxIntellectGainPerRepair.kit,
|
this.repairConfig.maxIntellectGainPerRepair.kit,
|
||||||
);
|
);
|
||||||
@ -206,13 +216,11 @@ export class RepairService
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Trader repair - Not as accurate as kit, needs data from live
|
// Trader repair - Not as accurate as kit, needs data from live
|
||||||
intellectGainedFromRepair = Math.min(
|
return Math.min(
|
||||||
repairDetails.repairAmount / 10,
|
repairDetails.repairAmount / 10,
|
||||||
this.repairConfig.maxIntellectGainPerRepair.trader,
|
this.repairConfig.maxIntellectGainPerRepair.trader,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.profileHelper.addSkillPointsToPlayer(pmcData, SkillTypes.INTELLECT, intellectGainedFromRepair);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user