diff --git a/html/src/app.js b/html/src/app.js index fd0e2342..a1564b7f 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -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; })(); diff --git a/html/src/index.pug b/html/src/index.pug index 7bb982e0..c7006223 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -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") diff --git a/html/src/localization/strings/en.json b/html/src/localization/strings/en.json index e9134951..6cf7871f 100644 --- a/html/src/localization/strings/en.json +++ b/html/src/localization/strings/en.json @@ -507,6 +507,7 @@ "edit_status": "Social Status", "edit_language": "Language", "edit_bio": "Bio", + "report_hacking": "Report For Hacking", "unfriend": "Unfriend", "logout": "Logout" },