/// Called when the player actually spawns in as a new hero public void SetupHero() { if (WishHeroId == HeroId) { return; } // This shouldn't happen, but if we receive a bad hero ID, then revert it to default if (!HeroCollection.HeroDatas.ContainsKey(WishHeroId)) { WishHeroId = ExtractionConfig.DefaultHero; } // Don't print the message if we've just spawned in (which is the only case where HeroId should be empty) if (!string.IsNullOrEmpty(HeroId)) { string heroName = HeroCollection.HeroDatas[WishHeroId].Name; string oldHeroName = HeroCollection.HeroDatas[HeroId].Name; ChatPanel.AddInformation(To.Everyone, $"{Local.DisplayName} respawned as {heroName} (was {oldHeroName})"); } HeroId = WishHeroId; SetHeroControllerProperties(); Dress(); }
/// Called when the player decides they want to switch to a different hero public void ChangeHero(string newHeroId) { if (!HeroCollection.HeroDatas.ContainsKey(newHeroId)) { return; } // We want to change hero; access Hero directly, change the ID there ChatPanel.AddInformation(To.Single(Local.Pawn), $"Hero {newHeroId} selected; this will change when you respawn"); WishHeroId = newHeroId; }