Card Database - Fluorohydride/ygopro GitHub Wiki
Card Database Description
The YGOPro card database uses the SQLite format, with the file name cards.cdb
, located in the program's root directory.
Some fields are represented using binary bits.
Database Structure
CREATE TABLE datas(
id INTEGER PRIMARY KEY,
ot INTEGER,
alias INTEGER,
setcode INTEGER,
type INTEGER,
atk INTEGER,
def INTEGER,
level INTEGER,
race INTEGER,
attribute INTEGER,
category INTEGER
);
CREATE TABLE texts(
id INTEGER PRIMARY KEY,
name TEXT,
"desc" TEXT,
str1 TEXT,
str2 TEXT,
str3 TEXT,
str4 TEXT,
str5 TEXT,
str6 TEXT,
str7 TEXT,
str8 TEXT,
str9 TEXT,
str10 TEXT,
str11 TEXT,
str12 TEXT,
str13 TEXT,
str14 TEXT,
str15 TEXT,
str16 TEXT
);
Database Field Descriptions
datas
Table
-
id
: The 8-digit password at the bottom-left corner of the card- Token cards: The password +1 of the card that generates the token
- Cards without password: Custom password assigned by YGOPro
-
ot
: Card availability (OCG/TCG, etc.)0x1
:AVAIL_OCG
0x2
:AVAIL_TCG
0x4
:AVAIL_CUSTOM
(custom cards)0x8
:AVAIL_SC
(Simplified Chinese)
-
alias
: Alias for cards with the same name0
: Not an alias cardabs(alias - id) < CARD_ARTWORK_VERSIONS_OFFSET
: Alternate artwork card,alias
is the actual code,id
is the actual code +1- For example, the original Blue-Eyes White Dragon has
id
89631139
andalias
0
, while alternate artworks haveid
89631140
,89631141
, etc., andalias
89631139
- For example, the original Blue-Eyes White Dragon has
- Other
alias
values: Cards with the same name by rule,alias
is the code of the corresponding card,id
is the actual code- For example, Umi has
id
22702055
andalias
0
, while A Legendary Ocean hasid
295517
andalias
22702055
- For example, Umi has
-
setcode
: Card archetype (fields included in the card name)- Stores 4 values in a single
int64
, each occupying 16 bits - The last 12 bits of each value represent the root field, and the first 4 bits represent the subfield
- For example,
0x10dc
representsSuper Quantum
,0x20dc
representsSuper Quantal Mech Beast
, where0x0dc
is the root fieldSuper Quant
, and0x1000
and0x2000
are subfields - Note the inclusion relationship between subfields, e.g.,
0x107a
representsNoble Knights
,0x207a
representsNoble Arms
, and0x507a
representsInfernoble Knights
, where0x507a
(subfield0b0101
) includes0x107a
(subfield0b0001
) but not0x207a
(subfield0b0010
)
- For example,
- Refer to the
setnames
section instrings.conf
for the list
- Stores 4 values in a single
-
type
: Card type- Refer to
TYPE_*
inconstants.lua
- Normal Spells and Normal Traps do not use
TYPE_NORMAL
- Trap Monsters do not have
TYPE_TRAPMONSTER
set in the database but require attributes, levels, ATK/DEF, etc.
- Refer to
-
atk
: Card's attack points-1
: Indicates the attack points are question mark
-
def
: Card's defense points-1
: Indicates the defense points are question mark- Link Monsters store link markers in this field, refer to
LINK_MARKER_*
inconstants.lua
or the numeric keypad layout
-
level
: Card's level- This field is a 32-bit integer:
- Bits 0-7: Represent the card's level
- Bits 8-15: Reserved
- Bits 16-23: Represent the right Pendulum Scale
- Bits 24-31: Represent the left Pendulum Scale
- For example,
0x04040007
represents a Level 7 Pendulum Monster with a left scale of 4 and a right scale of 4 - The rank of Xyz Monsters and the link value of Link Monsters are also stored in this field
- This field is a 32-bit integer:
-
race
: Card's race- Refer to
RACE_*
inconstants.lua
- Refer to
-
attribute
: Card's attribute- Refer to
ATTRIBUTE_*
inconstants.lua
- Refer to
-
category
: Card's effect type- Used in search only
- Refer to the section starting with
!system 1100
insystem.conf
texts
Table
-
id
: The 8-digit password at the bottom-left corner of the card- Matches the
id
field in thedatas
table
- Matches the
-
name
: Card's name -
desc
: Card's effect text-
The format for Pendulum Monsters is as follows:
← (Left Scale) 【Pendulum】 (Right Scale) → (Pendulum Effect) 【Monster Effect】 (Monster Effect)
-
-
str1
~str16
: Card's hint texts- Used for pop-up hints during duels