Table of Contents

Class BaseItemTemplate

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Abstract base class for item templates, providing common properties and tooltip logic for all items. Implements ITooltip for UI display and ICachedObject for template caching.

public abstract class BaseItemTemplate : CachedScriptableObject<BaseItemTemplate>, ICachedObject, ITooltip
Inheritance
Object
ScriptableObject
BaseItemTemplate
Implements
Derived
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags
Extension Methods

Fields

Attributes

The base attributes added to the item after generation.

[Tooltip("The base attributes that are added to the item after the ItemGenerator has completed.")]
public List<ItemAttributeTemplate> Attributes

Field Value

List<ItemAttributeTemplate>

Generate

Indicates if the item should be generated (used in item generation systems).

public bool Generate

Field Value

bool

IconPools

Pools of icons for item generation and randomization.

public int[] IconPools

Field Value

int[]

IsIdentifiable

Indicates if the item can be identified (e.g., has hidden stats).

public bool IsIdentifiable

Field Value

bool

MaxStackSize

The maximum stack size for this item (if greater than 1, item is stackable).

public uint MaxStackSize

Field Value

uint

MeshReference

Addressable reference to the mesh for 3D representation of the item.

public AssetReference MeshReference

Field Value

AssetReference

Price

The price of the item, used for buying/selling.

public int Price

Field Value

int

icon

Addressable reference to the icon sprite for this item.

public AssetReferenceSprite icon

Field Value

AssetReferenceSprite

Properties

Icon

Gets the icon sprite for this item (loaded at runtime on client).

public Sprite Icon { get; }

Property Value

Sprite

IsStackable

Returns true if the item is stackable (MaxStackSize > 1).

public bool IsStackable { get; }

Property Value

bool

Mesh

Gets the mesh for this item (loaded at runtime on client).

public Mesh Mesh { get; }

Property Value

Mesh

Name

Gets the name of this item template (defaults to the asset name).

public string Name { get; }

Property Value

string

Methods

AddAttributeRange(TooltipContent, string, ItemAttributeTemplate, int, bool)

Writes an attribute the item grants, as the range it can roll.

protected static void AddAttributeRange(TooltipContent content, string label, ItemAttributeTemplate attribute, int priority, bool describingInstance = false)

Parameters

content TooltipContent

The content being assembled.

label string

What the attribute is called on this item.

attribute ItemAttributeTemplate

The attribute template, or null.

priority int

Where the row sorts.

describingInstance bool

Remarks

A template describes what an item of this kind CAN be, not what one particular item is: the value is rolled per instance by ItemGenerator, which writes the rolled number itself. A single number here would be a promise the item does not keep.

BuildTooltip(TooltipContent)

Describes the item: what it is called and what it is worth. Override in derived types to add their own rows.

public void BuildTooltip(TooltipContent content)

Parameters

content TooltipContent

The content being assembled.

BuildTooltip(TooltipContent, bool)

Describes the item, either as a kind of thing or as one the player is holding.

public virtual void BuildTooltip(TooltipContent content, bool describingInstance)

Parameters

content TooltipContent

The content being assembled.

describingInstance bool

True when an instance's own rolled values follow.

Remarks

The distinction matters for anything that rolls. A template can only say what an item of this kind CAN be — "Attack Power 1 - 3" — while an instance knows what it rolled, and ItemGenerator writes that. Printing both put the range and the roll in the same tooltip under two different names, which reads as two separate bonuses.

OnLoad(string, string, int)

Called when the item template is loaded into cache. Loads the icon and mesh on the client.

public override void OnLoad(string typeName, string resourceName, int resourceID)

Parameters

typeName string

The type name of the resource.

resourceName string

The resource name.

resourceID int

The resource ID.

OnUnload(string, string, int)

Called when the item template is unloaded from cache. Releases the icon and mesh on the client.

public override void OnUnload(string typeName, string resourceName, int resourceID)

Parameters

typeName string

The type name of the resource.

resourceName string

The resource name.

resourceID int

The resource ID.