Beispiel #1
0
        public static MapInfoPacket Read(NBufferReader reader)
        {
            var ret = new MapInfoPacket();

            ret.Width         = reader.ReadUInt32();
            ret.Height        = reader.ReadUInt32();
            ret.Name          = reader.ReadUTF();
            ret.Name2         = reader.ReadUTF();
            ret.Seed          = reader.ReadUInt32();
            ret.Background    = reader.ReadUInt32();
            ret.Diffculty     = reader.ReadUInt32();
            ret.AllowTeleport = reader.ReadBoolean();
            ret.ShowDisplays  = reader.ReadBoolean();

            ret.ClientXML = new string[reader.ReadUInt16()];
            for (int i = 0; i < ret.ClientXML.Length; i++)
            {
                ret.ClientXML[i] = reader.Read32UTF();
            }

            ret.ExtraXML = new string[reader.ReadUInt16()];
            for (int i = 0; i < ret.ExtraXML.Length; i++)
            {
                ret.ExtraXML[i] = reader.Read32UTF();
            }

            return(ret);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public static ReconnPacket Read(NBufferReader reader)
        {
            var ret = new ReconnPacket();

            ret.Name        = reader.ReadUTF();
            ret.Host        = reader.ReadUTF();
            ret.Port        = reader.ReadUInt32();
            ret.GameId      = reader.ReadUInt32();
            ret.KeyTime     = reader.ReadUInt32();
            ret.IsFromArena = reader.ReadBoolean();
            ret.Key         = reader.ReadBytes(reader.ReadUInt16());
            return(ret);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public static RequestTradePacket Read(NBufferReader reader)
        {
            var ret = new RequestTradePacket();

            ret.Name = reader.ReadUTF();
            return(ret);
        }
Beispiel #6
0
        public static PlayerTextPacket Read(NBufferReader reader)
        {
            var ret = new PlayerTextPacket();

            ret.Text = reader.ReadUTF();
            return(ret);
        }
Beispiel #7
0
        public static AccountListPacket Read(NBufferReader reader)
        {
            var ret = new AccountListPacket();

            ret.AccountListId = reader.ReadUInt32();
            ret.AccountIds    = new string[reader.ReadUInt16()];
            for (int i = 0; i < ret.AccountIds.Length; i++)
            {
                ret.AccountIds[i] = reader.ReadUTF();
            }
            return(ret);
        }
Beispiel #8
0
        public static HelloPacket Read(NBufferReader reader)
        {
            var ret = new HelloPacket();

            ret.BuildVer = reader.ReadUTF();
            ret.GameId   = reader.ReadUInt32();
            ret.Guid     = reader.ReadUTF();
            ret.Rand1    = reader.ReadUInt32();
            ret.Password = reader.ReadUTF();
            ret.Rand2    = reader.ReadUInt32();
            ret.Secret   = reader.ReadUTF();
            ret.KeyTime  = reader.ReadUInt32();
            ret.Key      = reader.ReadBytes(reader.ReadUInt16());
            ret.MapInfo  = reader.Read32UTF();
            ret.X1       = reader.ReadUTF();
            ret.X2       = reader.ReadUTF();
            ret.X3       = reader.ReadUTF();
            ret.X4       = reader.ReadUTF();
            ret.X5       = reader.ReadUTF();
            return(ret);
        }
Beispiel #9
0
        public static TradeStartPacket Read(NBufferReader reader)
        {
            var ret = new TradeStartPacket();

            ret.MyItems = new TradeItem[reader.ReadUInt16()];
            for (int i = 0; i < ret.MyItems.Length; i++)
            {
                ret.MyItems[i] = TradeItem.Read(reader);
            }

            ret.YourName  = reader.ReadUTF();
            ret.YourItems = new TradeItem[reader.ReadUInt16()];
            for (int i = 0; i < ret.YourItems.Length; i++)
            {
                ret.YourItems[i] = TradeItem.Read(reader);
            }

            return(ret);
        }