clashofclans.js 3.0.0-dev.392ca4c → 3.0.0-dev.5d2e14a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -47
- package/README.md +12 -8
- package/dist/client/Client.d.ts +29 -2
- package/dist/client/Client.js +14 -6
- package/dist/client/PollingClient.d.ts +106 -33
- package/dist/client/PollingClient.js +266 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.js +5 -2
- package/dist/index.mjs +2 -1
- package/dist/rest/RESTManager.d.ts +39 -4
- package/dist/rest/RESTManager.js +40 -29
- package/dist/rest/RequestHandler.d.ts +30 -2
- package/dist/rest/RequestHandler.js +12 -6
- package/dist/struct/CapitalRaidSeason.d.ts +29 -0
- package/dist/struct/CapitalRaidSeason.js +22 -0
- package/dist/struct/Clan.d.ts +1 -1
- package/dist/struct/ClanCapital.js +1 -1
- package/dist/struct/Player.d.ts +1 -1
- package/dist/struct/Ranking.d.ts +1 -1
- package/dist/struct/Unit.d.ts +0 -2
- package/dist/struct/Unit.js +0 -2
- package/dist/struct/index.js +5 -1
- package/dist/types/api.d.ts +58 -0
- package/dist/types/index.js +5 -1
- package/dist/types/lib.d.ts +4 -4
- package/dist/util/Constants.d.ts +38 -3
- package/dist/util/Constants.js +25 -6
- package/dist/util/Util.js +2 -2
- package/dist/util/raw.json +1 -1
- package/package.json +6 -59
- package/dist/client/EventManager.d.ts +0 -86
- package/dist/client/EventManager.js +0 -278
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { APICapitalRaidSeason, APICapitalRaidSeasonAttackLog, APICapitalRaidSeasonDefenseLog, APICapitalRaidSeasonMember } from '../types';
|
|
2
|
+
/** Represents a Capital Raid Season. */
|
|
3
|
+
export declare class CapitalRaidSeason {
|
|
4
|
+
/** The state of the raid season. */
|
|
5
|
+
state: 'ongoing' | 'ended';
|
|
6
|
+
/** The start time of the raid season. */
|
|
7
|
+
startTime: Date;
|
|
8
|
+
/** The end time of the raid season. */
|
|
9
|
+
endTime: Date;
|
|
10
|
+
/** The total loot collected from the capital. */
|
|
11
|
+
capitalTotalLoot: number;
|
|
12
|
+
/** The number of raids completed. */
|
|
13
|
+
raidsCompleted: number;
|
|
14
|
+
/** The total number of attacks. */
|
|
15
|
+
totalAttacks: number;
|
|
16
|
+
/** The number of enemy districts destroyed. */
|
|
17
|
+
enemyDistrictsDestroyed: number;
|
|
18
|
+
/** The offensive reward. */
|
|
19
|
+
offensiveReward: number;
|
|
20
|
+
/** The defensive reward. */
|
|
21
|
+
defensiveReward: number;
|
|
22
|
+
/** The members of the raid season. */
|
|
23
|
+
members: APICapitalRaidSeasonMember[];
|
|
24
|
+
/** The attack log of the raid season. */
|
|
25
|
+
attackLog: APICapitalRaidSeasonAttackLog[];
|
|
26
|
+
/** The defense log of the raid season. */
|
|
27
|
+
defenseLog: APICapitalRaidSeasonDefenseLog[];
|
|
28
|
+
constructor(data: APICapitalRaidSeason);
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CapitalRaidSeason = void 0;
|
|
4
|
+
const Util_1 = require("../util/Util");
|
|
5
|
+
/** Represents a Capital Raid Season. */
|
|
6
|
+
class CapitalRaidSeason {
|
|
7
|
+
constructor(data) {
|
|
8
|
+
this.state = data.state;
|
|
9
|
+
this.startTime = Util_1.Util.formatDate(data.startTime);
|
|
10
|
+
this.endTime = Util_1.Util.formatDate(data.endTime);
|
|
11
|
+
this.capitalTotalLoot = data.capitalTotalLoot;
|
|
12
|
+
this.raidsCompleted = data.raidsCompleted;
|
|
13
|
+
this.totalAttacks = data.totalAttacks;
|
|
14
|
+
this.enemyDistrictsDestroyed = data.enemyDistrictsDestroyed;
|
|
15
|
+
this.offensiveReward = data.offensiveReward;
|
|
16
|
+
this.defensiveReward = data.defensiveReward;
|
|
17
|
+
this.members = data.members ?? [];
|
|
18
|
+
this.attackLog = data.attackLog;
|
|
19
|
+
this.defenseLog = data.defenseLog;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.CapitalRaidSeason = CapitalRaidSeason;
|
package/dist/struct/Clan.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIClan, OverrideOptions } from '../types';
|
|
2
|
+
import { Client } from '../client/Client';
|
|
2
3
|
import { ChatLanguage } from './ChatLanguage';
|
|
3
4
|
import { ClanMember } from './ClanMember';
|
|
4
|
-
import { Client } from '../client/Client';
|
|
5
5
|
import { WarLeague } from './WarLeague';
|
|
6
6
|
import type { Player } from './Player';
|
|
7
7
|
import { Location } from './Location';
|
|
@@ -4,7 +4,7 @@ exports.ClanCapital = void 0;
|
|
|
4
4
|
class ClanCapital {
|
|
5
5
|
constructor(data) {
|
|
6
6
|
this.capitalHallLevel = data.capitalHallLevel ?? null;
|
|
7
|
-
this.districts = data.districts
|
|
7
|
+
this.districts = data.districts ?? null;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.ClanCapital = ClanCapital;
|
package/dist/struct/Player.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { APIPlayer, OverrideOptions } from '../types';
|
|
2
|
+
import { Client } from '../client/Client';
|
|
2
3
|
import { LegendStatistics } from './LegendStatistics';
|
|
3
4
|
import { Achievement } from './Achievement';
|
|
4
5
|
import { Hero, Spell, Troop } from './Unit';
|
|
5
6
|
import { PlayerClan } from './PlayerClan';
|
|
6
|
-
import { Client } from '../client/Client';
|
|
7
7
|
import { League } from './League';
|
|
8
8
|
import { Label } from './Label';
|
|
9
9
|
/** Represents a Clash of Clans Player. */
|
package/dist/struct/Ranking.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIClanRanking, APIClanVersusRanking, APIPlayerRanking, APIPlayerVersusRanking } from '../types';
|
|
2
|
-
import { PlayerClan } from './PlayerClan';
|
|
3
2
|
import { Client } from '../client/Client';
|
|
3
|
+
import { PlayerClan } from './PlayerClan';
|
|
4
4
|
import { Location } from './Location';
|
|
5
5
|
import { League } from './League';
|
|
6
6
|
import { Badge } from './Badge';
|
package/dist/struct/Unit.d.ts
CHANGED
package/dist/struct/Unit.js
CHANGED
|
@@ -25,7 +25,6 @@ class Unit {
|
|
|
25
25
|
this.unlockBuilding = original.unlock.building;
|
|
26
26
|
this.unlockBuildingLevel = original.unlock.buildingLevel;
|
|
27
27
|
this.dps = rawUnit.dps[this.level - 1];
|
|
28
|
-
this.resourceType = rawSuperUnit.resource;
|
|
29
28
|
this.trainingTime = rawUnit.trainingTime;
|
|
30
29
|
const origin = data.troops.find((troop) => troop.village === 'home' && troop.name === original.name);
|
|
31
30
|
this.level = origin.level;
|
|
@@ -49,7 +48,6 @@ class Unit {
|
|
|
49
48
|
this.upgradeCost = rawUnit.upgrade.cost[this.level - 1] ?? 0;
|
|
50
49
|
this.upgradeTime = rawUnit.upgrade.time[this.level - 1] ?? 0;
|
|
51
50
|
this.dps = rawUnit.dps[this.level - 1];
|
|
52
|
-
this.resourceType = rawUnit.resourceType;
|
|
53
51
|
this.trainingTime = rawUnit.trainingTime;
|
|
54
52
|
if (rawUnit.category === 'hero')
|
|
55
53
|
this.regenerationTime = rawUnit.regenerationTimes[this.level - 1];
|
package/dist/struct/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/types/api.d.ts
CHANGED
|
@@ -169,6 +169,64 @@ export interface APIClanWarLeagueClanMember {
|
|
|
169
169
|
export interface APIClanWarLeagueRound {
|
|
170
170
|
warTags: string[];
|
|
171
171
|
}
|
|
172
|
+
export interface APICapitalRaidSeason {
|
|
173
|
+
state: 'ongoing' | 'ended';
|
|
174
|
+
startTime: string;
|
|
175
|
+
endTime: string;
|
|
176
|
+
capitalTotalLoot: number;
|
|
177
|
+
raidsCompleted: number;
|
|
178
|
+
totalAttacks: number;
|
|
179
|
+
enemyDistrictsDestroyed: number;
|
|
180
|
+
offensiveReward: number;
|
|
181
|
+
defensiveReward: number;
|
|
182
|
+
members?: APICapitalRaidSeasonMember[];
|
|
183
|
+
attackLog: APICapitalRaidSeasonAttackLog[];
|
|
184
|
+
defenseLog: APICapitalRaidSeasonDefenseLog[];
|
|
185
|
+
}
|
|
186
|
+
export interface APICapitalRaidSeasonMember {
|
|
187
|
+
tag: string;
|
|
188
|
+
name: string;
|
|
189
|
+
attacks: number;
|
|
190
|
+
attackLimit: number;
|
|
191
|
+
bonusAttackLimit: number;
|
|
192
|
+
capitalResourcesLooted: number;
|
|
193
|
+
}
|
|
194
|
+
export interface APICapitalRaidSeasonClan {
|
|
195
|
+
tag: string;
|
|
196
|
+
name: string;
|
|
197
|
+
level: number;
|
|
198
|
+
badgeUrls: {
|
|
199
|
+
small: string;
|
|
200
|
+
large: string;
|
|
201
|
+
medium: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export interface APICapitalRaidSeasonDistrict {
|
|
205
|
+
id: number;
|
|
206
|
+
name: string;
|
|
207
|
+
districtHallLevel: number;
|
|
208
|
+
destructionPercent: number;
|
|
209
|
+
attackCount: number;
|
|
210
|
+
totalLooted: number;
|
|
211
|
+
}
|
|
212
|
+
export interface APICapitalRaidSeasonAttackLog {
|
|
213
|
+
defender: APICapitalRaidSeasonClan;
|
|
214
|
+
attackCount: 27;
|
|
215
|
+
districtCount: 7;
|
|
216
|
+
districtsDestroyed: 7;
|
|
217
|
+
districts: APICapitalRaidSeasonDistrict[];
|
|
218
|
+
}
|
|
219
|
+
export interface APICapitalRaidSeasonDefenseLog {
|
|
220
|
+
attacker: APICapitalRaidSeasonClan;
|
|
221
|
+
attackCount: 27;
|
|
222
|
+
districtCount: 7;
|
|
223
|
+
districtsDestroyed: 7;
|
|
224
|
+
districts: APICapitalRaidSeasonDistrict[];
|
|
225
|
+
}
|
|
226
|
+
export interface APICapitalRaidSeasons {
|
|
227
|
+
items: APICapitalRaidSeason[];
|
|
228
|
+
paging: APIPaging;
|
|
229
|
+
}
|
|
172
230
|
/** /players/{playerTag} */
|
|
173
231
|
export interface APIPlayer {
|
|
174
232
|
name: string;
|
package/dist/types/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/types/lib.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { QueueThrottler, BatchThrottler } from '../rest/Throttler';
|
|
2
2
|
export interface Store<T = any> {
|
|
3
|
-
set(key: string, value: T, ttl?: number)
|
|
4
|
-
get(key: string)
|
|
5
|
-
delete(key: string)
|
|
6
|
-
clear()
|
|
3
|
+
set: (key: string, value: T, ttl?: number) => boolean | Promise<boolean>;
|
|
4
|
+
get: (key: string) => T | null | Promise<T | null>;
|
|
5
|
+
delete: (key: string) => boolean | Promise<boolean>;
|
|
6
|
+
clear: () => void | Promise<void>;
|
|
7
7
|
}
|
|
8
8
|
/** Options for a {@link Client} */
|
|
9
9
|
export interface ClientOptions {
|
package/dist/util/Constants.d.ts
CHANGED
|
@@ -24,25 +24,60 @@ export declare const Leagues: number[];
|
|
|
24
24
|
export declare const WarLeagues: number[];
|
|
25
25
|
export declare const FriendlyWarPreparationTimes: readonly [number, number, number, number, number, number, number, number, number, number, number, number];
|
|
26
26
|
export declare const PollingEvents: {
|
|
27
|
-
readonly NewSeasonStart: "newSeasonStart";
|
|
28
27
|
readonly ClanLoopStart: "clanLoopStart";
|
|
29
28
|
readonly ClanLoopEnd: "clanLoopEnd";
|
|
30
29
|
readonly PlayerLoopStart: "playerLoopStart";
|
|
31
30
|
readonly PlayerLoopEnd: "playerLoopEnd";
|
|
32
31
|
readonly WarLoopStart: "warLoopEnd";
|
|
33
32
|
readonly WarLoopEnd: "warLoopEnd";
|
|
33
|
+
readonly NewSeasonStart: "newSeasonStart";
|
|
34
34
|
readonly MaintenanceStart: "maintenanceStart";
|
|
35
35
|
readonly MaintenanceEnd: "maintenanceEnd";
|
|
36
36
|
readonly Error: "error";
|
|
37
37
|
readonly Debug: "debug";
|
|
38
38
|
};
|
|
39
|
+
export declare const ClientEvents: {
|
|
40
|
+
readonly Error: "error";
|
|
41
|
+
readonly Debug: "debug";
|
|
42
|
+
};
|
|
43
|
+
export declare const RestEvents: {
|
|
44
|
+
readonly Error: "error";
|
|
45
|
+
readonly Debug: "debug";
|
|
46
|
+
readonly RateLimited: "rateLimited";
|
|
47
|
+
};
|
|
39
48
|
export declare const CWLRounds: {
|
|
40
49
|
readonly PreviousRound: "warEnded";
|
|
41
50
|
readonly CurrentRound: "inWar";
|
|
42
51
|
readonly NextRound: "preparation";
|
|
43
52
|
};
|
|
44
53
|
export declare const RawData: {
|
|
45
|
-
RawUnits: {
|
|
54
|
+
RawUnits: ({
|
|
55
|
+
id: number;
|
|
56
|
+
name: string;
|
|
57
|
+
housingSpace: number;
|
|
58
|
+
village: string;
|
|
59
|
+
category: string;
|
|
60
|
+
subCategory: string;
|
|
61
|
+
unlock: {
|
|
62
|
+
hall: number;
|
|
63
|
+
cost: number;
|
|
64
|
+
time: number;
|
|
65
|
+
resource: string;
|
|
66
|
+
building: string;
|
|
67
|
+
buildingLevel: number;
|
|
68
|
+
};
|
|
69
|
+
trainingTime: number;
|
|
70
|
+
regenerationTimes: number[];
|
|
71
|
+
dps: number[];
|
|
72
|
+
upgrade: {
|
|
73
|
+
cost: number[];
|
|
74
|
+
time: number[];
|
|
75
|
+
resource: string;
|
|
76
|
+
};
|
|
77
|
+
seasonal: boolean;
|
|
78
|
+
levels: number[];
|
|
79
|
+
resourceType?: undefined;
|
|
80
|
+
} | {
|
|
46
81
|
id: number;
|
|
47
82
|
name: string;
|
|
48
83
|
housingSpace: number;
|
|
@@ -68,7 +103,7 @@ export declare const RawData: {
|
|
|
68
103
|
};
|
|
69
104
|
seasonal: boolean;
|
|
70
105
|
levels: number[];
|
|
71
|
-
}[];
|
|
106
|
+
})[];
|
|
72
107
|
RawSuperUnits: {
|
|
73
108
|
name: string;
|
|
74
109
|
id: number;
|
package/dist/util/Constants.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RawData = exports.CWLRounds = exports.PollingEvents = exports.FriendlyWarPreparationTimes = exports.WarLeagues = exports.Leagues = exports.LegendLeagueId = exports.UnrankedLeagueData = exports.HeroPets = exports.Heroes = exports.BuilderTroops = exports.Spells = exports.DarkElixirSpells = exports.ElixirSpells = exports.SuperTroops = exports.SiegeMachines = exports.HomeTroops = exports.DarkElixirTroops = exports.ElixirTroops = exports.DevSiteAPIBaseURL = exports.APIBaseURL = void 0;
|
|
6
|
+
exports.RawData = exports.CWLRounds = exports.RestEvents = exports.ClientEvents = exports.PollingEvents = exports.FriendlyWarPreparationTimes = exports.WarLeagues = exports.Leagues = exports.LegendLeagueId = exports.UnrankedLeagueData = exports.HeroPets = exports.Heroes = exports.BuilderTroops = exports.Spells = exports.DarkElixirSpells = exports.ElixirSpells = exports.SuperTroops = exports.SiegeMachines = exports.HomeTroops = exports.DarkElixirTroops = exports.ElixirTroops = exports.DevSiteAPIBaseURL = exports.APIBaseURL = void 0;
|
|
7
7
|
const raw_json_1 = __importDefault(require("../util/raw.json"));
|
|
8
8
|
exports.APIBaseURL = 'https://api.clashofclans.com/v1';
|
|
9
9
|
exports.DevSiteAPIBaseURL = 'https://developer.clashofclans.com/api';
|
|
@@ -22,11 +22,20 @@ exports.ElixirTroops = [
|
|
|
22
22
|
'Miner',
|
|
23
23
|
'Electro Dragon',
|
|
24
24
|
'Yeti',
|
|
25
|
-
'Dragon Rider'
|
|
25
|
+
'Dragon Rider',
|
|
26
|
+
'Electro Titan'
|
|
26
27
|
];
|
|
27
28
|
exports.DarkElixirTroops = ['Minion', 'Hog Rider', 'Valkyrie', 'Golem', 'Witch', 'Lava Hound', 'Bowler', 'Ice Golem', 'Headhunter'];
|
|
28
29
|
exports.HomeTroops = [...exports.ElixirTroops, ...exports.DarkElixirTroops];
|
|
29
|
-
exports.SiegeMachines = [
|
|
30
|
+
exports.SiegeMachines = [
|
|
31
|
+
'Wall Wrecker',
|
|
32
|
+
'Battle Blimp',
|
|
33
|
+
'Stone Slammer',
|
|
34
|
+
'Siege Barracks',
|
|
35
|
+
'Log Launcher',
|
|
36
|
+
'Flame Flinger',
|
|
37
|
+
'Battle Drill'
|
|
38
|
+
];
|
|
30
39
|
exports.SuperTroops = [
|
|
31
40
|
'Super Barbarian',
|
|
32
41
|
'Super Archer',
|
|
@@ -50,7 +59,8 @@ exports.ElixirSpells = [
|
|
|
50
59
|
'Jump Spell',
|
|
51
60
|
'Freeze Spell',
|
|
52
61
|
'Clone Spell',
|
|
53
|
-
'Invisibility Spell'
|
|
62
|
+
'Invisibility Spell',
|
|
63
|
+
'Recall Spell'
|
|
54
64
|
];
|
|
55
65
|
exports.DarkElixirSpells = ['Poison Spell', 'Earthquake Spell', 'Haste Spell', 'Skeleton Spell', 'Bat Spell'];
|
|
56
66
|
exports.Spells = [...exports.ElixirSpells, ...exports.DarkElixirSpells];
|
|
@@ -68,7 +78,7 @@ exports.BuilderTroops = [
|
|
|
68
78
|
'Hog Glider'
|
|
69
79
|
];
|
|
70
80
|
exports.Heroes = ['Barbarian King', 'Archer Queen', 'Grand Warden', 'Royal Champion', 'Battle Machine'];
|
|
71
|
-
exports.HeroPets = ['L.A.S.S.I', 'Electro Owl', 'Mighty Yak', 'Unicorn'];
|
|
81
|
+
exports.HeroPets = ['L.A.S.S.I', 'Electro Owl', 'Mighty Yak', 'Unicorn', 'Poison Lizard', 'Diggy', 'Frosty', 'Phoenix'];
|
|
72
82
|
exports.UnrankedLeagueData = {
|
|
73
83
|
id: 29000000,
|
|
74
84
|
name: 'Unranked',
|
|
@@ -122,18 +132,27 @@ exports.FriendlyWarPreparationTimes = [
|
|
|
122
132
|
1000 * 60 * 5
|
|
123
133
|
];
|
|
124
134
|
exports.PollingEvents = {
|
|
125
|
-
NewSeasonStart: 'newSeasonStart',
|
|
126
135
|
ClanLoopStart: 'clanLoopStart',
|
|
127
136
|
ClanLoopEnd: 'clanLoopEnd',
|
|
128
137
|
PlayerLoopStart: 'playerLoopStart',
|
|
129
138
|
PlayerLoopEnd: 'playerLoopEnd',
|
|
130
139
|
WarLoopStart: 'warLoopEnd',
|
|
131
140
|
WarLoopEnd: 'warLoopEnd',
|
|
141
|
+
NewSeasonStart: 'newSeasonStart',
|
|
132
142
|
MaintenanceStart: 'maintenanceStart',
|
|
133
143
|
MaintenanceEnd: 'maintenanceEnd',
|
|
134
144
|
Error: 'error',
|
|
135
145
|
Debug: 'debug'
|
|
136
146
|
};
|
|
147
|
+
exports.ClientEvents = {
|
|
148
|
+
Error: 'error',
|
|
149
|
+
Debug: 'debug'
|
|
150
|
+
};
|
|
151
|
+
exports.RestEvents = {
|
|
152
|
+
Error: 'error',
|
|
153
|
+
Debug: 'debug',
|
|
154
|
+
RateLimited: 'rateLimited'
|
|
155
|
+
};
|
|
137
156
|
exports.CWLRounds = {
|
|
138
157
|
PreviousRound: 'warEnded',
|
|
139
158
|
CurrentRound: 'inWar',
|
package/dist/util/Util.js
CHANGED
|
@@ -114,8 +114,8 @@ class Util extends null {
|
|
|
114
114
|
}
|
|
115
115
|
/** Parse in-game army link into troops and spells count with respective Id's. */
|
|
116
116
|
static parseArmyLink(link) {
|
|
117
|
-
const unitsMatches =
|
|
118
|
-
const spellsMatches =
|
|
117
|
+
const unitsMatches = /u(?<units>[\d+x-]+)/.exec(link);
|
|
118
|
+
const spellsMatches = /s(?<spells>[\d+x-]+)/.exec(link);
|
|
119
119
|
const unitsPart = unitsMatches?.groups?.unit?.split('-') ?? [];
|
|
120
120
|
const spellParts = spellsMatches?.groups?.spells?.split('-') ?? [];
|
|
121
121
|
const units = unitsPart
|