Report user for hacking

This commit is contained in:
Natsumi
2023-03-05 00:49:32 +13:00
parent cd6856e581
commit b085a75cb3
3 changed files with 112 additions and 1 deletions

View File

@@ -9905,7 +9905,7 @@ speechSynthesis.getVoices();
$app.methods.getPhotonIdFromDisplayName = function (displayName) {
var photonId = '';
if (displayName) {
this.photonLobbyCurrent.forEach((ref, id) => {
this.photonLobby.forEach((ref, id) => {
if (
typeof ref !== 'undefined' &&
ref.displayName === displayName
@@ -9917,6 +9917,18 @@ speechSynthesis.getVoices();
return photonId;
};
$app.methods.getPhotonIdFromUserId = function (userId) {
var photonId = '';
if (userId) {
this.photonLobby.forEach((ref, id) => {
if (typeof ref !== 'undefined' && ref.id === userId) {
photonId = id;
}
});
}
return photonId;
};
$app.methods.sortPhotonId = function (a, b, field) {
var id1 = this.getPhotonIdFromDisplayName(a[field]);
var id2 = this.getPhotonIdFromDisplayName(b[field]);
@@ -10248,6 +10260,32 @@ speechSynthesis.getVoices();
this.queueGameLogNoty(entry);
this.addGameLog(entry);
break;
case 70:
// Portal Spawn
if (data.Parameters[245][0] === 20) {
var portalId = data.Parameters[245][1];
var userId = data.Parameters[245][2];
var shortName = data.Parameters[245][5];
var worldName = data.Parameters[245][8].name;
this.lastPortalList.set(portalId, Date.parse(gameLogDate));
this.addPhotonPortalSpawn(
gameLogDate,
userId,
shortName,
worldName
);
} else if (data.Parameters[245][0] === 22) {
var portalId = data.Parameters[245][1];
this.lastPortalList.delete(portalId);
var date = this.lastPortalList.get(portalId);
var time = timeToText(Date.parse(gameLogDate) - date);
this.addEntryPhotonEvent({
text: `DeletedPortal ${time}`,
type: 'DeletedPortal',
created_at: gameLogDate
});
}
break;
}
};
@@ -10421,6 +10459,39 @@ speechSynthesis.getVoices();
});
};
$app.methods.addPhotonPortalSpawn = async function (
gameLogDate,
userId,
shortName,
worldName
) {
var instance = await API.getInstanceFromShortName({shortName});
var location = instance.json.location;
// var newShortName = instance.json.shortName;
// var portalType = 'Secure';
// if (shortName === newShortName) {
// portalType = 'Unlocked';
// }
this.addEntryPhotonEvent({
photonId: this.getPhotonIdFromUserId(userId),
text: `PortalSpawn to ${worldName}`,
type: 'PortalSpawn',
shortName,
location,
worldName,
created_at: gameLogDate
});
this.addPhotonEventToGameLog({
created_at: gameLogDate,
type: 'PortalSpawn',
displayName: this.getDisplayName(userId),
location: this.lastLocation.location,
userId,
instanceId: location,
worldName
});
};
$app.methods.addPhotonEventToGameLog = function (entry) {
this.queueGameLogNoty(entry);
this.addGameLog(entry);
@@ -15733,6 +15804,9 @@ speechSynthesis.getVoices();
type: 'interactOff'
});
break;
case 'Report Hacking':
$app.reportUserForHacking(userId);
break;
case 'Unfriend':
API.deleteFriend({
userId
@@ -25010,6 +25084,41 @@ speechSynthesis.getVoices();
console.log(imageUrl, fileId);
};
$app.methods.reportUserForHacking = function (userId) {
API.reportUser({
userId,
contentType: 'user',
reason: 'behavior-hacking',
type: 'report'
});
};
/*
params: {
userId: string,
contentType: string,
reason: string,
type: string
}
*/
API.reportUser = function (params) {
return this.call(`feedback/${params.userId}/user`, {
method: 'POST',
params: {
contentType: params.contentType,
reason: params.reason,
type: params.type
}
}).then((json) => {
var args = {
json,
params
};
this.$emit('FEEDBACK:REPORT:USER', args);
return args;
});
};
$app = new Vue($app);
window.$app = $app;
})();

View File

@@ -1741,6 +1741,7 @@ html
span {{ $t('dialog.user.actions.moderation_hide_avatar') }}
el-dropdown-item(v-if="userDialog.isInteractOff" icon="el-icon-thumb" command="Enable Avatar Interaction" style="color:#F56C6C") {{ $t('dialog.user.actions.moderation_enable_avatar_interaction') }}
el-dropdown-item(v-else icon="el-icon-circle-close" command="Disable Avatar Interaction") {{ $t('dialog.user.actions.moderation_disable_avatar_interaction') }}
el-dropdown-item(icon="el-icon-s-flag" command="Report Hacking" :disabled="userDialog.ref.$isModerator") {{ $t('dialog.user.actions.report_hacking') }}
template(v-if="userDialog.isFriend")
el-dropdown-item(icon="el-icon-delete" command="Unfriend" divided style="color:#F56C6C") {{ $t('dialog.user.actions.unfriend') }}
el-tabs(ref="userDialogTabs" @tab-click="userDialogTabClick")

View File

@@ -507,6 +507,7 @@
"edit_status": "Social Status",
"edit_language": "Language",
"edit_bio": "Bio",
"report_hacking": "Report For Hacking",
"unfriend": "Unfriend",
"logout": "Logout"
},