clashofclans.js 3.3.18 → 3.3.19
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/dist/index.mjs +1 -0
- package/dist/struct/Player.d.ts +2 -2
- package/dist/struct/Player.js +1 -1
- package/dist/struct/Unit.d.ts +3 -3
- package/dist/struct/Unit.js +4 -4
- package/dist/util/Constants.d.ts +2 -1
- package/dist/util/Constants.js +11 -108
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -28,6 +28,7 @@ export const DarkElixirTroops = mod.DarkElixirTroops;
|
|
|
28
28
|
export const DevSiteAPIBaseURL = mod.DevSiteAPIBaseURL;
|
|
29
29
|
export const ElixirSpells = mod.ElixirSpells;
|
|
30
30
|
export const ElixirTroops = mod.ElixirTroops;
|
|
31
|
+
export const Equipment = mod.Equipment;
|
|
31
32
|
export const FriendlyWarPreparationTimes = mod.FriendlyWarPreparationTimes;
|
|
32
33
|
export const GoldPassSeason = mod.GoldPassSeason;
|
|
33
34
|
export const HTTPError = mod.HTTPError;
|
package/dist/struct/Player.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Label } from './Label';
|
|
|
5
5
|
import { League } from './League';
|
|
6
6
|
import { LegendStatistics } from './LegendStatistics';
|
|
7
7
|
import { PlayerClan } from './PlayerClan';
|
|
8
|
-
import {
|
|
8
|
+
import { Equipment, Hero, Spell, Troop } from './Unit';
|
|
9
9
|
/** Represents a Clash of Clans Player. */
|
|
10
10
|
export declare class Player {
|
|
11
11
|
/** The player's name. */
|
|
@@ -61,7 +61,7 @@ export declare class Player {
|
|
|
61
61
|
/** An array of player's heroes (both home base and build base). */
|
|
62
62
|
heroes: Hero[];
|
|
63
63
|
/** An array of player's hero equipment. */
|
|
64
|
-
heroEquipment:
|
|
64
|
+
heroEquipment: Equipment[];
|
|
65
65
|
/** The player's clan capital house details. */
|
|
66
66
|
playerHouse?: APIPlayerHouse | null;
|
|
67
67
|
private readonly client;
|
package/dist/struct/Player.js
CHANGED
|
@@ -46,7 +46,7 @@ class Player {
|
|
|
46
46
|
this.troops = data.troops.map((unit) => new Unit_1.Troop(data, unit));
|
|
47
47
|
this.spells = data.spells.map((unit) => new Unit_1.Spell(data, unit));
|
|
48
48
|
this.heroes = data.heroes.map((unit) => new Unit_1.Hero(data, unit));
|
|
49
|
-
this.heroEquipment = data.heroEquipment.map((unit) => new Unit_1.
|
|
49
|
+
this.heroEquipment = data.heroEquipment.map((unit) => new Unit_1.Equipment(data, unit));
|
|
50
50
|
this.playerHouse = data.playerHouse ?? null;
|
|
51
51
|
}
|
|
52
52
|
/** Whether this clan member is in the clan. */
|
package/dist/struct/Unit.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare class Unit {
|
|
|
50
50
|
/** @internal */
|
|
51
51
|
originalName: string | null;
|
|
52
52
|
/** @internal */
|
|
53
|
-
equipment:
|
|
53
|
+
equipment: Equipment[];
|
|
54
54
|
constructor(data: APIPlayer, unit: APIPlayerItem);
|
|
55
55
|
/** Whether the unit belongs to the home base. */
|
|
56
56
|
get isHomeBase(): boolean;
|
|
@@ -82,8 +82,8 @@ export declare class Hero extends Unit {
|
|
|
82
82
|
/** Regeneration time of this hero. */
|
|
83
83
|
regenerationTime: number;
|
|
84
84
|
/** Hero Equipment */
|
|
85
|
-
equipment:
|
|
85
|
+
equipment: Equipment[];
|
|
86
86
|
}
|
|
87
87
|
/** Represents a Player's Hero Equipment. */
|
|
88
|
-
export declare class
|
|
88
|
+
export declare class Equipment extends Unit {
|
|
89
89
|
}
|
package/dist/struct/Unit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Equipment = exports.Hero = exports.Spell = exports.Troop = exports.Unit = void 0;
|
|
4
4
|
const Constants_1 = require("../util/Constants");
|
|
5
5
|
/** Represents a Player's Unit. */
|
|
6
6
|
class Unit {
|
|
@@ -58,7 +58,7 @@ class Unit {
|
|
|
58
58
|
this.regenerationTime = rawUnit.regenerationTimes[this.level - 1] ?? 0;
|
|
59
59
|
this.hallMaxLevel =
|
|
60
60
|
rawUnit.levels[(this.village === 'home' ? data.townHallLevel : data.builderHallLevel) - 1] ?? this.maxLevel;
|
|
61
|
-
this.equipment = (unit.equipment ?? []).map((unit) => new
|
|
61
|
+
this.equipment = (unit.equipment ?? []).map((unit) => new Equipment(data, unit));
|
|
62
62
|
}
|
|
63
63
|
this.seasonal = Boolean(rawUnit?.seasonal);
|
|
64
64
|
this.isLoaded = Boolean(rawUnit ?? rawSuperUnit);
|
|
@@ -101,6 +101,6 @@ class Hero extends Unit {
|
|
|
101
101
|
}
|
|
102
102
|
exports.Hero = Hero;
|
|
103
103
|
/** Represents a Player's Hero Equipment. */
|
|
104
|
-
class
|
|
104
|
+
class Equipment extends Unit {
|
|
105
105
|
}
|
|
106
|
-
exports.
|
|
106
|
+
exports.Equipment = Equipment;
|
package/dist/util/Constants.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export declare const APIBaseURL = "https://api.clashofclans.com/v1";
|
|
2
2
|
export declare const DevSiteAPIBaseURL = "https://developer.clashofclans.com/api";
|
|
3
|
+
export declare const SuperTroops: string[];
|
|
3
4
|
export declare const ElixirTroops: string[];
|
|
4
5
|
export declare const DarkElixirTroops: string[];
|
|
5
6
|
export declare const HomeTroops: string[];
|
|
6
7
|
export declare const SiegeMachines: string[];
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const HeroEquipment: string[];
|
|
8
9
|
export declare const ElixirSpells: string[];
|
|
9
10
|
export declare const DarkElixirSpells: string[];
|
|
10
11
|
export declare const Spells: string[];
|
package/dist/util/Constants.js
CHANGED
|
@@ -3,119 +3,22 @@ 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.RestEvents = exports.ClientEvents = exports.PollingEvents = exports.FriendlyWarPreparationTimes = exports.WarLeagues = exports.Leagues = exports.UnrankedWarLeagueId = exports.LegendLeagueId = exports.UnrankedLeagueId = exports.UnrankedLeagueData = exports.HeroPets = exports.Heroes = exports.BuilderTroops = exports.Spells = exports.DarkElixirSpells = exports.ElixirSpells = exports.
|
|
6
|
+
exports.RawData = exports.CWLRounds = exports.RestEvents = exports.ClientEvents = exports.PollingEvents = exports.FriendlyWarPreparationTimes = exports.WarLeagues = exports.Leagues = exports.UnrankedWarLeagueId = exports.LegendLeagueId = exports.UnrankedLeagueId = exports.UnrankedLeagueData = exports.HeroPets = exports.Heroes = exports.BuilderTroops = exports.Spells = exports.DarkElixirSpells = exports.ElixirSpells = exports.HeroEquipment = exports.SiegeMachines = exports.HomeTroops = exports.DarkElixirTroops = exports.ElixirTroops = exports.SuperTroops = 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';
|
|
10
|
-
exports.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'Giant',
|
|
14
|
-
'Goblin',
|
|
15
|
-
'Wall Breaker',
|
|
16
|
-
'Balloon',
|
|
17
|
-
'Wizard',
|
|
18
|
-
'Healer',
|
|
19
|
-
'Dragon',
|
|
20
|
-
'P.E.K.K.A',
|
|
21
|
-
'Baby Dragon',
|
|
22
|
-
'Miner',
|
|
23
|
-
'Electro Dragon',
|
|
24
|
-
'Yeti',
|
|
25
|
-
'Dragon Rider',
|
|
26
|
-
'Electro Titan',
|
|
27
|
-
'Root Rider',
|
|
28
|
-
'Thrower'
|
|
29
|
-
];
|
|
30
|
-
exports.DarkElixirTroops = [
|
|
31
|
-
'Minion',
|
|
32
|
-
'Hog Rider',
|
|
33
|
-
'Valkyrie',
|
|
34
|
-
'Golem',
|
|
35
|
-
'Witch',
|
|
36
|
-
'Lava Hound',
|
|
37
|
-
'Bowler',
|
|
38
|
-
'Ice Golem',
|
|
39
|
-
'Headhunter',
|
|
40
|
-
'Apprentice Warden',
|
|
41
|
-
'Druid'
|
|
42
|
-
];
|
|
10
|
+
exports.SuperTroops = raw_json_1.default.RAW_SUPER_UNITS.map((unit) => unit.name);
|
|
11
|
+
exports.ElixirTroops = raw_json_1.default.RAW_UNITS.filter((unit) => !exports.SuperTroops.includes(unit.name) && unit.subCategory === 'troop' && unit.upgrade.resource === 'Elixir').map((unit) => unit.name);
|
|
12
|
+
exports.DarkElixirTroops = raw_json_1.default.RAW_UNITS.filter((unit) => !exports.SuperTroops.includes(unit.name) && unit.subCategory === 'troop' && unit.upgrade.resource === 'Dark Elixir').map((unit) => unit.name);
|
|
43
13
|
exports.HomeTroops = [...exports.ElixirTroops, ...exports.DarkElixirTroops];
|
|
44
|
-
exports.SiegeMachines =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'Siege Barracks',
|
|
49
|
-
'Log Launcher',
|
|
50
|
-
'Flame Flinger',
|
|
51
|
-
'Battle Drill'
|
|
52
|
-
];
|
|
53
|
-
exports.SuperTroops = [
|
|
54
|
-
'Super Barbarian',
|
|
55
|
-
'Super Archer',
|
|
56
|
-
'Super Giant',
|
|
57
|
-
'Sneaky Goblin',
|
|
58
|
-
'Super Wall Breaker',
|
|
59
|
-
'Rocket Balloon',
|
|
60
|
-
'Super Wizard',
|
|
61
|
-
'Super Dragon',
|
|
62
|
-
'Inferno Dragon',
|
|
63
|
-
'Super Minion',
|
|
64
|
-
'Super Valkyrie',
|
|
65
|
-
'Super Witch',
|
|
66
|
-
'Ice Hound',
|
|
67
|
-
'Super Bowler',
|
|
68
|
-
'Super Miner',
|
|
69
|
-
'Super Hog Rider'
|
|
70
|
-
];
|
|
71
|
-
exports.ElixirSpells = [
|
|
72
|
-
'Lightning Spell',
|
|
73
|
-
'Healing Spell',
|
|
74
|
-
'Rage Spell',
|
|
75
|
-
'Jump Spell',
|
|
76
|
-
'Freeze Spell',
|
|
77
|
-
'Clone Spell',
|
|
78
|
-
'Invisibility Spell',
|
|
79
|
-
'Recall Spell',
|
|
80
|
-
'Revive Spell'
|
|
81
|
-
];
|
|
82
|
-
exports.DarkElixirSpells = ['Poison Spell', 'Earthquake Spell', 'Haste Spell', 'Skeleton Spell', 'Bat Spell', 'Overgrowth Spell'];
|
|
14
|
+
exports.SiegeMachines = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'siege').map((unit) => unit.name);
|
|
15
|
+
exports.HeroEquipment = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'equipment').map((unit) => unit.name);
|
|
16
|
+
exports.ElixirSpells = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'spell' && unit.upgrade.resource === 'Elixir').map((unit) => unit.name);
|
|
17
|
+
exports.DarkElixirSpells = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'spell' && unit.upgrade.resource === 'Dark Elixir').map((unit) => unit.name);
|
|
83
18
|
exports.Spells = [...exports.ElixirSpells, ...exports.DarkElixirSpells];
|
|
84
|
-
exports.BuilderTroops =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
'Boxer Giant',
|
|
88
|
-
'Beta Minion',
|
|
89
|
-
'Bomber',
|
|
90
|
-
'Baby Dragon',
|
|
91
|
-
'Cannon Cart',
|
|
92
|
-
'Night Witch',
|
|
93
|
-
'Drop Ship',
|
|
94
|
-
'Super P.E.K.K.A',
|
|
95
|
-
'Hog Glider',
|
|
96
|
-
'Electrofire Wizard'
|
|
97
|
-
];
|
|
98
|
-
exports.Heroes = [
|
|
99
|
-
'Barbarian King',
|
|
100
|
-
'Archer Queen',
|
|
101
|
-
'Grand Warden',
|
|
102
|
-
'Royal Champion',
|
|
103
|
-
'Minion Prince',
|
|
104
|
-
'Battle Machine',
|
|
105
|
-
'Battle Copter'
|
|
106
|
-
];
|
|
107
|
-
exports.HeroPets = [
|
|
108
|
-
'L.A.S.S.I',
|
|
109
|
-
'Electro Owl',
|
|
110
|
-
'Mighty Yak',
|
|
111
|
-
'Unicorn',
|
|
112
|
-
'Poison Lizard',
|
|
113
|
-
'Diggy',
|
|
114
|
-
'Frosty',
|
|
115
|
-
'Phoenix',
|
|
116
|
-
'Spirit Fox',
|
|
117
|
-
'Angry Jelly'
|
|
118
|
-
];
|
|
19
|
+
exports.BuilderTroops = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'troop' && unit.village === 'builderBase').map((unit) => unit.name);
|
|
20
|
+
exports.Heroes = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'hero').map((unit) => unit.name);
|
|
21
|
+
exports.HeroPets = raw_json_1.default.RAW_UNITS.filter((unit) => unit.subCategory === 'pet').map((unit) => unit.name);
|
|
119
22
|
exports.UnrankedLeagueData = {
|
|
120
23
|
id: 29000000,
|
|
121
24
|
name: 'Unranked',
|