@dchighs/dc-assets 0.0.1 → 0.0.3
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/island-package-downloader.js +1 -1
- 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?
|
|
@@ -17,7 +17,7 @@ class IslandPackageDownloader extends static_file_downloader_1.StaticFileDownloa
|
|
|
17
17
|
if (islandType === dc_core_1.IslandType.GridIslands && !fileName.endsWith("_optim.zip")) {
|
|
18
18
|
fileName = fileName.replace(".zip", "_optim.zip");
|
|
19
19
|
}
|
|
20
|
-
this.url = `https://www.socialpointgames.com/static/dragoncity/mobile/ui/${islandType === dc_core_1.IslandType.HeroicRaces ? "heroicraces_islands" :
|
|
20
|
+
this.url = `https://www.socialpointgames.com/static/dragoncity/mobile/ui/${islandType === dc_core_1.IslandType.HeroicRaces ? "heroicraces_islands" : islandType}/HD/dxt5/${fileName}`;
|
|
21
21
|
}
|
|
22
22
|
async download(filePath) {
|
|
23
23
|
return await super.download(this.url, filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dchighs/dc-assets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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",
|