예제 #1
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     uid = reader.ReadInt();
     if (uid < 0)
     {
         throw new Exception("Forbidden value on uid = " + uid + ", it doesn't respect the following condition : uid < 0");
     }
     targetId     = reader.ReadInt();
     turnDuration = reader.ReadShort();
     dispelable   = reader.ReadSByte();
     if (dispelable < 0)
     {
         throw new Exception("Forbidden value on dispelable = " + dispelable + ", it doesn't respect the following condition : dispelable < 0");
     }
     spellId = reader.ReadShort();
     if (spellId < 0)
     {
         throw new Exception("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0");
     }
     parentBoostUid = reader.ReadInt();
     if (parentBoostUid < 0)
     {
         throw new Exception("Forbidden value on parentBoostUid = " + parentBoostUid + ", it doesn't respect the following condition : parentBoostUid < 0");
     }
 }
예제 #2
0
        public virtual void Deserialize(BigEndianReader reader)
        {
            fightId   = reader.ReadInt();
            fightType = reader.ReadSByte();
            if (fightType < 0)
            {
                throw new Exception("Forbidden value on fightType = " + fightType + ", it doesn't respect the following condition : fightType < 0");
            }
            fightStart = reader.ReadInt();
            if (fightStart < 0)
            {
                throw new Exception("Forbidden value on fightStart = " + fightStart + ", it doesn't respect the following condition : fightStart < 0");
            }
            fightSpectatorLocked = reader.ReadBoolean();
            var limit = reader.ReadUShort();

            fightTeams = new Types.FightTeamLightInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                fightTeams[i] = new Types.FightTeamLightInformations();
                fightTeams[i].Deserialize(reader);
            }
            limit             = reader.ReadUShort();
            fightTeamsOptions = new Types.FightOptionsInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                fightTeamsOptions[i] = new Types.FightOptionsInformations();
                fightTeamsOptions[i].Deserialize(reader);
            }
        }
        public override void Deserialize(BigEndianReader reader)
        {
            base.Deserialize(reader);
            partyType = reader.ReadSByte();
            if (partyType < 0)
            {
                throw new Exception("Forbidden value on partyType = " + partyType + ", it doesn't respect the following condition : partyType < 0");
            }
            fromId = reader.ReadInt();
            if (fromId < 0)
            {
                throw new Exception("Forbidden value on fromId = " + fromId + ", it doesn't respect the following condition : fromId < 0");
            }
            fromName = reader.ReadUTF();
            leaderId = reader.ReadInt();
            if (leaderId < 0)
            {
                throw new Exception("Forbidden value on leaderId = " + leaderId + ", it doesn't respect the following condition : leaderId < 0");
            }
            var limit = reader.ReadUShort();

            members = new Types.PartyInvitationMemberInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                members[i] = new Types.PartyInvitationMemberInformations();
                members[i].Deserialize(reader);
            }
            limit  = reader.ReadUShort();
            guests = new Types.PartyGuestInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                guests[i] = new Types.PartyGuestInformations();
                guests[i].Deserialize(reader);
            }
        }
        public override void Deserialize(BigEndianReader reader)
        {
            byte flag1 = reader.ReadByte();

            hasRights           = BooleanByteWrapper.GetFlag(flag1, 0);
            wasAlreadyConnected = BooleanByteWrapper.GetFlag(flag1, 1);
            login     = reader.ReadUTF();
            nickname  = reader.ReadUTF();
            accountId = reader.ReadInt();
            if (accountId < 0)
            {
                throw new Exception("Forbidden value on accountId = " + accountId + ", it doesn't respect the following condition : accountId < 0");
            }
            communityId = reader.ReadSByte();
            if (communityId < 0)
            {
                throw new Exception("Forbidden value on communityId = " + communityId + ", it doesn't respect the following condition : communityId < 0");
            }
            secretQuestion      = reader.ReadUTF();
            subscriptionEndDate = reader.ReadDouble();
            if (subscriptionEndDate < 0)
            {
                throw new Exception("Forbidden value on subscriptionEndDate = " + subscriptionEndDate + ", it doesn't respect the following condition : subscriptionEndDate < 0");
            }
            accountCreation = reader.ReadDouble();
            if (accountCreation < 0)
            {
                throw new Exception("Forbidden value on accountCreation = " + accountCreation + ", it doesn't respect the following condition : accountCreation < 0");
            }
        }
