159 lines
3.3 KiB
Markdown
159 lines
3.3 KiB
Markdown
# Inventory System
|
|
```mermaid
|
|
classDiagram
|
|
|
|
class PlayerInventoryComponent{
|
|
<<InventoryComponent>>
|
|
+ OpenSingle(ItemPreview : ItemPreview) IventoryWindow
|
|
|
|
}
|
|
|
|
class InventoryComponent{
|
|
<<I_InventoryComponent>>
|
|
- InventoryName : Text
|
|
- NumberOfSlots : int
|
|
- inventoryType : inventoryType
|
|
- Inventory : SlotStructure[]
|
|
- MaxWeight : int
|
|
- currentWeight : int
|
|
- monyTranslator : I_MoneyTranslator
|
|
- window : InventoryWindow
|
|
|
|
+ GetInventoryWindo(OppositeComponent : InventoryComponent) InventoryWindow
|
|
+ AddToInventory()
|
|
+ CheckBalance(value: int) : bool
|
|
+ AddMoney(Value : int)
|
|
+ RemoveMoney(Value : int)
|
|
+ RemoveFromInventory(Value : Int, Item : ItemStructure) : bool
|
|
- PrepareInventory()
|
|
- CreateStack() int
|
|
- IsInInventory() bool
|
|
- AddToStack() int
|
|
- HasPartialStack() int
|
|
}
|
|
|
|
class InventoryWindow{
|
|
<<User_Widget>>
|
|
- Iventory : I_InventoryComponent
|
|
+ InventoryWindow(Iventory : I_InventoryComponent)
|
|
- RenewInventorySlots()
|
|
}
|
|
|
|
|
|
|
|
class Stackslider{
|
|
<<User_Widget>>
|
|
- Iventory_Remove : I_InventoryComponent
|
|
- Iventory_Add : I_InventoryComponent
|
|
+ InventoryWindow(Iventory_remove : I_InventoryComponent, Iventory_Add : I_InventoryComponent)
|
|
- CheckBuyerValue() : int
|
|
- setMaxAmount()
|
|
- setMinAmount()
|
|
- buy()
|
|
}
|
|
|
|
class InventorySlot{
|
|
<<User_Widget>>
|
|
- itemStructure : ItemStructure
|
|
+ InventorySlot(item : ItemStructure)
|
|
+ RightClick : EventDispatcher
|
|
+ LeftClick : EventDispatcher
|
|
}
|
|
|
|
class I_InventoryComponent{
|
|
<<Interface>>
|
|
+ AddToInventory()
|
|
+ GetInventory(filters: Filterstructure) : SlotStructure[]
|
|
+ CheckBalance(value: int) : bool
|
|
+ AddMoney(Value : int)
|
|
+ RemoveMoney(Value : int)
|
|
+ RemoveFromInventory(Value : Int, Item : ItemStructure) : bool
|
|
}
|
|
|
|
class inventoryType{
|
|
<<enumerator>>
|
|
Chest
|
|
Dealer
|
|
}
|
|
|
|
class SlotStructure{
|
|
<<struct>>
|
|
Quantety : int
|
|
ItemStrcut : ItemStructure
|
|
}
|
|
|
|
class ItemStructure{
|
|
<<struct>>
|
|
Name : Text
|
|
IsStackable : Bool
|
|
Description : Text
|
|
IsConsumable : Text
|
|
MaxStackSize : Int
|
|
Durability : Float
|
|
BuyValue : Int
|
|
SellValue : Int
|
|
Weight : Int
|
|
Thumbnail : Texture_2D
|
|
Item_Type : ItemType
|
|
rarety : Rarety
|
|
DealerInterest : DealerInterests
|
|
}
|
|
|
|
class Filterstruct{
|
|
<<structure>>
|
|
Consuming_Item : bool
|
|
Ingridient : bool
|
|
Letters_Books : bool
|
|
Necromant_Stuff : bool
|
|
Wapon : bool
|
|
Armor : bool
|
|
Other : bool
|
|
}
|
|
|
|
class ItemType{
|
|
<<enumerator>>
|
|
Consuming_Item
|
|
Ingridient
|
|
Letters_Books
|
|
Necromant_Stuff
|
|
Wapon
|
|
Armor
|
|
Other
|
|
}
|
|
|
|
class Rarety{
|
|
<<enumeratior>>
|
|
Common
|
|
Uncommon
|
|
Rare
|
|
Mythic
|
|
}
|
|
|
|
class DealerInterests{
|
|
<<struct>>
|
|
wholeDealer
|
|
smith
|
|
alchemist
|
|
marketeer
|
|
fence
|
|
nekromant
|
|
bankier
|
|
}
|
|
|
|
PlayerInventoryComponent --> InventoryComponent
|
|
InventoryComponent --> inventoryType
|
|
InventoryComponent --> SlotStructure
|
|
InventoryComponent --> InventoryWindow
|
|
InventoryComponent --> Stackslider
|
|
InventoryWindow --> InventorySlot
|
|
InventorySlot --> ItemStructure
|
|
InventoryWindow --> Filterstruct
|
|
Stackslider --> I_InventoryComponent
|
|
InventoryWindow --> I_InventoryComponent
|
|
InventoryComponent --> I_InventoryComponent
|
|
SlotStructure --> ItemStructure
|
|
ItemStructure --> ItemType
|
|
ItemStructure --> Rarety
|
|
ItemStructure --> DealerInterests
|
|
|
|
``` |