Exemplo n.º 1
0
        /*private bool TryRead(Stream stream, byte[] data)
         * {
         *  int offset = 0;
         *  int count = data.Length;
         *  while (count > 0)
         *  {
         *      int bytesRead = stream.Read(data, offset, count);
         *      if (bytesRead == 0)
         *      {
         *          return false;
         *      }
         *      offset += bytesRead;
         *      count -= bytesRead;
         *  }
         *  return true;
         * }*/

        //sub Parse methods
        /// <summary>
        /// Parses fight related data
        /// </summary>
        private void ParseFightData(Stream stream, ParserController operation)
        {
            using (BinaryReader reader = CreateReader(stream))
            {
                // 12 bytes: arc build version
                _buildVersion = ParserHelper.GetString(stream, 12);
                operation.UpdateProgressWithCancellationCheck("ArcDPS Build " + _buildVersion);

                // 1 byte: skip
                _revision = reader.ReadByte();
                operation.UpdateProgressWithCancellationCheck("ArcDPS Combat Item Revision " + _revision);

                // 2 bytes: fight instance ID
                _id = reader.ReadUInt16();
                operation.UpdateProgressWithCancellationCheck("Fight Instance " + _id);
                // 1 byte: position
                ParserHelper.SafeSkip(stream, 1);
            }
        }
Exemplo n.º 2
0
        private static CombatItem ReadCombatItem(BinaryReader reader)
        {
            // 8 bytes: time
            long time = reader.ReadInt64();

            // 8 bytes: src_agent
            ulong srcAgent = reader.ReadUInt64();

            // 8 bytes: dst_agent
            ulong dstAgent = reader.ReadUInt64();

            // 4 bytes: value
            int value = reader.ReadInt32();

            // 4 bytes: buff_dmg
            int buffDmg = reader.ReadInt32();

            // 2 bytes: overstack_value
            ushort overstackValue = reader.ReadUInt16();

            // 2 bytes: skill_id
            ushort skillId = reader.ReadUInt16();

            // 2 bytes: src_instid
            ushort srcInstid = reader.ReadUInt16();

            // 2 bytes: dst_instid
            ushort dstInstid = reader.ReadUInt16();

            // 2 bytes: src_master_instid
            ushort srcMasterInstid = reader.ReadUInt16();

            // 9 bytes: garbage
            ParserHelper.SafeSkip(reader.BaseStream, 9);

            // 1 byte: iff
            byte iff = reader.ReadByte();

            // 1 byte: buff
            byte buff = reader.ReadByte();

            // 1 byte: result
            byte result = reader.ReadByte();

            // 1 byte: is_activation
            byte isActivation = reader.ReadByte();

            // 1 byte: is_buffremove
            byte isBuffRemove = reader.ReadByte();

            // 1 byte: is_ninety
            byte isNinety = reader.ReadByte();

            // 1 byte: is_fifty
            byte isFifty = reader.ReadByte();

            // 1 byte: is_moving
            byte isMoving = reader.ReadByte();

            // 1 byte: is_statechange
            byte isStateChange = reader.ReadByte();

            // 1 byte: is_flanking
            byte isFlanking = reader.ReadByte();

            // 1 byte: is_flanking
            byte isShields = reader.ReadByte();
            // 1 byte: is_flanking
            byte isOffcycle = reader.ReadByte();

            // 1 bytes: garbage
            ParserHelper.SafeSkip(reader.BaseStream, 1);

            //save
            // Add combat
            return(new CombatItem(time, srcAgent, dstAgent, value, buffDmg, overstackValue, skillId,
                                  srcInstid, dstInstid, srcMasterInstid, 0, iff, buff, result, isActivation, isBuffRemove,
                                  isNinety, isFifty, isMoving, isStateChange, isFlanking, isShields, isOffcycle, 0));
        }