@dchighs/dc-config 0.0.3 → 0.0.6
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/LICENSE +20 -20
- package/README.md +88 -88
- package/dist/dtos/game-config.d.ts +3319 -3486
- package/dist/dtos/game-config.js +832 -0
- package/package.json +4 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Marcuth
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Marcuth
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
# @dchighs/dc-config
|
|
2
|
-
|
|
3
|
-
> ⚠️ **Note**: Don't ask me how to get your URL, Auth Token, or User ID; I won't answer you. If you don't know how to use this, it's because you shouldn't.
|
|
4
|
-
|
|
5
|
-
**@dchighs/dc-config** is a package for accessing game configuration data from [Dragon City](https://dragoncitygame.com/) (this is not an official SocialPoint library; it is fan-made).
|
|
6
|
-
|
|
7
|
-
## 📦 Installation
|
|
8
|
-
|
|
9
|
-
Installation is straightforward—simply use your preferred package manager. Here is an example using NPM:
|
|
10
|
-
|
|
11
|
-
```cmd
|
|
12
|
-
npm i @dchighs/dc-config
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## 🚀 Usage
|
|
17
|
-
|
|
18
|
-
<a href="https://www.buymeacoffee.com/marcuth">
|
|
19
|
-
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="200">
|
|
20
|
-
</a>
|
|
21
|
-
|
|
22
|
-
### Fetching configuration for specific parameters
|
|
23
|
-
|
|
24
|
-
To create a `Config` instance, you need to provide credentials or use the static `.create()` method by providing the necessary parameters:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { Config, ConfigLanguage, ConfigPlatform, ConfigFilter } from "@dchighs/dc-config"
|
|
28
|
-
|
|
29
|
-
;(async () => {
|
|
30
|
-
const userId = process.env.USER_ID
|
|
31
|
-
const authToken = process.env.AUTH_TOKEN
|
|
32
|
-
const url = process.env.URL
|
|
33
|
-
|
|
34
|
-
const config = await Config.create({
|
|
35
|
-
url: url,
|
|
36
|
-
userId: userId,
|
|
37
|
-
authToken: authToken,
|
|
38
|
-
language: ConfigLanguage.Turkish, // optional - "en" is default
|
|
39
|
-
platform: ConfigPlatform.Android, // optional - "ios" is default
|
|
40
|
-
filter: [ConfigFilter.Items] // optional - undefined is default
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const data = config.data
|
|
44
|
-
|
|
45
|
-
console.log(data)
|
|
46
|
-
})();
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
### Loading a saved configuration from a file
|
|
53
|
-
|
|
54
|
-
If you have a saved JSON file containing configuration data and want to load it to perform operations using the class, you can do it as follows:
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
import { Config, ConfigLanguage, ConfigPlatform, GameConfigDto } from "@dchighs/dc-config"
|
|
58
|
-
import fs from "node:fs"
|
|
59
|
-
|
|
60
|
-
;(async () => {
|
|
61
|
-
const filePath = "config.json"
|
|
62
|
-
const contentString = await fs.promises.readFile(filePath, { encoding: "utf-8" })
|
|
63
|
-
const data = JSON.parse(contentString) as GameConfigDto
|
|
64
|
-
|
|
65
|
-
const config = new Config({
|
|
66
|
-
language: ConfigLanguage.Turkish,
|
|
67
|
-
platform: ConfigPlatform.Android,
|
|
68
|
-
data: data
|
|
69
|
-
})
|
|
70
|
-
})();
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## 🤝 Contributing
|
|
77
|
-
|
|
78
|
-
* Want to contribute? Follow these steps:
|
|
79
|
-
* Fork the repository.
|
|
80
|
-
* Create a new branch (`git checkout -b feature-new`).
|
|
81
|
-
* Commit your changes (`git commit -m 'Add new feature'`).
|
|
82
|
-
* Push to the branch (`git push origin feature-new`).
|
|
83
|
-
* Open a Pull Request.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## 📝 License
|
|
88
|
-
|
|
1
|
+
# @dchighs/dc-config
|
|
2
|
+
|
|
3
|
+
> ⚠️ **Note**: Don't ask me how to get your URL, Auth Token, or User ID; I won't answer you. If you don't know how to use this, it's because you shouldn't.
|
|
4
|
+
|
|
5
|
+
**@dchighs/dc-config** is a package for accessing game configuration data from [Dragon City](https://dragoncitygame.com/) (this is not an official SocialPoint library; it is fan-made).
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
Installation is straightforward—simply use your preferred package manager. Here is an example using NPM:
|
|
10
|
+
|
|
11
|
+
```cmd
|
|
12
|
+
npm i @dchighs/dc-config
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 🚀 Usage
|
|
17
|
+
|
|
18
|
+
<a href="https://www.buymeacoffee.com/marcuth">
|
|
19
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="200">
|
|
20
|
+
</a>
|
|
21
|
+
|
|
22
|
+
### Fetching configuration for specific parameters
|
|
23
|
+
|
|
24
|
+
To create a `Config` instance, you need to provide credentials or use the static `.create()` method by providing the necessary parameters:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { Config, ConfigLanguage, ConfigPlatform, ConfigFilter } from "@dchighs/dc-config"
|
|
28
|
+
|
|
29
|
+
;(async () => {
|
|
30
|
+
const userId = process.env.USER_ID
|
|
31
|
+
const authToken = process.env.AUTH_TOKEN
|
|
32
|
+
const url = process.env.URL
|
|
33
|
+
|
|
34
|
+
const config = await Config.create({
|
|
35
|
+
url: url,
|
|
36
|
+
userId: userId,
|
|
37
|
+
authToken: authToken,
|
|
38
|
+
language: ConfigLanguage.Turkish, // optional - "en" is default
|
|
39
|
+
platform: ConfigPlatform.Android, // optional - "ios" is default
|
|
40
|
+
filter: [ConfigFilter.Items] // optional - undefined is default
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const data = config.data
|
|
44
|
+
|
|
45
|
+
console.log(data)
|
|
46
|
+
})();
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### Loading a saved configuration from a file
|
|
53
|
+
|
|
54
|
+
If you have a saved JSON file containing configuration data and want to load it to perform operations using the class, you can do it as follows:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { Config, ConfigLanguage, ConfigPlatform, GameConfigDto } from "@dchighs/dc-config"
|
|
58
|
+
import fs from "node:fs"
|
|
59
|
+
|
|
60
|
+
;(async () => {
|
|
61
|
+
const filePath = "config.json"
|
|
62
|
+
const contentString = await fs.promises.readFile(filePath, { encoding: "utf-8" })
|
|
63
|
+
const data = JSON.parse(contentString) as GameConfigDto
|
|
64
|
+
|
|
65
|
+
const config = new Config({
|
|
66
|
+
language: ConfigLanguage.Turkish,
|
|
67
|
+
platform: ConfigPlatform.Android,
|
|
68
|
+
data: data
|
|
69
|
+
})
|
|
70
|
+
})();
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🤝 Contributing
|
|
77
|
+
|
|
78
|
+
* Want to contribute? Follow these steps:
|
|
79
|
+
* Fork the repository.
|
|
80
|
+
* Create a new branch (`git checkout -b feature-new`).
|
|
81
|
+
* Commit your changes (`git commit -m 'Add new feature'`).
|
|
82
|
+
* Push to the branch (`git push origin feature-new`).
|
|
83
|
+
* Open a Pull Request.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 📝 License
|
|
88
|
+
|
|
89
89
|
This project is licensed under the MIT License.
|