Make overriding labs specific code easier inside sendMail()
This commit is contained in:
parent
d519907566
commit
564fb7f4ca
@ -530,16 +530,12 @@ export class InsuranceController {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
protected sendMail(sessionID: string, insurance: IInsurance): void {
|
protected sendMail(sessionID: string, insurance: IInsurance): void {
|
||||||
const labsId = "laboratory";
|
|
||||||
// After all of the item filtering that we've done, if there are no items remaining, the insurance has
|
// After all of the item filtering that we've done, if there are no items remaining, the insurance has
|
||||||
// successfully "failed" to return anything and an appropriate message should be sent to the player.
|
// successfully "failed" to return anything and an appropriate message should be sent to the player.
|
||||||
const traderDialogMessages = this.databaseService.getTrader(insurance.traderId).dialogue;
|
const traderDialogMessages = this.databaseService.getTrader(insurance.traderId).dialogue;
|
||||||
|
|
||||||
// Map is labs + insurance is disabled in base.json
|
// Map is labs + insurance is disabled in base.json
|
||||||
if (
|
if (this.IsMapLabsAndInsuranceDisabled(insurance)) {
|
||||||
insurance.systemData?.location?.toLowerCase() === labsId &&
|
|
||||||
!this.databaseService.getLocation(labsId).base.Insurance
|
|
||||||
) {
|
|
||||||
// Trader has labs-specific messages
|
// Trader has labs-specific messages
|
||||||
// Wipe out returnable items
|
// Wipe out returnable items
|
||||||
if (traderDialogMessages.insuranceFailedLabs?.length > 0) {
|
if (traderDialogMessages.insuranceFailedLabs?.length > 0) {
|
||||||
@ -565,6 +561,14 @@ export class InsuranceController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IsMapLabsAndInsuranceDisabled(insurance: IInsurance) {
|
||||||
|
const labsId = "laboratory";
|
||||||
|
return (
|
||||||
|
insurance.systemData?.location?.toLowerCase() === labsId &&
|
||||||
|
!this.databaseService.getLocation(labsId).base.Insurance
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether an insured item should be removed from the player's inventory based on a random roll and
|
* Determines whether an insured item should be removed from the player's inventory based on a random roll and
|
||||||
* trader-specific return chance.
|
* trader-specific return chance.
|
||||||
|
Loading…
Reference in New Issue
Block a user