gems/GemDodge.cs

A Gem item class that grants the player one or more instances of the PerkDodge perk at run start and posts a local chat message. It defines item id, description strings, and in OnRunStart adds the perk Level times to the player via TypeLibrary and Manager chat call.

Reflection
using Sandbox;

public class GemDodge : Gem
{
	public const string ItemId = "gem_dodge";

	public static string Description( int level ) => $"Start with {Perk.GetRichTextNameToken( typeof( PerkDodge ) )} {Perk.GetRichTextToken( nameof( PerkDodge ), level )} Lvl {level}";
	public static string UpgradeDescription( int level ) => $"Start with {Perk.GetRichTextNameToken( typeof( PerkDodge ) )} {Perk.GetRichTextToken( nameof(PerkDodge), level )} Lvl [+]{level - 1}[/+]→Lvl [+]{level}[/+]";

	public override void OnRunStart()
	{
		var perkType = TypeLibrary.GetType<PerkDodge>();
		for ( int i = 0; i < Level; i++ )
			Player.AddPerk( perkType );

		Manager.Instance.Chat.AddLocalChatMessage( $"Got {Perk.GetRichTextNameToken( typeof( PerkDodge ) )} {Perk.GetRichTextToken( nameof( PerkDodge ), Level )} Lvl {Level}", from: "" );
	}
}