koishi-plugin-tmp-bot 1.19.4 → 1.20.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 (37) hide show
  1. package/lib/api/evmOpenApi.js +1 -136
  2. package/lib/api/truckersMpApi.js +1 -110
  3. package/lib/api/truckersMpMapApi.js +1 -25
  4. package/lib/api/truckyAppApi.js +1 -47
  5. package/lib/command/tmpBind.js +1 -19
  6. package/lib/command/tmpDlcMap.js +1 -33
  7. package/lib/command/tmpFootprint.d.ts +1 -1
  8. package/lib/command/tmpFootprint.js +1 -68
  9. package/lib/command/tmpMileageRanking.js +1 -55
  10. package/lib/command/tmpPosition.js +1 -95
  11. package/lib/command/tmpQuery/tmpQuery.js +1 -12
  12. package/lib/command/tmpQuery/tmpQueryImg.js +1 -103
  13. package/lib/command/tmpQuery/tmpQueryText.js +1 -118
  14. package/lib/command/tmpServer.js +1 -34
  15. package/lib/command/tmpTraffic/tmpTraffic.js +1 -15
  16. package/lib/command/tmpTraffic/tmpTrafficMap.js +1 -119
  17. package/lib/command/tmpTraffic/tmpTrafficText.js +1 -58
  18. package/lib/command/tmpVersion.js +1 -14
  19. package/lib/database/guildBind.js +1 -41
  20. package/lib/database/model.js +1 -65
  21. package/lib/database/translateCache.js +1 -31
  22. package/lib/index.js +1 -55
  23. package/lib/resource/dlc.html +1 -30
  24. package/lib/resource/footprint.html +1 -125
  25. package/lib/resource/mileage-leaderboard.html +1 -174
  26. package/lib/resource/package/ets-map.js +1 -63
  27. package/lib/resource/package/leaflet/heatmap.min.js +1 -9
  28. package/lib/resource/package/leaflet/leaflet-heatmap.js +1 -246
  29. package/lib/resource/package/leaflet/leaflet.min.js +1 -1
  30. package/lib/resource/position.html +1 -105
  31. package/lib/resource/query.html +1 -137
  32. package/lib/resource/traffic.html +1 -121
  33. package/lib/util/baiduTranslate.js +1 -30
  34. package/lib/util/common.js +1 -5
  35. package/lib/util/constant.d.ts +4 -0
  36. package/lib/util/constant.js +1 -29
  37. package/package.json +1 -2
