Photon logging fixes

This commit is contained in:
Natsumi
2021-12-10 02:02:16 +13:00
parent 1bf5bcf1f3
commit 85a6304053
4 changed files with 114 additions and 135 deletions

View File

@@ -8199,25 +8199,11 @@ speechSynthesis.getVoices();
}
if (!joinTime || joinTime + 120000 < dtNow) {
// wait 2mins for user to load in
var displayName = '';
var userId = '';
var ref = this.photonLobby.get(id);
displayName = `ID:${id}`;
if (typeof ref !== 'undefined') {
if (typeof ref.displayName !== 'undefined') {
displayName = ref.displayName;
}
if (typeof ref.id !== 'undefined') {
userId = ref.id;
}
}
var time = Math.round(timeSinceLastEvent / 1000);
var feed = {
userId,
displayName,
time
};
hudTimeout.unshift(feed);
hudTimeout.unshift({
userId: this.getUserIdFromPhotonId(id),
displayName: this.getDisplayNameFromPhotonId(id),
time: Math.round(timeSinceLastEvent / 1000)
});
}
}
});
@@ -8278,70 +8264,32 @@ speechSynthesis.getVoices();
if (isInvisible) {
text = 'User has joined invisible';
} else if (avatarEyeHeight < 0) {
text = 'Photon bot has joined';
text = 'Photon bot has joined, a';
} else if (
joinTime &&
joinTime + 10000 < dtNow &&
!hasInstantiated
) {
text = 'Photon bot has joined';
text = 'Photon bot has joined, b';
} else if (
(!joinTime || joinTime + 3000 < dtNow) &&
typeof ref === 'undefined' &&
!event7PhotonIds.includes(id.toString())
) {
text = 'Photon bot has joined';
text = 'Photon bot has joined, c';
}
if (text) {
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({
photonId: id,
displayName,
userId,
text,
color: 'yellow',
created_at: new Date().toJSON()
});
}
photonBots.unshift(id);
}
});
this.photonLobbyBots.forEach((id) => {
if (!photonBots.includes(id)) {
var ref = this.photonLobby.get(id);
var userId = '';
if (typeof ref.id !== 'undefined') {
userId = ref.id;
}
var displayName = `ID:${id}`;
if (typeof ref.displayName !== 'undefined') {
displayName = ref.displayName;
}
var time = '';
if (this.photonLobbyJointime.has(id)) {
var {joinTime} = this.photonLobbyJointime.get(id);
if (typeof joinTime !== 'undefined') {
time = ` ${timeToText(Date.now() - joinTime)}`;
}
}
this.addEntryPhotonEvent({
photonId: id,
displayName,
userId,
text: `Photon bot has left${time}`,
created_at: new Date().toJSON()
});
}
});
if (this.photonLobbyBots.length !== photonBots.length) {
this.updatePhotonLobbyBotSize(photonBots.length);
}
@@ -8366,7 +8314,12 @@ speechSynthesis.getVoices();
}
};
$app.methods.addEntryPhotonEvent = function (feed) {
$app.methods.addEntryPhotonEvent = function (input) {
var feed = {
displayName: this.getDisplayNameFromPhotonId(input.photonId),
userId: this.getUserIdFromPhotonId(input.photonId),
...input
};
this.photonEventTable.data.unshift(feed);
if (this.photonEventOverlay) {
if (
@@ -8409,6 +8362,17 @@ speechSynthesis.getVoices();
return displayName;
};
$app.methods.getUserIdFromPhotonId = function (photonId) {
var userId = '';
if (photonId) {
var ref = this.photonLobby.get(photonId);
if (typeof ref !== 'undefined' && typeof ref.id !== 'undefined') {
userId = ref.id;
}
}
return userId;
};
$app.methods.showUserFromPhotonId = function (photonId) {
if (photonId) {
var ref = this.photonLobby.get(photonId);
@@ -8472,15 +8436,6 @@ speechSynthesis.getVoices();
);
this.parsePhotonAvatar(data.Parameters[251].avatarDict);
this.parsePhotonAvatar(data.Parameters[251].favatarDict);
var lobbyJointime = this.photonLobbyJointime.get(
data.Parameters[253]
);
if (typeof lobbyJointime !== 'undefined') {
this.photonLobbyJointime.set(data.Parameters[253], {
...lobbyJointime,
hasInstantiated: true
});
}
if (typeof data.Parameters[251].inVRMode !== 'undefined') {
this.photonLobbyInVrMode.set(
data.Parameters[253],
@@ -8521,16 +8476,18 @@ speechSynthesis.getVoices();
this.startLobbyWatcherLoop();
} else if (data.Code === 254) {
// Leave
this.checkPhotonBotLeave(data.Parameters[254], gameLogDate);
this.photonUserLeave(data.Parameters[254], gameLogDate);
this.photonLobbyCurrent.delete(data.Parameters[254]);
this.photonLobbyJointime.delete(data.Parameters[254]);
this.photonLobbyInVrMode.delete(data.Parameters[254]);
this.parsePhotonLobbyIds(data.Parameters[252].$values);
if (typeof data.Parameters[203] !== 'undefined') {
this.setPhotonLobbyMaster(data.Parameters[203]);
this.setPhotonLobbyMaster(data.Parameters[203], gameLogDate);
}
} else if (data.Code === 4) {
// Sync
this.setPhotonLobbyMaster(data.Parameters[254]);
this.setPhotonLobbyMaster(data.Parameters[254], gameLogDate);
} else if (data.Code === 33) {
// Moderation
if (data.Parameters[245]['0'] === 21) {
@@ -8556,21 +8513,10 @@ speechSynthesis.getVoices();
gameLogDate
});
if (block || mute) {
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: `mute:${mute} block:${block}`,
color: 'yellow',
created_at: gameLogDate
});
}
@@ -8621,6 +8567,15 @@ speechSynthesis.getVoices();
if (!this.photonLobbyCurrent.has(data.Parameters[254])) {
this.photonLobbyCurrent.set(data.Parameters[254]);
}
var lobbyJointime = this.photonLobbyJointime.get(
data.Parameters[254]
);
if (typeof lobbyJointime !== 'undefined') {
this.photonLobbyJointime.set(data.Parameters[254], {
...lobbyJointime,
hasInstantiated: true
});
}
} else if (data.Code === 6) {
var senderId = data.Parameters[254];
// VRC Event
@@ -8642,20 +8597,6 @@ speechSynthesis.getVoices();
) {
return;
}
var displayName = '';
var userId = '';
if (senderId) {
var ref = this.photonLobby.get(senderId);
displayName = `ID:${senderId}`;
if (typeof ref !== 'undefined') {
if (typeof ref.displayName !== 'undefined') {
displayName = ref.displayName;
}
if (typeof ref.id !== 'undefined') {
userId = ref.id;
}
}
}
if (
data.EventType === '_InstantiateObject' &&
data.Data[0] === 'Portals/PortalInternalDynamic'
@@ -8671,8 +8612,6 @@ speechSynthesis.getVoices();
var time = timeToText(Date.parse(gameLogDate) - date);
this.addEntryPhotonEvent({
photonId: senderId,
displayName,
userId,
text: `DeletedPortal ${time}`,
created_at: gameLogDate
});
@@ -8686,18 +8625,11 @@ speechSynthesis.getVoices();
);
this.lastPortalId = '';
}
var ref = this.photonLobby.get(senderId);
if (
typeof ref !== 'undefined' &&
typeof ref.displayName !== 'undefined'
) {
var userId = '';
if (typeof ref.id !== 'undefined') {
userId = ref.id;
}
var displayName = this.getDisplayNameFromPhotonId(senderId);
if (displayName) {
var ref1 = {
id: userId,
displayName: ref.displayName
id: this.getUserIdFromPhotonId(senderId),
displayName
};
this.portalQueue = 'skip';
this.parsePhotonPortalSpawn(gameLogDate, instanceId, ref1);
@@ -8745,8 +8677,6 @@ speechSynthesis.getVoices();
}
this.addEntryPhotonEvent({
photonId: senderId,
displayName,
userId,
text,
created_at: gameLogDate
});
@@ -8813,37 +8743,61 @@ speechSynthesis.getVoices();
}
};
$app.methods.setPhotonLobbyMaster = function (photonId) {
$app.methods.setPhotonLobbyMaster = function (photonId, gameLogDate) {
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()
created_at: gameLogDate
});
}
this.photonLobbyMaster = photonId;
}
};
$app.methods.checkPhotonBotLeave = function (photonId, gameLogDate) {
var text = '';
var lobbyJointime = this.photonLobbyJointime.get(photonId);
if (
typeof lobbyJointime !== 'undefined' &&
!lobbyJointime.hasInstantiated
) {
var time = timeToText(Date.now() - lobbyJointime.joinTime);
text = `Left without instantiating ${time}`;
} else if (this.photonLobbyBots.includes(photonId)) {
var text = 'Photon bot has left';
if (typeof lobbyJointime !== 'undefined') {
var time = timeToText(Date.now() - lobbyJointime.joinTime);
text = `Photon bot has left ${time}`;
}
}
if (text) {
this.addEntryPhotonEvent({
photonId,
text,
color: 'yellow',
created_at: gameLogDate
});
}
};
$app.methods.parsePhotonUser = async function (
photonId,
user,
gameLogDate
) {
var lobbyJointime = this.photonLobbyJointime.get(photonId);
if (
typeof lobbyJointime !== 'undefined' &&
!lobbyJointime.hasInstantiated
) {
this.photonLobbyJointime.set(photonId, {
...lobbyJointime,
hasInstantiated: true
});
}
var hasJoined = this.photonLobbyCurrent.has(photonId);
var tags = [];
if (
typeof user.tags !== 'undefined' &&
@@ -8914,6 +8868,28 @@ speechSynthesis.getVoices();
this.photonModerationUpdate(ref, block, mute, gameLogDate);
}
}
if (!hasJoined) {
this.photonUserJoin(photonId, ref, gameLogDate);
}
};
$app.methods.photonUserJoin = function (photonId, ref, gameLogDate) {
if (ref.id === API.currentUser.id) {
return;
}
this.addEntryPhotonEvent({
photonId,
text: 'has joined',
created_at: gameLogDate
});
};
$app.methods.photonUserLeave = function (photonId, gameLogDate) {
this.addEntryPhotonEvent({
photonId,
text: 'has left',
created_at: gameLogDate
});
};
$app.methods.photonModerationUpdate = function (

View File

@@ -1279,14 +1279,14 @@ html
span(v-else-if="userDialog.ref.status === 'busy'") Do Not Disturb
span(v-else) Offline
i.x-user-status(:class="userStatusClass(userDialog.ref)")
span(v-text="userDialog.ref.displayName" style="margin-left:5px;font-weight:bold")
span(v-text="userDialog.ref.displayName" style="margin-left:5px;margin-right:5px;font-weight:bold")
el-popover(placement="top" trigger="click")
span(slot="reference" v-text="userDialog.ref.username" style="margin-left:5px;color:#909399;font-family:monospace;font-size:12px;cursor:pointer")
span(slot="reference" v-text="userDialog.ref.username" style="margin-right:5px;color:#909399;font-family:monospace;font-size:12px;cursor:pointer")
span(style="display:block;text-align:center;font-family:monospace") {{ userDialog.ref.username | textToHex }}
el-tooltip(v-for="item in userDialog.ref.$languages" :key="item.key" placement="top")
template(#content)
span {{ item.value }} ({{ item.key }})
span.famfamfam-flags(:class="languageClass(item.key)" style="display:inline-block;margin-left:5px")
span.famfamfam-flags(:class="languageClass(item.key)" style="display:inline-block;margin-right:5px")
div
el-tag.name(type="info" effect="plain" size="mini" :class="userDialog.ref.$trustClass" v-text="userDialog.ref.$trustLevel" style="margin-right:5px;margin-top:5px")
el-tag.x-tag-friend(v-if="userDialog.isFriend && userDialog.friend" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Friend No.{{userDialog.friend.no}}

View File

@@ -567,7 +567,7 @@ Vue.component('marquee-text', MarqueeText);
};
$app.methods.addEntryHudFeed = function (json) {
var {displayName, text} = JSON.parse(json);
var {displayName, text, color} = JSON.parse(json);
var combo = 1;
this.hudFeed.forEach((item) => {
if (item.displayName === displayName && item.text === text) {
@@ -579,7 +579,8 @@ Vue.component('marquee-text', MarqueeText);
time: Date.now(),
displayName,
text,
combo
combo,
color
});
this.cleanHudFeed();
};

View File

@@ -416,7 +416,9 @@ html
circle(class="np-progress-circle-stroke" cx="60" cy="60" stroke="white" r="30" fill="transparent" stroke-width="60")
.hud-feed
div(v-for="feed in hudFeed")
.item <strong>{{ feed.displayName }}</strong> {{ feed.text }}
.item <strong>{{ feed.displayName }}</strong>
span(v-if="feed.color === 'yellow'" style="color: yellow") {{ feed.text }}
span(v-else) {{ feed.text }}
template(v-if="feed.combo > 1")
span.combo x{{ feed.combo }}
.hud-timeout(v-if="hudTimeout.length > 0")