2026-03-01 12:16:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Container.h"
|
|
|
|
|
#include "ArrayWithLength.h"
|
|
|
|
|
|
|
|
|
|
class Merchant;
|
|
|
|
|
class Player;
|
|
|
|
|
class MerchantRecipe;
|
|
|
|
|
|
|
|
|
|
class MerchantContainer : public Container
|
|
|
|
|
{
|
|
|
|
|
private:
|
2026-03-02 15:58:20 +07:00
|
|
|
std::shared_ptr<Merchant> merchant;
|
2026-03-01 12:16:08 +08:00
|
|
|
ItemInstanceArray items;
|
2026-03-02 15:58:20 +07:00
|
|
|
std::shared_ptr<Player> player;
|
2026-03-01 12:16:08 +08:00
|
|
|
MerchantRecipe *activeRecipe;
|
|
|
|
|
int selectionHint;
|
|
|
|
|
|
|
|
|
|
public:
|
2026-03-02 15:58:20 +07:00
|
|
|
MerchantContainer(std::shared_ptr<Player> player, std::shared_ptr<Merchant> villager);
|
2026-03-01 12:16:08 +08:00
|
|
|
~MerchantContainer();
|
|
|
|
|
|
|
|
|
|
unsigned int getContainerSize();
|
2026-03-02 15:58:20 +07:00
|
|
|
std::shared_ptr<ItemInstance> getItem(unsigned int slot);
|
|
|
|
|
std::shared_ptr<ItemInstance> removeItem(unsigned int slot, int count);
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool isPaymentSlot(int slot);
|
|
|
|
|
|
|
|
|
|
public:
|
2026-03-02 15:58:20 +07:00
|
|
|
std::shared_ptr<ItemInstance> removeItemNoUpdate(int slot);
|
|
|
|
|
void setItem(unsigned int slot, std::shared_ptr<ItemInstance> item);
|
2026-03-01 12:16:08 +08:00
|
|
|
int getName();
|
|
|
|
|
int getMaxStackSize();
|
2026-03-02 15:58:20 +07:00
|
|
|
bool stillValid(std::shared_ptr<Player> player);
|
2026-03-01 12:16:08 +08:00
|
|
|
void startOpen();
|
|
|
|
|
void stopOpen();
|
|
|
|
|
void setChanged();
|
|
|
|
|
void updateSellItem();
|
|
|
|
|
MerchantRecipe *getActiveRecipe();
|
|
|
|
|
void setSelectionHint(int selectionHint);
|
|
|
|
|
};
|