Esempio n. 1
0
        public static ObjectStats Read(NBufferReader reader)
        {
            ObjectStats ret;

            ret.Id       = reader.ReadUInt32();
            ret.Position = Position.Read(reader);
            ret.Stats    = new Tuple <StatsType, object> [reader.ReadUInt16()];
            for (var i = 0; i < ret.Stats.Length; i++)
            {
                var type = (StatsType)reader.ReadByte();
                if (type == StatsType.Guild || type == StatsType.Name || type == StatsType.PetName)
                {
                    ret.Stats[i] = Tuple.Create(type, (object)reader.ReadUTF());
                }
                else if (type == StatsType.AccountId || type == StatsType.OwnerAccountId)
                {
                    string x = reader.ReadUTF();
                    // wut kabam?
                    // AccountId & OwnerAccountId are App Engine numeric IDs
                    // Some time ago the format was changed and broke newly created account
                    // And...they didn't read the documentation and just use a string...
                    // http://googlecloudplatform.blogspot.hk/2013/05/update-on-datastore-auto-ids.html
                    // Quote: "guaranteed to be small enough to be completely represented as 64-bit floats"
                    ret.Stats[i] = Tuple.Create(type, (object)long.Parse(x));
                }
                else
                {
                    ret.Stats[i] = Tuple.Create(type, (object)(int)reader.ReadUInt32());
                }
            }

            return(ret);
        }
Esempio n. 2
0
        public static ObjectSlot Read(NBufferReader reader)
        {
            ObjectSlot ret;

            ret.ObjectId   = reader.ReadUInt32();
            ret.SlotId     = reader.ReadByte();
            ret.ObjectType = reader.ReadUInt16();
            return(ret);
        }
Esempio n. 3
0
        public static UseItemPacket Read(NBufferReader reader)
        {
            var ret = new UseItemPacket();

            ret.Time     = reader.ReadUInt32();
            ret.Slot     = ObjectSlot.Read(reader);
            ret.Position = Position.Read(reader);
            ret.UseType  = reader.ReadByte();
            return(ret);
        }
Esempio n. 4
0
        public static ShowEffectPacket Read(NBufferReader reader)
        {
            var ret = new ShowEffectPacket();

            ret.EffectType = (EffectType)reader.ReadByte();
            ret.TargetId   = reader.ReadUInt32();
            ret.PosA       = Position.Read(reader);
            ret.PosB       = Position.Read(reader);
            ret.Color      = ARGB.Read(reader);
            return(ret);
        }
Esempio n. 5
0
        public static TextPacket Read(NBufferReader reader)
        {
            var ret = new TextPacket();

            ret.name       = reader.ReadUTF();
            ret.objectId   = reader.ReadUInt32();         //objectId
            ret.star       = reader.ReadUInt32();
            ret.bubbleTime = reader.ReadByte();           //bubbleTime
            ret.recipient  = reader.ReadUTF();            //recipient
            ret.text       = reader.ReadUTF();
            ret.cleanText  = reader.ReadUTF();            //cleanText
            return(ret);
        }