@@ -194,6 +194,7 @@ internal static void Load() {
194194 hookOnOuiFileSelectSlotRender = new ILHook ( typeof ( OuiFileSelectSlot ) . GetMethod ( "orig_Render" ) , modOuiFileSelectSlotRender ) ;
195195
196196 On . Celeste . Mod . Everest . DiscordSDK . GetMapIconURLCached += onDiscordGetPresenceIcon ;
197+ IL . Celeste . Mod . Everest . DiscordSDK . UpdatePresence += modDiscordChangePresence ;
197198
198199 typeof ( ModExports ) . ModInterop ( ) ;
199200 }
@@ -225,6 +226,7 @@ internal static void Unload() {
225226 hookOnOuiFileSelectSlotRender ? . Dispose ( ) ;
226227
227228 On . Celeste . Mod . Everest . DiscordSDK . GetMapIconURLCached -= onDiscordGetPresenceIcon ;
229+ IL . Celeste . Mod . Everest . DiscordSDK . UpdatePresence -= modDiscordChangePresence ;
228230
229231 if ( Everest . Loader . DependencyLoaded ( new EverestModuleMetadata ( ) { Name = "CelesteNet.Client" , Version = new Version ( 2 , 0 , 0 ) } ) ) {
230232 teardownAdjustCollabIcon ( ) ;
@@ -259,6 +261,24 @@ private static string onDiscordGetPresenceIcon(On.Celeste.Mod.Everest.DiscordSDK
259261 return orig ( self , areaData ) ;
260262 }
261263
264+
265+ private static void modDiscordChangePresence ( ILContext il ) {
266+ ILCursor cursor = new ILCursor ( il ) ;
267+
268+ if ( cursor . TryGotoNext ( MoveType . After , instr => instr . MatchLdflda < Session > ( "Area" ) , instr => instr . MatchCall < AreaKey > ( "get_ChapterIndex" ) ) ) {
269+ Logger . Log ( "CollabUtils2/InGameOverworldHelper" , $ "Hiding chapter number from collab maps at { cursor . Index } in IL for DiscordSDK.UpdatePresence") ;
270+
271+ cursor . Emit ( OpCodes . Ldarg_1 ) ;
272+ cursor . EmitDelegate < Func < int , Session , int > > ( ( orig , session ) => {
273+ if ( IsCollabMap ( session . Area . GetSID ( ) ) ) {
274+ // prevent Everest from displaying the chapter number
275+ return - 1 ;
276+ }
277+ return orig ;
278+ } ) ;
279+ }
280+ }
281+
262282 public static void OnSessionCreated ( ) {
263283 Session session = SaveData . Instance . CurrentSession_Safe ;
264284 string levelSet = GetLobbyLevelSet ( session . Area . GetSID ( ) ) ;
0 commit comments