koishi-plugin-tmp-bot 1.20.1 → 1.20.3
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.
- package/lib/command/tmpFootprint.js +1 -1
- package/lib/command/{tmpQuery/tmpQueryText.js → tmpQuery.js} +4 -4
- package/lib/index.js +2 -6
- package/lib/resource/footprint.html +1 -1
- package/lib/resource/package/SEGUIEMJ.TTF +0 -0
- package/package.json +2 -2
- package/readme.md +14 -13
- package/lib/command/tmpQuery/tmpQuery.d.ts +0 -2
- package/lib/command/tmpQuery/tmpQuery.js +0 -12
- package/lib/command/tmpQuery/tmpQueryImg.d.ts +0 -3
- package/lib/command/tmpQuery/tmpQueryImg.js +0 -103
- package/lib/resource/query.html +0 -363
- /package/lib/command/{tmpQuery/tmpQueryText.d.ts → tmpQuery.d.ts} +0 -0
|
@@ -55,7 +55,7 @@ module.exports = async (ctx, session, serverType, tmpId) => {
|
|
|
55
55
|
name: playerInfo.data.name,
|
|
56
56
|
smallAvatarUrl: playerInfo.data.smallAvatarUrl,
|
|
57
57
|
todayMileage: playerInfo.data.todayMileage,
|
|
58
|
-
points:
|
|
58
|
+
points: mapPlayerHistoryArr
|
|
59
59
|
};
|
|
60
60
|
let page;
|
|
61
61
|
try {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const dayjs = require('dayjs');
|
|
2
2
|
const dayjsRelativeTime = require('dayjs/plugin/relativeTime');
|
|
3
3
|
const dayjsLocaleZhCn = require('dayjs/locale/zh-cn');
|
|
4
|
-
const guildBind = require('
|
|
5
|
-
const truckyAppApi = require('
|
|
6
|
-
const evmOpenApi = require('
|
|
7
|
-
const baiduTranslate = require('
|
|
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
8
|
dayjs.extend(dayjsRelativeTime);
|
|
9
9
|
dayjs.locale(dayjsLocaleZhCn);
|
|
10
10
|
/**
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.apply = apply;
|
|
|
5
5
|
const koishi_1 = require("koishi");
|
|
6
6
|
const model = require('./database/model');
|
|
7
7
|
const { MileageRankingType } = require('./util/constant');
|
|
8
|
-
const tmpQuery = require('./command/tmpQuery
|
|
8
|
+
const tmpQuery = require('./command/tmpQuery');
|
|
9
9
|
const tmpServer = require('./command/tmpServer');
|
|
10
10
|
const tmpBind = require('./command/tmpBind');
|
|
11
11
|
const tmpTraffic = require('./command/tmpTraffic/tmpTraffic');
|
|
@@ -32,11 +32,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
32
32
|
tmpTrafficType: koishi_1.Schema.union([
|
|
33
33
|
koishi_1.Schema.const(1).description('文字'),
|
|
34
34
|
koishi_1.Schema.const(2).description('热力图')
|
|
35
|
-
]).default(1).description('路况信息展示方式')
|
|
36
|
-
tmpQueryType: koishi_1.Schema.union([
|
|
37
|
-
koishi_1.Schema.const(1).description('文字'),
|
|
38
|
-
koishi_1.Schema.const(2).description('图片')
|
|
39
|
-
]).default(1).description('玩家信息展示方式'),
|
|
35
|
+
]).default(1).description('路况信息展示方式')
|
|
40
36
|
}).description('指令配置'),
|
|
41
37
|
]);
|
|
42
38
|
function apply(ctx, cfg) {
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-tmp-bot",
|
|
3
|
-
"description": "欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人->QQ:
|
|
4
|
-
"version": "1.20.
|
|
3
|
+
"description": "欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人->QQ:2364390698",
|
|
4
|
+
"version": "1.20.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"homepage": "https://github.com/79887143/koishi-plugin-tmp-bot",
|
package/readme.md
CHANGED
|
@@ -5,19 +5,20 @@
|
|
|
5
5
|
欧洲卡车模拟2 TMP查询机器人
|
|
6
6
|
|
|
7
7
|
### 指令说明
|
|
8
|
-
| 指令名称 | 指令介绍
|
|
9
|
-
|
|
10
|
-
| tmpbind | 绑定 TMPID,绑定后使用其他指令时可省略输入
|
|
11
|
-
| tmpquery | 查询TMP玩家信息
|
|
12
|
-
| tmpposition | 查询玩家位置信息
|
|
13
|
-
| tmptraffic | 查询服务器热门地点路况信息,仅支持使用服务器简称查询,具体支持查询的服务器和服务器简称信息如下</br>Simulation 1 (简称: s1)</br>Simulation 2 (简称: s2)</br>ProMods (简称: p)</br>Arcade (简称: a)
|
|
14
|
-
| tmpserverats | 查询美卡服务器信息列表
|
|
15
|
-
| tmpserverets | 查询欧卡服务器信息列表
|
|
16
|
-
| tmpversion | 查询版本信息
|
|
17
|
-
| tmpdlcmap | 地图DLC列表
|
|
18
|
-
| tmpmileageranking | 总里程排行榜,数据从 2025年8月23日20:00 开始统计,绑定ID后可查看自己的排名
|
|
19
|
-
| tmptodaymileageranking | 今日里程排行榜,每日0点重置数据,绑定ID后可查看自己的排名
|
|
20
|
-
|
|
|
8
|
+
| 指令名称 | 指令介绍 | 使用示例 |
|
|
9
|
+
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|------------------------|
|
|
10
|
+
| tmpbind | 绑定 TMPID,绑定后使用其他指令时可省略输入 | tmpbind 123 |
|
|
11
|
+
| tmpquery | 查询TMP玩家信息 | tmpquery 123 |
|
|
12
|
+
| tmpposition | 查询玩家位置信息 | tmpposition 123 |
|
|
13
|
+
| tmptraffic | 查询服务器热门地点路况信息,仅支持使用服务器简称查询,具体支持查询的服务器和服务器简称信息如下</br>Simulation 1 (简称: s1)</br>Simulation 2 (简称: s2)</br>ProMods (简称: p)</br>Arcade (简称: a) | tmptraffic s1 |
|
|
14
|
+
| tmpserverats | 查询美卡服务器信息列表 | tmpserverats |
|
|
15
|
+
| tmpserverets | 查询欧卡服务器信息列表 | tmpserverets |
|
|
16
|
+
| tmpversion | 查询版本信息 | tmpversion |
|
|
17
|
+
| tmpdlcmap | 地图DLC列表 | tmpdlcmap |
|
|
18
|
+
| tmpmileageranking | 总里程排行榜,数据从 2025年8月23日20:00 开始统计,绑定ID后可查看自己的排名 | tmpmileageranking |
|
|
19
|
+
| tmptodaymileageranking | 今日里程排行榜,每日0点重置数据,绑定ID后可查看自己的排名 | tmptodaymileageranking |
|
|
20
|
+
| tmpfootprints | 今日足迹,查询除P服外的所有服务器足迹 | tmpfootprints 123 |
|
|
21
|
+
| tmpfootprintp | 今日足迹,查询P和PA服的足迹 | tmpfootprintp 123 |
|
|
21
22
|
|
|
22
23
|
### TMP数据接口文档
|
|
23
24
|
https://apifox.com/apidoc/shared/38508a88-5ff4-4b29-b724-41f9d3d3336a
|
|
@@ -1,12 +0,0 @@
|
|
|
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,103 +0,0 @@
|
|
|
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
|
-
};
|
package/lib/resource/query.html
DELETED
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Title</title>
|
|
6
|
-
<link href="./package/leaflet/leaflet.min.css" rel="stylesheet">
|
|
7
|
-
<script src="./package/leaflet/leaflet.min.js"></script>
|
|
8
|
-
<style>
|
|
9
|
-
@font-face {
|
|
10
|
-
font-family: 'segui-emj';
|
|
11
|
-
src: url('./package/SEGUIEMJ.TTF');
|
|
12
|
-
font-weight: normal;
|
|
13
|
-
font-style: normal;
|
|
14
|
-
}
|
|
15
|
-
body {
|
|
16
|
-
font-family: 'segui-emj', 'sans-serif';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.border {
|
|
20
|
-
border: 1px solid red;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
#container {
|
|
24
|
-
padding-bottom: 16px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.form-box {
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-wrap: wrap;
|
|
30
|
-
}
|
|
31
|
-
.form-box .form-item {
|
|
32
|
-
width: 50%;
|
|
33
|
-
}
|
|
34
|
-
.form-box .form-item.full {
|
|
35
|
-
width: 100%;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
#container {
|
|
39
|
-
width: 400px;
|
|
40
|
-
background: linear-gradient(135deg, #1f2f54, #0f2c2a);
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.header {
|
|
45
|
-
height: 100px;
|
|
46
|
-
background-color: rgba(0, 0, 0, .1);
|
|
47
|
-
display: flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
padding: 0 26px;
|
|
50
|
-
box-shadow: 0 0 16px rgba(0, 0, 0, .4);
|
|
51
|
-
}
|
|
52
|
-
.header .avatar {
|
|
53
|
-
width: 64px;
|
|
54
|
-
height: 64px;
|
|
55
|
-
}
|
|
56
|
-
.header .info {
|
|
57
|
-
flex: 1;
|
|
58
|
-
padding-left: 16px;
|
|
59
|
-
}
|
|
60
|
-
.header .info .name {
|
|
61
|
-
color: #b0c7ff;
|
|
62
|
-
font-size: 18px;
|
|
63
|
-
font-weight: 600;
|
|
64
|
-
}
|
|
65
|
-
.header .info .tmp-id {
|
|
66
|
-
color: #aaaaaa;
|
|
67
|
-
font-size: 14px;
|
|
68
|
-
margin-top: 4px;
|
|
69
|
-
}
|
|
70
|
-
.header .info .group {
|
|
71
|
-
color: #ffffff;
|
|
72
|
-
font-size: 12px;
|
|
73
|
-
padding: 2px 4px;
|
|
74
|
-
margin-left: 6px;
|
|
75
|
-
border-radius: 4px;
|
|
76
|
-
text-shadow: 0 4px 4px rgba(0, 0, 0, 0.8),
|
|
77
|
-
0 -4px 4px rgba(0, 0, 0, 0.8);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.details-container {
|
|
81
|
-
padding: 16px 20px 0 20px;
|
|
82
|
-
}
|
|
83
|
-
.details-container .form-item {
|
|
84
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
85
|
-
box-sizing: border-box;
|
|
86
|
-
}
|
|
87
|
-
.details-container .form-item:nth-child(1) {
|
|
88
|
-
margin-top: 0;
|
|
89
|
-
}
|
|
90
|
-
.details-container .form-item .label {
|
|
91
|
-
color: #dddddd;
|
|
92
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
93
|
-
padding: 4px 8px;
|
|
94
|
-
}
|
|
95
|
-
.details-container .form-item .value {
|
|
96
|
-
color: #ffffff;
|
|
97
|
-
padding: 4px 8px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.ban-container {
|
|
101
|
-
margin: 16px 20px 0 20px;
|
|
102
|
-
background-color: rgba(227, 92, 92, 0.3);
|
|
103
|
-
}
|
|
104
|
-
.ban-header {
|
|
105
|
-
width: 100%;
|
|
106
|
-
height: 30px;
|
|
107
|
-
box-sizing: border-box;
|
|
108
|
-
padding: 0 12px;
|
|
109
|
-
color: #ffffff;
|
|
110
|
-
font-size: 14px;
|
|
111
|
-
line-height: 30px;
|
|
112
|
-
background-color: rgba(227, 92, 92, 0.6);
|
|
113
|
-
}
|
|
114
|
-
.ban-body {
|
|
115
|
-
padding: 12px 16px;
|
|
116
|
-
}
|
|
117
|
-
.ban-body .ban-hidden {
|
|
118
|
-
color: #cccccc;
|
|
119
|
-
font-size: 14px;
|
|
120
|
-
font-style: italic;
|
|
121
|
-
text-align: center;
|
|
122
|
-
}
|
|
123
|
-
.ban-body .form-item {
|
|
124
|
-
margin-top: 8px;
|
|
125
|
-
}
|
|
126
|
-
.ban-body .form-item:nth-child(1),
|
|
127
|
-
.ban-body .form-item:nth-child(2) {
|
|
128
|
-
margin-top: 0;
|
|
129
|
-
}
|
|
130
|
-
.ban-body .form-item .label {
|
|
131
|
-
color: #f3f3f3;
|
|
132
|
-
font-size: 12px;
|
|
133
|
-
}
|
|
134
|
-
.ban-body .form-item .value {
|
|
135
|
-
color: #eeeeee;
|
|
136
|
-
font-size: 14px;
|
|
137
|
-
word-wrap: break-word;
|
|
138
|
-
word-break: break-all;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.position-container {
|
|
142
|
-
margin: 16px 20px;
|
|
143
|
-
}
|
|
144
|
-
.position-container .position-header {
|
|
145
|
-
width: 100%;
|
|
146
|
-
height: 30px;
|
|
147
|
-
box-sizing: border-box;
|
|
148
|
-
padding: 0 12px;
|
|
149
|
-
color: #ffffff;
|
|
150
|
-
font-size: 14px;
|
|
151
|
-
line-height: 30px;
|
|
152
|
-
background-color: rgba(0, 0, 0, 0.4);
|
|
153
|
-
}
|
|
154
|
-
.position-container #map {
|
|
155
|
-
width: 100%;
|
|
156
|
-
height: 150px;
|
|
157
|
-
background-color: rgba(0, 0, 0, 0.25);
|
|
158
|
-
}
|
|
159
|
-
</style>
|
|
160
|
-
</head>
|
|
161
|
-
<body>
|
|
162
|
-
<div id="container">
|
|
163
|
-
<div class="header">
|
|
164
|
-
<img class="avatar" id="tmp-avatar" src="" alt="avatar"/>
|
|
165
|
-
<div class="info">
|
|
166
|
-
<div class="name" id="tmp-name">-</div>
|
|
167
|
-
<div class="tmp-id" id="tmp-id"></div>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
<div class="details-container">
|
|
171
|
-
<div class="form-box">
|
|
172
|
-
<div class="form-item full">
|
|
173
|
-
<div class="label">🎮SteamID</div>
|
|
174
|
-
<div class="value" id="tmp-steam-id"></div>
|
|
175
|
-
</div>
|
|
176
|
-
<div class="form-item full">
|
|
177
|
-
<div class="label">📑注册日期</div>
|
|
178
|
-
<div class="value" id="tmp-register-date"></div>
|
|
179
|
-
</div>
|
|
180
|
-
<div class="form-item full" id="tmp-vtc-box">
|
|
181
|
-
<div class="label">🚚所属车队</div>
|
|
182
|
-
<div class="value" id="tmp-vtc-name"></div>
|
|
183
|
-
</div>
|
|
184
|
-
<div class="form-item full" id="tmp-vtc-role-box">
|
|
185
|
-
<div class="label">🚚车队角色</div>
|
|
186
|
-
<div class="value" id="tmp-vtc-role"></div>
|
|
187
|
-
</div>
|
|
188
|
-
<div class="form-item" id="tmp-sponsor-box">
|
|
189
|
-
<div class="label">🎁赞助用户</div>
|
|
190
|
-
<div class="value" id="tmp-sponsor-amount"></div>
|
|
191
|
-
</div>
|
|
192
|
-
<div class="form-item" id="tmp-sponsor-cumulative-box">
|
|
193
|
-
<div class="label">🎁累计赞助</div>
|
|
194
|
-
<div class="value" id="tmp-sponsor-cumulative"></div>
|
|
195
|
-
</div>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
<div class="position-container" id="position-box">
|
|
199
|
-
<div class="position-header" id="position-title"></div>
|
|
200
|
-
<div id="map"></div>
|
|
201
|
-
</div>
|
|
202
|
-
<div class="ban-container" id="ban-box">
|
|
203
|
-
<div class="ban-header">封禁中</div>
|
|
204
|
-
<div class="ban-body">
|
|
205
|
-
<div class="ban-hidden" id="ban-hidden-box">玩家隐藏信息</div>
|
|
206
|
-
<div class="form-box" id="ban-info-box">
|
|
207
|
-
<div class="form-item">
|
|
208
|
-
<div class="label">截止时间</div>
|
|
209
|
-
<div class="value" id="ban-until"></div>
|
|
210
|
-
</div>
|
|
211
|
-
<div class="form-item">
|
|
212
|
-
<div class="label">封禁次数</div>
|
|
213
|
-
<div class="value" id="ban-count"></div>
|
|
214
|
-
</div>
|
|
215
|
-
<div class="form-item full">
|
|
216
|
-
<div class="label">原因</div>
|
|
217
|
-
<div class="value" id="ban-reason"></div>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
|
-
</div>
|
|
223
|
-
<script>
|
|
224
|
-
let mapConfig = {
|
|
225
|
-
ets: {
|
|
226
|
-
tileUrl: 'https://ets-map.oss-cn-beijing.aliyuncs.com/ets2/05102019/{z}/{x}/{y}.png',
|
|
227
|
-
multipliers: {
|
|
228
|
-
x: 71282,
|
|
229
|
-
y: 56532
|
|
230
|
-
},
|
|
231
|
-
breakpoints: {
|
|
232
|
-
uk: {
|
|
233
|
-
x: -31056.8,
|
|
234
|
-
y: -5832.867
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
bounds: {
|
|
238
|
-
y: 131072,
|
|
239
|
-
x: 131072
|
|
240
|
-
},
|
|
241
|
-
maxZoom: 8,
|
|
242
|
-
minZoom: 2,
|
|
243
|
-
// 游戏地转地图坐标
|
|
244
|
-
calculateMapCoordinate (x, y) {
|
|
245
|
-
return [
|
|
246
|
-
x / 1.325928 + mapConfig.ets.multipliers.x,
|
|
247
|
-
y / 1.325928 + mapConfig.ets.multipliers.y
|
|
248
|
-
];
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
promods: {
|
|
252
|
-
tileUrl: 'https://ets-map.oss-cn-beijing.aliyuncs.com/promods/05102019/{z}/{x}/{y}.png',
|
|
253
|
-
multipliers: {
|
|
254
|
-
x: 51953,
|
|
255
|
-
y: 76024
|
|
256
|
-
},
|
|
257
|
-
breakpoints: {
|
|
258
|
-
uk: {
|
|
259
|
-
x: -31056.8,
|
|
260
|
-
y: -5832.867
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
bounds: {
|
|
264
|
-
y: 131072,
|
|
265
|
-
x: 131072
|
|
266
|
-
},
|
|
267
|
-
maxZoom: 8,
|
|
268
|
-
minZoom: 2,
|
|
269
|
-
// 游戏地转地图坐标
|
|
270
|
-
calculateMapCoordinate (x, y) {
|
|
271
|
-
return [
|
|
272
|
-
x / 2.598541 + mapConfig.promods.multipliers.x,
|
|
273
|
-
y / 2.598541 + mapConfig.promods.multipliers.y
|
|
274
|
-
]
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function init(data) {
|
|
280
|
-
document.getElementById('tmp-name').innerText = data.name
|
|
281
|
-
document.getElementById('tmp-avatar').src = data.avatarUrl
|
|
282
|
-
document.getElementById('tmp-id').innerHTML = `TMP#${data.tmpId} <span class="group" style="background-color: #${data.groupColor}">${data.groupName}</span>`
|
|
283
|
-
document.getElementById('tmp-steam-id').innerText = data.steamId
|
|
284
|
-
document.getElementById('tmp-register-date').innerText = data.registerDate
|
|
285
|
-
if (data.isJoinVtc) {
|
|
286
|
-
document.getElementById('tmp-vtc-name').innerText = data.vtcName
|
|
287
|
-
document.getElementById('tmp-vtc-role').innerText = data.vtcRole
|
|
288
|
-
} else {
|
|
289
|
-
document.getElementById('tmp-vtc-box').remove()
|
|
290
|
-
document.getElementById('tmp-vtc-role-box').remove()
|
|
291
|
-
}
|
|
292
|
-
if (data.isSponsor && !data.sponsorHide) {
|
|
293
|
-
document.getElementById('tmp-sponsor-amount').innerText = '$' + Math.floor(data.sponsorAmount / 100)
|
|
294
|
-
document.getElementById('tmp-sponsor-cumulative').innerText = '$' + Math.floor(data.sponsorCumulativeAmount / 100)
|
|
295
|
-
} else {
|
|
296
|
-
document.getElementById('tmp-sponsor-box').remove()
|
|
297
|
-
document.getElementById('tmp-sponsor-cumulative-box').remove()
|
|
298
|
-
}
|
|
299
|
-
if (data.isOnline) {
|
|
300
|
-
document.getElementById('position-title').innerText = `${data.onlineServerName} · ${data.onlineCountry}-${data.onlineCity}`
|
|
301
|
-
map(data.onlineMapType, data.onlineX, data.onlineY)
|
|
302
|
-
} else {
|
|
303
|
-
document.getElementById('position-box').remove()
|
|
304
|
-
}
|
|
305
|
-
if (data.isBan) {
|
|
306
|
-
if (data.banHide) {
|
|
307
|
-
document.getElementById('ban-info-box').remove()
|
|
308
|
-
} else {
|
|
309
|
-
document.getElementById('ban-hidden-box').remove()
|
|
310
|
-
document.getElementById('ban-until').innerText = (data.banUntil || '永久')
|
|
311
|
-
document.getElementById('ban-count').innerText = (data.banCount || 0) + '次'
|
|
312
|
-
document.getElementById('ban-reason').innerText = data.banReasonZh || data.banReason
|
|
313
|
-
}
|
|
314
|
-
} else {
|
|
315
|
-
document.getElementById('ban-box').remove()
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
function map(mapType, x, y) {
|
|
320
|
-
// 定义地图
|
|
321
|
-
let map = L.map('map', {
|
|
322
|
-
attributionControl: false,
|
|
323
|
-
crs: L.CRS.Simple,
|
|
324
|
-
zoomControl: false
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
// 边界
|
|
328
|
-
let bounds = L.latLngBounds(
|
|
329
|
-
map.unproject([0, mapConfig[mapType].bounds.y], mapConfig[mapType].maxZoom),
|
|
330
|
-
map.unproject([mapConfig[mapType].bounds.x, 0], mapConfig[mapType].maxZoom)
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
// 瓦片地图
|
|
334
|
-
L.tileLayer(mapConfig[mapType].tileUrl, {
|
|
335
|
-
minZoom: 2,
|
|
336
|
-
maxZoom: 10,
|
|
337
|
-
maxNativeZoom: 8,
|
|
338
|
-
tileSize: 512,
|
|
339
|
-
bounds: bounds,
|
|
340
|
-
reuseTiles: true
|
|
341
|
-
}).addTo(map);
|
|
342
|
-
map.setMaxBounds(
|
|
343
|
-
new L.LatLngBounds(
|
|
344
|
-
map.unproject([0, mapConfig[mapType].bounds.y], mapConfig[mapType].maxZoom),
|
|
345
|
-
map.unproject([mapConfig[mapType].bounds.x, 0], mapConfig[mapType].maxZoom)
|
|
346
|
-
)
|
|
347
|
-
);
|
|
348
|
-
|
|
349
|
-
L.circleMarker(map.unproject(mapConfig[mapType].calculateMapCoordinate(x, y), 8), {
|
|
350
|
-
color: '#2f2f2f', // 标记点边框颜色
|
|
351
|
-
weight: 2, // 标记点边框大小
|
|
352
|
-
fillColor: '#1cb715', // 标记点填充颜色
|
|
353
|
-
fillOpacity: 1, // 标记点填充不透明度(0到1之间的值)
|
|
354
|
-
radius: 5, // 标记点半径(以像素为单位)
|
|
355
|
-
zIndex: 1000
|
|
356
|
-
}).addTo(map);
|
|
357
|
-
|
|
358
|
-
// 设置中心点
|
|
359
|
-
map.setView(map.unproject(mapConfig[mapType].calculateMapCoordinate(x, y), 8), 5);
|
|
360
|
-
}
|
|
361
|
-
</script>
|
|
362
|
-
</body>
|
|
363
|
-
</html>
|
|
File without changes
|