aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MerchantMenu.h
blob: 14a5fa1d17071eeb7b39c0f9497fdfb9190b9f4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include "AbstractContainerMenu.h"

class MerchantContainer;

class MerchantMenu : public AbstractContainerMenu
{
public:
	static const int PAYMENT1_SLOT = 0;
	static const int PAYMENT2_SLOT = 1;
	static const int RESULT_SLOT = 2;

	static const int INV_SLOT_START = RESULT_SLOT + 1;
	static const int INV_SLOT_END = INV_SLOT_START + 9 * 3;
	static const int USE_ROW_SLOT_START = INV_SLOT_END;
	static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9;

	static const int SELLSLOT1_X = 36;
	static const int SELLSLOT2_X = SELLSLOT1_X + 26;
	static const int BUYSLOT_X = 120;

	static const int ROW1_Y = 24;
	static const int ROW2_Y = 53;


private:
	shared_ptr<Merchant> trader;
	shared_ptr<MerchantContainer> tradeContainer;
	Level *level;

public:
	MerchantMenu(shared_ptr<Inventory> inventory, shared_ptr<Merchant> merchant, Level *level);

	shared_ptr<MerchantContainer> getTradeContainer();
	void addSlotListener(ContainerListener *listener);
	void broadcastChanges();
	void slotsChanged(); // 4J used to take a shared_ptr<Container> but wasn't using it, so removed to simplify things
	void setSelectionHint(int hint);
	void setData(int id, int value);
	bool stillValid(shared_ptr<Player> player);
	shared_ptr<ItemInstance> quickMoveStack(shared_ptr<Player> player, int slotIndex);
	void removed(shared_ptr<Player> player);

	shared_ptr<Merchant> getMerchant(); // 4J Added
};