A gun item class that grants the player a Boomerang perk at run start. It defines an item id, a perk level constant, a Description string, and in OnRunStart adds a chat message and gives the player the perk instance PerkLevel times.
public class GunBoomerang : Gun
{
public const string ItemId = "gun_boomerang";
private const int PerkLevel = 1;
public static string Description() => $"Start with {Perk.GetRichTextNameToken( typeof( PerkBoomerang ) )} {Perk.GetRichTextToken( nameof( PerkBoomerang ), level: PerkLevel )} Lvl {PerkLevel}";
public override void OnRunStart()
{
base.OnRunStart();
Manager.Instance.Chat.AddLocalChatMessage( $"Got {Perk.GetRichTextNameToken( typeof( PerkBoomerang ) )} {Perk.GetRichTextToken( nameof( PerkBoomerang ), level: PerkLevel )} Lvl {PerkLevel}", from: "" );
for( int i = 0; i < PerkLevel; i++ )
Player.AddPerk( TypeLibrary.GetType( typeof( PerkBoomerang ) ) );
//Player.Modify( this, PlayerStat.MaxAmmoCount, -5, ModifierType.Add );
}
}