RacesOfValheim/JotunnModStub/Factions/FactionMerchantCatalog.cs
Ferdinando 91eb5ca8e5 feat(factions): merchant catalog entries and hostility rules
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 17:02:48 +02:00

308 lines
13 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("Pukeberries", 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("RotSeed", 500), // gates the Trenta Composter
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),
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),
new CatalogEntry("Tar", 5), // Growth, folded in here: Growth lives in Plains, same biome as Lox/Ocean
// UNRESOLVED, left as-is rather than guessed: vanilla fish items are named Fish1
// through Fish12 (plus Fish4_cave), so "Tuna", "CoralCod" and "Pufferfish" below
// are display names and match no prefab - these three entries never appear on the
// bench. Which number is which fish lives in the localization, which ships inside
// compressed asset bundles and cannot be read the way the rest of this file's names
// were verified. FactionMerchantSetup already logs each unresolved entry by name at
// runtime, so hovering a Fuling merchant once will name them in the log.
new CatalogEntry("Tuna", 50),
new CatalogEntry("CoralCod", 70),
new CatalogEntry("GoblinTotem", 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),
}
};
// The Shaman alone stocks the Furling's crop line, so it needs a bench of its own - the four
// Fuling prefabs shared one ShopDefinition instance until now. It keeps everything the Fuling
// bench sells and adds the five on top, so splitting it off takes nothing away.
//
// Declared after FulingShop because it copies that list, and static field initialisers run
// in declaration order.
private static readonly ShopDefinition GoblinShamanShop = new ShopDefinition
{
DisplayName = "Fuling Shaman",
JokeCategory = JokeGoblin,
Items = new List<CatalogEntry>(FulingShop.Items)
{
// Plantable, millable, and the only source of these three strains anywhere.
new CatalogEntry("CopperFlax", 20),
new CatalogEntry("TinFlax", 20),
new CatalogEntry("IronFlax", 50),
// Inedible. Buying one is the only way to get a bush, but a planted bush then yields
// forever - so these are a one-off cost per bush, not a running one.
new CatalogEntry("Stoneberry", 20),
new CatalogEntry("Flintberry", 20),
}
};
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("BloodCore", 500), // gates the Aswid Blood Refinery
new CatalogEntry("CursedBone", 500), // gates the Draugh body pile
new CatalogEntry("GreaterCursedBone", 1500), // upgrades it: officers
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("IronScrap", 20), // Oozer
new CatalogEntry("TrophySkeleton", 350),
new CatalogEntry("TrophyBlob", 350), // Blob
new CatalogEntry("TrophySkeletonPoison", 800),
new CatalogEntry("SoulStone", 50), // binds a skeleton archer sentry
new CatalogEntry("CursedSkull", 500), // gates the Skeleton bone pile
new CatalogEntry("GreaterCursedSkull", 1500), // upgrades it: the rotten
}
};
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 },
{ "GoblinArcher", FulingShop },
{ "GoblinBrute", FulingShop },
{ "GoblinShaman", GoblinShamanShop }, // the only bench carrying the crop line
{ "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 },
};
}
}