Search the Community
Showing results for tags 'library'.
-
Version 1.1.2
85 downloads
Image Manager is a sleek and powerful tool for developers, offering a lightweight alternative to ImageLibrary. Its unique handling and plugin-specific callbacks make it exceptionally easy to use. Console Command: imagemanager.reset // can only be ran from server console/terminal I don't allow use client side. Features: Error Handling: Outputs special debug info for devs when something fails. It's able to self repair when the server sv.files have been deleted but a wipe hasn't occurred or vice versa. Stores images with unique identifiers to ensure reliable retrieval/removal. If unity request fails retries with www instead. Optimized Request Management: Utilizes batch processing to handle image caching requests efficiently. Auto Remove Data that isn't used past x Days: Default = 30, 0 = disabled. Sets batch limits on Images: Default = 30 & Avatars can do 100 at a time per request using steam API key. Keeps Previous Wipe Data thus reducing the need to redo everything each wipe. Groups requests into batches to optimize resource use and reduce overhead. Manages large volumes of connections without sacrificing performance. Handles high volumes of image caching requests during server wipes or mass player reconnections. Processes and caches avatar images quickly with coroutine-based execution. Manages concurrent requests from multiple plugins simultaneously without conflicts or slowdowns. Maintains responsiveness and efficiency in dynamic server environments. Plugin Communication: In addition to its core functionality, the system includes special logic to facilitate communication between plugins. Each plugin calling the image caching system is notified when its batch of requests is ready or finished, allowing it to proceed with its logic without waiting for all requests to complete. This feature enhances the flexibility and usability of the system, ensuring smooth integration with various plugins and workflows. Plugin Communication Example For Images: // Plugin Calls!? Whaaa.. :P This works with all Adding hook calls in this plugin. // Example plugin: GUIShop [PluginReference] private Plugin ImageManager; private List<string> _pluginImages = new List<string>(); private Dictionary<string, string> _guishopImages = new Dictionary<string, string>(); private void OnServerInitialized() { // This will add the images to the filesystem list for the callback if (ImageManager != null && ImageManager.IsLoaded) ImageManager?.Call("AddImages", _pluginImages, FileStorage.Type.jpg, "GUIShop"); } // why do we need this!? OnPluginLoaded for reload situations, or when plugin wasn't loaded yet. private void OnPluginLoaded(Plugin name) { if (ImageManager != null && name.Name == ImageManager.Name & ImageManager.IsLoaded) { Puts("ImageManager has been detected and GUIShop Images are now being Processed"); // This will add the images to the filesystem list for the callback ImageManager?.Call("AddImages", _pluginImages, FileStorage.Type.jpg, "GUIShop"); } } // this would be your custom call-back ( Why use this!? Because it can actually be faster so you can continue your code logic quicker ) void ImageManagerGUIShop(Dictionary<string, string> images) { _guishopImages = images; // this returns the sent URL as the KEY with the image as the value. } // now down in your GUI / UI you can do this ( same for avatars except the key is ulong ) public void Pic(ref CuiElementContainer container, string parent, string name, string anchorMin, string anchorMax, string url) { CuiRawImageComponent rawImage = new CuiRawImageComponent(); rawImage.Png = _guishopImages[url]; container.Add(new CuiElement { Parent = parent, Name = name, Components = { rawImage, new CuiRectTransformComponent { AnchorMin = anchorMin, AnchorMax = anchorMax } } }); } Plugin Communication Example for Avatars / Image Combo: private HashSet<string> _storeImages = new HashSet<string>(); private Dictionary<string, string> _storedImages = new Dictionary<string, string>(); private Dictionary<string, string> _storedAvatars = new Dictionary<string, string>(); private void OnServerInitialized() { ImageManager?.Call("AddImages", _storeImages.ToList(), FileStorage.Type.jpg, "GUIShop"); } private void OnPluginLoaded(Plugin name) { if (ImageManager != null && name.Name == ImageManager.Name) { Puts("ImageManager has been detected and Images are now being Processed"); ImageManager?.Call("AddImages", _storeImages.ToList(), FileStorage.Type.jpg, "GUIShop"); // plugin name "GUIShop" } } // your special made hook to listen for on your image request. private void ImageManagerRustID(Dictionary<string, string> received) { // you can filter which ones you want when you get the list back. example. foreach (var image in received) { if (_storeImages.Contains(image.Key)) { _storedImages[image.Key] = image.Value; _storeImages.Remove(image.Key); if (_storeImages.Count == 0) break; } } } // called when new avatars get cached so you can update as needed. void ImageManagerPlayerConnected(Dictionary<string, string> avatars) => _storedAvatars = avatars; // use for your gui example CuiRawImageComponent rawImage = new CuiRawImageComponent(); rawImage.Png = _storedAvatars[id]; //or call each time if you prefer.. (string)ImageManager?.Call("GetAvatar", id); // or image rawImage.Png = _storedImages[key] container.Add(new CuiElement { Parent = parent, Name = name, Components = { rawImage, new CuiRectTransformComponent { AnchorMin = anchorMin, AnchorMax = anchorMax } } }); API Hooks: // Avatars // Called when the plugin has initially loaded / compiled & finished/ready for use. void ImageManagerLoadedAvatars(Dictionary<string, string> avatars) // Triggered when new players connect with no stored pic yet. ( Is only called once finished storing in the event of multiple or mass player connections their Queued ) void ImageManagerPlayerConnected(Dictionary<string, string> avatars) // Triggered by 3rd party plugins doing stuff + PlayerConnected. void ImageManagerAdded(Dictionary<string, string> avatars) // called when avatars have been removed & returns the new full avatar list available. void ImageManagerRemoved(Dictionary<string, string> avatars) // Images // Called when the plugin has initially loaded / compiled & finished/ready for use. void ImageManagerLoadedImages(Dictionary<string, string> images) // Triggered by 3rd party plugins doing stuff. void ImageManagerAdded(Dictionary<string, string> images) // called when avatars have been removed & returns the new full avatar list available. void ImageManagerRemoved(Dictionary<string, string> images) API Calls: These are API CALLS which means you call them.. ImageManager?.Call("AddImages", _pluginImages, FileStorage.Type.jpg, "GUIShop"); // Example // new hook use this to specify individual image storage types. AddImages(Dictionary<string, FileStorage.Type> images, string plugin) // hook changed. AddImages(List<string> images, FileStorage.Type format, string plugin) // hook changed. Use this to specify 1 storage type for all images to save as. AddImage(string image, FileStorage.Type format, string plugin) GetImage(string image) // returns string GetImages(List<string> images) // returns Dictionary<string, string> RemoveImage(string image) RemoveImages(List<string> images) AddAvatar(ulong player, string url, string plugin) // url is optional if you want to provide custom image for player. AddAvatar(string player, string url, string plugin) // url is optional if you want to provide custom image for player. AddAvatars(Dictionary<string, string> players, string plugin) // url is optional if you want to provide custom image for player. GetAvatar(string player) // returns string GetAvatars(List<string> players) // returns Dictionary<string, string> RemoveAvatar(string player) RemoveAvatars(List<string> players) TODO: Add MYSQL Support to have 1 database available instead of each server instance. Add Discord support for Error Responses.Free -
Version 1.1.9
672 downloads
This library allows developers to create their own ItemDefinitions, which will allow them to create custom items with their own unique values. What is an ItemDefinition created with the library? It is a full-fledged ItemDefinition just like the other ones created by Rust developers, a new item definition is created based on an existing one with modified settings. It has its own shortname and itemid, and can also have its own itemMods created by the developer, which is very convenient. You can use the give command, item.info.[anything], and any other way you want. A simple example of item creation: // Requires: CustomItemDefinitions using static Oxide.Plugins.CustomItemDefinitions; namespace Oxide.Plugins { [Info("LightsaberItem", "0xF", "1.0.0")] public class LightsaberItem : RustPlugin { public static LightsaberItem PluginInstance; ItemDefinition PARENT_DEFINITION = ItemManager.FindItemDefinition("longsword"); void Init() { PluginInstance = this; CustomItemDefinitions.RegisterPluginItemDefinition(new CustomItemDefinition { shortname = "lightsaber", parentItemId = PARENT_DEFINITION.itemid, maxStackSize = 1, category = ItemCategory.Weapon, defaultName = "Lightsaber", defaultSkinId = 3035762342, itemMods = new ItemMod[] { PARENT_DEFINITION.GetComponentInChildren<ItemModEntity>(), new ItemModLightsaberCreatedNotice() { exampleField_message = "Item with name \"{0}\" just created! Yay!" } } }, this); } public class ItemModLightsaberCreatedNotice : ItemMod { public string exampleField_message; public override void OnItemCreated(Item item) { base.OnItemCreated(item); if (exampleField_message != null) PluginInstance.Puts(string.Format(exampleField_message, item.name)); } } } } What are some things to keep in mind? Always register new item definitions in the Init hook! This is important! You must take care to register unique shortnames and item ids. ItemId should never be changed in your plugin, as items created with an old itemId will break if they don't have their definition. After your plugin is unloaded, all items created with your item definitions will lose interaction, as all ItemMods will be removed. This is done for safety, don't worry, after loading the plugin back in, all items will work again as before. CustomItemDefinition class structure: public class CustomItemDefinition { public int parentItemId; public string shortname; public int? itemId; // optional public string defaultName; public string defaultDescription; // For use by other plugins, this will not be displayed on the client side when selecting an item public ulong defaultSkinId; public int? maxStackSize; public ItemCategory? category; public ItemDefinition.Flag flags; public ItemMod[] itemMods; } ItemMods details: ItemMods are overwritten, this means the new item definition will not include the itemMods of the parent. If you need to import an item mod from the parent, you can use PARENT_DEFINITION.GetComponent<ItemModYouNeed>() if you need to import everything ItemMods new List<ItemMod>(PARENT_DEFINITION.itemMods).ToArray() Custom itemMods are added using the method of creating a new class, i.e. new YourItemMod() Here you can also specify the fields you want, example: new YourItemMod() { field: value } Quick answers to questions: Items have become coal, what does that mean? This is a fallback ItemDefinition in case the plugin providing this item is no longer available. The items will be restored if the plugin is returned.Free -
Version 1.0.6
217 downloads
Admin and player UI for saving/recalling/deleting sign drawings. Gives players a 25 capacity image library so they can save, and restore, their artwork. Saved images exist even after the signs they're on are destroyed. Multi-layer support for animated signs allows save from and restore to each layer separately. Admin can view a 25 image history for any sign, with the SteamID of the painter shown. Clicking a SteamID shows a 25 image history for that player. UI delete allows for very easy moderation of unwanted images. Permissions SignManager.admin – Allows use of /sma command. SignManager.autosave – Allows auto-saving of paintings upon completion. SignManager.manualsave – Allows manual saving of paintings in UI menu. Chat commands Players. /sm – Opens SignManager UI. Player must be close to a sign Admin. /sma – Opens admin menu for closest sign. /sma <steamID> – Opens admin menu for closest sign /sma export – Exports all images/library data to file. These are auto imported on next server boot. Console commands sma export -Exports all images/library data to file. These are auto imported on next server boot. Configuration ButtonColour : “0.7 0.32 0.17 1” CommandAlias = "SignManager"; AdminCommandAlias = "SignManagerAdmin"; Note : SignManager uses Rust storage and, therefore, saved images will be wiped when the server is wiped. To avoid this, use the the `/sma export` chat command or `sma export` console command before shutdown and wipe.$10.00