koishi-plugin-tmp-bot 1.20.0 → 1.20.2

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 (41) hide show
  1. package/lib/api/evmOpenApi.js +136 -1
  2. package/lib/api/truckersMpApi.js +110 -1
  3. package/lib/api/truckersMpMapApi.js +25 -1
  4. package/lib/api/truckyAppApi.js +47 -1
  5. package/lib/command/tmpBind.js +19 -1
  6. package/lib/command/tmpDlcMap.js +33 -1
  7. package/lib/command/tmpFootprint.js +82 -1
  8. package/lib/command/tmpMileageRanking.js +55 -1
  9. package/lib/command/tmpPosition.d.ts +1 -1
  10. package/lib/command/tmpPosition.js +95 -1
  11. package/lib/command/tmpQuery.js +118 -0
  12. package/lib/command/tmpServer.js +34 -1
  13. package/lib/command/tmpTraffic/tmpTraffic.js +15 -1
  14. package/lib/command/tmpTraffic/tmpTrafficMap.js +119 -1
  15. package/lib/command/tmpTraffic/tmpTrafficText.js +58 -1
  16. package/lib/command/tmpVersion.js +14 -1
  17. package/lib/database/guildBind.js +41 -1
  18. package/lib/database/model.js +65 -1
  19. package/lib/database/translateCache.js +31 -1
  20. package/lib/index.js +53 -1
  21. package/lib/resource/dlc.html +30 -1
  22. package/lib/resource/footprint.html +125 -1
  23. package/lib/resource/mileage-leaderboard.html +174 -1
  24. package/lib/resource/package/ets-map.js +63 -1
  25. package/lib/resource/package/leaflet/heatmap.min.js +9 -1
  26. package/lib/resource/package/leaflet/leaflet-heatmap.js +246 -1
  27. package/lib/resource/package/leaflet/leaflet.min.js +1 -1
  28. package/lib/resource/position.html +105 -1
  29. package/lib/resource/traffic.html +121 -1
  30. package/lib/util/baiduTranslate.js +30 -1
  31. package/lib/util/common.js +5 -1
  32. package/lib/util/constant.js +36 -1
  33. package/package.json +3 -2
  34. package/readme.md +14 -13
  35. package/lib/command/tmpQuery/tmpQuery.d.ts +0 -2
  36. package/lib/command/tmpQuery/tmpQuery.js +0 -1
  37. package/lib/command/tmpQuery/tmpQueryImg.d.ts +0 -3
  38. package/lib/command/tmpQuery/tmpQueryImg.js +0 -1
  39. package/lib/command/tmpQuery/tmpQueryText.js +0 -1
  40. package/lib/resource/query.html +0 -227
  41. /package/lib/command/{tmpQuery/tmpQueryText.d.ts → tmpQuery.d.ts} +0 -0
