Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

1 Screenshot

  • 345
  • 3
  • 58.5 kB

About Workshop API

Utility tool for plugin developers to use Workshop information in their own plugins. This plugin also caches the in-game icon for workshop items using ImageLibrary so you can use the real icon for items in various situations, like custom item stores and any other CUI-dependent type of plugins.

 

API

  • DownloadGameIcon

    void DownloadGameIcon ( ulong workshopId, Action<byte[]> onIconReceived );

    Requests and returns the byte[] data of a workshop in-game item icon (png, with transparency).

  • StoreGameIcon

    void StoreGameIcon ( ulong workshopId, bool redownload = false );

    Downloads and stores the workshop in-game item icon (png, with transparency) in ImageLibrary in the following name format: workshop_<workshopId>

    Usage:

    new CuiRawImageComponent
    {
        Png = (string) ImageLibrary?.Call ( "GetImage", $"workshop_{workshopId}" );
    };
  •  GetGameIcon

    string GetGameIcon ( ulong workshopId );

    Returns the ImageLibrary ID.

    Usage:

    new CuiRawImageComponent
    {
        Png = returnedId
    };
  • GetInfo

    void GetInfo ( ulong workshopId, Action<Newtonsoft.Json.Linq.JObject> onInfoReceived );

    Gets the workshop information as seen on Steam for you to use & access. Ideally used to cache information whenever needed.

    {
        "creatorId": "",
        "size": 0,
        "title": "",                                                                                                                           
        "previewUrl": "",
        "description": "",
        "views": 0,
        "favorites": 0,
        "tags": [
            {
                "tag": ""
            }
        ]
    }

    Usage: 

    WorkshopAPI?.Call ( "GetWorkshopInfo", 2494493821ul, new Action<Newtonsoft.Json.Linq.JObject> ( info =>
    {
        Puts ( $"{info [ "title" ]}" );
    } ) );
  • IsGameIconStored

    bool IsGameIconStored ( ulong workshopId );

    Lets you know if the in-game workshop icon is already stored or not.

 

Config

For limitation reasons, ScaleMultiplier (defaults to 1f) is used to downscale the icon because the original size sometimes exceeds the maximum server FileStorage size limit. You could try using the original HD size (ScaleMultiplier: 1), but if the image remains blank, it's because the size of the icon is too large.

EnableLogs (defaults to true) will log whenever an in-game workshop icon has been (re)stored in ImageLibrary.

{
  "ScaleMultiplier": 1.0,
  "EnableLogs": true
}

 

How it Works

Mainly used to get workshop page information and the in-game icon in any CUI plugin you're willing to write.

image.png.3a2bbc39a26e637d32a17cb76b2ce0fe.png    image.thumb.png.0526370e5998187c99b793cce9cb3528.png

 

  • Like 1
  • Love 1
 Share


Raul-Sorin Sorban's Other Downloads


User Feedback

About Us

Codefling is a forward-thinking platform for developers to share and monetize their work from plugins to game assets and everything in-between.

7,092 files sold to 634 customers and $102,868 of payments processed this year!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.