start draugh race
This commit is contained in:
parent
73da3bacd3
commit
d387131086
7 changed files with 522 additions and 16 deletions
|
|
@ -31,6 +31,7 @@ namespace RacesOfValheim
|
|||
gameObject.AddComponent<AswidRace>();
|
||||
gameObject.AddComponent<FurlingRace>();
|
||||
gameObject.AddComponent<TrolRace>();
|
||||
gameObject.AddComponent<DraughRace>();
|
||||
PrefabManager.OnVanillaPrefabsAvailable += CreateAllModAssets;
|
||||
CommandManager.Instance.AddConsoleCommand(new ResetRaceCommand());
|
||||
CommandManager.Instance.AddConsoleCommand(new CheckProgressionCommand());
|
||||
|
|
@ -46,6 +47,7 @@ namespace RacesOfValheim
|
|||
AswidRace.Instance.CreateModAssets();
|
||||
FurlingRace.Instance.CreateModAssets();
|
||||
TrolRace.Instance.CreateModAssets();
|
||||
DraughRace.Instance.CreateModAssets();
|
||||
}
|
||||
// --- RACE SELECTION UI ---
|
||||
public void ShowRaceSelectionMenu()
|
||||
|
|
@ -175,17 +177,16 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
// Row 1 (y = 100)
|
||||
CreateRaceButtonWithConfirm("Human", new Vector2(-300, 100), GetHumanIcon(), "The versatile founders of Midgard. Balanced stats with no specific weaknesses.", SelectHuman);
|
||||
CreateRaceButtonWithConfirm("Fenrir", new Vector2(0, 100), GetFenrirIcon(), "Cursed by the blood of the wolf. Fast and deadly, but vulnerable to silver.", SelectFenrir);
|
||||
CreateRaceButtonWithConfirm("Skadi", new Vector2(300, 100), GetSkadiIcon(), "Children of the mountains. Resistant to frost, at home in the freezing cold.", SelectSkadi);
|
||||
CreateRaceButtonWithConfirm("Human", new Vector2(-450, 100), GetHumanIcon(), "The versatile founders of Midgard. Balanced stats with no specific weaknesses.", SelectHuman);
|
||||
CreateRaceButtonWithConfirm("Fenrir", new Vector2(-150, 100), GetFenrirIcon(), "Cursed by the blood of the wolf. Fast and deadly, but vulnerable to silver.", SelectFenrir);
|
||||
CreateRaceButtonWithConfirm("Skadi", new Vector2(150, 100), GetSkadiIcon(), "Children of the mountains. Resistant to frost, at home in the freezing cold.", SelectSkadi);
|
||||
CreateRaceButtonWithConfirm("Skeleton", new Vector2(450, 100), GetSkeletonIcon(), "Undead warriors. Immune to poison, but brittle against blunt trauma.", SelectSkeleton);
|
||||
|
||||
// Row 2 (y = 0)
|
||||
CreateRaceButtonWithConfirm("Skeleton", new Vector2(-300, 0), GetSkeletonIcon(), "Undead warriors. Immune to poison, but brittle against blunt trauma.", SelectSkeleton);
|
||||
CreateRaceButtonWithConfirm("Aswid", new Vector2(0, 0), GetAswidIcon(), "Fierce night stalker. Strong and resilient, transforms into a bat.", SelectAswid);
|
||||
CreateRaceButtonWithConfirm("Furling", new Vector2(300, 0), GetFurlingIcon(), "Cunning goblin-like creatures. Agile and resourceful.", SelectFurling);
|
||||
|
||||
// Row 3 (y = -100)
|
||||
CreateRaceButtonWithConfirm("Trol", new Vector2(0, -100), GetTrolIcon(), "Massive brute strength. Towering over others but slow to react.", SelectTrol);
|
||||
// Row 2 (y = -20)
|
||||
CreateRaceButtonWithConfirm("Aswid", new Vector2(-450, -20), GetAswidIcon(), "Fierce night stalker. Strong and resilient, transforms into a bat.", SelectAswid);
|
||||
CreateRaceButtonWithConfirm("Furling", new Vector2(-150, -20), GetFurlingIcon(), "Cunning goblin-like creatures. Agile and resourceful.", SelectFurling);
|
||||
CreateRaceButtonWithConfirm("Trol", new Vector2(150, -20), GetTrolIcon(), "Massive brute strength. Towering over others but slow to react.", SelectTrol);
|
||||
CreateRaceButtonWithConfirm("Draugh", new Vector2(450, -20), GetDraughIcon(), "Undead warriors of the swamps. Accustomed to damp and decay.", SelectDraugh);
|
||||
|
||||
GUIManager.BlockInput(true);
|
||||
}
|
||||
|
|
@ -487,6 +488,48 @@ namespace RacesOfValheim
|
|||
return null;
|
||||
}
|
||||
|
||||
private void SelectDraugh()
|
||||
{
|
||||
if (Player.m_localPlayer != null)
|
||||
{
|
||||
Player.m_localPlayer.m_customData["Race"] = "Draugh";
|
||||
ZNetView nview = Player.m_localPlayer.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_Race", "Draugh");
|
||||
|
||||
VisEquipment visEq = Player.m_localPlayer.GetComponent<VisEquipment>();
|
||||
if (visEq != null)
|
||||
{
|
||||
if (!Player.m_localPlayer.m_customData.ContainsKey("OriginalSkinColor_X"))
|
||||
{
|
||||
Vector3 currentSkinColor = Traverse.Create(visEq).Field("m_skinColor").GetValue<Vector3>();
|
||||
Player.m_localPlayer.m_customData["OriginalSkinColor_X"] = currentSkinColor.x.ToString();
|
||||
Player.m_localPlayer.m_customData["OriginalSkinColor_Y"] = currentSkinColor.y.ToString();
|
||||
Player.m_localPlayer.m_customData["OriginalSkinColor_Z"] = currentSkinColor.z.ToString();
|
||||
}
|
||||
|
||||
Traverse.Create(visEq).Method("SetSkinColor", new Vector3(0.25f, 0.4f, 0.28f)).GetValue();
|
||||
visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
}
|
||||
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "You chose the path of the Draugh.");
|
||||
CloseRaceSelectionMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private Sprite GetDraughIcon()
|
||||
{
|
||||
GameObject trophyPrefab = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyDraugr")?.gameObject;
|
||||
if (trophyPrefab != null)
|
||||
{
|
||||
ItemDrop trophyDrop = trophyPrefab.GetComponent<ItemDrop>();
|
||||
if (trophyDrop != null && trophyDrop.m_itemData.m_shared.m_icons.Length > 0)
|
||||
{
|
||||
return trophyDrop.m_itemData.m_shared.m_icons[0];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void CloseRaceSelectionMenu()
|
||||
{
|
||||
if (raceSelectionMenu != null)
|
||||
|
|
@ -549,8 +592,8 @@ namespace RacesOfValheim
|
|||
__instance.GetSEMan().AddStatusEffect("SE_FenrirCurse".GetStableHashCode(), true);
|
||||
}
|
||||
|
||||
// If Skadi, Aswid, Furling or Trol, re-trigger visual update to set skin color
|
||||
if (__instance.m_customData.ContainsKey("Race") && (__instance.m_customData["Race"] == "Skadi" || __instance.m_customData["Race"] == "Aswid" || __instance.m_customData["Race"] == "Furling" || __instance.m_customData["Race"] == "Trol"))
|
||||
// If Skadi, Aswid, Furling, Trol or Draugh, re-trigger visual update to set skin color
|
||||
if (__instance.m_customData.ContainsKey("Race") && (__instance.m_customData["Race"] == "Skadi" || __instance.m_customData["Race"] == "Aswid" || __instance.m_customData["Race"] == "Furling" || __instance.m_customData["Race"] == "Trol" || __instance.m_customData["Race"] == "Draugh"))
|
||||
{
|
||||
VisEquipment visEq = __instance.GetComponent<VisEquipment>();
|
||||
if (visEq != null) visEq.GetType().GetMethod("UpdateColors", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public)?.Invoke(visEq, null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue