Atavism Version 2018.1AGIS API

atavism.agis.objects
Class Bag

java.lang.Object
  extended by atavism.server.objects.NamedPropertyClass
      extended by atavism.server.objects.Entity
          extended by atavism.agis.objects.Bag
All Implemented Interfaces:
java.io.Serializable

public class Bag
extends Entity

a bag used to hold objects, either items or other bags

See Also:
Serialized Form

Field Summary
static int BAG_USE_TYPE_EQUIPPED
           
static int BAG_USE_TYPE_STANDARD
           
static int BAG_USE_TYPE_STORAGE
           
 
Fields inherited from class atavism.server.objects.Entity
log, staticLock, subObjectNamespacesInt, transientPropertyKeys, type
 
Fields inherited from class atavism.server.objects.NamedPropertyClass
lock, name
 
Constructor Summary
Bag()
           
Bag(int numSlots)
           
Bag(int id, int numSlots)
           
Bag(OID oid)
           
 
Method Summary
 int addChestLocks(int amount, OID chestLock)
          Adds a specific amount of locks to the chest and returns the leftover amount if the limit is reached.
 boolean addItem(OID oid)
          add item to next available slot
 void applySettings(int numSlots, int useType)
          Applies the settings for the bag.
 java.lang.Integer findItem(OID itemOid)
          returns the slotnumber where the item is located in this bag, or null if not found
 OID getChestLock()
           
 OID getItem(int slotNum)
           
 OID[] getItemsList()
           
 int getItemTemplateID()
           
 int getLockLimit()
           
 int getNumLocks()
           
 int getNumSlots()
           
 ObjectType getType()
          Entity object type.
 int getUseType()
           
 boolean isEmpty()
           
 boolean isLockable()
           
 boolean isLocked()
           
 int itemCount()
           
 boolean putItem(int slotNum, OID itemOid)
          places item into specified slot. slotNum starts with 0 returns false if there already is an item
 void removeChestLocks(int amount)
           
 boolean removeItem(OID oid)
           
 void setChestLock(OID chestLock)
           
 void setItemsList(OID[] items)
          java beans paradigm for saving into the databse
 void setItemTemplateID(int id)
           
 void setLockable(boolean lockable)
           
 void setLocked()
           
 void setLockLimit(int lockLimit)
           
 void setNumLocks(int numLocks)
           
 void setNumSlots(int numSlots)
           
 void setUseType(int useType)
           
 
Methods inherited from class atavism.server.objects.Entity
addSubObjectNamespace, equals, equals, getLock, getNamespace, getOid, getPersistenceFlag, getProperty, getSubObjectNamespaces, getSubObjectNamespacesInt, getTransientDataRef, hashCode, hasSubObjectNamespace, isDeleted, registerTransientPropertyKey, removeProperty, removeSubObjectNamespace, setDeleted, setNamespace, setOid, setPersistenceFlag, setProperty, setSubObjectNamespaces, setSubObjectNamespacesInt, setType, toBytes, toString, unregisterTransientPropertyKey
 
Methods inherited from class atavism.server.objects.NamedPropertyClass
getBooleanProperty, getIntProperty, getName, getPropertyMap, getPropertyMapRef, getStringProperty, lock, modifyIntProperty, setName, setPropertyMap, setupTransient, unlock
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BAG_USE_TYPE_STANDARD

public static final int BAG_USE_TYPE_STANDARD
See Also:
Constant Field Values

BAG_USE_TYPE_EQUIPPED

public static final int BAG_USE_TYPE_EQUIPPED
See Also:
Constant Field Values

BAG_USE_TYPE_STORAGE

public static final int BAG_USE_TYPE_STORAGE
See Also:
Constant Field Values
Constructor Detail

Bag

public Bag()

Bag

public Bag(OID oid)

Bag

public Bag(int numSlots)

Bag

public Bag(int id,
           int numSlots)
Method Detail

applySettings

public void applySettings(int numSlots,
                          int useType)
Applies the settings for the bag. WARNING: this will clear the currentItems.

Parameters:
numSlots -
useType -

getType

public ObjectType getType()
Description copied from class: Entity
Entity object type.

Overrides:
getType in class Entity
Returns:
ObjectTypes.unknown if no object type has been set.

getNumSlots

public int getNumSlots()

setNumSlots

public void setNumSlots(int numSlots)

getItemTemplateID

public int getItemTemplateID()

setItemTemplateID

public void setItemTemplateID(int id)

getUseType

public int getUseType()

setUseType

public void setUseType(int useType)

putItem

public boolean putItem(int slotNum,
                       OID itemOid)
places item into specified slot. slotNum starts with 0 returns false if there already is an item


getItem

public OID getItem(int slotNum)

addItem

public boolean addItem(OID oid)
add item to next available slot


removeItem

public boolean removeItem(OID oid)

setItemsList

public void setItemsList(OID[] items)
java beans paradigm for saving into the databse


getItemsList

public OID[] getItemsList()

isEmpty

public boolean isEmpty()

itemCount

public int itemCount()

findItem

public java.lang.Integer findItem(OID itemOid)
returns the slotnumber where the item is located in this bag, or null if not found

Parameters:
itemOid - oid for the item you are looking for
Returns:
slotnumber or null if not found

getNumLocks

public int getNumLocks()

setNumLocks

public void setNumLocks(int numLocks)

getChestLock

public OID getChestLock()

setChestLock

public void setChestLock(OID chestLock)

addChestLocks

public int addChestLocks(int amount,
                         OID chestLock)
Adds a specific amount of locks to the chest and returns the leftover amount if the limit is reached.

Parameters:
amount -
chestLock -
Returns:

removeChestLocks

public void removeChestLocks(int amount)

isLocked

public boolean isLocked()

isLockable

public boolean isLockable()

setLockable

public void setLockable(boolean lockable)

getLockLimit

public int getLockLimit()

setLockLimit

public void setLockLimit(int lockLimit)

setLocked

public void setLocked()


Copyright © 2018 Dragonsan Studios Sp. z o.o.