Exemplo n.º 1
0
        public bool Validator(LockStyleInfoDataHeader dataHeader, LockItem[] lockItems)
        {
            if (dataHeader.count > EQUIP_SLOTS.BACK + 1 || dataHeader.type > 4 ||
                (lockItems != null && lockItems.Length != dataHeader.count))
            {
                return(false);
            }

            foreach (LockItem item in lockItems)
            {
                if (item.slotId > EQUIP_SLOTS.BACK)
                {
                    return(false);
                }
            }

            Logger.Success("we got 0x053");

            return(true);
        }
Exemplo n.º 2
0
        public bool Handler(Player player, byte[] bytes)
        {
            if (bytes.Length < MinSize || bytes.Length > MaxSize)
            {
                return(false);
            }

            LockStyleInfoDataHeader LockStyleInfoDataHeader = Utility.Deserialize <LockStyleInfoDataHeader>(bytes.Take(8).ToArray());

            LockStyleInfoDataHeader.header.size *= 2;

            ByteRef byteRef = new ByteRef(bytes.Skip(8).ToArray());

            if (byteRef.Length != bytes.Length - 8)
            {
                return(false);
            }

            LockItem[] lockItems = null;
            if (LockStyleInfoDataHeader.count > 0 && byteRef.Length > 0)
            {
                lockItems = new LockItem[LockStyleInfoDataHeader.count];
                for (int i = 0; i < LockStyleInfoDataHeader.count; i++)
                {
                    lockItems[i] = Utility.Deserialize <LockItem>(byteRef.GetBytes(i * 8, 8));
                }
            }

            if (Validator(LockStyleInfoDataHeader, lockItems))
            {
                // TODO: Handle the lockstyle information in player object i.e. Player->UpdateLockStyle(header,items)

                return(true);
            }
            return(false);
        }