bastion-siege-logic
Advanced tools
Comparing version 2.5.2 to 2.6.0
@@ -16,2 +16,3 @@ "use strict"; | ||
.map(o => o[resource]) | ||
// eslint-disable-next-line unicorn/no-reduce | ||
.reduce((a, b) => a + b, 0); | ||
@@ -18,0 +19,0 @@ const average = sum / reports.length; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -31,2 +31,10 @@ export declare const EMOJI: { | ||
ballista: string; | ||
sunny: string; | ||
cloudy: string; | ||
snow: string; | ||
rain: string; | ||
wetSnow: string; | ||
storm: string; | ||
stormOld: string; | ||
snowstorm: string; | ||
war: string; | ||
@@ -33,0 +41,0 @@ search: string; |
@@ -34,2 +34,10 @@ "use strict"; | ||
ballista: '⚔', | ||
sunny: '☀', | ||
cloudy: '☁', | ||
snow: '🌨', | ||
rain: '🌧', | ||
wetSnow: '🌧', | ||
storm: '🌩', | ||
stormOld: '⛈', | ||
snowstorm: '🌪', | ||
war: '⚔', | ||
@@ -36,0 +44,0 @@ search: '🔎', |
@@ -6,2 +6,3 @@ import { BattlereportRaw } from '../battlereport'; | ||
import { Player } from './player'; | ||
import { Weather } from './weather'; | ||
export interface AllianceBattleStart { | ||
@@ -83,2 +84,3 @@ readonly attack: boolean; | ||
readonly resources?: Resources; | ||
readonly weather?: Weather; | ||
readonly workshop?: Workshop; | ||
@@ -85,0 +87,0 @@ } |
@@ -44,6 +44,11 @@ "use strict"; | ||
}); | ||
return Object.assign(Object.assign(Object.assign(Object.assign({}, basicRaw), { won, | ||
return { | ||
...basicRaw, | ||
won, | ||
me, | ||
enemy, | ||
enemyAlliance }), winnersLosers), soldiers); | ||
enemyAlliance, | ||
...winnersLosers, | ||
...soldiers | ||
}; | ||
} | ||
@@ -64,6 +69,11 @@ function rawContentFromEnglish(content) { | ||
}); | ||
return Object.assign(Object.assign(Object.assign(Object.assign({}, basicRaw), { won, | ||
return { | ||
...basicRaw, | ||
won, | ||
me, | ||
enemy, | ||
enemyAlliance }), winnersLosers), soldiers); | ||
enemyAlliance, | ||
...winnersLosers, | ||
...soldiers | ||
}; | ||
} | ||
@@ -122,3 +132,10 @@ function getWinnersLosersFromAllianceAttack(content, winnersString, losersString, losersAbortStrings) { | ||
const friendsEnemies = getFriendsEnemies(raw); | ||
const battlereport = Object.assign(Object.assign({ attack, won: raw.won }, friendsEnemies), { soldiersAlive: raw.soldiersAlive, soldiersTotal: raw.soldiersTotal, gold }); | ||
const battlereport = { | ||
attack, | ||
won: raw.won, | ||
...friendsEnemies, | ||
soldiersAlive: raw.soldiersAlive, | ||
soldiersTotal: raw.soldiersTotal, | ||
gold | ||
}; | ||
if (raw.gems) { | ||
@@ -125,0 +142,0 @@ battlereport.gems = raw.gems; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const player_1 = require("./player"); | ||
const weather_1 = require("./weather"); | ||
const contentFilter = require("./helpers/content-filter"); | ||
@@ -30,3 +31,4 @@ const regexHelper = require("./helpers/regex"); | ||
player: player_1.parsePlayer(firstLine), | ||
resources: parseResources(content) | ||
resources: parseResources(content), | ||
weather: weather_1.parseWeatherFromContent(content) | ||
}; | ||
@@ -33,0 +35,0 @@ } |
@@ -18,5 +18,3 @@ "use strict"; | ||
] | ||
.map(o => Object.values(o)) | ||
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types | ||
.reduce((collector, add) => collector.concat(add), []); | ||
.flatMap(o => Object.values(o)); | ||
function parseGamescreenContent(content) { | ||
@@ -34,5 +32,9 @@ for (const parser of availableParser) { | ||
const ingameTimestamp = Math.floor(unixTimestamp / 60) * 60; | ||
return Object.assign(Object.assign({}, parseGamescreenContent(content)), { timestamp: unixTimestamp, ingameTimestamp }); | ||
return { | ||
...parseGamescreenContent(content), | ||
timestamp: unixTimestamp, | ||
ingameTimestamp | ||
}; | ||
} | ||
exports.parseGamescreen = parseGamescreen; | ||
//# sourceMappingURL=gamescreen.js.map |
@@ -6,2 +6,3 @@ "use strict"; | ||
const player_1 = require("./player"); | ||
const weather_1 = require("./weather"); | ||
const contentFilter = require("./helpers/content-filter"); | ||
@@ -51,8 +52,9 @@ const regexHelper = require("./helpers/regex"); | ||
const domainStats = getWarMenuDomainStats(content); | ||
const weather = weather_1.parseWeatherFromContent(content); | ||
const warRegex = isEnglish ? WAR_REGEX_ENGLISH : WAR_REGEX_RUSSIAN; | ||
const battle = getWarBattle(content, warRegex); | ||
if (battle) { | ||
return { type, domainStats, battle }; | ||
return { type, domainStats, weather, battle }; | ||
} | ||
return { type, domainStats }; | ||
return { type, domainStats, weather }; | ||
} | ||
@@ -59,0 +61,0 @@ exports.war = war; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -6,4 +6,3 @@ "use strict"; | ||
const mystics_1 = require("./mystics"); | ||
/* eslint @typescript-eslint/no-require-imports: "warn" */ | ||
/* eslint @typescript-eslint/no-var-requires: "warn" */ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const emojiRegex = require('emoji-tree/lib/emojiRegex'); | ||
@@ -10,0 +9,0 @@ const nameRegex = createNameRegex(); |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -63,3 +63,7 @@ "use strict"; | ||
const semitotalNeeded = Math.max(0, calcSemitotalGold(needed)); | ||
const income = calcSemitotalGoldIncome(Object.assign(Object.assign({}, buildings), { sawmill: needed.wood === 0 ? 0 : buildings.sawmill, mine: needed.stone === 0 ? 0 : buildings.mine })); | ||
const income = calcSemitotalGoldIncome({ | ||
...buildings, | ||
sawmill: needed.wood === 0 ? 0 : buildings.sawmill, | ||
mine: needed.stone === 0 ? 0 : buildings.mine | ||
}); | ||
return Math.ceil(semitotalNeeded / income); | ||
@@ -66,0 +70,0 @@ } |
{ | ||
"name": "bastion-siege-logic", | ||
"version": "2.5.2", | ||
"version": "2.6.0", | ||
"description": "", | ||
@@ -40,4 +40,4 @@ "license": "MIT", | ||
"nyc": "^15.0.0", | ||
"typescript": "^3.9.5", | ||
"xo": "^0.32.0" | ||
"typescript": "^4.0.3", | ||
"xo": "^0.33.1" | ||
}, | ||
@@ -64,3 +64,2 @@ "nyc": { | ||
"ava/no-ignored-test-files": "off", | ||
"unicorn/no-reduce": "off", | ||
"@typescript-eslint/prefer-readonly-parameter-types": "error", | ||
@@ -67,0 +66,0 @@ "@typescript-eslint/no-unnecessary-condition": "error" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
150233
87
2141