mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Add support for Eggstra Work and Tableturf Battle for Splatoon 3 presence
This commit is contained in:
parent
a7406bd850
commit
9b038c76da
|
|
@ -1,7 +1,7 @@
|
|||
import createDebug from 'debug';
|
||||
import persist from 'node-persist';
|
||||
import DiscordRPC from 'discord-rpc';
|
||||
import { BankaraMatchMode, BankaraMatchSetting, CoopSchedule, CoopSchedule_schedule, CoopSetting, DetailVotingStatusResult, FestMatchSetting, FestState, FestTeamRole, FestTeam_schedule, FestTeam_votingStatus, Fest_schedule, FriendListResult, FriendOnlineState, GraphQLSuccessResponse, LeagueMatchSetting, RegularMatchSetting, StageScheduleResult, VsSchedule_bankara, VsSchedule_fest, VsSchedule_league, VsSchedule_regular, VsSchedule_xMatch, XMatchSetting } from 'splatnet3-types/splatnet3';
|
||||
import { BankaraMatchMode, BankaraMatchSetting, CoopRule, CoopSchedule_schedule, CoopSetting_schedule, DetailVotingStatusResult, FestMatchSetting, FestTeam_schedule, FestTeam_votingStatus, Fest_schedule, FriendListResult, FriendOnlineState, GraphQLSuccessResponse, LeagueMatchSetting, RegularMatchSetting, StageScheduleResult, VsSchedule_bankara, VsSchedule_fest, VsSchedule_league, VsSchedule_regular, VsSchedule_xMatch, XMatchSetting } from 'splatnet3-types/splatnet3';
|
||||
import { Game } from '../../api/coral-types.js';
|
||||
import SplatNet3Api from '../../api/splatnet3.js';
|
||||
import { DiscordPresenceExternalMonitorsConfiguration } from '../../app/common/types.js';
|
||||
|
|
@ -35,6 +35,7 @@ export default class SplatNet3Monitor extends EmbeddedLoop {
|
|||
x_schedule: VsSchedule_xMatch | null = null;
|
||||
coop_regular_schedule: CoopSchedule_schedule | null = null;
|
||||
coop_big_run_schedule: CoopSchedule_schedule | null = null;
|
||||
coop_team_contest_schedule: CoopSchedule_schedule | null = null;
|
||||
fest: Fest_schedule | null = null;
|
||||
fest_team_voting_status: FestTeam_votingStatus | null = null;
|
||||
fest_team: FestTeam_schedule | null = null;
|
||||
|
|
@ -135,6 +136,7 @@ export default class SplatNet3Monitor extends EmbeddedLoop {
|
|||
this.x_schedule = this.getSchedule(this.cached_schedules?.data.xSchedules.nodes ?? []);
|
||||
this.coop_regular_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.regularSchedules.nodes ?? []);
|
||||
this.coop_big_run_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.bigRunSchedules.nodes ?? []);
|
||||
this.coop_team_contest_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.teamContestSchedules.nodes ?? []);
|
||||
this.fest = this.cached_schedules?.data.currentFest ?? null;
|
||||
|
||||
// Identify the user by their icon as the vote list doesn't have friend IDs
|
||||
|
|
@ -225,7 +227,7 @@ interface PresenceUrlResponse {
|
|||
splatoon3_vs_setting?:
|
||||
RegularMatchSetting | BankaraMatchSetting | FestMatchSetting |
|
||||
LeagueMatchSetting | XMatchSetting | null;
|
||||
splatoon3_coop_setting?: CoopSetting | null;
|
||||
splatoon3_coop_setting?: CoopSetting_schedule | null;
|
||||
splatoon3_fest?: Fest_schedule | null;
|
||||
}
|
||||
|
||||
|
|
@ -339,9 +341,9 @@ export function callback(activity: DiscordRPC.Presence, game: Game, context?: Di
|
|||
presence_proxy_data && 'splatoon3_coop_setting' in presence_proxy_data ?
|
||||
presence_proxy_data.splatoon3_coop_setting :
|
||||
monitor ?
|
||||
friend.coopRule === 'BIG_RUN' ?
|
||||
monitor.coop_big_run_schedule?.setting :
|
||||
monitor.coop_regular_schedule?.setting :
|
||||
friend.coopRule === CoopRule.BIG_RUN ? monitor.coop_big_run_schedule?.setting :
|
||||
friend.coopRule === CoopRule.TEAM_CONTEST ? monitor.coop_team_contest_schedule?.setting :
|
||||
monitor.coop_regular_schedule?.setting :
|
||||
null;
|
||||
|
||||
if (coop_setting) {
|
||||
|
|
@ -359,4 +361,8 @@ export function callback(activity: DiscordRPC.Presence, game: Game, context?: Di
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (friend.onlineState === FriendOnlineState.MINI_GAME_PLAYING) {
|
||||
activity.details = 'Tableturf Battle';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user