RacesOfValheim/JotunnModStub/Factions/FactionMerchantCatalog.cs
kanym 9287bd060d fix(factions): use the real 'Goblin' prefab id, not the display name 'Fuling'
FactionHostilityPatch's NeraForestaMobs set and FactionMerchantCatalog's
Shops dictionary both keyed the base Goblin by its in-game display name,
"Fuling", instead of its actual prefab id. Confirmed against the game's own
asset paths (Assets/Characters/Goblin/, TrophyGoblin.prefab) rather than
assumption - "Fuling" appears nowhere as a real prefab, only as flavor text
(kept as-is on the shop's own DisplayName, which is just UI label text).

Neither peace nor merchant status ever actually applied to a plain Goblin
for any Black Forest race (Trenta, Trol, Furling) as a result - only the
GoblinBrute/GoblinShaman entries, which already used their real ids, worked.

Confirmed a related but separate bug while investigating, left alone per
request: AswidRace.cs's mobToTrophyMap also keys off "Fuling" and feeds it
into a live prefab lookup for food nutrition tuning - same wrong-id pattern,
milder failure mode (falls back to generic values rather than breaking
anything). Not fixed here.
2026-08-07 11:32:13 +02:00

268 lines
10 KiB
C#

using System.Collections.Generic;
namespace RacesOfValheim
{
// Data-only: the full buy/sell catalogue designed in the Factions brainstorm
// (see Pacchetto_Rame/Factions_Brainstorm.txt for the source-of-truth tables).
// Prices are symmetric: a merchant buys and sells every listed item at the
// same price, coins are never a tradeable item.
public static class FactionMerchantCatalog
{
public class CatalogEntry
{
public string PrefabName;
public int Price;
public CatalogEntry(string prefabName, int price)
{
PrefabName = prefabName;
Price = price;
}
}
public class ShopDefinition
{
public string DisplayName;
public string JokeCategory;
public List<CatalogEntry> Items;
}
// Joke category keys, matched against FactionMerchantJokes.
public const string JokeLegnoFalegname = "LegnoFalegname";
public const string JokeGoblin = "Goblin";
public const string JokeTroll = "Troll";
public const string JokeLupoLicantropo = "LupoLicantropo";
public const string JokeNano = "Nano";
public const string JokeStrega = "Strega";
public const string JokeScheletro = "Scheletro";
public const string JokeNonMortoZombie = "NonMortoZombie";
public const string JokeFantasma = "Fantasma";
private static readonly ShopDefinition GreydwarfShop = new ShopDefinition
{
DisplayName = "Greydwarf",
JokeCategory = JokeLegnoFalegname,
Items = new List<CatalogEntry>
{
new CatalogEntry("Wood", 1),
new CatalogEntry("Stone", 2),
new CatalogEntry("Resin", 5),
new CatalogEntry("GreydwarfEye", 5),
new CatalogEntry("Dandelion", 5),
new CatalogEntry("Bukeperries", 5),
new CatalogEntry("Mushroom", 5),
new CatalogEntry("Blueberries", 5),
new CatalogEntry("Thistle", 5),
new CatalogEntry("Carrot", 5),
new CatalogEntry("CarrotSeeds", 20),
new CatalogEntry("AncientSeed", 20),
new CatalogEntry("TrophyGreydwarf", 20),
new CatalogEntry("TrophyGreydwarfBrute", 350),
new CatalogEntry("TrophyGreydwarfShaman", 350),
}
};
private static readonly ShopDefinition TrollShop = new ShopDefinition
{
DisplayName = "Troll",
JokeCategory = JokeTroll,
Items = new List<CatalogEntry>
{
new CatalogEntry("TrollHide", 1),
new CatalogEntry("DeerHide", 2),
new CatalogEntry("DeerMeat", 2),
new CatalogEntry("LeatherScraps", 5),
new CatalogEntry("RawMeat", 5), // was "BoarMeat" - not a real prefab id, never appeared
new CatalogEntry("NeckTail", 5),
new CatalogEntry("TrophyNeck", 20),
new CatalogEntry("TrophyDeer", 20),
new CatalogEntry("TrophyBoar", 50),
new CatalogEntry("TrophyForestTroll", 1500),
}
};
private static readonly ShopDefinition FulingShop = new ShopDefinition
{
DisplayName = "Fuling",
JokeCategory = JokeGoblin,
Items = new List<CatalogEntry>
{
new CatalogEntry("BlackMetalScrap", 1),
new CatalogEntry("LoxMeat", 1),
new CatalogEntry("SerpentMeat", 1),
new CatalogEntry("SerpentScale", 1),
new CatalogEntry("LoxPelt", 2),
new CatalogEntry("Flax", 5),
new CatalogEntry("Barley", 5),
new CatalogEntry("Cloudberry", 5), // was "Cloudberries" - not a real prefab id, never appeared
new CatalogEntry("Tar", 5), // Growth, folded in here: Growth lives in Plains, same biome as Lox/Ocean
new CatalogEntry("Tuna", 50),
new CatalogEntry("CoralCod", 70),
new CatalogEntry("FulingTotem", 350),
new CatalogEntry("TrophyGoblin", 350),
new CatalogEntry("TrophyGoblinShaman", 350),
new CatalogEntry("TrophyLox", 350),
new CatalogEntry("Pufferfish", 350),
new CatalogEntry("TrophyGrowth", 800), // Growth
new CatalogEntry("TrophyGoblinBrute", 1500),
new CatalogEntry("TrophySerpent", 1500),
}
};
private static readonly ShopDefinition WolfShop = new ShopDefinition
{
DisplayName = "Wolf",
JokeCategory = JokeLupoLicantropo,
Items = new List<CatalogEntry>
{
new CatalogEntry("WolfFang", 5),
new CatalogEntry("WolfMeat", 5),
new CatalogEntry("WolfPelt", 5),
new CatalogEntry("Onion", 5),
new CatalogEntry("FreezeGland", 5), // Drake, folded in here: no talk-capable rig
new CatalogEntry("OnionSeeds", 20),
new CatalogEntry("TrophyWolf", 350),
new CatalogEntry("TrophyHatchling", 350), // Drake (internal id "Hatchling")
}
};
private static readonly ShopDefinition UlvShop = new ShopDefinition
{
DisplayName = "Ulv",
JokeCategory = JokeLupoLicantropo,
Items = new List<CatalogEntry>
{
new CatalogEntry("WolfFang", 5),
new CatalogEntry("TrophyUlv", 350),
}
};
private static readonly ShopDefinition FenringShop = new ShopDefinition
{
DisplayName = "Fenring",
JokeCategory = JokeLupoLicantropo,
Items = new List<CatalogEntry>
{
new CatalogEntry("WolfFang", 5),
new CatalogEntry("TrophyFenring", 350),
}
};
private static readonly ShopDefinition CultistShop = new ShopDefinition
{
DisplayName = "Cultist",
JokeCategory = JokeStrega,
Items = new List<CatalogEntry>
{
new CatalogEntry("JuteRed", 2),
new CatalogEntry("TrophyCultist", 1500),
}
};
private static readonly ShopDefinition DvergShop = new ShopDefinition
{
DisplayName = "Dverg",
JokeCategory = JokeNano,
Items = new List<CatalogEntry>
{
new CatalogEntry("BlackMarble", 20),
new CatalogEntry("SoftTissue", 250),
new CatalogEntry("Sap", 250), // extracted from Yggdrasil roots with Dvergr extractors
new CatalogEntry("TrophyDvergr", 1500),
}
};
private static readonly ShopDefinition DraugrShop = new ShopDefinition
{
DisplayName = "Draugr",
JokeCategory = JokeNonMortoZombie,
Items = new List<CatalogEntry>
{
new CatalogEntry("Entrails", 2),
new CatalogEntry("Mushroom", 5),
new CatalogEntry("Thistle", 5),
new CatalogEntry("Turnip", 5),
new CatalogEntry("Bloodbag", 5), // Leech, folded in here: no talk-capable rig
new CatalogEntry("Guck", 1), // Abomination, folded in here: cannot speak at all
new CatalogEntry("Root", 1), // Abomination
new CatalogEntry("TurnipSeeds", 20),
new CatalogEntry("TrophyDraugr", 350),
new CatalogEntry("TrophyLeech", 350), // Leech
new CatalogEntry("TrophyDraugrElite", 800),
new CatalogEntry("TrophyAbomination", 1500), // Abomination
}
};
private static readonly ShopDefinition SkeletonShop = new ShopDefinition
{
DisplayName = "Skeleton",
JokeCategory = JokeScheletro,
Items = new List<CatalogEntry>
{
new CatalogEntry("BoneFragments", 1),
new CatalogEntry("Ooze", 2), // Blob/Oozer, folded in here: no talk-capable rig
new CatalogEntry("ScrapIron", 20), // Oozer
new CatalogEntry("TrophySkeleton", 350),
new CatalogEntry("TrophyBlob", 350), // Blob
new CatalogEntry("TrophySkeletonPoison", 800),
}
};
private static readonly ShopDefinition GhostShop = new ShopDefinition
{
DisplayName = "Ghost",
JokeCategory = JokeFantasma,
Items = new List<CatalogEntry>
{
new CatalogEntry("Ectoplasm", 2),
new CatalogEntry("TrophyGhost", 350),
}
};
private static readonly ShopDefinition WraithShop = new ShopDefinition
{
DisplayName = "Wraith",
JokeCategory = JokeFantasma,
Items = new List<CatalogEntry>
{
new CatalogEntry("Chain", 5),
new CatalogEntry("TrophyWraith", 1500),
}
};
// Key = vanilla creature prefab name (internal id, not the wiki display name).
// Several creature families share one ShopDefinition instance on purpose.
public static readonly Dictionary<string, ShopDefinition> Shops = new Dictionary<string, ShopDefinition>
{
{ "Greydwarf", GreydwarfShop },
{ "Greydwarf_Elite", GreydwarfShop },
{ "Greydwarf_Shaman", GreydwarfShop },
{ "Troll", TrollShop },
{ "Goblin", FulingShop }, // "Goblin" is the real prefab id - "Fuling" is only the in-game display name
{ "GoblinBrute", FulingShop },
{ "GoblinShaman", FulingShop },
{ "Wolf", WolfShop },
{ "Ulv", UlvShop },
{ "Fenring", FenringShop },
{ "Fenring_Cultist", CultistShop },
{ "Dverger", DvergShop },
{ "DvergerMageFire", DvergShop },
{ "DvergerMageIce", DvergShop },
{ "DvergerMageSupport", DvergShop },
{ "DvergerAshlands", DvergShop },
{ "Draugr", DraugrShop },
{ "Draugr_Elite", DraugrShop },
{ "Skeleton", SkeletonShop },
{ "Skeleton_Poison", SkeletonShop },
{ "Ghost", GhostShop },
{ "Wraith", WraithShop },
};
}
}