Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
trades.h
Go to the documentation of this file.
1
/*
2
* Copyright 2019 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
18
#include <QObject>
19
#include <QJsonValue>
20
#include <QString>
21
#include <QVector>
22
23
#include <
pse-common/types.h
>
24
#include "
./db_autoport.h
"
25
26
struct
PokemonDBEntry
;
27
class
QQmlEngine;
28
37
struct
DB_AUTOPORT
TradeDBEntry
{
38
TradeDBEntry
();
39
TradeDBEntry
(QJsonValue& data);
40
void
deepLink
();
41
42
QString
give
;
43
QString
get
;
44
var8
textId
= 0;
45
QString
nickname
;
46
bool
unused
=
false
;
47
48
PokemonDBEntry
*
toGive
=
nullptr
;
49
PokemonDBEntry
*
toGet
=
nullptr
;
50
};
51
60
class
DB_AUTOPORT
TradesDB :
public
QObject
61
{
62
Q_OBJECT
63
Q_PROPERTY(
int
getStoreSize
READ
getStoreSize
CONSTANT)
64
65
public
:
66
static
TradesDB*
inst
();
67
68
[[nodiscard]]
const
QVector<TradeDBEntry*>
getStore
()
const
;
69
[[nodiscard]]
int
getStoreSize
()
const
;
70
71
Q_INVOKABLE
TradeDBEntry
*
getStoreAt
(
int
idx)
const
;
72
73
public
slots:
74
void
load
();
75
void
deepLink
();
76
void
qmlProtect
(
const
QQmlEngine*
const
engine)
const
;
77
78
private
slots:
79
void
qmlRegister()
const
;
80
81
private
:
82
TradesDB();
83
84
QVector<TradeDBEntry*> store;
85
};
TradesDB::deepLink
void deepLink()
Resolve each trade's species links.
Definition
trades.cpp:81
TradesDB::inst
static TradesDB * inst()
< Number of trades.
Definition
trades.cpp:56
TradesDB::getStoreSize
int getStoreSize() const
Trade count.
Definition
trades.cpp:63
TradesDB::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
trades.cpp:90
TradesDB::load
void load()
Load trades from JSON.
Definition
trades.cpp:71
TradesDB::getStoreAt
TradeDBEntry * getStoreAt(int idx) const
Trade by store index (for QML).
Definition
trades.cpp:65
TradesDB::getStore
const QVector< TradeDBEntry * > getStore() const
All trades.
Definition
trades.cpp:62
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
db_autoport.h
Import/export macro for the db library, plus the central list of DB entry pointer types declared opaq...
DB_AUTOPORT
#define DB_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition
db_autoport.h:37
PokemonDBEntry
One species' complete static data – the richest entry in the db layer.
Definition
pokemon.h:98
TradeDBEntry
One in-game (NPC) trade definition: what you give and get.
Definition
trades.h:37
TradeDBEntry::toGet
PokemonDBEntry * toGet
Resolved species you get (deepLink).
Definition
trades.h:49
TradeDBEntry::deepLink
void deepLink()
Resolve the give/get species links.
Definition
trades.cpp:44
TradeDBEntry::textId
var8 textId
Trade dialogue text id.
Definition
trades.h:44
TradeDBEntry::TradeDBEntry
TradeDBEntry()
Empty entry.
Definition
trades.cpp:34
TradeDBEntry::unused
bool unused
Whether this trade slot is unused.
Definition
trades.h:46
TradeDBEntry::nickname
QString nickname
Nickname the received mon comes with.
Definition
trades.h:45
TradeDBEntry::give
QString give
Species name you give (resolved to toGive).
Definition
trades.h:42
TradeDBEntry::get
QString get
Species name you get (resolved to toGet).
Definition
trades.h:43
TradeDBEntry::toGive
PokemonDBEntry * toGive
Resolved species you give (deepLink).
Definition
trades.h:48
projects
db
src
pse-db
trades.h
Generated by
1.17.0