|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatavism.server.engine.EnginePlugin
atavism.server.plugins.InventoryPlugin
atavism.agis.plugins.AgisInventoryPlugin
public class AgisInventoryPlugin
The AgisInventoryPlugin is the manager of Inventory for players and mobs and all related areas such as Trading, Looting, and Mail. The Plugin creates and works with the Inventory Sub Object, which contains the players inventory (their bags, mailbox and eventually their bank). The Plugin is set up with Hooks for many Inventory related messages and loads in the players inventory sub object to get the information requested or make the changes needed.
Nested Class Summary | |
---|---|
class |
AgisInventoryPlugin.CancelTradeInviteTimer
|
class |
AgisInventoryPlugin.CategoryUpdatedHook
Handles the CategoryUpdatedMessage to indicate the player has changed world category. |
protected class |
AgisInventoryPlugin.CreateInventoryHook
Hook for the CreateInventoryMessage. |
static class |
AgisInventoryPlugin.EquipMap
Helper class used to track what item can be equipped in what slot. |
static class |
AgisInventoryPlugin.ItemAcquireResult
|
class |
AgisInventoryPlugin.LockpickHook
|
Fields inherited from class atavism.server.plugins.InventoryPlugin |
---|
INVENTORY_PLUGIN_NAME, INVENTORY_PROP_BACKREF_KEY, INVENTORY_PROP_BAG_KEY, lock |
Fields inherited from interface atavism.msgsys.MessageCallback |
---|
NO_FLAGS, RESPONSE_EXPECTED |
Constructor Summary | |
---|---|
AgisInventoryPlugin()
|
Method Summary | |
---|---|
protected AgisInventoryPlugin.ItemAcquireResult |
accountItemAcquired(OID oid,
int templateID,
int count)
Old function that should be deleted. |
protected boolean |
activateObject(OID objOid,
OID activatorOid,
OID targetOid)
Activates the item. |
protected boolean |
addItem(OID mobOid,
OID rootBagOid,
OID itemOid)
adds the item to the container item must not be in a container already sets the item's containedBy backlink to the container |
protected boolean |
addItemHelper(OID ownerOid,
OID subBagOid,
int slotNum,
AgisItem item)
Helper function for the addItem function. |
void |
alterMobCurrency(OID mobOid,
int currencyID,
int delta)
Changes the amount of the specified currency for the player by the specified amount. |
void |
completeTrade(TradeSession tradeSession)
Completes the Trade moving the items offered between the two players. |
protected boolean |
containsItem(OID mobOid,
OID itemOid)
Returns whether or not the mob contains the given item |
protected void |
createBags(InventoryInfo iInfo,
OID mobOid,
boolean isPlayer)
Creates a new set of Bags and inventory to be placed in an existing InventoryInfo. |
protected void |
createInventoryItems(OID masterOid,
InventoryInfo iInfo,
java.lang.String invItems)
Generates the items requested and puts them in the players/mobs inventory. |
EnginePlugin.SubObjData |
createInvSubObj(OID mobOid,
Template template)
Creates the InventoryInfo for the for the specified player/mob. |
protected EnginePlugin.SubObjData |
createItemSubObj(OID masterOid,
Template template)
Creates an AgisItem from the Template specified. |
protected void |
deleteInventory(Entity e)
Deletes a InventoryInfo object from the internal object database. |
protected void |
deleteItem(Entity item)
Deletes an AgisItem from the internal object database. |
boolean |
equipItem(AOObject itemObj,
OID activatorOid,
boolean replace)
|
boolean |
equipItem(AOObject itemObj,
OID activatorOid,
boolean replace,
AgisEquipSlot targetSlot)
Equips the item to its primary slot on the player/mob. |
protected OID |
findItem(OID mobOid,
AgisEquipSlot slot)
Finds an equipped item |
protected OID |
findItem(OID mobOid,
int templateID)
finds an item based on the template name |
protected boolean |
findItemHelper(OID mobOid,
InventoryInfo iInfo,
int templateID,
java.util.ArrayList<OID> resultList)
Helper function for the findItem and findItems functions. |
protected java.util.ArrayList<OID> |
findItems(OID mobOid,
java.util.ArrayList<java.lang.Integer> templateList)
Finds items in the players inventory that match one of the template IDs specified. |
protected java.util.ArrayList<OID> |
findItemStacks(OID mobOid,
int templateID)
Finds all stacks of items matching the templateID that the player has. |
protected void |
findItemStacksHelper(OID mobOid,
InventoryInfo iInfo,
int templateID,
java.util.ArrayList<OID> resultList)
Helper function for the findItemStacks function. |
static AgisItem |
getAgisItem(OID oid)
Returns the AgisItem Entity for the specified OID. |
static java.util.List<java.lang.Float> |
getArmourSlotModifier(java.lang.String armourSlot)
|
static java.util.List<java.lang.Float> |
getArmourTypeModifier(java.lang.String armourType)
|
static Bag |
getBag(OID activatorOid)
Returns the Bag Entity for the specified OID. |
AgisInventoryPlugin.EquipMap |
getEquipMap(OID activatorOid)
Gets the EquipMap for the player/mob. |
static float |
getGradeModifier(int grade)
|
static InventoryInfo |
getInventoryInfo(OID oid)
Returns the InventoryInfo Entity for the specified OID. |
int |
getMobCurrency(OID mobOid,
int currencyID)
Gets the amount of the specified currency the mob specified has. |
static float |
getSlotModifier(java.lang.String slot)
|
static float |
getStatModifier(java.lang.String statName)
|
boolean |
hasSpace(OID looterOid,
java.util.HashMap<java.lang.Integer,java.lang.Integer> items,
int invType)
Checks if the player has enough space in their inventory for the items being added. |
boolean |
hasSpace(OID looterOid,
int itemID,
int count,
int invType)
Checks if the player has enough space in their inventory for the items being added. |
boolean |
isItemEquipped(AOObject itemObj,
OID activatorOid)
Checks if the item specified is equipped by the player. |
protected void |
loadInventory(Entity e)
Loads the players inventory from the internal object database then sends down the inventory information to their client. |
protected void |
loadItem(Entity e)
Does nothing. |
void |
loadItemsFromDatabase(ItemDatabase iDB)
Loads in item templates from the database and registers them. |
protected void |
loadMailItems(OID oid)
|
protected boolean |
loadSubBag(OID subBagOid,
Entity rootBag)
Loads a Bag that resides inside another Bag from the internal object database. |
protected boolean |
lootAll(OID looterOid,
OID mobOid)
NOT USED. |
protected boolean |
lootAllHelper(OID looterOid,
Bag looterRootBag,
OID mobOid,
Bag mobRootBag,
Bag mobSubBag)
|
void |
onActivate()
Run on activation, this function sets up the Hooks and filters for the messages the plugin deals with. |
boolean |
placeEquippedItem(OID activatorOid,
OID itemOid,
AgisEquipSlot slot)
Places an equipped item in the correct slot that it belongs in |
static void |
registerAgisItem(AgisItem item)
Registers the AgisItem in the Item Namespace. |
static void |
registerBag(Bag bag)
Registers the Bag Entity in the Bag Namespace. |
static void |
registerInventoryInfo(InventoryInfo iInfo)
Registers the InventoryInfo in the Item Namespace. |
protected java.util.ArrayList<OID> |
removeAllItems(OID mobOid)
Removes all items from the players inventory that match one of the template IDs specified. |
boolean |
removeEquippedItem(OID activatorOid,
OID itemOid,
AgisEquipSlot slot)
Removes an equipped item from the equipped items bag |
protected OID |
removeItem(OID mobOid,
int template,
boolean removeFromPlayer)
Removes an item from the players inventory that matches the specified templateID |
protected OID |
removeItem(OID mobOid,
OID itemOid,
boolean removeFromPlayer)
Removes the specified item from the player. |
protected boolean |
removeItemFromBag(OID rootBagOid,
OID itemOid)
Removes an item from a Bag. |
protected boolean |
removeItemFromBagHelper(OID subBagOid,
Entity item)
Helper function for the removeItemFromBag function. |
protected OID |
removeItemFromStorage(OID mobOid,
OID itemOid,
boolean removeFromPlayer)
|
protected java.util.ArrayList<OID> |
removeItems(OID mobOid,
java.util.ArrayList<java.lang.Integer> templateList,
boolean removeFromPlayer)
Removes all items from the players inventory that match one of the template IDs specified. |
protected void |
saveInventory(Entity e,
Namespace namespace)
Saves an InventoryInfo object into the internal object database. |
protected void |
saveItem(Entity e,
Namespace namespace)
Does nothing. |
protected void |
sendBagInvUpdate(OID mobOid)
Sends down the Bags and Items found in the players Inventory. |
protected void |
sendBankInvUpdate(OID mobOid,
java.lang.String storageKey,
OID storageBagOid)
Sends down the Bags and Items found in the players Inventory. |
protected void |
sendEquippedInvUpdate(OID mobOid)
Sends the equipped inventory bag information to the player. |
protected void |
sendInvUpdate(OID mobOid)
Calls the sendEquippedInvUpdate and the sendBagInvUpdate functions. |
void |
sendLockpickLootList(OID playerOid,
OID itemOid,
OID bagOid,
int count)
Sends down the picked item as loot to the requesting player. |
void |
sendLootList(OID playerOid,
OID mobOid)
Sends down the list of loot from the specified mob to the requesting player. |
protected void |
sendStorageInvUpdate(OID mobOid)
Sends down the Bags and Items found in the players Inventory. |
protected static void |
sendTradeComplete(OID trader1,
OID trader2,
byte status)
send an ao.TRADE_COMPLETE message to trader1, telling it that a trade with trader2 has completed |
static void |
sendTradeOfferUpdate(OID trader1,
OID trader2,
TradeSession tradeSession)
Sends down the updated list of offers to players involved in the Trade. |
protected static java.util.ArrayList<java.util.ArrayList> |
sendTradeOfferUpdateHelper(OID traderOid,
TradeSession tradeSession)
Helper function for the sendTradeOfferUpdate function. |
protected static void |
sendTradeStart(OID trader1,
OID trader2)
sends an ao.TRADE_START message to trader1 telling it that a trade has started with trader2 |
void |
setDirty(OID mobOid)
Sets the InventoryInfo for the player to dirty causing it to be saved to the internal object database. |
protected void |
swapItemPositions(OID playerOid,
OID itemOid,
int bagNum2,
int slotNum2)
Swaps the bag/slots of two items. |
void |
swapLockPositions(OID playerOid,
OID itemOid,
int itemAmount,
int bagNum,
int slotNum)
Swaps the bag/slots of two locks. |
boolean |
unequipItem(AOObject itemObj,
OID activatorOid,
boolean isReplaced)
|
boolean |
unequipItem(AOObject itemObj,
OID activatorOid,
boolean isReplaced,
Bag targetBag,
int slotNum,
boolean destroyItem)
Unequips the specified item. |
boolean |
unequipItem(AOObject itemObj,
OID activatorOid,
boolean isReplaced,
boolean destroyItem)
|
protected void |
unloadInventory(Entity e)
Unloads the players inventory object. |
protected void |
unloadItem(Entity e)
DOes nothing. |
void |
updateObject(OID mobOid,
OID target)
Called when an object is updated, sending information about the inventory to the client. |
boolean |
validateTradeCurrencyOffer(OID trader,
java.util.HashMap<java.lang.String,java.lang.Integer> currencyOffer)
Ensures the items offered in the Trade are valid. |
boolean |
validateTradeOffer(OID trader,
java.util.List<OID> offer)
Ensures the items offered in the Trade are valid. |
Methods inherited from class atavism.server.plugins.InventoryPlugin |
---|
deleteInventory, deleteItem, destroyItem, getLock, registerHooks |
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 |
---|
public static final java.lang.String EQUIP_MAP_PROP
public static java.util.HashMap<java.lang.String,java.lang.Float> equipmentSlots
public static java.util.ArrayList<ItemWeight> itemPrefixes
public static java.util.ArrayList<ItemWeight> itemSuffixes
public static java.util.Random random
public static int TRADE_INVITE_TIMEOUT
public static int INVENTORY_BAG_COUNT
public int INVENTORY_FIRST_BAG_SIZE
public int INVENTORY_OTHER_BAG_SIZE
public int EQUIP_SLOTS_COUNT
public static int MAIL_ATTACHMENT_COUNT
public static int MAIL_LIFE_DAYS
public static int MAIL_COD_LIFE_DAYS
public static float SELL_FACTOR
public static float REPAIR_RATE
public int PLAYER_CORPSE_LOOT_DURATION
public int PLAYER_CORPSE_SAFE_LOOT_DURATION
public int PLAYER_CORPSE_MOB_TEMPLATE
public boolean PLAYER_CORPSE_DROPS_EQUIPMENT
public int DURABILITY_LOSS_CHANCE_FROM_ATTACK
public int DURABILITY_LOSS_CHANCE_FROM_DEFEND
public int DURABILITY_LOSS_CHANCE_FROM_GATHER
public int DURABILITY_LOSS_CHANCE_FROM_CRAFT
public boolean DURABILITY_DESTROY_BROKEN_ITEMS
public static boolean GIVE_QUEST_ITEMS_TO_ALL_IN_GROUP
public static int BANK_SLOTS_COUNT
public static int BANK_EXTRA_BAGS_COUNT
public static final java.lang.String bankBagKey
public static AccountDatabase aDB
public static AuthDatabase authDB
Constructor Detail |
---|
public AgisInventoryPlugin()
Method Detail |
---|
public void onActivate()
onActivate
in class InventoryPlugin
public void loadItemsFromDatabase(ItemDatabase iDB)
iDB
- public static AgisItem getAgisItem(OID oid)
oid
-
public static void registerAgisItem(AgisItem item)
item
- public static InventoryInfo getInventoryInfo(OID oid)
oid
-
public static void registerInventoryInfo(InventoryInfo iInfo)
iInfo
- public static Bag getBag(OID activatorOid)
activatorOid
-
public static void registerBag(Bag bag)
bag
- public EnginePlugin.SubObjData createInvSubObj(OID mobOid, Template template)
createInvSubObj
in class InventoryPlugin
protected void createBags(InventoryInfo iInfo, OID mobOid, boolean isPlayer)
iInfo
- mobOid
- protected void createInventoryItems(OID masterOid, InventoryInfo iInfo, java.lang.String invItems)
masterOid
- iInfo
- invItems
- A String with numbers representing the templateIDs of the items to be generated split by semicolons.protected void sendInvUpdate(OID mobOid)
sendInvUpdate
in class InventoryPlugin
protected void sendBagInvUpdate(OID mobOid)
mobOid
- protected void sendEquippedInvUpdate(OID mobOid)
mobOid
- protected void swapItemPositions(OID playerOid, OID itemOid, int bagNum2, int slotNum2)
playerOid
- itemOid
- bagNum2
- slotNum2
- public int getMobCurrency(OID mobOid, int currencyID)
mobOid
- currencyID
-
public void alterMobCurrency(OID mobOid, int currencyID, int delta)
mobOid
- currencyID
- delta
- protected AgisInventoryPlugin.ItemAcquireResult accountItemAcquired(OID oid, int templateID, int count)
oid
- templateID
- count
-
protected static void sendTradeComplete(OID trader1, OID trader2, byte status)
protected static void sendTradeStart(OID trader1, OID trader2)
public boolean validateTradeOffer(OID trader, java.util.List<OID> offer)
trader
- offer
-
public boolean validateTradeCurrencyOffer(OID trader, java.util.HashMap<java.lang.String,java.lang.Integer> currencyOffer)
trader
- offer
-
public static void sendTradeOfferUpdate(OID trader1, OID trader2, TradeSession tradeSession)
trader1
- trader2
- tradeSession
- protected static java.util.ArrayList<java.util.ArrayList> sendTradeOfferUpdateHelper(OID traderOid, TradeSession tradeSession)
traderOid
- tradeSession
-
public void completeTrade(TradeSession tradeSession)
tradeSession
- protected EnginePlugin.SubObjData createItemSubObj(OID masterOid, Template template)
createItemSubObj
in class InventoryPlugin
protected void loadInventory(Entity e)
loadInventory
in class InventoryPlugin
protected boolean loadSubBag(OID subBagOid, Entity rootBag)
subBagOid
- rootBag
-
protected void loadMailItems(OID oid)
protected void unloadInventory(Entity e)
unloadInventory
in class InventoryPlugin
protected void deleteInventory(Entity e)
deleteInventory
in class InventoryPlugin
protected void loadItem(Entity e)
loadItem
in class InventoryPlugin
protected void unloadItem(Entity e)
unloadItem
in class InventoryPlugin
protected void deleteItem(Entity item)
deleteItem
in class InventoryPlugin
protected void saveInventory(Entity e, Namespace namespace)
saveInventory
in class InventoryPlugin
protected void saveItem(Entity e, Namespace namespace)
saveItem
in class InventoryPlugin
protected boolean addItem(OID mobOid, OID rootBagOid, OID itemOid)
addItem
in class InventoryPlugin
protected boolean addItemHelper(OID ownerOid, OID subBagOid, int slotNum, AgisItem item)
subBagOid
- slotNum
- item
-
protected boolean removeItemFromBag(OID rootBagOid, OID itemOid)
removeItemFromBag
in class InventoryPlugin
protected boolean removeItemFromBagHelper(OID subBagOid, Entity item)
subBagOid
- item
-
protected OID removeItemFromStorage(OID mobOid, OID itemOid, boolean removeFromPlayer)
public void updateObject(OID mobOid, OID target)
updateObject
in class InventoryPlugin
public void sendLootList(OID playerOid, OID mobOid)
oid
- mobOid
- public void sendLockpickLootList(OID playerOid, OID itemOid, OID bagOid, int count)
oid
- mobOid
- protected boolean lootAll(OID looterOid, OID mobOid)
lootAll
in class InventoryPlugin
looterOid
- player/mob that is lootingmobOid
- where you are looting from
protected boolean lootAllHelper(OID looterOid, Bag looterRootBag, OID mobOid, Bag mobRootBag, Bag mobSubBag)
protected boolean containsItem(OID mobOid, OID itemOid)
containsItem
in class InventoryPlugin
mobOid
- the player/mob to check againstitemOid
- the item you are checking against
protected OID findItem(OID mobOid, int templateID)
findItem
in class InventoryPlugin
protected java.util.ArrayList<OID> findItemStacks(OID mobOid, int templateID)
mobOid
- templateID
-
protected void findItemStacksHelper(OID mobOid, InventoryInfo iInfo, int templateID, java.util.ArrayList<OID> resultList)
mobOid
- iInfo
- templateID
- resultList
- protected java.util.ArrayList<OID> findItems(OID mobOid, java.util.ArrayList<java.lang.Integer> templateList)
findItems
in class InventoryPlugin
protected boolean findItemHelper(OID mobOid, InventoryInfo iInfo, int templateID, java.util.ArrayList<OID> resultList)
mobOid
- iInfo
- templateID
- resultList
-
protected OID findItem(OID mobOid, AgisEquipSlot slot)
mobOid
- slot
-
protected OID removeItem(OID mobOid, OID itemOid, boolean removeFromPlayer)
removeItem
in class InventoryPlugin
protected OID removeItem(OID mobOid, int template, boolean removeFromPlayer)
removeItem
in class InventoryPlugin
protected java.util.ArrayList<OID> removeItems(OID mobOid, java.util.ArrayList<java.lang.Integer> templateList, boolean removeFromPlayer)
removeItems
in class InventoryPlugin
protected java.util.ArrayList<OID> removeAllItems(OID mobOid)
protected boolean activateObject(OID objOid, OID activatorOid, OID targetOid)
activateObject
in class InventoryPlugin
public boolean isItemEquipped(AOObject itemObj, OID activatorOid)
itemObj
- activatorOid
-
public boolean equipItem(AOObject itemObj, OID activatorOid, boolean replace)
equipItem
in class InventoryPlugin
public boolean equipItem(AOObject itemObj, OID activatorOid, boolean replace, AgisEquipSlot targetSlot)
public boolean unequipItem(AOObject itemObj, OID activatorOid, boolean isReplaced)
public boolean unequipItem(AOObject itemObj, OID activatorOid, boolean isReplaced, boolean destroyItem)
public boolean unequipItem(AOObject itemObj, OID activatorOid, boolean isReplaced, Bag targetBag, int slotNum, boolean destroyItem)
public void swapLockPositions(OID playerOid, OID itemOid, int itemAmount, int bagNum, int slotNum)
playerOid
- itemOid
- bagNum2
- slotNum2
- public boolean hasSpace(OID looterOid, java.util.HashMap<java.lang.Integer,java.lang.Integer> items, int invType)
activatorOid:
- the identifier of the person adding the items to their inventorynumItems:
- how many items are being addedpublic boolean hasSpace(OID looterOid, int itemID, int count, int invType)
activatorOid:
- the identifier of the person adding the items to their inventorynumItems:
- how many items are being addedpublic boolean placeEquippedItem(OID activatorOid, OID itemOid, AgisEquipSlot slot)
activatorOid
- itemOid
- slot
-
public boolean removeEquippedItem(OID activatorOid, OID itemOid, AgisEquipSlot slot)
activatorOid
- itemOid
- slot
-
protected void sendStorageInvUpdate(OID mobOid)
mobOid
- protected void sendBankInvUpdate(OID mobOid, java.lang.String storageKey, OID storageBagOid)
mobOid
- public AgisInventoryPlugin.EquipMap getEquipMap(OID activatorOid)
activatorOid
-
public void setDirty(OID mobOid)
mobOid
- public static float getSlotModifier(java.lang.String slot)
public static float getGradeModifier(int grade)
public static float getStatModifier(java.lang.String statName)
public static java.util.List<java.lang.Float> getArmourTypeModifier(java.lang.String armourType)
public static java.util.List<java.lang.Float> getArmourSlotModifier(java.lang.String armourSlot)
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |