Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.action.ItemFramework.ItemBundle Class Reference

Helper class for bundling non-bundleable items More...

Inheritance diagram for essentials.action.ItemFramework.ItemBundle:
essentials.action.ItemFramework.ItemBase essentials.action.ItemFramework.IItemQuantityBundleable pluginbase.Objects.Syncable.SyncableObject essentials.action.ItemFramework.IItem essentials.action.ItemFramework.IItemQuantity pluginbase.Objects.Syncable.SyncableBase< T > pluginbase.Objects.Syncable.INetSyncable essentials.action.ItemFramework.IItem pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetWatcher pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetWatcher pluginbase.Objects.Syncable.INetWatcher

Public Member Functions

 ItemBundle ()
 
 ItemBundle (IItem item, int quantity)
 
 ItemBundle (IItem item)
 
IItem RemoveOne ()
 Remove a representation of a single item in the bundle More...
 
void AddOne ()
 Add one item to a given bundle More...
 
bool Is< T > ()
 
bool StacksWith (IItem item)
 Gets whether or not this stack can stack with another item More...
 
IItemQuantity Split (int count)
 Splits the stack into another stack of a count, removing the items from this stack More...
 
- Public Member Functions inherited from essentials.action.ItemFramework.ItemBase
 ItemBase ()
 
override string ToString ()
 
- Public Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
 SyncableObject ()
 Initializes a new instance of the pluginbase.Objects.Syncable.SyncableObject class. More...
 

Protected Member Functions

override System.Drawing.Bitmap LoadIcon ()
 Loads the bitmap representing the image of the item More...
 
override IReadonlyModel LoadModel ()
 Loads the mesh representing the model in-world More...
 
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
sealed override void ResetWatch ()
 Reset variables watched status More...
 
sealed override void TouchRecurse ()
 Touch self, including all children of this syncable object More...
 
sealed override void EncodeTo (BinaryWriter writer, EncodeContext context)
 Encode changes to binary data More...
 
sealed override void DecodeFrom (BinaryReader reader, DecodeContext context)
 Decode changes from binary data More...
 
sealed override void Persist (IPersistObject obj)
 Build up a persistant object for this syncable, including all sync children and persist objects More...
 
sealed override void Load (IReadPersistObject obj)
 Load a given persistent object back into this instance More...
 
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableBase< T >
void Touch ()
 Touch the instance, notifying something has changed More...
 
virtual void OnChanged ()
 Raises the changed event. More...
 

Properties

int Quantity [get, set]
 
IItem Item [get]
 
override string Name [get]
 
override string IconLabel [get]
 
override string Icon [get]
 
- Properties inherited from essentials.action.ItemFramework.ItemBase
abstract string Icon [get]
 Gets the path to the icon More...
 
abstract string Name [get]
 Gets the name of the item More...
 
virtual string IconLabel [get]
 
virtual string Description [get]
 
virtual string MeshResource [get]
 
virtual string ModelImage [get]
 
virtual int MeshalizerResolution [get]
 
virtual float MeshalizerDepth [get]
 
virtual float ModelSize [get]
 
virtual ItemRenderMode ItemRenderMode [get]
 
virtual string ModelCacheKey [get]
 
virtual bool ShowNameplate [get]
 
virtual bool Bounce [get]
 
virtual bool AutoDespawn [get]
 
virtual TimeSpan AutoDespawnDelay [get]
 
virtual bool HasGravity [get]
 
virtual double ViewDistance [get]
 
- Properties inherited from pluginbase.Objects.Syncable.SyncableObject
virtual ushort NetOwnerId [get]
 Gets the network owner of this object (user id) More...
 
- Properties inherited from pluginbase.Objects.Syncable.INetSyncable
INetWatcher Watcher [get, set]
 Who is watching (who to inform of a change) More...
 
bool Modified [get]
 Gets a value indicating whether this pluginbase.Objects.Syncable.INetSyncable is modified. More...
 
- Properties inherited from essentials.action.ItemFramework.IItem
string Name [get]
 The human-readable name of the item More...
 
string IconLabel [get]
 Gets the wording that can appear over a icon More...
 
bool ShowNameplate [get]
 Whether or not to show the nameplate above the item More...
 
bool Bounce [get]
 Whether or not the item should bounce in the world More...
 
bool AutoDespawn [get]
 Whether or not the item should be subject to auto-despawn More...
 
TimeSpan AutoDespawnDelay [get]
 The amount of time the auto despawn will take, if set (Overrides global default) More...
 
bool HasGravity [get]
 Whether or not gravity affects the item More...
 
double ViewDistance [get]
 The distance from which the dropped item can be viewed More...
 