예제 #5
0
        protected override void Parse(BigEndianReader reader)
        {
            reader.ReadByte();             // ID
            reader.ReadInt16();            // Size

            _Serial    = reader.ReadUInt32();
            _Body      = reader.ReadInt16();
            _X         = reader.ReadInt16();
            _Y         = reader.ReadInt16();
            _Z         = reader.ReadSByte();
            _Direction = (Direction)reader.ReadByte();
            _Hue       = reader.ReadUInt16();

            byte flags = reader.ReadByte();

            if ((flags & 0x1) > 0)
            {
                _IsFrozen = true;
            }

            if ((flags & 0x2) > 0)
            {
                _IsFemale = true;
            }

            if ((flags & 0x4) > 0)
            {
                _IsFlying = true;
            }

            if ((flags & 0x8) > 0)
            {
                _HasYellowHealthBar = true;
            }

            if ((flags & 0x10) > 0)
            {
                _IsIgnoringMobiles = true;
            }

            if ((flags & 0x40) > 0)
            {
                _IsInWarMode = true;
            }

            if ((flags & 0x80) > 0)
            {
                _IsHidden = true;
            }

            _Notoriety = (Notoriety)reader.ReadByte();

            // Items
            _Items = new List <MobileItem>();

            //uint serial = 0;

            //while ((serial = reader.ReadUInt32()) != 0)
            //    _Items.Add(new MobileItem(serial, reader));
        }
예제 #6
0
        public virtual void Deserialize(BigEndianReader reader)
        {
            guestId = reader.ReadInt();
            if (guestId < 0)
            {
                throw new Exception("Forbidden value on guestId = " + guestId + ", it doesn't respect the following condition : guestId < 0");
            }
            hostId = reader.ReadInt();
            if (hostId < 0)
            {
                throw new Exception("Forbidden value on hostId = " + hostId + ", it doesn't respect the following condition : hostId < 0");
            }
            name      = reader.ReadUTF();
            guestLook = new Types.EntityLook();
            guestLook.Deserialize(reader);
            breed  = reader.ReadSByte();
            sex    = reader.ReadBoolean();
            status = Types.ProtocolTypeManager.GetInstance <Types.PlayerStatus>(reader.ReadShort());
            status.Deserialize(reader);
            var limit = reader.ReadUShort();

            companions = new Types.PartyCompanionBaseInformations[limit];
            for (int i = 0; i < limit; i++)
            {
                companions[i] = new Types.PartyCompanionBaseInformations();
                companions[i].Deserialize(reader);
            }
        }
 public override void Deserialize(BigEndianReader reader)
 {
     charaTypeTarget = reader.ReadSByte();
     if (charaTypeTarget < 0)
     {
         throw new Exception("Forbidden value on charaTypeTarget = " + charaTypeTarget + ", it doesn't respect the following condition : charaTypeTarget < 0");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     paymentType = reader.ReadSByte();
     if (paymentType < 0)
     {
         throw new Exception("Forbidden value on paymentType = " + paymentType + ", it doesn't respect the following condition : paymentType < 0");
     }
 }
예제 #9
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     type = reader.ReadSByte();
     if (type < 0)
     {
         throw new Exception("Forbidden value on type = " + type + ", it doesn't respect the following condition : type < 0");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     xpRatio = reader.ReadSByte();
     if (xpRatio < 0)
     {
         throw new Exception("Forbidden value on xpRatio = " + xpRatio + ", it doesn't respect the following condition : xpRatio < 0");
     }
 }
예제 #11
0
 public override void Deserialize(BigEndianReader reader)
 {
     downloadSpeed = reader.ReadSByte();
     if (downloadSpeed < 1 || downloadSpeed > 10)
     {
         throw new Exception("Forbidden value on downloadSpeed = " + downloadSpeed + ", it doesn't respect the following condition : downloadSpeed < 1 || downloadSpeed > 10");
     }
 }
예제 #12
0
 public override void Deserialize(BigEndianReader reader)
 {
     code = reader.ReadSByte();
     if (code < 0)
     {
         throw new Exception("Forbidden value on code = " + code + ", it doesn't respect the following condition : code < 0");
     }
 }
예제 #13
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     slot = reader.ReadSByte();
     if (slot < 0 || slot > 99)
     {
         throw new Exception("Forbidden value on slot = " + slot + ", it doesn't respect the following condition : slot < 0 || slot > 99");
     }
 }
