RacesOfValheim/JotunnModStub/Factions/FactionMerchantCatalog.cs
Ferdinando 5c5b8c34d2 feat(races): Skadi hollow chain, plus the pending Dvergar and Fenrir ones
Three per-race item chains had accumulated uncommitted. They land
together because FactionMerchantCatalog.cs carries hunks from all
three and cannot be split without interactive staging.

Skadi (new this session):
- SkadiNokkel - "Skadis Nokkel", a StaffSkeleton clone recoloured to
  ice, stripped of its eitr and health costs and of the skeleton
  summon, opening an ice-blue portal to a troll cave the player
  claims as their own. Crafted at the forge after Moder from a
  1500-coin Greater Frost Heart, a DragonTear and a TrophySkeleton.
- SkadiFrostHeart - the bought leg of that recipe, sold by the
  Cultist bench.
- SkadiHollow / SkadiHollowPortal - claims one existing TrollCave02
  in the Black Forest, half a world radius out and south of the
  equator, and opens a linked local portal pair to it.
- RaceCaveBuilding - Skadi and Trol may build inside any troll cave.

Two facts worth keeping, both paid for the hard way:
- a troll cave counts as a DUNGEON, so the flag that refuses a piece
  there is the per-piece Piece.m_allowedInDungeons, not the
  per-location Location.m_noBuild. Player.m_placementStatus names the
  exact refusal reason and is now logged.
- Object.DestroyImmediate is forbidden inside an animation event
  callback, and a staff cast runs in one - it fails silently there.

Also carried in, from earlier sessions and unverified in game:
- Dvergar contract bank and barrel (DvergarBanco*, DvergarBotte*)
- Fenrir Ulvsblod trough (FenrirMangiatoia*)
- the Wolf -> Ulv merchant bench move, so tameable wolves stop
  answering the E key with a shop window

Status: compiles clean with no new warnings. The Skadi chain has NOT
been confirmed working in game - the most recent fix to the troll
cave detection is still untested.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 14:58:43 +02:00

319 lines
14 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),
}
};
/// <summary>
/// The mountain's animal bench. It used to be the WOLF, and moving it was not a preference:
/// a bench is a Trader, a Trader is Interactable, and it wins the E key. The wolf is the ONLY
/// creature vanilla lets you tame that this catalogue ever made a merchant, so every wolf in
/// the world - including the two in your own pen - answered a click with a shop window
/// instead of being pettable, nameable or commandable. Taming an animal you cannot handle is
/// not taming.
///
/// The Ulv carries the whole line now, wolf goods included. It is a mountain creature of the
/// same faction, it is not tameable, and nothing about it is spent by being a shopkeeper.
///
/// Checked while fixing this: Boar, Lox, Hen and Asksvin - the rest of what vanilla lets you
/// tame - are not benches and never were. This was the only one, so the whole class of bug
/// closes here rather than needing a rule.
/// </summary>
private static readonly ShopDefinition UlvShop = new ShopDefinition
{
DisplayName = "Ulv",
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("TrophyUlv", 350),
new CatalogEntry("TrophyHatchling", 350), // Drake (internal id "Hatchling")
}
};
private static readonly ShopDefinition FenringShop = new ShopDefinition
{
DisplayName = "Fenring",
JokeCategory = JokeLupoLicantropo,
Items = new List<CatalogEntry>
{
new CatalogEntry("WolfFang", 5),
new CatalogEntry("Ulvsblod", 500), // gates the Fenrir pack trough
new CatalogEntry("GreaterUlvsblod", 1500), // upgrades it: the fenrir themselves
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("GreaterFrostHeart", 1500), // gates the Skadi's hidden hollow
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
// NO "Wolf" ENTRY, and it must stay that way: a bench is a Trader and a Trader takes the
// E key, which would make every tameable wolf in the world a shop instead of an animal.
// Its goods live on the Ulv now. (The wolf stays in FactionHostilityPatch's mountain
// roster - that list is about who attacks whom and is a different question entirely.)
{ "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 },
};
}
}