|
|
@ -13,11 +13,11 @@ |
|
|
|
<h4 style="text-align: center">Для подключения к серверу нажми на него</h4> |
|
|
|
<hr> |
|
|
|
<h5 style="text-align: center" v-if="this.$API.stats.servers['w'].length>0">где сейчас играют карлики</h5> |
|
|
|
<ServerCard v-for="srv in this.$API.stats.servers['w']" :key="srv['name']" :server-name="srv['name']" :server-image="srv['preview']" :server-current-player="srv['player_count']" :server-max-player="srv['max_players']" :server-data="srv"/> |
|
|
|
<ServerCard v-for="srv in this.$API.stats.servers['w']" :key="srv['name']" :server-name="srv['name']" :server-image="srv['preview']" :server-current-player="srv['player_count']" :server-max-player="srv['max_players']" :server-data="srv" :last_play="getLastPlay(srv['key'])"/> |
|
|
|
<h5 style="text-align: center" v-if="this.$API.stats.servers['e'].length>0">где сейчас никого нет</h5> |
|
|
|
<ServerCard v-for="srv in this.$API.stats.servers['e']" :key="srv['name']" :server-name="srv['name']" :server-image="srv['preview']" :server-current-player="srv['player_count']" :server-max-player="srv['max_players']" :server-data="srv"/> |
|
|
|
<ServerCard v-for="srv in this.$API.stats.servers['e']" :key="srv['name']" :server-name="srv['name']" :server-image="srv['preview']" :server-current-player="srv['player_count']" :server-max-player="srv['max_players']" :server-data="srv" :last_play="getLastPlay(srv['key'])"/> |
|
|
|
<h5 style="text-align: center" v-if="this.$API.stats.servers['n'].length>0">где сейчас играют карлики</h5> |
|
|
|
<ServerCard v-for="srv in this.$API.stats.servers['n']" :key="srv['name']" :server-name="srv['name']" :server-image="srv['preview']" :server-current-player="srv['player_count']" :server-max-player="srv['max_players']" :server-data="srv"/> |
|
|
|
<ServerCard v-for="srv in this.$API.stats.servers['n']" :key="srv['name']" :server-name="srv['name']" :server-image="srv['preview']" :server-current-player="srv['player_count']" :server-max-player="srv['max_players']" :server-data="srv" :last_play="getLastPlay(srv['key'])"/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<SnackLoader ref="s_loader" s_text="Обновление списка серверов"/> |
|
|
@ -32,7 +32,8 @@ export default { |
|
|
|
name: 'ServersView', |
|
|
|
components: {SnackLoader, ServerCard, CharacterImage}, |
|
|
|
data:() => ({ |
|
|
|
servers: {'w':[], 'n':[], 'e':[]} |
|
|
|
servers: {'w':[], 'n':[], 'e':[]}, |
|
|
|
lp_cache: null |
|
|
|
}), |
|
|
|
methods: { |
|
|
|
updateServers() { |
|
|
@ -41,6 +42,15 @@ export default { |
|
|
|
this.servers = this.$API.stats.servers; |
|
|
|
this.$refs.s_loader.setLoading(false); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getLastPlay(srv) { |
|
|
|
if (this.$API.player.store !== null) { |
|
|
|
if (this.lp_cache == null) this.lp_cache = this.$API.player.getLastplayList(this.$API.player.store); |
|
|
|
for (const lp in this.lp_cache) { |
|
|
|
if (this.lp_cache[lp][2] === srv) return this.lp_cache[lp][1]; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|