Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
ItemDBEntry Struct Reference

One item's static data: name/flags, pricing, and where it's used. More...

#include <itemdbentry.h>

Inheritance diagram for ItemDBEntry:
Collaboration diagram for ItemDBEntry:

Public Member Functions

QString getName () const
 < Internal item name.
int getInd () const
bool getOnce () const
bool getGlitch () const
QString getReadable () const
int getTm () const
int getHm () const
int getPrice () const
QString getInfo () const
int buyPriceMoney () const
int buyPriceCoins () const
int sellPriceMoney () const
int sellPriceCoins () const
bool canSell () const
bool isGameCornerExclusive () const
MoveDBEntrygetToMove () const
GameCornerDBEntrygetToGameCorner () const
const QVector< MapDBEntrySpriteItem * > getToMapSpriteItem () const
 Map sprites that drop this item.
int getToMapSpriteItemSize () const
MapDBEntrySpriteItemgetToMapSpriteItemAt (int ind) const
 Map-sprite-item ind (for QML).
const QVector< PokemonDBEntryEvolution * > getToEvolvePokemon () const
 Evolutions triggered by this item.
int getToEvolvePokemonSize () const
PokemonDBEntryEvolutiongetToEvolvePokemonAt (int ind) const
 Evolution ind (for QML).
const QVector< PokemonDBEntry * > getToTeachPokemon () const
 Pokemon this TM/HM teaches.
int getToTeachPokemonSize () const
PokemonDBEntrygetToTeachPokemonAt (int ind) const
 Taught Pokemon ind (for QML).
void qmlProtect (const QQmlEngine *const engine) const
 Pin to C++ ownership.

Protected Member Functions

 ItemDBEntry ()
 Empty entry (built by ItemsDB).
 ItemDBEntry (const QJsonValue &data)
 Build from a JSON value.
void deepLink ()
 Resolve the move/Game-Corner links.
void qmlRegister () const
 Register with QML.

Protected Attributes

QString name = ""
 Backing field (read via getName()).
int ind = -1
 Backing field (read via getInd()).
bool once = false
 Backing field (read via getOnce()).
bool glitch = false
 Backing field (read via getGlitch()).
QString readable = ""
 Backing field (read via getReadable()).
int tm = -1
 Backing field (read via getTm()).
int hm = -1
 Backing field (read via getHm()).
int price = -1
 Backing field (read via getPrice()).
QString info = ""
 Backing field (read via getInfo()); optional "info" in items.json.
MoveDBEntrytoMove = nullptr
 Resolved taught move (deepLink).
GameCornerDBEntrytoGameCorner = nullptr
 Resolved Game Corner entry (deepLink).
QVector< MapDBEntrySpriteItem * > toMapSpriteItem
 Map sprites dropping this (back-ref).
QVector< PokemonDBEntryEvolution * > toEvolvePokemon
 Evolutions using this (back-ref).
QVector< PokemonDBEntry * > toTeachPokemon
 Pokemon this teaches (back-ref).

Friends

class ItemsDB
 Owning DB constructs/populates entries.
struct MapDBEntrySpriteItem
 Writes toMapSpriteItem.
struct GameCornerDBEntry
struct PokemonDBEntry
struct PokemonDBEntryEvolution

Detailed Description

One item's static data: name/flags, pricing, and where it's used.

QObject-getter style DB entry. Beyond the basic fields it computes the full pricing surface (buy/sell, money/coins, plus canSell / isGameCornerExclusive) and exposes several cross-reference lists – the map sprites that drop it, the evolutions that use it, and the Pokemon it teaches. Because Qt can't expose a vector as a property, each list is surfaced as a ...Size property plus an invokable ...At(ind) accessor (the standard workaround). Each friend writes its respective back-reference during deepLink.

See also
ItemsDB, Item (the save-side inventory slot), db.md.

Definition at line 46 of file itemdbentry.h.

Constructor & Destructor Documentation

◆ ItemDBEntry() [1/2]

ItemDBEntry::ItemDBEntry ( )
protected

Empty entry (built by ItemsDB).

Definition at line 30 of file itemdbentry.cpp.

