bastion-siege-logic
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -15,5 +15,7 @@ "use strict"; | ||
function allianceBattleStart(content) { | ||
if (contentFilter.includesAll(content, 'Your ally ', ' attacked ', ' help ')) { | ||
const defenceMatch = /Your ally (.+) was attacked by (.+) from /.exec(content); | ||
const attackMatch = /Your ally (.+) attacked (.+) from /.exec(content); | ||
if (contentFilter.includesAll(content, 'Your ally ', ' attacked ')) { | ||
const indexOf = content.indexOf(' from '); | ||
const shortenedContent = indexOf < 0 ? content : content.slice(0, indexOf); | ||
const defenceMatch = /Your ally (.+) was attacked by (.+)/.exec(shortenedContent); | ||
const attackMatch = /Your ally (.+) attacked (.+)/.exec(shortenedContent); | ||
const allyMatch = defenceMatch ? defenceMatch : attackMatch; | ||
@@ -32,7 +34,9 @@ const enemyMatch = defenceMatch ? defenceMatch : attackMatch; | ||
} | ||
if (contentFilter.includesAll(content, ' союзник', ' атаковал ', ' Ты можешь ')) { | ||
const regex = /союзник.? (.+) атаковал (.+) из /; | ||
const attack = /атаке/.test(content); | ||
const ally = regexHelper.getPlayer(content, regex, 1); | ||
const enemy = regexHelper.getPlayer(content, regex, 2); | ||
if (contentFilter.includesAll(content, ' союзник', ' атаковал ')) { | ||
const indexOf = content.indexOf(' из '); | ||
const shortenedContent = indexOf < 0 ? content : content.slice(0, indexOf); | ||
const regex = /союзник.? (.+) атаковал (.+)$/; | ||
const attack = /Твой/.test(content); | ||
const ally = regexHelper.getPlayer(shortenedContent, regex, 1); | ||
const enemy = regexHelper.getPlayer(shortenedContent, regex, 2); | ||
return { allianceBattleStart: { | ||
@@ -93,3 +97,3 @@ attack, | ||
if (isEnglish || isRussian) { | ||
const karma = regexHelper.getNumberStrict(content, `(\\d+)${emoji_1.EMOJI.karma}`); | ||
const karma = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.karma}`) || 0; | ||
const terra = regexHelper.getNumberStrict(content, `(\\d+)${emoji_1.EMOJI.terra}`); | ||
@@ -96,0 +100,0 @@ if (isEnglish) { |
{ | ||
"name": "bastion-siege-logic", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "", | ||
@@ -41,3 +41,3 @@ "license": "MIT", | ||
"eslint-config-xo-typescript": "^0.9.0", | ||
"nyc": "^13.3.0", | ||
"nyc": "^14.0.0", | ||
"ts-node": "^8.0.2", | ||
@@ -44,0 +44,0 @@ "typescript": "^3.4.2", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110583
1557