Exemple #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);
            }
        }
Exemple #2
0
 /// <summary>
 /// Parses skill related data
 /// </summary>
 private void ParseSkillData(Stream stream, ParserController operation)
 {
     using (BinaryReader reader = CreateReader(stream))
     {
         // 4 bytes: player count
         uint skillCount = reader.ReadUInt32();
         operation.UpdateProgressWithCancellationCheck("Skill Count " + skillCount);
         //TempData["Debug"] += "Skill Count:" + skill_count.ToString();
         // 68 bytes: each skill
         for (int i = 0; i < skillCount; i++)
         {
             // 4 bytes: skill ID
             int skillId = reader.ReadInt32();
             // 64 bytes: name
             string name = ParserHelper.GetString(stream, 64);
             //Save
             var skill = new SkillItem(skillId, name);
             _skillData.Add(skill);
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Parses agent related data
        /// </summary>
        private void ParseAgentData(Stream stream, ParserController operation)
        {
            using (BinaryReader reader = CreateReader(stream))
            {            // 4 bytes: player count
                int agentCount = reader.ReadInt32();

                operation.UpdateProgressWithCancellationCheck("Agent Count " + agentCount);
                // 96 bytes: each player
                for (int i = 0; i < agentCount; i++)
                {
                    // 8 bytes: agent
                    ulong agent = reader.ReadUInt64();

                    // 4 bytes: profession
                    uint prof = reader.ReadUInt32();

                    // 4 bytes: is_elite
                    uint isElite = reader.ReadUInt32();

                    // 2 bytes: toughness
                    uint toughness = reader.ReadUInt16();
                    // 2 bytes: healing
                    uint concentration = reader.ReadUInt16();
                    // 2 bytes: healing
                    uint healing = reader.ReadUInt16();
                    // 2 bytes: hitbox width
                    uint hbWidth = (uint)2 * reader.ReadUInt16();
                    // 2 bytes: condition
                    uint condition = reader.ReadUInt16();
                    // 2 bytes: hitbox height
                    uint hbHeight = (uint)2 * reader.ReadUInt16();
                    // 68 bytes: name
                    string name = ParserHelper.GetString(stream, 68, false);
                    //Save
                    string agentProf = GetAgentProfString(prof, isElite);
                    AgentItem.AgentType type;
                    ushort ID = 0;
                    switch (agentProf)
                    {
                    case "NPC":
                        // NPC
                        try
                        {
                            ID = ushort.Parse(prof.ToString().PadLeft(5, '0'));
                        }
                        catch (FormatException)
                        {
                            ID = 0;
                        }
                        type = AgentItem.AgentType.NPC;
                        break;

                    case "GDG":
                        // Gadget
                        try
                        {
                            ID = ushort.Parse((prof & 0x0000ffff).ToString().PadLeft(5, '0'));
                        }
                        catch (FormatException)
                        {
                            ID = 0;
                        }
                        type = AgentItem.AgentType.Gadget;
                        break;

                    default:
                        // Player
                        type = AgentItem.AgentType.Player;
                        break;
                    }
                    _allAgentsList.Add(new AgentItem(agent, name, agentProf, ID, type, toughness, healing, condition, concentration, hbWidth, hbHeight));
                }
            }
        }