diff --git a/src/item_registry.nvgt b/src/item_registry.nvgt index 581693c..9b5e20f 100644 --- a/src/item_registry.nvgt +++ b/src/item_registry.nvgt @@ -41,21 +41,24 @@ const int ITEM_COUNT = 34; // Total number of item types // Item definition class class ItemDefinition { int type; - string name; // Plural form (e.g., "sticks") - string singular; // Singular form (e.g., "stick") + string name; // Plural form (e.g., "sticks") + string singular; // Singular form (e.g., "stick") + string display_name; // Capitalized for menus (e.g., "Sticks") double favor_value; ItemDefinition() { type = -1; name = "unknown"; singular = "unknown"; + display_name = "Unknown"; favor_value = 0.01; } - ItemDefinition(int t, string n, string s, double fv) { + ItemDefinition(int t, string n, string s, string d, double fv) { type = t; name = n; singular = s; + display_name = d; favor_value = fv; } } @@ -63,6 +66,9 @@ class ItemDefinition { // Global item registry - indexed by item type ItemDefinition[] item_registry; +// Display order for inventory menus (controls the order items appear) +int[] inventory_display_order; + // Inventory arrays - indexed by item type int[] personal_inventory; int[] storage_inventory; @@ -75,41 +81,86 @@ void init_item_registry() { // Initialize registry array item_registry.resize(ITEM_COUNT); - // Define all items: type, plural name, singular name, favor value - item_registry[ITEM_STICKS] = ItemDefinition(ITEM_STICKS, "sticks", "stick", 0.01); - item_registry[ITEM_VINES] = ItemDefinition(ITEM_VINES, "vines", "vine", 0.01); - item_registry[ITEM_REEDS] = ItemDefinition(ITEM_REEDS, "reeds", "reed", 0.01); - item_registry[ITEM_STONES] = ItemDefinition(ITEM_STONES, "stones", "stone", 0.02); - item_registry[ITEM_LOGS] = ItemDefinition(ITEM_LOGS, "logs", "log", 0.05); - item_registry[ITEM_CLAY] = ItemDefinition(ITEM_CLAY, "clay", "clay", 0.02); - item_registry[ITEM_SMALL_GAME] = ItemDefinition(ITEM_SMALL_GAME, "small game", "small game", 0.20); - item_registry[ITEM_MEAT] = ItemDefinition(ITEM_MEAT, "meat", "meat", 0.15); - item_registry[ITEM_SKINS] = ItemDefinition(ITEM_SKINS, "skins", "skin", 0.15); - item_registry[ITEM_SPEARS] = ItemDefinition(ITEM_SPEARS, "spears", "spear", 1.00); - item_registry[ITEM_SLINGS] = ItemDefinition(ITEM_SLINGS, "slings", "sling", 2.00); - item_registry[ITEM_AXES] = ItemDefinition(ITEM_AXES, "axes", "axe", 1.50); - item_registry[ITEM_SNARES] = ItemDefinition(ITEM_SNARES, "snares", "snare", 0.50); - item_registry[ITEM_KNIVES] = ItemDefinition(ITEM_KNIVES, "knives", "knife", 0.80); - item_registry[ITEM_FISHING_POLES] = ItemDefinition(ITEM_FISHING_POLES, "fishing poles", "fishing pole", 0.80); - item_registry[ITEM_SKIN_HATS] = ItemDefinition(ITEM_SKIN_HATS, "skin hats", "skin hat", 0.60); - item_registry[ITEM_SKIN_GLOVES] = ItemDefinition(ITEM_SKIN_GLOVES, "skin gloves", "skin glove", 0.60); - item_registry[ITEM_SKIN_PANTS] = ItemDefinition(ITEM_SKIN_PANTS, "skin pants", "skin pants", 1.20); - item_registry[ITEM_SKIN_TUNICS] = ItemDefinition(ITEM_SKIN_TUNICS, "skin tunics", "skin tunic", 1.20); - item_registry[ITEM_MOCCASINS] = ItemDefinition(ITEM_MOCCASINS, "moccasins", "moccasin", 0.80); - item_registry[ITEM_SKIN_POUCHES] = ItemDefinition(ITEM_SKIN_POUCHES, "skin pouches", "skin pouch", 0.80); - item_registry[ITEM_ROPES] = ItemDefinition(ITEM_ROPES, "ropes", "rope", 0.40); - item_registry[ITEM_REED_BASKETS] = ItemDefinition(ITEM_REED_BASKETS, "reed baskets", "reed basket", 0.60); - item_registry[ITEM_CLAY_POTS] = ItemDefinition(ITEM_CLAY_POTS, "clay pots", "clay pot", 0.70); - item_registry[ITEM_FEATHERS] = ItemDefinition(ITEM_FEATHERS, "feathers", "feather", 0.05); - item_registry[ITEM_DOWN] = ItemDefinition(ITEM_DOWN, "down", "down", 0.05); - item_registry[ITEM_INCENSE] = ItemDefinition(ITEM_INCENSE, "incense", "incense stick", 0.10); - item_registry[ITEM_BOWS] = ItemDefinition(ITEM_BOWS, "bows", "bow", 2.50); - item_registry[ITEM_ARROWS] = ItemDefinition(ITEM_ARROWS, "arrows", "arrow", 0.05); - item_registry[ITEM_QUIVERS] = ItemDefinition(ITEM_QUIVERS, "quivers", "quiver", 1.50); - item_registry[ITEM_BOWSTRINGS] = ItemDefinition(ITEM_BOWSTRINGS, "bowstrings", "bowstring", 0.20); - item_registry[ITEM_SINEW] = ItemDefinition(ITEM_SINEW, "sinew", "piece of sinew", 0.10); - item_registry[ITEM_BOAR_CARCASSES] = ItemDefinition(ITEM_BOAR_CARCASSES, "boar carcasses", "boar carcass", 1.50); - item_registry[ITEM_BACKPACKS] = ItemDefinition(ITEM_BACKPACKS, "backpacks", "backpack", 2.50); + // Define all items: type, plural name, singular name, display name, favor value + item_registry[ITEM_STICKS] = ItemDefinition(ITEM_STICKS, "sticks", "stick", "Sticks", 0.01); + item_registry[ITEM_VINES] = ItemDefinition(ITEM_VINES, "vines", "vine", "Vines", 0.01); + item_registry[ITEM_REEDS] = ItemDefinition(ITEM_REEDS, "reeds", "reed", "Reeds", 0.01); + item_registry[ITEM_STONES] = ItemDefinition(ITEM_STONES, "stones", "stone", "Stones", 0.02); + item_registry[ITEM_LOGS] = ItemDefinition(ITEM_LOGS, "logs", "log", "Logs", 0.05); + item_registry[ITEM_CLAY] = ItemDefinition(ITEM_CLAY, "clay", "clay", "Clay", 0.02); + item_registry[ITEM_SMALL_GAME] = ItemDefinition(ITEM_SMALL_GAME, "small game", "small game", "Small Game", 0.20); + item_registry[ITEM_MEAT] = ItemDefinition(ITEM_MEAT, "meat", "meat", "Meat", 0.15); + item_registry[ITEM_SKINS] = ItemDefinition(ITEM_SKINS, "skins", "skin", "Skins", 0.15); + item_registry[ITEM_SPEARS] = ItemDefinition(ITEM_SPEARS, "spears", "spear", "Spears", 1.00); + item_registry[ITEM_SLINGS] = ItemDefinition(ITEM_SLINGS, "slings", "sling", "Slings", 2.00); + item_registry[ITEM_AXES] = ItemDefinition(ITEM_AXES, "axes", "axe", "Axes", 1.50); + item_registry[ITEM_SNARES] = ItemDefinition(ITEM_SNARES, "snares", "snare", "Snares", 0.50); + item_registry[ITEM_KNIVES] = ItemDefinition(ITEM_KNIVES, "knives", "knife", "Knives", 0.80); + item_registry[ITEM_FISHING_POLES] = ItemDefinition(ITEM_FISHING_POLES, "fishing poles", "fishing pole", "Fishing Poles", 0.80); + item_registry[ITEM_SKIN_HATS] = ItemDefinition(ITEM_SKIN_HATS, "skin hats", "skin hat", "Skin Hats", 0.60); + item_registry[ITEM_SKIN_GLOVES] = ItemDefinition(ITEM_SKIN_GLOVES, "skin gloves", "skin glove", "Skin Gloves", 0.60); + item_registry[ITEM_SKIN_PANTS] = ItemDefinition(ITEM_SKIN_PANTS, "skin pants", "skin pants", "Skin Pants", 1.20); + item_registry[ITEM_SKIN_TUNICS] = ItemDefinition(ITEM_SKIN_TUNICS, "skin tunics", "skin tunic", "Skin Tunics", 1.20); + item_registry[ITEM_MOCCASINS] = ItemDefinition(ITEM_MOCCASINS, "moccasins", "moccasin", "Moccasins", 0.80); + item_registry[ITEM_SKIN_POUCHES] = ItemDefinition(ITEM_SKIN_POUCHES, "skin pouches", "skin pouch", "Skin Pouches", 0.80); + item_registry[ITEM_ROPES] = ItemDefinition(ITEM_ROPES, "ropes", "rope", "Ropes", 0.40); + item_registry[ITEM_REED_BASKETS] = ItemDefinition(ITEM_REED_BASKETS, "reed baskets", "reed basket", "Reed Baskets", 0.60); + item_registry[ITEM_CLAY_POTS] = ItemDefinition(ITEM_CLAY_POTS, "clay pots", "clay pot", "Clay Pots", 0.70); + item_registry[ITEM_FEATHERS] = ItemDefinition(ITEM_FEATHERS, "feathers", "feather", "Feathers", 0.05); + item_registry[ITEM_DOWN] = ItemDefinition(ITEM_DOWN, "down", "down", "Down", 0.05); + item_registry[ITEM_INCENSE] = ItemDefinition(ITEM_INCENSE, "incense", "incense stick", "Incense", 0.10); + item_registry[ITEM_BOWS] = ItemDefinition(ITEM_BOWS, "bows", "bow", "Bows", 2.50); + item_registry[ITEM_ARROWS] = ItemDefinition(ITEM_ARROWS, "arrows", "arrow", "Arrows", 0.05); + item_registry[ITEM_QUIVERS] = ItemDefinition(ITEM_QUIVERS, "quivers", "quiver", "Quivers", 1.50); + item_registry[ITEM_BOWSTRINGS] = ItemDefinition(ITEM_BOWSTRINGS, "bowstrings", "bowstring", "Bowstrings", 0.20); + item_registry[ITEM_SINEW] = ItemDefinition(ITEM_SINEW, "sinew", "piece of sinew", "Sinew", 0.10); + item_registry[ITEM_BOAR_CARCASSES] = ItemDefinition(ITEM_BOAR_CARCASSES, "boar carcasses", "boar carcass", "Boar Carcasses", 1.50); + item_registry[ITEM_BACKPACKS] = ItemDefinition(ITEM_BACKPACKS, "backpacks", "backpack", "Backpacks", 2.50); + + // Define display order for inventory menus + // This controls the order items appear in menus + inventory_display_order = { + // Raw materials + ITEM_STICKS, + ITEM_VINES, + ITEM_REEDS, + ITEM_STONES, + ITEM_LOGS, + ITEM_CLAY, + // Hunting drops + ITEM_SMALL_GAME, + ITEM_BOAR_CARCASSES, + ITEM_MEAT, + ITEM_SKINS, + ITEM_FEATHERS, + ITEM_DOWN, + ITEM_SINEW, + // Misc items + ITEM_INCENSE, + // Weapons + ITEM_SPEARS, + ITEM_SLINGS, + ITEM_AXES, + ITEM_BOWS, + ITEM_ARROWS, + ITEM_QUIVERS, + ITEM_BOWSTRINGS, + // Tools + ITEM_SNARES, + ITEM_KNIVES, + ITEM_FISHING_POLES, + ITEM_ROPES, + ITEM_REED_BASKETS, + ITEM_CLAY_POTS, + // Clothing + ITEM_SKIN_HATS, + ITEM_SKIN_GLOVES, + ITEM_SKIN_PANTS, + ITEM_SKIN_TUNICS, + ITEM_MOCCASINS, + ITEM_SKIN_POUCHES, + ITEM_BACKPACKS + }; // Initialize inventory arrays personal_inventory.resize(ITEM_COUNT); @@ -174,6 +225,11 @@ string get_item_label_singular(int item_type) { return item_registry[item_type].singular; } +string get_item_display_name(int item_type) { + if (item_type < 0 || item_type >= ITEM_COUNT) return "Unknown"; + return item_registry[item_type].display_name; +} + double get_item_favor_value(int item_type) { if (item_type < 0 || item_type >= ITEM_COUNT) return 0.01; return item_registry[item_type].favor_value; diff --git a/src/menus/inventory_core.nvgt b/src/menus/inventory_core.nvgt index b71d574..c2b5649 100644 --- a/src/menus/inventory_core.nvgt +++ b/src/menus/inventory_core.nvgt @@ -4,40 +4,20 @@ void build_personal_inventory_options(string[]@ options, int[]@ item_types) { options.resize(0); item_types.resize(0); - options.insert_last("Sticks: " + get_personal_count(ITEM_STICKS)); item_types.insert_last(ITEM_STICKS); - options.insert_last("Vines: " + get_personal_count(ITEM_VINES)); item_types.insert_last(ITEM_VINES); - options.insert_last("Reeds: " + get_personal_count(ITEM_REEDS)); item_types.insert_last(ITEM_REEDS); - options.insert_last("Stones: " + get_personal_count(ITEM_STONES)); item_types.insert_last(ITEM_STONES); - options.insert_last("Logs: " + get_personal_count(ITEM_LOGS)); item_types.insert_last(ITEM_LOGS); - options.insert_last("Clay: " + get_personal_count(ITEM_CLAY)); item_types.insert_last(ITEM_CLAY); - options.insert_last("Small Game: " + get_personal_count(ITEM_SMALL_GAME)); item_types.insert_last(ITEM_SMALL_GAME); - options.insert_last("Meat: " + get_personal_count(ITEM_MEAT)); item_types.insert_last(ITEM_MEAT); - options.insert_last("Skins: " + get_personal_count(ITEM_SKINS)); item_types.insert_last(ITEM_SKINS); - options.insert_last("Feathers: " + get_personal_count(ITEM_FEATHERS)); item_types.insert_last(ITEM_FEATHERS); - options.insert_last("Down: " + get_personal_count(ITEM_DOWN)); item_types.insert_last(ITEM_DOWN); - options.insert_last("Incense: " + get_personal_count(ITEM_INCENSE)); item_types.insert_last(ITEM_INCENSE); - options.insert_last("Spears: " + get_personal_count(ITEM_SPEARS)); item_types.insert_last(ITEM_SPEARS); - options.insert_last("Slings: " + get_personal_count(ITEM_SLINGS)); item_types.insert_last(ITEM_SLINGS); - options.insert_last("Axes: " + get_personal_count(ITEM_AXES)); item_types.insert_last(ITEM_AXES); - options.insert_last("Snares: " + get_personal_count(ITEM_SNARES)); item_types.insert_last(ITEM_SNARES); - options.insert_last("Knives: " + get_personal_count(ITEM_KNIVES)); item_types.insert_last(ITEM_KNIVES); - options.insert_last("Fishing Poles: " + get_personal_count(ITEM_FISHING_POLES)); item_types.insert_last(ITEM_FISHING_POLES); - options.insert_last("Ropes: " + get_personal_count(ITEM_ROPES)); item_types.insert_last(ITEM_ROPES); - options.insert_last("Reed Baskets: " + get_personal_count(ITEM_REED_BASKETS)); item_types.insert_last(ITEM_REED_BASKETS); - options.insert_last("Clay Pots: " + get_personal_count(ITEM_CLAY_POTS)); item_types.insert_last(ITEM_CLAY_POTS); - options.insert_last("Skin Hats: " + get_personal_count(ITEM_SKIN_HATS)); item_types.insert_last(ITEM_SKIN_HATS); - options.insert_last("Skin Gloves: " + get_personal_count(ITEM_SKIN_GLOVES)); item_types.insert_last(ITEM_SKIN_GLOVES); - options.insert_last("Skin Pants: " + get_personal_count(ITEM_SKIN_PANTS)); item_types.insert_last(ITEM_SKIN_PANTS); - options.insert_last("Skin Tunics: " + get_personal_count(ITEM_SKIN_TUNICS)); item_types.insert_last(ITEM_SKIN_TUNICS); - options.insert_last("Moccasins: " + get_personal_count(ITEM_MOCCASINS)); item_types.insert_last(ITEM_MOCCASINS); - options.insert_last("Skin Pouches: " + get_personal_count(ITEM_SKIN_POUCHES)); item_types.insert_last(ITEM_SKIN_POUCHES); - options.insert_last("Backpacks: " + get_personal_count(ITEM_BACKPACKS)); item_types.insert_last(ITEM_BACKPACKS); + + // Add all items in display order + for (uint i = 0; i < inventory_display_order.length(); i++) { + int item_type = inventory_display_order[i]; + string display_name = get_item_display_name(item_type); + int count = get_personal_count(item_type); + options.insert_last(display_name + ": " + count); + item_types.insert_last(item_type); + } // Add runed items int[] runeable = get_runeable_equipment_types(); for (uint i = 0; i < runeable.length(); i++) { int equip_type = runeable[i]; - // For now, only check for Swiftness rune int count = get_runed_item_count(equip_type, RUNE_SWIFTNESS); if (count > 0) { string name = "Runed " + get_base_equipment_name(equip_type) + " of Quickness"; @@ -49,20 +29,22 @@ void build_personal_inventory_options(string[]@ options, int[]@ item_types) { void show_inventory() { string info = "Inventory: "; - info += get_personal_count(ITEM_STICKS) + " sticks, "; - info += get_personal_count(ITEM_VINES) + " vines, "; - info += get_personal_count(ITEM_REEDS) + " reeds, "; - info += get_personal_count(ITEM_STONES) + " stones, "; - info += get_personal_count(ITEM_LOGS) + " logs, "; - info += get_personal_count(ITEM_CLAY) + " clay, "; - info += get_personal_count(ITEM_SMALL_GAME) + " small game, "; - info += get_personal_count(ITEM_MEAT) + " meat, "; - info += get_personal_count(ITEM_SKINS) + " skins, "; - info += get_personal_count(ITEM_FEATHERS) + " feathers, "; - info += get_personal_count(ITEM_DOWN) + " down, "; - info += get_personal_count(ITEM_INCENSE) + " incense. "; - info += "Tools: " + get_personal_count(ITEM_SPEARS) + " spears, " + get_personal_count(ITEM_SLINGS) + " slings, " + get_personal_count(ITEM_AXES) + " axes, " + get_personal_count(ITEM_SNARES) + " snares, " + get_personal_count(ITEM_KNIVES) + " knives, " + get_personal_count(ITEM_FISHING_POLES) + " fishing poles, " + get_personal_count(ITEM_ROPES) + " ropes, " + get_personal_count(ITEM_REED_BASKETS) + " reed baskets, " + get_personal_count(ITEM_CLAY_POTS) + " clay pots. "; - info += "Clothing: " + get_personal_count(ITEM_SKIN_HATS) + " hats, " + get_personal_count(ITEM_SKIN_GLOVES) + " gloves, " + get_personal_count(ITEM_SKIN_PANTS) + " pants, " + get_personal_count(ITEM_SKIN_TUNICS) + " tunics, " + get_personal_count(ITEM_MOCCASINS) + " moccasins, " + get_personal_count(ITEM_SKIN_POUCHES) + " skin pouches."; + + // Build inventory summary by iterating through display order + bool first = true; + for (uint i = 0; i < inventory_display_order.length(); i++) { + int item_type = inventory_display_order[i]; + int count = get_personal_count(item_type); + if (count > 0) { + if (!first) info += ", "; + info += count + " " + get_item_label(item_type); + first = false; + } + } + + if (first) { + info += "empty"; + } // Add runed items summary string runed_info = ""; @@ -75,9 +57,10 @@ void show_inventory() { } } if (runed_info.length() > 0) { - info += " Runed items: " + runed_info + "."; + info += ". Runed items: " + runed_info; } + info += "."; speak_with_history(info, true); } diff --git a/src/menus/storage_menu.nvgt b/src/menus/storage_menu.nvgt index 481ca56..2843ff3 100644 --- a/src/menus/storage_menu.nvgt +++ b/src/menus/storage_menu.nvgt @@ -238,34 +238,15 @@ void withdraw_item_max(int item_type) { void build_storage_inventory_options(string[]@ options, int[]@ item_types) { options.resize(0); item_types.resize(0); - options.insert_last("Sticks: " + get_storage_count(ITEM_STICKS)); item_types.insert_last(ITEM_STICKS); - options.insert_last("Vines: " + get_storage_count(ITEM_VINES)); item_types.insert_last(ITEM_VINES); - options.insert_last("Reeds: " + get_storage_count(ITEM_REEDS)); item_types.insert_last(ITEM_REEDS); - options.insert_last("Stones: " + get_storage_count(ITEM_STONES)); item_types.insert_last(ITEM_STONES); - options.insert_last("Logs: " + get_storage_count(ITEM_LOGS)); item_types.insert_last(ITEM_LOGS); - options.insert_last("Clay: " + get_storage_count(ITEM_CLAY)); item_types.insert_last(ITEM_CLAY); - options.insert_last("Small Game: " + get_storage_count(ITEM_SMALL_GAME)); item_types.insert_last(ITEM_SMALL_GAME); - options.insert_last("Meat: " + get_storage_count(ITEM_MEAT)); item_types.insert_last(ITEM_MEAT); - options.insert_last("Skins: " + get_storage_count(ITEM_SKINS)); item_types.insert_last(ITEM_SKINS); - options.insert_last("Feathers: " + get_storage_count(ITEM_FEATHERS)); item_types.insert_last(ITEM_FEATHERS); - options.insert_last("Down: " + get_storage_count(ITEM_DOWN)); item_types.insert_last(ITEM_DOWN); - options.insert_last("Incense: " + get_storage_count(ITEM_INCENSE)); item_types.insert_last(ITEM_INCENSE); - options.insert_last("Spears: " + get_storage_count(ITEM_SPEARS)); item_types.insert_last(ITEM_SPEARS); - options.insert_last("Slings: " + get_storage_count(ITEM_SLINGS)); item_types.insert_last(ITEM_SLINGS); - options.insert_last("Axes: " + get_storage_count(ITEM_AXES)); item_types.insert_last(ITEM_AXES); - options.insert_last("Snares: " + get_storage_count(ITEM_SNARES)); item_types.insert_last(ITEM_SNARES); - options.insert_last("Knives: " + get_storage_count(ITEM_KNIVES)); item_types.insert_last(ITEM_KNIVES); - options.insert_last("Fishing Poles: " + get_storage_count(ITEM_FISHING_POLES)); item_types.insert_last(ITEM_FISHING_POLES); - options.insert_last("Ropes: " + get_storage_count(ITEM_ROPES)); item_types.insert_last(ITEM_ROPES); - options.insert_last("Reed Baskets: " + get_storage_count(ITEM_REED_BASKETS)); item_types.insert_last(ITEM_REED_BASKETS); - options.insert_last("Clay Pots: " + get_storage_count(ITEM_CLAY_POTS)); item_types.insert_last(ITEM_CLAY_POTS); - options.insert_last("Skin Hats: " + get_storage_count(ITEM_SKIN_HATS)); item_types.insert_last(ITEM_SKIN_HATS); - options.insert_last("Skin Gloves: " + get_storage_count(ITEM_SKIN_GLOVES)); item_types.insert_last(ITEM_SKIN_GLOVES); - options.insert_last("Skin Pants: " + get_storage_count(ITEM_SKIN_PANTS)); item_types.insert_last(ITEM_SKIN_PANTS); - options.insert_last("Skin Tunics: " + get_storage_count(ITEM_SKIN_TUNICS)); item_types.insert_last(ITEM_SKIN_TUNICS); - options.insert_last("Moccasins: " + get_storage_count(ITEM_MOCCASINS)); item_types.insert_last(ITEM_MOCCASINS); - options.insert_last("Skin Pouches: " + get_storage_count(ITEM_SKIN_POUCHES)); item_types.insert_last(ITEM_SKIN_POUCHES); - options.insert_last("Backpacks: " + get_storage_count(ITEM_BACKPACKS)); item_types.insert_last(ITEM_BACKPACKS); + + // Add all items in display order + for (uint i = 0; i < inventory_display_order.length(); i++) { + int item_type = inventory_display_order[i]; + string display_name = get_item_display_name(item_type); + int count = get_storage_count(item_type); + options.insert_last(display_name + ": " + count); + item_types.insert_last(item_type); + } // Add stored runed items int[] runeable = get_runeable_equipment_types();