@@ -1 +1,95 @@
1
- function a8_0x354b(){const _0x58f000=['puppeteer','sleep','database','file:///','6hUGnEl','path','screenshot','946nRGzIP','stringify','192atJaxn','1757446KbNPjI','玩家离线','查询玩家信息失败,请重试','player','waitForNetworkIdle','ets','../api/truckersMpApi','1287222XjJKwN','country','../resource/position.html','setViewport','1710HjpDdQ','522995tAxOJd','promods','http','toString','1912HAjkoT','未启用\x20puppeteer\x20服务','location','goto','error','setData(','splice','data','8249612zpcEAm','渲染异常,请重试','5958nvBvfi','57069VpyzTv','page','realName','get','userId','serverDetails','online','poi','evaluate','name','tmpId','../api/evmOpenApi'];a8_0x354b=function(){return _0x58f000;};return a8_0x354b();}const a8_0x48c6d0=a8_0x17e2;function a8_0x17e2(_0x3fbc87,_0x26bee8){_0x3fbc87=_0x3fbc87-0x166;const _0x354be9=a8_0x354b();let _0x17e251=_0x354be9[_0x3fbc87];return _0x17e251;}(function(_0x247bde,_0x5d2d43){const _0x3851c1=a8_0x17e2,_0x16b3fc=_0x247bde();while(!![]){try{const _0x1a265f=parseInt(_0x3851c1(0x171))/0x1+-parseInt(_0x3851c1(0x16a))/0x2+parseInt(_0x3851c1(0x184))/0x3*(-parseInt(_0x3851c1(0x169))/0x4)+-parseInt(_0x3851c1(0x176))/0x5*(-parseInt(_0x3851c1(0x195))/0x6)+-parseInt(_0x3851c1(0x182))/0x7+-parseInt(_0x3851c1(0x17a))/0x8*(-parseInt(_0x3851c1(0x185))/0x9)+-parseInt(_0x3851c1(0x175))/0xa*(-parseInt(_0x3851c1(0x167))/0xb);if(_0x1a265f===_0x5d2d43)break;else _0x16b3fc['push'](_0x16b3fc['shift']());}catch(_0x89dd2f){_0x16b3fc['push'](_0x16b3fc['shift']());}}}(a8_0x354b,0xbbdb3));const {segment}=require('koishi'),{resolve}=require(a8_0x48c6d0(0x196)),guildBind=require('../database/guildBind'),truckyAppApi=require('../api/truckyAppApi'),truckersMpApi=require(a8_0x48c6d0(0x170)),evmOpenApi=require(a8_0x48c6d0(0x190)),baiduTranslate=require('../util/baiduTranslate'),common=require('../util/common');module['exports']=async(_0x378fc2,_0x275e3d,_0x3966e8,_0x153874)=>{const _0x3b8927=a8_0x48c6d0;if(_0x378fc2[_0x3b8927(0x191)]){if(_0x153874&&isNaN(_0x153874))return'请输入正确的玩家编号';if(!_0x153874){let _0x36b588=await guildBind[_0x3b8927(0x188)](_0x378fc2[_0x3b8927(0x193)],_0x3966e8['platform'],_0x3966e8[_0x3b8927(0x189)]);if(!_0x36b588)return'请输入正确的玩家编号';_0x153874=_0x36b588['tmp_id'];}let _0x4b4c50=await truckersMpApi[_0x3b8927(0x16d)](_0x378fc2[_0x3b8927(0x178)],_0x153874);if(_0x4b4c50['error'])return _0x3b8927(0x16c);let _0x4baafc=await truckyAppApi[_0x3b8927(0x18b)](_0x378fc2[_0x3b8927(0x178)],_0x153874);if(_0x4baafc[_0x3b8927(0x17e)])return _0x3b8927(0x16c);if(!_0x4baafc['data'][_0x3b8927(0x18b)])return _0x3b8927(0x16b);let _0x4c62c7=await evmOpenApi['mapPlayerList'](_0x378fc2[_0x3b8927(0x178)],_0x4baafc[_0x3b8927(0x181)]['server'],_0x4baafc[_0x3b8927(0x181)]['x']-0xfa0,_0x4baafc[_0x3b8927(0x181)]['y']+0x9c4,_0x4baafc[_0x3b8927(0x181)]['x']+0xfa0,_0x4baafc['data']['y']-0x9c4),_0x541cae=[];if(!_0x4c62c7['error']){_0x541cae=_0x4c62c7['data'];let _0x3accf3=_0x541cae['findIndex'](_0x18d07c=>{const _0x4d95cf=_0x3b8927;return _0x18d07c[_0x4d95cf(0x18f)]['toString']()===_0x153874[_0x4d95cf(0x179)]();});_0x3accf3!==-0x1&&_0x541cae[_0x3b8927(0x180)](_0x3accf3,0x1);}_0x541cae['push']({'axisX':_0x4baafc['data']['x'],'axisY':_0x4baafc[_0x3b8927(0x181)]['y'],'tmpId':_0x153874});let _0x36ed1f=[0x32,0x33],_0x30e2e7={'mapType':_0x36ed1f['indexOf'](_0x4baafc[_0x3b8927(0x181)]['server'])!==-0x1?_0x3b8927(0x177):_0x3b8927(0x16f),'avatar':_0x4b4c50[_0x3b8927(0x181)]['smallAvatar'],'username':_0x4b4c50[_0x3b8927(0x181)][_0x3b8927(0x18e)],'serverName':_0x4baafc[_0x3b8927(0x181)][_0x3b8927(0x18a)][_0x3b8927(0x18e)],'country':await baiduTranslate(_0x378fc2,_0x275e3d,_0x4baafc[_0x3b8927(0x181)][_0x3b8927(0x17c)]['poi'][_0x3b8927(0x172)]),'realName':await baiduTranslate(_0x378fc2,_0x275e3d,_0x4baafc[_0x3b8927(0x181)][_0x3b8927(0x17c)][_0x3b8927(0x18c)][_0x3b8927(0x187)]),'currentPlayerId':_0x153874,'centerX':_0x4baafc[_0x3b8927(0x181)]['x'],'centerY':_0x4baafc[_0x3b8927(0x181)]['y'],'playerList':_0x541cae},_0x1e3ab3;try{_0x1e3ab3=await _0x378fc2[_0x3b8927(0x191)][_0x3b8927(0x186)](),await _0x1e3ab3[_0x3b8927(0x174)]({'width':0x3e8,'height':0x3e8}),await _0x1e3ab3[_0x3b8927(0x17d)](_0x3b8927(0x194)+resolve(__dirname,_0x3b8927(0x173))),await _0x1e3ab3[_0x3b8927(0x18d)](_0x3b8927(0x17f)+JSON[_0x3b8927(0x168)](_0x30e2e7)+')'),await common[_0x3b8927(0x192)](0x64),await _0x1e3ab3[_0x3b8927(0x16e)]();const _0x5799ab=await _0x1e3ab3['$']('#container');return segment['image'](await _0x5799ab[_0x3b8927(0x166)]({'encoding':'binary'}),'image/jpg');}catch(_0x27b4bb){return _0x3b8927(0x183);}finally{_0x1e3ab3&&await _0x1e3ab3['close']();}}else return _0x3b8927(0x17b);};
1
+ const { segment } = require('koishi');
2
+ const { resolve } = require('path');
3
+ const guildBind = require('../database/guildBind');
4
+ const truckyAppApi = require('../api/truckyAppApi');
5
+ const truckersMpApi = require('../api/truckersMpApi');
6
+ const evmOpenApi = require('../api/evmOpenApi');
7
+ const baiduTranslate = require('../util/baiduTranslate');
8
+ const common = require('../util/common');
9
+ /**
10
+ * 定位
11
+ */
12
+ module.exports = async (ctx, cfg, session, tmpId) => {
13
+ if (ctx.puppeteer) {
14
+ if (tmpId && isNaN(tmpId)) {
15
+ return `请输入正确的玩家编号,或绑定玩家编号`;
16
+ }
17
+ // 如果没有传入tmpId,尝试从数据库查询绑定信息
18
+ if (!tmpId) {
19
+ let guildBindData = await guildBind.get(ctx.database, session.platform, session.userId);
20
+ if (!guildBindData) {
21
+ return `请输入正确的玩家编号,或绑定玩家编号`;
22
+ }
23
+ tmpId = guildBindData.tmp_id;
24
+ }
25
+ // 查询玩家信息
26
+ let playerInfo = await truckersMpApi.player(ctx.http, tmpId);
27
+ if (playerInfo.error) {
28
+ return '查询玩家信息失败,请重试';
29
+ }
30
+ // 查询线上信息
31
+ let playerMapInfo = await truckyAppApi.online(ctx.http, tmpId);
32
+ if (playerMapInfo.error) {
33
+ return '查询玩家信息失败,请重试';
34
+ }
35
+ if (!playerMapInfo.data.online) {
36
+ return '玩家离线';
37
+ }
38
+ // 查询周边玩家,并处理数据
39
+ let areaPlayersData = await evmOpenApi.mapPlayerList(ctx.http, playerMapInfo.data.server, playerMapInfo.data.x - 4000, playerMapInfo.data.y + 2500, playerMapInfo.data.x + 4000, playerMapInfo.data.y - 2500);
40
+ let areaPlayerList = [];
41
+ if (!areaPlayersData.error) {
42
+ areaPlayerList = areaPlayersData.data;
43
+ let index = areaPlayerList.findIndex((player) => {
44
+ return player.tmpId.toString() === tmpId.toString();
45
+ });
46
+ if (index !== -1) {
47
+ areaPlayerList.splice(index, 1);
48
+ }
49
+ }
50
+ areaPlayerList.push({
51
+ axisX: playerMapInfo.data.x,
52
+ axisY: playerMapInfo.data.y,
53
+ tmpId
54
+ });
55
+ // promods服ID集合
56
+ let promodsServerIdList = [50, 51];
57
+ // 构建地图数据
58
+ let data = {
59
+ mapType: promodsServerIdList.indexOf(playerMapInfo.data.server) !== -1 ? 'promods' : 'ets',
60
+ avatar: playerInfo.data.smallAvatar,
61
+ username: playerInfo.data.name,
62
+ serverName: playerMapInfo.data.serverDetails.name,
63
+ country: await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country),
64
+ realName: await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName),
65
+ currentPlayerId: tmpId,
66
+ centerX: playerMapInfo.data.x,
67
+ centerY: playerMapInfo.data.y,
68
+ playerList: areaPlayerList
69
+ };
70
+ let page;
71
+ try {
72
+ page = await ctx.puppeteer.page();
73
+ await page.setViewport({ width: 1000, height: 1000 });
74
+ await page.goto(`file:///${resolve(__dirname, '../resource/position.html')}`);
75
+ await page.evaluate(`setData(${JSON.stringify(data)})`);
76
+ await common.sleep(100);
77
+ await page.waitForNetworkIdle();
78
+ const element = await page.$("#container");
79
+ return (segment.image(await element.screenshot({
80
+ encoding: "binary"
81
+ }), "image/jpg"));
82
+ }
83
+ catch (e) {
84
+ return '渲染异常,请重试';
85
+ }
86
+ finally {
87
+ if (page) {
88
+ await page.close();
89
+ }
90
+ }
91
+ }
92
+ else {
93
+ return '未启用 puppeteer 服务';
94
+ }
95
+ };
@@ -0,0 +1,118 @@
1
+ const dayjs = require('dayjs');
2
+ const dayjsRelativeTime = require('dayjs/plugin/relativeTime');
3
+ const dayjsLocaleZhCn = require('dayjs/locale/zh-cn');
4
+ const guildBind = require('../database/guildBind');
5
+ const truckyAppApi = require('../api/truckyAppApi');
6
+ const evmOpenApi = require('../api/evmOpenApi');
7
+ const baiduTranslate = require('../util/baiduTranslate');
8
+ dayjs.extend(dayjsRelativeTime);
9
+ dayjs.locale(dayjsLocaleZhCn);
10
+ /**
11
+ * 用户组
12
+ */
13
+ const userGroup = {
14
+ 'Player': '玩家',
15
+ 'Retired Legend': '退役',
16
+ 'Game Developer': '游戏开发者',
17
+ 'Retired Team Member': '退休团队成员',
18
+ 'Add-On Team': '附加组件团队',
19
+ 'Game Moderator': '游戏管理员'
20
+ };
21
+ /**
22
+ * 查询玩家信息
23
+ */
24
+ module.exports = async (ctx, cfg, session, tmpId) => {
25
+ if (tmpId && isNaN(tmpId)) {
26
+ return `请输入正确的玩家编号,或绑定玩家编号`;
27
+ }
28
+ // 如果没有传入tmpId,尝试从数据库查询绑定信息
29
+ if (!tmpId) {
30
+ let guildBindData = await guildBind.get(ctx.database, session.platform, session.userId);
31
+ if (!guildBindData) {
32
+ return `请输入正确的玩家编号,或绑定玩家编号`;
33
+ }
34
+ tmpId = guildBindData.tmp_id;
35
+ }
36
+ // 查询玩家信息
37
+ let playerInfo = await evmOpenApi.playerInfo(ctx.http, tmpId);
38
+ if (playerInfo.error && playerInfo.code === 10001) {
39
+ return '玩家不存在';
40
+ }
41
+ else if (playerInfo.error) {
42
+ return '查询玩家信息失败,请重试';
43
+ }
44
+ // 查询线上信息
45
+ let playerMapInfo = await truckyAppApi.online(ctx.http, tmpId);
46
+ // 拼接消息模板
47
+ let message = '';
48
+ if (cfg.queryShowAvatarEnable) {
49
+ message += `<img src="${playerInfo.data.avatarUrl}"/>\n`;
50
+ }
51
+ message += '🆔TMP编号: ' + playerInfo.data.tmpId;
52
+ message += '\n😀玩家名称: ' + playerInfo.data.name;
53
+ message += '\n🎮SteamID: ' + playerInfo.data.steamId;
54
+ let registerDate = dayjs(playerInfo.data.registerTime);
55
+ message += '\n📑注册日期: ' + registerDate.format('YYYY年MM月DD日') + ` (${dayjs().diff(registerDate, 'day')}天)`;
56
+ message += '\n💼所属分组: ' + (userGroup[playerInfo.data.groupName] || playerInfo.data.groupName);
57
+ if (playerInfo.data.isJoinVtc) {
58
+ message += '\n🚚所属车队: ' + playerInfo.data.vtcName;
59
+ message += '\n🚚车队角色: ' + playerInfo.data.vtcRole;
60
+ }
61
+ message += '\n🚫是否封禁: ' + (playerInfo.data.isBan ? '是' : '否');
62
+ if (playerInfo.data.isBan) {
63
+ message += '\n🚫封禁截止: ';
64
+ if (playerInfo.data.banHide) {
65
+ message += '隐藏';
66
+ }
67
+ else {
68
+ if (!playerInfo.data.banUntil) {
69
+ message += '永久';
70
+ }
71
+ else {
72
+ message += dayjs(playerInfo.data.banUntil).format('YYYY年MM月DD日 HH:mm');
73
+ }
74
+ message += "\n🚫封禁原因: " + (playerInfo.data.banReasonZh || playerInfo.data.banReason);
75
+ }
76
+ }
77
+ message += '\n🚫封禁次数: ' + (playerInfo.data.banCount || 0);
78
+ if (playerInfo.data.mileage) {
79
+ let mileage = playerInfo.data.mileage;
80
+ let mileageUnit = '米';
81
+ if (mileage > 1000) {
82
+ mileage = (mileage / 1000).toFixed(1);
83
+ mileageUnit = '公里';
84
+ }
85
+ message += '\n🚩历史里程: ' + mileage + mileageUnit;
86
+ }
87
+ if (playerInfo.data.todayMileage) {
88
+ let todayMileage = playerInfo.data.todayMileage;
89
+ let mileageUnit = '米';
90
+ if (todayMileage > 1000) {
91
+ todayMileage = (todayMileage / 1000).toFixed(1);
92
+ mileageUnit = '公里';
93
+ }
94
+ message += '\n🚩今日里程: ' + todayMileage + mileageUnit;
95
+ }
96
+ if (playerMapInfo && !playerMapInfo.error) {
97
+ message += '\n📶在线状态: ' + (playerMapInfo.data.online ? `在线🟢 (${playerMapInfo.data.serverDetails.name})` : '离线⚫');
98
+ if (playerMapInfo.data.online) {
99
+ message += '\n🌍线上位置: ';
100
+ message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country);
101
+ message += ' - ';
102
+ message += await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName);
103
+ }
104
+ else if (playerInfo.data.lastOnlineTime) {
105
+ message += '\n📶上次在线: ' + dayjs(playerInfo.data.lastOnlineTime).fromNow(false);
106
+ }
107
+ }
108
+ if (playerInfo.data.isSponsor) {
109
+ message += '\n🎁赞助用户';
110
+ if (!playerInfo.data.sponsorHide) {
111
+ message += `: \$${Math.floor(playerInfo.data.sponsorAmount / 100)}`;
112
+ }
113
+ }
114
+ if (playerInfo.data.sponsorCumulativeAmount) {
115
+ message += '\n🎁累计赞助: $' + Math.floor(playerInfo.data.sponsorCumulativeAmount / 100);
116
+ }
117
+ return message;
118
+ };
@@ -1 +1,34 @@
1
- const a12_0x390cef=a12_0x4f88;(function(_0x616c84,_0x1fb55f){const _0x2bbaff=a12_0x4f88,_0x274f2e=_0x616c84();while(!![]){try{const _0x36956b=-parseInt(_0x2bbaff(0x88))/0x1+-parseInt(_0x2bbaff(0x8d))/0x2*(parseInt(_0x2bbaff(0x85))/0x3)+parseInt(_0x2bbaff(0x7f))/0x4+-parseInt(_0x2bbaff(0x95))/0x5*(parseInt(_0x2bbaff(0x7c))/0x6)+parseInt(_0x2bbaff(0x8f))/0x7*(parseInt(_0x2bbaff(0x92))/0x8)+-parseInt(_0x2bbaff(0x97))/0x9*(parseInt(_0x2bbaff(0x8c))/0xa)+parseInt(_0x2bbaff(0x80))/0xb;if(_0x36956b===_0x1fb55f)break;else _0x274f2e['push'](_0x274f2e['shift']());}catch(_0x3b7dc3){_0x274f2e['push'](_0x274f2e['shift']());}}}(a12_0x4958,0xd7cf9));const truckersMpApi=require(a12_0x390cef(0x91)),evmOpenApi=require(a12_0x390cef(0x93));function a12_0x4958(){const _0x3a64f9=['isOnline','\x0a服务器特性:\x20','afkEnable','524950sUUIMc','215386RIkOsi','⏱挂机','3843uGnkuh','playerCount','../api/truckersMpApi','9992EaicwH','../api/evmOpenApi','服务器:\x20','255LSDHYA','exports','171rjebGC','\x0a玩家人数:\x20','serverList','maxPlayer','180354uEoSaZ','\x20(队列:\x20','push','256116EtlPjf','54694431ngWysU','data','💥碰撞','queueCount','join','21ZyyYEW','serverName','collisionsEnable','1553725isjeAG'];a12_0x4958=function(){return _0x3a64f9;};return a12_0x4958();}function a12_0x4f88(_0x16ccd3,_0x43b7b1){_0x16ccd3=_0x16ccd3-0x7b;const _0x49588e=a12_0x4958();let _0x4f883c=_0x49588e[_0x16ccd3];return _0x4f883c;}module[a12_0x390cef(0x96)]=async _0x1e67ae=>{const _0xa78f7f=a12_0x390cef;let _0x2e9b1b=await evmOpenApi[_0xa78f7f(0x99)](_0x1e67ae['http']);if(_0x2e9b1b['error'])return'查询服务器失败,请稍后重试';let _0xb73c8='';for(let _0x4a7064 of _0x2e9b1b[_0xa78f7f(0x81)]){_0xb73c8&&(_0xb73c8+='\x0a\x0a');_0xb73c8+=_0xa78f7f(0x94)+(_0x4a7064[_0xa78f7f(0x89)]===0x1?'🟢':'⚫')+_0x4a7064[_0xa78f7f(0x86)],_0xb73c8+=_0xa78f7f(0x98)+_0x4a7064[_0xa78f7f(0x90)]+'/'+_0x4a7064[_0xa78f7f(0x7b)];_0x4a7064['queue']&&(_0xb73c8+=_0xa78f7f(0x7d)+_0x4a7064[_0xa78f7f(0x83)]+')');let _0x47208b=[];!(_0x4a7064[_0xa78f7f(0x8b)]===0x1)&&_0x47208b[_0xa78f7f(0x7e)](_0xa78f7f(0x8e)),_0x4a7064[_0xa78f7f(0x87)]===0x1&&_0x47208b[_0xa78f7f(0x7e)](_0xa78f7f(0x82)),_0x47208b&&_0x47208b['length']>0x0&&(_0xb73c8+=_0xa78f7f(0x8a)+_0x47208b[_0xa78f7f(0x84)]('\x20'));}return _0xb73c8;};
1
+ const truckersMpApi = require('../api/truckersMpApi');
2
+ const evmOpenApi = require('../api/evmOpenApi');
3
+ module.exports = async (ctx) => {
4
+ // 查询服务器信息
5
+ let serverData = await evmOpenApi.serverList(ctx.http);
6
+ if (serverData.error) {
7
+ return '查询服务器失败,请稍后重试';
8
+ }
9
+ // 构建消息
10
+ let message = '';
11
+ for (let server of serverData.data) {
12
+ // 如果前面有内容,换行
13
+ if (message) {
14
+ message += '\n\n';
15
+ }
16
+ message += '服务器: ' + (server.isOnline === 1 ? '🟢' : '⚫') + server.serverName;
17
+ message += `\n玩家人数: ${server.playerCount}/${server.maxPlayer}`;
18
+ if (server.queue) {
19
+ message += ` (队列: ${server.queueCount})`;
20
+ }
21
+ // 服务器特性
22
+ let characteristicList = [];
23
+ if (!(server.afkEnable === 1)) {
24
+ characteristicList.push('⏱挂机');
25
+ }
26
+ if (server.collisionsEnable === 1) {
27
+ characteristicList.push('💥碰撞');
28
+ }
29
+ if (characteristicList && characteristicList.length > 0) {
30
+ message += '\n服务器特性: ' + characteristicList.join(' ');
31
+ }
32
+ }
33
+ return message;
34
+ };
@@ -1 +1,15 @@
1
- const a13_0x18647a=a13_0x44e3;(function(_0x221aeb,_0x303d10){const _0x5bc886=a13_0x44e3,_0x2f6523=_0x221aeb();while(!![]){try{const _0x1d911a=-parseInt(_0x5bc886(0x189))/0x1*(-parseInt(_0x5bc886(0x188))/0x2)+-parseInt(_0x5bc886(0x186))/0x3+parseInt(_0x5bc886(0x18b))/0x4+parseInt(_0x5bc886(0x185))/0x5+-parseInt(_0x5bc886(0x18f))/0x6*(-parseInt(_0x5bc886(0x18d))/0x7)+parseInt(_0x5bc886(0x190))/0x8*(parseInt(_0x5bc886(0x191))/0x9)+-parseInt(_0x5bc886(0x18c))/0xa*(parseInt(_0x5bc886(0x187))/0xb);if(_0x1d911a===_0x303d10)break;else _0x2f6523['push'](_0x2f6523['shift']());}catch(_0x27d414){_0x2f6523['push'](_0x2f6523['shift']());}}}(a13_0x52bd,0x5e5e2));function a13_0x52bd(){const _0x54fe23=['302109DOpiTM','66mwkxfi','2WaDosf','654491IJGJtp','./tmpTrafficMap','2069316SNriia','3116670ZNiZtX','1244922UlbzqR','指令配置错误','18PLiczR','40VrNxXc','1115973muXeIb','./tmpTrafficText','159460LMFmsq'];a13_0x52bd=function(){return _0x54fe23;};return a13_0x52bd();}const tmpTrafficMap=require(a13_0x18647a(0x18a)),tmpTrafficText=require(a13_0x18647a(0x184));function a13_0x44e3(_0x2acb2b,_0x25fe13){_0x2acb2b=_0x2acb2b-0x184;const _0x52bd67=a13_0x52bd();let _0x44e325=_0x52bd67[_0x2acb2b];return _0x44e325;}module['exports']=async(_0x5e3b0b,_0x54ee7e,_0x4bfb2b)=>{const _0x55d0f8=a13_0x18647a;switch(_0x54ee7e['tmpTrafficType']){case 0x1:return await tmpTrafficText(_0x5e3b0b,_0x54ee7e,_0x4bfb2b);case 0x2:return await tmpTrafficMap(_0x5e3b0b,_0x54ee7e,_0x4bfb2b);default:return _0x55d0f8(0x18e);}};
1
+ const tmpTrafficMap = require("./tmpTrafficMap");
2
+ const tmpTrafficText = require("./tmpTrafficText");
3
+ /**
4
+ * 查询路况
5
+ */
6
+ module.exports = async (ctx, cfg, serverName) => {
7
+ switch (cfg.tmpTrafficType) {
8
+ case 1:
9
+ return await tmpTrafficText(ctx, cfg, serverName);
10
+ case 2:
11
+ return await tmpTrafficMap(ctx, cfg, serverName);
12
+ default:
13
+ return '指令配置错误';
14
+ }
15
+ };
@@ -1 +1,119 @@
1
- function a14_0x3e30(_0x240c96,_0x30a963){_0x240c96=_0x240c96-0x11c;const _0x887fb3=a14_0x887f();let _0x3e30b3=_0x887fb3[_0x240c96];return _0x3e30b3;}const a14_0x1c067d=a14_0x3e30;(function(_0x586a4e,_0xa4b285){const _0x1976c2=a14_0x3e30,_0x16c605=_0x586a4e();while(!![]){try{const _0x3f453b=-parseInt(_0x1976c2(0x12c))/0x1+-parseInt(_0x1976c2(0x152))/0x2*(-parseInt(_0x1976c2(0x120))/0x3)+parseInt(_0x1976c2(0x137))/0x4*(-parseInt(_0x1976c2(0x136))/0x5)+parseInt(_0x1976c2(0x13f))/0x6+-parseInt(_0x1976c2(0x12d))/0x7*(-parseInt(_0x1976c2(0x141))/0x8)+parseInt(_0x1976c2(0x149))/0x9+parseInt(_0x1976c2(0x14e))/0xa*(-parseInt(_0x1976c2(0x128))/0xb);if(_0x3f453b===_0xa4b285)break;else _0x16c605['push'](_0x16c605['shift']());}catch(_0x52ff8d){_0x16c605['push'](_0x16c605['shift']());}}}(a14_0x887f,0xe36ca));const truckyAppApi=require(a14_0x1c067d(0x139)),evmOpenApi=require(a14_0x1c067d(0x127)),baiduTranslate=require('../../util/baiduTranslate'),{resolve}=require(a14_0x1c067d(0x12f)),common=require(a14_0x1c067d(0x14a)),{segment}=require(a14_0x1c067d(0x14f)),serverAlias={'s1':{'name':'sim1','mapType':'ets','serverId':0x2,'bounds':[[-0x16fed,0x16e4f],[0x135a0,-0x13497]]},'s2':{'name':'sim2','mapType':a14_0x1c067d(0x11e),'serverId':0x29,'bounds':[[-0x16fed,0x16e4f],[0x135a0,-0x13497]]},'p':{'name':a14_0x1c067d(0x122),'mapType':'promods','serverId':0x32,'bounds':[[-0x17863,0x3ffd],[0x3230d,-0x1145e]]},'a':{'name':a14_0x1c067d(0x140),'mapType':a14_0x1c067d(0x11e),'serverId':0x7,'bounds':[[-0x16fed,0x16e4f],[0x135a0,-0x13497]]}},severityToZh={'Fluid':{'text':'畅通','color':a14_0x1c067d(0x12a)},'Moderate':{'text':'正常','color':a14_0x1c067d(0x146)},'Congested':{'text':'缓慢','color':'#f8312f'},'Heavy':{'text':'拥堵','color':a14_0x1c067d(0x131)}},typeToZh={'City':'城市','Road':'公路','Intersection':a14_0x1c067d(0x13c)};module['exports']=async(_0x91ad88,_0x300ab2,_0x48d627)=>{const _0x12c94b=a14_0x1c067d;if(!_0x91ad88['puppeteer'])return _0x12c94b(0x135);let _0x368876=serverAlias[_0x48d627];if(!_0x368876)return _0x12c94b(0x13a);let _0x4c160f=await truckyAppApi[_0x12c94b(0x11f)](_0x91ad88[_0x12c94b(0x14b)],_0x368876[_0x12c94b(0x138)]);if(_0x4c160f[_0x12c94b(0x143)])return _0x12c94b(0x147);let _0x4e8577=await evmOpenApi[_0x12c94b(0x14d)](_0x91ad88[_0x12c94b(0x14b)],_0x368876['serverId'],_0x368876['bounds'][0x0][0x0],_0x368876['bounds'][0x0][0x1],_0x368876[_0x12c94b(0x130)][0x1][0x0],_0x368876[_0x12c94b(0x130)][0x1][0x1]),_0x4d2f3d={'mapType':_0x368876['mapType'],'trafficList':[],'playerCoordinateList':_0x4e8577[_0x12c94b(0x143)]&&_0x4e8577['data']?[]:_0x4e8577[_0x12c94b(0x123)][_0x12c94b(0x125)](_0x4b3371=>[_0x4b3371[_0x12c94b(0x145)],_0x4b3371[_0x12c94b(0x11c)]])};for(const _0xb57017 of _0x4c160f[_0x12c94b(0x123)]){_0x4d2f3d[_0x12c94b(0x12e)]['push']({'country':await baiduTranslate(_0x91ad88,_0x300ab2,_0xb57017[_0x12c94b(0x151)]),'province':await baiduTranslate(_0x91ad88,_0x300ab2,_0xb57017[_0x12c94b(0x138)][_0x12c94b(0x153)](0x0,_0xb57017[_0x12c94b(0x138)][_0x12c94b(0x142)]('(')-0x1)),'playerCount':_0xb57017['players'],'severity':severityToZh[_0xb57017[_0x12c94b(0x148)]]||{'text':'未知','color':_0x12c94b(0x11d)}});}let _0x457c33;try{_0x457c33=await _0x91ad88[_0x12c94b(0x154)][_0x12c94b(0x126)](),await _0x457c33[_0x12c94b(0x13b)]({'width':0x3e8,'height':0x3e8}),await _0x457c33[_0x12c94b(0x133)](_0x12c94b(0x124)+resolve(__dirname,_0x12c94b(0x13e))),await _0x457c33[_0x12c94b(0x134)](_0x12c94b(0x14c)+JSON[_0x12c94b(0x13d)](_0x4d2f3d)+')'),await common[_0x12c94b(0x150)](0x64),await _0x457c33['waitForNetworkIdle']();const _0x31ee18=await _0x457c33['$'](_0x12c94b(0x129));return segment[_0x12c94b(0x12b)](await _0x31ee18[_0x12c94b(0x144)]({'encoding':'binary'}),_0x12c94b(0x121));}catch{return _0x12c94b(0x132);}finally{_0x457c33&&await _0x457c33['close']();}};function a14_0x887f(){const _0x1d72f9=['bounds','#8d67c5','渲染异常,请重试','goto','evaluate','未启用\x20puppeteer\x20服务','164180oRxCcS','92WcWwaG','name','../../api/truckyAppApi','请输入正确的服务器名称\x20(s1,\x20s2,\x20p,\x20a)','setViewport','十字路口','stringify','../../resource/traffic.html','10936116IOOtiv','arc1','8zOlfIR','lastIndexOf','error','screenshot','axisX','#ff6723','查询路况信息失败','newSeverity','3780594HWchOP','../../util/common','http','setData(','mapPlayerList','230gXcoIt','koishi','sleep','country','2qrMtLQ','substring','puppeteer','axisY','#ffffff','ets','trafficTop','642606BJYRFQ','image/jpg','eupromods1','data','file:///','map','page','../../api/evmOpenApi','96767NdUeUF','#container','#00d26a','image','1014484ovcUcR','3126333kKpEEr','trafficList','path'];a14_0x887f=function(){return _0x1d72f9;};return a14_0x887f();}
1
+ const truckyAppApi = require('../../api/truckyAppApi');
2
+ const evmOpenApi = require('../../api/evmOpenApi');
3
+ const baiduTranslate = require('../../util/baiduTranslate');
4
+ const { resolve } = require("path");
5
+ const common = require("../../util/common");
6
+ const { segment } = require("koishi");
7
+ /**
8
+ * 服务器别名
9
+ */
10
+ const serverAlias = {
11
+ 's1': {
12
+ name: 'sim1',
13
+ mapType: 'ets',
14
+ serverId: 2,
15
+ bounds: [[-94189, 93775], [79264, -78999]]
16
+ },
17
+ 's2': {
18
+ name: 'sim2',
19
+ mapType: 'ets',
20
+ serverId: 41,
21
+ bounds: [[-94189, 93775], [79264, -78999]]
22
+ },
23
+ 'p': {
24
+ name: 'eupromods1',
25
+ mapType: 'promods',
26
+ serverId: 50,
27
+ bounds: [[-96355, 16381], [205581, -70750]]
28
+ },
29
+ 'a': {
30
+ name: 'arc1',
31
+ mapType: 'ets',
32
+ serverId: 7,
33
+ bounds: [[-94189, 93775], [79264, -78999]]
34
+ }
35
+ };
36
+ /**
37
+ * 路况程度转中文
38
+ */
39
+ const severityToZh = {
40
+ 'Fluid': {
41
+ text: '畅通',
42
+ color: '#00d26a'
43
+ },
44
+ 'Moderate': {
45
+ text: '正常',
46
+ color: '#ff6723'
47
+ },
48
+ 'Congested': {
49
+ text: '缓慢',
50
+ color: '#f8312f'
51
+ },
52
+ 'Heavy': {
53
+ text: '拥堵',
54
+ color: '#8d67c5'
55
+ }
56
+ };
57
+ /**
58
+ * 位置类型转中文
59
+ */
60
+ const typeToZh = {
61
+ 'City': '城市',
62
+ 'Road': '公路',
63
+ 'Intersection': '十字路口'
64
+ };
65
+ /**
66
+ * 查询路况
67
+ */
68
+ module.exports = async (ctx, cfg, serverName) => {
69
+ if (!ctx.puppeteer) {
70
+ return '未启用 puppeteer 服务';
71
+ }
72
+ // 根据别名获取服务器信息
73
+ let serverInfo = serverAlias[serverName];
74
+ if (!serverInfo) {
75
+ return '请输入正确的服务器名称 (s1, s2, p, a)';
76
+ }
77
+ // 查询路况信息
78
+ let trafficData = await truckyAppApi.trafficTop(ctx.http, serverInfo.name);
79
+ if (trafficData.error) {
80
+ return '查询路况信息失败';
81
+ }
82
+ // 查询地图玩家数据
83
+ let mapData = await evmOpenApi.mapPlayerList(ctx.http, serverInfo.serverId, serverInfo.bounds[0][0], serverInfo.bounds[0][1], serverInfo.bounds[1][0], serverInfo.bounds[1][1]);
84
+ // 构建路况数据
85
+ let data = {
86
+ mapType: serverInfo.mapType,
87
+ trafficList: [],
88
+ playerCoordinateList: mapData.error && mapData.data ? [] : mapData.data.map(item => [item.axisX, item.axisY])
89
+ };
90
+ for (const traffic of trafficData.data) {
91
+ data.trafficList.push({
92
+ country: await baiduTranslate(ctx, cfg, traffic.country),
93
+ province: await baiduTranslate(ctx, cfg, traffic.name.substring(0, traffic.name.lastIndexOf('(') - 1)),
94
+ playerCount: traffic.players,
95
+ severity: severityToZh[traffic.newSeverity] || { text: '未知', color: '#ffffff' }
96
+ });
97
+ }
98
+ let page;
99
+ try {
100
+ page = await ctx.puppeteer.page();
101
+ await page.setViewport({ width: 1000, height: 1000 });
102
+ await page.goto(`file:///${resolve(__dirname, '../../resource/traffic.html')}`);
103
+ await page.evaluate(`setData(${JSON.stringify(data)})`);
104
+ await common.sleep(100);
105
+ await page.waitForNetworkIdle();
106
+ const element = await page.$("#container");
107
+ return (segment.image(await element.screenshot({
108
+ encoding: "binary"
109
+ }), "image/jpg"));
110
+ }
111
+ catch {
112
+ return '渲染异常,请重试';
113
+ }
114
+ finally {
115
+ if (page) {
116
+ await page.close();
117
+ }
118
+ }
119
+ };
@@ -1 +1,58 @@
1
- function a15_0x2f79(_0x204544,_0x3c5a15){_0x204544=_0x204544-0x1c2;const _0x49047c=a15_0x4904();let _0x2f792c=_0x49047c[_0x204544];return _0x2f792c;}const a15_0x1d3159=a15_0x2f79;function a15_0x4904(){const _0x439612=['sim1','1436554EcxIUm','newSeverity','168jjKqqn','455eCMTnn','exports','sim2','27747dYBQUq','🔴缓慢','134386JBZmcw','18196368mmIvDf','substring','\x0a路况:\x20','🟢畅通','🟠正常','8591589smyYSj','arc1','请输入正确的服务器名称\x20(s1,\x20s2,\x20p,\x20a)','20sBzEtu','lastIndexOf','十字路口','country','查询路况信息失败','224cOThRd','26328DmfFzT','trafficTop','error','eupromods1','3695032NdKcsM','http','name','🟣拥堵','1lTwDhK'];a15_0x4904=function(){return _0x439612;};return a15_0x4904();}(function(_0xe50e46,_0x50d1d7){const _0x559371=a15_0x2f79,_0x26640c=_0xe50e46();while(!![]){try{const _0xfd2d40=-parseInt(_0x559371(0x1c7))/0x1*(parseInt(_0x559371(0x1c9))/0x2)+-parseInt(_0x559371(0x1cf))/0x3*(parseInt(_0x559371(0x1df))/0x4)+parseInt(_0x559371(0x1cc))/0x5*(parseInt(_0x559371(0x1e0))/0x6)+-parseInt(_0x559371(0x1d1))/0x7*(parseInt(_0x559371(0x1cb))/0x8)+parseInt(_0x559371(0x1d7))/0x9+-parseInt(_0x559371(0x1da))/0xa*(parseInt(_0x559371(0x1c3))/0xb)+parseInt(_0x559371(0x1d2))/0xc;if(_0xfd2d40===_0x50d1d7)break;else _0x26640c['push'](_0x26640c['shift']());}catch(_0x455db8){_0x26640c['push'](_0x26640c['shift']());}}}(a15_0x4904,0x887f2));const truckyAppApi=require('../../api/truckyAppApi'),baiduTranslate=require('../../util/baiduTranslate'),serverNameAlias={'s1':a15_0x1d3159(0x1c8),'s2':a15_0x1d3159(0x1ce),'p':a15_0x1d3159(0x1c2),'a':a15_0x1d3159(0x1d8)},severityToZh={'Fluid':a15_0x1d3159(0x1d5),'Moderate':a15_0x1d3159(0x1d6),'Congested':a15_0x1d3159(0x1d0),'Heavy':a15_0x1d3159(0x1c6)},typeToZh={'City':'城市','Road':'公路','Intersection':a15_0x1d3159(0x1dc)};module[a15_0x1d3159(0x1cd)]=async(_0x29234e,_0x538c9a,_0x4021bb)=>{const _0x2cdd9d=a15_0x1d3159;let _0x18cebb=serverNameAlias[_0x4021bb];if(!_0x18cebb)return _0x2cdd9d(0x1d9);let _0x251345=await truckyAppApi[_0x2cdd9d(0x1e1)](_0x29234e[_0x2cdd9d(0x1c4)],_0x18cebb);if(_0x251345[_0x2cdd9d(0x1e2)])return _0x2cdd9d(0x1de);let _0x3d9391='';for(const _0x317d4e of _0x251345['data']){_0x3d9391&&(_0x3d9391+='\x0a\x0a');_0x3d9391+=await baiduTranslate(_0x29234e,_0x538c9a,_0x317d4e[_0x2cdd9d(0x1dd)]),_0x3d9391+='\x20-\x20';let _0xb57676=_0x317d4e[_0x2cdd9d(0x1c5)][_0x2cdd9d(0x1d3)](0x0,_0x317d4e[_0x2cdd9d(0x1c5)][_0x2cdd9d(0x1db)]('(')-0x1),_0x200471=_0x317d4e[_0x2cdd9d(0x1c5)]['substring'](_0x317d4e[_0x2cdd9d(0x1c5)][_0x2cdd9d(0x1db)]('(')+0x1,_0x317d4e['name'][_0x2cdd9d(0x1db)](')'));_0x3d9391+=await baiduTranslate(_0x29234e,_0x538c9a,_0xb57676)+('\x20('+(typeToZh[_0x200471]||_0x200471)+')'),_0x3d9391+=_0x2cdd9d(0x1d4)+(severityToZh[_0x317d4e[_0x2cdd9d(0x1ca)]]||_0x317d4e['color']),_0x3d9391+='\x20|\x20人数:\x20'+_0x317d4e['players'];}return _0x3d9391;};
1
+ const truckyAppApi = require('../../api/truckyAppApi');
2
+ const baiduTranslate = require('../../util/baiduTranslate');
3
+ /**
4
+ * 服务器别名
5
+ */
6
+ const serverNameAlias = {
7
+ 's1': 'sim1',
8
+ 's2': 'sim2',
9
+ 'p': 'eupromods1',
10
+ 'a': 'arc1'
11
+ };
12
+ /**
13
+ * 路况程度转中文
14
+ */
15
+ const severityToZh = {
16
+ 'Fluid': '🟢畅通',
17
+ 'Moderate': '🟠正常',
18
+ 'Congested': '🔴缓慢',
19
+ 'Heavy': '🟣拥堵'
20
+ };
21
+ /**
22
+ * 位置类型转中文
23
+ */
24
+ const typeToZh = {
25
+ 'City': '城市',
26
+ 'Road': '公路',
27
+ 'Intersection': '十字路口'
28
+ };
29
+ /**
30
+ * 查询路况
31
+ */
32
+ module.exports = async (ctx, cfg, serverName) => {
33
+ // 转换服务器别名
34
+ let serverQueryName = serverNameAlias[serverName];
35
+ if (!serverQueryName) {
36
+ return '请输入正确的服务器名称 (s1, s2, p, a)';
37
+ }
38
+ let trafficData = await truckyAppApi.trafficTop(ctx.http, serverQueryName);
39
+ if (trafficData.error) {
40
+ return '查询路况信息失败';
41
+ }
42
+ // 构建消息
43
+ let message = '';
44
+ for (const traffic of trafficData.data) {
45
+ // 如果已有内容,换行
46
+ if (message) {
47
+ message += '\n\n';
48
+ }
49
+ message += await baiduTranslate(ctx, cfg, traffic.country);
50
+ message += ' - ';
51
+ let name = traffic.name.substring(0, traffic.name.lastIndexOf('(') - 1);
52
+ let type = traffic.name.substring(traffic.name.lastIndexOf('(') + 1, traffic.name.lastIndexOf(')'));
53
+ message += await baiduTranslate(ctx, cfg, name) + ` (${typeToZh[type] || type})`;
54
+ message += '\n路况: ' + (severityToZh[traffic.newSeverity] || traffic.color);
55
+ message += ' | 人数: ' + traffic.players;
56
+ }
57
+ return message;
58
+ };
@@ -1 +1,14 @@
1
- function a16_0x2979(){const _0x36466a=['exports','67239ecOpUV','981464BnLAoJ','error','4rVJMgo','142458ptNUiY','data','1194864qCCqna','1041955mFVNBo','查询失败,请稍后再试','130777xALJnd','supported_game_version','http','7383681nWICpr','supported_ats_game_version','../api/truckersMpApi','version','美卡支持版本:\x20','28NqwzlC'];a16_0x2979=function(){return _0x36466a;};return a16_0x2979();}const a16_0x1a34b4=a16_0x30af;(function(_0x12603d,_0x4019e3){const _0x324276=a16_0x30af,_0xd24427=_0x12603d();while(!![]){try{const _0x390db6=-parseInt(_0x324276(0x1db))/0x1*(parseInt(_0x324276(0x1e8))/0x2)+-parseInt(_0x324276(0x1e5))/0x3+-parseInt(_0x324276(0x1e6))/0x4+-parseInt(_0x324276(0x1d9))/0x5+parseInt(_0x324276(0x1e9))/0x6*(-parseInt(_0x324276(0x1e3))/0x7)+parseInt(_0x324276(0x1d8))/0x8+parseInt(_0x324276(0x1de))/0x9;if(_0x390db6===_0x4019e3)break;else _0xd24427['push'](_0xd24427['shift']());}catch(_0xd4c025){_0xd24427['push'](_0xd24427['shift']());}}}(a16_0x2979,0x2176f));function a16_0x30af(_0x5f122b,_0x2c726a){_0x5f122b=_0x5f122b-0x1d8;const _0x297964=a16_0x2979();let _0x30afc9=_0x297964[_0x5f122b];return _0x30afc9;}const truckersMpApi=require(a16_0x1a34b4(0x1e0));module[a16_0x1a34b4(0x1e4)]=async _0x5150f6=>{const _0x30a2cc=a16_0x1a34b4;let _0x2c88ed=await truckersMpApi[_0x30a2cc(0x1e1)](_0x5150f6[_0x30a2cc(0x1dd)]);if(_0x2c88ed[_0x30a2cc(0x1e7)])return _0x30a2cc(0x1da);let _0x1e1178='';return _0x1e1178+='TMP版本:'+_0x2c88ed[_0x30a2cc(0x1ea)]['name']+'\x0a',_0x1e1178+='欧卡支持版本:\x20'+_0x2c88ed[_0x30a2cc(0x1ea)][_0x30a2cc(0x1dc)]+'\x0a',_0x1e1178+=_0x30a2cc(0x1e2)+_0x2c88ed['data'][_0x30a2cc(0x1df)],_0x1e1178;};
1
+ const truckersMpApi = require("../api/truckersMpApi");
2
+ module.exports = async (ctx) => {
3
+ // 查询版本信息
4
+ let result = await truckersMpApi.version(ctx.http);
5
+ if (result.error) {
6
+ return '查询失败,请稍后再试';
7
+ }
8
+ // 构建消息返回
9
+ let message = '';
10
+ message += `TMP版本:${result.data.name}\n`;
11
+ message += `欧卡支持版本: ${result.data.supported_game_version}\n`;
12
+ message += `美卡支持版本: ${result.data.supported_ats_game_version}`;
13
+ return message;
14
+ };
@@ -1 +1,41 @@
1
- function a17_0x1e45(_0x300071,_0x50b54a){_0x300071=_0x300071-0x1de;const _0x242705=a17_0x2427();let _0x1e45a2=_0x242705[_0x300071];return _0x1e45a2;}function a17_0x2427(){const _0x3b7122=['1803389FQxOoj','10540422jDgwJw','1094328UKHmYP','10DQYdGs','368252ANeCYb','12VaBoxD','448665sYGipi','414418NQAlji','5467840rPfHTb','exports','get','tmp_guild_bind'];a17_0x2427=function(){return _0x3b7122;};return a17_0x2427();}const a17_0x11fdc0=a17_0x1e45;(function(_0x544758,_0x206df7){const _0x95f4da=a17_0x1e45,_0x34a4dd=_0x544758();while(!![]){try{const _0xc6fd17=-parseInt(_0x95f4da(0x1e1))/0x1+-parseInt(_0x95f4da(0x1e4))/0x2+parseInt(_0x95f4da(0x1e3))/0x3+-parseInt(_0x95f4da(0x1df))/0x4*(parseInt(_0x95f4da(0x1e0))/0x5)+parseInt(_0x95f4da(0x1e2))/0x6*(-parseInt(_0x95f4da(0x1e9))/0x7)+parseInt(_0x95f4da(0x1e5))/0x8+parseInt(_0x95f4da(0x1de))/0x9;if(_0xc6fd17===_0x206df7)break;else _0x34a4dd['push'](_0x34a4dd['shift']());}catch(_0x50afa6){_0x34a4dd['push'](_0x34a4dd['shift']());}}}(a17_0x2427,0x596ea),module[a17_0x11fdc0(0x1e6)]={async 'get'(_0x5ce553,_0x109642,_0x40e7c0){const _0xdbf454=a17_0x11fdc0,_0xe06dec=await _0x5ce553['get'](_0xdbf454(0x1e8),{'platform':_0x109642,'user_id':_0x40e7c0});if(_0xe06dec&&_0xe06dec['length']>0x0)return _0xe06dec[0x0];return null;},'saveOrUpdate'(_0xca0bc,_0x33b975,_0x24f1c3,_0x540900){const _0x44dac6=a17_0x11fdc0;this[_0x44dac6(0x1e7)](_0xca0bc,_0x33b975,_0x24f1c3)['then'](_0x4a3c86=>{const _0x10eb94=_0x44dac6;_0x4a3c86?_0xca0bc['set'](_0x10eb94(0x1e8),_0x4a3c86['id'],{'tmp_id':_0x540900}):_0xca0bc['create'](_0x10eb94(0x1e8),{'platform':_0x33b975,'user_id':_0x24f1c3,'tmp_id':_0x540900});});}});
1
+ module.exports = {
2
+ /**
3
+ * 获取绑定信息
4
+ * @param db 数据源
5
+ * @param platform 平台
6
+ * @param userId 用户编号
7
+ */
8
+ async get(db, platform, userId) {
9
+ const guildBindList = await db.get('tmp_guild_bind', {
10
+ platform,
11
+ user_id: userId
12
+ });
13
+ if (guildBindList && guildBindList.length > 0) {
14
+ return guildBindList[0];
15
+ }
16
+ return null;
17
+ },
18
+ /**
19
+ * 新增或更新绑定信息
20
+ * @param db 数据源
21
+ * @param platform 平台
22
+ * @param userId 用户编号
23
+ * @param tmpId TMP ID
24
+ */
25
+ saveOrUpdate(db, platform, userId, tmpId) {
26
+ this.get(db, platform, userId).then((data) => {
27
+ if (data) {
28
+ db.set('tmp_guild_bind', data.id, {
29
+ tmp_id: tmpId
30
+ });
31
+ }
32
+ else {
33
+ db.create('tmp_guild_bind', {
34
+ platform: platform,
35
+ user_id: userId,
36
+ tmp_id: tmpId
37
+ });
38
+ }
39
+ });
40
+ }
41
+ };
@@ -1 +1,65 @@
1
- const a18_0x3249fd=a18_0x3f95;function a18_0x4837(){const _0x5ab6aa=['8620pQyVAk','用户编号','6VgGXqV','8129016fdIuIj','extend','138663BQCJUr','所属平台','翻译文本','原文文本md5','unsigned','exports','string','1733216aXoziV','原文文本','TMP\x20ID','1263Gooqdq','4748GFABZH','20201580EhtoRI','85265dpGOGr','83ovtzfn'];a18_0x4837=function(){return _0x5ab6aa;};return a18_0x4837();}function a18_0x3f95(_0x18bebc,_0x137d11){_0x18bebc=_0x18bebc-0xc7;const _0x483776=a18_0x4837();let _0x3f95c9=_0x483776[_0x18bebc];return _0x3f95c9;}(function(_0x57a474,_0x18dea5){const _0x965077=a18_0x3f95,_0x1d4034=_0x57a474();while(!![]){try{const _0x10492a=parseInt(_0x965077(0xcd))/0x1*(-parseInt(_0x965077(0xce))/0x2)+parseInt(_0x965077(0xc9))/0x3*(-parseInt(_0x965077(0xca))/0x4)+-parseInt(_0x965077(0xcc))/0x5*(-parseInt(_0x965077(0xd0))/0x6)+-parseInt(_0x965077(0xd3))/0x7+parseInt(_0x965077(0xda))/0x8+-parseInt(_0x965077(0xd1))/0x9+parseInt(_0x965077(0xcb))/0xa;if(_0x10492a===_0x18dea5)break;else _0x1d4034['push'](_0x1d4034['shift']());}catch(_0x138814){_0x1d4034['push'](_0x1d4034['shift']());}}}(a18_0x4837,0x7391d));const modelArray={'tmp_guild_bind':{'id':{'type':a18_0x3249fd(0xd7),'length':0xa,'nullable':![],'comment':'主键'},'platform':{'type':'string','length':0x32,'nullable':![],'comment':a18_0x3249fd(0xd4)},'user_id':{'type':a18_0x3249fd(0xd9),'length':0x32,'nullable':![],'comment':a18_0x3249fd(0xcf)},'tmp_id':{'type':'unsigned','length':0x32,'nullable':![],'comment':a18_0x3249fd(0xc8)}},'tmp_translate_cache':{'id':{'type':a18_0x3249fd(0xd7),'length':0xa,'nullable':![],'comment':'主键'},'content':{'type':'string','nullable':![],'length':0xc8,'comment':a18_0x3249fd(0xc7)},'content_md5':{'type':a18_0x3249fd(0xd9),'nullable':![],'length':0x20,'comment':a18_0x3249fd(0xd6)},'translate_content':{'type':a18_0x3249fd(0xd9),'nullable':![],'length':0xc8,'comment':a18_0x3249fd(0xd5)}}};module[a18_0x3249fd(0xd8)]=_0x1ed28f=>{const _0x53c06f=a18_0x3249fd;for(let _0x4150ed in modelArray){_0x1ed28f['model'][_0x53c06f(0xd2)](_0x4150ed,modelArray[_0x4150ed],{'autoInc':!![]});}};
1
+ /**
2
+ * 数据表声明
3
+ */
4
+ const modelArray = {
5
+ tmp_guild_bind: {
6
+ id: {
7
+ type: 'unsigned',
8
+ length: 10,
9
+ nullable: false,
10
+ comment: '主键'
11
+ },
12
+ platform: {
13
+ type: 'string',
14
+ length: 50,
15
+ nullable: false,
16
+ comment: '所属平台'
17
+ },
18
+ user_id: {
19
+ type: 'string',
20
+ length: 50,
21
+ nullable: false,
22
+ comment: '用户编号'
23
+ },
24
+ tmp_id: {
25
+ type: 'unsigned',
26
+ length: 50,
27
+ nullable: false,
28
+ comment: 'TMP ID'
29
+ }
30
+ },
31
+ tmp_translate_cache: {
32
+ id: {
33
+ type: 'unsigned',
34
+ length: 10,
35
+ nullable: false,
36
+ comment: '主键'
37
+ },
38
+ content: {
39
+ type: 'string',
40
+ nullable: false,
41
+ length: 200,
42
+ comment: '原文文本'
43
+ },
44
+ content_md5: {
45
+ type: 'string',
46
+ nullable: false,
47
+ length: 32,
48
+ comment: '原文文本md5'
49
+ },
50
+ translate_content: {
51
+ type: 'string',
52
+ nullable: false,
53
+ length: 200,
54
+ comment: '翻译文本'
55
+ }
56
+ }
57
+ };
58
+ /**
59
+ * 初始化数据库
60
+ */
61
+ module.exports = (ctx) => {
62
+ for (let modelName in modelArray) {
63
+ ctx.model.extend(modelName, modelArray[modelName], { autoInc: true });
64
+ }
65
+ };
@@ -1 +1,31 @@
1
- const a19_0x53b230=a19_0x42fd;(function(_0xefde8a,_0xc2218d){const _0x12c20b=a19_0x42fd,_0x370dca=_0xefde8a();while(!![]){try{const _0x1aeb43=-parseInt(_0x12c20b(0xd7))/0x1+parseInt(_0x12c20b(0xd6))/0x2*(-parseInt(_0x12c20b(0xd8))/0x3)+-parseInt(_0x12c20b(0xdf))/0x4+parseInt(_0x12c20b(0xe2))/0x5*(parseInt(_0x12c20b(0xdd))/0x6)+-parseInt(_0x12c20b(0xd9))/0x7+-parseInt(_0x12c20b(0xd5))/0x8+-parseInt(_0x12c20b(0xdc))/0x9*(-parseInt(_0x12c20b(0xda))/0xa);if(_0x1aeb43===_0xc2218d)break;else _0x370dca['push'](_0x370dca['shift']());}catch(_0x23764b){_0x370dca['push'](_0x370dca['shift']());}}}(a19_0x2693,0x7840f),module[a19_0x53b230(0xe0)]={async 'getTranslate'(_0x3f750,_0x4eaa6a){const _0x13fec5=a19_0x53b230,_0x88a187=await _0x3f750[_0x13fec5(0xdb)]('tmp_translate_cache',{'content_md5':_0x4eaa6a});if(_0x88a187&&_0x88a187[_0x13fec5(0xe1)]>0x0)return _0x88a187[0x0]['translate_content'];return null;},'save'(_0x41ed82,_0x46d3a5,_0x25fcd8,_0x5603b9){const _0x1e4859=a19_0x53b230;_0x41ed82['create'](_0x1e4859(0xde),{'content':_0x25fcd8,'content_md5':_0x46d3a5,'translate_content':_0x5603b9});}});function a19_0x42fd(_0x2982a8,_0x275e55){_0x2982a8=_0x2982a8-0xd5;const _0x26932d=a19_0x2693();let _0x42fd11=_0x26932d[_0x2982a8];return _0x42fd11;}function a19_0x2693(){const _0x366980=['9EbznyA','8502FNLwpO','tmp_translate_cache','3807228DPzvHE','exports','length','1515prLejg','4114600yXhBPK','2eerHkq','191443AZAyoB','198933RTdeNi','4986254bWsfva','24994160DJVCqa','get'];a19_0x2693=function(){return _0x366980;};return a19_0x2693();}
1
+ module.exports = {
2
+ /**
3
+ * 查询翻译
4
+ * @param db 数据源
5
+ * @param contentMd5 文本MD5
6
+ */
7
+ async getTranslate(db, contentMd5) {
8
+ const translateCacheList = await db.get('tmp_translate_cache', {
9
+ content_md5: contentMd5
10
+ });
11
+ // 如果查询到了缓存,直接返回翻译文本
12
+ if (translateCacheList && translateCacheList.length > 0) {
13
+ return translateCacheList[0].translate_content;
14
+ }
15
+ return null;
16
+ },
17
+ /**
18
+ * 保存翻译缓存信息
19
+ * @param db 数据源
20
+ * @param contentMd5 原文文本MD5
21
+ * @param content 原文文本
22
+ * @param translateContent 翻译文本
23
+ */
24
+ save(db, contentMd5, content, translateContent) {
25
+ db.create('tmp_translate_cache', {
26
+ content,
27
+ content_md5: contentMd5,
28
+ translate_content: translateContent
29
+ });
30
+ }
31
+ };