Пример #1
0
        /// <summary>
        /// Parses agent related data
        /// </summary>
        private void ParseAgentData(BinaryReader reader, ParserController operation)
        {        // 4 bytes: player count
            uint agentCount = reader.ReadUInt32();

            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
                ushort toughness = reader.ReadUInt16();
                // 2 bytes: healing
                ushort concentration = reader.ReadUInt16();
                // 2 bytes: healing
                ushort healing = reader.ReadUInt16();
                // 2 bytes: hitbox width
                uint hbWidth = (uint)(2 * reader.ReadUInt16());
                // 2 bytes: condition
                ushort condition = reader.ReadUInt16();
                // 2 bytes: hitbox height
                uint hbHeight = (uint)(2 * reader.ReadUInt16());
                // 68 bytes: name
                string name = GetString(reader, 68, false);
                //Save
                ParserHelper.Spec   agentProf = ParserHelper.ProfToSpec(GetAgentProfString(prof, isElite, operation));
                AgentItem.AgentType type;
                ushort ID = 0;
                switch (agentProf)
                {
                case ParserHelper.Spec.NPC:
                    // NPC
                    if (!ushort.TryParse(prof.ToString().PadLeft(5, '0'), out ID))
                    {
                        ID = 0;
                    }
                    type = AgentItem.AgentType.NPC;
                    break;

                case ParserHelper.Spec.Gadget:
                    // Gadget
                    if (!ushort.TryParse((prof & 0x0000ffff).ToString().PadLeft(5, '0'), out ID))
                    {
                        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));
            }
        }