References qmlRegister().

◆ ItemDBEntry() [2/2]

ItemDBEntry::ItemDBEntry ( const QJsonValue & data)
protected

Build from a JSON value.

Definition at line 33 of file itemdbentry.cpp.

References glitch, hm, ind, info, name, once, price, qmlRegister(), readable, and tm.

Member Function Documentation

◆ buyPriceCoins()

int ItemDBEntry::buyPriceCoins ( ) const

◆ buyPriceMoney()

int ItemDBEntry::buyPriceMoney ( ) const
See also
buyPriceMoney property.

Definition at line 200 of file itemdbentry.cpp.

References price.

Referenced by sellPriceMoney(), and ItemMarketModel::vendorListItem().

◆ canSell()

bool ItemDBEntry::canSell ( ) const
See also
canSell property.

Definition at line 251 of file itemdbentry.cpp.

References price.

Referenced by ItemMarketModel::vendorListItem().

◆ deepLink()

void ItemDBEntry::deepLink ( )
protected

Resolve the move/Game-Corner links.

Definition at line 62 of file itemdbentry.cpp.

References MovesDB::getIndAt(), hm, MovesDB::inst(), name, tm, and toMove.

◆ getGlitch()

bool ItemDBEntry::getGlitch ( ) const
See also
getGlitch property.

Definition at line 180 of file itemdbentry.cpp.

References glitch.

◆ getHm()

int ItemDBEntry::getHm ( ) const
See also
getHm property.

Definition at line 165 of file itemdbentry.cpp.

References hm.

◆ getInd()

int ItemDBEntry::getInd ( ) const
See also
getInd property.

Definition at line 190 of file itemdbentry.cpp.

References ind.

Referenced by ItemMarketModel::buyableInGame(), and ItemMarketModel::isVendingItem().

◆ getInfo()

QString ItemDBEntry::getInfo ( ) const
See also
getInfo property.

Definition at line 160 of file itemdbentry.cpp.

References info.

Referenced by ItemSelectModel::infoForInd().

◆ getName()

QString ItemDBEntry::getName ( ) const

< Internal item name.

Item index. One-time-only item. Glitch item. Display name. TM number, if a TM. HM number, if an HM. Base price. Detailed-tooltip lore: what it is / how it's obtained. Buy price in money. Buy price in coins. Sell price in money. Sell price in coins. Whether it can be sold. Coins-only (Game Corner) item. Move taught (if a TM/HM). Game Corner prize entry, if any. < Count of map sprites dropping this. Count of evolutions using this. Count of Pokemon it teaches.

See also
getName property.

Definition at line 195 of file itemdbentry.cpp.

References name.

◆ getOnce()

bool ItemDBEntry::getOnce ( ) const
See also
getOnce property.

Definition at line 185 of file itemdbentry.cpp.

References once.

◆ getPrice()

int ItemDBEntry::getPrice ( ) const
See also
getPrice property.

Definition at line 155 of file itemdbentry.cpp.

References price.

◆ getReadable()

QString ItemDBEntry::getReadable ( ) const
See also
getReadable property.

Definition at line 175 of file itemdbentry.cpp.

References readable.

◆ getTm()

int ItemDBEntry::getTm ( ) const
See also
getTm property.

Definition at line 170 of file itemdbentry.cpp.

References tm.

◆ getToEvolvePokemon()

const QVector< PokemonDBEntryEvolution * > ItemDBEntry::getToEvolvePokemon ( ) const

Evolutions triggered by this item.

Definition at line 109 of file itemdbentry.cpp.

References toEvolvePokemon.

◆ getToEvolvePokemonAt()

PokemonDBEntryEvolution * ItemDBEntry::getToEvolvePokemonAt ( int ind) const

Evolution ind (for QML).

Definition at line 119 of file itemdbentry.cpp.

References ind, PokemonDBEntryEvolution, and toEvolvePokemon.

◆ getToEvolvePokemonSize()

int ItemDBEntry::getToEvolvePokemonSize ( ) const
See also
getToEvolvePokemonSize property.

Definition at line 114 of file itemdbentry.cpp.

