# Inventool Utility

## 🛠️ InventoolUtility Class

Inventool's useful utility functions.

> Namespace: `Esper.Inventool`
>
> Access: `public static`
>
> Type: `class`

***

### 🧰 Methods

| Access          | Method                                                                        | Returns     | Description                                                                                                                                                                                          |
| --------------- | ----------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public static` | `GetCraftingCode(List<ItemStack> combineItems)`                               | `string`    | Generates a crafting code from a list of item stacks.                                                                                                                                                |
| `public static` | `GetCraftingCode(ItemStack[] combineItems)`                                   | `string`    | Generates a crafting code from a list of item stacks.                                                                                                                                                |
| `public static` | `GenerateCraftingCode(params ItemStack[] combineItems)`                       | `string`    | Generates a crafting code from a list of item stacks.                                                                                                                                                |
| `public static` | `GetCurrencyOfIdentity(List<Currency> currencies, CurrencyIdentity identity)` | `Currency`  | Returns the currency of a particular identity from a list of currencies. Returns the currency of the identity or default if it doesn't exist.                                                        |
| `public static` | `GetCurrencyOfIdentity(Currency[] currencies, CurrencyIdentity identity)`     | `Currency`  | Returns the currency of a particular identity from a list of currencies. Returns the currency of the identity or default if it doesn't exist.                                                        |
| `public static` | `GetMousePositionUGUI()`                                                      | `Vector2`   | Gets the mouse position.                                                                                                                                                                             |
| `public static` | `ForceInsideView(VisualElement element)`                                      | `void`      | Forces a visual element inside the game viewport if it's somewhat outside of it.                                                                                                                     |
| `public static` | `DropItemConfirmation(ItemStack itemStack)`                                   | `void`      | Convenience method for dropping items with a confirmation. The item will be dropped from the vault that it's in. If the item is not inside a vault, nothing will happen. Supports both UIT and uGUI. |
| `public static` | `IsElementInside(VisualElement element, VisualElement other)`                 | `bool`      | Checks if a visual element is inside another. Returns true if the visual element is inside the other. Otherwise, false.                                                                              |
| `public static` | `ToTexture2D(RenderTexture render)`                                           | `Texture2D` | Converts a RenderTexture to a Texture2D.                                                                                                                                                             |
| `public static` | `GetRandomPositionWithinRange(Vector3 target, Vector3 low, Vector3 high)`     | `Vector3`   | Gets a random position within a range.                                                                                                                                                               |
| `public static` | `IsFocusable(UIDocument document)`                                            | `bool`      | Checks if the document is currently focusable. Returns true if the document is focusable. Otherwise, false.                                                                                          |
| `public static` | `IsFocusable(VisualElement element)`                                          | `bool`      | Checks if a VisualElement is currently focusable. Returns true if the element is focusable. Otherwise, false.                                                                                        |
| `public static` | `IsFocusable(Selectable selectable)`                                          | `bool`      | Checks if a selectable is currently focusable. Returns true if the selectable is focusable. Otherwise, false.                                                                                        |
| `public static` | `IsVisibleInHierarchy(VisualElement element)`                                 | `bool`      | Checks if a VisualElement is visible in its hierarchy. Returns true if the element is visible. Otherwise, false.                                                                                     |
| `public static` | `IsPointInside(RectTransform rectTransform, Vector2 point, Canvas canvas)`    | `bool`      | Checks if a point in screen space is inside a RectTransform. Returns true if the point is inside the RectTransform. Otherwise, false.                                                                |
| `public static` | `ForceInsideView(RectTransform rectTransform, Canvas canvas)`                 | `void`      | Forces a RectTransform inside the screen.                                                                                                                                                            |
| `public static` | `AddToDragArea(VisualElement element)`                                        | `void`      | Adds an element to the drag area.                                                                                                                                                                    |
| `public static` | `AddToDragArea(RectTransform rectTransform)`                                  | `void`      | Adds a RectTransform to the drag area.                                                                                                                                                               |
| `public static` | `RemoveFromDragArea(VisualElement element)`                                   | `void`      | Removes an element from the drag area.                                                                                                                                                               |
| `public static` | `RemoveFromDragArea(RectTransform rectTransform)`                             | `void`      | Removes a RectTransform from the drag area.                                                                                                                                                          |
