mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +02:00
List of players in current instance
This commit is contained in:
+46
-32
@@ -3767,10 +3767,10 @@ speechSynthesis.getVoices();
|
|||||||
var wristFilter = this.sharedFeedFilters.wrist;
|
var wristFilter = this.sharedFeedFilters.wrist;
|
||||||
var notyFilter = this.sharedFeedFilters.noty;
|
var notyFilter = this.sharedFeedFilters.noty;
|
||||||
var locationChange = false;
|
var locationChange = false;
|
||||||
var playerCountDone = false;
|
var playerCountIndex = 0;
|
||||||
var playerCount = 0;
|
var playerList = [];
|
||||||
var friendCount = 0;
|
var friendList = [];
|
||||||
while ((w < 20) || (n < 5) || ((!locationChange) && (this.hideOnPlayerJoined)) || !playerCountDone) {
|
while ((w < 20) || (n < 5) || ((!locationChange) && (this.hideOnPlayerJoined))) {
|
||||||
var ctx = data[--i];
|
var ctx = data[--i];
|
||||||
if ((i <= -1) || (ctx.created_at < bias)) {
|
if ((i <= -1) || (ctx.created_at < bias)) {
|
||||||
break;
|
break;
|
||||||
@@ -3778,6 +3778,13 @@ speechSynthesis.getVoices();
|
|||||||
if (ctx.type === 'Notification') {
|
if (ctx.type === 'Notification') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ((playerCountIndex === 0) && (ctx.type === 'Location')) {
|
||||||
|
playerCountIndex = i;
|
||||||
|
}
|
||||||
|
if (((ctx.type === 'OnPlayerJoined') || (ctx.type === 'OnPlayerLeft')) &&
|
||||||
|
(ctx.data === API.currentUser.displayName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// on Location change remove OnPlayerJoined
|
// on Location change remove OnPlayerJoined
|
||||||
if ((ctx.type === 'Location') && (this.hideOnPlayerJoined)) {
|
if ((ctx.type === 'Location') && (this.hideOnPlayerJoined)) {
|
||||||
var locationBias = new Date(Date.parse(ctx.created_at) + 15000).toJSON(); //15 seconds
|
var locationBias = new Date(Date.parse(ctx.created_at) + 15000).toJSON(); //15 seconds
|
||||||
@@ -3814,26 +3821,6 @@ speechSynthesis.getVoices();
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// instance player count
|
|
||||||
if (ctx.type === 'Location') {
|
|
||||||
playerCountDone = true;
|
|
||||||
}
|
|
||||||
if ((!playerCountDone) && (ctx.type === 'OnPlayerJoined')) {
|
|
||||||
playerCount++;
|
|
||||||
if (isFriend) {
|
|
||||||
friendCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((!playerCountDone) && (ctx.type === 'OnPlayerLeft')) {
|
|
||||||
playerCount--;
|
|
||||||
if (isFriend) {
|
|
||||||
friendCount--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (((ctx.type === 'OnPlayerJoined') || (ctx.type === 'OnPlayerLeft')) &&
|
|
||||||
(ctx.data === API.currentUser.displayName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((w < 20) && (wristFilter[ctx.type]) &&
|
if ((w < 20) && (wristFilter[ctx.type]) &&
|
||||||
((wristFilter[ctx.type] === 'On') ||
|
((wristFilter[ctx.type] === 'On') ||
|
||||||
(wristFilter[ctx.type] === 'Everyone') ||
|
(wristFilter[ctx.type] === 'Everyone') ||
|
||||||
@@ -3859,8 +3846,35 @@ speechSynthesis.getVoices();
|
|||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lastLocation.playerCount = playerCount;
|
// instance player list
|
||||||
this.lastLocation.friendCount = friendCount;
|
for (var i = playerCountIndex + 1; i < data.length; i++) {
|
||||||
|
var ctx = data[i];
|
||||||
|
if (ctx.type === 'OnPlayerJoined') {
|
||||||
|
playerList.push(ctx.data);
|
||||||
|
var isFriend = false;
|
||||||
|
for (var ref of API.cachedUsers.values()) {
|
||||||
|
if (ref.displayName === ctx.data) {
|
||||||
|
isFriend = this.friends.has(ref.id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isFriend) {
|
||||||
|
friendList.push(ctx.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ctx.type === 'OnPlayerLeft') {
|
||||||
|
var index = playerList.indexOf(ctx.data);
|
||||||
|
if (index > -1) {
|
||||||
|
playerList.splice(index, 1);
|
||||||
|
}
|
||||||
|
var index = friendList.indexOf(ctx.data);
|
||||||
|
if (index > -1) {
|
||||||
|
friendList.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.lastLocation.playerList = playerList;
|
||||||
|
this.lastLocation.friendList = friendList;
|
||||||
sharedRepository.setObject('last_location', this.lastLocation);
|
sharedRepository.setObject('last_location', this.lastLocation);
|
||||||
this.sharedFeed.gameLog.wrist = wristArr;
|
this.sharedFeed.gameLog.wrist = wristArr;
|
||||||
this.sharedFeed.gameLog.noty = notyArr;
|
this.sharedFeed.gameLog.noty = notyArr;
|
||||||
@@ -5411,8 +5425,8 @@ speechSynthesis.getVoices();
|
|||||||
date: 0,
|
date: 0,
|
||||||
location: '',
|
location: '',
|
||||||
name: '',
|
name: '',
|
||||||
playerCount: 0,
|
playerList: [],
|
||||||
friendCount: 0
|
friendList: []
|
||||||
};
|
};
|
||||||
$app.data.lastLocation$ = {};
|
$app.data.lastLocation$ = {};
|
||||||
$app.data.discordActive = configRepository.getBool('discordActive');
|
$app.data.discordActive = configRepository.getBool('discordActive');
|
||||||
@@ -5471,8 +5485,8 @@ speechSynthesis.getVoices();
|
|||||||
date: 0,
|
date: 0,
|
||||||
location: '',
|
location: '',
|
||||||
name: '',
|
name: '',
|
||||||
playerCount: 0,
|
playerList: [],
|
||||||
friendCount: 0
|
friendList: []
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -6843,8 +6857,8 @@ speechSynthesis.getVoices();
|
|||||||
date: 0,
|
date: 0,
|
||||||
location: '',
|
location: '',
|
||||||
name: '',
|
name: '',
|
||||||
playerCount: 0,
|
playerList: [],
|
||||||
friendCount: 0
|
friendList: []
|
||||||
};
|
};
|
||||||
if (this.isGameRunning) {
|
if (this.isGameRunning) {
|
||||||
API.currentUser.$online_for = Date.now();
|
API.currentUser.$online_for = Date.now();
|
||||||
|
|||||||
+2
-2
@@ -698,8 +698,8 @@ speechSynthesis.getVoices();
|
|||||||
date: 0,
|
date: 0,
|
||||||
location: '',
|
location: '',
|
||||||
name: '',
|
name: '',
|
||||||
playerCount: 0,
|
playerList: [],
|
||||||
friendCount: 0
|
friendList: []
|
||||||
},
|
},
|
||||||
lastLocationTimer: '',
|
lastLocationTimer: '',
|
||||||
wristFeedLastEntry: '',
|
wristFeedLastEntry: '',
|
||||||
|
|||||||
+2
-2
@@ -283,8 +283,8 @@ html
|
|||||||
.x-containerbottom
|
.x-containerbottom
|
||||||
template(v-if="lastLocation.date != 0")
|
template(v-if="lastLocation.date != 0")
|
||||||
span(style="float:right") Timer: {{ lastLocationTimer }}
|
span(style="float:right") Timer: {{ lastLocationTimer }}
|
||||||
span(style="display:inline-block") Players: {{ lastLocation.playerCount }}
|
span(style="display:inline-block") Players: {{ lastLocation.playerList.length }}
|
||||||
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendCount !== 0 ? ` (${lastLocation.friendCount})` : ''}}
|
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
|
||||||
br
|
br
|
||||||
span(style="float:right") {{ currentTime | formatDate('YYYY-MM-DD HH:MI:SS AMPM') }}
|
span(style="float:right") {{ currentTime | formatDate('YYYY-MM-DD HH:MI:SS AMPM') }}
|
||||||
span CPU {{ cpuUsage }}%
|
span CPU {{ cpuUsage }}%
|
||||||
|
|||||||
Reference in New Issue
Block a user