Refactor doesPlayerLevelFulfilCondition() to handle more than just >

This commit is contained in:
Dev 2023-05-22 16:00:09 +01:00
parent 87c1c80a78
commit eb445b2820

View File

@ -85,9 +85,17 @@ export class QuestHelper
switch (condition._props.compareMethod) switch (condition._props.compareMethod)
{ {
case ">=": case ">=":
return playerLevel >= condition._props.value; return playerLevel >= <number>condition._props.value;
case ">":
return playerLevel > <number>condition._props.value;
case "<":
return playerLevel < <number>condition._props.value;
case "<=":
return playerLevel <= <number>condition._props.value;
case "=":
return playerLevel === <number>condition._props.value;
default: default:
this.logger.debug(`Unrecognised Comparison Method: ${condition._props.compareMethod}`); this.logger.error(`Unrecognised Comparison Method: ${condition._props.compareMethod}`);
return false; return false;
} }
} }