feat: Add scripts for mob dependency management and server setup

- Implemented `findMobDependencies.ts` to identify foreign key constraints referencing the Mob table and log dependent rows.
- Created `fullServerSetup.ts` for idempotent server setup, including economy items, item recipes, game areas, mobs, and optional demo mob attacks.
- Developed `removeInvalidMobsWithDeps.ts` to delete invalid mobs and their dependencies, backing up affected scheduled mob attacks.
- Added unit tests in `testMobUnit.ts` and `mob.test.ts` for mob functionality, including stats computation and instance retrieval.
- Introduced reward modification tests in `testRewardMods.ts` and `rewardMods.unit.ts` to validate drop selection and coin multiplier behavior.
- Enhanced command handling for mob deletion in `mobDelete.ts` and setup examples in `setup.ts`, ensuring proper permissions and feedback.
- Created utility functions in `testHelpers.ts` for deterministic drop selection from mob definitions.
This commit is contained in:
Shni
2025-10-14 14:58:38 -05:00
parent f36fa24e46
commit 852b1d02a2
24 changed files with 2158 additions and 177 deletions

131
invalid_mobs_backup.json Normal file
View File

@@ -0,0 +1,131 @@
[
{
"id": "cmgqyuj2h000zmofwe8oflv0r",
"error": {
"name": "ZodError",
"message": "[\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"key\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"number\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"tier\"\n ],\n \"message\": \"Invalid input: expected number, received undefined\"\n },\n {\n \"expected\": \"object\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"base\"\n ],\n \"message\": \"Invalid input: expected object, received undefined\"\n }\n]"
},
"row": {
"id": "cmgqyuj2h000zmofwe8oflv0r",
"key": "bat",
"name": "Murciélago",
"category": null,
"guildId": "1316592320954630144",
"stats": {
"attack": 4
},
"drops": null,
"metadata": null,
"createdAt": "2025-10-14T19:39:39.401Z",
"updatedAt": "2025-10-14T19:39:39.401Z"
}
},
{
"id": "cmgqyuj6r0011mofwii4i80qf",
"error": {
"name": "ZodError",
"message": "[\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"key\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"number\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"tier\"\n ],\n \"message\": \"Invalid input: expected number, received undefined\"\n },\n {\n \"expected\": \"object\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"base\"\n ],\n \"message\": \"Invalid input: expected object, received undefined\"\n }\n]"
},
"row": {
"id": "cmgqyuj6r0011mofwii4i80qf",
"key": "slime",
"name": "Slime",
"category": null,
"guildId": "1316592320954630144",
"stats": {
"attack": 6
},
"drops": null,
"metadata": null,
"createdAt": "2025-10-14T19:39:39.556Z",
"updatedAt": "2025-10-14T19:39:39.556Z"
}
},
{
"id": "cmgqyuj8t0013mofwsc965xxk",
"error": {
"name": "ZodError",
"message": "[\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"key\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"number\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"tier\"\n ],\n \"message\": \"Invalid input: expected number, received undefined\"\n },\n {\n \"expected\": \"object\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"base\"\n ],\n \"message\": \"Invalid input: expected object, received undefined\"\n }\n]"
},
"row": {
"id": "cmgqyuj8t0013mofwsc965xxk",
"key": "goblin",
"name": "Duende",
"category": null,
"guildId": "1316592320954630144",
"stats": {
"attack": 8
},
"drops": null,
"metadata": null,
"createdAt": "2025-10-14T19:39:39.629Z",
"updatedAt": "2025-10-14T19:39:39.629Z"
}
},
{
"id": "cmgqyunde001zmofwyqw6oh49",
"error": {
"name": "ZodError",
"message": "[\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"key\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"number\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"tier\"\n ],\n \"message\": \"Invalid input: expected number, received undefined\"\n },\n {\n \"expected\": \"object\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"base\"\n ],\n \"message\": \"Invalid input: expected object, received undefined\"\n }\n]"
},
"row": {
"id": "cmgqyunde001zmofwyqw6oh49",
"key": "orc",
"name": "Orco",
"category": null,
"guildId": "1316592320954630144",
"stats": {
"attack": 12,
"defense": 2
},
"drops": null,
"metadata": null,
"createdAt": "2025-10-14T19:39:44.978Z",
"updatedAt": "2025-10-14T19:39:44.978Z"
}
},
{
"id": "cmgqyunf90021mofw2nb0j3ye",
"error": {
"name": "ZodError",
"message": "[\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"key\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"number\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"tier\"\n ],\n \"message\": \"Invalid input: expected number, received undefined\"\n },\n {\n \"expected\": \"object\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"base\"\n ],\n \"message\": \"Invalid input: expected object, received undefined\"\n }\n]"
},
"row": {
"id": "cmgqyunf90021mofw2nb0j3ye",
"key": "troll",
"name": "Trol",
"category": null,
"guildId": "1316592320954630144",
"stats": {
"attack": 20,
"defense": 4
},
"drops": null,
"metadata": null,
"createdAt": "2025-10-14T19:39:45.045Z",
"updatedAt": "2025-10-14T19:39:45.045Z"
}
},
{
"id": "cmgqyunha0023mofwyhh34uye",
"error": {
"name": "ZodError",
"message": "[\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"key\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"number\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"tier\"\n ],\n \"message\": \"Invalid input: expected number, received undefined\"\n },\n {\n \"expected\": \"object\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"base\"\n ],\n \"message\": \"Invalid input: expected object, received undefined\"\n }\n]"
},
"row": {
"id": "cmgqyunha0023mofwyhh34uye",
"key": "dragonling",
"name": "Dragoncito",
"category": null,
"guildId": "1316592320954630144",
"stats": {
"attack": 35,
"defense": 6
},
"drops": null,
"metadata": null,
"createdAt": "2025-10-14T19:39:45.119Z",
"updatedAt": "2025-10-14T19:39:45.119Z"
}
}
]