Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
item.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 <QObject>
18
#include <QString>
19
#include <
pse-common/types.h
>
20
#include "
../../savefile_autoport.h
"
21
22
class
SaveFileIterator
;
23
class
ItemDBEntry
;
24
35
class
SAVEFILE_AUTOPORT
Item
:
public
QObject
36
{
37
Q_OBJECT
38
39
Q_PROPERTY(
int
ind
MEMBER
ind
NOTIFY
indChanged
)
40
Q_PROPERTY(
int
amount
READ
getAmount
WRITE
setAmount
NOTIFY
amountChanged
)
41
42
Q_PROPERTY(
bool
canSell
READ
canSell
NOTIFY
itemChanged
STORED
false
)
43
44
Q_PROPERTY(
int
buyPriceOneMoney
READ
buyPriceOneMoney
NOTIFY
itemChanged
STORED
false
)
45
Q_PROPERTY(
int
buyPriceOneCoins
READ
buyPriceOneCoins
NOTIFY
itemChanged
STORED
false
)
46
Q_PROPERTY(
int
sellPriceOneMoney
READ
sellPriceOneMoney
NOTIFY
itemChanged
STORED
false
)
47
Q_PROPERTY(
int
sellPriceOneCoins
READ
sellPriceOneCoins
NOTIFY
itemChanged
STORED
false
)
48
49
Q_PROPERTY(
int
buyPriceAllMoney
READ
buyPriceAllMoney
NOTIFY
itemChanged
STORED
false
)
50
Q_PROPERTY(
int
buyPriceAllCoins
READ
buyPriceAllCoins
NOTIFY
itemChanged
STORED
false
)
51
Q_PROPERTY(
int
sellPriceAllMoney
READ
sellPriceAllMoney
NOTIFY
itemChanged
STORED
false
)
52
Q_PROPERTY(
int
sellPriceAllCoins
READ
sellPriceAllCoins
NOTIFY
itemChanged
STORED
false
)
53
54
public
:
57
Item
(
SaveFileIterator
* it =
nullptr
);
58
60
Item
(
var8
ind
,
var8
amount
);
61
63
Item
(
bool
random);
64
66
Item
(QString name,
var8
amount
);
67
68
void
makeConnect
();
69
70
virtual
~Item
();
71
73
void
save
(
SaveFileIterator
* it);
74
75
ItemDBEntry
*
toItem
();
76
77
bool
canSell
();
78
79
int
buyPriceOneMoney
();
80
int
buyPriceOneCoins
();
81
int
sellPriceOneMoney
();
82
int
sellPriceOneCoins
();
83
84
int
buyPriceAllMoney
();
85
int
buyPriceAllCoins
();
86
int
sellPriceAllMoney
();
87
int
sellPriceAllCoins
();
88
89
int
getAmount
();
90
void
setAmount
(
int
val);
91
92
signals:
93
void
indChanged
();
94
void
amountChanged
();
95
void
itemChanged
();
96
97
public
slots:
98
void
load
(
int
ind
,
int
amount
);
99
void
load
(
bool
random);
100
void
load
(QString name,
int
amount
);
101
void
reset
();
102
void
randomize
();
103
104
public
:
105
// Item Index
106
int
ind
;
107
108
// Item Amount, max of 99 for gen 1 games
109
int
amount
;
110
};
Item::ind
int ind
Item index (backs property).
Definition
item.h:106
Item::makeConnect
void makeConnect()
Wire up internal signal connections.
Definition
item.cpp:60
Item::sellPriceOneMoney
int sellPriceOneMoney()
Definition
item.cpp:134
Item::reset
void reset()
Blank this slot.
Definition
item.cpp:74
Item::amount
int amount
Item amount (max 99 in Gen 1; backs property).
Definition
item.h:109
Item::amountChanged
void amountChanged()
Item::getAmount
int getAmount()
Current amount (backs property READ).
Definition
item.cpp:174
Item::buyPriceOneCoins
int buyPriceOneCoins()
Definition
item.cpp:124
Item::sellPriceAllMoney
int sellPriceAllMoney()
Definition
item.cpp:164
Item::randomize
void randomize()
Randomize this slot.
Definition
item.cpp:83
Item::load
void load(int ind, int amount)
Set from an index + amount.
Definition
item.cpp:188
Item::sellPriceOneCoins
int sellPriceOneCoins()
Definition
item.cpp:144
Item::indChanged
protected::void indChanged()
Item::buyPriceAllCoins
int buyPriceAllCoins()
Definition
item.cpp:159
Item::sellPriceAllCoins
int sellPriceAllCoins()
Definition
item.cpp:169
Item::Item
Item(SaveFileIterator *it=nullptr)
< Item index (into the items DB).
Definition
item.cpp:30
Item::setAmount
void setAmount(int val)
Set amount (backs property WRITE; clamped to the Gen 1 max).
Definition
item.cpp:179
Item::canSell
bool canSell()
Whether the item may be sold.
Definition
item.cpp:104
Item::buyPriceOneMoney
int buyPriceOneMoney()
Definition
item.cpp:114
Item::buyPriceAllMoney
int buyPriceAllMoney()
Definition
item.cpp:154
Item::itemChanged
void itemChanged()
Item::save
void save(SaveFileIterator *it)
Given an iterator, saves 2 bytes: index and amount.
Definition
item.cpp:68
Item::toItem
ItemDBEntry * toItem()
Resolve ind to its DB entry.
Definition
item.cpp:98
SaveFileIterator
A moving cursor over a SaveFile, layering auto-advancing reads/writes on top of SaveFileToolset.
Definition
savefileiterator.h:42
types.h
Project-wide fixed-width integer aliases (var8, var16, ...).
var8
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
Definition
types.h:124
savefile_autoport.h
Import/export macro for the savefile library, plus the central list of QObject types kept deliberatel...
SAVEFILE_AUTOPORT
#define SAVEFILE_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition
savefile_autoport.h:38
ItemDBEntry
One item's static data: name/flags, pricing, and where it's used.
Definition
itemdbentry.h:46
projects
savefile
src
pse-savefile
expanded
fragments
item.h
Generated by
1.17.0