C# 클래스 Aura.Channel.World.Inventory.CreatureInventory

Inventory for players
TODO: I'm dirty and unsafe, clean me up.
파일 보기 프로젝트 열기: aura-project/aura

공개 프로퍼티들

프로퍼티 타입 설명
InvisiblePockets IEnumerable

공개 메소드들

메소드 설명
Add ( Item item, Pocket pocket ) : bool

Tries to add item to pocket. Returns false if the pocket doesn't exist or there was no space.

Add ( Item item, bool tempFallback ) : bool

Tries to add item to one of the main inventories, using the temp inv as fallback (if specified to do so). Returns false if there was no space.

Add ( InventoryPocket inventoryPocket ) : void

Adds pocket to inventory.

AddBagPocket ( Item item ) : bool

Adds pocket for item and updates item's linked pocket.

AddGold ( int amount ) : bool

Adds new gold stacks to the inventory until the amount was added, using temp as fallback. Returns false if something went wrong, and not everything could be added.

AddMainInventory ( ) : void

Adds main inventories (inv, personal, VIP). Call after creature's defaults (RaceInfo) have been loaded.

AddProficiency ( Item item, int amount ) : void

Increases item's proficiency and updates client.

ChangeWeaponSet ( WeaponSet set ) : void

Changes weapon set, if necessary, and updates clients.

Count ( bool>.Func predicate ) : int

Returns the amount of items matching the conditions specified.

Count ( int itemId ) : int

Returns the amount of items with this id in the inventory.

Count ( string tag ) : int

Returns the amount of items in the inventory that match the given tag.

CountItemsInPocket ( Pocket pocket ) : int

Returns the number of items in the given pocket. Returns -1 if the pocket doesn't exist.

CreatureInventory ( Creature creature ) : System

Creates new creature inventory instance for creature.

Decrement ( Item item, ushort amount = 1 ) : bool

Reduces item's amount and sends the necessary update packets. Also removes the item, if it's not a sack and its amount reaches 0.

GetAllEquipment ( ) : Item[]

Returns a new list of all items in all equipment pockets.

GetAllEquipment ( bool>.Func predicate ) : Item[]

Returns a new list of all items that match the predicate, in all equipment pockets.

GetAllItemsFrom ( Pocket pocket ) : List

Returns list of all items in pocket. Returns null if the pocket doesn't exist.

GetCastingSpeedMod ( long entityId ) : int

Returns casting speed modificator, based onthe WU upgrades for the given item entity id.

GetChainCastLevel ( SkillId skillId ) : int

Returns the chain cast level for the given skill from the equipped WUUpgrades. Returns 0 if no Chain Cast upgrade could be found.

GetEquipment ( ) : Item[]

Returns a new list of all items in all equipment pockets that aren't hair or face.

GetEquipment ( bool>.Func predicate ) : Item[]

Returns a new list of all items that match the predicate, in all equipment pockets that aren't hair or face.

GetFreePocketId ( ) : Pocket

Returns a free pocket id to be used for item bags.

GetItem ( bool>.Func predicate, StartAt startAt = StartAt.Random ) : Item

Returns first item to match predicate, or null.

GetItem ( long entityId ) : Item

Returns item with the id, or null.

GetItemAt ( Pocket pocket, int x, int y ) : Item

Returns item at the location, or null.

GetItemSafe ( long entityId ) : Item

Returns item or throws security violation exception, if item didn't exist or isn't allowed to be accessed.

GetItems ( ) : Item[]

Returns a new list of all items in the inventory.

GetItems ( bool>.Func predicate, StartAt startAt = StartAt.Random ) : List

Returns a new list of all items that match the predicate.

GetMainEquipment ( ) : Item[]

Returns a new list of all items in all main equipment pockets, meaning no style or inactive weapon pockets.

GetMainEquipment ( bool>.Func predicate ) : Item[]

Returns a new list of all items in all main equipment pockets, meaning no style or inactive weapon pockets, that match the predicate.

GetManaBurnBonus ( ) : float

Returns the ManaBurn bonus from all equipped WUUpgrades.

GetManaUseModificator ( ) : float

Returns the ManaUse modificator from all equipped WUUpgrades.

GetPocket ( Pocket pocket ) : InventoryPocket

Returns given inventory pocket. Warning: Not for general usage, only use this if you know what you're doing.

Has ( Item item ) : bool

Returns true uf the item exists in this inventory.

Has ( Pocket pocket ) : bool

Returns true if pocket exists in this inventory.

Has ( int itemId, int amount = 1 ) : bool

Returns whether inventory contains the item in this amount.

HasGold ( int amount ) : bool

Returns whether inventory contains gold in this amount.

InitAdd ( Item item ) : bool

Adds item to pocket at the position it currently has. Returns false if pocket doesn't exist.

Insert ( Item item, bool tempFallback ) : bool

Tries to add item to one of the main inventories, using temp as fallback. Unlike "Add" the item will be filled into stacks first, if possible, before calling Add.

Insert ( Item item, bool tempFallback, List &changed ) : bool

Tries to add item to one of the main inventories, using temp as fallback. Unlike "Add" the item will be filled into stacks first, if possible, before calling Add.

InsertStacks ( int itemId, int amount ) : bool

Adds new stacks to the inventory until the amount was added, using temp as fallback. Returns false if something went wrong, and not everything could be added.

Move ( Item item, Pocket target, byte targetX, byte targetY ) : bool

Used from MoveItem handler.

The item is the one that's interacted with, the one picked up when taking it, the one being put into a packet when it's one the cursor. Colliding items switch places with it.

MoveItemsToInvFrom ( ) : void

Moves all items creature has in the given pockets to the main inventory.

MovePet ( Creature pet, Item item, Creature other, Pocket target, int targetX, int targetY ) : bool

Moving item between char and pet, used from handler.

PickUp ( Item item ) : bool

Tries to put item into the inventory, by filling stacks and adding it. If it was completely added to the inventory, it's removed from the region the inventory's creature is in.

ReduceDurability ( Item item, int amount ) : void

Reduces durability and updates client.

Checks NoDurabilityLoss option, meaning this method won't reduce the durability if the option is set.

ReduceMaxDurability ( Item item, int amount ) : void

Reduces max durability and updates client.

Remove ( Item item ) : bool

Removes item from inventory, if it is in it, and sends update packets.

Remove ( Pocket pocket ) : bool

Removes pocket from inventory.

Remove ( int itemId, int amount = 1 ) : bool

Removes the amount of items with the id from the inventory. Returns true if the specified amount was removed.

Does not check amount before removing.

RemoveGold ( int amount ) : bool

Removes the amount of gold from the inventory. Returns true if the specified amount was removed.

StartLiveUpdate ( ) : void

Subscribes inventory to events necessary for upgrade effect live updates.

UpdateStatBonuses ( ) : void

Removes all upgrade effect bonuses from current equipment and reapplies them.

비공개 메소드들

메소드 설명
ApplyDefenseBonuses ( Item item ) : void

Applies non-upgrade Defense and Protection bonuses from the item.

ApplyUpgradeEffects ( Item item ) : void

Applies upgrade effects from item.

ApplyUpgrades ( Item item ) : void

Applies upgrade bonuses from the item.

CheckLeftHand ( Item item, Pocket source, Pocket target ) : void

Unequips item in left hand/magazine, if item in right hand is moved.

CheckRightHand ( Item item, Pocket source, Pocket target ) : void

Makes sure you can't combine invalid equipment, like 2H and shields.

CreatureInventory ( ) : System

Initializes static information.

HandleWUUpgrades ( Item item ) : void

Caches and applies WU upgrades for item.

OnCreatureChangedTitles ( Creature creature ) : void

Raised when inventory's creature changes titles.

OnCreatureConditionsChanged ( Creature creature ) : void

Raised when inventory's creature's conditions change.

OnCreatureLeveledUp ( Creature creature, int levelBefore ) : void

Raised when inventory's creature leveled up.

OnCreatureSkillRankChanged ( Creature creature, Skill skill ) : void

Raised when one of the inventory's creature's skill's rank changes.

OnEquip ( Item item ) : void

Called when an item is equipped, or becomes "active". Calls and sets the appropriate events and stat bonuses. Does not update the client.

Before this is called, the references should be updated, so the subscribers see the character as he is *after* equipping the item. For example, to check the equipment for custom set bonuses. Afterwards the equip stats should be updated, so the client displays the changes. Both of these things aren't done inside this method, because there are cases where we have to equip/unequip multiple items, and we don't want to spam the client. You also have to take care of the visual equipment updates, for similar reasons.

