koishi-plugin-tmp-bot 1.3.4 → 1.4.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.
|
@@ -39,7 +39,12 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
39
39
|
return '玩家离线'
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// promods服ID集合
|
|
43
|
+
let promodsServerIdList = [50, 51]
|
|
44
|
+
|
|
45
|
+
// 构建地图数据
|
|
42
46
|
let data = {
|
|
47
|
+
mapType: promodsServerIdList.indexOf(playerMapInfo.data.server) !== -1 ? 'promods' : 'ets',
|
|
43
48
|
avatar: playerInfo.data.smallAvatar,
|
|
44
49
|
username: playerInfo.data.name,
|
|
45
50
|
serverName: playerMapInfo.data.serverDetails.name,
|
package/lib/command/tmpQuery.js
CHANGED
|
@@ -113,25 +113,61 @@
|
|
|
113
113
|
</div>
|
|
114
114
|
</div>
|
|
115
115
|
<script>
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
let mapConfig = {
|
|
117
|
+
ets: {
|
|
118
|
+
tileUrl: 'https://ets-map.oss-cn-beijing.aliyuncs.com/ets2/05102019/{z}/{x}/{y}.png',
|
|
119
|
+
multipliers: {
|
|
120
|
+
x: 71292,
|
|
121
|
+
y: 60412
|
|
122
|
+
},
|
|
123
|
+
breakpoints: {
|
|
124
|
+
uk: {
|
|
125
|
+
x: -31056.8,
|
|
126
|
+
y: -5832.867
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
bounds: {
|
|
130
|
+
y: 131072,
|
|
131
|
+
x: 131072
|
|
132
|
+
},
|
|
133
|
+
maxZoom: 8,
|
|
134
|
+
minZoom: 2,
|
|
135
|
+
// 游戏地转地图坐标
|
|
136
|
+
calculateMapCoordinate (x, y) {
|
|
137
|
+
return [
|
|
138
|
+
x / 1.325928 + mapConfig.ets.multipliers.x,
|
|
139
|
+
y / 1.325928 + mapConfig.ets.multipliers.y
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
promods: {
|
|
144
|
+
tileUrl: 'https://tiles.truckyapp.com/promods/05102019/{z}/{x}/{y}.png',
|
|
145
|
+
multipliers: {
|
|
146
|
+
x: 41828,
|
|
147
|
+
y: 77369
|
|
148
|
+
},
|
|
149
|
+
breakpoints: {
|
|
150
|
+
uk: {
|
|
151
|
+
x: -31056.8,
|
|
152
|
+
y: -5832.867
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
bounds: {
|
|
156
|
+
y: 131072,
|
|
157
|
+
x: 131072
|
|
158
|
+
},
|
|
159
|
+
maxZoom: 8,
|
|
160
|
+
minZoom: 2,
|
|
161
|
+
// 游戏地转地图坐标
|
|
162
|
+
calculateMapCoordinate (x, y) {
|
|
163
|
+
return [
|
|
164
|
+
x / 2.303589 + mapConfig.promods.multipliers.x,
|
|
165
|
+
y / 2.303589 + mapConfig.promods.multipliers.y
|
|
166
|
+
]
|
|
167
|
+
}
|
|
124
168
|
}
|
|
125
169
|
}
|
|
126
170
|
|
|
127
|
-
// 游戏地转地图坐标
|
|
128
|
-
function calculateMapCoordinate(x, y) {
|
|
129
|
-
return [
|
|
130
|
-
x / 1.325928 + multipliers.x,
|
|
131
|
-
y / 1.325928 + multipliers.y
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
|
|
135
171
|
// 定义地图
|
|
136
172
|
let map = L.map('map', {
|
|
137
173
|
attributionControl: false,
|
|
@@ -139,36 +175,36 @@
|
|
|
139
175
|
zoomControl: false
|
|
140
176
|
});
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
178
|
+
function setData(data) {
|
|
179
|
+
// 边界
|
|
180
|
+
let bounds = L.latLngBounds(
|
|
181
|
+
map.unproject([0, mapConfig[data.mapType].bounds.y], mapConfig[data.mapType].maxZoom),
|
|
182
|
+
map.unproject([mapConfig[data.mapType].bounds.x, 0], mapConfig[data.mapType].maxZoom)
|
|
183
|
+
);
|
|
147
184
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
185
|
+
// 瓦片地图
|
|
186
|
+
L.tileLayer(mapConfig[data.mapType].tileUrl, {
|
|
187
|
+
minZoom: 2,
|
|
188
|
+
maxZoom: 10,
|
|
189
|
+
maxNativeZoom: 8,
|
|
190
|
+
tileSize: 512,
|
|
191
|
+
bounds: bounds,
|
|
192
|
+
reuseTiles: true
|
|
193
|
+
}).addTo(map);
|
|
194
|
+
map.setMaxBounds(
|
|
195
|
+
new L.LatLngBounds(
|
|
196
|
+
map.unproject([0, mapConfig[data.mapType].bounds.y], mapConfig[data.mapType].maxZoom),
|
|
197
|
+
map.unproject([mapConfig[data.mapType].bounds.x, 0], mapConfig[data.mapType].maxZoom)
|
|
198
|
+
)
|
|
199
|
+
);
|
|
163
200
|
|
|
164
|
-
function setData(data) {
|
|
165
201
|
document.getElementsByClassName('avatar')[0].src = data.avatar
|
|
166
202
|
document.getElementsByClassName('username')[0].innerText = data.username
|
|
167
203
|
document.getElementsByClassName('server-name')[0].innerText = data.serverName
|
|
168
204
|
document.getElementsByClassName('country')[0].innerText = data.country
|
|
169
205
|
document.getElementsByClassName('real-name')[0].innerText = data.realName
|
|
170
206
|
|
|
171
|
-
L.circleMarker(map.unproject(calculateMapCoordinate(data.x, data.y), 8), {
|
|
207
|
+
L.circleMarker(map.unproject(mapConfig[data.mapType].calculateMapCoordinate(data.x, data.y), 8), {
|
|
172
208
|
color: '#2f2f2f', // 标记点边框颜色
|
|
173
209
|
weight: 2, // 标记点边框大小
|
|
174
210
|
fillColor: '#158cfb', // 标记点填充颜色
|
|
@@ -177,7 +213,7 @@
|
|
|
177
213
|
}).addTo(map);
|
|
178
214
|
|
|
179
215
|
// 移动地图到坐标,视角稍微向上移动
|
|
180
|
-
map.setView(map.unproject(calculateMapCoordinate(data.x, data.y + 80), 8), 7);
|
|
216
|
+
map.setView(map.unproject(mapConfig[data.mapType].calculateMapCoordinate(data.x, data.y + 80), 8), 7);
|
|
181
217
|
}
|
|
182
218
|
</script>
|
|
183
219
|
</body>
|