mm_os 4.1.4 → 4.1.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.
@@ -1,401 +0,0 @@
1
- {
2
- // 名称
3
- "name": "msg",
4
- // 标题
5
- "title": "消息模型",
6
- // 描述
7
- "description": "用于端于端之间通讯",
8
- // 主文件
9
- "main": "index.js",
10
- // 状态 0:禁用 1:启用
11
- "state": 1,
12
- // 排序,越小越靠前
13
- "sort": 100,
14
- // 模型包含字段
15
- "fields": {
16
- "msg_id": {
17
- // 值类型
18
- "type": "string",
19
- // 数据类型
20
- "data_type": "varchar",
21
- // 标题
22
- "title": "消息ID",
23
- // 描述
24
- "description": "消息的唯一标识符",
25
- // 最小长度
26
- "min": 1,
27
- // 最大长度
28
- "max": 64,
29
- // 默认值
30
- "default": "",
31
- // 是否主键
32
- "primary_key": true
33
- },
34
- "msg_type": {
35
- "type": "string",
36
- "data_type": "varchar",
37
- "title": "消息类型",
38
- "description": "消息的类型",
39
- "min": 1,
40
- "max": 32,
41
- "default": "text",
42
- "enum": [
43
- {
44
- "value": "text",
45
- "label": "文本消息"
46
- },
47
- {
48
- "value": "image",
49
- "label": "图片消息"
50
- },
51
- {
52
- "value": "voice",
53
- "label": "语音消息"
54
- },
55
- {
56
- "value": "video",
57
- "label": "视频消息"
58
- },
59
- {
60
- "value": "event",
61
- "label": "事件消息"
62
- },
63
- {
64
- "value": "notice",
65
- "label": "通知消息"
66
- },
67
- {
68
- "value": "card",
69
- "label": "卡片消息"
70
- },
71
- {
72
- "value": "list",
73
- "label": "列表消息"
74
- },
75
- {
76
- "value": "chat",
77
- "label": "聊天消息"
78
- },
79
- {
80
- "value": "mail",
81
- "label": "邮件消息"
82
- },
83
- {
84
- "value": "trade",
85
- "label": "交易消息"
86
- }
87
- ]
88
- },
89
- "event_type": {
90
- "type": "string",
91
- "data_type": "varchar",
92
- "title": "事件类型",
93
- "description": "当消息类型为event时使用",
94
- "min": 0,
95
- "max": 32,
96
- "default": "",
97
- "enum": [
98
- {
99
- "value": "combat",
100
- "label": "战斗事件"
101
- },
102
- {
103
- "value": "quest",
104
- "label": "任务事件"
105
- },
106
- {
107
- "value": "level",
108
- "label": "等级事件"
109
- },
110
- {
111
- "value": "achievement",
112
- "label": "成就事件"
113
- },
114
- {
115
- "value": "friend",
116
- "label": "好友事件"
117
- },
118
- {
119
- "value": "guild",
120
- "label": "公会事件"
121
- },
122
- {
123
- "value": "team",
124
- "label": "队伍事件"
125
- },
126
- {
127
- "value": "invite",
128
- "label": "邀请事件"
129
- },
130
- {
131
- "value": "login",
132
- "label": "登录事件"
133
- },
134
- {
135
- "value": "logout",
136
- "label": "登出事件"
137
- },
138
- {
139
- "value": "reward",
140
- "label": "奖励事件"
141
- },
142
- {
143
- "value": "activity",
144
- "label": "活动事件"
145
- }
146
- ]
147
- },
148
- "msg_group": {
149
- "type": "string",
150
- "data_type": "varchar",
151
- "title": "消息范围",
152
- "description": "消息的发送范围",
153
- "min": 1,
154
- "max": 32,
155
- "default": "system",
156
- "enum": [
157
- {
158
- "value": "private",
159
- "label": "私聊"
160
- },
161
- {
162
- "value": "channel",
163
- "label": "频道"
164
- },
165
- {
166
- "value": "world",
167
- "label": "世界"
168
- },
169
- {
170
- "value": "guild",
171
- "label": "公会"
172
- },
173
- {
174
- "value": "system",
175
- "label": "系统"
176
- }
177
- ]
178
- },
179
- "sender_id": {
180
- "type": "string",
181
- "data_type": "varchar",
182
- "title": "发送者ID",
183
- "description": "消息发送者的ID",
184
- "min": 1,
185
- "max": 64,
186
- "default": "system"
187
- },
188
- "sender_name": {
189
- "type": "string",
190
- "data_type": "varchar",
191
- "title": "发送者名称",
192
- "description": "消息发送者的名称",
193
- "min": 0,
194
- "max": 64,
195
- "default": "系统"
196
- },
197
- "receiver_id": {
198
- "type": "string",
199
- "data_type": "varchar",
200
- "title": "接收者ID",
201
- "description": "消息接收者的ID",
202
- "min": 0,
203
- "max": 64,
204
- "default": ""
205
- },
206
- "receiver_name": {
207
- "type": "string",
208
- "data_type": "varchar",
209
- "title": "接收者名称",
210
- "description": "消息接收者的名称",
211
- "min": 0,
212
- "max": 64,
213
- "default": ""
214
- },
215
- "content": {
216
- "type": "string",
217
- "data_type": "text",
218
- "title": "消息内容",
219
- "description": "消息的文本内容",
220
- "min": 0,
221
- "max": 65535,
222
- "default": ""
223
- },
224
- "data": {
225
- "type": "string",
226
- "data_type": "text",
227
- "title": "消息数据",
228
- "description": "消息的JSON格式数据",
229
- "min": 0,
230
- "max": 65535,
231
- "default": "{}"
232
- },
233
- "event_key": {
234
- "type": "string",
235
- "data_type": "varchar",
236
- "title": "事件键",
237
- "description": "事件消息的键值",
238
- "min": 0,
239
- "max": 64,
240
- "default": ""
241
- },
242
- "priority": {
243
- "type": "string",
244
- "data_type": "varchar",
245
- "title": "优先级",
246
- "description": "消息的优先级",
247
- "min": 1,
248
- "max": 16,
249
- "default": "normal",
250
- "enum": [
251
- {
252
- "value": "low",
253
- "label": "低"
254
- },
255
- {
256
- "value": "normal",
257
- "label": "普通"
258
- },
259
- {
260
- "value": "high",
261
- "label": "高"
262
- },
263
- {
264
- "value": "urgent",
265
- "label": "紧急"
266
- }
267
- ]
268
- },
269
- "need_confirm": {
270
- "type": "number",
271
- "data_type": "tinyint",
272
- "title": "需要确认",
273
- "description": "是否需要用户确认",
274
- "min": 0,
275
- "max": 1,
276
- "default": 0
277
- },
278
- "title": {
279
- "type": "string",
280
- "data_type": "varchar",
281
- "title": "标题",
282
- "description": "消息标题(通知消息使用)",
283
- "min": 0,
284
- "max": 255,
285
- "default": ""
286
- },
287
- "subtitle": {
288
- "type": "string",
289
- "data_type": "varchar",
290
- "title": "副标题",
291
- "description": "消息副标题",
292
- "min": 0,
293
- "max": 255,
294
- "default": ""
295
- },
296
- "icon": {
297
- "type": "string",
298
- "data_type": "varchar",
299
- "title": "图标",
300
- "description": "消息图标URL",
301
- "min": 0,
302
- "max": 255,
303
- "default": ""
304
- },
305
- "actions": {
306
- "type": "string",
307
- "data_type": "text",
308
- "title": "操作按钮",
309
- "description": "操作按钮的JSON数组",
310
- "min": 0,
311
- "max": 65535,
312
- "default": "[]"
313
- },
314
- "format": {
315
- "type": "string",
316
- "data_type": "varchar",
317
- "title": "格式",
318
- "description": "文本消息的格式",
319
- "min": 1,
320
- "max": 16,
321
- "default": "plain",
322
- "enum": [
323
- {
324
- "value": "plain",
325
- "label": "纯文本"
326
- },
327
- {
328
- "value": "markdown",
329
- "label": "Markdown"
330
- },
331
- {
332
- "value": "html",
333
- "label": "HTML"
334
- }
335
- ]
336
- },
337
- "emoji_support": {
338
- "type": "number",
339
- "data_type": "tinyint",
340
- "title": "表情支持",
341
- "description": "是否支持表情",
342
- "min": 0,
343
- "max": 1,
344
- "default": 1
345
- },
346
- "expire_time": {
347
- "type": "string",
348
- "data_type": "datetime",
349
- "title": "过期时间",
350
- "description": "消息过期时间",
351
- "min": 0,
352
- "max": 20,
353
- "default": "1970-01-01 00:00:00"
354
- },
355
- "timestamp": {
356
- "type": "string",
357
- "data_type": "datetime",
358
- "title": "时间戳",
359
- "description": "消息发送时间",
360
- "min": 0,
361
- "max": 20,
362
- "default": "now()"
363
- },
364
- "ext_data": {
365
- "type": "string",
366
- "data_type": "text",
367
- "title": "扩展数据",
368
- "description": "扩展数据的JSON格式",
369
- "min": 0,
370
- "max": 65535,
371
- "default": "{}"
372
- },
373
- "state": {
374
- "type": "number",
375
- "data_type": "int",
376
- "title": "状态",
377
- "description": "消息状态",
378
- "min": 0,
379
- "max": 100,
380
- "default": 1,
381
- "enum": [
382
- {
383
- "value": 1,
384
- "label": "正常"
385
- },
386
- {
387
- "value": 2,
388
- "label": "已读"
389
- },
390
- {
391
- "value": 3,
392
- "label": "已删除"
393
- },
394
- {
395
- "value": 4,
396
- "label": "已过期"
397
- }
398
- ]
399
- }
400
- }
401
- }
@@ -1,63 +0,0 @@
1
-
2
- module.exports = {
3
- methods: {
4
- /**
5
- * 检查玩家是否在线
6
- * @returns {boolean} 是否在线
7
- */
8
- isOnline() {
9
- return this.state === 1 && this.login === 1;
10
- },
11
-
12
- /**
13
- * 增加金币
14
- * @param {number} amount 金币数量
15
- * @returns {boolean} 是否成功
16
- */
17
- gainGold(amount) {
18
- if (typeof amount !== 'number' || amount < 0) {
19
- throw new TypeError('金币数量必须是非负数');
20
- }
21
- var new_gold = this.gold + amount;
22
- if (new_gold > 999999999) {
23
- this.gold = 999999999;
24
- } else {
25
- this.gold = new_gold;
26
- }
27
- return true;
28
- },
29
-
30
- /**
31
- * 转换为JSON字符串
32
- * @returns {string} JSON字符串
33
- */
34
- toJson() {
35
- return JSON.stringify(this.getInfo());
36
- },
37
-
38
- /**
39
- * 从数据对象初始化玩家
40
- * @param {object} data 玩家数据
41
- * @returns {object} 玩家实例
42
- */
43
- from(data) {
44
- if (typeof data !== 'object' || data === null) {
45
- throw new TypeError('玩家数据必须是对象');
46
- }
47
- for (var key in data) {
48
- if (this.hasOwnProperty(key)) {
49
- this[key] = data[key];
50
- }
51
- }
52
- return this;
53
- }
54
- },
55
-
56
- /**
57
- * 添加玩家模型方法
58
- * @param {object} model 玩家模型实例
59
- */
60
- addMethods(model) {
61
- Object.assign(model, this.methods);
62
- }
63
- };
@@ -1,185 +0,0 @@
1
- {
2
- // 名称
3
- "name": "player",
4
- // 标题
5
- "title": "游戏玩家模型",
6
- // 描述
7
- "description": "定义游戏玩家模型的组件,包含账户信息和游戏状态",
8
- // 主文件
9
- "main": "index.js",
10
- // 状态 0:禁用 1:启用
11
- "state": 1,
12
- // 排序,越小越靠前
13
- "sort": 100,
14
- // 模型包含字段
15
- "fields": {
16
- "player_id": {
17
- // 值类型
18
- "type": "string",
19
- // 数据类型
20
- "data_type": "varchar",
21
- // 标题
22
- "title": "玩家ID",
23
- // 描述
24
- "description": "玩家的唯一标识符",
25
- // 最小长度
26
- "min": 1,
27
- // 最大长度
28
- "max": 32,
29
- // 默认值
30
- "default": "",
31
- // 是否主键
32
- "primary_key": true,
33
- // 是否自动增长
34
- "auto": false
35
- },
36
- "user_id": {
37
- "type": "string",
38
- "data_type": "varchar",
39
- "title": "用户ID",
40
- "description": "玩家关联的用户ID",
41
- "min": 1,
42
- "max": 32,
43
- "default": ""
44
- },
45
- "client_id": {
46
- "type": "string",
47
- "data_type": "varchar",
48
- "title": "客户端ID",
49
- "description": "玩家关联的客户端ID",
50
- "min": 1,
51
- "max": 32,
52
- "default": ""
53
- },
54
- "avatar": {
55
- "type": "string",
56
- "data_type": "varchar",
57
- "title": "头像",
58
- "description": "玩家的头像",
59
- "min": 1,
60
- "max": 255,
61
- "default": "/avatar.jpg"
62
- },
63
- "name": {
64
- "type": "string",
65
- "data_type": "varchar",
66
- "title": "名称",
67
- "description": "玩家的显示名称",
68
- "min": 0,
69
- "max": 24,
70
- "default": ""
71
- },
72
- "state": {
73
- "type": "number",
74
- "data_type": "int",
75
- "title": "状态",
76
- "description": "账户的状态",
77
- "min": 0,
78
- "max": 4,
79
- "default": 1,
80
- "enum": [
81
- {
82
- "value": 0,
83
- "label": "离线"
84
- },
85
- {
86
- "value": 1,
87
- "label": "在线"
88
- },
89
- {
90
- "value": 2,
91
- "label": "异常"
92
- },
93
- {
94
- "value": 3,
95
- "label": "已冻结"
96
- },
97
- {
98
- "value": 4,
99
- "label": "已注销"
100
- }
101
- ]
102
- },
103
- "level": {
104
- "type": "number",
105
- "data_type": "int",
106
- "title": "玩家等级",
107
- "description": "玩家的游戏等级",
108
- "min": 0,
109
- "max": 1000,
110
- "default": 0
111
- },
112
- "channel_id": {
113
- "type": "number",
114
- "data_type": "int",
115
- "title": "频道ID",
116
- "description": "玩家当前所在的频道ID",
117
- "min": 0,
118
- "max": 100,
119
- "default": 0
120
- },
121
- "room_id": {
122
- "type": "string",
123
- "data_type": "varchar",
124
- "title": "房间ID",
125
- "description": "玩家当前所在的房间ID",
126
- "min": 0,
127
- "max": 10000,
128
- "default": 0
129
- },
130
- "world_id": {
131
- "type": "string",
132
- "data_type": "varchar",
133
- "title": "世界ID",
134
- "description": "玩家当前所在的世界ID",
135
- "min": 0,
136
- "max": 10000,
137
- "default": 0
138
- },
139
- "returning": {
140
- "type": "number",
141
- "data_type": "tinyint",
142
- "title": "回归状态",
143
- "description": "玩家是否为回归玩家(0:否,1:是)",
144
- "min": 0,
145
- "max": 1,
146
- "default": 0
147
- },
148
- "gold": {
149
- "type": "number",
150
- "data_type": "int",
151
- "title": "金币",
152
- "description": "玩家的金币数量",
153
- "min": 0,
154
- "max": 999999999,
155
- "default": 0
156
- },
157
- "zone": {
158
- "type": "string",
159
- "data_type": "varchar",
160
- "title": "所在分区",
161
- "description": "玩家当前所在的分区名称",
162
- "min": 0,
163
- "max": 50,
164
- "default": ""
165
- },
166
- "login": {
167
- "type": "number",
168
- "data_type": "tinyint",
169
- "title": "登录状态",
170
- "description": "玩家是否已登录(0:否,1:是)",
171
- "min": 0,
172
- "max": 1,
173
- "default": 0
174
- },
175
- "is_ready": {
176
- "type": "number",
177
- "data_type": "tinyint",
178
- "title": "准备状态",
179
- "description": "玩家是否已准备(0:否,1:是)",
180
- "min": 0,
181
- "max": 1,
182
- "default": 0
183
- }
184
- }
185
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * 富血模型
3
- */
4
- module.exports = {
5
- /**
6
- * 添加玩家模型方法
7
- * @param {object} model 玩家模型实例
8
- */
9
- addMethods(model) {
10
- }
11
- };