Пример #1
0
        public static ObjectDef Read(NReader rdr)
        {
            ObjectDef ret = new ObjectDef
            {
                ObjectType = (ushort)rdr.ReadInt16(),
                Stats      = ObjectStatusData.Read(rdr)
            };

            return(ret);
        }
Пример #2
0
        public static ObjectStatusData Read(NReader rdr)
        {
            ObjectStatusData ret = new ObjectStatusData
            {
                Id       = rdr.ReadInt32(),
                Position = Position.Read(rdr),
                Stats    = new KeyValuePair <StatsType, object> [rdr.ReadInt16()]
            };

            for (int i = 0; i < ret.Stats.Length; i++)
            {
                StatsType type = rdr.ReadByte();
                if (type == StatsType.GUILD_NAME_STAT || type == StatsType.NAME_STAT)
                {
                    ret.Stats[i] = new KeyValuePair <StatsType, object>(type, rdr.ReadUTF());
                }
                else
                {
                    ret.Stats[i] = new KeyValuePair <StatsType, object>(type, rdr.ReadInt32());
                }
            }
            return(ret);
        }