private DiscordRpc.RichPresence GetPresence() { DiscordRpc.RichPresence presence = new DiscordRpc.RichPresence { details = api.FormatText(Conf.Details), state = api.FormatText(Conf.State), largeImageKey = "default_large", largeImageText = api.FormatText(Conf.LargeImageText), smallImageText = api.FormatText(Conf.SmallImageText) }; if (Conf.ForceSmallImage) { presence.smallImageKey = "default_small"; } if (presence.smallImageText != null) { presence.smallImageKey = presence.smallImageKey ?? "default_small"; } if (Context.IsWorldReady) { GamePresence conf = (GamePresence)Conf; if (conf.ShowSeason) { presence.largeImageKey = $"{Game1.currentSeason}_{FarmTypeKey()}"; } if (conf.ShowWeather) { presence.smallImageKey = "weather_" + WeatherKey(); } if (conf.ShowPlayTime) { presence.startTimestamp = timestampFarm; } if (Context.IsMultiplayer && conf.ShowPlayerCount) { try { presence.partyId = Game1.MasterPlayer.UniqueMultiplayerID.ToString(); presence.partySize = Game1.numberOfPlayers(); presence.partyMax = Game1.getFarm().getNumberBuildingsConstructed("Cabin") + 1; presence.joinSecret = Game1.server.getInviteCode(); } finally { } } } if (config.ShowGlobalPlayTime) { presence.startTimestamp = timestampSession; } return(presence); }
private RichPresence GetPresence() { RichPresence presence = new RichPresence { Details = api.FormatText(Conf.Details), State = api.FormatText(Conf.State) }; Assets assets = new Assets { LargeImageKey = "default_large", LargeImageText = api.FormatText(Conf.LargeImageText), SmallImageText = api.FormatText(Conf.SmallImageText) }; if (Conf.ForceSmallImage) { assets.SmallImageKey = "default_small"; } if (assets.SmallImageText != null) { assets.SmallImageKey = assets.SmallImageKey ?? "default_small"; } if (Context.IsWorldReady) { GamePresence conf = (GamePresence)Conf; if (conf.ShowSeason) { assets.LargeImageKey = $"{Game1.currentSeason}_{FarmTypeKey()}"; } if (conf.ShowWeather) { assets.SmallImageKey = "weather_" + WeatherKey(); } if (conf.ShowPlayTime) { presence.Timestamps = new Timestamps { Start = timestampFarm } } ; if (Context.IsMultiplayer && conf.ShowPlayerCount) { try { presence.Party = new Party { ID = Game1.MasterPlayer.UniqueMultiplayerID.ToString(), Size = Game1.numberOfPlayers(), Max = Game1.getFarm().getNumberBuildingsConstructed("Cabin") + 1 }; presence.Secrets = new Secrets { JoinSecret = Game1.server.getInviteCode() }; } catch { } } } if (config.ShowGlobalPlayTime) { presence.Timestamps = new Timestamps { Start = timestampSession } } ; presence.Assets = assets; return(presence); }