Tramway SDK
inventory.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_EXTENSIONS_DESIGN_INVENTORY_H
5#define TRAM_SDK_EXTENSIONS_DESIGN_INVENTORY_H
6
8
9#include <framework/gui.h>
10
11namespace tram::Ext::Kitchensink {
12
13struct Inventory;
14struct ItemInstance;
16
17struct ItemClass {
19
22
26
27 bool draw_hands = false;
28
30
35
36 int width = 1, height = 1;
37 int stack = 1;
38
39 float weight = 0.0f;
40
41 std::vector<Attribute> attributes;
42
43 static ItemClass* Find(name_t item_class);
44};
45
48 int count = 1;
49 int x = 0, y = 0;
50 bool equipped = false;
51};
52
53struct Inventory {
54 std::vector<ItemInstance> items;
55
56 int width = 1, height = 1;
57
58 bool allow_overlap = true;
59
60 int AddItem(const ItemInstance& item);
61 int AddItem(name_t item_class, int count);
62 int RemoveItem(name_t item_class, int count);
63 int GetItemCount(name_t item_class);
64 static Inventory* Find(id_t id);
65};
66
67
68
69
70}
71
72#endif // TRAM_SDK_EXTENSIONS_DESIGN_INVENTORY_H
Definition: ai.cpp:16
void(* item_action_func)(Inventory *, ItemInstance *)
Definition: inventory.h:15
uint32_t font_t
Definition: gui.h:15
uint32_t glyph_t
Definition: gui.h:16
uint32_t id_t
Definition: core.h:11
Definition: inventory.h:53
int AddItem(const ItemInstance &item)
Definition: inventory.cpp:26
int GetItemCount(name_t item_class)
Definition: inventory.cpp:70
int width
Definition: inventory.h:56
int RemoveItem(name_t item_class, int count)
Definition: inventory.cpp:54
std::vector< ItemInstance > items
Definition: inventory.h:54
static Inventory * Find(id_t id)
Definition: inventory.cpp:78
bool allow_overlap
Definition: inventory.h:58
int height
Definition: inventory.h:56
Definition: inventory.h:17
GUI::glyph_t sprite_glyph
Definition: inventory.h:33
int height
Definition: inventory.h:36
name_t equipped_slot
Definition: inventory.h:29
static ItemClass * Find(name_t item_class)
Definition: inventory.cpp:15
item_action_func primary_action
Definition: inventory.h:23
GUI::font_t sprite_font
Definition: inventory.h:31
GUI::glyph_t icon_glyph
Definition: inventory.h:34
item_action_func idle_action
Definition: inventory.h:25
std::vector< Attribute > attributes
Definition: inventory.h:41
name_t name
Definition: inventory.h:18
GUI::font_t icon_font
Definition: inventory.h:32
name_t viewmodel
Definition: inventory.h:20
float weight
Definition: inventory.h:39
item_action_func secondary_action
Definition: inventory.h:24
name_t worldmodel
Definition: inventory.h:21
int width
Definition: inventory.h:36
bool draw_hands
Definition: inventory.h:27
int stack
Definition: inventory.h:37
Definition: inventory.h:46
bool equipped
Definition: inventory.h:50
int y
Definition: inventory.h:49
int x
Definition: inventory.h:49
name_t item_class
Definition: inventory.h:47
int count
Definition: inventory.h:48
Definition: uid.h:11