koishi-plugin-tmp-bot 1.5.0 → 1.6.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.
- package/lib/command/tmpPosition.js +17 -3
- package/lib/index.js +0 -1
- package/lib/resource/position.html +4 -3
- package/package.json +1 -1
|
@@ -11,7 +11,6 @@ const common = require('../util/common')
|
|
|
11
11
|
* 定位
|
|
12
12
|
*/
|
|
13
13
|
module.exports = async (ctx, cfg, session, tmpId) => {
|
|
14
|
-
// 5265655
|
|
15
14
|
if (ctx.puppeteer) {
|
|
16
15
|
if (tmpId && isNaN(tmpId)) {
|
|
17
16
|
return `请输入正确的玩家编号`
|
|
@@ -41,12 +40,27 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
41
40
|
return '玩家离线'
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
//
|
|
43
|
+
// 查询周边玩家,并处理数据
|
|
45
44
|
let areaPlayersData = await truckersMpMapApi.area(ctx.http, playerMapInfo.data.server,
|
|
46
45
|
playerMapInfo.data.x - 4000,
|
|
47
46
|
playerMapInfo.data.y + 2500,
|
|
48
47
|
playerMapInfo.data.x + 4000,
|
|
49
48
|
playerMapInfo.data.y - 2500)
|
|
49
|
+
let areaPlayerList = []
|
|
50
|
+
if (!areaPlayersData.error) {
|
|
51
|
+
areaPlayerList = areaPlayersData.data
|
|
52
|
+
let index = areaPlayerList.findIndex((player) => {
|
|
53
|
+
return player.MpId.toString() === tmpId
|
|
54
|
+
})
|
|
55
|
+
if (index !== -1) {
|
|
56
|
+
areaPlayerList.splice(index, 1)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
areaPlayerList.push({
|
|
60
|
+
X: playerMapInfo.data.x,
|
|
61
|
+
Y: playerMapInfo.data.y,
|
|
62
|
+
MpId: tmpId
|
|
63
|
+
})
|
|
50
64
|
|
|
51
65
|
// promods服ID集合
|
|
52
66
|
let promodsServerIdList = [50, 51]
|
|
@@ -62,7 +76,7 @@ module.exports = async (ctx, cfg, session, tmpId) => {
|
|
|
62
76
|
currentPlayerId: tmpId,
|
|
63
77
|
centerX: playerMapInfo.data.x,
|
|
64
78
|
centerY: playerMapInfo.data.y,
|
|
65
|
-
playerList:
|
|
79
|
+
playerList: areaPlayerList
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
let page
|
package/lib/index.js
CHANGED
|
@@ -8,7 +8,6 @@ const tmpServer = require('./command/tmpServer');
|
|
|
8
8
|
const tmpBind = require('./command/tmpBind');
|
|
9
9
|
const tmpTraffic = require('./command/tmpTraffic');
|
|
10
10
|
const tmpPosition = require('./command/tmpPosition');
|
|
11
|
-
const api = require('./api/truckersMpMapApi');
|
|
12
11
|
exports.name = 'tmp-bot';
|
|
13
12
|
exports.inject = {
|
|
14
13
|
required: ['database'],
|
|
@@ -208,9 +208,10 @@
|
|
|
208
208
|
L.circleMarker(map.unproject(mapConfig[data.mapType].calculateMapCoordinate(player.X, player.Y), 8), {
|
|
209
209
|
color: '#2f2f2f', // 标记点边框颜色
|
|
210
210
|
weight: 2, // 标记点边框大小
|
|
211
|
-
fillColor: '#158cfb', // 标记点填充颜色
|
|
212
|
-
fillOpacity:
|
|
213
|
-
radius:
|
|
211
|
+
fillColor: data.currentPlayerId === player.MpId.toString() ? '#1cb715' : '#158cfb', // 标记点填充颜色
|
|
212
|
+
fillOpacity: 1, // 标记点填充不透明度(0到1之间的值)
|
|
213
|
+
radius: 5, // 标记点半径(以像素为单位)
|
|
214
|
+
zIndex: data.currentPlayerId === player.MpId.toString() ? 1000 : undefined
|
|
214
215
|
}).addTo(map);
|
|
215
216
|
}
|
|
216
217
|
|