{"id":28565256,"url":"https://github.com/kistras/customdiscoverstatelib","last_synced_at":"2026-04-29T09:04:42.022Z","repository":{"id":284116885,"uuid":"953872705","full_name":"Kistras/CustomDiscoverStateLib","owner":"Kistras","description":"Library for your mod that allows for custom-colored discoveries","archived":false,"fork":false,"pushed_at":"2025-04-15T20:44:33.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T21:36:18.579Z","etag":null,"topics":["bepinex","library","mod","repo","unity"],"latest_commit_sha":null,"homepage":"https://thunderstore.io/c/repo/p/Kistras/CustomDiscoverStateLib/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kistras.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-24T08:06:49.000Z","updated_at":"2025-04-15T20:43:19.000Z","dependencies_parsed_at":"2025-03-24T09:25:31.264Z","dependency_job_id":"be16bc9e-a099-420b-a307-5fadc493ef2a","html_url":"https://github.com/Kistras/CustomDiscoverStateLib","commit_stats":null,"previous_names":["kistras/customdiscoverstatelib"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kistras%2FCustomDiscoverStateLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kistras%2FCustomDiscoverStateLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kistras%2FCustomDiscoverStateLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kistras%2FCustomDiscoverStateLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kistras","download_url":"https://codeload.github.com/Kistras/CustomDiscoverStateLib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kistras%2FCustomDiscoverStateLib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259090411,"owners_count":22803677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bepinex","library","mod","repo","unity"],"created_at":"2025-06-10T14:13:40.882Z","updated_at":"2026-04-29T09:04:36.990Z","avatar_url":"https://github.com/Kistras.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## What does it do\nThis library allows you to create custom colored highlights for ValuableDiscoverGraphic (the thing that appears when you see a valuable or a dead friend for a first time). Doesn't do anything by itself, other mods are meant to use it.\n\nGUID: `Kistras-CustomDiscoverStateLib`\n\n## Feature overview\n- Create custom static ValuableDiscoverGraphic states. To use them, you need to call `ValuableDiscover.instance.New()` with the state you created.\n- Create custom conditional ValuableDiscoverGraphic states. These will be applied automatically if prespecified (by you) conditions are met.\n- Create custom dynamic ValuableDiscoverGraphic states. These will be applied automatically if prespecified (by you) conditions are met, and you can change the color of the state upon creation. This is useful for mods that want to change the color of the state based on some conditions.\n\nPriority of the states is as follows:\n1. Static states (triggered manually by `ValuableDiscover.instance.New()`)\n2. Conditional states\n3. Dynamic states\n4. Base game states\n\n## Example plugin\n[Visit github page for working color-coding](https://github.com/Kistras/CustomDiscoverStateLib?tab=readme-ov-file#usage)\n```cs\nusing System;\nusing System.Linq;\nusing BepInEx;\nusing BepInEx.Logging;\nusing UnityEngine;\n\nnamespace CustomDiscoverStateExample;\n\nusing CDS = CustomDiscoverStateLib.CustomDiscoverState;\nusing State = ValuableDiscoverGraphic.State;\n\n[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]\n[BepInDependency(\"Kistras-CustomDiscoverStateLib\")]\npublic class Plugin : BaseUnityPlugin {\n    internal static new ManualLogSource Logger;\n\n    // Apply this one manually to PhysGrabObjects\n    private static State newDiscoverGraphic = CDS.AddNewDiscoverGraphic(\n            middle: new Color(0.8f, 0.0f, 0.5f, 0.075f), \n            corner: new Color(0.9f, 0.1f, 0.6f, 0.75f));\n    \n    // This one will be applied if the condition matches\n    // In this example - if the value of an object is bigger than 1500\n    private static State newConditionalDiscoverGraphic = CDS.AddNewConditionalDiscoverGraphic(\n        condition: (ValuableDiscover valuableDiscover, PhysGrabObject physGrabObject) =\u003e {\n            if (!physGrabObject) return false;\n            ValuableObject valuableObject = physGrabObject.transform.GetComponent\u003cValuableObject\u003e();\n            if (!valuableObject) return false;\n            return valuableObject.dollarValueCurrent \u003e 1500;\n        },\n        middle: new Color(0.0f, 0.0f, 0.5f, 0.075f), \n        corner: new Color(0.0f, 0.1f, 0.6f, 0.75f));\n    \n    // This one will be applied if the function will both return true and set middle/border color\n    // In this example - discoverGraphic of any valuable object will be based on it's currency\n    //     to initCurrency relation (red if nearly destroyed, green if wasn't damaged)\n    private static Color middleColorDestroyed = new Color(1.0f, 0.0f, 0.0f, 0.075f);\n    private static Color cornerColorDestroyed = new Color(1.0f, 0.1f, 0.0f, 0.75f);\n    private static Color middleColorIntact = new Color(0.0f, 1.0f, 0.0f, 0.075f);\n    private static Color cornerColorIntact = new Color(0.0f, 1.0f, 0.1f, 0.75f);\n    \n    private static State newDynamicDiscoverGraphic = CDS.AddNewDynamicDiscoverGraphic(\n        (ValuableDiscover discover, PhysGrabObject physGrabObject, out Color? middle, out Color? corner) =\u003e {\n            corner = middle = null;\n            \n            if (!physGrabObject) return false;\n            ValuableObject valuableObject = physGrabObject.transform.GetComponent\u003cValuableObject\u003e();\n            if (!valuableObject || valuableObject.discovered == false) return false;\n            \n            // This is a value between 0 and 1, where 0 means the object is destroyed and 1 means it's in perfect condition\n            float damagePercent = Math.Clamp(valuableObject.dollarValueCurrent / Math.Max(1, valuableObject.dollarValueOriginal), 0, 1);\n            \n            corner = cornerColorIntact * damagePercent + cornerColorDestroyed * (1 - damagePercent);\n            middle = middleColorIntact * damagePercent + middleColorDestroyed * (1 - damagePercent);\n            \n            return true;\n        });\n    \n    private void Awake() {\n        Logger = base.Logger;\n        Logger.LogInfo($\"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!\");\n        \n        // Utilize the custom discover graphic state as an example\n        // NOTE: Doesn't actually do anything, since no objects are spawned when the plugin is loaded\n        //       This is just an example of how to use the custom discover graphic state\n        ValuableObject someValuable = FindObjectsOfType\u003cValuableObject\u003e().FirstOrDefault();\n        if (someValuable) {\n            ValuableDiscover.instance.New(someValuable.physGrabObject, newDiscoverGraphic);\n        }\n    }\n}\n```\n\u003cdetails\u003e\n  \u003csummary\u003eThis is what you can expect from using this library\u003c/summary\u003e\n  \u003cimg src=\"https://i.imgur.com/Vh39siZ.png\" alt=\"A thingum hath been enlumined\"/\u003e\n\u003c/details\u003e\nDon't forget to list this library as dependency.\n\n## Base game colors (for reference)\n```cs\nValuableDiscoverGraphic.State baseGameReminder = CustomDiscoverState.AddNewDiscoverGraphic(\n    middle: new Color(0.642f, 0.619f, 0.481f, 0.039f), \n    corner: new Color(0.642f, 0.619f, 0.481f, 0.39f));\nValuableDiscoverGraphic.State baseGameBad = CustomDiscoverState.AddNewDiscoverGraphic(\n    middle: new Color(1f, 0.0f, 0.067f, 0.059f), \n    corner: new Color(1f, 0.1f, 0.067f, 0.59f));\nValuableDiscoverGraphic.State baseGameDiscover = CustomDiscoverState.AddNewDiscoverGraphic(\n    middle: new Color(1f, 0.863f, 0f, 0.118f), \n    corner: new Color(1f, 0.863f, 0f, 1f));\n```\n\n## Why make this?\nBecause I've seen two mods already that implement this functionality and [I'm in the process of making the third one](https://thunderstore.io/c/repo/p/Kistras/Valuables_Scanner/). So making a library seemed like a right choice","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkistras%2Fcustomdiscoverstatelib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkistras%2Fcustomdiscoverstatelib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkistras%2Fcustomdiscoverstatelib/lists"}