Navigation

Inventory

The game keeps everything the player carries in one bag of nine tabs, opened with B, and keeps its currencies beside it. The world package holds the bag as pure state and functions over it, genshin-interface draws its screen, and the world's Inventory/Screen puts the two together in the reader's language.

How it works

flowchart TD
  P["A pick up, a chest, a wish's weapon"] --> A{"Weapon or artifact?"}
  A -->|"yes"| ROOM{"Room left in that tab?"}
  ROOM -->|"yes"| ONE["An entry of its own at its starting level"]
  ROOM -->|"no"| LEFT["Left over"]
  A -->|"no"| STACK{"A stack of it already?"}
  STACK -->|"yes"| FILL["The stack fills to its item's limit"]
  STACK -->|"no"| KINDS{"Fewer kinds than the bag holds?"}
  KINDS -->|"yes"| NEW["A new stack"]
  KINDS -->|"no"| LEFT
  FILL --> REST["Whatever does not fit is left over"]
  NEW --> REST
  B["B, or the Paimon menu"] --> SCREEN["Inventory screen: the open tab sorted, its room, Mora"]
  • The game's nine tabs. ItemCategory is Weapons, Artifacts, Character Development Items, Food, Materials, Gadget, Quest, Precious Items and Furnishings, and ItemCategories lists them in the game's order. Each tab's name is the game's own text (ITEM_WEAPON to ITEM_FURNITURE, through ItemCategoryGameTextKeyMap).
  • An item is its definition. ItemDefinition carries the game's item id, its tab, its name in the reader's language, its rarity, its stack limit and its rank, the place the game gives it in its tab's own order. The bag holds InventoryItem entries, each numbered by the bag's own count of what it has taken in, so an entry's id never repeats and runs in the order obtained.
  • The world's materials are read from the game's table. pnpm -C scripts genshin:assets items reads the material table of the game's dump for every item the drop families name, and writes packages/genshin-world/src/data/items/materials.json: each item's id, its material type as the table spells it, the text id of its name, its rank, its rarity and its stack limit. Each row's name is read by its nameTextId through the name-text chunks in the reader's language, which genshin:text names writes for every material, the billets and ores among them, so a material is never named by a GameTextKey. getItemDefinition builds the definition from a row, and MaterialTypeItemCategoryMap files the material's type in its tab, the character development items for the enemies' masks.
  • Stacks fill to their item's own limit. addInventoryItem adds to an item's stack up to its stackLimit, or opens a new stack. The limit is the item's own: most stop at 9,999, ores and experience materials hold 99,999, food and the common bosses' drops 2,000, consumable gadgets 99, and reusable gadgets and most quest items one, as the wiki lists them. The save refuses a stack past 99,999, the highest of those maximums (MAX_ITEM_QUANTITY).
  • Weapons and artifacts never stack. Each is an entry of its own with its level, a weapon from 1 and an artifact from 0.
  • A weapon is rebuilt from the weapon table on load. A saved entry holds its item id alone, so toInventory takes a weapon from the stat tables when the id is a weapon's, its name read by the weapon's text id and its rarity from its row, and any other id from the materials table. toWeaponDefinition gives a weapon the same entry whether a forge, a wish or the save made it: a weapon category entry of one, at rank zero.
  • Taking items takes from the stacks. takeInventoryItems takes a count of one item out of its stacks, from the first stack it lies in onwards, and a stack emptied is dropped. A take the bag cannot cover is refused.
  • The bag's room is the game's. ItemCategoryRoomMap gives the tabs counted on their own their room in pieces: 2,000 weapons, 2,400 artifacts and 2,600 furnishings. Every other tab shares INVENTORY_KIND_LIMIT, the kinds of item counted by kind rather than quantity. Both are the wiki's Inventory page's limits, cited beside their constants, and the save's bag is bounded by them: at most its kinds plus each counted tab's room in entries, which sizes the save's ceiling (save data).
  • What does not fit is left over. An addition returns the bag after it and how many there was no room for, which stay where they lay, as the game leaves a pick up the bag cannot take.
  • Each tab sorts as the game's does. computeInventoryTab takes a tab's entries in the game's order. Weapons and artifacts sort by Level or Quality, ascending or descending (InventorySortOrder), the other key breaking a tie the same way. Furnishings run from the first obtained, gadgets and quest items from the highest quality down, and every other tab in the game's own order by rank. A tie left falls to rank, then to the order obtained.
  • A wallet of the game's currencies. Wallet counts each Currency: Mora, Primogems and Genesis Crystals, which the game holds outside the tabs, and Intertwined Fate, Acquaint Fate, Masterless Starglitter, Masterless Stardust and Masterless Stella Fortuna, which it files among the Precious Items. Each is named by its item's own text (CurrencyGameTextKeyMap). Original Resin is counted in the same wallet, beside the moment it last changed, from which it regenerates (original resin).
  • Nothing is bought with money. Genesis Crystals are the game's paid currency, bought only by topping up. Nothing here takes a payment, so the wallet's Genesis Crystals stay at none; a Fate the wish screen sells is bought with Primogems, which the world gives (wish).
  • The game's destroy rule decides what may be destroyed. checkIsInventoryItemDestroyable reads the entry's own destroyRule on its definition: an entry whose rule is DestroyRule.ReturnMaterial may be destroyed, and one with no rule, a material or food among them, never is. The rule and what a destroy returns come from the game's weapon table, its destroyRule, destroyReturnMaterial and destroyReturnMaterialCount fields, written into each weapon's row of generated/stats/weapons.json by the stats run and carried by WeaponData (toWeaponDefinition), whose schema refuses a weapon whose rule returns materials but names no material or count, so no destroy returns a material the table never named. Per that table a weapon of one to three stars is destroyable and returns its enhancement ore (104011) times its rarity, and a four- or five-star weapon is not. Artifacts are not in the bag yet, so none of their table is built; when they join, their table carries the same fields. The artifact table already shows the rule is per item rather than per rarity: every real set piece of one to four stars is destroyable and returns Mora (202) at 420, 840, 1,260 or 2,520 by rarity, while 178 four-star artifacts outside the sets are not. destroyInventoryItems refuses the whole destruction when a chosen entry is not destroyable (getDestroyableItem), and otherwise destroys the chosen entries, an id chosen twice once, and takes in what they returned, summed by material (getDestroyReturns): a wallet currency such as Mora goes into the wallet, any other material into the bag through addInventoryItem. A return the bag has no room for refuses the whole destruction, as claimBlossom refuses a claim: destroyInventoryItems is then undefined, nothing is destroyed, and the dialog's OK is held off under the game's bag-full line (GameTextKey.BagFull). The screen emits destroy with the bag and the wallet after it, and World/Session applies both.
  • The destroy mode. The trash on the foot bar enters the bag's destroy mode, titled by the game's own word (GameTextKey.InventoryDestroy, "Destroy") and opened with the game's line "Select items to destroy". In it a click ticks an entry the rule allows, and a quick select ticks every such entry of one rarity on the open tab (DestroyQuickSelectGameTextKeyMap: a weapon's one to three stars, an artifact's one to four, the labels the destroy page gives them). The count beside the Destroy button reads {0}/{1} selected, the chosen entries over the bag's destroyable ones, and the button stays off until one is ticked. Destroy opens the game's confirm, "Destroy Items", which lists the chosen entries and warns "The item(s) will be destroyed. This action cannot be undone.", with Cancel and OK. The confirm takes the focus as it opens, the bag behind it inert until it closes, so nothing behind it changes the entries OK destroys, and gives the focus back once it closes. OK destroys every chosen entry through destroyInventoryItems, and the screen emits destroy with the bag and the wallet after it; World/Session applies both through setInventory and setWallet. Leaving the mode drops the ticks. Each word is the destroy page's own text id (UI_STC_BAGPAGE_DESTROY_*, read off the manual text map). Under the entries the dialog lists the materials the chosen entries return, summed by material and each with its count, under the game's "Recovered:" (GameTextKey.InventoryDestroyRecovered, UI_STC_BAGPAGE_DESTROY_CONFIRM_2). One thing the game shows is not modelled: its selection limit ("Item selection limit reached").
  • The full-bag hint. A pick up the bag has no room for left something on the ground, and shows the game's own hint (GameTextKey.BagFull, the text id UI_BEYOND_RUNTIME_UI_DROP_PICKTIPS_FAIL) over the world. World/Session sets it from the overflow of a drop or a gathering point, and the next pick up clears it.
  • The screen opens on B. InputAction.OpenInventory is on B, and the screens' map opens ScreenKind.Inventory from it or from the Paimon menu. Inventory/Screen opens on the weapons, sorted by level from the highest, and hands InventoryScreen the tabs, the open tab's cells, its room in the game's own wording ("Weapons 0/2000", only on a tab counted on its own), the sort with its order's word for a screen reader, and the Mora count beside the tabs. A weapon's caption is its level as the game writes one, an artifact's its plus, and a stack's its count. Precious Items shows the wish's five currencies the wallet holds, in the game's order, ahead of the bag's own precious items.

