using System.Collections.Generic;
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
///
/// Defines an object in the world
///
public class WorldObject : GenericDisposableWrapper
{
///
/// Gets the number of active spells on this object.
///
public int ActiveSpellCount => Values(LongValueKey.ActiveSpellCount);
///
/// Gets the number of spells that this object casts.
///
public int SpellCount => Values(LongValueKey.SpellCount);
public int Behavior => base.Wrapped.Behavior;
public int Category => base.Wrapped.Category;
public int Container => base.Wrapped.Container;
public int GameDataFlags1 => base.Wrapped.GameDataFlags1;
public int Id => base.Wrapped.GUID;
public bool HasIdData => base.Wrapped.HasIdData;
public int Icon => base.Wrapped.Icon;
public int LastIdTime => base.Wrapped.LastIdTime;
public string Name => base.Wrapped.Name;
public ObjectClass ObjectClass => (ObjectClass)base.Wrapped.ObjectClass;
public int PhysicsDataFlags => base.Wrapped.PhysicsDataFlags;
public int Type => base.Wrapped.Type;
public List BoolKeys
{
get
{
List list = new List();
int num = 0;
for (int num2 = base.Wrapped.EnumBoolKey(0); num2 != -1; num2 = base.Wrapped.EnumBoolKey(num))
{
list.Add(num2);
num++;
}
if (base.Wrapped.Bools((Decal.Interop.Filters.BoolValueKey)(-1)))
{
list.Add(-1);
}
return list;
}
}
public List LongKeys
{
get
{
List list = new List();
int num = 0;
for (int num2 = base.Wrapped.EnumLongKey(0); num2 != -1; num2 = base.Wrapped.EnumLongKey(num))
{
list.Add(num2);
num++;
}
if (base.Wrapped.Longs((Decal.Interop.Filters.LongValueKey)(-1), -1) != -1)
{
list.Add(-1);
}
return list;
}
}
public List DoubleKeys
{
get
{
List list = new List();
int num = 0;
for (int num2 = base.Wrapped.EnumDoubleKey(0); num2 != -1; num2 = base.Wrapped.EnumDoubleKey(num))
{
list.Add(num2);
num++;
}
if (base.Wrapped.Doubles((Decal.Interop.Filters.DoubleValueKey)(-1), -1.0) != -1.0)
{
list.Add(-1);
}
return list;
}
}
public List StringKeys
{
get
{
List list = new List();
int num = 0;
for (int num2 = base.Wrapped.EnumStringKey(0); num2 != -1; num2 = base.Wrapped.EnumStringKey(num))
{
list.Add(num2);
num++;
}
if (!base.Wrapped.Strings((Decal.Interop.Filters.StringValueKey)(-1), "-1").Equals("-1"))
{
list.Add(-1);
}
return list;
}
}
public WorldObject(Decal.Interop.Filters.WorldObject obj)
: base(obj)
{
}
///
/// Gets the spell ID of one of the active spells on this object.
///
/// The index in the list of active spells.
/// The spell ID.
public int ActiveSpell(int index)
{
return base.Wrapped.ActiveSpell(index);
}
///
/// Determines whether this object has the specified property.
///
/// The property to check.
/// true if this object has the specified property.
public bool Exists(BoolValueKey index)
{
bool pValue;
return base.Wrapped.BoolExists((Decal.Interop.Filters.BoolValueKey)index, out pValue);
}
///
/// Determines whether this object has the specified property.
///
/// The property to check.
/// true if this object has the specified property.
public bool Exists(DoubleValueKey index)
{
double pValue;
return base.Wrapped.DoubleExists((Decal.Interop.Filters.DoubleValueKey)index, out pValue);
}
///
/// Determines whether this object has the specified property.
///
/// The property to check.
/// true if this object has the specified property.
public bool Exists(LongValueKey index)
{
int pValue;
return base.Wrapped.LongExists((Decal.Interop.Filters.LongValueKey)index, out pValue);
}
///
/// Determines whether this object has the specified property.
///
/// The property to check.
/// true if this object has the specified property.
public bool Exists(StringValueKey index)
{
string pValue;
return base.Wrapped.StringExists((Decal.Interop.Filters.StringValueKey)index, out pValue);
}
///
/// Gets the value of the specified property, if it exists.
///
/// The property to get.
/// Set to the value of the property, if it exists.
/// true if this object has the specified property.
public bool Exists(BoolValueKey index, out bool pValue)
{
return base.Wrapped.BoolExists((Decal.Interop.Filters.BoolValueKey)index, out pValue);
}
///
/// Gets the value of the specified property, if it exists.
///
/// The property to get.
/// Set to the value of the property, if it exists.
/// true if this object has the specified property.
public bool Exists(DoubleValueKey index, out double pValue)
{
return base.Wrapped.DoubleExists((Decal.Interop.Filters.DoubleValueKey)index, out pValue);
}
///
/// Gets the value of the specified property, if it exists.
///
/// The property to get.
/// Set to the value of the property, if it exists.
/// true if this object has the specified property.
public bool Exists(LongValueKey index, out int pValue)
{
return base.Wrapped.LongExists((Decal.Interop.Filters.LongValueKey)index, out pValue);
}
///
/// Gets the value of the specified property, if it exists.
///
/// The property to get.
/// Set to the value of the property, if it exists.
/// true if this object has the specified property.
public bool Exists(StringValueKey index, out string pValue)
{
return base.Wrapped.StringExists((Decal.Interop.Filters.StringValueKey)index, out pValue);
}
///
/// Gets the value of the specified property, or false if this
/// object doesn't have the property.
///
/// The property to get.
/// The property's value.
public bool Values(BoolValueKey index)
{
return Values(index, defaultValue: false);
}
///
/// Gets the value of the specified property, or 0.0 if this
/// object doesn't have the property.
///
/// The property to get.
/// The property's value.
public double Values(DoubleValueKey index)
{
return Values(index, 0.0);
}
///
/// Gets the value of the specified property, or 0 if this
/// object doesn't have the property.
///
/// The property to get.
/// The property's value.
public int Values(LongValueKey index)
{
return index switch
{
LongValueKey.Slot => Values(index, -1),
LongValueKey.SlotLegacy => Values(index, 0),
_ => Values(index, 0),
};
}
///
/// Gets the value of the specified property, or "" if this
/// object doesn't have the property.
///
/// The property to get.
/// The property's value.
public string Values(StringValueKey index)
{
return Values(index, string.Empty);
}
///
/// Gets the value of the specified property, or defaultValue
/// if this object doesn't have the property.
///
/// The property to get.
/// The value to return if this object
/// doesn't have the property.
/// The property's value.
public bool Values(BoolValueKey index, bool defaultValue)
{
return base.Wrapped.Bools((Decal.Interop.Filters.BoolValueKey)index, defaultValue);
}
///
/// Gets the value of the specified property, or defaultValue
/// if this object doesn't have the property.
///
/// The property to get.
/// The value to return if this object
/// doesn't have the property.
/// The property's value.
public double Values(DoubleValueKey index, double defaultValue)
{
return base.Wrapped.Doubles((Decal.Interop.Filters.DoubleValueKey)index, defaultValue);
}
///
/// Gets the value of the specified property, or defaultValue
/// if this object doesn't have the property.
///
/// The property to get.
/// The value to return if this object
/// doesn't have the property.
/// The property's value.
public int Values(LongValueKey index, int defaultValue)
{
return base.Wrapped.Longs((Decal.Interop.Filters.LongValueKey)index, defaultValue);
}
///
/// Gets the value of the specified property, or defaultValue
/// if this object doesn't have the property.
///
/// The property to get.
/// The value to return if this object
/// doesn't have the property.
/// The property's value.
public string Values(StringValueKey index, string defaultValue)
{
return base.Wrapped.Strings((Decal.Interop.Filters.StringValueKey)index, defaultValue);
}
///
/// Gets the coordinates of this object, or null if this
/// object doesn't have coordinates (if it's in a container, etc.)
///
/// The coordinates of this object, or null if this
/// object doesn't have coordinates.
public CoordsObject Coordinates()
{
double NorthSouth = 0.0;
double EastWest = 0.0;
if (base.Wrapped.Coordinates(ref NorthSouth, ref EastWest))
{
return new CoordsObject(NorthSouth, EastWest);
}
return null;
}
///
/// Gets this object's current offset in its landblock, or null
/// if this object doesn't have an offset (if it's in a container, etc.)
///
/// The offset of this object, or null if this object
/// doesn't have an offset.
public Vector3Object Offset()
{
double x = 0.0;
double y = 0.0;
double z = 0.0;
if (base.Wrapped.Offset(out x, out y, out z))
{
return new Vector3Object(x, y, z);
}
return null;
}
///
/// Gets a quaternion representing the orientation of this object, or
/// null if this object doesn't have an orientation (if it's in
/// a container, etc.)
///
/// The orientation of this object, or null if this
/// object doesn't have an orientation.
public Vector4Object Orientation()
{
double w = 0.0;
double x = 0.0;
double y = 0.0;
double z = 0.0;
if (base.Wrapped.Orientation(out w, out x, out y, out z))
{
return new Vector4Object(w, x, y, z);
}
return null;
}
///
/// Gets the raw coordinates of this object, or null if this
/// object doesn't have coordinates (if it's in a container, etc.)
///
/// The raw coordinates of this object, or null if this
/// object doesn't have coordinates.
public Vector3Object RawCoordinates()
{
double pX = 0.0;
double pY = 0.0;
double pZ = 0.0;
if (base.Wrapped.RawCoordinates(ref pX, ref pY, ref pZ))
{
return new Vector3Object(pX, pY, pZ);
}
return null;
}
///
/// Gets the spell ID of one of the spells that this object casts.
///
/// The index in the list of spells.
/// The spell ID.
public int Spell(int index)
{
return base.Wrapped.Spell(index);
}
}