References toEvolvePokemon.

◆ getToGameCorner()

GameCornerDBEntry * ItemDBEntry::getToGameCorner ( ) const
See also
getToGameCorner property.

Definition at line 145 of file itemdbentry.cpp.

References GameCornerDBEntry, and toGameCorner.

◆ getToMapSpriteItem()

const QVector< MapDBEntrySpriteItem * > ItemDBEntry::getToMapSpriteItem ( ) const

Map sprites that drop this item.

Definition at line 127 of file itemdbentry.cpp.

References toMapSpriteItem.

◆ getToMapSpriteItemAt()

MapDBEntrySpriteItem * ItemDBEntry::getToMapSpriteItemAt ( int ind) const

Map-sprite-item ind (for QML).

Definition at line 137 of file itemdbentry.cpp.

References ind, MapDBEntrySpriteItem, and toMapSpriteItem.

◆ getToMapSpriteItemSize()

int ItemDBEntry::getToMapSpriteItemSize ( ) const
See also
getToMapSpriteItemSize property.

Definition at line 132 of file itemdbentry.cpp.

References toMapSpriteItem.

◆ getToMove()

MoveDBEntry * ItemDBEntry::getToMove ( ) const
See also
getToMove property.

Definition at line 150 of file itemdbentry.cpp.

References toMove.

◆ getToTeachPokemon()

const QVector< PokemonDBEntry * > ItemDBEntry::getToTeachPokemon ( ) const

Pokemon this TM/HM teaches.

Definition at line 86 of file itemdbentry.cpp.

References toTeachPokemon.

◆ getToTeachPokemonAt()

PokemonDBEntry * ItemDBEntry::getToTeachPokemonAt ( int ind) const

Taught Pokemon ind (for QML).

Definition at line 96 of file itemdbentry.cpp.

References ind, PokemonDBEntry, and toTeachPokemon.

◆ getToTeachPokemonSize()

int ItemDBEntry::getToTeachPokemonSize ( ) const
See also
getToTeachPokemonSize property.

Definition at line 91 of file itemdbentry.cpp.

References toTeachPokemon.

◆ isGameCornerExclusive()

bool ItemDBEntry::isGameCornerExclusive ( ) const
See also
isGameCornerExclusive property.

Definition at line 256 of file itemdbentry.cpp.

References toGameCorner.

Referenced by ItemMarketModel::vendorListItem().

◆ qmlProtect()

void ItemDBEntry::qmlProtect ( const QQmlEngine *const engine) const

Pin to C++ ownership.

Definition at line 104 of file itemdbentry.cpp.

References Utility::qmlProtectUtil().

◆ qmlRegister()

void ItemDBEntry::qmlRegister ( ) const
protected

Register with QML.

Definition at line 75 of file itemdbentry.cpp.

References once.

Referenced by ItemDBEntry(), and ItemDBEntry().

◆ sellPriceCoins()

int ItemDBEntry::sellPriceCoins ( ) const
See also
sellPriceCoins property.

Definition at line 242 of file itemdbentry.cpp.

References buyPriceCoins().

◆ sellPriceMoney()

int ItemDBEntry::sellPriceMoney ( ) const
See also
sellPriceMoney property.

Definition at line 237 of file itemdbentry.cpp.

References buyPriceMoney().

◆ GameCornerDBEntry

friend struct GameCornerDBEntry
friend

Definition at line 129 of file itemdbentry.h.

References GameCornerDBEntry.

Referenced by GameCornerDBEntry, and getToGameCorner().

◆ ItemsDB

friend class ItemsDB
friend

Owning DB constructs/populates entries.

Definition at line 127 of file itemdbentry.h.

References ItemsDB.

Referenced by ItemsDB.

◆ MapDBEntrySpriteItem

friend struct MapDBEntrySpriteItem
friend

Writes toMapSpriteItem.

Definition at line 128 of file itemdbentry.h.

References MapDBEntrySpriteItem.

Referenced by getToMapSpriteItemAt(), and MapDBEntrySpriteItem.

◆ PokemonDBEntry

friend struct PokemonDBEntry
friend

