mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Merge pull request #299 from p-buse/eventcheck-regexp
Added Regular Expression Event Checker
This commit is contained in:
commit
d46716eec4
2 changed files with 5 additions and 1 deletions
|
@ -12,5 +12,7 @@ module.exports.scriptMatchesEventPrereqs = scriptMatchesEventPrereqs = (script,
|
|||
return false if ap.lessThanOrEqualTo? and not (v <= ap.lessThanOrEqualTo)
|
||||
return false if ap.containingString? and v?.search(ap.containingString) == -1
|
||||
return false if ap.notContainingString? and v?.search(ap.containingString) != -1
|
||||
return false if ap.containingRegexp? and v?.search(new RegExp(ap.containingRegexp)) == -1
|
||||
return false if ap.notContainingRegexp? and v?.search(new RegExp(ap.notContainingRegexp)) != -1
|
||||
|
||||
return true
|
||||
return true
|
|
@ -20,6 +20,8 @@ EventPrereqSchema = c.object {title: "Event Prerequisite", format: 'event-prereq
|
|||
lessThanOrEqualTo: {type: 'number', title: "<=", description: "Script requires the event's property chain value to be less than or equal to this value."}
|
||||
containingString: c.shortString(title: "Contains", description: "Script requires the event's property chain value to be a string containing this string.")
|
||||
notContainingString: c.shortString(title: "Does not contain", description: "Script requires the event's property chain value to *not* be a string containing this string.")
|
||||
containingRegexp: c.shortString(title: "Contains Regexp", description: "Script requires the event's property chain value to be a string containing this regular expression.")
|
||||
notContainingRegexp: c.shortString(title: "Does not contain regexp", description: "Script requires the event's property chain value to *not* be a string containing this regular expression.")
|
||||
|
||||
GoalSchema = c.object {title: "Goal", description: "A goal that the player can accomplish.", required: ["name", "id"]},
|
||||
name: c.shortString(title: "Name", description: "Name of the goal that the player will see, like \"Defeat eighteen dragons\".")
|
||||
|
|
Loading…
Reference in a new issue