Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
itemmarketentryplayeritem.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 <QPointer>
18
19#include "./itemmarketentry.h"
20// Full types (not fwd decls) so QPointer<> can verify they are QObjects. toBox/toItem
21// are NOT owned by this entry (they live in the save's item box) and can be freed out
22// from under a stale entry that lingers in the static instances registry -- QPointer
23// auto-nulls on their destruction so a stale read returns a safe default, not a UAF.
26
27class PlayerBasics;
28
29// Selling player inventory for money or coins
30
39{
40 Q_OBJECT
41
42public:
45
46 virtual QString _name() override;
47 virtual int _inStockCount() override;
48 virtual bool _canSell() override;
49 virtual int _itemWorth() override;
50 virtual QString _whichType() override;
51 virtual int onCartLeft() override;
52 virtual int stackCount() override;
53 virtual QString infoText() override;
54
55public slots:
56 virtual void checkout() override;
57
58public:
59 QPointer<ItemStorageBox> toBox;
60 QPointer<Item> toItem;
61 static constexpr const char* type = "playerItem";
62};
static constexpr const char * type
This row's type key.
virtual void checkout() override
Sell the item (remove qty, credit balance).
QPointer< ItemStorageBox > toBox
The box the item is sold from (auto-nulls if freed).
virtual bool _canSell() override
Subtype: compute sellability.
virtual int onCartLeft() override
Subtype: how many more may be added.
virtual QString infoText() override
Detailed-tooltip body (default none).
virtual int stackCount() override
Subtype: new stack slots needed (see note above).
virtual int _itemWorth() override
Subtype: compute the unit value.
virtual QString _whichType() override
Subtype: report the type label.
QPointer< Item > toItem
The item being sold (auto-nulls if freed).
virtual int _inStockCount() override
Subtype: compute the owned/sellable count.
ItemMarketEntryPlayerItem(ItemStorageBox *toBox, Item *toItem)
virtual QString _name() override
Subtype: compute the display name.
ItemMarketEntry(int compatMoneyCurrency=CompatEither, int compatBuyMode=CompatEither)
A container of Items – either the trainer's bag or a PC item box.
One inventory slot: an item index and an amount, with live pricing.
Definition item.h:36
The trainer's headline values: name, ID, money, coins, badges, starter.