Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
itemmarketentrymoney.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16#pragma once
17#include "./itemmarketentry.h"
18
26{
27 Q_OBJECT
28
29public:
31 enum {
32 DirGlobal = -1,
35 };
36
41 virtual ~ItemMarketEntryMoney();
42
43 virtual QString _name() override;
44 virtual int _inStockCount() override;
45 virtual bool _canSell() override;
46 virtual int _itemWorth() override;
47 virtual QString _whichType() override;
48 virtual int onCartLeft() override;
49 virtual int stackCount() override;
50 virtual bool canCheckout() override;
51
54 bool buying() const;
55
56 // The unit traded is ONE COIN (onCart = number of coins). A coin costs
57 // GameCornerDB buy price (~20) to buy and returns the sell price (~half) when
58 // sold -- the source of truth for the whole Game Corner / Mart economy.
59 int moneyDelta() const;
60 int coinsDelta() const;
61
62public slots:
63 virtual void checkout() override;
64
65public:
66 static constexpr const char* type = "money";
67
69};
int coinsDelta() const
Signed coins change for this row's onCart (+buying, -selling).
ItemMarketEntryMoney(int forceDir=DirGlobal)
bool buying() const
This row's effective direction: true = Money=>Coins (spend money), false = Coins=>Money (spend coins)...
virtual bool _canSell() override
Subtype: compute sellability.
virtual QString _whichType() override
Subtype: report the type label.
@ DirToMoney
Coins => Money (the "sell" direction).
@ DirGlobal
Follow the model's global buy/sell flag (legacy behaviour).
@ DirToCoins
Money => Coins (the "buy" direction).
virtual int _inStockCount() override
Subtype: compute the owned/sellable count.
static constexpr const char * type
This row's type key.
virtual int onCartLeft() override
Subtype: how many more may be added.
virtual int stackCount() override
Subtype: new stack slots needed (see note above).
virtual bool canCheckout() override
Exchange-aware affordability gate.
int forceDir
Fixed direction, or DirGlobal to follow the model.
virtual QString _name() override
Subtype: compute the display name.
virtual int _itemWorth() override
Subtype: compute the unit value.
int moneyDelta() const
Signed money change for this row's onCart (-cost buying, +gain selling).
virtual void checkout() override
Apply the money/coins change.
ItemMarketEntry(int compatMoneyCurrency=CompatEither, int compatBuyMode=CompatEither)