OnHoursTimeTick ( ErinnTime now ) : void

Raised once ever RL hour.

OnItemEntersInventory ( Item item ) : void

Handles events that need to happen when an item "enters" the inventory.

Only called when an item is actually new to the inventory.

OnItemLeavesInventory ( Item item ) : void

Handles events that need to happen when an item "leaves" the inventory.

Only called when an item is completely removed from the inventory.

OnUnequip ( Item item ) : void

Called when an item is unequipped, or becomes "inactive". Calls and removes the appropriate events and stat bonuses. Does not update the client.

Before this is called, the references should be updated, so the subscribers see the character as he is *after* unequipping the item. For example, to check the equipment for custom set bonuses. Afterwards the equip stats should be updated, so the client displays the changes. Both of these things aren't done inside this method, because there are cases where we have to equip/unequip multiple items, and we don't want to spam the client. You also have to take care of the visual equipment updates, for similar reasons.

PrepareBags ( Item item ) : void

Adds bag pocket to inventory and sets it for the item if item is a bag. Call before ItemNew, otherwise the bag won't open until relog.

TryAutoAdd ( Item item, bool tempFallback ) : bool

Tries to add item to one of the main invs or bags, wherever free space is available. Returns whether it was successful.

UnequipIfCantBeTouched ( Item item ) : void

Moves item to inventory if it can't be touched.

UpdateChangedItems ( IEnumerable items ) : void

Sends amount update or remove packets for all items, depending on their amount.

UpdateEquipReferences ( ) : void

Updates quick access equipment refernces.

UpdateEquipStats ( ) : void

Sends private stat update for all equipment relevant stats.

메소드 상세

Add() 공개 메소드

Tries to add item to pocket. Returns false if the pocket doesn't exist or there was no space.
public Add ( Item item, Pocket pocket ) : bool
item Item
pocket Pocket
리턴 bool

Add() 공개 메소드

Tries to add item to one of the main inventories, using the temp inv as fallback (if specified to do so). Returns false if there was no space.
public Add ( Item item, bool tempFallback ) : bool
item Item
tempFallback bool
리턴 bool

Add() 공개 메소드

Adds pocket to inventory.
public Add ( InventoryPocket inventoryPocket ) : void
inventoryPocket InventoryPocket
리턴 void

AddBagPocket() 공개 메소드

Adds pocket for item and updates item's linked pocket.
public AddBagPocket ( Item item ) : bool
item Item
리턴 bool

AddGold() 공개 메소드

Adds new gold stacks to the inventory until the amount was added, using temp as fallback. Returns false if something went wrong, and not everything could be added.
public AddGold ( int amount ) : bool
amount int
리턴 bool

AddMainInventory() 공개 메소드

Adds main inventories (inv, personal, VIP). Call after creature's defaults (RaceInfo) have been loaded.
public AddMainInventory ( ) : void
리턴 void

AddProficiency() 공개 메소드

Increases item's proficiency and updates client.
public AddProficiency ( Item item, int amount ) : void
item Item
amount int
리턴 void

ChangeWeaponSet() 공개 메소드

Changes weapon set, if necessary, and updates clients.
public ChangeWeaponSet ( WeaponSet set ) : void
set WeaponSet
리턴 void

Count() 공개 메소드

Returns the amount of items matching the conditions specified.
public Count ( bool>.Func predicate ) : int
predicate bool>.Func
리턴 int

Count() 공개 메소드

Returns the amount of items with this id in the inventory.
public Count ( int itemId ) : int
itemId int
리턴 int

Count() 공개 메소드

Returns the amount of items in the inventory that match the given tag.
public Count ( string tag ) : int
tag string
리턴 int

CountItemsInPocket() 공개 메소드

Returns the number of items in the given pocket. Returns -1 if the pocket doesn't exist.
public CountItemsInPocket ( Pocket pocket ) : int
pocket Pocket
리턴 int

CreatureInventory() 공개 메소드

Creates new creature inventory instance for creature.
public CreatureInventory ( Creature creature ) : System
creature Aura.Channel.World.Entities.Creature
리턴 System

Decrement() 공개 메소드

Reduces item's amount and sends the necessary update packets. Also removes the item, if it's not a sack and its amount reaches 0.
public Decrement ( Item item, ushort amount = 1 ) : bool
item Item
amount ushort
리턴 bool

