Merge branch 'war-vulture' into main
Brings in v1.4.3-v1.4.5 work: Trol's Hammer, Bone Servants, War Vulture craftability, and the Aswid/Fenrir timed-claws rework, on top of the bugfixes merged into main since v1.4.2. Resolved conflicts in 7 files where main's post-v1.4.2 fixes overlapped war-vulture's claws rework: - README.md, manifest.json: took war-vulture's v1.4.5 content (main hadn't touched either since the v1.4.2 release). - RacesOfValheim.cs: plugin version -> 1.4.5. - RaceClaws.cs: kept war-vulture's lazy EnsureRoster() fix for the Fenrir claw-registration bug over main's belt-and-suspenders Register(this), and dropped the now-stale comment referencing the removed static constructor. Main's SetupDragItem race-ownership fix carried through untouched. - AswidConfig.cs/AswidRace.cs/AswidPatches.cs: adopted war-vulture's single-key design (I toggles both Vampiric Aura and Devour together) to match the documented v1.4.5 trader-safety fix, removing a duplicate AuraEnabled field the two branches had each declared independently. Kept main's IsDownIgnoringHeldKeys() input fix on top. - RaceCompendium.cs: kept main's fact-checked Aswid/Fenrir entries (war-vulture's copies were pre-fix stubs, one referencing a nonexistent variable) and layered in war-vulture's timed-claws wording. Build verified clean (0 errors) after resolution.
This commit is contained in:
commit
c2212df322
38 changed files with 3831 additions and 192 deletions
|
|
@ -38,14 +38,41 @@ namespace RacesOfValheim
|
|||
public const string JokeNonMortoZombie = "NonMortoZombie";
|
||||
public const string JokeFantasma = "Fantasma";
|
||||
|
||||
// Every merchant in the mod buys/sells these regardless of what its own list
|
||||
// carries - players kept running into benches that could not fence basic building
|
||||
// mats. Folded into each ShopDefinition.Items below (WithDefaults) rather than
|
||||
// handled in FactionMerchantSetup/FactionMerchantSellPanel, so both the buy and
|
||||
// sell columns pick it up for free.
|
||||
private static readonly List<CatalogEntry> DefaultItems = new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("Wood", 1),
|
||||
new CatalogEntry("Stone", 1),
|
||||
new CatalogEntry("FineWood", 5),
|
||||
new CatalogEntry("Flint", 5),
|
||||
new CatalogEntry("RoundLog", 10), // Core wood's internal prefab name
|
||||
};
|
||||
|
||||
// Appends whichever DefaultItems aren't already named in items, explicit entries
|
||||
// win so a shop can still special-price one of these if it ever needs to.
|
||||
private static List<CatalogEntry> WithDefaults(List<CatalogEntry> items)
|
||||
{
|
||||
var combined = new List<CatalogEntry>(items);
|
||||
foreach (CatalogEntry defaultEntry in DefaultItems)
|
||||
{
|
||||
if (!combined.Exists(e => e.PrefabName == defaultEntry.PrefabName))
|
||||
{
|
||||
combined.Add(defaultEntry);
|
||||
}
|
||||
}
|
||||
return combined;
|
||||
}
|
||||
|
||||
private static readonly ShopDefinition GreydwarfShop = new ShopDefinition
|
||||
{
|
||||
DisplayName = "Greydwarf",
|
||||
JokeCategory = JokeLegnoFalegname,
|
||||
Items = new List<CatalogEntry>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("Wood", 1),
|
||||
new CatalogEntry("Stone", 2),
|
||||
new CatalogEntry("Resin", 5),
|
||||
new CatalogEntry("GreydwarfEye", 5),
|
||||
new CatalogEntry("Dandelion", 5),
|
||||
|
|
@ -60,14 +87,14 @@ namespace RacesOfValheim
|
|||
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>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("TrollHide", 1),
|
||||
new CatalogEntry("DeerHide", 2),
|
||||
|
|
@ -79,14 +106,14 @@ namespace RacesOfValheim
|
|||
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>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("BlackMetalScrap", 1),
|
||||
new CatalogEntry("LoxMeat", 1),
|
||||
|
|
@ -114,7 +141,7 @@ namespace RacesOfValheim
|
|||
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
|
||||
|
|
@ -160,7 +187,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
DisplayName = "Ulv",
|
||||
JokeCategory = JokeLupoLicantropo,
|
||||
Items = new List<CatalogEntry>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("WolfFang", 5),
|
||||
new CatalogEntry("WolfMeat", 5),
|
||||
|
|
@ -171,52 +198,52 @@ namespace RacesOfValheim
|
|||
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>
|
||||
Items = WithDefaults(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>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("JuteRed", 2),
|
||||
new CatalogEntry("GreaterFrostHeart", 1500), // the Skadi's bought reagent
|
||||
new CatalogEntry("TrophyCultist", 1500),
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
private static readonly ShopDefinition DvergShop = new ShopDefinition
|
||||
{
|
||||
DisplayName = "Dverg",
|
||||
JokeCategory = JokeNano,
|
||||
Items = new List<CatalogEntry>
|
||||
Items = WithDefaults(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>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("Entrails", 2),
|
||||
new CatalogEntry("Mushroom", 5),
|
||||
|
|
@ -234,14 +261,14 @@ namespace RacesOfValheim
|
|||
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>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("BoneFragments", 1),
|
||||
new CatalogEntry("Ooze", 2), // Blob/Oozer, folded in here: no talk-capable rig
|
||||
|
|
@ -252,29 +279,29 @@ namespace RacesOfValheim
|
|||
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>
|
||||
Items = WithDefaults(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>
|
||||
Items = WithDefaults(new List<CatalogEntry>
|
||||
{
|
||||
new CatalogEntry("Chain", 5),
|
||||
new CatalogEntry("TrophyWraith", 1500),
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// Key = vanilla creature prefab name (internal id, not the wiki display name).
|
||||
|
|
|
|||
|
|
@ -11,19 +11,63 @@ namespace RacesOfValheim
|
|||
// notices the player - not what a "press E to talk" merchant should do. Skipping Update()
|
||||
// entirely leaves Interactable.Interact() (E opens StoreGui) and Hoverable.GetHoverText()
|
||||
// (the "E - Talk" prompt) untouched, since neither of those depends on Update() running.
|
||||
//
|
||||
// The same prefix also refuses to run Update() on a Trader that has no rig to drive, which is
|
||||
// the general form of a bug that reached a tester: Trader.Start() resolves m_animator and
|
||||
// m_lookAt with GetComponentInChildren, and Update() then dereferences BOTH with no null check -
|
||||
// m_animator.SetBool("Stand", ...) and m_lookAt.ResetTarget() on the branch taken whenever no
|
||||
// player is nearby, which is most frames. A building is not a creature and has neither, so a
|
||||
// Trader bolted onto one threw a NullReferenceException every frame and filled the BepInEx
|
||||
// console. The prefabs that do that (the Dvergar bank, the Trol totem, the Hive Market) now
|
||||
// disable their Trader outright, which is the real fix; this check is the net under it, and it
|
||||
// costs one cached field read per trader per frame.
|
||||
[HarmonyPatch(typeof(Trader), "Update")]
|
||||
public static class FactionMerchantSuppressAmbientPatch
|
||||
{
|
||||
// Both fields are private in the assembly this project compiles against. Resolved once
|
||||
// rather than through Traverse, because this runs on every trader on every frame.
|
||||
private static readonly AccessTools.FieldRef<Trader, Animator> AnimatorField =
|
||||
AccessTools.FieldRefAccess<Trader, Animator>("m_animator");
|
||||
private static readonly AccessTools.FieldRef<Trader, LookAt> LookAtField =
|
||||
AccessTools.FieldRefAccess<Trader, LookAt>("m_lookAt");
|
||||
|
||||
public static bool Prefix(Trader __instance)
|
||||
{
|
||||
if (((Component)__instance).GetComponent<FactionMerchant>() != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AnimatorField(__instance) == null || LookAtField(__instance) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Trader.Start() ends with InvokeRepeating("RandomTalk", m_randomTalkInterval,
|
||||
// m_randomTalkInterval), and a Trader added with AddComponent comes up with that interval at
|
||||
// zero, because nobody authored it in the editor. On a faction merchant the repeat is pure
|
||||
// waste for as long as the creature exists: RandomTalk's first act is to read the animator's
|
||||
// "Stand" bool, and nothing ever sets it, because Update() - the only thing that would - is
|
||||
// suppressed for these by the patch above. So it wakes up, asks one question, answers no, and
|
||||
// is scheduled again.
|
||||
//
|
||||
// Cancelled in a postfix rather than by skipping Start with a prefix: Start also resolves
|
||||
// m_animator and m_lookAt and snaps a SnapToGround rig to the terrain, and none of that is in
|
||||
// the way. Only the timer is.
|
||||
[HarmonyPatch(typeof(Trader), "Start")]
|
||||
public static class FactionMerchantStopRandomTalkPatch
|
||||
{
|
||||
public static void Postfix(Trader __instance)
|
||||
{
|
||||
if (((Component)__instance).GetComponent<FactionMerchant>() == null) return;
|
||||
__instance.CancelInvoke("RandomTalk");
|
||||
}
|
||||
}
|
||||
|
||||
// Player.FindHoverObject() always figures out m_hoveringCreature correctly (it only
|
||||
// needs a Character component on the hit collider, no Hoverable/Interactable
|
||||
// involved) but separately sets m_hovering - the field the "E - Talk" prompt and the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue