That's easy. If you want use player flags, you need next:
Add your CustomFlag to
public enum PlayerFlag : ulong enumerable list.
If you see, that last flag on list ending on
DisabledPvpWarning = 0x80000000 value, you need add new hex value with your properti, when your value must be last value + 1bit value), it's be:
...
Unused = 0x08000000,
ToggleCutTopiaries = 0x10000000,
HasValiantStatReward = 0x20000000,
RefuseTrades = 0x40000000,
DisabledPvpWarning = 0x80000000,
CustomFlag = 0x100000000 // we added one zero here, coz previous bit lenght is full
...
Now we need add public property for our Flag for to change his value:
[CommandProperty(AccessLevel.GameMaster)]
public bool CustomFlag { get { return GetFlag(PlayerFlag.CustomFlag); } set { SetFlag(PlayerFlag.CustomFlag, value); } }
If your enum values with your CustomFlag = 32 values, all is ok, but if you using latest version of ServuUO, then you will encounter a bug when saving and reading a world where your value will not be saved correctly. This is due to the fact that in servuo for PlayerFlags, the ulong type is used, which = 64 bits (respectively, 64 fields can be entered in this list), but next it saves and reads in int, which = 32 bits, respectively, all that we have specified over 32 entries, will not be able to correctly save or read changes in the enum list - what would be a bug.
So we need change next:
Find
public override void Serialize(GenericWriter writer) method, and find in it writen value of PlayerFlags:
writer.Write((int)m_Flags);
Change it to:
writer.Write((ulong)m_Flags);
Do same for read method
public override void Deserialize(GenericReader reader), find in it:
m_Flags = (PlayerFlag)reader.ReadInt();
and change it to:
m_Flags = (PlayerFlag)reader.ReadULong();
Now it's work correctly.
For finish you need add your custom item, where you can add OnDoubleClick methon, when you can change CustomFlag property as you need:
Look Scripts\Items\Consumables\GlassblowingBook.cs for example.