GetAllEquipment() 공개 메소드

Returns a new list of all items in all equipment pockets.
public GetAllEquipment ( ) : Item[]
리턴 Item[]

GetAllEquipment() 공개 메소드

Returns a new list of all items that match the predicate, in all equipment pockets.
public GetAllEquipment ( bool>.Func predicate ) : Item[]
predicate bool>.Func
리턴 Item[]

GetAllItemsFrom() 공개 메소드

Returns list of all items in pocket. Returns null if the pocket doesn't exist.
public GetAllItemsFrom ( Pocket pocket ) : List
pocket Pocket
리턴 List

GetCastingSpeedMod() 공개 메소드

Returns casting speed modificator, based onthe WU upgrades for the given item entity id.
public GetCastingSpeedMod ( long entityId ) : int
entityId long
리턴 int

GetChainCastLevel() 공개 메소드

Returns the chain cast level for the given skill from the equipped WUUpgrades. Returns 0 if no Chain Cast upgrade could be found.
public GetChainCastLevel ( SkillId skillId ) : int
skillId SkillId
리턴 int

GetEquipment() 공개 메소드

Returns a new list of all items in all equipment pockets that aren't hair or face.
public GetEquipment ( ) : Item[]
리턴 Item[]

GetEquipment() 공개 메소드

Returns a new list of all items that match the predicate, in all equipment pockets that aren't hair or face.
public GetEquipment ( bool>.Func predicate ) : Item[]
predicate bool>.Func
리턴 Item[]

GetFreePocketId() 공개 메소드

Returns a free pocket id to be used for item bags.
public GetFreePocketId ( ) : Pocket
리턴 Pocket

GetItem() 공개 메소드

Returns first item to match predicate, or null.
public GetItem ( bool>.Func predicate, StartAt startAt = StartAt.Random ) : Item
predicate bool>.Func
startAt StartAt /// Affects the order of the returned items, based on their position in /// the inventory. ///
리턴 Item

GetItem() 공개 메소드

Returns item with the id, or null.
public GetItem ( long entityId ) : Item
entityId long
리턴 Item

GetItemAt() 공개 메소드

Returns item at the location, or null.
public GetItemAt ( Pocket pocket, int x, int y ) : Item
pocket Pocket
x int
y int
리턴 Item

GetItemSafe() 공개 메소드

Returns item or throws security violation exception, if item didn't exist or isn't allowed to be accessed.
public GetItemSafe ( long entityId ) : Item
entityId long
리턴 Item

GetItems() 공개 메소드

Returns a new list of all items in the inventory.
public GetItems ( ) : Item[]
리턴 Item[]

GetItems() 공개 메소드

Returns a new list of all items that match the predicate.
public GetItems ( bool>.Func predicate, StartAt startAt = StartAt.Random ) : List
predicate bool>.Func
startAt StartAt /// Affects the order of the returned items, based on their position in /// the inventory. ///
리턴 List

GetMainEquipment() 공개 메소드

Returns a new list of all items in all main equipment pockets, meaning no style or inactive weapon pockets.
public GetMainEquipment ( ) : Item[]
리턴 Item[]

GetMainEquipment() 공개 메소드

Returns a new list of all items in all main equipment pockets, meaning no style or inactive weapon pockets, that match the predicate.
public GetMainEquipment ( bool>.Func predicate ) : Item[]
predicate bool>.Func
리턴 Item[]

GetManaBurnBonus() 공개 메소드

Returns the ManaBurn bonus from all equipped WUUpgrades.
public GetManaBurnBonus ( ) : float
리턴 float

GetManaUseModificator() 공개 메소드

Returns the ManaUse modificator from all equipped WUUpgrades.
public GetManaUseModificator ( ) : float
리턴 float

GetPocket() 공개 메소드

Returns given inventory pocket. Warning: Not for general usage, only use this if you know what you're doing.
public GetPocket ( Pocket pocket ) : InventoryPocket
pocket Pocket
리턴 InventoryPocket

Has() 공개 메소드

Returns true uf the item exists in this inventory.
public Has ( Item item ) : bool
item Item
리턴 bool

Has() 공개 메소드

Returns true if pocket exists in this inventory.
public Has ( Pocket pocket ) : bool
pocket Pocket
리턴 bool

Has() 공개 메소드

