@dchighs/dc-assets 0.0.2 → 0.0.4
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 +169 -0
- package/dist/chest-sprite-downloader.d.ts +13 -0
- package/dist/chest-sprite-downloader.js +16 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# @dchighs/dc-assets
|
|
2
|
+
|
|
3
|
+
**@dchighs/dc-assets** is a package for downloading assets from the game [Dragon City](https://dragoncitygame.com/) (this is not an official SocialPoint library; it is fan-made).
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
Installation is straightforward—simply use your preferred package manager. Here is an example using NPM:
|
|
8
|
+
|
|
9
|
+
```bush
|
|
10
|
+
npm i @dchighs/dc-assets @dchighs/dc-core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> You need to install `@dchighs/dc-core` as well because I have set it as a `peerDependency`. This means the package requires `@dchighs/dc-core` to function, but it will use the specific version you have installed in your project.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Usage
|
|
18
|
+
|
|
19
|
+
<a href="https://www.buymeacoffee.com/marcuth">
|
|
20
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="200">
|
|
21
|
+
</a>
|
|
22
|
+
|
|
23
|
+
### Downloading Dragon Assets
|
|
24
|
+
|
|
25
|
+
#### Downloading Animations
|
|
26
|
+
|
|
27
|
+
**Flash Animations (`.swf`):**
|
|
28
|
+
|
|
29
|
+
To obtain the URL and download the Flash animation file (`.swf`), you will need to provide the following information:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { DragonPhase } from "@dchighs/dc-core"
|
|
33
|
+
import dcAssets from "@dchighs/dc-assets"
|
|
34
|
+
|
|
35
|
+
;(async () => {
|
|
36
|
+
const dragonFlashAnimationDownloader = dcAssets.dragons.animations.flash({
|
|
37
|
+
imageName: "1000_dragon_nature",
|
|
38
|
+
phase: DragonPhase.Adult,
|
|
39
|
+
// skin: "_1"
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
await dragonFlashAnimationDownloader.download("dragon-animation.swf")
|
|
43
|
+
})();
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Spine Animations (`.zip`):**
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { DragonPhase } from "@dchighs/dc-core"
|
|
50
|
+
import dcAssets from "@dchighs/dc-assets"
|
|
51
|
+
|
|
52
|
+
;(async () => {
|
|
53
|
+
const dragonSpineAnimationDownloader = dcAssets.dragons.animations.spine({
|
|
54
|
+
imageName: "1000_dragon_nature",
|
|
55
|
+
phase: DragonPhase.Adult,
|
|
56
|
+
// skin: "_1"
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
await dragonSpineAnimationDownloader.download("dragon-animation.zip")
|
|
60
|
+
})();
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### Downloading Dragon Sprites
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { DragonPhase, DragonSpriteQuality } from "@dchighs/dc-core"
|
|
69
|
+
import dcAssets from "@dchighs/dc-assets"
|
|
70
|
+
|
|
71
|
+
;(async () => {
|
|
72
|
+
const dragonSpriteDownloader = dcAssets.dragons.sprite({
|
|
73
|
+
imageName: "1000_dragon_nature",
|
|
74
|
+
phase: DragonPhase.Adult,
|
|
75
|
+
imageQuality: DragonSpriteQuality.Large
|
|
76
|
+
// skin: "_1"
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
await dragonSpriteDownloader.download("dragon-sprite.png")
|
|
80
|
+
})();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### Downloading Dragon Thumbnails
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { DragonPhase } from "@dchighs/dc-core"
|
|
89
|
+
import dcAssets from "@dchighs/dc-assets"
|
|
90
|
+
|
|
91
|
+
;(async () => {
|
|
92
|
+
const dragonThumbDownloader = dcAssets.dragons.thumbnail({
|
|
93
|
+
imageName: "1000_dragon_nature",
|
|
94
|
+
phase: DragonPhase.Adult,
|
|
95
|
+
// skin: "_1"
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
await dragonThumbDownloader.download("dragon-thumbnail.png")
|
|
99
|
+
})();
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### Downloading Island Content Packages
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import dcAssets from "@dchighs/dc-assets"
|
|
108
|
+
|
|
109
|
+
;(async () => {
|
|
110
|
+
const islandDownloader = dcAssets.islands.package({
|
|
111
|
+
fileName: "1000_dragon_nature",
|
|
112
|
+
islandType: "heroicraces_islands",
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
await islandDownloader.download("island-package.zip")
|
|
116
|
+
})();
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Downloading Audio
|
|
120
|
+
|
|
121
|
+
**Music:**
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import dcAssets from "@dchighs/dc-assets"
|
|
125
|
+
|
|
126
|
+
;(async () => {
|
|
127
|
+
const musicDownloader = dcAssets.sounds.music({
|
|
128
|
+
keyName: "531_dc_party_planning_island"
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
await musicDownloader.download("music.mp3") // Fixed extension example
|
|
132
|
+
})();
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Downloading Chest Sprites
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import dcAssets from "@dchighs/dc-assets"
|
|
141
|
+
|
|
142
|
+
;(async () => {
|
|
143
|
+
const chestDownloader = dcAssets.chests.sprite({
|
|
144
|
+
fileName: "1000_dragon_nature",
|
|
145
|
+
islandType: "heroicraces_islands",
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
await chestDownloader.download("chest-sprite.png")
|
|
149
|
+
})();
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🤝 Contributing
|
|
155
|
+
|
|
156
|
+
* Want to contribute? Follow these steps:
|
|
157
|
+
* Fork the repository.
|
|
158
|
+
* Create a new branch (`git checkout -b feature-new`).
|
|
159
|
+
* Commit your changes (`git commit -m 'Add new feature'`).
|
|
160
|
+
* Push to the branch (`git push origin feature-new`).
|
|
161
|
+
* Open a Pull Request.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 📝 License
|
|
166
|
+
|
|
167
|
+
This project is licensed under the MIT License.
|
|
168
|
+
|
|
169
|
+
Would you like me to proofread the technical terms or adjust the tone for a specific audience?
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DragonSpriteQuality } from "@dchighs/dc-core";
|
|
2
|
+
import { StaticFileDownloader } from "./static-file-downloader";
|
|
3
|
+
export type ChestSpriteDownloaderOptions = {
|
|
4
|
+
imageQuality: DragonSpriteQuality;
|
|
5
|
+
imageName: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class ChestSpriteDownloader extends StaticFileDownloader {
|
|
8
|
+
readonly url: string;
|
|
9
|
+
readonly imageQuality: DragonSpriteQuality;
|
|
10
|
+
readonly imageName: string;
|
|
11
|
+
constructor({ imageQuality, imageName }: ChestSpriteDownloaderOptions);
|
|
12
|
+
download(filePath: string): Promise<string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChestSpriteDownloader = void 0;
|
|
4
|
+
const static_file_downloader_1 = require("./static-file-downloader");
|
|
5
|
+
class ChestSpriteDownloader extends static_file_downloader_1.StaticFileDownloader {
|
|
6
|
+
constructor({ imageQuality, imageName }) {
|
|
7
|
+
super();
|
|
8
|
+
this.imageQuality = imageQuality;
|
|
9
|
+
this.imageName = imageName;
|
|
10
|
+
this.url = `https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/chests/ui_basic_${imageName}${imageQuality}.png`;
|
|
11
|
+
}
|
|
12
|
+
async download(filePath) {
|
|
13
|
+
return await super.download(this.url, filePath);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ChestSpriteDownloader = ChestSpriteDownloader;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DragonSpriteDownloader, DragonSpriteDownloaderOptions } from "./dragon-
|
|
|
4
4
|
import { DragonThumbnailDownloader, DragonThumbnailDownloaderOptions } from "./dragon-thumbnail-downloader";
|
|
5
5
|
import { IslandPackageDownloader, IslandPackageDownloaderOptions } from "./island-package-downloader";
|
|
6
6
|
import { MusicDownloader, MusicDownloaderOptions } from "./music-downloader";
|
|
7
|
+
import { ChestSpriteDownloader, ChestSpriteDownloaderOptions } from "./chest-sprite-downloader";
|
|
7
8
|
declare const dcAssets: {
|
|
8
9
|
dragons: {
|
|
9
10
|
animations: {
|
|
@@ -19,11 +20,15 @@ declare const dcAssets: {
|
|
|
19
20
|
sounds: {
|
|
20
21
|
music: (options: MusicDownloaderOptions) => MusicDownloader;
|
|
21
22
|
};
|
|
23
|
+
chests: {
|
|
24
|
+
sprite: (options: ChestSpriteDownloaderOptions) => ChestSpriteDownloader;
|
|
25
|
+
};
|
|
22
26
|
};
|
|
23
27
|
export * from "./dragon-flash-animation-downloader";
|
|
24
28
|
export * from "./static-file-downloader";
|
|
25
29
|
export * from "./dragon-spine-animation-downloader";
|
|
26
30
|
export * from "./dragon-sprite-downloader";
|
|
27
31
|
export * from "./island-package-downloader";
|
|
32
|
+
export * from "./chest-sprite-downloader";
|
|
28
33
|
export * from "./music-downloader";
|
|
29
34
|
export default dcAssets;
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const dragon_sprite_downloader_1 = require("./dragon-sprite-downloader");
|
|
|
20
20
|
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
|
+
const chest_sprite_downloader_1 = require("./chest-sprite-downloader");
|
|
23
24
|
const dcAssets = {
|
|
24
25
|
dragons: {
|
|
25
26
|
animations: {
|
|
@@ -34,6 +35,9 @@ const dcAssets = {
|
|
|
34
35
|
},
|
|
35
36
|
sounds: {
|
|
36
37
|
music: (options) => new music_downloader_1.MusicDownloader(options)
|
|
38
|
+
},
|
|
39
|
+
chests: {
|
|
40
|
+
sprite: (options) => new chest_sprite_downloader_1.ChestSpriteDownloader(options)
|
|
37
41
|
}
|
|
38
42
|
};
|
|
39
43
|
__exportStar(require("./dragon-flash-animation-downloader"), exports);
|
|
@@ -41,5 +45,6 @@ __exportStar(require("./static-file-downloader"), exports);
|
|
|
41
45
|
__exportStar(require("./dragon-spine-animation-downloader"), exports);
|
|
42
46
|
__exportStar(require("./dragon-sprite-downloader"), exports);
|
|
43
47
|
__exportStar(require("./island-package-downloader"), exports);
|
|
48
|
+
__exportStar(require("./chest-sprite-downloader"), exports);
|
|
44
49
|
__exportStar(require("./music-downloader"), exports);
|
|
45
50
|
exports.default = dcAssets;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dchighs/dc-assets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
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.
|
|
36
|
+
"@dchighs/dc-core": "^0.0.3"
|
|
37
37
|
},
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|