reldens 4.0.0-beta.21 → 4.0.0-beta.22

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.
@@ -0,0 +1,27 @@
1
+ #######################################################################################################################
2
+
3
+ SET FOREIGN_KEY_CHECKS = 0;
4
+
5
+ #######################################################################################################################
6
+
7
+ # Config:
8
+ INSERT INTO `config` VALUES(NULL, 'client', 'objects/npc/invalidOptionMessage', 'I do not understand.', 't');
9
+ DELETE FROM `config` WHERE `path` = 'ui/minimap/roundMap';
10
+ INSERT INTO `config` VALUES(NULL, 'client', 'ui/minimap/roundMap', '1', 'b');
11
+
12
+ # Played Time:
13
+ ALTER TABLE `users`
14
+ CHANGE COLUMN `email` `email` VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci' AFTER `id`,
15
+ CHANGE COLUMN `username` `username` VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci' AFTER `email`,
16
+ CHANGE COLUMN `password` `password` VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci' AFTER `username`,
17
+ CHANGE COLUMN `status` `status` VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci' AFTER `role_id`,
18
+ ADD COLUMN `played_time` INT(10) NOT NULL DEFAULT 0 AFTER `updated_at`;
19
+
20
+ INSERT INTO `config` VALUES(NULL, 'client', 'players/playedTime/show', '2', 'i');
21
+ INSERT INTO `config` VALUES(NULL, 'client', 'players/playedTime/label', 'Played Time:<br/>', 't');
22
+
23
+ #######################################################################################################################
24
+
25
+ SET FOREIGN_KEY_CHECKS = 1;
26
+
27
+ #######################################################################################################################
@@ -162,7 +162,7 @@ CREATE TABLE IF NOT EXISTS `config` (
162
162
  `value` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
163
163
  `type` varchar(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
164
164
  PRIMARY KEY (`id`)
165
- ) ENGINE=InnoDB AUTO_INCREMENT=253 DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
165
+ ) ENGINE=InnoDB AUTO_INCREMENT=257 DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci;
166
166
 
167
167
  -- Dumping data for table config: ~236 rows (approximately)
168
168
  /*!40000 ALTER TABLE `config` DISABLE KEYS */;
@@ -297,7 +297,7 @@ INSERT INTO `config` (`id`, `scope`, `path`, `value`, `type`) VALUES
297
297
  (136, 'client', 'players/animations/collideWorldBounds', '1', 'b'),
298
298
  (137, 'server', 'rooms/world/bulletsStopOnPlayer', '1', 'b'),
299
299
  (138, 'client', 'players/animations/fallbackImage', 'player-base', 't'),
300
- (139, 'client', 'players/multiplePlayers/enabled', '1', 'b'),
300
+ (139, 'client', 'players/multiplePlayers/enabled', '0', 'b'),
301
301
  (140, 'server', 'players/gameOver/timeOut', '10000', 'i'),
302
302
  (141, 'client', 'ui/controls/tabTarget', '1', 'b'),
303
303
  (142, 'client', 'ui/controls/disableContextMenu', '1', 'b'),
@@ -336,12 +336,10 @@ INSERT INTO `config` (`id`, `scope`, `path`, `value`, `type`) VALUES
336
336
  (182, 'client', 'ui/minimap/mapHeightDivisor', '1', 'i'),
337
337
  (183, 'client', 'ui/minimap/fixedWidth', '450', 'i'),
338
338
  (184, 'client', 'ui/minimap/fixedHeight', '450', 'i'),
339
- (185, 'client', 'ui/minimap/roundMap', '1', 'b'),
340
339
  (186, 'client', 'ui/minimap/camX', '140', 'i'),
341
340
  (187, 'client', 'ui/minimap/camY', '10', 'i'),
342
341
  (188, 'client', 'ui/minimap/camBackgroundColor', 'rgba(0,0,0,0.6)', 't'),
343
342
  (189, 'client', 'ui/minimap/camZoom', '0.35', 'i'),
344
- (190, 'client', 'ui/minimap/roundMap', '1', 'b'),
345
343
  (191, 'client', 'ui/minimap/addCircle', '1', 'b'),