Returns whether inventory contains the item in this amount.
public Has ( int itemId, int amount = 1 ) : bool
itemId int
amount int
리턴 bool

HasGold() 공개 메소드

Returns whether inventory contains gold in this amount.
public HasGold ( int amount ) : bool
amount int
리턴 bool

InitAdd() 공개 메소드

Adds item to pocket at the position it currently has. Returns false if pocket doesn't exist.
public InitAdd ( Item item ) : bool
item Item
리턴 bool

Insert() 공개 메소드

Tries to add item to one of the main inventories, using temp as fallback. Unlike "Add" the item will be filled into stacks first, if possible, before calling Add.
public Insert ( Item item, bool tempFallback ) : bool
item Item
tempFallback bool Add to temp inv when all other pockets are full?
리턴 bool

Insert() 공개 메소드

Tries to add item to one of the main inventories, using temp as fallback. Unlike "Add" the item will be filled into stacks first, if possible, before calling Add.
public Insert ( Item item, bool tempFallback, List &changed ) : bool
item Item
tempFallback bool Add to temp inv when all other pockets are full?
changed List List of stacks that items were inserted into.
리턴 bool

InsertStacks() 공개 메소드

Adds new stacks to the inventory until the amount was added, using temp as fallback. Returns false if something went wrong, and not everything could be added.
public InsertStacks ( int itemId, int amount ) : bool
itemId int Id of the item to add.
amount int Amount to add, value affects the amount of stacks.
리턴 bool

Move() 공개 메소드

Used from MoveItem handler.
The item is the one that's interacted with, the one picked up when taking it, the one being put into a packet when it's one the cursor. Colliding items switch places with it.
public Move ( Item item, Pocket target, byte targetX, byte targetY ) : bool
item Item Item to move
target Pocket Pocket to move it to
targetX byte
targetY byte
리턴 bool

MoveItemsToInvFrom() 공개 메소드

Moves all items creature has in the given pockets to the main inventory.
public MoveItemsToInvFrom ( ) : void
리턴 void

MovePet() 공개 메소드

Moving item between char and pet, used from handler.
public MovePet ( Creature pet, Item item, Creature other, Pocket target, int targetX, int targetY ) : bool
pet Aura.Channel.World.Entities.Creature Always the pet
item Item
other Aura.Channel.World.Entities.Creature The "other" creature, player when taking out, pet when putting in.
target Pocket
targetX int
targetY int
리턴 bool

PickUp() 공개 메소드

Tries to put item into the inventory, by filling stacks and adding it. If it was completely added to the inventory, it's removed from the region the inventory's creature is in.
public PickUp ( Item item ) : bool
item Item
리턴 bool

ReduceDurability() 공개 메소드

Reduces durability and updates client.
Checks NoDurabilityLoss option, meaning this method won't reduce the durability if the option is set.
public ReduceDurability ( Item item, int amount ) : void
item Item
amount int
리턴 void

ReduceMaxDurability() 공개 메소드

Reduces max durability and updates client.
public ReduceMaxDurability ( Item item, int amount ) : void
item Item
amount int
리턴 void

Remove() 공개 메소드

Removes item from inventory, if it is in it, and sends update packets.
public Remove ( Item item ) : bool
item Item
리턴 bool

Remove() 공개 메소드

Removes pocket from inventory.
public Remove ( Pocket pocket ) : bool
pocket Pocket
리턴 bool

Remove() 공개 메소드

Removes the amount of items with the id from the inventory. Returns true if the specified amount was removed.
Does not check amount before removing.
public Remove ( int itemId, int amount = 1 ) : bool
itemId int
amount int
리턴 bool

RemoveGold() 공개 메소드

Removes the amount of gold from the inventory. Returns true if the specified amount was removed.
public RemoveGold ( int amount ) : bool
amount int
리턴 bool

StartLiveUpdate() 공개 메소드

Subscribes inventory to events necessary for upgrade effect live updates.
public StartLiveUpdate ( ) : void
리턴 void

UpdateStatBonuses() 공개 메소드

Removes all upgrade effect bonuses from current equipment and reapplies them.
public UpdateStatBonuses ( ) : void
리턴 void

프로퍼티 상세

InvisiblePockets 공개적으로 정적으로 프로퍼티

These pockets aren't checked by the Count() method
public static IEnumerable InvisiblePockets
리턴 IEnumerable