Definition at line 130 of file itemdbentry.h.

References PokemonDBEntry.

Referenced by getToTeachPokemonAt(), and PokemonDBEntry.

◆ PokemonDBEntryEvolution

friend struct PokemonDBEntryEvolution
friend

Definition at line 131 of file itemdbentry.h.

References PokemonDBEntryEvolution.

Referenced by getToEvolvePokemonAt(), and PokemonDBEntryEvolution.

Member Data Documentation

◆ glitch

bool ItemDBEntry::glitch = false
protected

Backing field (read via getGlitch()).

Definition at line 114 of file itemdbentry.h.

Referenced by getGlitch(), and ItemDBEntry().

◆ hm

int ItemDBEntry::hm = -1
protected

Backing field (read via getHm()).

Definition at line 117 of file itemdbentry.h.

Referenced by deepLink(), getHm(), and ItemDBEntry().

◆ ind

int ItemDBEntry::ind = -1
protected

Backing field (read via getInd()).

Definition at line 112 of file itemdbentry.h.

Referenced by getInd(), getToEvolvePokemonAt(), getToMapSpriteItemAt(), getToTeachPokemonAt(), and ItemDBEntry().

◆ info

QString ItemDBEntry::info = ""
protected

Backing field (read via getInfo()); optional "info" in items.json.

Definition at line 119 of file itemdbentry.h.

Referenced by getInfo(), and ItemDBEntry().

◆ name

QString ItemDBEntry::name = ""
protected

Backing field (read via getName()).

Definition at line 111 of file itemdbentry.h.

Referenced by deepLink(), getName(), and ItemDBEntry().

◆ once

bool ItemDBEntry::once = false
protected

Backing field (read via getOnce()).

Definition at line 113 of file itemdbentry.h.

Referenced by getOnce(), ItemDBEntry(), and qmlRegister().

◆ price

int ItemDBEntry::price = -1
protected

Backing field (read via getPrice()).

Definition at line 118 of file itemdbentry.h.

Referenced by buyPriceCoins(), buyPriceMoney(), canSell(), getPrice(), and ItemDBEntry().

◆ readable

QString ItemDBEntry::readable = ""
protected

Backing field (read via getReadable()).

Definition at line 115 of file itemdbentry.h.

Referenced by getReadable(), and ItemDBEntry().

◆ tm

int ItemDBEntry::tm = -1
protected

Backing field (read via getTm()).

Definition at line 116 of file itemdbentry.h.

Referenced by deepLink(), getTm(), and ItemDBEntry().

◆ toEvolvePokemon

QVector<PokemonDBEntryEvolution*> ItemDBEntry::toEvolvePokemon
protected

Evolutions using this (back-ref).

Definition at line 124 of file itemdbentry.h.

Referenced by getToEvolvePokemon(), getToEvolvePokemonAt(), and getToEvolvePokemonSize().

◆ toGameCorner

GameCornerDBEntry* ItemDBEntry::toGameCorner = nullptr
protected

Resolved Game Corner entry (deepLink).

Definition at line 122 of file itemdbentry.h.

Referenced by buyPriceCoins(), getToGameCorner(), and isGameCornerExclusive().

◆ toMapSpriteItem

QVector<MapDBEntrySpriteItem*> ItemDBEntry::toMapSpriteItem
protected

Map sprites dropping this (back-ref).

Definition at line 123 of file itemdbentry.h.

Referenced by getToMapSpriteItem(), getToMapSpriteItemAt(), and getToMapSpriteItemSize().

◆ toMove

MoveDBEntry* ItemDBEntry::toMove = nullptr
protected

Resolved taught move (deepLink).

Definition at line 121 of file itemdbentry.h.

Referenced by deepLink(), and getToMove().

◆ toTeachPokemon

QVector<PokemonDBEntry*> ItemDBEntry::toTeachPokemon
protected

Pokemon this teaches (back-ref).

Definition at line 125 of file itemdbentry.h.

Referenced by getToTeachPokemon(), getToTeachPokemonAt(), and getToTeachPokemonSize().


The documentation for this struct was generated from the following files: