Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
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
25
class
ItemMarketEntryMoney
:
public
ItemMarketEntry
26
{
27
Q_OBJECT
28
29
public
:
31
enum
{
32
DirGlobal
= -1,
33
DirToMoney
= 0,
34
DirToCoins
= 1
35
};
36
40
explicit
ItemMarketEntryMoney
(
int
forceDir
=
DirGlobal
);
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
62
public
slots:
63
virtual
void
checkout
()
override
;
64
65
public
:
66
static
constexpr
const
char
*
type
=
"money"
;
67
68
int
forceDir
=
DirGlobal
;
69
};
ItemMarketEntryMoney::coinsDelta
int coinsDelta() const
Signed coins change for this row's onCart (+buying, -selling).
Definition
itemmarketentrymoney.cpp:100
ItemMarketEntryMoney::~ItemMarketEntryMoney
virtual ~ItemMarketEntryMoney()
Definition
itemmarketentrymoney.cpp:46
ItemMarketEntryMoney::ItemMarketEntryMoney
ItemMarketEntryMoney(int forceDir=DirGlobal)
Definition
itemmarketentrymoney.cpp:38
ItemMarketEntryMoney::buying
bool buying() const
This row's effective direction: true = Money=>Coins (spend money), false = Coins=>Money (spend coins)...
Definition
itemmarketentrymoney.cpp:48
ItemMarketEntryMoney::_canSell
virtual bool _canSell() override
Subtype: compute sellability.
Definition
itemmarketentrymoney.cpp:73
ItemMarketEntryMoney::_whichType
virtual QString _whichType() override
Subtype: report the type label.
Definition
itemmarketentrymoney.cpp:87
ItemMarketEntryMoney::DirToMoney
@ DirToMoney
Coins => Money (the "sell" direction).
Definition
itemmarketentrymoney.h:33
ItemMarketEntryMoney::DirGlobal
@ DirGlobal
Follow the model's global buy/sell flag (legacy behaviour).
Definition
itemmarketentrymoney.h:32
ItemMarketEntryMoney::DirToCoins
@ DirToCoins
Money => Coins (the "buy" direction).
Definition
itemmarketentrymoney.h:34
ItemMarketEntryMoney::_inStockCount
virtual int _inStockCount() override
Subtype: compute the owned/sellable count.
Definition
itemmarketentrymoney.cpp:65
ItemMarketEntryMoney::type
static constexpr const char * type
This row's type key.
Definition
itemmarketentrymoney.h:66
ItemMarketEntryMoney::onCartLeft
virtual int onCartLeft() override
Subtype: how many more may be added.
Definition
itemmarketentrymoney.cpp:108
ItemMarketEntryMoney::stackCount
virtual int stackCount() override
Subtype: new stack slots needed (see note above).
Definition
itemmarketentrymoney.cpp:129
ItemMarketEntryMoney::canCheckout
virtual bool canCheckout() override
Exchange-aware affordability gate.
Definition
itemmarketentrymoney.cpp:136
ItemMarketEntryMoney::forceDir
int forceDir
Fixed direction, or DirGlobal to follow the model.
Definition
itemmarketentrymoney.h:68
ItemMarketEntryMoney::_name
virtual QString _name() override
Subtype: compute the display name.
Definition
itemmarketentrymoney.cpp:55
ItemMarketEntryMoney::_itemWorth
virtual int _itemWorth() override
Subtype: compute the unit value.
Definition
itemmarketentrymoney.cpp:79
ItemMarketEntryMoney::moneyDelta
int moneyDelta() const
Signed money change for this row's onCart (-cost buying, +gain selling).
Definition
itemmarketentrymoney.cpp:92
ItemMarketEntryMoney::checkout
virtual void checkout() override
Apply the money/coins change.
Definition
itemmarketentrymoney.cpp:148
ItemMarketEntry::ItemMarketEntry
ItemMarketEntry(int compatMoneyCurrency=CompatEither, int compatBuyMode=CompatEither)
Definition
itemmarketentry.cpp:28
itemmarketentry.h
projects
app
src
mvc
itemmarket
itemmarketentrymoney.h
Generated by
1.17.0