From 91eb5ca8e5d10e57a55b27c81070c837c4a2ec39 Mon Sep 17 00:00:00 2001 From: Ferdinando Date: Fri, 7 Aug 2026 17:02:48 +0200 Subject: [PATCH] feat(factions): merchant catalog entries and hostility rules Co-Authored-By: Claude Opus 5 --- .../Factions/FactionHostilityPatch.cs | 8 ++- .../Factions/FactionMerchantCatalog.cs | 56 ++++++++++++++++--- JotunnModStub/RaceHostilityManager.cs | 14 ++++- 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/JotunnModStub/Factions/FactionHostilityPatch.cs b/JotunnModStub/Factions/FactionHostilityPatch.cs index 7a20956..48fc181 100644 --- a/JotunnModStub/Factions/FactionHostilityPatch.cs +++ b/JotunnModStub/Factions/FactionHostilityPatch.cs @@ -17,10 +17,16 @@ namespace RacesOfValheim [HarmonyPatch(typeof(BaseAI), nameof(BaseAI.IsEnemy), new System.Type[] { typeof(Character), typeof(Character) })] public static class FactionHostilityPatch { + // "Fuling" was in this set and is not a prefab: the Fuling family is named Goblin* in code, + // so the basic Fuling and the Archer were never exempted for any of the three races that + // read this set (Trenta, Trol, Furling) while the Berserker and Shaman were. In a camp that + // is the same as no truce at all - the unexempted Fulings open fire, the player defends + // themselves, and every Berserker in earshot joins in through damage retaliation, which + // IsEnemy has no say over. Verified against the asset manifest, not the wiki's display names. private static readonly HashSet NeraForestaMobs = new HashSet { "Greydwarf", "Greydwarf_Elite", "Greydwarf_Shaman", - "Fuling", "GoblinBrute", "GoblinShaman", + "Goblin", "GoblinArcher", "GoblinBrute", "GoblinShaman", "Troll", }; diff --git a/JotunnModStub/Factions/FactionMerchantCatalog.cs b/JotunnModStub/Factions/FactionMerchantCatalog.cs index 126cee9..bfc02c4 100644 --- a/JotunnModStub/Factions/FactionMerchantCatalog.cs +++ b/JotunnModStub/Factions/FactionMerchantCatalog.cs @@ -49,13 +49,14 @@ namespace RacesOfValheim new CatalogEntry("Resin", 5), new CatalogEntry("GreydwarfEye", 5), new CatalogEntry("Dandelion", 5), - new CatalogEntry("Bukeperries", 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), @@ -72,7 +73,7 @@ namespace RacesOfValheim new CatalogEntry("DeerHide", 2), new CatalogEntry("DeerMeat", 2), new CatalogEntry("LeatherScraps", 5), - new CatalogEntry("BoarMeat", 5), + new CatalogEntry("RawMeat", 5), new CatalogEntry("NeckTail", 5), new CatalogEntry("TrophyNeck", 20), new CatalogEntry("TrophyDeer", 20), @@ -94,11 +95,18 @@ namespace RacesOfValheim new CatalogEntry("LoxPelt", 2), new CatalogEntry("Flax", 5), new CatalogEntry("Barley", 5), - new CatalogEntry("Cloudberries", 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("FulingTotem", 350), + new CatalogEntry("GoblinTotem", 350), new CatalogEntry("TrophyGoblin", 350), new CatalogEntry("TrophyGoblinShaman", 350), new CatalogEntry("TrophyLox", 350), @@ -109,6 +117,30 @@ namespace RacesOfValheim } }; + // 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(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", @@ -166,7 +198,7 @@ namespace RacesOfValheim Items = new List { new CatalogEntry("BlackMarble", 20), - new CatalogEntry("SoftTissue", 250), + new CatalogEntry("Softtissue", 250), new CatalogEntry("Sap", 250), // extracted from Yggdrasil roots with Dvergr extractors new CatalogEntry("TrophyDvergr", 1500), } @@ -186,6 +218,10 @@ namespace RacesOfValheim 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), @@ -201,10 +237,13 @@ namespace RacesOfValheim { new CatalogEntry("BoneFragments", 1), new CatalogEntry("Ooze", 2), // Blob/Oozer, folded in here: no talk-capable rig - new CatalogEntry("ScrapIron", 20), // Oozer + 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 } }; @@ -240,9 +279,10 @@ namespace RacesOfValheim { "Troll", TrollShop }, - { "Fuling", FulingShop }, + { "Goblin", FulingShop }, + { "GoblinArcher", FulingShop }, { "GoblinBrute", FulingShop }, - { "GoblinShaman", FulingShop }, + { "GoblinShaman", GoblinShamanShop }, // the only bench carrying the crop line { "Wolf", WolfShop }, { "Ulv", UlvShop }, diff --git a/JotunnModStub/RaceHostilityManager.cs b/JotunnModStub/RaceHostilityManager.cs index 8f0938a..2bd09b4 100644 --- a/JotunnModStub/RaceHostilityManager.cs +++ b/JotunnModStub/RaceHostilityManager.cs @@ -74,8 +74,20 @@ namespace RacesOfValheim if (p.m_customData.ContainsKey("Race") && p.m_customData["Race"] == TrentaConfig.RaceId) { string prefabName = monster.gameObject.name.ToLower(); + + // "fuling" matched nothing: the Fuling family's prefabs are Goblin, + // GoblinArcher, GoblinBrute and GoblinShaman, so the Trenta's truce with them + // never existed despite this file and TrentaConfig both describing it. + // Unlike the other entries here, the goblin name needs its bosses carved back + // out - Yagluth is GoblinKing, and Hildir's arena pair are GoblinBruteBros / + // *_Hildir - because a substring test would otherwise pacify all three. + bool isGoblinKin = prefabName.Contains("goblin") + && !prefabName.Contains("goblinking") + && !prefabName.Contains("hildir") + && !prefabName.Contains("brutebros"); + if (prefabName.Contains("greyling") || prefabName.Contains("greydwarf") || - prefabName.Contains("fuling") || prefabName.Contains("troll") || + isGoblinKin || prefabName.Contains("troll") || prefabName.Contains("leech") || prefabName.Contains("deathsquito")) { __result = false;