예제 #14
0
 public virtual void Deserialize(BigEndianReader reader)
 {
     statusId = reader.ReadSByte();
     if (statusId < 0)
     {
         throw new Exception("Forbidden value on statusId = " + statusId + ", it doesn't respect the following condition : statusId < 0");
     }
 }
예제 #15
0
 public override void Deserialize(BigEndianReader reader)
 {
     invitationState = reader.ReadSByte();
     if (invitationState < 0)
     {
         throw new Exception("Forbidden value on invitationState = " + invitationState + ", it doesn't respect the following condition : invitationState < 0");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     listen = reader.ReadSByte();
     if (listen < 0)
     {
         throw new Exception("Forbidden value on listen = " + listen + ", it doesn't respect the following condition : listen < 0");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     error = reader.ReadSByte();
     if (error < 0)
     {
         throw new Exception("Forbidden value on error = " + error + ", it doesn't respect the following condition : error < 0");
     }
 }
예제 #18
0
 public override void Deserialize(BigEndianReader reader)
 {
     urlId = reader.ReadSByte();
     if (urlId < 0)
     {
         throw new Exception("Forbidden value on urlId = " + urlId + ", it doesn't respect the following condition : urlId < 0");
     }
 }
예제 #19
0
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     breed = reader.ReadSByte();
     sex   = reader.ReadBoolean();
     rank  = reader.ReadShort();
     if (rank < 0)
     {
         throw new Exception("Forbidden value on rank = " + rank + ", it doesn't respect the following condition : rank < 0");
     }
     givenExperience = reader.ReadDouble();
     if (givenExperience < 0)
     {
         throw new Exception("Forbidden value on givenExperience = " + givenExperience + ", it doesn't respect the following condition : givenExperience < 0");
     }
     experienceGivenPercent = reader.ReadSByte();
     if (experienceGivenPercent < 0 || experienceGivenPercent > 100)
     {
         throw new Exception("Forbidden value on experienceGivenPercent = " + experienceGivenPercent + ", it doesn't respect the following condition : experienceGivenPercent < 0 || experienceGivenPercent > 100");
     }
     rights = reader.ReadUInt();
     if (rights < 0 || rights > 4.294967295E9)
     {
         throw new Exception("Forbidden value on rights = " + rights + ", it doesn't respect the following condition : rights < 0 || rights > 4.294967295E9");
     }
     connected = reader.ReadSByte();
     if (connected < 0)
     {
         throw new Exception("Forbidden value on connected = " + connected + ", it doesn't respect the following condition : connected < 0");
     }
     alignmentSide            = reader.ReadSByte();
     hoursSinceLastConnection = reader.ReadUShort();
     if (hoursSinceLastConnection < 0 || hoursSinceLastConnection > 65535)
     {
         throw new Exception("Forbidden value on hoursSinceLastConnection = " + hoursSinceLastConnection + ", it doesn't respect the following condition : hoursSinceLastConnection < 0 || hoursSinceLastConnection > 65535");
     }
     moodSmileyId = reader.ReadSByte();
     accountId    = reader.ReadInt();
     if (accountId < 0)
     {
         throw new Exception("Forbidden value on accountId = " + accountId + ", it doesn't respect the following condition : accountId < 0");
     }
     achievementPoints = reader.ReadInt();
     status            = Types.ProtocolTypeManager.GetInstance <Types.PlayerStatus>(reader.ReadShort());
     status.Deserialize(reader);
 }
 public override void Deserialize(BigEndianReader reader)
 {
     result = reader.ReadSByte();
     if (result < 0)
     {
         throw new Exception("Forbidden value on result = " + result + ", it doesn't respect the following condition : result < 0");
     }
 }
예제 #21
0
 public override void Deserialize(BigEndianReader reader)
 {
     day = reader.ReadSByte();
     if (day < 0)
     {
         throw new Exception("Forbidden value on day = " + day + ", it doesn't respect the following condition : day < 0");
     }
     month = reader.ReadSByte();
     if (month < 0)
     {
         throw new Exception("Forbidden value on month = " + month + ", it doesn't respect the following condition : month < 0");
     }
     year = reader.ReadShort();
     if (year < 0)
     {
         throw new Exception("Forbidden value on year = " + year + ", it doesn't respect the following condition : year < 0");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     spellId    = reader.ReadInt();
     spellLevel = reader.ReadSByte();
     if (spellLevel < 1 || spellLevel > 6)
     {
         throw new Exception("Forbidden value on spellLevel = " + spellLevel + ", it doesn't respect the following condition : spellLevel < 1 || spellLevel > 6");
     }
 }
예제 #23
0
 public override void Deserialize(BigEndianReader reader)
 {
     barType = reader.ReadSByte();
     if (barType < 0)
     {
         throw new Exception("Forbidden value on barType = " + barType + ", it doesn't respect the following condition : barType < 0");
     }
     firstSlot = reader.ReadSByte();
     if (firstSlot < 0 || firstSlot > 99)
     {
         throw new Exception("Forbidden value on firstSlot = " + firstSlot + ", it doesn't respect the following condition : firstSlot < 0 || firstSlot > 99");
     }
     secondSlot = reader.ReadSByte();
     if (secondSlot < 0 || secondSlot > 99)
     {
         throw new Exception("Forbidden value on secondSlot = " + secondSlot + ", it doesn't respect the following condition : secondSlot < 0 || secondSlot > 99");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     subAreaId = reader.ReadVarShort();
     if (subAreaId < 0)
     {
         throw new Exception("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0");
     }
     reason = reader.ReadSByte();
 }
예제 #25
0
 public override void Deserialize(BigEndianReader reader)
 {
     emoteId = reader.ReadSByte();
     if (emoteId < 0)
     {
         throw new Exception("Forbidden value on emoteId = " + emoteId + ", it doesn't respect the following condition : emoteId < 0");
     }
     emoteStartTime = reader.ReadDouble();
 }
예제 #26
0
 public override void Deserialize(BigEndianReader reader)
 {
     level = reader.ReadSByte();
     if (level < 0)
     {
         throw new Exception("Forbidden value on level = " + level + ", it doesn't respect the following condition : level < 0");
     }
     message = reader.ReadUTF();
 }
예제 #27
0
 public override void Deserialize(BigEndianReader reader)
 {
     delayedCharacterId = reader.ReadInt();
     delayTypeId        = reader.ReadSByte();
     if (delayTypeId < 0)
     {
         throw new Exception("Forbidden value on delayTypeId = " + delayTypeId + ", it doesn't respect the following condition : delayTypeId < 0");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     playerId = reader.ReadVarInt();
     if (playerId < 0)
     {
         throw new Exception("Forbidden value on playerId = " + playerId + ", it doesn't respect the following condition : playerId < 0");
     }
     reason = reader.ReadSByte();
 }
 public override void Deserialize(BigEndianReader reader)
 {
     uid     = reader.ReadUTF();
     failure = reader.ReadSByte();
     if (failure < 0)
     {
         throw new Exception("Forbidden value on failure = " + failure + ", it doesn't respect the following condition : failure < 0");
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     alignmentRank = reader.ReadSByte();
     if (alignmentRank < 0)
     {
         throw new Exception("Forbidden value on alignmentRank = " + alignmentRank + ", it doesn't respect the following condition : alignmentRank < 0");
     }
     verbose = reader.ReadBoolean();
 }
예제 #31
0
        protected override void Parse( BigEndianReader reader )
        {
            reader.ReadByte(); // ID
            reader.ReadInt16(); // Size place holder

            _DataType = (WorldObjectType) reader.ReadByte();
            _Serial = reader.ReadUInt32();
            _ObjectID = reader.ReadInt16();
            _ObjectIDOffset = reader.ReadByte();
            _Amount = reader.ReadInt16();

            reader.ReadInt16(); // Amount again?

            _X = reader.ReadInt16();
            _Y = reader.ReadInt16();
            _Z = reader.ReadSByte();
            _LightLevel = reader.ReadByte();
            _Hue = reader.ReadInt16();

            byte flags = reader.ReadByte();

            if ( ( flags & 0x20 ) > 0 )
                _HasProperties = true;
            else
                _HasProperties = false;

            if ( ( flags & 0x80 ) > 0 )
                _IsVisible = true;
            else
                _IsVisible = false;

            _Access = (WorldObjectAccess) reader.ReadInt16();
        }
예제 #32
0
파일: ArcCPK.cs 프로젝트: Casidi/GARbro
        public List<TableRow> DeserializeUTFChunk(byte[] chunk)
        {
            m_chunk = chunk;
            if (!Binary.AsciiEqual (m_chunk, 0, "@UTF"))
                throw new InvalidFormatException();
            var chunk_length = BigEndian.ToInt32 (m_chunk, 4);
            using (var mem = new MemoryStream (m_chunk, 8, chunk_length))
            using (var input = new BigEndianReader (mem))
            {
                int rows_offset     = input.ReadInt32();
                int strings_offset  = input.ReadInt32() + 8;
                int data_offset     = input.ReadInt32() + 8;
                input.Skip (4);
                int column_count    = input.ReadInt16();
                int row_length      = input.ReadInt16();
                int row_count       = input.ReadInt32();

                var columns = new List<Column> (column_count);
                for (int i = 0; i < column_count; ++i)
                {
                    byte flags = input.ReadByte();
                    if (0 == flags)
                    {
                        input.Skip (3);
                        flags = input.ReadByte();
                    }
                    int name_offset = strings_offset + input.ReadInt32();
                    var column = new Column
                    {
                        Flags = (TableFlags)flags,
                        Name  = ReadString (name_offset),
                    };
                    columns.Add (column);
                }

                var table = new List<TableRow> (row_count);
                int next_offset = rows_offset;
                for (int i = 0; i < row_count; ++i)
                {
                    input.Position = next_offset;
                    next_offset += row_length;
                    var row = new TableRow (column_count);
                    table.Add (row);
                    foreach (var column in columns)
                    {
                        var storage = column.Flags & TableFlags.StorageMask;
                        if (TableFlags.StorageNone == storage
                            || TableFlags.StorageZero == storage
                            || TableFlags.StorageConstant == storage)
                            continue;
                        switch (column.Flags & TableFlags.TypeMask)
                        {
                        case TableFlags.TypeByte:
                            row[column.Name] = (int)input.ReadByte();
                            break;

                        case TableFlags.TypeSByte:
                            row[column.Name] = (int)input.ReadSByte();
                            break;

                        case TableFlags.TypeUInt16:
                            row[column.Name] = (int)input.ReadUInt16();
                            break;

                        case TableFlags.TypeInt16:
                            row[column.Name] = (int)input.ReadInt16();
                            break;

                        case TableFlags.TypeUInt32:
                        case TableFlags.TypeInt32:
                            row[column.Name] = input.ReadInt32();
                            break;

                        case TableFlags.TypeUInt64:
                        case TableFlags.TypeInt64:
                            row[column.Name] = input.ReadInt64();
                            break;

                        case TableFlags.TypeFloat32:
                            row[column.Name] = input.ReadSingle();
                            break;

                        case TableFlags.TypeString:
                            {
                                int offset = strings_offset + input.ReadInt32();
                                row[column.Name] = ReadString (offset);
                                break;
                            }

                        case TableFlags.TypeData:
                            {
                                int offset = data_offset + input.ReadInt32();
                                int length = input.ReadInt32();
                                row[column.Name] = m_chunk.Skip (offset).Take (length).ToArray();
                                break;
                            }

                        default:
                            throw new NotSupportedException();
                        }
                    }
                }
                return table;
            }
        }
예제 #33
0
        protected override void Parse( BigEndianReader reader )
        {
            reader.ReadByte(); // ID

            _Type = (GraphicalEffectType) reader.ReadByte();
            _Source = reader.ReadUInt32();
            _Target = reader.ReadUInt32();
            _ObjectID = reader.ReadInt16();
            _SourceX = reader.ReadInt16();
            _SourceY = reader.ReadInt16();
            _SourceZ = reader.ReadSByte();
            _TargetX = reader.ReadInt16();
            _TargetY = reader.ReadInt16();
            _TargetZ = reader.ReadSByte();
            _Speed = reader.ReadByte();
            _Duration = reader.ReadByte();
            reader.ReadInt16();
            _FixedDirection = reader.ReadBoolean();
            _Explode = reader.ReadBoolean();
        }
예제 #34
0
        protected override void Parse( BigEndianReader reader )
        {
            reader.ReadByte(); // ID
            reader.ReadInt16(); // Size

            _Serial = reader.ReadUInt32();
            _Body = reader.ReadInt16();
            _X = reader.ReadInt16();
            _Y = reader.ReadInt16();
            _Z = reader.ReadSByte();
            _Direction = (Direction) reader.ReadByte();
            _Hue = reader.ReadUInt16();

            byte flags = reader.ReadByte();

            if ( ( flags & 0x1 ) > 0 )
                _IsFrozen = true;

            if ( ( flags & 0x2 ) > 0 )
                _IsFemale = true;

            if ( ( flags & 0x4 ) > 0 )
                _IsFlying = true;

            if ( ( flags & 0x8 ) > 0 )
                _HasYellowHealthBar = true;

            if ( ( flags & 0x10 ) > 0 )
                _IsIgnoringMobiles = true;

            if ( ( flags & 0x40 ) > 0 )
                _IsInWarMode = true;

            if ( ( flags & 0x80 ) > 0 )
                _IsHidden = true;

            _Notoriety = (Notoriety) reader.ReadByte();

            // Items
            _Items = new List<MobileItem>();

            uint serial = 0;

            while ( ( serial = reader.ReadUInt32() ) != 0 )
                _Items.Add( new MobileItem( serial, reader ) );
        }
예제 #35
0
        protected override void Parse( BigEndianReader reader )
        {
            reader.ReadByte(); // ID

            _Serial = reader.ReadUInt32();
            _Body = reader.ReadInt16();
            reader.ReadByte();
            _Hue = reader.ReadInt16();

            byte flags = reader.ReadByte();

            if ( ( flags & 0x1 ) > 0 )
                _IsFrozen = true;

            if ( ( flags & 0x2 ) > 0 )
                _IsFemale = true;

            if ( ( flags & 0x4 ) > 0 )
                _IsFlying = true;

            if ( ( flags & 0x8 ) > 0 )
                _HasYellowHealthBar = true;

            if ( ( flags & 0x10 ) > 0 )
                _IsIgnoringMobiles = true;

            if ( ( flags & 0x40 ) > 0 )
                _IsInWarMode = true;

            if ( ( flags & 0x80 ) > 0 )
                _IsHidden = true;

            _X = reader.ReadInt16();
            _Y = reader.ReadInt16();
            reader.ReadInt16();
            _Direction = (Direction) reader.ReadByte();
            _Z = reader.ReadSByte();
        }