mm_datas 0.0.0-stage → 5.3.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.
Files changed (42) hide show
  1. package/example/custom_demo.js +237 -0
  2. package/example/model/item_model.json +46 -0
  3. package/example/model/map_model.json +53 -0
  4. package/example/model/player_model.json +65 -0
  5. package/example/model/role_model.json +61 -0
  6. package/example/model/skill_model.json +60 -0
  7. package/example/preset_demo.js +44 -0
  8. package/example/rpg_cache.js +179 -0
  9. package/example/rpg_crud.js +170 -0
  10. package/example/rpg_demo.js +61 -0
  11. package/example/rpg_model/bag_model.json +74 -0
  12. package/example/rpg_model/character_model.json +165 -0
  13. package/example/rpg_model/character_skill_model.json +61 -0
  14. package/example/rpg_model/drop_model.json +103 -0
  15. package/example/rpg_model/item_model.json +189 -0
  16. package/example/rpg_model/job_model.json +96 -0
  17. package/example/rpg_model/level_exp_model.json +111 -0
  18. package/example/rpg_model/map_model.json +166 -0
  19. package/example/rpg_model/map_state_model.json +63 -0
  20. package/example/rpg_model/monster_model.json +115 -0
  21. package/example/rpg_model/npc_model.json +103 -0
  22. package/example/rpg_model/quest_model.json +106 -0
  23. package/example/rpg_model/quest_progress_model.json +61 -0
  24. package/example/rpg_model/save_model.json +42 -0
  25. package/example/rpg_model/skill_model.json +124 -0
  26. package/example/rpg_persistence.js +151 -0
  27. package/example/rpg_relations.js +196 -0
  28. package/example/rpg_world.js +149 -0
  29. package/example/storage_demo.js +194 -0
  30. package/index.js +122 -0
  31. package/lib/backend.js +597 -0
  32. package/lib/errors.js +35 -0
  33. package/lib/manager.js +717 -0
  34. package/lib/model.js +540 -0
  35. package/lib/pool.js +277 -0
  36. package/lib/relation.js +175 -0
  37. package/lib/store.js +430 -0
  38. package/package.json +64 -5
  39. package/test.js +748 -0
  40. package/tool/data/index.js +107 -0
  41. package/tool/data/tool.json +211 -0
  42. package/README.md +0 -3
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "character_skill",
3
+ "kind": "link",
4
+ "description": "角色已学技能(静态模板 × 动态持有)",
5
+ "key": "id",
6
+ "store": {
7
+ "db": "mysql",
8
+ "table": "game_character_skill",
9
+ "indexes": [
10
+ [
11
+ "character_id",
12
+ "skill_id"
13
+ ]
14
+ ]
15
+ },
16
+ "schema": {
17
+ "$schema": "http://json-schema.org/draft-07/schema#",
18
+ "type": "object",
19
+ "properties": {
20
+ "id": {
21
+ "type": "number",
22
+ "primary": true,
23
+ "auto": true
24
+ },
25
+ "character_id": {
26
+ "type": "number",
27
+ "ref": "character"
28
+ },
29
+ "skill_id": {
30
+ "type": "number",
31
+ "ref": {
32
+ "model": "skill",
33
+ "as": "skill"
34
+ }
35
+ },
36
+ "skill_name": {
37
+ "type": "string",
38
+ "snapshot": "skill.name",
39
+ "default": ""
40
+ },
41
+ "cfg_ver": {
42
+ "type": "number",
43
+ "default": 0,
44
+ "description": "静态表版本钉扎"
45
+ },
46
+ "level": {
47
+ "type": "number",
48
+ "default": 1
49
+ },
50
+ "exp": {
51
+ "type": "number",
52
+ "default": 0
53
+ }
54
+ },
55
+ "required": [
56
+ "character_id",
57
+ "skill_id"
58
+ ],
59
+ "additionalProperties": false
60
+ }
61
+ }
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "drop",
3
+ "kind": "static",
4
+ "version": 6,
5
+ "description": "掉落表(静态,同时关联怪物与道具)",
6
+ "key": "drop_id",
7
+ "store": {
8
+ "db": "memory",
9
+ "table": "sys_drop"
10
+ },
11
+ "schema": {
12
+ "$schema": "http://json-schema.org/draft-07/schema#",
13
+ "type": "object",
14
+ "properties": {
15
+ "drop_id": {
16
+ "type": "number",
17
+ "primary": true
18
+ },
19
+ "monster_id": {
20
+ "type": "number",
21
+ "ref": "monster"
22
+ },
23
+ "item_id": {
24
+ "type": "number",
25
+ "ref": "item"
26
+ },
27
+ "rate": {
28
+ "type": "number",
29
+ "default": 0.1,
30
+ "minimum": 0,
31
+ "maximum": 1
32
+ },
33
+ "min": {
34
+ "type": "number",
35
+ "default": 1
36
+ },
37
+ "max": {
38
+ "type": "number",
39
+ "default": 1
40
+ }
41
+ },
42
+ "required": [],
43
+ "additionalProperties": false
44
+ },
45
+ "seed": [
46
+ {
47
+ "drop_id": 1,
48
+ "monster_id": 1,
49
+ "item_id": 4001,
50
+ "rate": 0.6,
51
+ "min": 1,
52
+ "max": 2
53
+ },
54
+ {
55
+ "drop_id": 2,
56
+ "monster_id": 2,
57
+ "item_id": 4002,
58
+ "rate": 0.45,
59
+ "min": 1,
60
+ "max": 1
61
+ },
62
+ {
63
+ "drop_id": 3,
64
+ "monster_id": 2,
65
+ "item_id": 3001,
66
+ "rate": 0.2,
67
+ "min": 1,
68
+ "max": 2
69
+ },
70
+ {
71
+ "drop_id": 4,
72
+ "monster_id": 3,
73
+ "item_id": 1002,
74
+ "rate": 0.08,
75
+ "min": 1,
76
+ "max": 1
77
+ },
78
+ {
79
+ "drop_id": 5,
80
+ "monster_id": 4,
81
+ "item_id": 2002,
82
+ "rate": 0.12,
83
+ "min": 1,
84
+ "max": 1
85
+ },
86
+ {
87
+ "drop_id": 6,
88
+ "monster_id": 99,
89
+ "item_id": 4003,
90
+ "rate": 1,
91
+ "min": 3,
92
+ "max": 5
93
+ },
94
+ {
95
+ "drop_id": 7,
96
+ "monster_id": 99,
97
+ "item_id": 1003,
98
+ "rate": 0.05,
99
+ "min": 1,
100
+ "max": 1
101
+ }
102
+ ]
103
+ }
@@ -0,0 +1,189 @@
1
+ {
2
+ "name": "item",
3
+ "kind": "static",
4
+ "version": 12,
5
+ "description": "道具模板(静态配置)",
6
+ "key": "item_id",
7
+ "store": {
8
+ "db": "memory",
9
+ "table": "sys_item"
10
+ },
11
+ "indexes": [
12
+ {
13
+ "field": "type",
14
+ "type": "inverted"
15
+ }
16
+ ],
17
+ "schema": {
18
+ "$schema": "http://json-schema.org/draft-07/schema#",
19
+ "type": "object",
20
+ "properties": {
21
+ "item_id": {
22
+ "type": "number",
23
+ "primary": true,
24
+ "description": "道具ID"
25
+ },
26
+ "name": {
27
+ "type": "string"
28
+ },
29
+ "type": {
30
+ "type": "string",
31
+ "enum": [
32
+ "weapon",
33
+ "armor",
34
+ "potion",
35
+ "material",
36
+ "quest"
37
+ ]
38
+ },
39
+ "icon": {
40
+ "type": "string",
41
+ "default": ""
42
+ },
43
+ "price": {
44
+ "type": "number",
45
+ "default": 0
46
+ },
47
+ "stack_max": {
48
+ "type": "number",
49
+ "default": 1
50
+ },
51
+ "atk": {
52
+ "type": "number",
53
+ "default": 0
54
+ },
55
+ "def": {
56
+ "type": "number",
57
+ "default": 0
58
+ },
59
+ "hp_bonus": {
60
+ "type": "number",
61
+ "default": 0
62
+ },
63
+ "level_req": {
64
+ "type": "number",
65
+ "default": 1
66
+ },
67
+ "description": {
68
+ "type": "string",
69
+ "default": ""
70
+ }
71
+ },
72
+ "required": [
73
+ "name",
74
+ "type"
75
+ ],
76
+ "additionalProperties": false
77
+ },
78
+ "seed": [
79
+ {
80
+ "item_id": 1001,
81
+ "name": "铁剑",
82
+ "type": "weapon",
83
+ "icon": "sword_01",
84
+ "price": 120,
85
+ "stack_max": 1,
86
+ "atk": 12,
87
+ "level_req": 1
88
+ },
89
+ {
90
+ "item_id": 1002,
91
+ "name": "钢剑",
92
+ "type": "weapon",
93
+ "icon": "sword_02",
94
+ "price": 480,
95
+ "stack_max": 1,
96
+ "atk": 28,
97
+ "level_req": 10
98
+ },
99
+ {
100
+ "item_id": 1003,
101
+ "name": "龙牙巨剑",
102
+ "type": "weapon",
103
+ "icon": "sword_09",
104
+ "price": 8800,
105
+ "stack_max": 1,
106
+ "atk": 96,
107
+ "level_req": 35
108
+ },
109
+ {
110
+ "item_id": 2001,
111
+ "name": "皮甲",
112
+ "type": "armor",
113
+ "icon": "armor_01",
114
+ "price": 90,
115
+ "stack_max": 1,
116
+ "def": 8,
117
+ "level_req": 1
118
+ },
119
+ {
120
+ "item_id": 2002,
121
+ "name": "锁子甲",
122
+ "type": "armor",
123
+ "icon": "armor_04",
124
+ "price": 620,
125
+ "stack_max": 1,
126
+ "def": 24,
127
+ "level_req": 12
128
+ },
129
+ {
130
+ "item_id": 3001,
131
+ "name": "小红药水",
132
+ "type": "potion",
133
+ "icon": "potion_r",
134
+ "price": 15,
135
+ "stack_max": 99,
136
+ "hp_bonus": 50
137
+ },
138
+ {
139
+ "item_id": 3002,
140
+ "name": "大红药水",
141
+ "type": "potion",
142
+ "icon": "potion_r2",
143
+ "price": 60,
144
+ "stack_max": 99,
145
+ "hp_bonus": 200
146
+ },
147
+ {
148
+ "item_id": 3003,
149
+ "name": "蓝药水",
150
+ "type": "potion",
151
+ "icon": "potion_b",
152
+ "price": 20,
153
+ "stack_max": 99,
154
+ "hp_bonus": 0
155
+ },
156
+ {
157
+ "item_id": 4001,
158
+ "name": "史莱姆凝胶",
159
+ "type": "material",
160
+ "icon": "mat_01",
161
+ "price": 8,
162
+ "stack_max": 999
163
+ },
164
+ {
165
+ "item_id": 4002,
166
+ "name": "狼皮",
167
+ "type": "material",
168
+ "icon": "mat_02",
169
+ "price": 14,
170
+ "stack_max": 999
171
+ },
172
+ {
173
+ "item_id": 4003,
174
+ "name": "龙骨碎片",
175
+ "type": "material",
176
+ "icon": "mat_09",
177
+ "price": 1200,
178
+ "stack_max": 99
179
+ },
180
+ {
181
+ "item_id": 5001,
182
+ "name": "勇者之证",
183
+ "type": "quest",
184
+ "icon": "quest_01",
185
+ "price": 0,
186
+ "stack_max": 1
187
+ }
188
+ ]
189
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "job",
3
+ "kind": "static",
4
+ "version": 3,
5
+ "description": "职业模板(静态配置)",
6
+ "key": "job_id",
7
+ "store": {
8
+ "db": "memory",
9
+ "table": "sys_job"
10
+ },
11
+ "schema": {
12
+ "$schema": "http://json-schema.org/draft-07/schema#",
13
+ "type": "object",
14
+ "properties": {
15
+ "job_id": {
16
+ "type": "number",
17
+ "primary": true,
18
+ "description": "职业ID"
19
+ },
20
+ "name": {
21
+ "type": "string",
22
+ "description": "职业名"
23
+ },
24
+ "base_hp": {
25
+ "type": "number",
26
+ "default": 100
27
+ },
28
+ "base_mp": {
29
+ "type": "number",
30
+ "default": 30
31
+ },
32
+ "hp_growth": {
33
+ "type": "number",
34
+ "default": 10
35
+ },
36
+ "mp_growth": {
37
+ "type": "number",
38
+ "default": 5
39
+ },
40
+ "atk_growth": {
41
+ "type": "number",
42
+ "default": 3
43
+ },
44
+ "def_growth": {
45
+ "type": "number",
46
+ "default": 2
47
+ }
48
+ },
49
+ "required": [
50
+ "name"
51
+ ],
52
+ "additionalProperties": false
53
+ },
54
+ "seed": [
55
+ {
56
+ "job_id": 1,
57
+ "name": "战士",
58
+ "base_hp": 180,
59
+ "base_mp": 20,
60
+ "hp_growth": 18,
61
+ "mp_growth": 3,
62
+ "atk_growth": 5,
63
+ "def_growth": 4
64
+ },
65
+ {
66
+ "job_id": 2,
67
+ "name": "法师",
68
+ "base_hp": 100,
69
+ "base_mp": 120,
70
+ "hp_growth": 8,
71
+ "mp_growth": 14,
72
+ "atk_growth": 3,
73
+ "def_growth": 1
74
+ },
75
+ {
76
+ "job_id": 3,
77
+ "name": "弓手",
78
+ "base_hp": 130,
79
+ "base_mp": 60,
80
+ "hp_growth": 12,
81
+ "mp_growth": 7,
82
+ "atk_growth": 4,
83
+ "def_growth": 2
84
+ },
85
+ {
86
+ "job_id": 4,
87
+ "name": "牧师",
88
+ "base_hp": 120,
89
+ "base_mp": 100,
90
+ "hp_growth": 11,
91
+ "mp_growth": 11,
92
+ "atk_growth": 2,
93
+ "def_growth": 3
94
+ }
95
+ ]
96
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "name": "level_exp",
3
+ "kind": "static",
4
+ "version": 1,
5
+ "description": "等级成长表(静态数值配置)",
6
+ "key": "level",
7
+ "store": {
8
+ "db": "memory",
9
+ "table": "sys_level_exp"
10
+ },
11
+ "schema": {
12
+ "$schema": "http://json-schema.org/draft-07/schema#",
13
+ "type": "object",
14
+ "properties": {
15
+ "level": {
16
+ "type": "number",
17
+ "primary": true
18
+ },
19
+ "exp_need": {
20
+ "type": "number",
21
+ "default": 0
22
+ },
23
+ "hp_growth": {
24
+ "type": "number",
25
+ "default": 10
26
+ },
27
+ "mp_growth": {
28
+ "type": "number",
29
+ "default": 5
30
+ },
31
+ "atk_growth": {
32
+ "type": "number",
33
+ "default": 3
34
+ }
35
+ },
36
+ "required": [],
37
+ "additionalProperties": false
38
+ },
39
+ "seed": [
40
+ {
41
+ "level": 1,
42
+ "exp_need": 0,
43
+ "hp_growth": 10,
44
+ "mp_growth": 5,
45
+ "atk_growth": 3
46
+ },
47
+ {
48
+ "level": 2,
49
+ "exp_need": 100,
50
+ "hp_growth": 11,
51
+ "mp_growth": 5,
52
+ "atk_growth": 3
53
+ },
54
+ {
55
+ "level": 3,
56
+ "exp_need": 260,
57
+ "hp_growth": 12,
58
+ "mp_growth": 6,
59
+ "atk_growth": 4
60
+ },
61
+ {
62
+ "level": 4,
63
+ "exp_need": 500,
64
+ "hp_growth": 13,
65
+ "mp_growth": 6,
66
+ "atk_growth": 4
67
+ },
68
+ {
69
+ "level": 5,
70
+ "exp_need": 860,
71
+ "hp_growth": 14,
72
+ "mp_growth": 7,
73
+ "atk_growth": 5
74
+ },
75
+ {
76
+ "level": 6,
77
+ "exp_need": 1400,
78
+ "hp_growth": 15,
79
+ "mp_growth": 7,
80
+ "atk_growth": 5
81
+ },
82
+ {
83
+ "level": 7,
84
+ "exp_need": 2200,
85
+ "hp_growth": 16,
86
+ "mp_growth": 8,
87
+ "atk_growth": 6
88
+ },
89
+ {
90
+ "level": 8,
91
+ "exp_need": 3400,
92
+ "hp_growth": 17,
93
+ "mp_growth": 8,
94
+ "atk_growth": 6
95
+ },
96
+ {
97
+ "level": 9,
98
+ "exp_need": 5200,
99
+ "hp_growth": 18,
100
+ "mp_growth": 9,
101
+ "atk_growth": 7
102
+ },
103
+ {
104
+ "level": 10,
105
+ "exp_need": 7800,
106
+ "hp_growth": 20,
107
+ "mp_growth": 10,
108
+ "atk_growth": 8
109
+ }
110
+ ]
111
+ }