346
344
  (192, 'client', 'ui/minimap/circleX', '220', 'i'),
347
345
  (193, 'client', 'ui/minimap/circleY', '88', 'i'),
@@ -364,16 +362,16 @@ INSERT INTO `config` (`id`, `scope`, `path`, `value`, `type`) VALUES
364
362
  (210, 'client', 'ui/settings/y', '280', 'i'),
365
363
  (211, 'client', 'ui/settings/enabled', '1', 'b'),
366
364
  (212, 'client', 'ui/lifeBar/showOnClick', '1', 'b'),
367
- (213, 'client', 'rooms/selection/allowOnRegistration', '1', 'b'),
368
- (214, 'client', 'rooms/selection/allowOnLogin', '1', 'b'),
365
+ (213, 'client', 'rooms/selection/allowOnRegistration', '0', 'b'),
366
+ (214, 'client', 'rooms/selection/allowOnLogin', '0', 'b'),
369
367
  (215, 'client', 'rooms/selection/registrationAvailableRooms', '*', 't'),
370
368
  (216, 'client', 'rooms/selection/loginLastLocation', '1', 'b'),
371
369
  (218, 'client', 'rooms/selection/loginAvailableRooms', '*', 't'),
372
370
  (219, 'client', 'rooms/selection/loginLastLocationLabel', 'Last Location', 't'),
373
371
  (220, 'client', 'players/tapMovement/enabled', '1', 'b'),
374
372
  (221, 'client', 'ui/chat/overheadChat/enabled', '1', 'b'),
375
- (222, 'client', 'chat/messages/characterLimit', '10', 'i'),
376
- (223, 'client', 'chat/messages/characterLimitOverhead', '5', 'i'),
373
+ (222, 'client', 'chat/messages/characterLimit', '100', 'i'),
374
+ (223, 'client', 'chat/messages/characterLimitOverhead', '50', 'i'),
377
375
  (224, 'client', 'ui/chat/overheadText/fontFamily', 'Verdana, Geneva, sans-serif', 't'),
378
376
  (225, 'client', 'ui/chat/overheadText/fontSize', '12px', 't'),
379
377
  (226, 'client', 'ui/chat/overheadText/fill', '#ffffff', 't'),
@@ -402,7 +400,11 @@ INSERT INTO `config` (`id`, `scope`, `path`, `value`, `type`) VALUES
402
400
  (249, 'client', 'ui/players/nameText/textLength', '4', 'i'),
403
401
  (250, 'client', 'ui/chat/overheadChat/isTyping', '1', 'b'),
404
402
  (251, 'client', 'ui/chat/overheadText/timeOut', '5000', 'i'),
405
- (252, 'client', 'ui/chat/overheadChat/closeChatBoxAfterSend', '1', 'b');
403
+ (252, 'client', 'ui/chat/overheadChat/closeChatBoxAfterSend', '1', 'b'),
404
+ (253, 'client', 'players/playedTime/show', '2', 'i'),
405
+ (254, 'client', 'players/playedTime/label', 'Played Time:<br/>', 't'),
406
+ (255, 'client', 'objects/npc/invalidOptionMessage', 'I do not understand.', 't'),
407
+ (256, 'client', 'ui/minimap/roundMap', '1', 'b');
406
408
  /*!40000 ALTER TABLE `config` ENABLE KEYS */;
407
409
 
408
410
  -- Dumping structure for table features
