1.0 compatibility
This commit is contained in:
parent
5104f86ede
commit
6193b3ee2d
33 changed files with 712 additions and 49 deletions
|
|
@ -15,7 +15,7 @@ namespace RacesOfValheim
|
|||
{
|
||||
public const string PluginGUID = "com.nandor.racesofvalheim";
|
||||
public const string PluginName = "Races Of Valheim";
|
||||
public const string PluginVersion = "1.4.11";
|
||||
public const string PluginVersion = "1.4.13";
|
||||
|
||||
private readonly Harmony harmony = new Harmony(PluginGUID);
|
||||
|
||||
|
|
@ -160,18 +160,59 @@ namespace RacesOfValheim
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the boss-progression override and falls back to the natural world state.
|
||||
/// Shared by the resetprogression console command and the Race Menu Ward.
|
||||
/// Gives back the progression a player claimed for themselves, and says plainly when there
|
||||
/// is none to give back. Shared by the resetprogression console command and the Race Menu
|
||||
/// Ward's Reset Progression button.
|
||||
///
|
||||
/// This used to clear BossProgressionManager.DebugState and nothing else - the console-only
|
||||
/// debug override, a static that is -1 at every launch and that the ward never writes. The
|
||||
/// two things the ward DOES write, RacesOfValheim_PersonalState and _PersonalMode in
|
||||
/// m_customData, were untouched, so for anyone who had not just typed increaseprogression
|
||||
/// in this session the button was a no-op by construction. It then reported
|
||||
/// GetCurrentProgressionState() as the result, which is the unchanged current tier - the
|
||||
/// "it always puts me back at the tier I'm on" the testers were describing. They were
|
||||
/// reading the one number that function could possibly have produced.
|
||||
///
|
||||
/// What it resets now is the personal tier only. The progression MODE is deliberately left
|
||||
/// alone: a player who chose to be independent of the server's kills stays independent,
|
||||
/// they just start claiming relics again from the bottom. And world progression is not this
|
||||
/// button's to reset - those are the world's global keys, shared by everyone on the server -
|
||||
/// so in world mode it says so rather than pretending.
|
||||
/// </summary>
|
||||
public static int ResetProgression()
|
||||
/// <param name="summary">Human-readable account of what actually changed, for the console.</param>
|
||||
public static int ResetProgression(out string summary)
|
||||
{
|
||||
// Still cleared, and first: it outranks both of the others in
|
||||
// GetCurrentProgressionState, so leaving it up would mask whatever we do below.
|
||||
bool hadDebugOverride = BossProgressionManager.DebugState != -1;
|
||||
BossProgressionManager.DebugState = -1;
|
||||
|
||||
bool clearedPersonal = false;
|
||||
if (BossProgressionManager.UsePersonalProgression && BossProgressionManager.HasPersonalState)
|
||||
{
|
||||
BossProgressionManager.ClearPersonalState();
|
||||
clearedPersonal = true;
|
||||
}
|
||||
|
||||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
string boss = BossProgressionManager.GetBossNameForState(state);
|
||||
|
||||
if (clearedPersonal)
|
||||
summary = $"Personal progression reset to {boss} ({state}/{BossProgressionManager.MaxState}). Claim your relics again.";
|
||||
else if (BossProgressionManager.UsePersonalProgression)
|
||||
summary = $"Nothing to reset - you have claimed no relics yet ({state}/{BossProgressionManager.MaxState}).";
|
||||
else
|
||||
summary = $"Nothing to reset - you follow the world's progression: {boss} ({state}/{BossProgressionManager.MaxState}).";
|
||||
|
||||
if (hadDebugOverride) summary += " Debug override cleared.";
|
||||
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player != null)
|
||||
{
|
||||
player.Message(MessageHud.MessageType.Center, $"Progression reset to: {state}");
|
||||
player.Message(MessageHud.MessageType.Center, summary);
|
||||
|
||||
// Progression drives stats and unlocks that are only recalculated when equipment is
|
||||
// set up, so nudge that or the new tier will not show until something else does.
|
||||
Traverse.Create(player).Method("SetupEquipment").GetValue();
|
||||
}
|
||||
|
||||
|
|
@ -1299,8 +1340,8 @@ namespace RacesOfValheim
|
|||
|
||||
public override void Run(string[] args)
|
||||
{
|
||||
int state = RacesOfValheim.ResetProgression();
|
||||
Console.instance.Print($"[DEBUG] Progression state reset to natural world state: {state}");
|
||||
RacesOfValheim.ResetProgression(out string summary);
|
||||
Console.instance.Print($"[DEBUG] {summary}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue