Skip to content
This repository was archived by the owner on Aug 7, 2022. It is now read-only.

Commit 9b08d09

Browse files
committed
[Change] RPCを改善、v5.4.7
1 parent 5df2ee0 commit 9b08d09

6 files changed

Lines changed: 60 additions & 18 deletions

File tree

app/js/preload/game.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ const initDiscordRPC = () => {
3232
try {
3333
const gameActivity = window.getGameActivity();
3434
rpcActivity = {
35-
state: gameActivity.map.length ? gameActivity.map : 'Playing Krunker',
36-
details: gameActivity.mode,
35+
state: gameActivity.map.length && config.get('shareMapInfo', true) ? gameActivity.map : 'Playing Krunker',
36+
details: gameActivity.mode && config.get('shareModeInfo', true) ? gameActivity.mode : undefined,
3737
largeImageKey: 'laf_icon',
38-
largeImageText: 'LaF CLient',
39-
smallImageKey: `icon_${gameActivity.class.index}`,
40-
smallImageText: gameActivity.class.name,
38+
largeImageText: 'LaF Client',
39+
smallImageKey: config.get('shareClassInfo', true) ? `icon_${gameActivity.class.index}` : undefined,
40+
smallImageText: config.get('shareClassInfo', true) ? gameActivity.class.name : undefined,
4141
};
42-
if (gameActivity.time) {
42+
if (gameActivity.time && config.get('shareTimerInfo', true)) {
4343
rpcActivity.endTimestamp = Date.now() + gameActivity.time * 1e3;
4444
}
4545
ipcRenderer.invoke('RPC_SEND', rpcActivity);

app/js/util/settings.js

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,57 @@ module.exports = {
3232
restart: true,
3333
default: true,
3434
},
35+
enableAltMng: {
36+
id: 'enableAltMng',
37+
title: langPack.settings.enableAltManager,
38+
cat: 'General',
39+
type: 'checkbox',
40+
val: config.get('enableAltMng', true),
41+
restart: false,
42+
default: true,
43+
},
3544
enableRPC: {
3645
id: 'enableRPC',
3746
title: langPack.settings.enableRPC,
38-
cat: 'General',
47+
cat: 'Discord',
3948
type: 'checkbox',
4049
val: config.get('enableRPC', true),
4150
restart: true,
4251
default: true,
4352
},
44-
enableAltMng: {
45-
id: 'enableAltMng',
46-
title: langPack.settings.enableAltManager,
47-
cat: 'General',
53+
shareMapInfo: {
54+
id: 'shareMapInfo',
55+
title: langPack.settings.shareMapInfo,
56+
cat: 'Discord',
4857
type: 'checkbox',
49-
val: config.get('enableAltMng', true),
58+
val: config.get('shareMapInfo', true),
59+
restart: false,
60+
default: true,
61+
},
62+
shareModeInfo: {
63+
id: 'shareModeInfo',
64+
title: langPack.settings.shareModeInfo,
65+
cat: 'Discord',
66+
type: 'checkbox',
67+
val: config.get('shareModeInfo', true),
68+
restart: false,
69+
default: true,
70+
},
71+
shareClassInfo: {
72+
id: 'shareClassInfo',
73+
title: langPack.settings.shareClassInfo,
74+
cat: 'Discord',
75+
type: 'checkbox',
76+
val: config.get('shareClassInfo', true),
77+
restart: false,
78+
default: true,
79+
},
80+
shareTimerInfo: {
81+
id: 'shareTimerInfo',
82+
title: langPack.settings.shareTimerInfo,
83+
cat: 'Discord',
84+
type: 'checkbox',
85+
val: config.get('shareTimerInfo', true),
5086
restart: false,
5187
default: true,
5288
},

app/lang/en_US.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ module.exports = {
8181
joinMatchOCustom: 'Official Custom Games',
8282
enableGA: 'Google Analytics',
8383
openDiscord: 'Join to Discord Server',
84+
shareMapInfo: 'Share map info',
85+
shareModeInfo: 'Share gamemode info',
86+
shareClassInfo: 'Share class info',
87+
shareTimerInfo: 'Share timer info',
8488
},
8589
misc: {
8690
noJoinableGames: 'There are no joinable games',

app/lang/ja_JP.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ module.exports = {
8181
joinMatchOCustom: '公式カスタムマッチ',
8282
enableGA: 'Google Analytics',
8383
openDiscord: 'Discordサーバーに参加する',
84+
shareMapInfo: 'プレイ中のマップを表示',
85+
shareModeInfo: 'プレイ中のモードを表示',
86+
shareClassInfo: '使用中のクラスを表示',
87+
shareTimerInfo: '試合の残り時間を表示',
8488
},
8589
misc: {
8690
noJoinableGames: '参加可能なゲームがありません',

app/main.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,13 @@ DiscordRPC.register(ClientID);
239239
const rpc = new DiscordRPC.Client({ transport: 'ipc' });
240240

241241
/* イベントハンドラー */
242-
// DiscordRPC
243-
let isDiscordAlive;
242+
// DiscordRPC`
244243
rpc.on('ready', () => {
245-
isDiscordAlive = true;
246244
log.info('Discord RPC Ready');
247245
});
248246

249247
ipcMain.handle('RPC_SEND', (e, d) => {
250-
if (isDiscordAlive) {
248+
if (rpc.user) {
251249
rpc.setActivity(d);
252250
}
253251
});
@@ -438,7 +436,7 @@ app.on('ready', () => {
438436
rpc.login({ clientId: ClientID });
439437
loggedIn = true;
440438
}
441-
catch (e) {
439+
catch (e) {
442440
console.error(e);
443441
}
444442
if (loggedIn) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "laf",
3-
"version": "5.4.6",
3+
"version": "5.4.7",
44
"description": "Lite and Fast Krunker Client",
55
"main": "app/main.js",
66
"scripts": {

0 commit comments

Comments
 (0)