ClassicCityBuilderKit 1.8.8
|
general container for storage of items, use whenever anything owns items
defines various convenience methods for moving and checking items that abstract its different storage modes
Classes | |
class | ItemStorageData |
Public Member Functions | |
void | Clear () |
removes all items and reservations | |
bool | HasItems () |
returns whether the strorage contains any items | |
bool | HasItem (Item item) |
returns whether the strorage contains a particular items | |
bool | HasItem (ItemCategory itemCategory) |
returns whether the strorage contains any item in the category | |
bool | HasItems (ItemQuantity itemQuantity) |
checks if at least a certain quantity of an item is stored does not take reservations into account, for that use HasItemsRemaining(Item, int) | |
bool | HasItems (Item item, int quantity) |
checks if at least a certain quantity of an item is stored does not take reservations into account, for that use HasItemsRemaining(Item, int) | |
bool | HasItems (ItemCategoryQuantity itemCategoryQuantity) |
checks if at least a certain quantity of an item category is stored does not take reservations into account, for that use HasItemsRemaining(Item, int) | |
bool | HasItems (ItemCategory itemCategory, int quantity) |
checks if at least a certain quantity of an item category is stored does not take reservations into account, for that use HasItemsRemaining(Item, int) | |
bool | HasItems (IEnumerable< ItemQuantity > itemQuantities) |
checks if at least all the quantities passed are stored | |
bool | HasItems (IEnumerable< ItemCategoryQuantity > itemCategoryQuantities) |
checks if at least all the quantities passed are stored | |
bool | HasItemsRemaining (Item item, int quantity) |
checks if at least a certain quantity of an item is stored and unreserved | |
bool | HasItemsRemaining (ItemCategory itemCategory, int quantity) |
checks if at least a certain quantity of an item category is stored and unreserved | |
int | GetItemQuantity () |
calculates the total number of items in the store | |
int | GetItemQuantity (Item item) |
calculates the total number of a particular item stored | |
int | GetItemQuantity (ItemCategory itemCategory) |
calculates the total number of items in a particular itemCategory(food, ...) stored | |
float | GetUnitQuantity (Item item) |
calculates the number of units(Item.UnitSize) stored for an item ie apples are stored in units of 100, 150 apples are in store > 1.5 units | |
int | GetItemQuantityRemaining (Item item) |
calculates the total number of a particular item stored wihtout reservations | |
int | GetItemCapacity () |
calculates the total number of items that may be stored | |
int | GetItemCapacity (Item item) |
calculates the total number that may be stored of a particular item | |
int | GetItemCapacity (Item item, float ratio) |
calculates the proportional number that may be stored of a particular item | |
int | GetItemCapacity (ItemCategory itemCategory) |
calculates the total number of items in a category that may be stored | |
int | GetItemCapacity (ItemCategory itemCategory, float ratio) |
calculates the proportional number that may be stored of items in a category | |
int | GetItemsOverRatio (Item item, float ratio=1f) |
calculates the quantity of items that is above the ratio this can never be > 0 for ration 1 since items could use the entire capacity it would be half the capacity if the storage was full and ratio was 0.5 | |
int | GetItemCapacityRemaining () |
calculates how much space is left after removing stored items and reservations | |
int | GetItemCapacityRemaining (Item item) |
calculates how many more of a particular item can be stored taking reservations into account | |
int | GetItemCapacityRemaining (Item item, float ratio) |
calculates how many more of a particular item can be stored taking reservations into account while limiting capacity to a specified ratio | |
int | GetItemCapacityRemaining (ItemCategory itemCategory) |
calculates how many more items in a category can be stored while taking reservations into account | |
int | GetItemCapacityRemaining (ItemCategory itemCategory, float ratio) |
calculates how many more items in a category can be stored taking reservations into account while limiting capacity to a specified ratio | |
float | GetUnitCapacityRemaining (Item item) |
calculates how many more units(Item.UnitSize) of an items can be stored while subtracting reservations | |
ItemLevel | GetItemLevel (Item item) |
retrieves the item level for an item the item level expresses current storage quantity and capacity | |
bool | FitsItems (IEnumerable< ItemQuantity > itemQuantities) |
checks whether multiple item quantities fit into storage takes reservations into account | |
bool | FitsItems (ItemQuantity itemQuantity) |
checks whether an item quantity fits into storage takes reservations into account | |
bool | FitsItems (Item item, int quantity) |
checks whether a quantity fits into storage takes reservations into account | |
IEnumerable< Item > | GetItems () |
returns all the kinds of item in the storage | |
IEnumerable< ItemQuantity > | GetItemQuantities () |
returns all the items in storage with their current quantity | |
List< ItemQuantity > | MoveItemsTo (ItemStorage other) |
moves any item into the other storage that will fit | |
List< ItemQuantity > | MoveItemsTo (ItemStorage other, bool overfill) |
moves any item into the other storage | |
int | MoveItemsTo (ItemStorage other, Item item, int maxQuantity=int.MaxValue, bool overfill=false) |
moves quantities of an items to another storage, may be limited by a maximum quantity | |
void | AddItems (IEnumerable< ItemQuantity > itemQuantities, bool overfill=false) |
void | RemoveItems (IEnumerable< ItemQuantity > itemQuantities) |
void | RemoveItems (IEnumerable< ItemCategoryQuantity > itemCategoryQuantities) |
int | AddItems (ItemQuantity itemQuantity, bool overfill=false) |
adds items to that storage up to its capacity, remaining quantity is returned (adding 10 items to a storage that can only fit 4 more will return 6) | |
int | AddItems (Item item, int quantity) |
adds items to that storage up to its capacity, remaining quantity is returned (adding 10 items to a storage that can only fit 4 more will return 6) | |
int | AddItems (Item item, int quantity, bool overfill) |
adds items to that storage up to its capacity, remaining quantity is returned (adding 10 items to a storage that can only fit 4 more will return 6) | |
int | RemoveItems (ItemQuantity itemQuantity) |
removes items from storage and returns the remaining quantity if not enough items were present (removing 4 items from a store that contains only 3 will return 1) | |
int | RemoveItems (Item item, int quantity) |
removes items from storage and returns the remaining quantity if not enough items were present (removing 4 items from a store that contains only 3 will return 1) | |
int | RemoveItems (ItemCategoryQuantity itemCategoryQuantity) |
removes items from storage and returns the remaining quantity if not enough items were present (removing 4 items from a store that contains only 3 will return 1) | |
int | RemoveItems (ItemCategory itemCategory, int quantity) |
removes items from storage and returns the remaining quantity if not enough items were present (removing 4 items from a store that contains only 3 will return 1) | |
void | ReserveCapacity (Item item, int quantity) |
reserves capacity for an item that may be delivered in the future makes sure that capacity is still available when the item arrives | |
void | UnreserveCapacity (Item item, int quantity) |
removes a reservation made by ReserveCapacity(Item, int) should be called when the items arrives or if the delivery got interrupted | |
int | GetReservedCapacity (Item item) |
checks how much capacity has been reserved for an item | |
void | ReserveQuantity (Item item, int quantity) |
reserves a quantity of an item so it can be collected in the future makes sure the items dont get removed from somebody else until it is acutally removed | |
void | UnreserveQuantity (Item item, int quantity) |
removes a reservation made by ReserveQuantity(Item, int) should be called when the items are collected or if the pickup was interrupted | |
int | GetReservedQuantity (Item item) |
checks how much quantity has been reserved of an item | |
ItemStorage | GetActualStorage () |
returns the proxy store if the store redirects to another one using ItemStorageMode.Global or ItemStorageMode.Store or itself if not | |
string | GetDebugText () |
text that can be displayed for easy debugging prints out all the item quantities stored | |
string | GetItemNames () |
joins all items names inside the store seperated by comma | |
ItemStorageData | SaveData () |
void | LoadData (ItemStorageData data) |
Public Attributes | |
ItemStorageMode | Mode = ItemStorageMode.UnitCapped |
int | StackCount |
int | Capacity = 1 |
ItemQuantity[] | ItemCapacities |
ItemStore | Store |
bool | PersistStore |
Properties | |
bool | IsStackedStorage [get] |
bool | IsProxyStorage [get] |
bool | IsListStorage [get] |
ItemStack[] | Stacks [get] |
Events | |
Action< ItemStorage > | Changed |
int CityBuilderCore.ItemStorage.AddItems | ( | Item | item, |
int | quantity ) |
adds items to that storage up to its capacity, remaining quantity is returned
(adding 10 items to a storage that can only fit 4 more will return 6)
item | the item to add |
quantity | maximum quantity to add |
Implements CityBuilderCore.IItemContainer.
|
inline |
adds items to that storage up to its capacity, remaining quantity is returned
(adding 10 items to a storage that can only fit 4 more will return 6)
item | the item to add |
quantity | maximum quantity to add |
int CityBuilderCore.ItemStorage.AddItems | ( | ItemQuantity | itemQuantity, |
bool | overfill = false ) |
adds items to that storage up to its capacity, remaining quantity is returned
(adding 10 items to a storage that can only fit 4 more will return 6)
itemQuantity | the quantity of items to add |
bool CityBuilderCore.ItemStorage.FitsItems | ( | IEnumerable< ItemQuantity > | itemQuantities | ) |
checks whether multiple item quantities fit into storage
takes reservations into account
itemQuantities | the item quantities to check |
|
inline |
checks whether a quantity fits into storage
takes reservations into account
item | |
quantity |
bool CityBuilderCore.ItemStorage.FitsItems | ( | ItemQuantity | itemQuantity | ) |
checks whether an item quantity fits into storage
takes reservations into account
itemQuantity | the item quantity to check |
|
inline |
returns the proxy store if the store redirects to another one using ItemStorageMode.Global or ItemStorageMode.Store or itself if not
|
inline |
text that can be displayed for easy debugging
prints out all the item quantities stored
|
inline |
calculates the total number of items that may be stored
Implements CityBuilderCore.IItemContainer.
int CityBuilderCore.ItemStorage.GetItemCapacity | ( | Item | item | ) |
calculates the total number that may be stored of a particular item
item | item in question |
Implements CityBuilderCore.IItemContainer.
|
inline |
calculates the proportional number that may be stored of a particular item
item | item in question |
ratio | how much of the capacity may be used (0-1) |
int CityBuilderCore.ItemStorage.GetItemCapacity | ( | ItemCategory | itemCategory | ) |
calculates the total number of items in a category that may be stored
itemCategory | item category in question |
Implements CityBuilderCore.IItemContainer.
|
inline |
calculates the proportional number that may be stored of items in a category
itemCategory | item category in question |
ratio | how much of the capacity may be used (0-1) |
|
inline |
calculates how much space is left after removing stored items and reservations
Implements CityBuilderCore.IItemContainer.
int CityBuilderCore.ItemStorage.GetItemCapacityRemaining | ( | Item | item | ) |
calculates how many more of a particular item can be stored taking reservations into account
item | item to check |
Implements CityBuilderCore.IItemContainer.
|
inline |
calculates how many more of a particular item can be stored taking reservations into account while limiting capacity to a specified ratio
item | item to check |
ratio | how much of the capacity may be used (0-1) |
int CityBuilderCore.ItemStorage.GetItemCapacityRemaining | ( | ItemCategory | itemCategory | ) |
calculates how many more items in a category can be stored while taking reservations into account
itemCategory | the category of items to calculate |
Implements CityBuilderCore.IItemContainer.
|
inline |
calculates how many more items in a category can be stored taking reservations into account while limiting capacity to a specified ratio
itemCategory | item category to check |
ratio | how much of the capacity may be used (0-1) |
retrieves the item level for an item
the item level expresses current storage quantity and capacity
item | the item to check |
|
inline |
joins all items names inside the store seperated by comma
|
inline |
returns all the items in storage with their current quantity
Implements CityBuilderCore.IItemContainer.
|
inline |
calculates the total number of items in the store
Implements CityBuilderCore.IItemContainer.
|
inline |
calculates the total number of a particular item stored
item | the item to count |
Implements CityBuilderCore.IItemContainer.
int CityBuilderCore.ItemStorage.GetItemQuantity | ( | ItemCategory | itemCategory | ) |
calculates the total number of items in a particular itemCategory(food, ...) stored
itemCategory | the item category to count |
Implements CityBuilderCore.IItemContainer.
int CityBuilderCore.ItemStorage.GetItemQuantityRemaining | ( | Item | item | ) |
calculates the total number of a particular item stored wihtout reservations
item | the item to count |
|
inline |
returns all the kinds of item in the storage
Implements CityBuilderCore.IItemContainer.
|
inline |
calculates the quantity of items that is above the ratio
this can never be > 0 for ration 1 since items could use the entire capacity
it would be half the capacity if the storage was full and ratio was 0.5
item | |
ratio |
|
inline |
checks how much capacity has been reserved for an item
item | the item in question |
int CityBuilderCore.ItemStorage.GetReservedQuantity | ( | Item | item | ) |
checks how much quantity has been reserved of an item
item | the item in question |
|
inline |
calculates how many more units(Item.UnitSize) of an items can be stored while subtracting reservations
item | item to calculate |
float CityBuilderCore.ItemStorage.GetUnitQuantity | ( | Item | item | ) |
calculates the number of units(Item.UnitSize) stored for an item
ie apples are stored in units of 100, 150 apples are in store > 1.5 units
item |
|
inline |
returns whether the strorage contains a particular items
item | the item to check for |
|
inline |
returns whether the strorage contains any item in the category
itemCategory | the item category to check for |
|
inline |
returns whether the strorage contains any items
bool CityBuilderCore.ItemStorage.HasItems | ( | IEnumerable< ItemCategoryQuantity > | itemCategoryQuantities | ) |
checks if at least all the quantities passed are stored
itemCategoryQuantities | the quantities to check |
bool CityBuilderCore.ItemStorage.HasItems | ( | IEnumerable< ItemQuantity > | itemQuantities | ) |
checks if at least all the quantities passed are stored
itemQuantities | the quantities to check |
|
inline |
checks if at least a certain quantity of an item is stored
does not take reservations into account, for that use HasItemsRemaining(Item, int)
item | the item to look for |
quantity | the minimum qantity |
|
inline |
checks if at least a certain quantity of an item category is stored
does not take reservations into account, for that use HasItemsRemaining(Item, int)
itemCategory | the item category to look for |
quantity | the minimum qantity |
bool CityBuilderCore.ItemStorage.HasItems | ( | ItemCategoryQuantity | itemCategoryQuantity | ) |
checks if at least a certain quantity of an item category is stored
does not take reservations into account, for that use HasItemsRemaining(Item, int)
itemCategoryQuantity | the item category and quantity to look for |
bool CityBuilderCore.ItemStorage.HasItems | ( | ItemQuantity | itemQuantity | ) |
checks if at least a certain quantity of an item is stored
does not take reservations into account, for that use HasItemsRemaining(Item, int)
itemQuantity | the quantity of item to check |
|
inline |
checks if at least a certain quantity of an item is stored and unreserved
item | the item to look for |
quantity | the minimum qantity |
|
inline |
checks if at least a certain quantity of an item category is stored and unreserved
itemCategory | the item category to look for |
quantity | the minimum qantity |
List< ItemQuantity > CityBuilderCore.ItemStorage.MoveItemsTo | ( | ItemStorage | other | ) |
moves any item into the other storage that will fit
other | storage that receives the items |
|
inline |
moves any item into the other storage
other | storage that receives the items |
overfill | whether exceeding the targets capacity is allowed |
|
inline |
moves quantities of an items to another storage, may be limited by a maximum quantity
other | the receiving storage |
item | the items to move |
maxQuantity | the maximum quantity that may be moved |
|
inline |
removes items from storage and returns the remaining quantity if not enough items were present
(removing 4 items from a store that contains only 3 will return 1)
item | the item to remove |
quantity | the maximum quantity to remove |
Implements CityBuilderCore.IItemContainer.
|
inline |
removes items from storage and returns the remaining quantity if not enough items were present
(removing 4 items from a store that contains only 3 will return 1)
itemCategory | the itemCategory to remove |
quantity | the maximum quantity to remove |
int CityBuilderCore.ItemStorage.RemoveItems | ( | ItemCategoryQuantity | itemCategoryQuantity | ) |
removes items from storage and returns the remaining quantity if not enough items were present
(removing 4 items from a store that contains only 3 will return 1)
itemCategoryQuantity | the itemCategoryQuantity to remove |
int CityBuilderCore.ItemStorage.RemoveItems | ( | ItemQuantity | itemQuantity | ) |
removes items from storage and returns the remaining quantity if not enough items were present
(removing 4 items from a store that contains only 3 will return 1)
itemQuantity | the quantity of item to remove |
|
inline |
reserves capacity for an item that may be delivered in the future
makes sure that capacity is still available when the item arrives
item | the item to reserve |
quantity | quantity of the item to reserve |
Implements CityBuilderCore.IItemContainer.
|
inline |
reserves a quantity of an item so it can be collected in the future
makes sure the items dont get removed from somebody else until it is acutally removed
item | the item to reserve quantity for |
quantity | the quantity to reserve |
Implements CityBuilderCore.IItemContainer.
|
inline |
removes a reservation made by ReserveCapacity(Item, int)
should be called when the items arrives or if the delivery got interrupted
item | the item to unreseve |
quantity | quantity of the item to unreserve |
Implements CityBuilderCore.IItemContainer.
|
inline |
removes a reservation made by ReserveQuantity(Item, int)
should be called when the items are collected or if the pickup was interrupted
item | the item to unreserve quantity for |
quantity | the quantity to unreserve |
Implements CityBuilderCore.IItemContainer.