Esempio n. 1
0
        /// <summary>
        /// Parses agent related data
        /// </summary>
        private void parseAgentData(Stream stream)
        {
            using (var reader = CreateReader(stream))
            {
                // 4 bytes: player count
                int player_count = reader.ReadInt32();

                // 96 bytes: each player
                for (int i = 0; i < player_count; i++)
                {
                    // 8 bytes: agent
                    ulong agent = reader.ReadUInt64();

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

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

                    // 2 bytes: toughness
                    int toughness = reader.ReadInt16();
                    // skip concentration
                    ParseHelper.safeSkip(stream, 2);
                    // 2 bytes: healing
                    int healing = reader.ReadInt16();
                    ParseHelper.safeSkip(stream, 2);
                    // 2 bytes: condition
                    int condition = reader.ReadInt16();
                    ParseHelper.safeSkip(stream, 2);
                    // 68 bytes: name
                    String name = ParseHelper.getString(stream, 68, false);
                    //Save
                    Agent a          = new Agent(agent, name, prof, is_elite);
                    var   agent_prof = a.getProf(this.log_data.getBuildVersion(), APIController);
                    switch (agent_prof)
                    {
                    case "NPC":
                        // NPC
                        agent_data.addItem(new AgentItem(agent, name, a.getName() + ":" + prof.ToString().PadLeft(5, '0')), agent_prof);
                        break;

                    // Gadget
                    case "GDG":
                        agent_data.addItem(new AgentItem(agent, name, a.getName() + ":" + (prof & 0x0000ffff).ToString().PadLeft(5, '0')), agent_prof);
                        break;

                    default:
                        // Player
                        agent_data.addItem(new AgentItem(agent, name, agent_prof, toughness, healing, condition), agent_prof);
                        break;
                    }
                }
            }
        }