C# Класс Aura.Channel.World.Inventory.CreatureInventory

Inventory for players
TODO: I'm dirty and unsafe, clean me up.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
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