@@ -1364,13 +1366,14 @@ INSERT INTO `stats` (`id`, `key`, `label`, `description`, `base_value`, `customD
1364
1366
  -- Dumping structure for table users
1365
1367
  CREATE TABLE IF NOT EXISTS `users` (
1366
1368
  `id` int unsigned NOT NULL AUTO_INCREMENT,
1367
- `email` varchar(255) NOT NULL,
1368
- `username` varchar(255) NOT NULL,
1369
- `password` varchar(255) NOT NULL,
1369
+ `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
1370
+ `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
1371
+ `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
1370
1372
  `role_id` int unsigned NOT NULL,
1371
- `status` varchar(255) NOT NULL,
1373
+ `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
1372
1374
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1373
1375
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
1376
+ `played_time` int NOT NULL DEFAULT '0',
1374
1377
  PRIMARY KEY (`id`),
1375
1378
  UNIQUE KEY `email` (`email`),
1376
1379
  UNIQUE KEY `username` (`username`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reldens",
3
- "version": "4.0.0-beta.21",
3
+ "version": "4.0.0-beta.22",
4
4
  "description": "Reldens - MMORPG Platform",
5
5
  "author": "Damian A. Pastorini",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "@adminjs/design-system": "2.1.2",
38
38
  "@adminjs/express": "4.1.0",
39
39
  "@adminjs/upload": "2.0.2",
40
- "@babel/core": "^7.17.5",
40
+ "@babel/core": "^7.17.8",
41
41
  "@colyseus/monitor": "^0.12.3",
42
42
  "@colyseus/schema": "^0.5.41",
43
43
  "@reldens/items-system": "^0.11.0",
@@ -49,16 +49,16 @@
49
49
  "bcrypt": "^5.0.1",
50
50
  "colyseus": "0.12.6",
51
51
  "colyseus.js": "0.12.2",
52
- "core-js": "^3.21.0",
52
+ "core-js": "^3.21.1",
53
53
  "cors": "^2.8.5",
54
54
  "dotenv": "^16.0.0",
55
55
  "express": "^4.17.3",
56
56
  "express-basic-auth": "^1.2.1",
57
57
  "express-formidable": "^1.2.0",
58
58
  "express-session": "^1.17.2",
59
- "firebase": "9.6.8",
59
+ "firebase": "9.6.9",
60
60
  "firebaseui": "6.0.1",
61
- "mime-types": "^2.1.34",
61
+ "mime-types": "^2.1.35",
62
62
  "mustache": "^4.2.0",
63
63
  "nodemailer": "^6.7.2",
64
64
  "p2": "^0.7.1",
@@ -71,12 +71,12 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "babel-eslint": "^10.1.0",
74
- "eslint": "^8.9.0",
74
+ "eslint": "^8.11.0",
75
75
  "eslint-config-standard": "^17.0.0-1",
76
76
  "eslint-plugin-import": "^2.25.4",
77
77
  "eslint-plugin-node": "^11.1.0",
78
78
  "eslint-plugin-promise": "^6.0.0",
79
79
  "eslint-plugin-standard": "^5.0.0",
80
- "sass": "^1.49.7"
80
+ "sass": "^1.49.9"
81
81
  }
82
82
  }
@@ -237,7 +237,7 @@ class ChatUi
237
237
  message: message[ChatConst.CHAT_MESSAGE]
238
238
  });
239
239
  readPanel.innerHTML += output;
240
- if(message[ChatConst.CHAT_FROM]){
240
+ if(message[ChatConst.CHAT_FROM] && this.isValidMessageType(message.t)){
241
241
  let playerSprite = this.fetchPlayerByName(message[ChatConst.CHAT_FROM]);
242
242
  if(playerSprite){
243
243
  this.showOverheadChat(playerSprite, message[ChatConst.CHAT_MESSAGE]);
@@ -250,6 +250,13 @@ class ChatUi
250
250
  }
251
251
  }
252
252
 
253
+ isValidMessageType(messageType)
254
+ {
255
+ return ChatConst.CHAT_TYPE_SYSTEM !== messageType
256
+ && ChatConst.CHAT_TYPE_SYSTEM_ERROR !== messageType
257
+ && ChatConst.CHAT_TYPE_SYSTEM_BATTLE !== messageType;
258
+ }
259
+
253
260
  fetchPlayerByName(playerName)
254
261
  {
255
262
  let players = this.gameManager.getCurrentPlayer().players;
@@ -32,6 +32,7 @@ module.exports.ChatConst = {
32
32
  CHAT_TYPE_GLOBAL: 'ctg',
33
33
  CHAT_TYPE_SYSTEM: 'cts',
34
34
  CHAT_TYPE_SYSTEM_ERROR: 'ctse',
35
+ CHAT_TYPE_SYSTEM_BATTLE: 'ctb',
35
36
  colors: {
36
37
  ctn: '#ffffff',
37
38
  ctpf: '#f39c12',
@@ -52,7 +52,8 @@ class ChatPack extends PackInterface
52
52
  let messageObject = {
53
53
  act: ChatConst.CHAT_ACTION,
54
54
  f: skill.owner.playerName,
55
- m: sendMessage
55
+ m: sendMessage,
56
+ t: ChatConst.CHAT_TYPE_SYSTEM_BATTLE
56
57
  };
57
58
  client.send(messageObject);
58
59
  this.chatManager.saveMessage(
@@ -17,31 +17,29 @@ class ConfigProcessor
17
17
  */
18
18
  get(path, avoidLog = false)
19
19
  {
20
- // default value will be always false:
21
- let result = false;
22
20
  // since the amount of parameters should be always 3 (for a config group) or 4 (for a single value) then we can
23
21
  // easily split the path:
24
22
  let pathArray = path.split('/');
25
23
  // verify path size:
26
- if(pathArray.length >= 3){
27
- let levelCheck = (this[pathArray[0]] || {});
28
- for(let i = 1; i < pathArray.length; i++){
29
- if(!sc.hasOwn(levelCheck, pathArray[i])){
30
- if(!avoidLog){
31
- Logger.error('Configuration level '+i+' not defined: '+path);
32
- }
33
- levelCheck = false;
34
- break;
35
- }
36
- levelCheck = levelCheck[pathArray[i]];
37
- }
38
- result = levelCheck;
39
- } else {
24
+ if(pathArray.length < 3){
40
25
  if(!avoidLog){
41
26
  Logger.error('Path level is too low:', path);
42
27
  }
28
+ return false;
29
+ }
30
+ // default value will be always false:
31
+ let levelCheck = (this[pathArray[0]] || {});
32
+ for(let i = 1; i < pathArray.length; i++){
33
+ if(!sc.hasOwn(levelCheck, pathArray[i])){
34
+ if(!avoidLog){
35
+ Logger.error('Configuration level '+i+' not defined: '+path);
36
+ }
37
+ levelCheck = false;
38
+ break;
39
+ }
40
+ levelCheck = levelCheck[pathArray[i]];
43
41
  }
44
- return result;
42
+ return levelCheck;
45
43
  }
46
44
 
47
45
  }
@@ -78,11 +78,35 @@ class GameEngine extends Game
78
78
  {
79
79
  if(sc.hasOwn(this.uiScene, 'uiTarget')){
80
80
  this.uiScene.uiTarget.getChildByID('box-target').style.display = 'block';
81
- this.uiScene.uiTarget.getChildByID('target-container').innerHTML = targetName;
81
+ this.uiScene.uiTarget.getChildByID('target-container').innerHTML = this.targetDisplay(targetName, target);
82
82
  }
83
83
  this.eventsManager.emit('reldens.gameEngineShowTarget', this, target, previousTarget);
84
84
  }
85
85
 
86
+ targetDisplay(targetName, target)
87
+ {
88
+ // @TODO - BETA - Refactor.
89
+ let gameManager = this.uiScene.gameManager;
90
+ let showPlayedTime = gameManager.config.get('client/players/playedTime/show');
91
+ if(0 === showPlayedTime || GameConst.TYPE_PLAYER !== target.type){
92
+ return targetName;
93
+ }
94
+ let currentPlayer = gameManager.getCurrentPlayer();
95
+ let timeText = '';
96
+ let label = gameManager.config.get('client/players/playedTime/label');
97
+ if(0 < showPlayedTime && currentPlayer.playerId === target.id){
98
+ let element = gameManager.gameDom.createElement('p');
99
+ element.innerHTML = label+(currentPlayer.playedTime / 60 / 60).toFixed(1)+'hs';
100
+ timeText = element.outerHTML;
101
+ }
102
+ if(2 === showPlayedTime && sc.hasOwn(currentPlayer.players, target.id)){
103
+ let element = gameManager.gameDom.createElement('p');
104
+ element.innerHTML = label+(currentPlayer.players[target.id].playedTime / 60 / 60).toFixed(1)+'hs';
105
+ timeText = element.outerHTML;
106
+ }
107
+ return targetName+timeText;
108
+ }
109
+
86
110
  clearTarget()
87
111
  {
88
112
  let currentScene = this.uiScene.gameManager.activeRoomEvents.getActiveScene();