clashofclans.js 1.5.4 → 2.0.0-dev.2c5b083
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 +17 -0
- package/LICENSE +2 -1
- package/README.md +39 -110
- package/dist/client/Client.d.ts +177 -0
- package/dist/client/Client.js +237 -0
- package/dist/client/EventManager.d.ts +86 -0
- package/dist/client/EventManager.js +279 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +21 -0
- package/dist/rest/HTTPError.d.ts +24 -0
- package/dist/rest/HTTPError.js +42 -0
- package/dist/rest/RESTManager.d.ts +56 -0
- package/dist/rest/RESTManager.js +123 -0
- package/dist/rest/RequestHandler.d.ts +162 -0
- package/dist/rest/RequestHandler.js +198 -0
- package/dist/rest/Throttler.d.ts +31 -0
- package/dist/rest/Throttler.js +86 -0
- package/dist/struct/Achievement.d.ts +25 -0
- package/dist/struct/Achievement.js +28 -0
- package/dist/struct/Badge.d.ts +16 -0
- package/dist/struct/Badge.js +27 -0
- package/dist/struct/ChatLanguage.d.ts +11 -0
- package/dist/struct/ChatLanguage.js +12 -0
- package/dist/struct/Clan.d.ts +64 -0
- package/dist/struct/Clan.js +44 -0
- package/dist/struct/ClanMember.d.ts +32 -0
- package/dist/struct/ClanMember.js +28 -0
- package/dist/struct/ClanWar.d.ts +137 -0
- package/dist/struct/ClanWar.js +198 -0
- package/dist/struct/ClanWarLeagueGroup.d.ts +63 -0
- package/dist/struct/ClanWarLeagueGroup.js +85 -0
- package/dist/struct/ClanWarLog.d.ts +54 -0
- package/dist/struct/ClanWarLog.js +46 -0
- package/dist/struct/Icon.d.ts +16 -0
- package/dist/struct/Icon.js +27 -0
- package/dist/struct/Label.d.ts +12 -0
- package/dist/struct/Label.js +13 -0
- package/dist/struct/League.d.ts +14 -0
- package/dist/struct/League.js +18 -0
- package/dist/struct/LegendStatistics.d.ts +18 -0
- package/dist/struct/LegendStatistics.js +17 -0
- package/dist/struct/Location.d.ts +15 -0
- package/dist/struct/Location.js +14 -0
- package/dist/struct/Player.d.ts +78 -0
- package/dist/struct/Player.js +72 -0
- package/dist/struct/PlayerClan.d.ts +19 -0
- package/dist/struct/PlayerClan.js +19 -0
- package/dist/struct/Ranking.d.ts +58 -0
- package/dist/struct/Ranking.js +50 -0
- package/dist/struct/Season.d.ts +19 -0
- package/dist/struct/Season.js +21 -0
- package/dist/struct/Unit.d.ts +68 -0
- package/dist/struct/Unit.js +90 -0
- package/dist/struct/WarLeague.d.ts +11 -0
- package/dist/struct/WarLeague.js +16 -0
- package/dist/struct/index.d.ts +19 -0
- package/dist/struct/index.js +31 -0
- package/dist/types/index.d.ts +350 -0
- package/dist/types/index.js +2 -0
- package/dist/util/Constants.d.ts +41 -0
- package/dist/util/Constants.js +122 -0
- package/dist/util/Util.d.ts +18 -0
- package/dist/util/Util.js +53 -0
- package/dist/util/raw.json +1 -0
- package/package.json +109 -36
- package/src/index.d.ts +0 -811
- package/src/index.js +0 -5
- package/src/struct/Client.js +0 -481
- package/src/util/Extension.js +0 -130
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Hero = exports.Spell = exports.Troop = exports.Unit = void 0;
|
|
4
|
+
const raw_json_1 = require("../util/raw.json");
|
|
5
|
+
const Constants_1 = require("../util/Constants");
|
|
6
|
+
/** Represents a player's unit. */
|
|
7
|
+
class Unit {
|
|
8
|
+
// #endregion static
|
|
9
|
+
constructor(data, unit) {
|
|
10
|
+
this.name = unit.name;
|
|
11
|
+
this.level = unit.level;
|
|
12
|
+
this.maxLevel = unit.maxLevel;
|
|
13
|
+
this.village = unit.village;
|
|
14
|
+
const rawSuperUnit = raw_json_1.RAW_SUPER_UNITS.find((unit) => unit.name === this.name && this.isHomeBase);
|
|
15
|
+
const rawUnit = raw_json_1.RAW_UNITS.find((unit) => unit.name === this.name && unit.village === this.village);
|
|
16
|
+
if (rawSuperUnit) {
|
|
17
|
+
this.id = rawSuperUnit.id;
|
|
18
|
+
this.housingSpace = rawSuperUnit.housingSpace;
|
|
19
|
+
this.originalName = rawSuperUnit.original;
|
|
20
|
+
this.minOriginalLevel = rawSuperUnit.minOriginalLevel;
|
|
21
|
+
const original = raw_json_1.RAW_UNITS.find((unit) => unit.village === 'home' && unit.name === rawSuperUnit.original);
|
|
22
|
+
this.unlockHallLevel = original.levels.findIndex((level) => level >= rawSuperUnit.minOriginalLevel) + 1;
|
|
23
|
+
this.unlockCost = original.unlock.cost;
|
|
24
|
+
this.unlockTime = original.unlock.time;
|
|
25
|
+
this.unlockResource = original.unlock.resource;
|
|
26
|
+
this.unlockBuilding = original.unlock.building;
|
|
27
|
+
this.unlockBuildingLevel = original.unlock.buildingLevel;
|
|
28
|
+
const origin = data.troops.find((troop) => troop.village === 'home' && troop.name === original.name);
|
|
29
|
+
this.level = origin.level;
|
|
30
|
+
this.maxLevel = origin.maxLevel;
|
|
31
|
+
this.upgradeCost = original.upgrade.cost[origin.level - 1] ?? 0;
|
|
32
|
+
this.upgradeResource = original.upgrade.resource;
|
|
33
|
+
this.upgradeTime = original.upgrade.time[origin.level - 1] ?? 0;
|
|
34
|
+
this.hallMaxLevel = original.levels[data.townHallLevel - 1];
|
|
35
|
+
}
|
|
36
|
+
if (rawUnit) {
|
|
37
|
+
this.id = rawUnit.id;
|
|
38
|
+
this.housingSpace = rawUnit.housingSpace;
|
|
39
|
+
this.unlockCost = rawUnit.unlock.cost;
|
|
40
|
+
this.unlockTime = rawUnit.unlock.time;
|
|
41
|
+
this.unlockResource = rawUnit.unlock.resource;
|
|
42
|
+
this.unlockBuilding = rawUnit.unlock.building;
|
|
43
|
+
this.unlockHallLevel = rawUnit.unlock.hall;
|
|
44
|
+
this.unlockBuildingLevel = rawUnit.unlock.buildingLevel;
|
|
45
|
+
this.upgradeResource = rawUnit.upgrade.resource;
|
|
46
|
+
this.upgradeCost = rawUnit.upgrade.cost[this.level - 1] ?? 0;
|
|
47
|
+
this.upgradeTime = rawUnit.upgrade.time[this.level - 1] ?? 0;
|
|
48
|
+
this.hallMaxLevel = rawUnit.levels[(this.village === 'home' ? data.townHallLevel : data.builderHallLevel) - 1];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Whether the unit belongs to the home base. */
|
|
52
|
+
get isHomeBase() {
|
|
53
|
+
return this.village === 'home';
|
|
54
|
+
}
|
|
55
|
+
/** Whether the unit belongs to the builder base. */
|
|
56
|
+
get isBuilderBase() {
|
|
57
|
+
return this.village === 'builderBase';
|
|
58
|
+
}
|
|
59
|
+
/** Whether the unit is at max level. */
|
|
60
|
+
get isMax() {
|
|
61
|
+
return this.level === this.maxLevel;
|
|
62
|
+
}
|
|
63
|
+
/** Icon of this unit. */
|
|
64
|
+
get iconURL() {
|
|
65
|
+
return `https://supercell.vercel.app/assets/troops/icons/${this.name.replace(/ /gi, '_')}.png`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.Unit = Unit;
|
|
69
|
+
/** Represents a player's troop. */
|
|
70
|
+
class Troop extends Unit {
|
|
71
|
+
constructor(data, unit) {
|
|
72
|
+
super(data, unit);
|
|
73
|
+
this.originalName = this.originalName ?? null;
|
|
74
|
+
this.isActive = unit.superTroopIsActive ?? false;
|
|
75
|
+
this.minOriginalLevel = this.minOriginalLevel ?? null;
|
|
76
|
+
}
|
|
77
|
+
/** Whether this troop is a Super Troop. */
|
|
78
|
+
get isSuperTroop() {
|
|
79
|
+
return this.isActive || (this.isHomeBase && Constants_1.SUPER_TROOPS.includes(this.name));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.Troop = Troop;
|
|
83
|
+
/** Represents a player's spell. */
|
|
84
|
+
class Spell extends Unit {
|
|
85
|
+
}
|
|
86
|
+
exports.Spell = Spell;
|
|
87
|
+
/** Represents a player's hero. */
|
|
88
|
+
class Hero extends Unit {
|
|
89
|
+
}
|
|
90
|
+
exports.Hero = Hero;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { APIWarLeague } from '../types';
|
|
2
|
+
/** Represents a Clan's War League. */
|
|
3
|
+
export declare class WarLeague {
|
|
4
|
+
/** The league's unique Id. */
|
|
5
|
+
id: number;
|
|
6
|
+
/** The league's name. */
|
|
7
|
+
name: string;
|
|
8
|
+
constructor(data: APIWarLeague);
|
|
9
|
+
/** Position of this War League. Starting from 0 (Unranked) */
|
|
10
|
+
get position(): number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarLeague = void 0;
|
|
4
|
+
const Constants_1 = require("../util/Constants");
|
|
5
|
+
/** Represents a Clan's War League. */
|
|
6
|
+
class WarLeague {
|
|
7
|
+
constructor(data) {
|
|
8
|
+
this.id = data.id;
|
|
9
|
+
this.name = data.name;
|
|
10
|
+
}
|
|
11
|
+
/** Position of this War League. Starting from 0 (Unranked) */
|
|
12
|
+
get position() {
|
|
13
|
+
return Constants_1.WAR_LEAGUES.indexOf(this.id);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.WarLeague = WarLeague;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from './Achievement';
|
|
2
|
+
export * from './Badge';
|
|
3
|
+
export * from './ChatLanguage';
|
|
4
|
+
export * from './Clan';
|
|
5
|
+
export * from './ClanMember';
|
|
6
|
+
export * from './ClanWar';
|
|
7
|
+
export * from './ClanWarLog';
|
|
8
|
+
export * from './ClanWarLeagueGroup';
|
|
9
|
+
export * from './Icon';
|
|
10
|
+
export * from './Label';
|
|
11
|
+
export * from './League';
|
|
12
|
+
export * from './LegendStatistics';
|
|
13
|
+
export * from './Location';
|
|
14
|
+
export * from './Player';
|
|
15
|
+
export * from './PlayerClan';
|
|
16
|
+
export * from './Ranking';
|
|
17
|
+
export * from './Season';
|
|
18
|
+
export * from './Unit';
|
|
19
|
+
export * from './WarLeague';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Achievement"), exports);
|
|
14
|
+
__exportStar(require("./Badge"), exports);
|
|
15
|
+
__exportStar(require("./ChatLanguage"), exports);
|
|
16
|
+
__exportStar(require("./Clan"), exports);
|
|
17
|
+
__exportStar(require("./ClanMember"), exports);
|
|
18
|
+
__exportStar(require("./ClanWar"), exports);
|
|
19
|
+
__exportStar(require("./ClanWarLog"), exports);
|
|
20
|
+
__exportStar(require("./ClanWarLeagueGroup"), exports);
|
|
21
|
+
__exportStar(require("./Icon"), exports);
|
|
22
|
+
__exportStar(require("./Label"), exports);
|
|
23
|
+
__exportStar(require("./League"), exports);
|
|
24
|
+
__exportStar(require("./LegendStatistics"), exports);
|
|
25
|
+
__exportStar(require("./Location"), exports);
|
|
26
|
+
__exportStar(require("./Player"), exports);
|
|
27
|
+
__exportStar(require("./PlayerClan"), exports);
|
|
28
|
+
__exportStar(require("./Ranking"), exports);
|
|
29
|
+
__exportStar(require("./Season"), exports);
|
|
30
|
+
__exportStar(require("./Unit"), exports);
|
|
31
|
+
__exportStar(require("./WarLeague"), exports);
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
export interface APIPaging {
|
|
2
|
+
cursors?: APICursors;
|
|
3
|
+
}
|
|
4
|
+
export interface APICursors {
|
|
5
|
+
after?: string;
|
|
6
|
+
before?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface APIIcon {
|
|
9
|
+
small: string;
|
|
10
|
+
/** Tiny Icon is not available for Labels. */
|
|
11
|
+
tiny?: string;
|
|
12
|
+
/** Medium Icon is not available for Unranked Icon. */
|
|
13
|
+
medium?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface APIBadge {
|
|
16
|
+
small: string;
|
|
17
|
+
large: string;
|
|
18
|
+
medium: string;
|
|
19
|
+
}
|
|
20
|
+
export interface APISeason {
|
|
21
|
+
id: string;
|
|
22
|
+
rank: number;
|
|
23
|
+
trophies: number;
|
|
24
|
+
}
|
|
25
|
+
/** /clans?name={name}&limit={limit} */
|
|
26
|
+
export interface APIClanList {
|
|
27
|
+
items: Omit<APIClan, 'memberList'>[];
|
|
28
|
+
paging: APIPaging;
|
|
29
|
+
}
|
|
30
|
+
export interface APIChatLanguage {
|
|
31
|
+
name: string;
|
|
32
|
+
id: number;
|
|
33
|
+
languageCode: string;
|
|
34
|
+
}
|
|
35
|
+
/** /clans/{clanTag} */
|
|
36
|
+
export interface APIClan {
|
|
37
|
+
tag: string;
|
|
38
|
+
name: string;
|
|
39
|
+
type: 'open' | 'inviteOnly' | 'closed';
|
|
40
|
+
description: string;
|
|
41
|
+
location?: APILocation;
|
|
42
|
+
chatLanguage?: APIChatLanguage;
|
|
43
|
+
badgeUrls: APIBadge;
|
|
44
|
+
clanLevel: number;
|
|
45
|
+
clanPoints: number;
|
|
46
|
+
clanVersusPoints: number;
|
|
47
|
+
requiredTrophies: number;
|
|
48
|
+
requiredTownhallLevel?: number;
|
|
49
|
+
warFrequency: 'always' | 'moreThanOncePerWeek' | 'oncePerWeek' | 'lessThanOncePerWeek' | 'never' | 'unknown';
|
|
50
|
+
warWinStreak: number;
|
|
51
|
+
warWins: number;
|
|
52
|
+
warTies?: number;
|
|
53
|
+
warLosses?: number;
|
|
54
|
+
isWarLogPublic: boolean;
|
|
55
|
+
warLeague?: APIWarLeague;
|
|
56
|
+
members: number;
|
|
57
|
+
labels: APILabel[];
|
|
58
|
+
memberList: APIClanMember[];
|
|
59
|
+
}
|
|
60
|
+
export interface APIClanMember {
|
|
61
|
+
name: string;
|
|
62
|
+
tag: string;
|
|
63
|
+
role: 'member' | 'admin' | 'coLeader' | 'leader';
|
|
64
|
+
expLevel: number;
|
|
65
|
+
league: APILeague;
|
|
66
|
+
trophies: number;
|
|
67
|
+
versusTrophies?: number;
|
|
68
|
+
clanRank: number;
|
|
69
|
+
previousClanRank: number;
|
|
70
|
+
donations: number;
|
|
71
|
+
donationsReceived: number;
|
|
72
|
+
}
|
|
73
|
+
/** /clans/{clanTag}/members */
|
|
74
|
+
export interface APIClanMemberList {
|
|
75
|
+
items: APIClanMember[];
|
|
76
|
+
paging: APIPaging;
|
|
77
|
+
}
|
|
78
|
+
/** /clans/{clanTag}/currentwar and /clanwarleagues/wars/{warTag} */
|
|
79
|
+
export interface APIClanWar {
|
|
80
|
+
state: 'notInWar' | 'preparation' | 'inWar' | 'warEnded';
|
|
81
|
+
teamSize: number;
|
|
82
|
+
startTime: string;
|
|
83
|
+
preparationStartTime: string;
|
|
84
|
+
endTime: string;
|
|
85
|
+
clan: APIWarClan;
|
|
86
|
+
opponent: APIWarClan;
|
|
87
|
+
attacksPerMember: number;
|
|
88
|
+
}
|
|
89
|
+
export interface APIWarClan {
|
|
90
|
+
tag: string;
|
|
91
|
+
name: string;
|
|
92
|
+
badgeUrls: APIBadge;
|
|
93
|
+
clanLevel: number;
|
|
94
|
+
attacks: number;
|
|
95
|
+
stars: number;
|
|
96
|
+
destructionPercentage: number;
|
|
97
|
+
members: APIClanWarMember[];
|
|
98
|
+
}
|
|
99
|
+
export interface APIClanWarMember {
|
|
100
|
+
tag: string;
|
|
101
|
+
name: string;
|
|
102
|
+
mapPosition: number;
|
|
103
|
+
townhallLevel: number;
|
|
104
|
+
opponentAttacks: number;
|
|
105
|
+
bestOpponentAttack?: APIClanWarAttack;
|
|
106
|
+
attacks?: APIClanWarAttack[];
|
|
107
|
+
}
|
|
108
|
+
export interface APIClanWarAttack {
|
|
109
|
+
order: number;
|
|
110
|
+
attackerTag: string;
|
|
111
|
+
defenderTag: string;
|
|
112
|
+
stars: number;
|
|
113
|
+
duration: number;
|
|
114
|
+
destructionPercentage: number;
|
|
115
|
+
}
|
|
116
|
+
export interface APIWarLogClan {
|
|
117
|
+
tag?: string;
|
|
118
|
+
name?: string;
|
|
119
|
+
badgeUrls: APIBadge;
|
|
120
|
+
clanLevel: number;
|
|
121
|
+
attacks?: number;
|
|
122
|
+
stars: number;
|
|
123
|
+
destructionPercentage: number;
|
|
124
|
+
expEarned?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface APIClanWarLogEntry {
|
|
127
|
+
result: 'win' | 'lose' | 'tie' | null;
|
|
128
|
+
endTime: string;
|
|
129
|
+
teamSize: number;
|
|
130
|
+
attacksPerMember?: number;
|
|
131
|
+
clan: APIWarLogClan;
|
|
132
|
+
opponent: APIWarLogClan;
|
|
133
|
+
}
|
|
134
|
+
/** /clans/{clanTag}/warlog */
|
|
135
|
+
export interface APIClanWarLog {
|
|
136
|
+
items: APIClanWarLogEntry[];
|
|
137
|
+
paging: APIPaging;
|
|
138
|
+
}
|
|
139
|
+
/** /clans/{clanTag}/currentwar/leaguegroup */
|
|
140
|
+
export interface APIClanWarLeagueGroup {
|
|
141
|
+
state: 'preparation' | 'inWar' | 'warEnded';
|
|
142
|
+
season: string;
|
|
143
|
+
clans: APIClanWarLeagueClan[];
|
|
144
|
+
rounds: APIClanWarLeagueRound[];
|
|
145
|
+
}
|
|
146
|
+
export interface APIClanWarLeagueClan {
|
|
147
|
+
name: string;
|
|
148
|
+
tag: string;
|
|
149
|
+
clanLevel: number;
|
|
150
|
+
badgeUrls: APIBadge;
|
|
151
|
+
members: APIClanWarLeagueClanMember[];
|
|
152
|
+
}
|
|
153
|
+
export interface APIClanWarLeagueClanMember {
|
|
154
|
+
name: string;
|
|
155
|
+
tag: string;
|
|
156
|
+
townHallLevel: number;
|
|
157
|
+
}
|
|
158
|
+
export interface APIClanWarLeagueRound {
|
|
159
|
+
warTags: string[];
|
|
160
|
+
}
|
|
161
|
+
/** /players/{playerTag} */
|
|
162
|
+
export interface APIPlayer {
|
|
163
|
+
name: string;
|
|
164
|
+
tag: string;
|
|
165
|
+
townHallLevel: number;
|
|
166
|
+
townHallWeaponLevel?: number;
|
|
167
|
+
expLevel: number;
|
|
168
|
+
trophies: number;
|
|
169
|
+
bestTrophies: number;
|
|
170
|
+
warStars: number;
|
|
171
|
+
attackWins: number;
|
|
172
|
+
defenseWins: number;
|
|
173
|
+
builderHallLevel?: number;
|
|
174
|
+
versusTrophies?: number;
|
|
175
|
+
bestVersusTrophies?: number;
|
|
176
|
+
versusBattleWins?: number;
|
|
177
|
+
donations: number;
|
|
178
|
+
donationsReceived: number;
|
|
179
|
+
role?: string;
|
|
180
|
+
warPreference?: 'in' | 'out';
|
|
181
|
+
clan?: APIPlayerClan;
|
|
182
|
+
league?: APILeague;
|
|
183
|
+
legendStatistics?: APILegendStatistics;
|
|
184
|
+
achievements: APIPlayerAchievement[];
|
|
185
|
+
troops: APIPlayerItem[];
|
|
186
|
+
heroes: APIPlayerItem[];
|
|
187
|
+
spells: APIPlayerItem[];
|
|
188
|
+
labels: APILabel[];
|
|
189
|
+
}
|
|
190
|
+
export interface APILegendStatistics {
|
|
191
|
+
previousSeason?: APISeason;
|
|
192
|
+
previousVersusSeason?: APISeason;
|
|
193
|
+
bestVersusSeason?: APISeason;
|
|
194
|
+
currentSeason?: APISeason;
|
|
195
|
+
bestSeason?: APISeason;
|
|
196
|
+
legendTrophies: number;
|
|
197
|
+
}
|
|
198
|
+
export interface APIPlayerClan {
|
|
199
|
+
tag: string;
|
|
200
|
+
name: string;
|
|
201
|
+
clanLevel: number;
|
|
202
|
+
badgeUrls: APIBadge;
|
|
203
|
+
}
|
|
204
|
+
export interface APIPlayerAchievement {
|
|
205
|
+
name: string;
|
|
206
|
+
stars: number;
|
|
207
|
+
value: number;
|
|
208
|
+
target: number;
|
|
209
|
+
info: string;
|
|
210
|
+
completionInfo: string | null;
|
|
211
|
+
village: 'home' | 'builderBase';
|
|
212
|
+
}
|
|
213
|
+
export interface APIPlayerItem {
|
|
214
|
+
name: string;
|
|
215
|
+
level: number;
|
|
216
|
+
maxLevel: number;
|
|
217
|
+
superTroopIsActive?: boolean;
|
|
218
|
+
village: 'home' | 'builderBase';
|
|
219
|
+
}
|
|
220
|
+
/** /players/{playerTag}/verifytoken */
|
|
221
|
+
export interface APIVerifyToken {
|
|
222
|
+
tag: string;
|
|
223
|
+
token: string;
|
|
224
|
+
status: 'ok' | 'invalid';
|
|
225
|
+
}
|
|
226
|
+
/** /locations */
|
|
227
|
+
export interface APILocationList {
|
|
228
|
+
items: APILocation[];
|
|
229
|
+
paging: APIPaging;
|
|
230
|
+
}
|
|
231
|
+
/** /locations/{locationId} */
|
|
232
|
+
export interface APILocation {
|
|
233
|
+
localizedName?: string;
|
|
234
|
+
id: number;
|
|
235
|
+
name: string;
|
|
236
|
+
isCountry: boolean;
|
|
237
|
+
countryCode?: string;
|
|
238
|
+
}
|
|
239
|
+
/** /locations/{locationId}/rankings/clans */
|
|
240
|
+
export interface APIClanRankingList {
|
|
241
|
+
items: APIClanRanking[];
|
|
242
|
+
paging: APIPaging;
|
|
243
|
+
}
|
|
244
|
+
export interface APIClanRanking {
|
|
245
|
+
clanLevel: number;
|
|
246
|
+
clanPoints: number;
|
|
247
|
+
location: APILocation;
|
|
248
|
+
members: number;
|
|
249
|
+
tag: string;
|
|
250
|
+
name: string;
|
|
251
|
+
rank: number;
|
|
252
|
+
previousRank: number;
|
|
253
|
+
badgeUrls: APIBadge;
|
|
254
|
+
}
|
|
255
|
+
/** /locations/{locationId}/rankings/players */
|
|
256
|
+
export interface APIPlayerRankingList {
|
|
257
|
+
items: APIPlayerRanking[];
|
|
258
|
+
paging: APIPaging;
|
|
259
|
+
}
|
|
260
|
+
export interface APIPlayerRanking {
|
|
261
|
+
tag: string;
|
|
262
|
+
name: string;
|
|
263
|
+
expLevel: number;
|
|
264
|
+
trophies: number;
|
|
265
|
+
attackWins: number;
|
|
266
|
+
defenseWins: number;
|
|
267
|
+
rank: number;
|
|
268
|
+
previousRank: number;
|
|
269
|
+
clan: APIPlayerClan;
|
|
270
|
+
league: APILeague;
|
|
271
|
+
}
|
|
272
|
+
/** /locations/{locationId}/rankings/clans-versus */
|
|
273
|
+
export interface APIClanVersusRankingList {
|
|
274
|
+
items: APIClanVersusRanking[];
|
|
275
|
+
paging: APIPaging;
|
|
276
|
+
}
|
|
277
|
+
export interface APIClanVersusRanking {
|
|
278
|
+
clanLevel: number;
|
|
279
|
+
location: APILocation;
|
|
280
|
+
members: number;
|
|
281
|
+
tag: string;
|
|
282
|
+
name: string;
|
|
283
|
+
rank: number;
|
|
284
|
+
previousRank: number;
|
|
285
|
+
badgeUrls: APIBadge;
|
|
286
|
+
clanVersusPoints: number;
|
|
287
|
+
}
|
|
288
|
+
/** /locations/{locationId}/rankings/players-versus */
|
|
289
|
+
export interface APIPlayerVersusRankingList {
|
|
290
|
+
items: APIPlayerVersusRanking[];
|
|
291
|
+
paging: APIPaging;
|
|
292
|
+
}
|
|
293
|
+
export interface APIPlayerVersusRanking {
|
|
294
|
+
tag: string;
|
|
295
|
+
name: string;
|
|
296
|
+
expLevel: number;
|
|
297
|
+
versusTrophies: number;
|
|
298
|
+
versusBattleWins: number;
|
|
299
|
+
rank: number;
|
|
300
|
+
previousRank: number;
|
|
301
|
+
clan: APIPlayerClan;
|
|
302
|
+
}
|
|
303
|
+
/** /leagues */
|
|
304
|
+
export interface APILeagueList {
|
|
305
|
+
items: APILeague[];
|
|
306
|
+
paging: APIPaging;
|
|
307
|
+
}
|
|
308
|
+
/** /leagues/{leagueId} */
|
|
309
|
+
export interface APILeague {
|
|
310
|
+
id: number;
|
|
311
|
+
name: string;
|
|
312
|
+
iconUrls: APIIcon;
|
|
313
|
+
}
|
|
314
|
+
/** /leagues/{leagueId}/seasons/{seasonId} */
|
|
315
|
+
export interface APIPlayerSeasonRankingList {
|
|
316
|
+
items: Omit<APIPlayerRanking, 'league'>[];
|
|
317
|
+
paging: APIPaging;
|
|
318
|
+
}
|
|
319
|
+
/** /leagues/{leagueId}/seasons */
|
|
320
|
+
export interface APILeagueSeasonList {
|
|
321
|
+
items: {
|
|
322
|
+
id: string;
|
|
323
|
+
}[];
|
|
324
|
+
paging: APIPaging;
|
|
325
|
+
}
|
|
326
|
+
/** /warleagues */
|
|
327
|
+
export interface APIWarLeagueList {
|
|
328
|
+
items: APIWarLeague[];
|
|
329
|
+
paging: APIPaging;
|
|
330
|
+
}
|
|
331
|
+
/** /warleagues/{leagueId} */
|
|
332
|
+
export interface APIWarLeague {
|
|
333
|
+
id: number;
|
|
334
|
+
name: string;
|
|
335
|
+
}
|
|
336
|
+
export interface APILabel {
|
|
337
|
+
id: number;
|
|
338
|
+
name: string;
|
|
339
|
+
iconUrls: APIIcon;
|
|
340
|
+
}
|
|
341
|
+
/** /labels/clans and /labels/players */
|
|
342
|
+
export interface APILabelList {
|
|
343
|
+
items: APILabel[];
|
|
344
|
+
paging: APIPaging;
|
|
345
|
+
}
|
|
346
|
+
/** /goldpass/seasons/current */
|
|
347
|
+
export interface APIGoldPassSeason {
|
|
348
|
+
startTime: string;
|
|
349
|
+
endTime: string;
|
|
350
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const API_BASE_URL = "https://api.clashofclans.com/v1";
|
|
2
|
+
export declare const DEV_SITE_API_BASE_URL = "https://developer.clashofclans.com/api";
|
|
3
|
+
export declare const ELIXIR_TROOPS: string[];
|
|
4
|
+
export declare const DARK_ELIXIR_TROOPS: string[];
|
|
5
|
+
export declare const HOME_TROOPS: string[];
|
|
6
|
+
export declare const SIEGE_MACHINES: string[];
|
|
7
|
+
export declare const SUPER_TROOPS: string[];
|
|
8
|
+
export declare const ELIXIR_SPELLS: string[];
|
|
9
|
+
export declare const DARK_ELIXIR_SPELLS: string[];
|
|
10
|
+
export declare const SPELLS: string[];
|
|
11
|
+
export declare const HEROES: string[];
|
|
12
|
+
export declare const HERO_PETS: string[];
|
|
13
|
+
export declare const UNRANKED_LEAGUE_DATA: {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
iconUrls: {
|
|
17
|
+
small: string;
|
|
18
|
+
tiny: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const LEGEND_LEAGUE_ID = 29000022;
|
|
22
|
+
export declare const LEAGUES: number[];
|
|
23
|
+
export declare const WAR_LEAGUES: number[];
|
|
24
|
+
export declare const FRIENDLY_WAR_PREPARATION_TIMES: readonly [number, number, number, number, number, number, number, number, number, number, number, number];
|
|
25
|
+
export declare const EVENTS: {
|
|
26
|
+
readonly NEW_SEASON_START: "newSeasonStart";
|
|
27
|
+
readonly CLAN_LOOP_START: "clanLoopStart";
|
|
28
|
+
readonly CLAN_LOOP_END: "clanLoopEnd";
|
|
29
|
+
readonly PLAYER_LOOP_START: "playerLoopStart";
|
|
30
|
+
readonly PLAYER_LOOP_END: "playerLoopEnd";
|
|
31
|
+
readonly WAR_LOOP_START: "warLoopEnd";
|
|
32
|
+
readonly WAR_LOOP_END: "warLoopEnd";
|
|
33
|
+
readonly MAINTENANCE_START: "maintenanceStart";
|
|
34
|
+
readonly MAINTENANCE_END: "maintenanceEnd";
|
|
35
|
+
readonly ERROR: "error";
|
|
36
|
+
};
|
|
37
|
+
export declare const CWL_ROUNDS: {
|
|
38
|
+
readonly PREVIOUS_ROUND: "warEnded";
|
|
39
|
+
readonly CURRENT_ROUND: "inWar";
|
|
40
|
+
readonly NEXT_ROUND: "preparation";
|
|
41
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CWL_ROUNDS = exports.EVENTS = exports.FRIENDLY_WAR_PREPARATION_TIMES = exports.WAR_LEAGUES = exports.LEAGUES = exports.LEGEND_LEAGUE_ID = exports.UNRANKED_LEAGUE_DATA = exports.HERO_PETS = exports.HEROES = exports.SPELLS = exports.DARK_ELIXIR_SPELLS = exports.ELIXIR_SPELLS = exports.SUPER_TROOPS = exports.SIEGE_MACHINES = exports.HOME_TROOPS = exports.DARK_ELIXIR_TROOPS = exports.ELIXIR_TROOPS = exports.DEV_SITE_API_BASE_URL = exports.API_BASE_URL = void 0;
|
|
4
|
+
exports.API_BASE_URL = 'https://api.clashofclans.com/v1';
|
|
5
|
+
exports.DEV_SITE_API_BASE_URL = 'https://developer.clashofclans.com/api';
|
|
6
|
+
exports.ELIXIR_TROOPS = [
|
|
7
|
+
'Barbarian',
|
|
8
|
+
'Archer',
|
|
9
|
+
'Giant',
|
|
10
|
+
'Goblin',
|
|
11
|
+
'Wall Breaker',
|
|
12
|
+
'Balloon',
|
|
13
|
+
'Wizard',
|
|
14
|
+
'Healer',
|
|
15
|
+
'Dragon',
|
|
16
|
+
'P.E.K.K.A',
|
|
17
|
+
'Baby Dragon',
|
|
18
|
+
'Miner',
|
|
19
|
+
'Electro Dragon',
|
|
20
|
+
'Yeti',
|
|
21
|
+
'Dragon Rider'
|
|
22
|
+
];
|
|
23
|
+
exports.DARK_ELIXIR_TROOPS = ['Minion', 'Hog Rider', 'Valkyrie', 'Golem', 'Witch', 'Lava Hound', 'Bowler', 'Ice Golem', 'Headhunter'];
|
|
24
|
+
exports.HOME_TROOPS = [...exports.ELIXIR_TROOPS, ...exports.DARK_ELIXIR_TROOPS];
|
|
25
|
+
exports.SIEGE_MACHINES = ['Wall Wrecker', 'Battle Blimp', 'Stone Slammer', 'Siege Barracks', 'Log Launcher'];
|
|
26
|
+
exports.SUPER_TROOPS = [
|
|
27
|
+
'Super Barbarian',
|
|
28
|
+
'Super Archer',
|
|
29
|
+
'Super Giant',
|
|
30
|
+
'Sneaky Goblin',
|
|
31
|
+
'Super Wall Breaker',
|
|
32
|
+
'Rocket Balloon',
|
|
33
|
+
'Super Wizard',
|
|
34
|
+
'Inferno Dragon',
|
|
35
|
+
'Super Minion',
|
|
36
|
+
'Super Valkyrie',
|
|
37
|
+
'Super Witch',
|
|
38
|
+
'Ice Hound',
|
|
39
|
+
'Super Bowler'
|
|
40
|
+
];
|
|
41
|
+
exports.ELIXIR_SPELLS = [
|
|
42
|
+
'Lightning Spell',
|
|
43
|
+
'Healing Spell',
|
|
44
|
+
'Rage Spell',
|
|
45
|
+
'Jump Spell',
|
|
46
|
+
'Freeze Spell',
|
|
47
|
+
'Clone Spell',
|
|
48
|
+
'Invisibility Spell'
|
|
49
|
+
];
|
|
50
|
+
exports.DARK_ELIXIR_SPELLS = ['Poison Spell', 'Earthquake Spell', 'Haste Spell', 'Skeleton Spell', 'Bat Spell'];
|
|
51
|
+
exports.SPELLS = [...exports.ELIXIR_SPELLS, ...exports.DARK_ELIXIR_SPELLS];
|
|
52
|
+
exports.HEROES = ['Barbarian King', 'Archer Queen', 'Grand Warden', 'Royal Champion', 'Battle Machine'];
|
|
53
|
+
exports.HERO_PETS = ['L.A.S.S.I', 'Electro Owl', 'Mighty Yak', 'Unicorn'];
|
|
54
|
+
exports.UNRANKED_LEAGUE_DATA = {
|
|
55
|
+
id: 29000000,
|
|
56
|
+
name: 'Unranked',
|
|
57
|
+
iconUrls: {
|
|
58
|
+
small: 'https://api-assets.clashofclans.com/leagues/72/e--YMyIexEQQhE4imLoJcwhYn6Uy8KqlgyY3_kFV6t4.png',
|
|
59
|
+
tiny: 'https://api-assets.clashofclans.com/leagues/36/e--YMyIexEQQhE4imLoJcwhYn6Uy8KqlgyY3_kFV6t4.png'
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.LEGEND_LEAGUE_ID = 29000022;
|
|
63
|
+
exports.LEAGUES = [
|
|
64
|
+
29000000,
|
|
65
|
+
29000001,
|
|
66
|
+
29000002,
|
|
67
|
+
29000003,
|
|
68
|
+
29000004,
|
|
69
|
+
29000005,
|
|
70
|
+
29000006,
|
|
71
|
+
29000007,
|
|
72
|
+
29000008,
|
|
73
|
+
29000009,
|
|
74
|
+
29000010,
|
|
75
|
+
29000011,
|
|
76
|
+
29000012,
|
|
77
|
+
29000013,
|
|
78
|
+
29000014,
|
|
79
|
+
29000015,
|
|
80
|
+
29000016,
|
|
81
|
+
29000017,
|
|
82
|
+
29000018,
|
|
83
|
+
29000019,
|
|
84
|
+
29000020,
|
|
85
|
+
29000021,
|
|
86
|
+
exports.LEGEND_LEAGUE_ID
|
|
87
|
+
];
|
|
88
|
+
exports.WAR_LEAGUES = [
|
|
89
|
+
48000000, 48000001, 48000002, 48000003, 48000004, 48000005, 48000006, 48000007, 48000008, 48000009, 48000010, 48000011, 48000012,
|
|
90
|
+
48000013, 48000014, 48000015, 48000016, 48000017, 48000018
|
|
91
|
+
];
|
|
92
|
+
exports.FRIENDLY_WAR_PREPARATION_TIMES = [
|
|
93
|
+
1000 * 60 * 60 * 24,
|
|
94
|
+
1000 * 60 * 60 * 20,
|
|
95
|
+
1000 * 60 * 60 * 16,
|
|
96
|
+
1000 * 60 * 60 * 12,
|
|
97
|
+
1000 * 60 * 60 * 8,
|
|
98
|
+
1000 * 60 * 60 * 6,
|
|
99
|
+
1000 * 60 * 60 * 4,
|
|
100
|
+
1000 * 60 * 60 * 2,
|
|
101
|
+
1000 * 60 * 60,
|
|
102
|
+
1000 * 60 * 30,
|
|
103
|
+
1000 * 60 * 15,
|
|
104
|
+
1000 * 60 * 5
|
|
105
|
+
];
|
|
106
|
+
exports.EVENTS = {
|
|
107
|
+
NEW_SEASON_START: 'newSeasonStart',
|
|
108
|
+
CLAN_LOOP_START: 'clanLoopStart',
|
|
109
|
+
CLAN_LOOP_END: 'clanLoopEnd',
|
|
110
|
+
PLAYER_LOOP_START: 'playerLoopStart',
|
|
111
|
+
PLAYER_LOOP_END: 'playerLoopEnd',
|
|
112
|
+
WAR_LOOP_START: 'warLoopEnd',
|
|
113
|
+
WAR_LOOP_END: 'warLoopEnd',
|
|
114
|
+
MAINTENANCE_START: 'maintenanceStart',
|
|
115
|
+
MAINTENANCE_END: 'maintenanceEnd',
|
|
116
|
+
ERROR: 'error'
|
|
117
|
+
};
|
|
118
|
+
exports.CWL_ROUNDS = {
|
|
119
|
+
PREVIOUS_ROUND: 'warEnded',
|
|
120
|
+
CURRENT_ROUND: 'inWar',
|
|
121
|
+
NEXT_ROUND: 'preparation'
|
|
122
|
+
};
|