Time spent in world, world PC/Quest badge, fix Nuisance badge

This commit is contained in:
Natsumi
2022-01-01 00:10:08 +13:00
parent b8b996997a
commit b76858a960
3 changed files with 45 additions and 5 deletions

View File

@@ -12033,9 +12033,9 @@ speechSynthesis.getVoices();
avatarName: '',
fileCreatedAt: ''
},
lastSeen: '',
joinCount: 0,
timeSpent: ''
timeSpent: 0,
lastSeen: ''
};
$app.watch['userDialog.memo'] = function () {
@@ -12248,7 +12248,7 @@ speechSynthesis.getVoices();
};
D.lastSeen = '';
D.joinCount = 0;
D.timeSpent = '';
D.timeSpent = 0;
API.getCachedUser({
userId
})
@@ -13054,7 +13054,10 @@ speechSynthesis.getVoices();
cacheSize: 0,
cacheLocked: false,
lastVisit: '',
visitCount: 0
visitCount: 0,
timeSpent: 0,
isPC: false,
isQuest: false
};
API.$on('LOGOUT', function () {
@@ -13153,6 +13156,9 @@ speechSynthesis.getVoices();
D.rooms = [];
D.lastVisit = '';
D.visitCount = '';
D.timeSpent = 0;
D.isPC = false;
D.isQuest = false;
database.getLastVisit(D.id).then((ref) => {
if (ref.worldId === D.id) {
D.lastVisit = ref.created_at;
@@ -13163,6 +13169,11 @@ speechSynthesis.getVoices();
D.visitCount = ref.visitCount;
}
});
database.getTimeSpentInWorld(D.id).then((ref) => {
if (ref.worldId === D.id) {
D.timeSpent = ref.timeSpent;
}
});
API.getCachedWorld({
worldId: L.worldId
})
@@ -13176,6 +13187,13 @@ speechSynthesis.getVoices();
D.loading = false;
D.ref = args.ref;
D.isFavorite = API.cachedFavoritesByObjectId.has(D.id);
for (var unityPackage of args.ref.unityPackages) {
if (unityPackage.platform === 'standalonewindows') {
D.isPC = true;
} else if (unityPackage.platform === 'android') {
D.isQuest = true;
}
}
this.updateVRChatWorldCache();
if (args.cache) {
API.getWorld(args.params)

View File

@@ -1319,6 +1319,7 @@ html
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}}
el-tag.x-tag-troll(v-if="userDialog.ref.$isTroll" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Nuisance
el-tag.x-tag-legendary(v-if="userDialog.ref.$isLegend" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Legend
el-tag.x-tag-vip(v-if="userDialog.ref.$isModerator" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") VRChat Team
el-tag.x-tag-vrcplus(v-if="userDialog.ref.$isVRCPlus" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") VRC+
@@ -1534,6 +1535,8 @@ html
el-tag(v-if="worldDialog.ref.$isLabs" type="primary" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Labs
el-tag(v-else-if="worldDialog.ref.releaseStatus === 'public'" type="success" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Public
el-tag(v-else type="danger" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Private
el-tag.x-tag-platform-pc(v-if="worldDialog.isPC" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") PC
el-tag.x-tag-platform-quest(v-if="worldDialog.isQuest" type="info" effect="plain" size="mini" style="margin-right:5px;margin-top:5px") Quest
el-tag(type="info" effect="plain" size="mini" v-text="worldDialog.fileSize" style="margin-right:5px;margin-top:5px")
el-tag(v-if="worldDialog.inCache" type="info" effect="plain" size="mini" style="margin-top:5px")
span(v-text="worldDialog.cacheSize")
@@ -1670,6 +1673,11 @@ html
.detail
span.name Visit Count
span.extra(v-text="worldDialog.visitCount")
.x-friend-item(style="cursor:default")
.detail
span.name Time Spent
span.extra(v-if="worldDialog.timeSpent === 0") -
span.extra(v-else) {{ worldDialog.timeSpent | timeToText }}
el-tab-pane(label="JSON")
el-button(type="default" @click="refreshWorldDialogTreeData()" size="mini" icon="el-icon-refresh" circle)
el-tree(:data="worldDialog.treeData" style="margin-top:5px;font-size:12px")
@@ -2072,7 +2080,7 @@ html
el-dialog.x-dialog(ref="launchDialog" :visible.sync="launchDialog.visible" title="Launch" width="400px")
div #[span(v-text="launchDialog.shortUrl" style="word-break:break-all;font-size:12px")]
el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips")
el-button(@click="copyInstanceUrl(launchDialog.shortUrl)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
el-button(v-if="launchDialog.shortUrl" @click="copyInstanceUrl(launchDialog.shortUrl)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)
div(style="margin-top:10px") #[span(v-text="launchDialog.url" style="word-break:break-all;font-size:12px")]
el-tooltip(placement="top" content="Copy to clipboard" :disabled="hideTooltips")
el-button(@click="copyInstanceUrl(launchDialog.url)" size="mini" icon="el-icon-s-order" style="margin-left:5px" circle)

View File

@@ -751,6 +751,20 @@ class Database {
return ref;
}
async getTimeSpentInWorld(input) {
var worldId = input.replaceAll("'", '');
var ref = {
timeSpent: 0,
worldId: input
};
await sqliteService.execute((row) => {
if (typeof row[0] === 'number') {
ref.timeSpent += row[0];
}
}, `SELECT time FROM gamelog_location WHERE world_id = '${worldId}'`);
return ref;
}
async getLastSeen(input) {
var userId = input.id.replaceAll("'", '');
var displayName = input.displayName.replaceAll("'", "''");