Key files

FileRole
packages/genshin-world/src/services/inventory/addInventoryItem.tsA pick up taken into the bag: stacks, single pieces, room and what is left
packages/genshin-world/src/services/inventory/takeInventoryItems.tsThe items taken out of the bag's stacks, from the first stack onwards
packages/genshin-world/src/services/inventory/checkIsInventoryItemDestroyable.tsWhether an entry may be destroyed: its definition's destroy rule returns materials
packages/genshin-world/src/services/inventory/getDestroyableItem.tsThe bag's entry with an id, refused unless the bag holds it and may destroy it
packages/genshin-world/src/services/inventory/getDestroyReturns.tsThe materials the destroyed entries return, summed by material
packages/genshin-world/src/services/inventory/addDestroyReturn.tsOne returned material taken in: a wallet currency into the wallet, any other into the bag
packages/genshin-world/src/services/inventory/getWalletCurrency.tsThe wallet currency an item id is filed under, if any
packages/genshin-world/src/services/inventory/destroyInventoryItems.tsThe bag's entries after every chosen entry of the destroy mode is destroyed
packages/genshin-world/src/services/inventory/DestroyQuickSelectGameTextKeyMap.tsThe destroy mode's quick selects by rarity, each with the game's label
packages/genshin-world/src/components/World/Session/Index.vueSets the full-bag hint on a pick up the bag has no room for
packages/genshin-world/src/services/inventory/computeInventoryTab.tsA tab's entries in the order the game shows them
packages/genshin-world/src/services/inventory/ItemCategoryRoomMap.tsThe room of the tabs counted on their own
packages/genshin-world/src/services/inventory/bagLimits.tsThe bag's kind limit and the most of one item it holds, the wiki's Inventory page's limits
packages/genshin-world/src/services/inventory/constants.tsThe starting levels, the currencies shown, an empty bag and a wallet with Original Resin full
packages/genshin-world/src/services/inventory/getItemDefinition.tsAn item's definition, read from the materials table, its name from the name-text chunks
packages/genshin-world/src/services/inventory/toWeaponDefinition.tsA weapon in the bag as a weapon entry of one, at rank zero
packages/genshin-world/src/services/save/toInventory.tsThe bag read from its save, a weapon rebuilt from the weapon table and any other item from the materials table
packages/genshin-world/src/services/inventory/MaterialTypeItemCategoryMap.tsThe tab each material type is filed in
packages/genshin-world/src/models/inventory/MaterialData.tsA row of the materials table, checked against its schema as the world loads
packages/genshin-world/src/data/items/materials.jsonThe materials the enemies' drops name, as genshin:assets items writes them
scripts/src/services/genshinAssets/items/writeItems.tsThe reader that writes the materials table from the game's dump
packages/genshin-world/src/models/inventory/Currency.tsThe currencies the wallet counts, Original Resin among them
packages/genshin-world/src/components/Inventory/Screen/Index.vueThe bag's screen in the reader's language
packages/genshin-world/src/components/Inventory/Screen/Index.fixture.tsThe weapons tab of 1,347 entries, the parity page's and the visual suite's state
packages/genshin-interface/src/components/InventoryScreen/Index.vueThe bag's tabs, room, sort, grid and counts
packages/genshin-interface/src/models/ItemCategory.tsThe nine tabs, in the game's order