@@ -1,95 +1 @@
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
- };
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,12 +1 @@
1
- const tmpQueryText = require("./tmpQueryText");
2
- const tmpQueryImg = require("./tmpQueryImg");
3
- module.exports = async (ctx, cfg, session, tmpId) => {
4
- switch (cfg.tmpQueryType) {
5
- case 1:
6
- return await tmpQueryText(ctx, cfg, session, tmpId);
7
- case 2:
8
- return await tmpQueryImg(ctx, cfg, session, tmpId);
9
- default:
10
- return '指令配置错误';
11
- }
12
- };
1
+ const a9_0x5a52d0=a9_0x4dff;(function(_0x495149,_0x2a30d6){const _0x3fb6fd=a9_0x4dff,_0x175288=_0x495149();while(!![]){try{const _0x4b009d=parseInt(_0x3fb6fd(0xcf))/0x1*(-parseInt(_0x3fb6fd(0xc7))/0x2)+parseInt(_0x3fb6fd(0xc6))/0x3+-parseInt(_0x3fb6fd(0xcc))/0x4*(-parseInt(_0x3fb6fd(0xc8))/0x5)+-parseInt(_0x3fb6fd(0xc3))/0x6*(-parseInt(_0x3fb6fd(0xc5))/0x7)+parseInt(_0x3fb6fd(0xd0))/0x8*(-parseInt(_0x3fb6fd(0xcb))/0x9)+parseInt(_0x3fb6fd(0xcd))/0xa+-parseInt(_0x3fb6fd(0xc2))/0xb*(parseInt(_0x3fb6fd(0xc4))/0xc);if(_0x4b009d===_0x2a30d6)break;else _0x175288['push'](_0x175288['shift']());}catch(_0x322085){_0x175288['push'](_0x175288['shift']());}}}(a9_0x4137,0xb3683));const tmpQueryText=require(a9_0x5a52d0(0xce)),tmpQueryImg=require(a9_0x5a52d0(0xca));function a9_0x4137(){const _0xa1f376=['18816URRsui','7PsayKv','3871500KLMVCM','22EltWss','1737810UwqQni','exports','./tmpQueryImg','247383HGaUbT','8KxZbGk','6770690CVxloE','./tmpQueryText','79013AdOwAn','384XXkOZj','tmpQueryType','3014AzlxIJ','4141854gJamlA'];a9_0x4137=function(){return _0xa1f376;};return a9_0x4137();}function a9_0x4dff(_0x4b59c9,_0x137259){_0x4b59c9=_0x4b59c9-0xc1;const _0x4137fd=a9_0x4137();let _0x4dff45=_0x4137fd[_0x4b59c9];return _0x4dff45;}module[a9_0x5a52d0(0xc9)]=async(_0x1aefe3,_0x27c505,_0x21f298,_0x5a3962)=>{const _0x262ca5=a9_0x5a52d0;switch(_0x27c505[_0x262ca5(0xc1)]){case 0x1:return await tmpQueryText(_0x1aefe3,_0x27c505,_0x21f298,_0x5a3962);case 0x2:return await tmpQueryImg(_0x1aefe3,_0x27c505,_0x21f298,_0x5a3962);default:return'指令配置错误';}};
@@ -1,103 +1 @@
1
- const dayjs = require('dayjs');
2
- const guildBind = require('../../database/guildBind');
3
- const truckyAppApi = require('../../api/truckyAppApi');
4
- const evmOpenApi = require('../../api/evmOpenApi');
5
- const baiduTranslate = require('../../util/baiduTranslate');
6
- const { resolve } = require("path");
7
- const common = require("../../util/common");
8
- const { segment } = require("koishi");
9
- /**
10
- * 用户组
11
- */
12
- const userGroup = {
13
- 'Player': '玩家',
14
- 'Retired Legend': '退役',
15
- 'Game Developer': '游戏开发者',
16
- 'Retired Team Member': '退休团队成员',
17
- 'Add-On Team': '附加组件团队',
18
- 'Game Moderator': '游戏管理员'
19
- };
20
- /**
21
- * 查询玩家信息
22
- */
23
- module.exports = async (ctx, cfg, session, tmpId) => {
24
- if (!ctx.puppeteer) {
25
- return '未启用 puppeteer 服务';
26
- }
27
- if (tmpId && isNaN(tmpId)) {
28
- return `请输入正确的玩家编号`;
29
- }
30
- // 如果没有传入tmpId,尝试从数据库查询绑定信息
31
- if (!tmpId) {
32
- let guildBindData = await guildBind.get(ctx.database, session.platform, session.userId);
33
- if (!guildBindData) {
34
- return `请输入正确的玩家编号`;
35
- }
36
- tmpId = guildBindData.tmp_id;
37
- }
38
- // 查询玩家信息
39
- let playerInfo = await evmOpenApi.playerInfo(ctx.http, tmpId);
40
- if (playerInfo.error && playerInfo.code === 10001) {
41
- return '玩家不存在';
42
- }
43
- else if (playerInfo.error) {
44
- return '查询玩家信息失败,请重试';
45
- }
46
- // 查询线上信息
47
- let playerMapInfo = await truckyAppApi.online(ctx.http, tmpId);
48
- // 拼接数据
49
- let data = {};
50
- data.tmpId = playerInfo.data.tmpId;
51
- data.name = playerInfo.data.name;
52
- data.steamId = playerInfo.data.steamId;
53
- data.registerDate = dayjs(playerInfo.data.registerTime).format('YYYY年MM月DD日');
54
- data.avatarUrl = playerInfo.data.avatarUrl;
55
- data.groupColor = playerInfo.data.groupColor;
56
- data.groupName = (userGroup[playerInfo.data.groupName] || playerInfo.data.groupName);
57
- data.isJoinVtc = playerInfo.data.isJoinVtc;
58
- data.vtcName = playerInfo.data.vtcName;
59
- data.vtcRole = playerInfo.data.vtcRole;
60
- data.isSponsor = playerInfo.data.isSponsor;
61
- data.sponsorAmount = playerInfo.data.sponsorAmount;
62
- data.sponsorCumulativeAmount = playerInfo.data.sponsorCumulativeAmount;
63
- data.sponsorHide = playerInfo.data.sponsorHide;
64
- data.isOnline = false;
65
- if (playerMapInfo && !playerMapInfo.error) {
66
- data.isOnline = playerMapInfo.data.online;
67
- if (data.isOnline) {
68
- data.onlineServerName = playerMapInfo.data.serverDetails.name;
69
- data.onlineCountry = await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.country);
70
- data.onlineCity = await baiduTranslate(ctx, cfg, playerMapInfo.data.location.poi.realName);
71
- data.onlineX = playerMapInfo.data.x;
72
- data.onlineY = playerMapInfo.data.y;
73
- data.onlineMapType = playerMapInfo.data.serverDetails.id === 50 ? 'promods' : 'ets';
74
- }
75
- }
76
- data.isBan = playerInfo.data.isBan;
77
- data.banUntil = playerInfo.data.banUntil;
78
- data.banReason = playerInfo.data.banReason;
79
- data.banReasonZh = playerInfo.data.banReasonZh;
80
- data.banCount = playerInfo.data.banCount;
81
- data.banHide = playerInfo.data.banHide;
82
- let page;
83
- try {
84
- page = await ctx.puppeteer.page();
85
- await page.setViewport({ width: 1000, height: 1000 });
86
- await page.goto(`file:///${resolve(__dirname, '../../resource/query.html')}`);
87
- await page.evaluate(`init(${JSON.stringify(data)})`);
88
- await common.sleep(100);
89
- await page.waitForNetworkIdle();
90
- const element = await page.$("#container");
91
- return (segment.image(await element.screenshot({
92
- encoding: "binary"
93
- }), "image/jpg"));
94
- }
95
- catch {
96
- return '渲染异常,请重试';
97
- }
98
- finally {
99
- if (page) {
100
- await page.close();
101
- }
102
- }
103
- };
1
+ const a10_0x4d2801=a10_0x35bf;(function(_0x51e863,_0x4b3eae){const _0xc5fd30=a10_0x35bf,_0x1f55bd=_0x51e863();while(!![]){try{const _0x19c3f6=-parseInt(_0xc5fd30(0x12c))/0x1*(-parseInt(_0xc5fd30(0x153))/0x2)+-parseInt(_0xc5fd30(0x12f))/0x3+parseInt(_0xc5fd30(0x117))/0x4+-parseInt(_0xc5fd30(0x151))/0x5+-parseInt(_0xc5fd30(0x148))/0x6*(parseInt(_0xc5fd30(0x147))/0x7)+-parseInt(_0xc5fd30(0x131))/0x8+parseInt(_0xc5fd30(0x12a))/0x9*(parseInt(_0xc5fd30(0x14b))/0xa);if(_0x19c3f6===_0x4b3eae)break;else _0x1f55bd['push'](_0x1f55bd['shift']());}catch(_0x286ac3){_0x1f55bd['push'](_0x1f55bd['shift']());}}}(a10_0x47f3,0xdde4c));const dayjs=require(a10_0x4d2801(0x159)),guildBind=require(a10_0x4d2801(0x135)),truckyAppApi=require(a10_0x4d2801(0x150)),evmOpenApi=require(a10_0x4d2801(0x116)),baiduTranslate=require('../../util/baiduTranslate'),{resolve}=require(a10_0x4d2801(0x14e)),common=require(a10_0x4d2801(0x13d)),{segment}=require(a10_0x4d2801(0x15a)),userGroup={'Player':'玩家','Retired\x20Legend':'退役','Game\x20Developer':'游戏开发者','Retired\x20Team\x20Member':a10_0x4d2801(0x12d),'Add-On\x20Team':a10_0x4d2801(0x13f),'Game\x20Moderator':a10_0x4d2801(0x11b)};module['exports']=async(_0x523b9b,_0x38b994,_0x49fcdc,_0x3fd076)=>{const _0x10c640=a10_0x4d2801;if(!_0x523b9b[_0x10c640(0x157)])return _0x10c640(0x13b);if(_0x3fd076&&isNaN(_0x3fd076))return _0x10c640(0x120);if(!_0x3fd076){let _0x41fa63=await guildBind[_0x10c640(0x114)](_0x523b9b['database'],_0x49fcdc[_0x10c640(0x143)],_0x49fcdc[_0x10c640(0x115)]);if(!_0x41fa63)return'请输入正确的玩家编号';_0x3fd076=_0x41fa63['tmp_id'];}let _0x2f97da=await evmOpenApi['playerInfo'](_0x523b9b[_0x10c640(0x149)],_0x3fd076);if(_0x2f97da[_0x10c640(0x113)]&&_0x2f97da[_0x10c640(0x155)]===0x2711)return'玩家不存在';else{if(_0x2f97da[_0x10c640(0x113)])return _0x10c640(0x136);}let _0x567b9f=await truckyAppApi[_0x10c640(0x11e)](_0x523b9b[_0x10c640(0x149)],_0x3fd076),_0x46d220={};_0x46d220[_0x10c640(0x140)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x140)],_0x46d220[_0x10c640(0x154)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x154)],_0x46d220[_0x10c640(0x12b)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x12b)],_0x46d220[_0x10c640(0x130)]=dayjs(_0x2f97da[_0x10c640(0x121)]['registerTime'])['format'](_0x10c640(0x133)),_0x46d220[_0x10c640(0x122)]=_0x2f97da[_0x10c640(0x121)]['avatarUrl'],_0x46d220[_0x10c640(0x144)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x144)],_0x46d220[_0x10c640(0x138)]=userGroup[_0x2f97da[_0x10c640(0x121)][_0x10c640(0x138)]]||_0x2f97da[_0x10c640(0x121)]['groupName'],_0x46d220[_0x10c640(0x14a)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x14a)],_0x46d220[_0x10c640(0x12e)]=_0x2f97da[_0x10c640(0x121)]['vtcName'],_0x46d220[_0x10c640(0x126)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x126)],_0x46d220['isSponsor']=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x127)],_0x46d220['sponsorAmount']=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x112)],_0x46d220[_0x10c640(0x125)]=_0x2f97da[_0x10c640(0x121)]['sponsorCumulativeAmount'],_0x46d220[_0x10c640(0x123)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x123)],_0x46d220[_0x10c640(0x110)]=![];_0x567b9f&&!_0x567b9f[_0x10c640(0x113)]&&(_0x46d220[_0x10c640(0x110)]=_0x567b9f[_0x10c640(0x121)]['online'],_0x46d220[_0x10c640(0x110)]&&(_0x46d220[_0x10c640(0x139)]=_0x567b9f[_0x10c640(0x121)][_0x10c640(0x141)]['name'],_0x46d220['onlineCountry']=await baiduTranslate(_0x523b9b,_0x38b994,_0x567b9f[_0x10c640(0x121)]['location'][_0x10c640(0x11f)]['country']),_0x46d220[_0x10c640(0x146)]=await baiduTranslate(_0x523b9b,_0x38b994,_0x567b9f[_0x10c640(0x121)][_0x10c640(0x129)][_0x10c640(0x11f)]['realName']),_0x46d220[_0x10c640(0x156)]=_0x567b9f[_0x10c640(0x121)]['x'],_0x46d220['onlineY']=_0x567b9f['data']['y'],_0x46d220['onlineMapType']=_0x567b9f['data'][_0x10c640(0x141)]['id']===0x32?_0x10c640(0x158):_0x10c640(0x152)));_0x46d220['isBan']=_0x2f97da[_0x10c640(0x121)]['isBan'],_0x46d220['banUntil']=_0x2f97da['data'][_0x10c640(0x118)],_0x46d220[_0x10c640(0x145)]=_0x2f97da[_0x10c640(0x121)]['banReason'],_0x46d220[_0x10c640(0x111)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x111)],_0x46d220[_0x10c640(0x11d)]=_0x2f97da[_0x10c640(0x121)][_0x10c640(0x11d)],_0x46d220[_0x10c640(0x137)]=_0x2f97da[_0x10c640(0x121)]['banHide'];let _0x1447bd;try{_0x1447bd=await _0x523b9b[_0x10c640(0x157)][_0x10c640(0x124)](),await _0x1447bd['setViewport']({'width':0x3e8,'height':0x3e8}),await _0x1447bd['goto'](_0x10c640(0x11c)+resolve(__dirname,_0x10c640(0x13e))),await _0x1447bd[_0x10c640(0x142)](_0x10c640(0x14f)+JSON[_0x10c640(0x13c)](_0x46d220)+')'),await common[_0x10c640(0x128)](0x64),await _0x1447bd[_0x10c640(0x11a)]();const _0x23ad3f=await _0x1447bd['$'](_0x10c640(0x13a));return segment['image'](await _0x23ad3f[_0x10c640(0x14c)]({'encoding':_0x10c640(0x132)}),_0x10c640(0x14d));}catch{return _0x10c640(0x119);}finally{_0x1447bd&&await _0x1447bd[_0x10c640(0x134)]();}};function a10_0x35bf(_0x4277e0,_0xf2c640){_0x4277e0=_0x4277e0-0x110;const _0x47f38b=a10_0x47f3();let _0x35bfbb=_0x47f38b[_0x4277e0];return _0x35bfbb;}function a10_0x47f3(){const _0x1bd79a=['onlineServerName','#container','未启用\x20puppeteer\x20服务','stringify','../../util/common','../../resource/query.html','附加组件团队','tmpId','serverDetails','evaluate','platform','groupColor','banReason','onlineCity','45087vddoVF','246DiTMKF','http','isJoinVtc','60xrdfRv','screenshot','image/jpg','path','init(','../../api/truckyAppApi','6050630brrsNR','ets','430184qlSRsx','name','code','onlineX','puppeteer','promods','dayjs','koishi','isOnline','banReasonZh','sponsorAmount','error','get','userId','../../api/evmOpenApi','5695620IEjlLs','banUntil','渲染异常,请重试','waitForNetworkIdle','游戏管理员','file:///','banCount','online','poi','请输入正确的玩家编号','data','avatarUrl','sponsorHide','page','sponsorCumulativeAmount','vtcRole','isSponsor','sleep','location','2543967mnSAXT','steamId','4ajrltg','退休团队成员','vtcName','1650036eKmKBi','registerDate','8377248UslPgt','binary','YYYY年MM月DD日','close','../../database/guildBind','查询玩家信息失败,请重试','banHide','groupName'];a10_0x47f3=function(){return _0x1bd79a;};return a10_0x47f3();}
@@ -1,118 +1 @@
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
+ const a11_0x5c8f90=a11_0x41c7;(function(_0x1b40d7,_0x189d7d){const _0x4ac9f2=a11_0x41c7,_0x4704b1=_0x1b40d7();while(!![]){try{const _0x5e09b5=parseInt(_0x4ac9f2(0x176))/0x1+parseInt(_0x4ac9f2(0x1ae))/0x2+-parseInt(_0x4ac9f2(0x175))/0x3*(parseInt(_0x4ac9f2(0x191))/0x4)+parseInt(_0x4ac9f2(0x1a5))/0x5*(parseInt(_0x4ac9f2(0x185))/0x6)+parseInt(_0x4ac9f2(0x186))/0x7+parseInt(_0x4ac9f2(0x180))/0x8*(-parseInt(_0x4ac9f2(0x181))/0x9)+-parseInt(_0x4ac9f2(0x17f))/0xa*(-parseInt(_0x4ac9f2(0x1b0))/0xb);if(_0x5e09b5===_0x189d7d)break;else _0x4704b1['push'](_0x4704b1['shift']());}catch(_0x211b12){_0x4704b1['push'](_0x4704b1['shift']());}}}(a11_0xfc39,0x9b4ab));function a11_0x41c7(_0x253653,_0x1ad6e9){_0x253653=_0x253653-0x168;const _0xfc392d=a11_0xfc39();let _0x41c751=_0xfc392d[_0x253653];return _0x41c751;}const dayjs=require(a11_0x5c8f90(0x184)),dayjsRelativeTime=require(a11_0x5c8f90(0x16e)),dayjsLocaleZhCn=require(a11_0x5c8f90(0x182)),guildBind=require('../../database/guildBind'),truckyAppApi=require('../../api/truckyAppApi'),evmOpenApi=require('../../api/evmOpenApi'),baiduTranslate=require(a11_0x5c8f90(0x16b));function a11_0xfc39(){const _0x90290d=['\x0a🚚所属车队:\x20','\x0a📑注册日期:\x20','toFixed','playerInfo','banCount','\x0a🚩历史里程:\x20','sponsorCumulativeAmount','realName','查询玩家信息失败,请重试','vtcRole','\x0a📶上次在线:\x20','4595ILRXNM','groupName','附加组件团队','queryShowAvatarEnable','sponsorAmount','\x0a🌍线上位置:\x20','游戏管理员','YYYY年MM月DD日\x20HH:mm','banReason','740892VrgFuN','isJoinVtc','11819973JqnVNN','country','\x0a😀玩家名称:\x20','format','banUntil','data','userId','steamId','extend','\x20-\x20','../../util/baiduTranslate','location','在线🟢\x20(','dayjs/plugin/relativeTime','\x0a🚚车队角色:\x20','isBan','banHide','离线⚫','🆔TMP编号:\x20','sponsorHide','789vSZxMQ','536857Aertyz','todayMileage','locale','http','serverDetails','floor','\x0a🎁累计赞助:\x20$','\x0a🚫封禁次数:\x20','<img\x20src=\x22','10jqFQBc','7611056yZhbLC','9IImbFh','dayjs/locale/zh-cn','online','dayjs','1422kTEpse','3003175tEzazY','lastOnlineTime','platform','\x0a💼所属分组:\x20','YYYY年MM月DD日','vtcName','\x22/>\x0a','isSponsor','\x0a🚫是否封禁:\x20','name','diff','15836qzBOBp','exports','poi','请输入正确的玩家编号','registerTime','banReasonZh','\x0a🎁赞助用户','error','mileage'];a11_0xfc39=function(){return _0x90290d;};return a11_0xfc39();}dayjs[a11_0x5c8f90(0x169)](dayjsRelativeTime),dayjs[a11_0x5c8f90(0x178)](dayjsLocaleZhCn);const userGroup={'Player':'玩家','Retired\x20Legend':'退役','Game\x20Developer':'游戏开发者','Retired\x20Team\x20Member':'退休团队成员','Add-On\x20Team':a11_0x5c8f90(0x1a7),'Game\x20Moderator':a11_0x5c8f90(0x1ab)};module[a11_0x5c8f90(0x192)]=async(_0x2610a0,_0x4cf10d,_0x196552,_0x53c0a4)=>{const _0x31fd77=a11_0x5c8f90;if(_0x53c0a4&&isNaN(_0x53c0a4))return _0x31fd77(0x194);if(!_0x53c0a4){let _0x1f0ffd=await guildBind['get'](_0x2610a0['database'],_0x196552[_0x31fd77(0x188)],_0x196552[_0x31fd77(0x1b6)]);if(!_0x1f0ffd)return _0x31fd77(0x194);_0x53c0a4=_0x1f0ffd['tmp_id'];}let _0x449156=await evmOpenApi[_0x31fd77(0x19d)](_0x2610a0[_0x31fd77(0x179)],_0x53c0a4);if(_0x449156[_0x31fd77(0x198)]&&_0x449156['code']===0x2711)return'玩家不存在';else{if(_0x449156[_0x31fd77(0x198)])return _0x31fd77(0x1a2);}let _0x3c82a0=await truckyAppApi[_0x31fd77(0x183)](_0x2610a0['http'],_0x53c0a4),_0x125947='';_0x4cf10d[_0x31fd77(0x1a8)]&&(_0x125947+=_0x31fd77(0x17e)+_0x449156[_0x31fd77(0x1b5)]['avatarUrl']+_0x31fd77(0x18c));_0x125947+=_0x31fd77(0x173)+_0x449156[_0x31fd77(0x1b5)]['tmpId'],_0x125947+=_0x31fd77(0x1b2)+_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x18f)],_0x125947+='\x0a🎮SteamID:\x20'+_0x449156['data'][_0x31fd77(0x168)];let _0x3090c4=dayjs(_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x195)]);_0x125947+=_0x31fd77(0x19b)+_0x3090c4[_0x31fd77(0x1b3)](_0x31fd77(0x18a))+('\x20('+dayjs()[_0x31fd77(0x190)](_0x3090c4,'day')+'天)'),_0x125947+=_0x31fd77(0x189)+(userGroup[_0x449156[_0x31fd77(0x1b5)]['groupName']]||_0x449156['data'][_0x31fd77(0x1a6)]);_0x449156['data'][_0x31fd77(0x1af)]&&(_0x125947+=_0x31fd77(0x19a)+_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x18b)],_0x125947+=_0x31fd77(0x16f)+_0x449156['data'][_0x31fd77(0x1a3)]);_0x125947+=_0x31fd77(0x18e)+(_0x449156['data'][_0x31fd77(0x170)]?'是':'否');_0x449156[_0x31fd77(0x1b5)]['isBan']&&(_0x125947+='\x0a🚫封禁截止:\x20',_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x171)]?_0x125947+='隐藏':(!_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x1b4)]?_0x125947+='永久':_0x125947+=dayjs(_0x449156['data'][_0x31fd77(0x1b4)])[_0x31fd77(0x1b3)](_0x31fd77(0x1ac)),_0x125947+='\x0a🚫封禁原因:\x20'+(_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x196)]||_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x1ad)])));_0x125947+=_0x31fd77(0x17d)+(_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x19e)]||0x0);if(_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x199)]){let _0x5d5723=_0x449156[_0x31fd77(0x1b5)]['mileage'],_0x2abde6='米';_0x5d5723>0x3e8&&(_0x5d5723=(_0x5d5723/0x3e8)[_0x31fd77(0x19c)](0x1),_0x2abde6='公里'),_0x125947+=_0x31fd77(0x19f)+_0x5d5723+_0x2abde6;}if(_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x177)]){let _0x36ed10=_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x177)],_0x510808='米';_0x36ed10>0x3e8&&(_0x36ed10=(_0x36ed10/0x3e8)[_0x31fd77(0x19c)](0x1),_0x510808='公里'),_0x125947+='\x0a🚩今日里程:\x20'+_0x36ed10+_0x510808;}if(_0x3c82a0&&!_0x3c82a0[_0x31fd77(0x198)]){_0x125947+='\x0a📶在线状态:\x20'+(_0x3c82a0[_0x31fd77(0x1b5)][_0x31fd77(0x183)]?_0x31fd77(0x16d)+_0x3c82a0[_0x31fd77(0x1b5)][_0x31fd77(0x17a)][_0x31fd77(0x18f)]+')':_0x31fd77(0x172));if(_0x3c82a0['data'][_0x31fd77(0x183)])_0x125947+=_0x31fd77(0x1aa),_0x125947+=await baiduTranslate(_0x2610a0,_0x4cf10d,_0x3c82a0['data']['location'][_0x31fd77(0x193)][_0x31fd77(0x1b1)]),_0x125947+=_0x31fd77(0x16a),_0x125947+=await baiduTranslate(_0x2610a0,_0x4cf10d,_0x3c82a0['data'][_0x31fd77(0x16c)][_0x31fd77(0x193)][_0x31fd77(0x1a1)]);else _0x449156['data']['lastOnlineTime']&&(_0x125947+=_0x31fd77(0x1a4)+dayjs(_0x449156['data'][_0x31fd77(0x187)])['fromNow'](![]));}return _0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x18d)]&&(_0x125947+=_0x31fd77(0x197),!_0x449156['data'][_0x31fd77(0x174)]&&(_0x125947+=':\x20$'+Math['floor'](_0x449156[_0x31fd77(0x1b5)][_0x31fd77(0x1a9)]/0x64))),_0x449156[_0x31fd77(0x1b5)]['sponsorCumulativeAmount']&&(_0x125947+=_0x31fd77(0x17c)+Math[_0x31fd77(0x17b)](_0x449156['data'][_0x31fd77(0x1a0)]/0x64)),_0x125947;};
@@ -1,34 +1 @@
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
+ 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,15 +1 @@
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
+ 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,119 +1 @@
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
+ 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,58 +1 @@
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
+ 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;};