diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 3a2d2e97..94449249 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -591,9 +591,8 @@ static void command_what(shared_ptr, shared_ptr l, send_text_message(c, u"No items are near you"); } else { const auto& item = l->item_id_to_floor_item.at(nearest_item_id); - string name = name_for_item(item.inv_item.data); - send_text_message_printf(c, "$C6%s\n$C7ID: %08" PRIX32, - name.c_str(), item.inv_item.data.item_id.load()); + string name = name_for_item(item.inv_item.data, true); + send_text_message(c, decode_sjis(name)); } } diff --git a/src/Player.cc b/src/Player.cc index f41470fa..aa705f3f 100644 --- a/src/Player.cc +++ b/src/Player.cc @@ -667,7 +667,7 @@ void Player::print_inventory(FILE* stream) const { fprintf(stream, "[PlayerInventory] %hhu items\n", this->inventory.num_items); for (size_t x = 0; x < this->inventory.num_items; x++) { const auto& item = this->inventory.items[x]; - string name = name_for_item(item.data); + auto name = name_for_item(item.data, false); fprintf(stream, "[PlayerInventory] %zu (%08" PRIX32 "): %08" PRIX32 " (%s)\n", x, item.data.item_id.load(), item.data.primary_identifier(), name.c_str()); } diff --git a/src/StaticGameData.cc b/src/StaticGameData.cc index dbeb831b..0788a5f4 100644 --- a/src/StaticGameData.cc +++ b/src/StaticGameData.cc @@ -320,67 +320,76 @@ const unordered_map name_for_s_rank_special({ {0x10, "King\'s"}, }); -const unordered_map name_for_primary_identifier({ +struct ItemNameInfo { + const char* name; + bool is_rare; + bool is_s_rank; + + ItemNameInfo(const char* name, bool is_rare = true, bool is_s_rank = false) + : name(name), is_rare(is_rare), is_s_rank(is_s_rank) { } +}; + +const unordered_map name_info_for_primary_identifier({ // Weapons (00xxxx) - {0x000100, "Saber"}, - {0x000101, "Brand"}, - {0x000102, "Buster"}, - {0x000103, "Pallasch"}, - {0x000104, "Gladius"}, + {0x000100, {"Saber", false}}, + {0x000101, {"Brand", false}}, + {0x000102, {"Buster", false}}, + {0x000103, {"Pallasch", false}}, + {0x000104, {"Gladius", false}}, {0x000105, "DB\'s SABER"}, {0x000106, "KALADGOLG"}, {0x000107, "DURANDAL"}, {0x000108, "GALATINE"}, - {0x000200, "Sword"}, - {0x000201, "Gigush"}, - {0x000202, "Breaker"}, - {0x000203, "Claymore"}, - {0x000204, "Calibur"}, + {0x000200, {"Sword", false}}, + {0x000201, {"Gigush", false}}, + {0x000202, {"Breaker", false}}, + {0x000203, {"Claymore", false}}, + {0x000204, {"Calibur", false}}, {0x000205, "FLOWEN\'S SWORD"}, {0x000206, "LAST SURVIVOR"}, {0x000207, "DRAGON SLAYER"}, - {0x000300, "Dagger"}, - {0x000301, "Knife"}, - {0x000302, "Blade"}, - {0x000303, "Edge"}, - {0x000304, "Ripper"}, + {0x000300, {"Dagger", false}}, + {0x000301, {"Knife", false}}, + {0x000302, {"Blade", false}}, + {0x000303, {"Edge", false}}, + {0x000304, {"Ripper", false}}, {0x000305, "BLADE DANCE"}, {0x000306, "BLOODY ART"}, {0x000307, "CROSS SCAR"}, {0x000308, "ZERO DIVIDE"}, {0x000309, "TWIN KAMUI"}, - {0x000400, "Partisan"}, - {0x000401, "Halbert"}, - {0x000402, "Glaive"}, - {0x000403, "Berdys"}, - {0x000404, "Gungnir"}, + {0x000400, {"Partisan", false}}, + {0x000401, {"Halbert", false}}, + {0x000402, {"Glaive", false}}, + {0x000403, {"Berdys", false}}, + {0x000404, {"Gungnir", false}}, {0x000405, "BRIONAC"}, {0x000406, "VJAYA"}, {0x000407, "GAE BOLG"}, {0x000408, "ASTERON BELT"}, - {0x000500, "Slicer"}, - {0x000501, "Spinner"}, - {0x000502, "Cutter"}, - {0x000503, "Sawcer"}, - {0x000504, "Diska"}, + {0x000500, {"Slicer", false}}, + {0x000501, {"Spinner", false}}, + {0x000502, {"Cutter", false}}, + {0x000503, {"Sawcer", false}}, + {0x000504, {"Diska", false}}, {0x000505, "SLICER OF ASSASSIN"}, {0x000506, "DISKA OF LIBERATOR"}, {0x000507, "DISKA OF BRAVEMAN"}, {0x000508, "IZMAELA"}, - {0x000600, "Handgun"}, - {0x000601, "Autogun"}, - {0x000602, "Lockgun"}, - {0x000603, "Railgun"}, - {0x000604, "Raygun"}, + {0x000600, {"Handgun", false}}, + {0x000601, {"Autogun", false}}, + {0x000602, {"Lockgun", false}}, + {0x000603, {"Railgun", false}}, + {0x000604, {"Raygun", false}}, {0x000605, "VARISTA"}, {0x000606, "CUSTOM RAY ver.00"}, {0x000607, "BRAVACE"}, {0x000608, "TENSION BLASTER"}, - {0x000700, "Rifle"}, - {0x000701, "Sniper"}, - {0x000702, "Blaster"}, - {0x000703, "Beam"}, - {0x000704, "Laser"}, + {0x000700, {"Rifle", false}}, + {0x000701, {"Sniper", false}}, + {0x000702, {"Blaster", false}}, + {0x000703, {"Beam", false}}, + {0x000704, {"Laser", false}}, {0x000705, "VISK-235W"}, {0x000706, "WALS-MK2"}, {0x000707, "JUSTY-23ST"}, @@ -390,42 +399,42 @@ const unordered_map name_for_primary_identifier({ {0x00070B, "RIANOV 303SNR-3"}, {0x00070C, "RIANOV 303SNR-4"}, {0x00070D, "RIANOV 303SNR-5"}, - {0x000800, "Mechgun"}, - {0x000801, "Assault"}, - {0x000802, "Repeater"}, - {0x000803, "Gatling"}, - {0x000804, "Vulcan"}, + {0x000800, {"Mechgun", false}}, + {0x000801, {"Assault", false}}, + {0x000802, {"Repeater", false}}, + {0x000803, {"Gatling", false}}, + {0x000804, {"Vulcan", false}}, {0x000805, "M&A60 VISE"}, {0x000806, "H&S25 JUSTICE"}, {0x000807, "L&K14 COMBAT"}, - {0x000900, "Shot"}, - {0x000901, "Spread"}, - {0x000902, "Cannon"}, - {0x000903, "Launcher"}, - {0x000904, "Arms"}, + {0x000900, {"Shot", false}}, + {0x000901, {"Spread", false}}, + {0x000902, {"Cannon", false}}, + {0x000903, {"Launcher", false}}, + {0x000904, {"Arms", false}}, {0x000905, "CRUSH BULLET"}, {0x000906, "METEOR SMASH"}, {0x000907, "FINAL IMPACT"}, - {0x000A00, "Cane"}, - {0x000A01, "Stick"}, - {0x000A02, "Mace"}, - {0x000A03, "Club"}, + {0x000A00, {"Cane", false}}, + {0x000A01, {"Stick", false}}, + {0x000A02, {"Mace", false}}, + {0x000A03, {"Club", false}}, {0x000A04, "CLUB OF LACONIUM"}, {0x000A05, "MACE OF ADAMAN"}, {0x000A06, "CLUB OF ZUMIURAN"}, {0x000A07, "LOLLIPOP"}, - {0x000B00, "Rod"}, - {0x000B01, "Pole"}, - {0x000B02, "Pillar"}, - {0x000B03, "Striker"}, + {0x000B00, {"Rod", false}}, + {0x000B01, {"Pole", false}}, + {0x000B02, {"Pillar", false}}, + {0x000B03, {"Striker", false}}, {0x000B04, "BATTLE VERGE"}, {0x000B05, "BRAVE HAMMER"}, {0x000B06, "ALIVE AQHU"}, {0x000B07, "VALKYRIE"}, - {0x000C00, "Wand"}, - {0x000C01, "Staff"}, - {0x000C02, "Baton"}, - {0x000C03, "Scepter"}, + {0x000C00, {"Wand", false}}, + {0x000C01, {"Staff", false}}, + {0x000C02, {"Baton", false}}, + {0x000C03, {"Scepter", false}}, {0x000C04, "FIRE SCEPTER:AGNI"}, {0x000C05, "ICE STAFF:DAGON"}, {0x000C06, "STORM WAND:INDRA"}, @@ -559,31 +568,31 @@ const unordered_map name_for_primary_identifier({ {0x006D01, "POWER MASER"}, {0x006E00, "GAME MAGAZINE"}, {0x006F00, "FLOWER BOUQUET"}, - {0x007000, "S-RANK SABER"}, - {0x007100, "S-RANK SWORD"}, - {0x007200, "S-RANK BLADE"}, - {0x007300, "S-RANK PARTISAN"}, - {0x007400, "S-RANK SLICER"}, - {0x007500, "S-RANK GUN"}, - {0x007600, "S-RANK RIFLE"}, - {0x007700, "S-RANK MECHGUN"}, - {0x007800, "S-RANK SHOT"}, - {0x007900, "S-RANK CANE"}, - {0x007A00, "S-RANK ROD"}, - {0x007B00, "S-RANK WAND"}, - {0x007C00, "S-RANK TWIN"}, - {0x007D00, "S-RANK CLAW"}, - {0x007E00, "S-RANK BAZOOKA"}, - {0x007F00, "S-RANK NEEDLE"}, - {0x008000, "S-RANK SCYTHE"}, - {0x008100, "S-RANK HAMMER"}, - {0x008200, "S-RANK MOON"}, - {0x008300, "S-RANK PSYCHOGUN"}, - {0x008400, "S-RANK PUNCH"}, - {0x008500, "S-RANK WINDMILL"}, - {0x008600, "S-RANK HARISEN"}, - {0x008700, "S-RANK KATANA"}, - {0x008800, "S-RANK J-CUTTER"}, + {0x007000, {"S-RANK SABER", true, true}}, + {0x007100, {"S-RANK SWORD", true, true}}, + {0x007200, {"S-RANK BLADE", true, true}}, + {0x007300, {"S-RANK PARTISAN", true, true}}, + {0x007400, {"S-RANK SLICER", true, true}}, + {0x007500, {"S-RANK GUN", true, true}}, + {0x007600, {"S-RANK RIFLE", true, true}}, + {0x007700, {"S-RANK MECHGUN", true, true}}, + {0x007800, {"S-RANK SHOT", true, true}}, + {0x007900, {"S-RANK CANE", true, true}}, + {0x007A00, {"S-RANK ROD", true, true}}, + {0x007B00, {"S-RANK WAND", true, true}}, + {0x007C00, {"S-RANK TWIN", true, true}}, + {0x007D00, {"S-RANK CLAW", true, true}}, + {0x007E00, {"S-RANK BAZOOKA", true, true}}, + {0x007F00, {"S-RANK NEEDLE", true, true}}, + {0x008000, {"S-RANK SCYTHE", true, true}}, + {0x008100, {"S-RANK HAMMER", true, true}}, + {0x008200, {"S-RANK MOON", true, true}}, + {0x008300, {"S-RANK PSYCHOGUN", true, true}}, + {0x008400, {"S-RANK PUNCH", true, true}}, + {0x008500, {"S-RANK WINDMILL", true, true}}, + {0x008600, {"S-RANK HARISEN", true, true}}, + {0x008700, {"S-RANK KATANA", true, true}}, + {0x008800, {"S-RANK J-CUTTER", true, true}}, {0x008900, "MUSASHI"}, {0x008901, "YAMATO"}, {0x008902, "ASUKA"}, @@ -652,11 +661,11 @@ const unordered_map name_for_primary_identifier({ {0x00A202, "GIGOBOOMA\'S CLAW"}, {0x00A300, "RUBY BULLET"}, {0x00A400, "AMORE ROSE"}, - {0x00A500, "S-RANK SWORDS"}, - {0x00A600, "S-RANK LAUNCHER"}, - {0x00A700, "S-RANK CARD"}, - {0x00A800, "S-RANK KNUCKLE"}, - {0x00A900, "S-RANK AXE"}, + {0x00A500, {"S-RANK SWORDS", true, true}}, + {0x00A600, {"S-RANK LAUNCHER", true, true}}, + {0x00A700, {"S-RANK CARD", true, true}}, + {0x00A800, {"S-RANK KNUCKLE", true, true}}, + {0x00A900, {"S-RANK AXE", true, true}}, {0x00AA00, "SLICER OF FANATIC"}, {0x00AB00, "LAME D\'ARGENT"}, {0x00AC00, "EXCALIBUR"}, @@ -738,30 +747,30 @@ const unordered_map name_for_primary_identifier({ {0x00EC00, "TypeWA/Wand"}, // Armors (0101xx) - {0x010100, "Frame"}, - {0x010101, "Armor"}, - {0x010102, "Psy Armor"}, - {0x010103, "Giga Frame"}, - {0x010104, "Soul Frame"}, - {0x010105, "Cross Armor"}, - {0x010106, "Solid Frame"}, - {0x010107, "Brave Armor"}, - {0x010108, "Hyper Frame"}, - {0x010109, "Grand Armor"}, - {0x01010A, "Shock Frame"}, - {0x01010B, "King\'s Frame"}, - {0x01010C, "Dragon Frame"}, - {0x01010D, "Absorb Armor"}, - {0x01010E, "Protect Frame"}, - {0x01010F, "General Armor"}, - {0x010110, "Perfect Frame"}, - {0x010111, "Valiant Frame"}, - {0x010112, "Imperial Armor"}, - {0x010113, "Holiness Armor"}, - {0x010114, "Guardian Armor"}, - {0x010115, "Divinity Armor"}, - {0x010116, "Ultimate Frame"}, - {0x010117, "Celestial Armor"}, + {0x010100, {"Frame", false}}, + {0x010101, {"Armor", false}}, + {0x010102, {"Psy Armor", false}}, + {0x010103, {"Giga Frame", false}}, + {0x010104, {"Soul Frame", false}}, + {0x010105, {"Cross Armor", false}}, + {0x010106, {"Solid Frame", false}}, + {0x010107, {"Brave Armor", false}}, + {0x010108, {"Hyper Frame", false}}, + {0x010109, {"Grand Armor", false}}, + {0x01010A, {"Shock Frame", false}}, + {0x01010B, {"King\'s Frame", false}}, + {0x01010C, {"Dragon Frame", false}}, + {0x01010D, {"Absorb Armor", false}}, + {0x01010E, {"Protect Frame", false}}, + {0x01010F, {"General Armor", false}}, + {0x010110, {"Perfect Frame", false}}, + {0x010111, {"Valiant Frame", false}}, + {0x010112, {"Imperial Armor", false}}, + {0x010113, {"Holiness Armor", false}}, + {0x010114, {"Guardian Armor", false}}, + {0x010115, {"Divinity Armor", false}}, + {0x010116, {"Ultimate Frame", false}}, + {0x010117, {"Celestial Armor", false}}, {0x010118, "HUNTER FIELD"}, {0x010119, "RANGER FIELD"}, {0x01011A, "FORCE FIELD"}, @@ -799,9 +808,7 @@ const unordered_map name_for_primary_identifier({ {0x01013A, "BLACK ODOSHI RED NIMAIDOU"}, {0x01013B, "BLUE ODOSHI VIOLET NIMAIDOU"}, {0x01013C, "DIRTY LIFE JACKET"}, - {0x01013D, "Frame"}, {0x01013E, "WEDDING DRESS"}, - {0x01013F, "Frame"}, {0x010140, "RED COAT"}, {0x010141, "THIRTEEN"}, {0x010142, "MOTHER GARB"}, @@ -828,27 +835,27 @@ const unordered_map name_for_primary_identifier({ {0x010157, "STEALTH SUIT"}, // Shields (0102xx) - {0x010200, "Barrier"}, - {0x010201, "Shield"}, - {0x010202, "Core Shield"}, - {0x010203, "Giga Shield"}, - {0x010204, "Soul Barrier"}, - {0x010205, "Hard Shield"}, - {0x010206, "Brave Barrier"}, - {0x010207, "Solid Shield"}, - {0x010208, "Flame Barrier"}, - {0x010209, "Plasma Barrier"}, - {0x01020A, "Freeze Barrier"}, - {0x01020B, "Psychic Barrier"}, - {0x01020C, "General Shield"}, - {0x01020D, "Protect Barrier"}, - {0x01020E, "Glorious Shield"}, - {0x01020F, "Imperial Barrier"}, - {0x010210, "Guardian Shield"}, - {0x010211, "Divinity Barrier"}, - {0x010212, "Ultimate Shield"}, - {0x010213, "Spiritual Shield"}, - {0x010214, "Celestial Shield"}, + {0x010200, {"Barrier", false}}, + {0x010201, {"Shield", false}}, + {0x010202, {"Core Shield", false}}, + {0x010203, {"Giga Shield", false}}, + {0x010204, {"Soul Barrier", false}}, + {0x010205, {"Hard Shield", false}}, + {0x010206, {"Brave Barrier", false}}, + {0x010207, {"Solid Shield", false}}, + {0x010208, {"Flame Barrier", false}}, + {0x010209, {"Plasma Barrier", false}}, + {0x01020A, {"Freeze Barrier", false}}, + {0x01020B, {"Psychic Barrier", false}}, + {0x01020C, {"General Shield", false}}, + {0x01020D, {"Protect Barrier", false}}, + {0x01020E, {"Glorious Shield", false}}, + {0x01020F, {"Imperial Barrier", false}}, + {0x010210, {"Guardian Shield", false}}, + {0x010211, {"Divinity Barrier", false}}, + {0x010212, {"Ultimate Shield", false}}, + {0x010213, {"Spiritual Shield", false}}, + {0x010214, {"Celestial Shield", false}}, {0x010215, "INVISIBLE GUARD"}, {0x010216, "SACRED GUARD"}, {0x010217, "S-PARTS Ver1.16"}, @@ -879,30 +886,28 @@ const unordered_map name_for_primary_identifier({ {0x010230, "HUNTER\'S SHELL"}, {0x010231, "RICO\'S GLASSES"}, {0x010232, "RICO\'S EARRING"}, - {0x010235, "SECURE FEET"}, - {0x010238, "Barrier"}, - {0x010239, "Barrier"}, - {0x01023A, "RESTA MERGE"}, - {0x01023B, "ANTI MERGE"}, - {0x01023C, "SHIFTA MERGE"}, - {0x01023D, "DEBAND MERGE"}, - {0x01023E, "FOIE MERGE"}, - {0x01023F, "GIFOIE MERGE"}, - {0x010240, "RAFOIE MERGE"}, - {0x010241, "RED MERGE"}, - {0x010242, "BARTA MERGE"}, - {0x010243, "GIBARTA MERGE"}, - {0x010244, "RABARTA MERGE"}, - {0x010245, "BLUE MERGE"}, - {0x010246, "ZONDE MERGE"}, - {0x010247, "GIZONDE MERGE"}, - {0x010248, "RAZONDE MERGE"}, - {0x010249, "YELLOW MERGE"}, - {0x01024A, "RECOVERY BARRIER"}, - {0x01024B, "ASSIST BARRIER"}, - {0x01024C, "RED BARRIER"}, - {0x01024D, "BLUE BARRIER"}, - {0x01024E, "YELLOW BARRIER"}, + {0x010235, {"SECURE FEET", false}}, + {0x01023A, {"RESTA MERGE", false}}, + {0x01023B, {"ANTI MERGE", false}}, + {0x01023C, {"SHIFTA MERGE", false}}, + {0x01023D, {"DEBAND MERGE", false}}, + {0x01023E, {"FOIE MERGE", false}}, + {0x01023F, {"GIFOIE MERGE", false}}, + {0x010240, {"RAFOIE MERGE", false}}, + {0x010241, {"RED MERGE", false}}, + {0x010242, {"BARTA MERGE", false}}, + {0x010243, {"GIBARTA MERGE", false}}, + {0x010244, {"RABARTA MERGE", false}}, + {0x010245, {"BLUE MERGE", false}}, + {0x010246, {"ZONDE MERGE", false}}, + {0x010247, {"GIZONDE MERGE", false}}, + {0x010248, {"RAZONDE MERGE", false}}, + {0x010249, {"YELLOW MERGE", false}}, + {0x01024A, {"RECOVERY BARRIER", false}}, + {0x01024B, {"ASSIST BARRIER", false}}, + {0x01024C, {"RED BARRIER", false}}, + {0x01024D, {"BLUE BARRIER", false}}, + {0x01024E, {"YELLOW BARRIER", false}}, {0x01024F, "WEAPONS GOLD SHIELD"}, {0x010250, "BLACK GEAR"}, {0x010251, "WORKS GUARD"}, @@ -948,71 +953,71 @@ const unordered_map name_for_primary_identifier({ {0x0102A4, "GENPEI Whitill"}, // Units (0103xx) - {0x010300, "Knight/Power"}, - {0x010301, "General/Power"}, - {0x010302, "Ogre/Power"}, + {0x010300, {"Knight/Power", false}}, + {0x010301, {"General/Power", false}}, + {0x010302, {"Ogre/Power", false}}, {0x010303, "God/Power"}, - {0x010304, "Priest/Mind"}, - {0x010305, "General/Mind"}, - {0x010306, "Angel/Mind"}, + {0x010304, {"Priest/Mind", false}}, + {0x010305, {"General/Mind", false}}, + {0x010306, {"Angel/Mind", false}}, {0x010307, "God/Mind"}, - {0x010308, "Marksman/Arm"}, - {0x010309, "General/Arm"}, - {0x01030A, "Elf/Arm"}, + {0x010308, {"Marksman/Arm", false}}, + {0x010309, {"General/Arm", false}}, + {0x01030A, {"Elf/Arm", false}}, {0x01030B, "God/Arm"}, - {0x01030C, "Thief/Legs"}, - {0x01030D, "General/Legs"}, - {0x01030E, "Elf/Legs"}, + {0x01030C, {"Thief/Legs", false}}, + {0x01030D, {"General/Legs", false}}, + {0x01030E, {"Elf/Legs", false}}, {0x01030F, "God/Legs"}, - {0x010310, "Digger/HP"}, - {0x010311, "General/HP"}, - {0x010312, "Dragon/HP"}, + {0x010310, {"Digger/HP", false}}, + {0x010311, {"General/HP", false}}, + {0x010312, {"Dragon/HP", false}}, {0x010313, "God/HP"}, - {0x010314, "Magician/TP"}, - {0x010315, "General/TP"}, - {0x010316, "Angel/TP"}, + {0x010314, {"Magician/TP", false}}, + {0x010315, {"General/TP", false}}, + {0x010316, {"Angel/TP", false}}, {0x010317, "God/TP"}, - {0x010318, "Warrior/Body"}, - {0x010319, "General/Body"}, - {0x01031A, "Metal/Body"}, + {0x010318, {"Warrior/Body", false}}, + {0x010319, {"General/Body", false}}, + {0x01031A, {"Metal/Body", false}}, {0x01031B, "God/Body"}, - {0x01031C, "Angel/Luck"}, + {0x01031C, {"Angel/Luck", false}}, {0x01031D, "God/Luck"}, - {0x01031E, "Master/Ability"}, - {0x01031F, "Hero/Ability"}, + {0x01031E, {"Master/Ability", false}}, + {0x01031F, {"Hero/Ability", false}}, {0x010320, "God/Ability"}, - {0x010321, "Resist/Fire"}, - {0x010322, "Resist/Flame"}, - {0x010323, "Resist/Burning"}, - {0x010324, "Resist/Cold"}, - {0x010325, "Resist/Freeze"}, - {0x010326, "Resist/Blizzard"}, - {0x010327, "Resist/Shock"}, - {0x010328, "Resist/Thunder"}, - {0x010329, "Resist/Storm"}, - {0x01032A, "Resist/Light"}, - {0x01032B, "Resist/Saint"}, - {0x01032C, "Resist/Holy"}, - {0x01032D, "Resist/Dark"}, - {0x01032E, "Resist/Evil"}, - {0x01032F, "Resist/Devil"}, - {0x010330, "All/Resist"}, - {0x010331, "Super/Resist"}, + {0x010321, {"Resist/Fire", false}}, + {0x010322, {"Resist/Flame", false}}, + {0x010323, {"Resist/Burning", false}}, + {0x010324, {"Resist/Cold", false}}, + {0x010325, {"Resist/Freeze", false}}, + {0x010326, {"Resist/Blizzard", false}}, + {0x010327, {"Resist/Shock", false}}, + {0x010328, {"Resist/Thunder", false}}, + {0x010329, {"Resist/Storm", false}}, + {0x01032A, {"Resist/Light", false}}, + {0x01032B, {"Resist/Saint", false}}, + {0x01032C, {"Resist/Holy", false}}, + {0x01032D, {"Resist/Dark", false}}, + {0x01032E, {"Resist/Evil", false}}, + {0x01032F, {"Resist/Devil", false}}, + {0x010330, {"All/Resist", false}}, + {0x010331, {"Super/Resist", false}}, {0x010332, "Perfect/Resist"}, - {0x010333, "HP/Restorate"}, - {0x010334, "HP/Generate"}, - {0x010335, "HP/Revival"}, - {0x010336, "TP/Restorate"}, - {0x010337, "TP/Generate"}, - {0x010338, "TP/Revival"}, - {0x010339, "PB/Amplifier"}, - {0x01033A, "PB/Generate"}, - {0x01033B, "PB/Create"}, - {0x01033C, "Wizard/Technique"}, - {0x01033D, "Devil/Technique"}, + {0x010333, {"HP/Restorate", false}}, + {0x010334, {"HP/Generate", false}}, + {0x010335, {"HP/Revival", false}}, + {0x010336, {"TP/Restorate", false}}, + {0x010337, {"TP/Generate", false}}, + {0x010338, {"TP/Revival", false}}, + {0x010339, {"PB/Amplifier", false}}, + {0x01033A, {"PB/Generate", false}}, + {0x01033B, {"PB/Create", false}}, + {0x01033C, {"Wizard/Technique", false}}, + {0x01033D, {"Devil/Technique", false}}, {0x01033E, "God/Technique"}, - {0x01033F, "General/Battle"}, - {0x010340, "Devil/Battle"}, + {0x01033F, {"General/Battle", false}}, + {0x010340, {"Devil/Battle", false}}, {0x010341, "God/Battle"}, {0x010342, "Cure/Poison"}, {0x010343, "Cure/Paralysis"}, @@ -1050,46 +1055,46 @@ const unordered_map name_for_primary_identifier({ {0x010363, "PB/Increase"}, // Mags (02xxxx) - {0x020000, "Mag"}, - {0x020100, "Varuna"}, - {0x020200, "Mitra"}, - {0x020300, "Surya"}, - {0x020400, "Vayu"}, - {0x020500, "Varaha"}, - {0x020600, "Kama"}, - {0x020700, "Ushasu"}, - {0x020800, "Apsaras"}, - {0x020900, "Kumara"}, - {0x020A00, "Kaitabha"}, - {0x020B00, "Tapas"}, - {0x020C00, "Bhirava"}, - {0x020D00, "Kalki"}, - {0x020E00, "Rudra"}, - {0x020F00, "Marutah"}, - {0x021000, "Yaksa"}, - {0x021100, "Sita"}, - {0x021200, "Garuda"}, - {0x021300, "Nandin"}, - {0x021400, "Ashvinau"}, - {0x021500, "Ribhava"}, - {0x021600, "Soma"}, - {0x021700, "Ila"}, - {0x021800, "Durga"}, - {0x021900, "Vritra"}, - {0x021A00, "Namuci"}, - {0x021B00, "Sumba"}, - {0x021C00, "Naga"}, - {0x021D00, "Pitri"}, - {0x021E00, "Kabanda"}, - {0x021F00, "Ravana"}, - {0x022000, "Marica"}, - {0x022100, "Soniti"}, - {0x022200, "Preta"}, - {0x022300, "Andhaka"}, - {0x022400, "Bana"}, - {0x022500, "Naraka"}, - {0x022600, "Madhu"}, - {0x022700, "Churel"}, + {0x020000, {"Mag", false}}, + {0x020100, {"Varuna", false}}, + {0x020200, {"Mitra", false}}, + {0x020300, {"Surya", false}}, + {0x020400, {"Vayu", false}}, + {0x020500, {"Varaha", false}}, + {0x020600, {"Kama", false}}, + {0x020700, {"Ushasu", false}}, + {0x020800, {"Apsaras", false}}, + {0x020900, {"Kumara", false}}, + {0x020A00, {"Kaitabha", false}}, + {0x020B00, {"Tapas", false}}, + {0x020C00, {"Bhirava", false}}, + {0x020D00, {"Kalki", false}}, + {0x020E00, {"Rudra", false}}, + {0x020F00, {"Marutah", false}}, + {0x021000, {"Yaksa", false}}, + {0x021100, {"Sita", false}}, + {0x021200, {"Garuda", false}}, + {0x021300, {"Nandin", false}}, + {0x021400, {"Ashvinau", false}}, + {0x021500, {"Ribhava", false}}, + {0x021600, {"Soma", false}}, + {0x021700, {"Ila", false}}, + {0x021800, {"Durga", false}}, + {0x021900, {"Vritra", false}}, + {0x021A00, {"Namuci", false}}, + {0x021B00, {"Sumba", false}}, + {0x021C00, {"Naga", false}}, + {0x021D00, {"Pitri", false}}, + {0x021E00, {"Kabanda", false}}, + {0x021F00, {"Ravana", false}}, + {0x022000, {"Marica", false}}, + {0x022100, {"Soniti", false}}, + {0x022200, {"Preta", false}}, + {0x022300, {"Andhaka", false}}, + {0x022400, {"Bana", false}}, + {0x022500, {"Naraka", false}}, + {0x022600, {"Madhu", false}}, + {0x022700, {"Churel", false}}, {0x022800, "ROBOCHAO"}, {0x022900, "OPA-OPA"}, {0x022A00, "PIAN"}, @@ -1118,31 +1123,31 @@ const unordered_map name_for_primary_identifier({ {0x024100, "Nidra"}, // Tools (03xxxx) - {0x030000, "Monomate"}, - {0x030001, "Dimate"}, - {0x030002, "Trimate"}, - {0x030100, "Monofluid"}, - {0x030101, "Difluid"}, - {0x030102, "Trifluid"}, - {0x030200, ""}, // Special-cased in name_for_item - {0x030300, "Sol Atomizer"}, - {0x030400, "Moon Atomizer"}, - {0x030500, "Star Atomizer"}, - {0x030600, "Antidote"}, - {0x030601, "Antiparalysis"}, - {0x030700, "Telepipe"}, - {0x030800, "Trap Vision"}, - {0x030900, "Scape Doll"}, - {0x030A00, "Monogrinder"}, - {0x030A01, "Digrinder"}, - {0x030A02, "Trigrinder"}, - {0x030B00, "Power Material"}, - {0x030B01, "Mind Material"}, - {0x030B02, "Evade Material"}, - {0x030B03, "HP Material"}, - {0x030B04, "TP Material"}, - {0x030B05, "Def Material"}, - {0x030B06, "Luck Material"}, + {0x030000, {"Monomate", false}}, + {0x030001, {"Dimate", false}}, + {0x030002, {"Trimate", false}}, + {0x030100, {"Monofluid", false}}, + {0x030101, {"Difluid", false}}, + {0x030102, {"Trifluid", false}}, + {0x030200, {"", false}}, // Special-cased in name_for_item + {0x030300, {"Sol Atomizer", false}}, + {0x030400, {"Moon Atomizer", false}}, + {0x030500, {"Star Atomizer", false}}, + {0x030600, {"Antidote", false}}, + {0x030601, {"Antiparalysis", false}}, + {0x030700, {"Telepipe", false}}, + {0x030800, {"Trap Vision", false}}, + {0x030900, {"Scape Doll", false}}, + {0x030A00, {"Monogrinder", false}}, + {0x030A01, {"Digrinder", false}}, + {0x030A02, {"Trigrinder", false}}, + {0x030B00, {"Power Material", false}}, + {0x030B01, {"Mind Material", false}}, + {0x030B02, {"Evade Material", false}}, + {0x030B03, {"HP Material", false}}, + {0x030B04, {"TP Material", false}}, + {0x030B05, {"Def Material", false}}, + {0x030B06, {"Luck Material", false}}, {0x030C00, "Cell Of MAG 502"}, {0x030C01, "Cell Of MAG 213"}, {0x030C02, "Parts Of RoboChao"}, @@ -1162,12 +1167,12 @@ const unordered_map name_for_primary_identifier({ {0x030D0A, "Parts of Baranz"}, {0x030D0B, "Belra\'s right arm"}, {0x030D0C, "Gi Gue\'s body"}, - {0x030D0D, "S-Berill\'s arms"}, + {0x030D0D, "Sinow Berill\'s Arms"}, {0x030D0E, "G-Assassin\'S arms"}, {0x030D0F, "Booma\'s right arm"}, {0x030D10, "Gobooma\'s right arm"}, {0x030D11, "Gigobooma\'s right arm"}, - {0x030D12, "Gal Gryphon's wing"}, + {0x030D12, "Gal Gryphon's Wing"}, {0x030D13, "Rappy\'s Wing"}, {0x030D14, "Cladding of Epsilon"}, {0x030D15, "De Rol Le shell"}, @@ -1193,22 +1198,22 @@ const unordered_map name_for_primary_identifier({ {0x030E13, "Kit of GENESIS"}, {0x030E14, "Kit of SEGA SATURN"}, {0x030E15, "Kit of DREAMCAST"}, - {0x030E16, "Amplifier of Resta"}, - {0x030E17, "Amplifier of Anti"}, - {0x030E18, "Amplifier of Shifta"}, - {0x030E19, "Amplifier of Deband"}, - {0x030E1A, "Amplifier of Foie"}, - {0x030E1B, "Amplifier of Gifoie"}, - {0x030E1C, "Amplifier of Rafoie"}, - {0x030E1D, "Amplifier of Barta"}, - {0x030E1E, "Amplifier of Gibarta"}, - {0x030E1F, "Amplifier of Rabarta"}, - {0x030E20, "Amplifier of Zonde"}, - {0x030E21, "Amplifier of Gizonde"}, - {0x030E22, "Amplifier of Razonde"}, - {0x030E23, "Amplifier of Red"}, - {0x030E24, "Amplifier of Blue"}, - {0x030E25, "Amplifier of Yellow"}, + {0x030E16, {"Amplifier of Resta", false}}, + {0x030E17, {"Amplifier of Anti", false}}, + {0x030E18, {"Amplifier of Shifta", false}}, + {0x030E19, {"Amplifier of Deband", false}}, + {0x030E1A, {"Amplifier of Foie", false}}, + {0x030E1B, {"Amplifier of Gifoie", false}}, + {0x030E1C, {"Amplifier of Rafoie", false}}, + {0x030E1D, {"Amplifier of Barta", false}}, + {0x030E1E, {"Amplifier of Gibarta", false}}, + {0x030E1F, {"Amplifier of Rabarta", false}}, + {0x030E20, {"Amplifier of Zonde", false}}, + {0x030E21, {"Amplifier of Gizonde", false}}, + {0x030E22, {"Amplifier of Razonde", false}}, + {0x030E23, {"Amplifier of Red", false}}, + {0x030E24, {"Amplifier of Blue", false}}, + {0x030E25, {"Amplifier of Yellow", false}}, {0x030E26, "Heart of KAPU KAPU"}, {0x030E27, "Photon Booster"}, {0x030F00, "AddSlot"}, @@ -1351,7 +1356,7 @@ uint8_t technique_for_name(const u16string& name) { return technique_for_name(encode_sjis(name)); } -string name_for_item(const ItemData& item) { +string name_for_item(const ItemData& item, bool include_color_codes) { if (item.item_data1[0] == 0x04) { return string_printf("%" PRIu32 " Meseta", item.item_data2d.load()); } @@ -1361,13 +1366,7 @@ string name_for_item(const ItemData& item) { // For weapons, specials appear before the weapon name if ((item.item_data1[0] == 0x00) && (item.item_data1[4] != 0x00)) { bool is_present = item.item_data1[4] & 0x40; - bool is_unidentified = item.item_data1[4] & 0x80; uint8_t special_id = item.item_data1[4] & 0x3F; - if (is_unidentified) { - // Note: this looks weird so it won't parse as a trigraph. Thanks, IBM, - // for opposing modernization in C++ >:( - ret_tokens.emplace_back("(?""?""?""?)"); - } if (is_present) { ret_tokens.emplace_back("Wrapped"); } @@ -1387,6 +1386,7 @@ string name_for_item(const ItemData& item) { // Add the item name. Technique disks are special because the level is part of // the primary identifier, so we manually generate the name instead of looking // it up. + ItemNameInfo name_info(nullptr, false, false); uint32_t primary_identifier = item.primary_identifier(); if ((primary_identifier & 0xFFFFFF00) == 0x00030200) { string technique_name = name_for_technique(item.item_data1[4]); @@ -1395,7 +1395,8 @@ string name_for_item(const ItemData& item) { "Disk:%s Lv.%d", technique_name.c_str(), item.item_data1[2] + 1)); } else { try { - ret_tokens.emplace_back(name_for_primary_identifier.at(primary_identifier)); + name_info = name_info_for_primary_identifier.at(primary_identifier); + ret_tokens.emplace_back(name_info.name); } catch (const out_of_range&) { ret_tokens.emplace_back("!ID:%06" PRIX32, primary_identifier); } @@ -1407,7 +1408,8 @@ string name_for_item(const ItemData& item) { ret_tokens.emplace_back(string_printf("+%hhu", item.item_data1[3])); } - if (item.item_data1[6] & 0x18) { // S-rank (has name instead of percents) + if (name_info.is_s_rank && (item.item_data1[6] & 0x18)) { + // S-rank (has name instead of percent bonuses) uint8_t char_indexes[8] = { static_cast((item.item_data1w[3] >> 5) & 0x1F), static_cast(item.item_data1w[3] & 0x1F), @@ -1519,7 +1521,6 @@ string name_for_item(const ItemData& item) { // an index into this modified list to determine the actual left PB. // Here, we don't construct a temporary list and instead just skip the // center and right PB values with a loop instead. - // TODO: There is probably a cleaner way to do this. I'm lazy for now. uint8_t actual_left_pb = 0; for (;;) { if ((actual_left_pb == center_pb) || (actual_left_pb == right_pb)) { @@ -1583,5 +1584,16 @@ string name_for_item(const ItemData& item) { } } - return join(ret_tokens, " "); + string ret = join(ret_tokens, " "); + if (include_color_codes) { + if (name_info.is_s_rank) { + return "$C4" + ret; + } else if (name_info.is_rare) { + return "$C6" + ret; + } else { + return ret; + } + } else { + return ret; + } } diff --git a/src/StaticGameData.hh b/src/StaticGameData.hh index dcf26372..1d0facd6 100644 --- a/src/StaticGameData.hh +++ b/src/StaticGameData.hh @@ -38,4 +38,4 @@ std::u16string u16name_for_npc(uint8_t npc); uint8_t npc_for_name(const std::string& name); uint8_t npc_for_name(const std::u16string& name); -std::string name_for_item(const ItemData& item); +std::string name_for_item(const ItemData& item, bool include_color_codes);