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;
25struct SelectedSlotInfo;
26// clang-format on
27
28class Trade2ContainerManagerController : public ::ContainerManagerController {
29public:
30 // member variables
31 // NOLINTBEGIN
32 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::Trade2ContainerManagerModel>> mTradeContainerManagerModel;
33 ::ll::TypedStorage<1, 1, bool> mSelectBestTradeOnItemPlace;
34 ::ll::TypedStorage<8, 40, ::SlotData const> mCreatedItemOutputSlot;
35 ::ll::TypedStorage<8, 128, ::ItemInstance> mResultPreviewItem;
36 // NOLINTEND
37
38#ifdef LL_PLAT_S
39#else // LL_PLAT_C
40public:
41 // prevent constructor by default
42 Trade2ContainerManagerController();
43
44#endif
45public:
46 // virtual functions
47 // NOLINTBEGIN
48#ifdef LL_PLAT_S
49 virtual ~Trade2ContainerManagerController() /*override*/ = default;
50#else // LL_PLAT_C
51 virtual ~Trade2ContainerManagerController() /*override*/;
52#endif
53
54#ifdef LL_PLAT_S
55 virtual bool isOutputSlot(::std::string const&) const /*override*/;
56#else // LL_PLAT_C
57 virtual bool isOutputSlot(::std::string const& collectionName) const /*override*/;
58#endif
59
60#ifdef LL_PLAT_S
61 virtual int handleAutoPlace(
62 ::SlotData const&,
63 int,
64 ::std::vector<::AutoPlaceItem> const&,
65 ::std::vector<::AutoPlaceResult>&
66 ) /*override*/;
67#else // LL_PLAT_C
68 virtual int handleAutoPlace(
69 ::SlotData const& srcSlot,
70 int amount,
71 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
72 ::std::vector<::AutoPlaceResult>& destinations
73 ) /*override*/;
74#endif
75
76#ifdef LL_PLAT_S
77 virtual ::ItemStackBase const& getTakeableItemStackBase(::SlotData const&) const /*override*/;
78#else // LL_PLAT_C
79 virtual ::ItemStackBase const& getTakeableItemStackBase(::SlotData const& slot) const /*override*/;
80#endif
81
82#ifdef LL_PLAT_S
83 virtual void handleTakeAll(::SlotData const&, ::SlotData const&) /*override*/;
84#else // LL_PLAT_C
85 virtual void handleTakeAll(::SlotData const& dstSlot, ::SlotData const& srcSlot) /*override*/;
86#endif
87
88#ifdef LL_PLAT_S
89 virtual void handleTakeAmount(::SlotData const&, int, ::SlotData const&) /*override*/;
90#else // LL_PLAT_C
91 virtual void handleTakeAmount(::SlotData const& dstSlot, int amount, ::SlotData const& srcSlot) /*override*/;
92#endif
93
94#ifdef LL_PLAT_S
95 virtual void handlePlaceAll(::SelectedSlotInfo const&, ::SlotData const&) /*override*/;
96#else // LL_PLAT_C
97 virtual void handlePlaceAll(::SelectedSlotInfo const& selected, ::SlotData const& dstSlot) /*override*/;
98#endif
99
100#ifdef LL_PLAT_S
101 virtual void handlePlaceOne(::SlotData const&, ::SlotData const&) /*override*/;
102#else // LL_PLAT_C
103 virtual void handlePlaceOne(::SlotData const& srcSlot, ::SlotData const& dstSlot) /*override*/;
104#endif
105
106#ifdef LL_PLAT_S
107 virtual void handleAddToStack(::SlotData const&, ::SlotData const&, ::ItemTakeType) /*override*/;
108#else // LL_PLAT_C
109 virtual void
110 handleAddToStack(::SlotData const& dstSlot, ::SlotData const& srcSlot, ::ItemTakeType type) /*override*/;
111#endif
112
113#ifdef LL_PLAT_S
114 virtual void _onItemAcquired(::ItemInstance const&, ::SlotData const&) /*override*/;
115#else // LL_PLAT_C
116 virtual void _onItemAcquired(::ItemInstance const& stack, ::SlotData const& srcSlot) /*override*/;
117#endif
118
119#ifdef LL_PLAT_S
120 virtual ::CreateContainerItemScope
121 _makeCreateItemScope(::SlotData const&, ::ItemTransferAmount const&) /*override*/;
122#else // LL_PLAT_C
123 virtual ::CreateContainerItemScope
124 _makeCreateItemScope(::SlotData const& srcSlot, ::ItemTransferAmount const& takeAmount) /*override*/;
125#endif
126
127 // NOLINTEND
128
129public:
130 // member functions
131 // NOLINTBEGIN
132#ifdef LL_PLAT_C
133 MCNAPI explicit Trade2ContainerManagerController(::std::weak_ptr<::Trade2ContainerManagerModel> pModel);
134
135 MCNAPI void _consumeIngredients(uchar numCrafts);
136
137 MCNAPI void _consumeMaterials(int amount, ::ContainerEnumName ingredientContainerEnumName);
138
139 MCNAPI void _createResult(bool shouldPlayAudio);
140
141 MCNAPI void
142 _createTradeItem(::ItemInstance& itemInstance, ::ItemStackRequestScope const& requestScope, uchar numCrafts);
143
144 MCNAPI void _handleBuyItemUse(::ItemInstance const& buyItem, int& emeraldCount, ::Actor& trader, ::Player& player);
145
146 MCNAPI bool _handleTransferTrade(::SlotData const& srcSlot, ::SlotData const& dstSlot);
147
148 MCNAPI bool _ingredientsMatchRecipe(
149 ::MerchantRecipe const* recipe,
150 ::ItemStackBase const& itemA,
151 ::ItemStackBase const& itemB
152 ) const;
153
154 MCNAPI void _pullInIngredientItemsFromInventory(
155 ::ItemInstance const& recipeItemA,
156 ::ItemInstance const& recipeItemB,
159 bool ignoreCustomNamedItems
160 );
161
162 MCNAPI void _selectBestTradeForIngredients();
163
164 MCNAPI void _setupCallbacks();
165
166 MCNAPI int getCurrentTradeExp() const;
167
168 MCNAPI ::std::string getDisplayName();
169
170 MCNAPI ::std::string getDisplayNameTag() const;
171
172 MCNAPI int getEntityMaxTradeTier() const;
173
174 MCNAPI int getEntityTradeTier() const;
175
176 MCNAPI ::std::vector<int> getNumberOfTradesByTier() const;
177
178 MCNAPI ::MerchantRecipe* getSelectedTrade() const;
179
180 MCNAPI ::MerchantRecipe* getTrade(int tier, int index) const;
181
182 MCNAPI int getTradeExpForCurrentRequirement(uint currentExp) const;
183
184 MCNAPI int getTradeExpToNextRequirement(uint currentExp) const;
185
186 MCNAPI void handleAutoTrade(int tier, int index, ::std::vector<::AutoPlaceResult>&);
187
188 MCNAPI bool hasAvailableTradeWithSecondItem() const;
189
190 MCNAPI bool isItemValidForSelectedTrade(::ItemStackBase const& item, bool withCount, bool buyA) const;
191
192 MCNAPI bool isSelectedTrade(int tier, int index) const;
193
194 MCNAPI bool isSelectedTradeValid() const;
195
196 MCNAPI void moveIngredientsBackToInventory();
197
198 MCNAPI bool playerHasItemsForTrade(::MerchantRecipe const* recipe) const;
199
200 MCNAPI ::std::pair<bool, bool> playerHasItemsForTradeInInventory(::MerchantRecipe const* recipe) const;
201
202 MCNAPI void pullInIngredientsForSelectedTrade();
203
204 MCNAPI bool selectOfferedTrade();
205
206 MCNAPI void setSelectedTrade(int tier, int index);
207#endif
208 // NOLINTEND
209
210public:
211 // constructor thunks
212 // NOLINTBEGIN
213#ifdef LL_PLAT_C
214 MCNAPI void* $ctor(::std::weak_ptr<::Trade2ContainerManagerModel> pModel);
215#endif
216 // NOLINTEND
217
218public:
219 // destructor thunk
220 // NOLINTBEGIN
221 MCNAPI void $dtor();
222 // NOLINTEND
223
224public:
225 // virtual function thunks
226 // NOLINTBEGIN
227#ifdef LL_PLAT_C
228 MCNAPI bool $isOutputSlot(::std::string const& collectionName) const;
229
230 MCNAPI int $handleAutoPlace(
231 ::SlotData const& srcSlot,
232 int amount,
233 ::std::vector<::AutoPlaceItem> const& autoPlaceOrder,
234 ::std::vector<::AutoPlaceResult>& destinations
235 );
236
237 MCNAPI ::ItemStackBase const& $getTakeableItemStackBase(::SlotData const& slot) const;
238
239 MCNAPI void $handleTakeAll(::SlotData const& dstSlot, ::SlotData const& srcSlot);
240
241 MCNAPI void $handleTakeAmount(::SlotData const& dstSlot, int amount, ::SlotData const& srcSlot);
242
243 MCNAPI void $handlePlaceAll(::SelectedSlotInfo const& selected, ::SlotData const& dstSlot);
244
245 MCNAPI void $handlePlaceOne(::SlotData const& srcSlot, ::SlotData const& dstSlot);
246
247 MCNAPI void $handleAddToStack(::SlotData const& dstSlot, ::SlotData const& srcSlot, ::ItemTakeType type);
248
249 MCNAPI void $_onItemAcquired(::ItemInstance const& stack, ::SlotData const& srcSlot);
250
251 MCNAPI ::CreateContainerItemScope
252 $_makeCreateItemScope(::SlotData const& srcSlot, ::ItemTransferAmount const& takeAmount);
253#endif
254
255
256 // NOLINTEND
257
258public:
259 // vftables
260 // NOLINTBEGIN
261 MCNAPI static void** $vftable();
262 // NOLINTEND
263};
Definition Actor.h:125
Definition ContainerController.h:21
Definition ItemInstance.h:15
Definition ItemStackBase.h:52
Definition MerchantRecipe.h:20
Definition Player.h:137
static MCAPI void ** $vftable()
Definition Trade2ContainerManagerModel.h:20
Definition AutoPlaceItem.h:5
Definition AutoPlaceResult.h:5
Definition CreateContainerItemScope.h:18
Definition ItemStackRequestScope.h:16
Definition ItemTransferAmount.h:9
Definition SelectedSlotInfo.h:10
Definition SlotData.h:10