Ejemplo n.º 1
0
        public static void SendFSOPresence(string lotName, int lotID, int players, int maxSize, int catID)
        {
            if (!Active)
            {
                return;
            }
            var presence = new DiscordRpc.RichPresence();

            if (lotName?.StartsWith("{job:") == true)
            {
                var split = lotName.Split(':');
                if (split.Length > 2)
                {
                    switch (split[1])
                    {
                    case "0":
                        presence.state = "Playing Robot Factory Job";
                        break;

                    case "1":
                        presence.state = "Playing Restaurant Job";
                        break;

                    default:
                        presence.state = "Playing A Job Lot";
                        break;
                    }
                    presence.details = "Level " + split[2];
                }
                else
                {
                    presence.state = "Playing a Job Lot";
                }
            }
            else
            {
                presence.state = (lotName == null) ? "Idle in city" : "In Lot: " + lotName;
            }

            presence.largeImageKey  = "sunrise_crater";
            presence.largeImageText = "Sunrise Crater";

            if (lotName != null)
            {
                presence.joinSecret = lotID + "#" + lotName;
                //presence.matchSecret = lotID + "#" + lotName+".";
                presence.spectateSecret = lotID + "#" + lotName + "..";
                presence.partyMax       = maxSize;
                presence.partySize      = players;
                presence.partyId        = lotID.ToString();

                presence.largeImageKey  = "cat_" + catID;
                presence.largeImageText = CapFirstWord(((LotCategory)catID).ToString());
            }

            DiscordRpc.UpdatePresence(ref presence);
        }
Ejemplo n.º 2
0
        // Method for other game screens
        public static void SendFSOPresence(string state, string details = null)
        {
            if (!Active)
            {
                return;          // RPC not active
            }
            var presence = new DiscordRpc.RichPresence();

            presence.largeImageKey  = "sunrise_crater";
            presence.largeImageText = "Sunrise Crater";

            presence.state   = state;
            presence.details = details == null ? "" : details;

            DiscordRpc.UpdatePresence(ref presence);
        }
Ejemplo n.º 3
0
        // Standard DiscordRpc presence method
        public static void SendFSOPresence(string activeSim, string lotName, int lotID, int players, int maxSize, int catID, bool isPrivate = false)
        {
            if (!Active)
            {
                return;
            }
            var presence = new DiscordRpc.RichPresence();

            if (!isPrivate)
            {
                if (lotName?.StartsWith("{job:") == true)
                {
                    var jobStr = "";
                    var split  = lotName.Split(':');
                    if (split.Length > 2)
                    {
                        switch (split[1])
                        {
                        case "0":     // Robot Factory
                            jobStr = "Robot Factory";
                            break;

                        case "1":     // Restaurant
                            jobStr = "Restaurant";
                            break;

                        case "2":     // Nightclub
                            jobStr = "Nightclub";
                            break;

                        default:     // Other
                            jobStr = "Job Lot";
                            break;
                        }
                        jobStr += " | Level " + split[2].Trim('}');
                    }
                    else
                    {
                        jobStr = "Job Lot";
                    }
                    if (activeSim != null)
                    {
                        presence.details = "Playing as " + activeSim;
                    }
                    presence.state = jobStr;
                }
                else
                {
                    if (activeSim == null)
                    {
                        presence.state   = lotName ?? "Idle in City";
                        presence.details = "";
                    }
                    else
                    {
                        presence.details = "Playing as " + activeSim;
                        presence.state   = lotName ?? "Idle in City";
                    }
                }
            }
            else
            {
                presence.state   = "Online";
                presence.details = "Privacy Enabled";
            }


            presence.largeImageKey  = "sunrise_crater";
            presence.largeImageText = "Sunrise Crater";

            if (lotName != null && !isPrivate)
            {
                presence.joinSecret = lotID + "#" + lotName;
                //presence.matchSecret = lotID + "#" + lotName+".";
                presence.spectateSecret = lotID + "#" + lotName + "..";
                presence.partyMax       = maxSize;
                presence.partySize      = players;
                presence.partyId        = lotID.ToString();

                presence.largeImageKey  = "cat_" + catID;
                presence.largeImageText = CapFirstWord(((LotCategory)catID).ToString());
            }

            DiscordRpc.UpdatePresence(ref presence);
        }