Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
Trade2ContainerManagerController.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/containers/ContainerEnumName.h"
7#include "mc/world/containers/SlotData.h"
8#include "mc/world/containers/controllers/ItemTakeType.h"
9#include "mc/world/containers/managers/controllers/ContainerManagerController.h"
10#include "mc/world/item/ItemInstance.h"
11
12// auto generated forward declare list
13// clang-format off
14class Actor;
16class ItemStackBase;
17class MerchantRecipe;
18class Player;
20struct AutoPlaceItem;
21struct AutoPlaceResult;
24struct SelectedSlotInfo;
25// clang-format on
26
27class Trade2ContainerManagerController : public ::ContainerManagerController {
28public:
29 // member variables
30 // NOLINTBEGIN
31 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::Trade2ContainerManagerModel>> mTradeContainerManagerModel;
32 ::ll::TypedStorage<1, 1, bool> mSelectBestTradeOnItemPlace;
33 ::ll::TypedStorage<8, 40, ::SlotData const> mCreatedItemOutputSlot;
34 ::ll::TypedStorage<8, 128, ::ItemInstance> mResultPreviewItem;
35 // NOLINTEND
36
37#ifdef LL_PLAT_S
38#else // LL_PLAT_C
39public:
40 // prevent constructor by default
41 Trade2ContainerManagerController();
42
43#endif
44public:
45 // virtual functions
46 // NOLINTBEGIN
47 virtual ~Trade2ContainerManagerController() /*override*/ = default;
48
49 virtual bool isOutputSlot(::std::string const& collectionName) const /*override*/;
50
51 virtual int handleAutoPlace(
52 ::SlotData const& srcSlot,
53 int amount,
54 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
55 ::std::vector<::AutoPlaceResult>& destinations
56 ) /*override*/;
57
58 virtual ::ItemStackBase const& getTakeableItemStackBase(::SlotData const& slot) const /*override*/;
59
60 virtual bool handleTakeAll(::SlotData const& dstSlot, ::SlotData const& srcSlot) /*override*/;
61
62 virtual bool handleTakeAmount(::SlotData const& dstSlot, int amount, ::SlotData const& srcSlot) /*override*/;
63
64 virtual bool handlePlaceAll(::SelectedSlotInfo const& selected, ::SlotData const& dstSlot) /*override*/;
65
66 virtual bool handlePlaceOne(::SlotData const& srcSlot, ::SlotData const& dstSlot) /*override*/;
67
68 virtual bool
69 handleAddToStack(::SlotData const& dstSlot, ::SlotData const& srcSlot, ::ItemTakeType type) /*override*/;
70
71 virtual void _onItemAcquired(::ItemInstance const& stack, ::SlotData const& srcSlot) /*override*/;
72
73#ifdef LL_PLAT_S
74 virtual ::CreateContainerItemScope
75 _makeCreateItemScope(::SlotData const&, ::ItemTransferAmount const&) /*override*/;
76#else // LL_PLAT_C
77 virtual ::CreateContainerItemScope
78 _makeCreateItemScope(::SlotData const& srcSlot, ::ItemTransferAmount const& takeAmount) /*override*/;
79#endif
80
81 // NOLINTEND
82
83public:
84 // member functions
85 // NOLINTBEGIN
86#ifdef LL_PLAT_C
87 MCNAPI explicit Trade2ContainerManagerController(::std::weak_ptr<::Trade2ContainerManagerModel> pModel);
88
89 MCNAPI void _consumeIngredients(uchar const numCrafts);
90
91 MCNAPI void _consumeMaterials(int amount, ::ContainerEnumName const ingredientContainerEnumName);
92
93 MCNAPI void _createResult(bool shouldPlayAudio);
94
95 MCNAPI bool _handleTransferTrade(::SlotData const& srcSlot, ::SlotData const& dstSlot);
96
97 MCNAPI void _pullInIngredientItemsFromInventory(
98 ::ItemInstance const& recipeItemA,
99 ::ItemInstance const& recipeItemB,
102 bool ignoreCustomNamedItems
103 );
104
105 MCNAPI void _selectBestTradeForIngredients();
106
107 MCNAPI void _setupCallbacks();
108
109 MCNAPI int getCurrentTradeExp() const;
110
111 MCNAPI int getEntityMaxTradeTier() const;
112
113 MCNAPI ::MerchantRecipe* getSelectedTrade() const;
114
115 MCNAPI ::MerchantRecipe* getTrade(int tier, int index) const;
116
117 MCNAPI void handleAutoTrade(int tier, int index, ::std::vector<::AutoPlaceResult>&);
118
119 MCNAPI bool isItemValidForSelectedTrade(::ItemStackBase const& item, bool withCount, bool buyA) const;
120
121 MCNAPI bool isSelectedTrade(int tier, int index) const;
122
123 MCNAPI bool isSelectedTradeValid() const;
124
125 MCNAPI void moveIngredientsBackToInventory();
126
127 MCNAPI bool playerHasItemsForTrade(::MerchantRecipe const* recipe) const;
128
129 MCNAPI ::std::pair<bool, bool> playerHasItemsForTradeInInventory(::MerchantRecipe const* recipe) const;
130
131 MCNAPI void pullInIngredientsForSelectedTrade();
132
133 MCNAPI bool selectOfferedTrade();
134
135 MCNAPI void setSelectedTrade(int tier, int index);
136#endif
137 // NOLINTEND
138
139public:
140 // static functions
141 // NOLINTBEGIN
142#ifdef LL_PLAT_C
143 MCNAPI static void
144 _handleBuyItemUse(::ItemInstance const& buyItem, int& emeraldCount, ::Actor& trader, ::Player& player);
145
146 MCNAPI static bool
147 _ingredientsMatchRecipe(::MerchantRecipe const* recipe, ::ItemStackBase const& itemA, ::ItemStackBase const& itemB);
148#endif
149 // NOLINTEND
150
151public:
152 // constructor thunks
153 // NOLINTBEGIN
154#ifdef LL_PLAT_C
155 MCNAPI void* $ctor(::std::weak_ptr<::Trade2ContainerManagerModel> pModel);
156#endif
157 // NOLINTEND
158
159public:
160 // virtual function thunks
161 // NOLINTBEGIN
162#ifdef LL_PLAT_C
163 MCNAPI bool $isOutputSlot(::std::string const& collectionName) const;
164
165 MCNAPI int $handleAutoPlace(
166 ::SlotData const& srcSlot,
167 int amount,
168 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
169 ::std::vector<::AutoPlaceResult>& destinations
170 );
171
172 MCNAPI ::ItemStackBase const& $getTakeableItemStackBase(::SlotData const& slot) const;
173
174 MCNAPI bool $handleTakeAll(::SlotData const& dstSlot, ::SlotData const& srcSlot);
175
176 MCNAPI bool $handleTakeAmount(::SlotData const& dstSlot, int amount, ::SlotData const& srcSlot);
177
178 MCNAPI bool $handlePlaceAll(::SelectedSlotInfo const& selected, ::SlotData const& dstSlot);
179
180 MCNAPI bool $handlePlaceOne(::SlotData const& srcSlot, ::SlotData const& dstSlot);
181
182 MCNAPI bool $handleAddToStack(::SlotData const& dstSlot, ::SlotData const& srcSlot, ::ItemTakeType type);
183
184 MCNAPI void $_onItemAcquired(::ItemInstance const& stack, ::SlotData const& srcSlot);
185
186 MCNAPI ::CreateContainerItemScope
187 $_makeCreateItemScope(::SlotData const& srcSlot, ::ItemTransferAmount const& takeAmount);
188#endif
189
190
191 // NOLINTEND
192
193public:
194 // vftables
195 // NOLINTBEGIN
196 MCNAPI static void** $vftable();
197 // NOLINTEND
198};
Definition Actor.h:116
Definition ContainerController.h:20
Definition ItemInstance.h:15
Definition ItemStackBase.h:45
Definition MerchantRecipe.h:18
Definition Player.h:131
static MCAPI void ** $vftable()
Definition Trade2ContainerManagerModel.h:17
Definition AutoPlaceItem.h:5
Definition AutoPlaceResult.h:5
Definition CreateContainerItemScope.h:18
Definition ItemTransferAmount.h:5
Definition SelectedSlotInfo.h:10
Definition SlotData.h:5