you create :
private CMD.BitVector32 BitVector32 = new CMD.BitVector32(32 * 5);
Code:
public class BitVector32
{
public uint[] bits;
public int Size { get { return 32 * bits.Length; } }
public BitVector32(int BitCount)
{
int sections = BitCount / 32;
if (BitCount % 32 != 0)
sections += 1;
bits = new uint[sections];
}
public void Add(int index)
{
if (index < Size)
{
int idx = index / 32;
uint bites = (uint)(1 << (index % 32));
bits[idx] |= bites;
}
}
public void Remove(int index)
{
if (index < Size)
{
int idx = index / 32;
uint bites = (uint)(1 << (index % 32));
bits[idx] &= ~bites;
}
}
public bool Contain(int index)
{
if (index > Size) return false;
int idx = index / 32;
uint bites = (uint)(1 << (index % 32));
return ((bits[idx] & bites) == bites);
}
public void Clear()
{
ushort siz = (byte)(Size / 32);
for (byte x = 0; x < siz; x++)
{
bits[x] = 0;
}
}
}
objpos.BitVector32 = offset value .. = 22;
Code:
public void AddFlag(int flag)
{
BitVector32.Add(flag);
for (byte x = 0; x < BitVector32.bits.Length; x++)
WriteUint(BitVector32.bits[x], (ushort)((byte)objpos.BitVector32 + x * 4));
using (Client.GamePackets.Update updat = new Client.GamePackets.Update(0))
{
updat.UID = UID;
updat.Append(Client.GamePackets.Update.StatusFlag, BitVector32.bits);
View.SendView(updat.ToArray(), true);
}
}
public bool ContainsFlag(int flag)
{
return BitVector32.Contain(flag);
}
public void RemoveFlag(int flag)
{
if (ContainsFlag(flag))
{
BitVector32.Remove(flag);
for (byte x = 0; x < BitVector32.bits.Length; x++)
WriteUint(BitVector32.bits[x], (ushort)((byte)objpos.BitVector32 + x * 4));
using (Client.GamePackets.Update updat = new Client.GamePackets.Update(0))
{
updat.UID = UID;
updat.Append(Client.GamePackets.Update.StatusFlag, BitVector32.bits);
View.SendView(updat.ToArray(), true);
}
}
}
In Update.cs
Code:
public void Append(byte type, uint[] value)
{
UpdateCount = UpdateCount + 1;
ushort offset = (ushort)(12 + (UpdateCount - 1) * 24);
WriteUint(type, offset);
for (byte x = 0; x < value.Length; x++)
WriteUint(value[x], (ushort)((offset + 4) + x * 4));
}
Code:
public class Flags
{
public const int
Normal = 0x0,
FlashingName = 0,
Poisoned = 1,
Invisible = 2,
XPList = 4,
Dead = 5,
TeamLeader = 6,
StarOfAccuracy = 7,
MagicShield = 8,
Stigma = 9,
Ghost = 10,
FadeAway = 11,
RedName = 14,
BlackName = 15,
ReflectMelee = 17,
Superman = 18,
Ball = 19,
Ball2 = 20,
Invisibility = 22,
Cyclone = 23,
Dodge = 26,
Fly = 27,
Intensify = 28,
CastPray = 30,
Praying = 31,
HeavenBlessing = 33,
TopGuildLeader = 34,
TopDeputyLeader = 35,
MonthlyPKChampion = 36,
WeeklyPKChampion = 37,
TopWarrior = 38,
TopTrojan = 39,
TopArcher = 40,
TopWaterTaoist = 41,
TopFireTaoist = 42,
TopNinja = 43,
ShurikenVortex = 46,
FatalStrike = 47,
Flashy = 48,
Ride = 50,
AzureShield = 92,
SoulShackle = 110,
Oblivion = 111,
Shield = 128,
RemoveName = 129,
PurpleBall = 131,
BlueBall = 132,
PathOfShadow = 145,
AssasinExpSkill = 146,
KineticSpark = 147;
}