- Properties inherited from essentials.action.ItemFramework.IItemQuantity
int Quantity [get, set]
 Gets or sets the quantity of the stack More...
 

Additional Inherited Members

- Protected Attributes inherited from essentials.action.ItemFramework.ItemBase
readonly IModelFactory ModelFactory
 
readonly IPluginLogger Logger
 
- Events inherited from pluginbase.Objects.Syncable.SyncableBase< T >
Action< T > Changed
 Event triggered when any change occurs on this object, either locally or over the network More...
 
Action< T > NetUpdate
 Event triggered when a change occurs resulting from a change over the network More...
 
Action< T > Touched
 Event occurs only when an object is first touched. Usually the first instance of a local-change More...
 

Detailed Description

Helper class for bundling non-bundleable items

Constructor & Destructor Documentation

essentials.action.ItemFramework.ItemBundle.ItemBundle ( )
37  {
38  }
essentials.action.ItemFramework.ItemBundle.ItemBundle ( IItem  item,
int  quantity 
)
41  {
42  this._itemSync.Value = item;
43  this._quantitySync.Value = quantity;
44  }
essentials.action.ItemFramework.ItemBundle.ItemBundle ( IItem  item)
47  :this(item, 1)
48  { }

Member Function Documentation

void essentials.action.ItemFramework.ItemBundle.AddOne ( )

Add one item to a given bundle

Implements essentials.action.ItemFramework.IItemQuantityBundleable.

61  {
62  this.Quantity++;
63  }
int Quantity
Definition: ItemBundle.cs:20
bool essentials.action.ItemFramework.ItemBundle.Is< T > ( )
66  {
67  return typeof(T) == this._itemSync.Type;
68  }
override System.Drawing.Bitmap essentials.action.ItemFramework.ItemBundle.LoadIcon ( )
protectedvirtual

Loads the bitmap representing the image of the item

Returns
The icon.

Reimplemented from essentials.action.ItemFramework.ItemBase.

108  {
109  if (this.Item != null)
110  {
111  return this.Item.LoadIcon();
112  }
113  return base.LoadIcon();
114  }
Bitmap LoadIcon()
Loads the bitmap representing the image of the item
IItem Item
Definition: ItemBundle.cs:32
override IReadonlyModel essentials.action.ItemFramework.ItemBundle.LoadModel ( )
protectedvirtual

Loads the mesh representing the model in-world

Returns
The model.

Reimplemented from essentials.action.ItemFramework.ItemBase.

117  {
118  if (this.Item != null)
119  {
120  return this.Item.LoadModel();
121  }
122  return base.LoadModel();
123  }
IReadonlyModel LoadModel()
Loads the mesh representing the model in-world
IItem Item
Definition: ItemBundle.cs:32
IItem essentials.action.ItemFramework.ItemBundle.RemoveOne ( )

Remove a representation of a single item in the bundle

Returns
The one.

Implements essentials.action.ItemFramework.IItemQuantityBundleable.

51  {
52  if (this.Quantity > 0)
53  {
54  this.Quantity--;
55  return (IItem)Activator.CreateInstance(this._itemSync.Type);
56  }
57  return null;
58  }
int Quantity
Definition: ItemBundle.cs:20
IItemQuantity essentials.action.ItemFramework.ItemBundle.Split ( int  count)

Splits the stack into another stack of a count, removing the items from this stack

Parameters
countCount.

Implements essentials.action.ItemFramework.IItemQuantity.

77  {
78  int splitCount = Math.Min(count, this.Quantity);
79  this.Quantity -= splitCount;
80  return new ItemBundle(this.Item, splitCount);
81  }
int Quantity
Definition: ItemBundle.cs:20
ItemBundle()
Definition: ItemBundle.cs:36
IItem Item
Definition: ItemBundle.cs:32
bool essentials.action.ItemFramework.ItemBundle.StacksWith ( IItem  item)

Gets whether or not this stack can stack with another item

Returns
true, if with was stacksed, false otherwise.
Parameters
itemItem.

Implements essentials.action.ItemFramework.IItemQuantity.

71  {
72  var bundle = item as ItemBundle;
73  return bundle != null && bundle._itemSync.Type == this._itemSync.Type;
74  }
ItemBundle()
Definition: ItemBundle.cs:36

Property Documentation

override string essentials.action.ItemFramework.ItemBundle.Icon
getprotected
override string essentials.action.ItemFramework.ItemBundle.IconLabel
get
IItem essentials.action.ItemFramework.ItemBundle.Item
get
override string essentials.action.ItemFramework.ItemBundle.Name
get
int essentials.action.ItemFramework.ItemBundle.Quantity
getset

The documentation for this class was generated from the following file: