Atavism Version 2018.1AGIS API

atavism.server.plugins
Class InventoryPlugin

java.lang.Object
  extended by atavism.server.engine.EnginePlugin
      extended by atavism.server.plugins.InventoryPlugin
All Implemented Interfaces:
MessageCallback, StatusMapCallback
Direct Known Subclasses:
AgisInventoryPlugin

public abstract class InventoryPlugin
extends EnginePlugin
implements MessageCallback

handles all inventory queries (what is in the inventory) and also transfering items between containers


Nested Class Summary
 
Nested classes/interfaces inherited from class atavism.server.engine.EnginePlugin
EnginePlugin.DeleteHook, EnginePlugin.DeleteSubObjHook, EnginePlugin.GenerateSubObjectHook, EnginePlugin.GetPropertyMessage, EnginePlugin.GetPropertyNamesMessage, EnginePlugin.LoadHook, EnginePlugin.LoadSubObjHook, EnginePlugin.PluginActivateHook, EnginePlugin.PluginStateMessage, EnginePlugin.SaveHook, EnginePlugin.SaveSubObjHook, EnginePlugin.SetPropertyMessage, EnginePlugin.SubObjData, EnginePlugin.TransferFilter, EnginePlugin.TransferObjectMessage, EnginePlugin.UnloadHook, EnginePlugin.UnloadSubObjHook
 
Field Summary
static java.lang.String INVENTORY_PLUGIN_NAME
           
static java.lang.String INVENTORY_PROP_BACKREF_KEY
           
static java.lang.String INVENTORY_PROP_BAG_KEY
           
protected  java.util.concurrent.locks.Lock lock
           
protected static Logger log
           
 
Fields inherited from class atavism.server.engine.EnginePlugin
deleteSubObjectSubscription, dumpAllThreadSubscription, dumpAllThreadSubscriptionLock, loadSubObjectSubscription, MSG_TYPE_DUMP_ALL_THREAD_STACKS, MSG_TYPE_GET_PROPERTY, MSG_TYPE_GET_PROPERTY_NAMES, MSG_TYPE_PLUGIN_STATE, MSG_TYPE_SET_PROPERTY, MSG_TYPE_SET_PROPERTY_NONBLOCK, MSG_TYPE_TRANSFER_OBJECT, pluginStateSubscription, propertySubscription, saveSubObjectSubscription, selectionFilter, selectionSubscription, setSubObjectPersistenceSubscription, subObjectSubscription, unloadSubObjectSubscription
 
Fields inherited from interface atavism.msgsys.MessageCallback
NO_FLAGS, RESPONSE_EXPECTED
 
Constructor Summary
InventoryPlugin()
           
 
Method Summary
protected abstract  boolean activateObject(OID objOid, OID activatorOid, OID targetOid)
           
protected abstract  boolean addItem(OID mobOid, OID containerOid, OID itemOid)
           
protected abstract  boolean containsItem(OID ownerOid, OID itemOid)
          returns whether or not the mob contains the given item
protected abstract  EnginePlugin.SubObjData createInvSubObj(OID masterOid, Template template)
          creates an inventory for the mob returns the bag, or null on failure
protected abstract  EnginePlugin.SubObjData createItemSubObj(OID mobOid, Template template)
          creates an inventory item sub object returns the oid, or null on failure
protected abstract  void deleteInventory(Entity e)
          Clean up when deleting an inventory sub object
protected  void deleteInventory(OID oid)
          Clean up when deleting an inventory item
protected abstract  void deleteItem(Entity e)
          Clean up when deleting an inventory item
protected  void deleteItem(OID oid)
          Clean up when deleting an inventory item
protected  boolean destroyItem(OID containerOid, OID itemOid)
           
abstract  boolean equipItem(AOObject item, OID activateOid, boolean replace)
           
protected abstract  OID findItem(OID mobOid, int template)
           
protected abstract  java.util.ArrayList<OID> findItems(OID mobOid, java.util.ArrayList<java.lang.Integer> templateList)
           
 java.util.concurrent.locks.Lock getLock()
           
protected abstract  void loadInventory(Entity e)
          performs setup required after loading an inventory sub object
protected abstract  void loadItem(Entity e)
          performs setup required after loading an inventory item
protected abstract  boolean lootAll(OID looterOid, OID mobOid)
          used to loot objects from a mob, or some other top level container object, such as a chest
 void onActivate()
          for developers extending the EnginePlugin object, it may be easier to use the onActivate() method which gets called when the plugin is being activated by the Engine.
protected  void registerHooks()
           
protected abstract  OID removeItem(OID mobOid, int template, boolean removeFromPlayer)
           
protected abstract  OID removeItem(OID mobOid, OID itemOid, boolean removeFromPlayer)
           
protected abstract  boolean removeItemFromBag(OID rootBagOid, OID itemOid)
          removes item from the bag
protected abstract  java.util.ArrayList<OID> removeItems(OID MobOid, java.util.ArrayList<java.lang.Integer> templateList, boolean removeFromPlayer)
           
protected abstract  void saveInventory(Entity e, Namespace namespace)
          performs work required after saving an inventory sub object
protected abstract  void saveItem(Entity e, Namespace namespace)
          performs work required after saving an inventory item
protected abstract  void sendInvUpdate(OID mobOid)
          sends an inventory update message to the client
protected abstract  void unloadInventory(Entity e)
          Clean up when unloading an inventory sub object
protected abstract  void unloadItem(Entity e)
          Clean up when unloading an inventory item
abstract  void updateObject(OID mobOid, OID target)
          creates inventory if necessary or loads from database
 
