@@ -88,7 +88,8 @@ export default {
8888 isPaused: false ,
8989 trackedPlayer: window .location .hash .substr (1 ),
9090 firstRefresh: true ,
91- clickedCoords: ' '
91+ clickedCoords: ' ' ,
92+ afkMap: {}
9293 };
9394 },
9495 methods: {
@@ -231,6 +232,9 @@ export default {
231232
232233 return icon;
233234 },
235+ formatSeconds (seconds ) {
236+ return this .$moment .utc (seconds * 1000 ).format (' HH:mm:ss' );
237+ },
234238 renderMapData (data ) {
235239 if (this .isPaused ) {
236240 return ;
@@ -281,9 +285,30 @@ export default {
281285 icon = _this .getIcon (player, isDriving, isPassenger, isInvisible),
282286 vehicle = _this .getVehicleType (player .vehicle );
283287
288+ const roundedCoords = {
289+ x: player .coords .x .toFixed (1 ),
290+ y: player .coords .y .toFixed (1 ),
291+ },
292+ now = Math .round ((new Date ()).getTime () / 1000 );
293+
294+ if (! (id in _this .afkMap )) {
295+ _this .afkMap [id] = {
296+ coords: roundedCoords,
297+ lastChange: now,
298+ };
299+ } else if (_this .afkMap [id].coords .x !== roundedCoords .x || _this .afkMap [id].coords .y !== roundedCoords .y ) {
300+ _this .afkMap [id].coords = roundedCoords;
301+ _this .afkMap [id].lastChange = now;
302+ }
303+
304+ const afkTime = now - _this .afkMap [id].lastChange ;
305+
284306 if (printPlayerInfo && printPlayerInfo === player .character .id ) {
285307 printPlayerInfo = null ;
286- console .info (' Player debug' , player);
308+ console .info (' Player debug' , {
309+ afkTime: afkTime,
310+ player: player
311+ });
287312 }
288313
289314 validIds .push (id);
@@ -330,6 +355,11 @@ export default {
330355 markers[id].options .forceZIndex = 101 ;
331356 }
332357 extra += ' <br><i>Is ' + attributes .shift () + (attributes .length > 0 ? ' and ' + attributes .join (' , ' ) : ' ' ) + ' </i>' ;
358+
359+ if (afkTime > 300 ) {
360+ extra += ' <br><i>Hasn\' t moved in ' + _this .formatSeconds (afkTime) + ' </i>' ;
361+ }
362+
333363 if (_this .trackedPlayer === id) {
334364 extra += ' <br><br><a href="#" class="track-cid" data-trackid="stop"">' + _this .t (' map.stop_track' ) + ' </a>' ;
335365
0 commit comments