mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +02:00
Photon master check + platform
This commit is contained in:
+83
-54
@@ -7545,6 +7545,8 @@ speechSynthesis.getVoices();
|
|||||||
$app.methods.lastLocationReset = function () {
|
$app.methods.lastLocationReset = function () {
|
||||||
this.photonLobby = new Map();
|
this.photonLobby = new Map();
|
||||||
this.photonLobbyCurrent = new Map();
|
this.photonLobbyCurrent = new Map();
|
||||||
|
this.photonLobbyMaster = 0;
|
||||||
|
this.photonLobbyInVrMode = new Map();
|
||||||
this.photonLobbyWatcherLoopStop();
|
this.photonLobbyWatcherLoopStop();
|
||||||
this.photonLobbyAvatars = new Map();
|
this.photonLobbyAvatars = new Map();
|
||||||
this.photonLobbyJointime = new Map();
|
this.photonLobbyJointime = new Map();
|
||||||
@@ -8045,6 +8047,8 @@ speechSynthesis.getVoices();
|
|||||||
$app.data.moderationEventQueue = new Map();
|
$app.data.moderationEventQueue = new Map();
|
||||||
$app.data.moderationAgainstTable = [];
|
$app.data.moderationAgainstTable = [];
|
||||||
$app.data.photonLobby = new Map();
|
$app.data.photonLobby = new Map();
|
||||||
|
$app.data.photonLobbyMaster = 0;
|
||||||
|
$app.data.photonLobbyInVrMode = new Map();
|
||||||
$app.data.photonLobbyCurrent = new Map();
|
$app.data.photonLobbyCurrent = new Map();
|
||||||
$app.data.photonLobbyAvatars = new Map();
|
$app.data.photonLobbyAvatars = new Map();
|
||||||
$app.data.photonLobbyWatcherLoop = false;
|
$app.data.photonLobbyWatcherLoop = false;
|
||||||
@@ -8265,55 +8269,46 @@ speechSynthesis.getVoices();
|
|||||||
$app.methods.photonBotCheck = function (event7List, dtNow) {
|
$app.methods.photonBotCheck = function (event7List, dtNow) {
|
||||||
var event7PhotonIds = Object.keys(event7List);
|
var event7PhotonIds = Object.keys(event7List);
|
||||||
var photonBots = [];
|
var photonBots = [];
|
||||||
var currentUserPresent = false;
|
|
||||||
this.photonLobbyCurrent.forEach((ref, id) => {
|
this.photonLobbyCurrent.forEach((ref, id) => {
|
||||||
if (typeof ref !== 'undefined' && ref.id === API.currentUser.id) {
|
|
||||||
currentUserPresent = true;
|
|
||||||
}
|
|
||||||
if (this.photonLobbyJointime.has(id)) {
|
if (this.photonLobbyJointime.has(id)) {
|
||||||
var {joinTime, hasInstantiated, isInvisible, avatarEyeHeight} =
|
var {joinTime, hasInstantiated, isInvisible, avatarEyeHeight} =
|
||||||
this.photonLobbyJointime.get(id);
|
this.photonLobbyJointime.get(id);
|
||||||
}
|
}
|
||||||
if (
|
var text = '';
|
||||||
(!joinTime || joinTime + 3000 < dtNow) &&
|
|
||||||
typeof ref === 'undefined' &&
|
|
||||||
!event7PhotonIds.includes(id.toString())
|
|
||||||
) {
|
|
||||||
photonBots.unshift(id);
|
|
||||||
}
|
|
||||||
if (isInvisible) {
|
if (isInvisible) {
|
||||||
if (!this.photonLobbyBots.includes(id)) {
|
text = 'User has joined invisible';
|
||||||
this.addEntryPhotonEvent({
|
|
||||||
photonId: id,
|
|
||||||
displayName: ref.displayName,
|
|
||||||
userId: ref.id,
|
|
||||||
text: 'has joined invisible',
|
|
||||||
created_at: new Date().toJSON()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
photonBots.unshift(id);
|
|
||||||
} else if (avatarEyeHeight < 0) {
|
} else if (avatarEyeHeight < 0) {
|
||||||
if (!this.photonLobbyBots.includes(id)) {
|
text = 'Photon bot has joined';
|
||||||
this.addEntryPhotonEvent({
|
|
||||||
photonId: id,
|
|
||||||
displayName: ref.displayName,
|
|
||||||
userId: ref.id,
|
|
||||||
text: 'photon bot has joined',
|
|
||||||
created_at: new Date().toJSON()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
photonBots.unshift(id);
|
|
||||||
} else if (
|
} else if (
|
||||||
joinTime &&
|
joinTime &&
|
||||||
joinTime + 10000 < dtNow &&
|
joinTime + 10000 < dtNow &&
|
||||||
!hasInstantiated
|
!hasInstantiated
|
||||||
) {
|
) {
|
||||||
|
text = 'Photon bot has joined';
|
||||||
|
} else if (
|
||||||
|
(!joinTime || joinTime + 3000 < dtNow) &&
|
||||||
|
typeof ref === 'undefined' &&
|
||||||
|
!event7PhotonIds.includes(id.toString())
|
||||||
|
) {
|
||||||
|
text = 'Photon bot has joined';
|
||||||
|
}
|
||||||
|
if (text) {
|
||||||
if (!this.photonLobbyBots.includes(id)) {
|
if (!this.photonLobbyBots.includes(id)) {
|
||||||
|
var displayName = `ID:${id}`;
|
||||||
|
var userId = '';
|
||||||
|
if (typeof ref !== 'undefined') {
|
||||||
|
if (typeof ref.displayName !== 'undefined') {
|
||||||
|
displayName = ref.displayName;
|
||||||
|
}
|
||||||
|
if (typeof ref.id !== 'undefined') {
|
||||||
|
userId = ref.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.addEntryPhotonEvent({
|
this.addEntryPhotonEvent({
|
||||||
photonId: id,
|
photonId: id,
|
||||||
displayName: ref.displayName,
|
displayName,
|
||||||
userId: ref.id,
|
userId,
|
||||||
text: 'photon bot has joined',
|
text,
|
||||||
created_at: new Date().toJSON()
|
created_at: new Date().toJSON()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -8327,7 +8322,7 @@ speechSynthesis.getVoices();
|
|||||||
if (typeof ref.id !== 'undefined') {
|
if (typeof ref.id !== 'undefined') {
|
||||||
userId = ref.id;
|
userId = ref.id;
|
||||||
}
|
}
|
||||||
var displayName = `ID: ${id}`;
|
var displayName = `ID:${id}`;
|
||||||
if (typeof ref.displayName !== 'undefined') {
|
if (typeof ref.displayName !== 'undefined') {
|
||||||
displayName = ref.displayName;
|
displayName = ref.displayName;
|
||||||
}
|
}
|
||||||
@@ -8342,29 +8337,12 @@ speechSynthesis.getVoices();
|
|||||||
photonId: id,
|
photonId: id,
|
||||||
displayName,
|
displayName,
|
||||||
userId,
|
userId,
|
||||||
text: `photon bot has left${time}`,
|
text: `Photon bot has left${time}`,
|
||||||
created_at: new Date().toJSON()
|
created_at: new Date().toJSON()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.photonLobbyBots.length !== photonBots.length) {
|
if (this.photonLobbyBots.length !== photonBots.length) {
|
||||||
// bad bug fix is bad
|
|
||||||
if (!currentUserPresent) {
|
|
||||||
console.log('current user missing from photon lobby');
|
|
||||||
if (
|
|
||||||
this.lastLocation.playerList.has(
|
|
||||||
API.currentUser.displayName
|
|
||||||
) &&
|
|
||||||
photonBots.length === 1
|
|
||||||
) {
|
|
||||||
var ref = API.cachedUsers.get(API.currentUser.id);
|
|
||||||
if (typeof ref !== 'undefined') {
|
|
||||||
this.photonLobby.set(photonBots[0], ref);
|
|
||||||
this.photonLobbyCurrent.set(photonBots[0], ref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.updatePhotonLobbyBotSize(photonBots.length);
|
this.updatePhotonLobbyBotSize(photonBots.length);
|
||||||
}
|
}
|
||||||
this.photonLobbyBots = photonBots;
|
this.photonLobbyBots = photonBots;
|
||||||
@@ -8503,6 +8481,12 @@ speechSynthesis.getVoices();
|
|||||||
hasInstantiated: true
|
hasInstantiated: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (typeof data.Parameters[251].inVRMode !== 'undefined') {
|
||||||
|
this.photonLobbyInVrMode.set(
|
||||||
|
data.Parameters[253],
|
||||||
|
data.Parameters[251].inVRMode
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if (data.Code === 255) {
|
} else if (data.Code === 255) {
|
||||||
// Join
|
// Join
|
||||||
if (typeof data.Parameters[249] !== 'undefined') {
|
if (typeof data.Parameters[249] !== 'undefined') {
|
||||||
@@ -8520,6 +8504,12 @@ speechSynthesis.getVoices();
|
|||||||
this.parsePhotonAvatar(data.Parameters[249].avatarDict);
|
this.parsePhotonAvatar(data.Parameters[249].avatarDict);
|
||||||
this.parsePhotonAvatar(data.Parameters[249].favatarDict);
|
this.parsePhotonAvatar(data.Parameters[249].favatarDict);
|
||||||
}
|
}
|
||||||
|
if (typeof data.Parameters[249].inVRMode !== 'undefined') {
|
||||||
|
this.photonLobbyInVrMode.set(
|
||||||
|
data.Parameters[254],
|
||||||
|
data.Parameters[249].inVRMode
|
||||||
|
);
|
||||||
|
}
|
||||||
this.parsePhotonLobbyIds(data.Parameters[252].$values);
|
this.parsePhotonLobbyIds(data.Parameters[252].$values);
|
||||||
this.photonLobbyJointime.set(data.Parameters[254], {
|
this.photonLobbyJointime.set(data.Parameters[254], {
|
||||||
joinTime: Date.parse(gameLogDate),
|
joinTime: Date.parse(gameLogDate),
|
||||||
@@ -8533,7 +8523,14 @@ speechSynthesis.getVoices();
|
|||||||
// Leave
|
// Leave
|
||||||
this.photonLobbyCurrent.delete(data.Parameters[254]);
|
this.photonLobbyCurrent.delete(data.Parameters[254]);
|
||||||
this.photonLobbyJointime.delete(data.Parameters[254]);
|
this.photonLobbyJointime.delete(data.Parameters[254]);
|
||||||
|
this.photonLobbyInVrMode.delete(data.Parameters[254]);
|
||||||
this.parsePhotonLobbyIds(data.Parameters[252].$values);
|
this.parsePhotonLobbyIds(data.Parameters[252].$values);
|
||||||
|
if (typeof data.Parameters[203] !== 'undefined') {
|
||||||
|
this.setPhotonLobbyMaster(data.Parameters[203]);
|
||||||
|
}
|
||||||
|
} else if (data.Code === 4) {
|
||||||
|
// Sync
|
||||||
|
this.setPhotonLobbyMaster(data.Parameters[254]);
|
||||||
} else if (data.Code === 33) {
|
} else if (data.Code === 33) {
|
||||||
// Moderation
|
// Moderation
|
||||||
if (data.Parameters[245]['0'] === 21) {
|
if (data.Parameters[245]['0'] === 21) {
|
||||||
@@ -8816,6 +8813,32 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$app.methods.setPhotonLobbyMaster = function (photonId) {
|
||||||
|
if (this.photonLobbyMaster !== photonId) {
|
||||||
|
if (this.photonLobbyMaster !== 0) {
|
||||||
|
var ref = this.photonLobby.get(photonId);
|
||||||
|
var displayName = `ID:${photonId}`;
|
||||||
|
var userId = '';
|
||||||
|
if (typeof ref !== 'undefined') {
|
||||||
|
if (typeof ref.displayName !== 'undefined') {
|
||||||
|
displayName = ref.displayName;
|
||||||
|
}
|
||||||
|
if (typeof ref.id !== 'undefined') {
|
||||||
|
userId = ref.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.addEntryPhotonEvent({
|
||||||
|
photonId,
|
||||||
|
displayName,
|
||||||
|
userId,
|
||||||
|
text: `Photon Migrate Master`,
|
||||||
|
created_at: new Date().toJSON()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.photonLobbyMaster = photonId;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$app.methods.parsePhotonUser = async function (
|
$app.methods.parsePhotonUser = async function (
|
||||||
photonId,
|
photonId,
|
||||||
user,
|
user,
|
||||||
@@ -12458,9 +12481,14 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
var isMaster = false;
|
var isMaster = false;
|
||||||
if (photonId === masterId) {
|
if ($app.photonLobbyMaster !== 0) {
|
||||||
|
if (photonId === $app.photonLobbyMaster) {
|
||||||
isMaster = true;
|
isMaster = true;
|
||||||
}
|
}
|
||||||
|
} else if (photonId === masterId) {
|
||||||
|
isMaster = true;
|
||||||
|
}
|
||||||
|
var inVrMode = $app.photonLobbyInVrMode.get(photonId);
|
||||||
var timeoutTime = 0;
|
var timeoutTime = 0;
|
||||||
if (typeof ref.id !== 'undefined') {
|
if (typeof ref.id !== 'undefined') {
|
||||||
isFriend = $app.friends.has(ref.id);
|
isFriend = $app.friends.has(ref.id);
|
||||||
@@ -12486,6 +12514,7 @@ speechSynthesis.getVoices();
|
|||||||
timer: ref.$location_at,
|
timer: ref.$location_at,
|
||||||
photonId,
|
photonId,
|
||||||
isMaster,
|
isMaster,
|
||||||
|
inVrMode,
|
||||||
isFriend,
|
isFriend,
|
||||||
timeoutTime
|
timeoutTime
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -128,6 +128,15 @@ html
|
|||||||
span 💚
|
span 💚
|
||||||
el-tooltip(v-if="scope.row.timeoutTime" placement="left" content="Timeout")
|
el-tooltip(v-if="scope.row.timeoutTime" placement="left" content="Timeout")
|
||||||
span(style="color:red") 🔴{{ scope.row.timeoutTime }}s
|
span(style="color:red") 🔴{{ scope.row.timeoutTime }}s
|
||||||
|
el-table-column(label="Platform" prop="inVrMode" width="70")
|
||||||
|
template(v-once #default="scope")
|
||||||
|
template(v-if="scope.row.ref.last_platform")
|
||||||
|
span(v-if="scope.row.ref.last_platform === 'standalonewindows'" style="color:#409eff") PC
|
||||||
|
span(v-else-if="scope.row.ref.last_platform === 'android'" style="color:#67c23a") Q
|
||||||
|
span(v-else) {{ scope.row.ref.last_platform }}
|
||||||
|
template(v-if="scope.row.inVrMode !== undefined")
|
||||||
|
span(v-if="scope.row.inVrMode") VR
|
||||||
|
span(v-else) D
|
||||||
el-table-column(label="Display Name" min-width="140" prop="ref.displayName")
|
el-table-column(label="Display Name" min-width="140" prop="ref.displayName")
|
||||||
template(v-once #default="scope")
|
template(v-once #default="scope")
|
||||||
span(v-text="scope.row.ref.displayName" :class="scope.row.ref.$trustColor")
|
span(v-text="scope.row.ref.displayName" :class="scope.row.ref.$trustColor")
|
||||||
|
|||||||
Reference in New Issue
Block a user