Localization fixes

This commit is contained in:
Natsumi
2023-01-03 19:50:55 +13:00
parent b679f40874
commit ff03220772
5 changed files with 118 additions and 24 deletions

View File

@@ -7713,16 +7713,25 @@ speechSynthesis.getVoices();
return worldName;
};
$app.methods.getGroupName = async function (location) {
$app.methods.getGroupName = async function (data) {
if (!data) {
return '';
}
var groupName = '';
try {
var groupId = data;
if (!data.startsWith('grp_')) {
var L = API.parseLocation(location);
if (L.groupId) {
var args = await API.getCachedGroup({
groupId: L.groupId
});
groupName = args.ref.name;
groupId = L.groupId;
} else {
return '';
}
}
try {
var args = await API.getCachedGroup({
groupId
});
groupName = args.ref.name;
} catch (err) {}
return groupName;
};
@@ -9531,6 +9540,7 @@ speechSynthesis.getVoices();
'OnPlayerLeft',
'ChangeAvatar',
'ChangeStatus',
'ChangeGroup',
'PortalSpawn',
'DeletedPortal',
'ChatBoxMessage',
@@ -9743,6 +9753,12 @@ speechSynthesis.getVoices();
user.avatarDict,
gameLogDate
);
this.parsePhotonGroupChange(
id,
user.user,
user.groupOnNameplate,
gameLogDate
);
this.parsePhotonAvatar(user.avatarDict);
this.parsePhotonAvatar(user.favatarDict);
var hasInstantiated = false;
@@ -9773,6 +9789,12 @@ speechSynthesis.getVoices();
user.avatarDict,
gameLogDate
);
this.parsePhotonGroupChange(
id,
user.user,
user.groupOnNameplate,
gameLogDate
);
this.parsePhotonAvatar(user.avatarDict);
this.parsePhotonAvatar(user.favatarDict);
var hasInstantiated = false;
@@ -9805,6 +9827,12 @@ speechSynthesis.getVoices();
user.avatarDict,
gameLogDate
);
this.parsePhotonGroupChange(
id,
user.user,
user.groupOnNameplate,
gameLogDate
);
this.parsePhotonAvatar(user.avatarDict);
this.parsePhotonAvatar(user.favatarDict);
var lobbyJointime = this.photonLobbyJointime.get(id);
@@ -9833,6 +9861,12 @@ speechSynthesis.getVoices();
data.Parameters[249].avatarDict,
gameLogDate
);
this.parsePhotonGroupChange(
data.Parameters[254],
data.Parameters[249].user,
data.Parameters[249].groupOnNameplate,
gameLogDate
);
this.parsePhotonAvatar(data.Parameters[249].avatarDict);
this.parsePhotonAvatar(data.Parameters[249].favatarDict);
}
@@ -10564,6 +10598,40 @@ speechSynthesis.getVoices();
this.photonLobbyAvatars.set(user.id, avatar.id);
};
$app.methods.parsePhotonGroupChange = async function (
photonId,
user,
groupId,
gameLogDate
) {
if (
typeof user === 'undefined' ||
!this.photonLobbyJointime.has(photonId)
) {
return;
}
var {groupOnNameplate} = this.photonLobbyJointime.get(photonId);
if (
groupOnNameplate !== groupId &&
photonId !== this.photonLobbyCurrentUser
) {
var groupName = await this.getGroupName(groupId);
var previousGroupName = await this.getGroupName(groupOnNameplate);
this.addEntryPhotonEvent({
photonId,
displayName: user.displayName,
userId: user.id,
text: `ChangeGroup ${groupName}`,
type: 'ChangeGroup',
created_at: gameLogDate,
groupId,
groupName,
previousGroupId: groupOnNameplate,
previousGroupName
});
}
};
$app.methods.parsePhotonAvatar = function (avatar) {
if (typeof avatar === 'undefined' || typeof avatar.id === 'undefined') {
console.error('PhotonAvatar: avatar is undefined');
@@ -21129,6 +21197,12 @@ speechSynthesis.getVoices();
user.avatarDict,
dateTime
);
this.parsePhotonGroupChange(
id,
user.user,
user.groupOnNameplate,
dateTime
);
this.parsePhotonAvatar(user.avatarDict);
this.parsePhotonAvatar(user.favatarDict);
var hasInstantiated = false;