Notes

  • The weapons tab is the first state matched. Its reference is a frame of a public account tour's recording of the English PC client at 1080 high, 30 seconds into its clip, drawn behind the screen (inventory-weapons in ParityReferenceMap). Its mean difference is 9.13% (FLIP 0.3076), from 9.14% (FLIP 0.3080) before the dropdown: what is left is the grid's item art, which the rules keep out, the tabs' icons and the detail panel's stats, none built yet.
  • The food tab's foot is scored apart. Its reference is the same recording 58 seconds in, the Food tab's foot with the Primogems and Mora (inventory-food), drawn behind the screen over its foot. The mean difference is 2.26% (FLIP 0.0810, from 2.41% and 0.0774 with the figures at 22 units): the pills' ends, the top-up plus and the Mora coin sit where the frame puts them, and the figures are the game's 30-unit cap height, a size 29 and a letter-spaced 30 both scoring worse. What is left is the provisional discs standing for the Primogem and Mora marks, and the backdrop's own figures showing through the translucent pills, a double print the backdrop cannot avoid.
  • What the backdrop cannot score. A reference drawn behind the screen shows the game's own tab icons, arrows and Details button through every area the screen leaves transparent, so a piece this screen drops there scores as if drawn. Those pieces are the nine tabs' icons, the arrows, the Details button and the stats block of the detail panel, none built yet. The remaining difference is the grid's item art, which the rules keep out, and the stats the model does not hold.
  • The sort is the game's dropdown, and the foot shows the currencies on the other tabs. On an equipment tab (weapons, artifacts) the foot holds the trash, the filter, the sort's dropdown "Quality" and the order toggle, as the game lays them. On every other tab it holds the Primogems with their top-up plus and the Mora, in the game's order, where the dropdown stands. The dropdown is the browser's own list until its open motion is recorded (bag-sort-open.png, on the roadmap's Recordings owed list).
  • Not built yet. The food's use on the party, which the proposal keeps, the full-bag hint's timing (the game's fades on a timer, where this holds it until the next pick up, which waits on a recording), the nine tabs' icons, the grid's item icons and stars, the trash, filter, order and currency marks (provisional discs until the glyph pass traces them from the game's icons), the detail panel's stats, its footer line, the Details button and its arrows, and the screen's animations, which wait on the recordings listed in the roadmap. The UID is the player's own data, so it is not drawn.
  • The wish's currencies are counted, not stacked. The game files the Fates and the Masterless Starglitter, Stardust and Stella Fortuna as Precious Items with a stack of their own, so each takes one of the bag's kinds; the wallet counts them apart, and the bag's kinds leave them out.

Sources

  • Inventory, Genshin Impact Wiki: the nine categories and what each holds, the stack limits, the 2,300 kinds, the weapons', artifacts' and furnishings' room, each tab's order, and the full-bag hint.
  • Genesis Crystal, Genshin Impact Wiki: the paid currency, bought only by topping up.
  • Controls, Genshin Impact Wiki: the inventory on B.
  • Damaged Mask, Genshin Impact Wiki: the hilichurls' masks, filed among the Character Development Items.
  • AnimeGameData, the community's dump of the game's data: MaterialExcelConfigData, each material's type, name, rank, rarity and stack limit.

Details

Command palette

Keyboard shortcuts