Class SlotActivatedItem
java.lang.Object
marauroa.common.game.Attributes
marauroa.common.game.SlotOwner
marauroa.common.game.RPObject
games.stendhal.server.entity.Entity
games.stendhal.server.entity.PassiveEntity
games.stendhal.server.entity.item.Item
games.stendhal.server.entity.item.SlotActivatedItem
- All Implemented Interfaces:
EquipListener
,TurnListener
,UseListener
,Killer
,Cloneable
,Iterable<String>
,Serializable
- Direct Known Subclasses:
StatusResistantItem
An item that can be activated by being held in specific slots.
- Author:
- AntumDeluge
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
The active state of the item initialized as deactivated.Fields inherited from class games.stendhal.server.entity.item.Item
DEGRADATION_TIMEOUT
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Checks the activation state of the item for activation.protected boolean
Checks the activation state of the item for deactivation.void
initializeActiveSlotsList(List<String> list)
Create a list of slots in which this item can be activated while equipped.void
initiateActiveSlotsList(List<String> slotList)
Fill the list of active slots.boolean
Tests whether the item is currently activated.protected boolean
isActiveSlot(String slot)
Tests whether the item can be activated in specified slot.protected boolean
Actions to take when equipped.protected boolean
Actions to take when Unequipped.boolean
onEquipped(RPEntity owner, String slot)
Action to take when item is equipped.boolean
Action to take when item is un-equipped.toString()
This method returns a String that represent the objectMethods inherited from class games.stendhal.server.entity.item.Item
autobind, canBeEquippedIn, describe, deteriorate, deteriorate, generateRPClass, getAttack, getAttackRate, getAttackRate, getBoundTo, getDamageType, getDefaultAttackRate, getDefense, getDescriptionName, getDeterioration, getInfoString, getItemClass, getItemSubclass, getMinLevel, getName, getPlantGrower, getPossibleSlots, getQuantity, getRangedAttack, getSusceptibility, getTitle, getWeaponType, initializeStatusResistancesList, isBound, isFromCorpse, isOfClass, isPersistent, isUndroppableOnDeath, onPickedUp, onPutOnGround, onPutOnGround, onRemoveFromGround, onTurnReached, onUsed, removeFromWorld, removeOne, repair, setBoundTo, setDamageType, setEquipableSlots, setFromCorpse, setInfoString, setPersistent, setPlantGrower, setSusceptibilities, setUndroppableOnDeath, setUseBehavior
Methods inherited from class games.stendhal.server.entity.Entity
getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getOrigin, getResistance, getResistance, getWidth, getX, getY, getZone, hasDescription, isInSight, isObstacle, nextTo, nextTo, notifyWorldAboutChanges, onAdded, onMoved, onRemoved, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance, stopped, update
Methods inherited from class marauroa.common.game.RPObject
addEvent, addLink, addLink, addMap, addSlot, addSlot, applyDifferences, clearEvents, clearVisible, clone, containsKey, equals, events, eventsIterator, fill, get, getBaseContainer, getBoolean, getContainer, getContainerBaseOwner, getContainerOwner, getContainerSlot, getDifferences, getDouble, getFromSlots, getID, getInt, getLink, getLinkedObject, getMap, getSlot, has, hashCode, hasLink, hasMap, hasSlot, hide, isContained, isEmpty, isHidden, isStorable, maps, put, put, put, put, readObject, remove, removeLink, removeMap, removeSlot, resetAddedAndDeleted, resetAddedAndDeletedMaps, resetAddedAndDeletedRPLink, resetAddedAndDeletedRPSlot, setAddedMaps, setAddedRPSlot, setContainer, setDeletedMaps, setDeletedRPSlot, setID, size, slots, slotsIterator, store, unhide, unstore, writeObject, writeObject, writeToJson
Methods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlots
Methods inherited from class marauroa.common.game.Attributes
add, applyDifferences, get, getBool, getDouble, getInt, getList, getLong, getRPClass, has, instanceOf, iterator, put, put, put, put, put, readFromMap, remove, resetAddedAndDeletedAttributes, setAddedAttributes, setDeletedAttributes, setRPClass, setRPClass, toAttributeString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
activated
protected boolean activatedThe active state of the item initialized as deactivated.
-
-
Constructor Details
-
SlotActivatedItem
public SlotActivatedItem(String name, String clazz, String subclass, Map<String,String> attributes)Default constructor.- Parameters:
name
- Item's nameclazz
- Item's class or typesubclass
- Item's subclassattributes
- Attributes available to this item
-
SlotActivatedItem
Copy constructor- Parameters:
item
- Item to be copied
-
-
Method Details
-
initializeActiveSlotsList
Create a list of slots in which this item can be activated while equipped.- Overrides:
initializeActiveSlotsList
in classItem
- Parameters:
list
- List of slot active slot names
-
initiateActiveSlotsList
Fill the list of active slots.- Parameters:
slotList
- List of slots in which item can be activated
-
onEquipped
Action to take when item is equipped. If successfully equipped item's activation state is set to true.- Overrides:
onEquipped
in classItem
- Parameters:
owner
- entity equipping the itemslot
- slot where the item is equipped- Returns:
- unknown, see the note above
-
onUnequipped
public boolean onUnequipped()Action to take when item is un-equipped. If successfully un-equipped item's activation state is set to false.- Overrides:
onUnequipped
in classItem
- Returns:
- needs documenting
-
canActivate
protected boolean canActivate()Checks the activation state of the item for activation.- Returns:
- true if item is not currently activated
-
canDeactivate
protected boolean canDeactivate()Checks the activation state of the item for deactivation.- Returns:
- true if item is currently activated
-
isActivated
public boolean isActivated()Tests whether the item is currently activated.- Returns:
- Item's activation state
-
isActiveSlot
Tests whether the item can be activated in specified slot.- Parameters:
slot
- Slot to be tested- Returns:
- true if slot name is found in active slot list
-
onActivate
protected boolean onActivate()Actions to take when equipped. Should return true on successful activation.- Returns:
- Activated state
-
onDeactivate
protected boolean onDeactivate()Actions to take when Unequipped. Should return false on successful deactivation.- Returns:
- Non-activated state
-
toString
Description copied from class:RPObject
This method returns a String that represent the object
-