Use this file to discover all available pages before exploring further.
CustomItem is the abstract base class that all custom items must inherit from. It provides properties to define item behavior, event hooks for item interactions, and helper methods to check if an item instance belongs to this custom item type.
Event arguments containing the player and usable item information. Set ev.IsAllowed = false to cancel the event (OnUsing only).
Example:
public override void OnUsing(PlayerUsingItemEventArgs ev){ if (ev.Player.Health < 50) { ev.IsAllowed = false; ev.Player.SendHint("Not enough health to use this item!"); }}public override void OnUsed(PlayerUsedItemEventArgs ev){ ev.Player.SendHint("Item used successfully!");}
Event arguments containing the player, item, and pickup information. Set ev.IsAllowed = false to cancel the drop (OnDropping only).
Example:
public override void OnDropping(PlayerDroppingItemEventArgs ev){ // Prevent dropping in certain zones if (ev.Player.CurrentRoom.Name == "LCZ_173") { ev.IsAllowed = false; ev.Player.SendHint("Cannot drop this item here!"); }}public override void OnDropped(PlayerDroppedItemEventArgs ev){ Log.Info($"{ev.Player.Nickname} dropped {Name}");}
Event arguments containing the player, pickup, and item information. Set ev.IsAllowed = false to cancel the pickup (OnPickingUp only).
Example:
public override void OnPickingUp(PlayerPickingUpItemEventArgs ev){ // Only certain roles can pick up this item if (ev.Player.Role != RoleTypeId.Scientist) { ev.IsAllowed = false; ev.Player.SendHint("Only scientists can pick up this item!"); }}public override void OnPickedUp(PlayerPickedUpItemEventArgs ev){ // Grant effect when picked up ev.Player.AddEffect(EffectType.MovementBoost, 10f);}
Event arguments containing the player, old item, and new item information. Set ev.IsAllowed = false to cancel the selection change (OnSelecting/OnUnselecting only).
Example:
public override void OnSelecting(PlayerChangingItemEventArgs ev){ Log.Debug($"{ev.Player.Nickname} is selecting {Name}");}public override void OnSelected(PlayerChangedItemEventArgs ev){ // Apply passive effect when held ev.Player.AddEffect(EffectType.DamageReduction, 1f);}public override void OnUnselecting(PlayerChangingItemEventArgs ev){ Log.Debug($"{ev.Player.Nickname} is unselecting {Name}");}public override void OnUnselected(PlayerChangedItemEventArgs ev){ // Remove passive effect when not held ev.Player.RemoveEffect(EffectType.DamageReduction);}