Added Inventory.Definition.GetCachedStringProperty

This commit is contained in:
André Straubmeier 2019-03-15 13:58:20 +01:00
parent 879a284de3
commit 26a64f64e7

View File

@ -152,6 +152,25 @@ public string GetStringProperty( string name )
return val;
}
/// <summary>
/// Read and cache a raw property from the definition schema to make accessing it faster in the future
/// </summary>
public string GetCachedStringProperty( string name )
{
string val = string.Empty;
if ( customProperties == null )
customProperties = new Dictionary<string, string>();
if ( !customProperties.TryGetValue( name, out val ) )
{
inventory.inventory.GetItemDefinitionProperty( Id, name, out val );
customProperties.Add( name, val );
}
return val;
}
/// <summary>
/// Read a raw property from the definition schema
/// </summary>