@dchighs/dc-assets 0.0.5 → 0.2.0

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/README.md CHANGED
@@ -128,7 +128,7 @@ import dcAssets from "@dchighs/dc-assets"
128
128
  keyName: "531_dc_party_planning_island"
129
129
  })
130
130
 
131
- await musicDownloader.download("music.mp3") // Fixed extension example
131
+ await musicDownloader.download("music.mp3")
132
132
  })();
133
133
  ```
134
134
 
@@ -151,6 +151,40 @@ import dcAssets from "@dchighs/dc-assets"
151
151
 
152
152
  ---
153
153
 
154
+ ### Downloading Building Sprites
155
+
156
+ ```ts
157
+ import { BuildingSpriteQuality } from "@dchighs/dc-core"
158
+ import dcAssets from "@dchighs/dc-assets"
159
+
160
+ ;(async () => {
161
+ const buildingSpriteDownloader = dcAssets.buildings.sprite({
162
+ imageName: "10552_hatchery6reskinart_building",
163
+ imageQuality: BuildingSpriteQuality.Normal,
164
+ })
165
+
166
+ await buildingSpriteDownloader.download("building-sprite.png")
167
+ })();
168
+ ```
169
+
170
+ ---
171
+
172
+ ### Downloading Building Thumbnails
173
+
174
+ ```ts
175
+ import dcAssets from "@dchighs/dc-assets"
176
+
177
+ ;(async () => {
178
+ const buildingThumbnailDownloader = dcAssets.buildings.thumbnail({
179
+ imageName: "10552_hatchery6reskinart_building",
180
+ })
181
+
182
+ await buildingThumbnailDownloader.download("building-thumbnail.jpg")
183
+ })();
184
+ ```
185
+
186
+ ---
187
+
154
188
  ## 🤝 Contributing
155
189
 
156
190
  * Want to contribute? Follow these steps:
@@ -0,0 +1,15 @@
1
+ import { BuildingSpriteQuality, StaticFileUrlPlatformPrefix } from "@dchighs/dc-core";
2
+ import { StaticFileDownloader } from "./static-file-downloader";
3
+ export type BuildingSpriteDownloaderOptions = {
4
+ imageName: string;
5
+ platformPrefix?: StaticFileUrlPlatformPrefix;
6
+ imageQuality?: BuildingSpriteQuality;
7
+ };
8
+ export declare class BuildingSpriteDownloader extends StaticFileDownloader {
9
+ readonly url: string;
10
+ readonly imageName: string;
11
+ readonly imageQuality: BuildingSpriteQuality;
12
+ readonly platformPrefix: StaticFileUrlPlatformPrefix;
13
+ constructor({ imageName, platformPrefix, imageQuality }: BuildingSpriteDownloaderOptions);
14
+ download(filePath: string): Promise<string>;
15
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildingSpriteDownloader = void 0;
4
+ const dc_core_1 = require("@dchighs/dc-core");
5
+ const static_file_downloader_1 = require("./static-file-downloader");
6
+ class BuildingSpriteDownloader extends static_file_downloader_1.StaticFileDownloader {
7
+ constructor({ imageName, platformPrefix, imageQuality }) {
8
+ super();
9
+ this.imageName = imageName;
10
+ this.imageQuality = imageQuality || dc_core_1.BuildingSpriteQuality.Default;
11
+ this.platformPrefix = platformPrefix || dc_core_1.StaticFileUrlPlatformPrefix.Default;
12
+ this.url = `https://${this.platformPrefix}-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/buildings/ui_${imageName}${this.imageQuality}.png`;
13
+ }
14
+ async download(filePath) {
15
+ return await super.download(this.url, filePath);
16
+ }
17
+ }
18
+ exports.BuildingSpriteDownloader = BuildingSpriteDownloader;
@@ -0,0 +1,13 @@
1
+ import { StaticFileUrlPlatformPrefix } from "@dchighs/dc-core";
2
+ import { StaticFileDownloader } from "./static-file-downloader";
3
+ export type BuildingThumbnailDownloaderOptions = {
4
+ imageName: string;
5
+ platformPrefix?: StaticFileUrlPlatformPrefix;
6
+ };
7
+ export declare class BuildingThumbnailDownloader extends StaticFileDownloader {
8
+ readonly url: string;
9
+ readonly imageName: string;
10
+ readonly platformPrefix: StaticFileUrlPlatformPrefix;
11
+ constructor({ imageName, platformPrefix }: BuildingThumbnailDownloaderOptions);
12
+ download(filePath: string): Promise<string>;
13
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildingThumbnailDownloader = void 0;
4
+ const dc_core_1 = require("@dchighs/dc-core");
5
+ const static_file_downloader_1 = require("./static-file-downloader");
6
+ class BuildingThumbnailDownloader extends static_file_downloader_1.StaticFileDownloader {
7
+ constructor({ imageName, platformPrefix }) {
8
+ super();
9
+ this.imageName = imageName;
10
+ this.platformPrefix = platformPrefix || dc_core_1.StaticFileUrlPlatformPrefix.Default;
11
+ this.url = `https://${this.platformPrefix}-static-s1.socialpointgames.com/static/dragoncity/assets/thumbs/${imageName}.jpg`;
12
+ }
13
+ async download(filePath) {
14
+ return await super.download(this.url, filePath);
15
+ }
16
+ }
17
+ exports.BuildingThumbnailDownloader = BuildingThumbnailDownloader;
@@ -1,7 +1,7 @@
1
1
  import { ChestSpriteQuality } from "@dchighs/dc-core";
2
2
  import { StaticFileDownloader } from "./static-file-downloader";
3
3
  export type ChestSpriteDownloaderOptions = {
4
- imageQuality: ChestSpriteQuality;
4
+ imageQuality?: ChestSpriteQuality;
5
5
  imageName: string;
6
6
  };
7
7
  export declare class ChestSpriteDownloader extends StaticFileDownloader {
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChestSpriteDownloader = void 0;
4
+ const dc_core_1 = require("@dchighs/dc-core");
4
5
  const static_file_downloader_1 = require("./static-file-downloader");
5
6
  class ChestSpriteDownloader extends static_file_downloader_1.StaticFileDownloader {
6
7
  constructor({ imageQuality, imageName }) {
7
8
  super();
8
- this.imageQuality = imageQuality;
9
+ this.imageQuality = imageQuality || dc_core_1.ChestSpriteQuality.Default;
9
10
  this.imageName = imageName;
10
11
  this.url = `https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/chests/ui_basic_${imageName}${imageQuality}.png`;
11
12
  }
@@ -0,0 +1,15 @@
1
+ import { BuildingSpriteQuality, StaticFileUrlPlatformPrefix } from "@dchighs/dc-core";
2
+ import { StaticFileDownloader } from "./static-file-downloader";
3
+ export type DecorationSpriteDownloaderOptions = {
4
+ imageName: string;
5
+ platformPrefix?: StaticFileUrlPlatformPrefix;
6
+ imageQuality?: BuildingSpriteQuality;
7
+ };
8
+ export declare class DecorationSpriteDownloader extends StaticFileDownloader {
9
+ readonly url: string;
10
+ readonly imageName: string;
11
+ readonly imageQuality: BuildingSpriteQuality;
12
+ readonly platformPrefix: StaticFileUrlPlatformPrefix;
13
+ constructor({ imageName, platformPrefix, imageQuality }: DecorationSpriteDownloaderOptions);
14
+ download(filePath: string): Promise<string>;
15
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecorationSpriteDownloader = void 0;
4
+ const dc_core_1 = require("@dchighs/dc-core");
5
+ const static_file_downloader_1 = require("./static-file-downloader");
6
+ class DecorationSpriteDownloader extends static_file_downloader_1.StaticFileDownloader {
7
+ constructor({ imageName, platformPrefix, imageQuality }) {
8
+ super();
9
+ this.imageName = imageName;
10
+ this.imageQuality = imageQuality || dc_core_1.BuildingSpriteQuality.Default;
11
+ this.platformPrefix = platformPrefix || dc_core_1.StaticFileUrlPlatformPrefix.Default;
12
+ this.url = `https://${this.platformPrefix}-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/decorations/ui_${imageName}${this.imageQuality}.png`;
13
+ }
14
+ async download(filePath) {
15
+ return await super.download(this.url, filePath);
16
+ }
17
+ }
18
+ exports.DecorationSpriteDownloader = DecorationSpriteDownloader;
@@ -0,0 +1,13 @@
1
+ import { StaticFileUrlPlatformPrefix } from "@dchighs/dc-core";
2
+ import { StaticFileDownloader } from "./static-file-downloader";
3
+ export type DecorationThumbnailDownloaderOptions = {
4
+ imageName: string;
5
+ platformPrefix?: StaticFileUrlPlatformPrefix;
6
+ };
7
+ export declare class DecorationThumbnailDownloader extends StaticFileDownloader {
8
+ readonly url: string;
9
+ readonly imageName: string;
10
+ readonly platformPrefix: StaticFileUrlPlatformPrefix;
11
+ constructor({ imageName, platformPrefix }: DecorationThumbnailDownloaderOptions);
12
+ download(filePath: string): Promise<string>;
13
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecorationThumbnailDownloader = void 0;
4
+ const dc_core_1 = require("@dchighs/dc-core");
5
+ const static_file_downloader_1 = require("./static-file-downloader");
6
+ class DecorationThumbnailDownloader extends static_file_downloader_1.StaticFileDownloader {
7
+ constructor({ imageName, platformPrefix }) {
8
+ super();
9
+ this.imageName = imageName;
10
+ this.platformPrefix = platformPrefix || dc_core_1.StaticFileUrlPlatformPrefix.Default;
11
+ this.url = `https://${this.platformPrefix}-static-s1.socialpointgames.com/static/dragoncity/assets/thumbs/${imageName}.jpg`;
12
+ }
13
+ async download(filePath) {
14
+ return await super.download(this.url, filePath);
15
+ }
16
+ }
17
+ exports.DecorationThumbnailDownloader = DecorationThumbnailDownloader;
@@ -9,7 +9,7 @@ export declare class DragonFlashAnimationDownloader extends StaticFileDownloader
9
9
  readonly imageName: string;
10
10
  readonly phase: number;
11
11
  readonly skin?: string;
12
- readonly platformPrefix?: string;
12
+ readonly platformPrefix: string;
13
13
  readonly url: string;
14
14
  constructor({ imageName, phase, skin, platformPrefix, }: DragonFlashAnimationDownloaderOptions);
15
15
  download(filePath: string): Promise<string>;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,10 @@ import { DragonThumbnailDownloader, DragonThumbnailDownloaderOptions } from "./d
5
5
  import { IslandPackageDownloader, IslandPackageDownloaderOptions } from "./island-package-downloader";
6
6
  import { MusicDownloader, MusicDownloaderOptions } from "./music-downloader";
7
7
  import { ChestSpriteDownloader, ChestSpriteDownloaderOptions } from "./chest-sprite-downloader";
8
+ import { BuildingSpriteDownloader, BuildingSpriteDownloaderOptions } from "./building-sprite-downloader";
9
+ import { BuildingThumbnailDownloader, BuildingThumbnailDownloaderOptions } from "./building-thumbnail-downloader";
10
+ import { DecorationSpriteDownloader, DecorationSpriteDownloaderOptions } from "./decoration-sprite-downloader";
11
+ import { DecorationThumbnailDownloader, DecorationThumbnailDownloaderOptions } from "./decoration-thumbnail-downloader";
8
12
  declare const dcAssets: {
9
13
  dragons: {
10
14
  animations: {
@@ -23,6 +27,17 @@ declare const dcAssets: {
23
27
  chests: {
24
28
  sprite: (options: ChestSpriteDownloaderOptions) => ChestSpriteDownloader;
25
29
  };
30
+ buildings: {
31
+ sprite: (options: BuildingSpriteDownloaderOptions) => BuildingSpriteDownloader;
32
+ thumbnail: (options: BuildingThumbnailDownloaderOptions) => BuildingThumbnailDownloader;
33
+ };
34
+ decorations: {
35
+ sprite: (options: DecorationSpriteDownloaderOptions) => DecorationSpriteDownloader;
36
+ thumbnail: (options: DecorationThumbnailDownloaderOptions) => DecorationThumbnailDownloader;
37
+ };
38
+ habitats: {
39
+ sprite: null;
40
+ };
26
41
  };
27
42
  export * from "./dragon-flash-animation-downloader";
28
43
  export * from "./static-file-downloader";
@@ -31,4 +46,8 @@ export * from "./dragon-sprite-downloader";
31
46
  export * from "./island-package-downloader";
32
47
  export * from "./chest-sprite-downloader";
33
48
  export * from "./music-downloader";
49
+ export * from "./building-sprite-downloader";
50
+ export * from "./building-thumbnail-downloader";
51
+ export * from "./decoration-sprite-downloader";
52
+ export * from "./decoration-thumbnail-downloader";
34
53
  export default dcAssets;
package/dist/index.js CHANGED
@@ -21,6 +21,10 @@ const dragon_thumbnail_downloader_1 = require("./dragon-thumbnail-downloader");
21
21
  const island_package_downloader_1 = require("./island-package-downloader");
22
22
  const music_downloader_1 = require("./music-downloader");
23
23
  const chest_sprite_downloader_1 = require("./chest-sprite-downloader");
24
+ const building_sprite_downloader_1 = require("./building-sprite-downloader");
25
+ const building_thumbnail_downloader_1 = require("./building-thumbnail-downloader");
26
+ const decoration_sprite_downloader_1 = require("./decoration-sprite-downloader");
27
+ const decoration_thumbnail_downloader_1 = require("./decoration-thumbnail-downloader");
24
28
  const dcAssets = {
25
29
  dragons: {
26
30
  animations: {
@@ -38,6 +42,17 @@ const dcAssets = {
38
42
  },
39
43
  chests: {
40
44
  sprite: (options) => new chest_sprite_downloader_1.ChestSpriteDownloader(options)
45
+ },
46
+ buildings: {
47
+ sprite: (options) => new building_sprite_downloader_1.BuildingSpriteDownloader(options),
48
+ thumbnail: (options) => new building_thumbnail_downloader_1.BuildingThumbnailDownloader(options)
49
+ },
50
+ decorations: {
51
+ sprite: (options) => new decoration_sprite_downloader_1.DecorationSpriteDownloader(options),
52
+ thumbnail: (options) => new decoration_thumbnail_downloader_1.DecorationThumbnailDownloader(options)
53
+ },
54
+ habitats: {
55
+ sprite: null
41
56
  }
42
57
  };
43
58
  __exportStar(require("./dragon-flash-animation-downloader"), exports);
@@ -47,4 +62,8 @@ __exportStar(require("./dragon-sprite-downloader"), exports);
47
62
  __exportStar(require("./island-package-downloader"), exports);
48
63
  __exportStar(require("./chest-sprite-downloader"), exports);
49
64
  __exportStar(require("./music-downloader"), exports);
65
+ __exportStar(require("./building-sprite-downloader"), exports);
66
+ __exportStar(require("./building-thumbnail-downloader"), exports);
67
+ __exportStar(require("./decoration-sprite-downloader"), exports);
68
+ __exportStar(require("./decoration-thumbnail-downloader"), exports);
50
69
  exports.default = dcAssets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dchighs/dc-assets",
3
- "version": "0.0.5",
3
+ "version": "0.2.0",
4
4
  "description": "Library focused on downloading static files from the Dragon City server.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "axios": "^1.13.2"
34
34
  },
35
35
  "peerDependencies": {
36
- "@dchighs/dc-core": "^0.0.3"
36
+ "@dchighs/dc-core": "^0.1.0"
37
37
  },
38
38
  "repository": {
39
39
  "type": "git",