Methods inherited from class atavism.server.engine.EnginePlugin
activate, createMBeanInstance, createSubscription, getHookManager, getMessageHandler, getName, getObjectLockManager, getObjectProperties, getObjectProperties, getObjectProperty, getObjectPropertyNames, getPercentCPULoad, getPluginAvailable, getPluginInfo, getPluginNamespaces, getPluginState, getPluginStatus, getPluginType, getPropertyImpl, getPropertyNamesImpl, getStatusMap, handleMessage, handleMessageImpl, logDepsOutstanding, processKeysAndValues, registerActivateHook, registerDeleteHook, registerLoadHook, registerPluginNamespace, registerPluginNamespaces, registerPluginNamespaces, registerPluginNamespaces, registerSaveHook, registerTransferHook, registerUnloadHook, sendSubObjectResponse, sendSubObjectResponse, sendSubObjectResponse, setMessageHandler, setName, setObjectProperties, setObjectProperties, setObjectProperties, setObjectPropertiesNoResponse, setObjectPropertiesNoResponse, setObjectPropertiesNoResponse, setObjectProperty, setObjectPropertyNoResponse, setPercentCPULoad, setPluginAvailable, setPluginInfo, setPluginType, setPropertyImpl, transferObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atavism.msgsys.MessageCallback
handleMessage
 

Field Detail

INVENTORY_PLUGIN_NAME

public static java.lang.String INVENTORY_PLUGIN_NAME

log

protected static final Logger log

lock

protected java.util.concurrent.locks.Lock lock

INVENTORY_PROP_BAG_KEY

public static final java.lang.String INVENTORY_PROP_BAG_KEY
See Also:
Constant Field Values

INVENTORY_PROP_BACKREF_KEY

public static final java.lang.String INVENTORY_PROP_BACKREF_KEY
See Also:
Constant Field Values
Constructor Detail

InventoryPlugin

public InventoryPlugin()
Method Detail

onActivate

public void onActivate()
Description copied from class: EnginePlugin
for developers extending the EnginePlugin object, it may be easier to use the onActivate() method which gets called when the plugin is being activated by the Engine. this is an alternative to calling registerActivateHook()

Overrides:
onActivate in class EnginePlugin

registerHooks

protected void registerHooks()

updateObject

public abstract void updateObject(OID mobOid,
                                  OID target)
creates inventory if necessary or loads from database


equipItem

public abstract boolean equipItem(AOObject item,
                                  OID activateOid,
                                  boolean replace)

activateObject

protected abstract boolean activateObject(OID objOid,
                                          OID activatorOid,
                                          OID targetOid)

createInvSubObj

protected abstract EnginePlugin.SubObjData createInvSubObj(OID masterOid,
                                                           Template template)
creates an inventory for the mob returns the bag, or null on failure


createItemSubObj

protected abstract EnginePlugin.SubObjData createItemSubObj(OID mobOid,
                                                            Template template)
creates an inventory item sub object returns the oid, or null on failure


loadInventory

protected abstract void loadInventory(Entity e)
performs setup required after loading an inventory sub object


loadItem

protected abstract void loadItem(Entity e)
performs setup required after loading an inventory item


unloadInventory

protected abstract void unloadInventory(Entity e)
Clean up when unloading an inventory sub object


unloadItem

protected abstract void unloadItem(Entity e)
Clean up when unloading an inventory item


deleteInventory

protected abstract void deleteInventory(Entity e)
Clean up when deleting an inventory sub object


deleteInventory

protected void deleteInventory(OID oid)
Clean up when deleting an inventory item


deleteItem

protected abstract void deleteItem(Entity e)
Clean up when deleting an inventory item


deleteItem

protected void deleteItem(OID oid)
Clean up when deleting an inventory item


saveInventory

protected abstract void saveInventory(Entity e,
                                      Namespace namespace)
performs work required after saving an inventory sub object


saveItem

protected abstract void saveItem(Entity e,
                                 Namespace namespace)
performs work required after saving an inventory item


sendInvUpdate

protected abstract void sendInvUpdate(OID mobOid)
sends an inventory update message to the client


addItem

protected abstract boolean addItem(OID mobOid,
                                   OID containerOid,
                                   OID itemOid)

removeItemFromBag

protected abstract boolean removeItemFromBag(OID rootBagOid,
                                             OID itemOid)
removes item from the bag


lootAll

protected abstract boolean lootAll(OID looterOid,
                                   OID mobOid)
used to loot objects from a mob, or some other top level container object, such as a chest

Parameters:
looterOid - player/mob that is looting
mobOid - where you are looting from
Returns:
success or failure

containsItem

protected abstract boolean containsItem(OID ownerOid,
                                        OID itemOid)
returns whether or not the mob contains the given item

Parameters:
ownerOid - the player/mob to check against
itemOid - the item you are checking against
Returns:
true if mob contains item, false otherwise

findItem

protected abstract OID findItem(OID mobOid,
                                int template)

findItems

protected abstract java.util.ArrayList<OID> findItems(OID mobOid,
                                                      java.util.ArrayList<java.lang.Integer> templateList)

removeItem

protected abstract OID removeItem(OID mobOid,
                                  OID itemOid,
                                  boolean removeFromPlayer)

removeItem

protected abstract OID removeItem(OID mobOid,
                                  int template,
                                  boolean removeFromPlayer)

removeItems

protected abstract java.util.ArrayList<OID> removeItems(OID MobOid,
                                                        java.util.ArrayList<java.lang.Integer> templateList,
                                                        boolean removeFromPlayer)

destroyItem

protected boolean destroyItem(OID containerOid,
                              OID itemOid)

getLock

public java.util.concurrent.locks.Lock getLock()


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