public const int DATA_FLAG_BRIBED = 56; //dolphins have this set when they go to find treasure for the player public bool GetFlag(int id, int flagID) { EntityData data = this.GetDataProperty(id); if (data is EntityDataLong) { EntityDataLong longData = (EntityDataLong)data; long flag = longData.Data; BitArray flags = new BitArray(BitConverter.GetBytes(flag)); return(flags[flagID]); } return(false); }
public void SetFlag(int id, int flagID, bool value = true, bool send = false) { EntityData data = this.GetDataProperty(id); if (data is EntityDataLong) { EntityDataLong longData = (EntityDataLong)data; long flag = longData.Data; BitArray flags = new BitArray(BitConverter.GetBytes(flag)); flags[flagID] = value; byte[] result = new byte[8]; flags.CopyTo(result, 0); this.SetDataProperty(new EntityDataLong(id, BitConverter.ToInt64(result, 0)), send); } }