public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.GamePowerups);

                    if (this.GamePowerups != null)
                    {
                        binaryWriter.Write(this.GamePowerups.Count);

                        foreach (GamePowerup powerup in this.GamePowerups)
                        {
                            binaryWriter.Write(powerup.PackageName);
                            binaryWriter.Write(powerup.TypeString);
                            binaryWriter.Write(powerup.Amount);
                            binaryWriter.Write(powerup.Cost);
                        }
                    }
                    else
                    {
                        binaryWriter.Write(0);
                    }
                }

                return(memoryStream.ToArray());
            }
        }
Пример #2
0
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.Texts);

                    if (this.Texts != null)
                    {
                        binaryWriter.Write(this.Texts.Count);
                        foreach (KeyValuePair <string, string> text in this.Texts)
                        {
                            binaryWriter.Write(text.Key);
                            binaryWriter.Write(text.Value);
                        }
                    }
                    else
                    {
                        binaryWriter.Write(0);
                    }
                }

                return(memoryStream.ToArray());
            }
        }
Пример #3
0
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.AuthenicationOK);
                }

                return(memoryStream.ToArray());
            }
        }
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.Playtime);
                    binaryWriter.Write(this.Playtime);
                    binaryWriter.Write(this.Max);
                }

                return(memoryStream.ToArray());
            }
        }
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.PowerupGained);
                    binaryWriter.Write((int)this.Type);
                    binaryWriter.Write(this.Amount);
                }

                return(memoryStream.ToArray());
            }
        }
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.Maintenance);
                    binaryWriter.Write(false); //unused
                    binaryWriter.Write(this.FastFoodServerMaintenance);
                }

                return(memoryStream.ToArray());
            }
        }
Пример #7
0
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.OpenBigParachute);
                    binaryWriter.Write(this.PlateId);
                    binaryWriter.Write(this.GameUserID);
                }

                return(memoryStream.ToArray());
            }
        }
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.LaunchMissile);
                    binaryWriter.Write(this.TargetPlateID);
                    binaryWriter.Write(this.SenderGameUserID);
                    binaryWriter.Write(this.TargetGameUserID);
                }

                return(memoryStream.ToArray());
            }
        }
Пример #9
0
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.FoodHitTable);
                    binaryWriter.Write(this.Stars);
                    binaryWriter.Write(this.GameUserID);
                    binaryWriter.Write((int)this.State);
                    binaryWriter.Write(this.NextPlateID);
                    binaryWriter.Write(12); //idk?
                }

                return(memoryStream.ToArray());
            }
        }
Пример #10
0
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.UpdateState);
                    binaryWriter.Write(this.PlateID);
                    binaryWriter.Write(this.GameUserID);
                    binaryWriter.Write(this.Distance.ToString());
                    binaryWriter.Write(this.Speed.ToString());
                    binaryWriter.Write((int)this.State);
                    binaryWriter.Write(this.Failed);
                }

                return(memoryStream.ToArray());
            }
        }
Пример #11
0
        public static ServerMessage GetRevisionServerMessage(Revision revision, uint header)
        {
            ServerMessage message = null;

            switch (revision)
            {
            case Revision.RELEASE63_35255_34886_201108111108:
            case Revision.R26_20080915_0408_7984_61ccb5f8b8797a3aba62c1fa2ca80169:
                message = new OldCryptoServerMessage(revision);
                break;

            case Revision.RELEASE63_201211141113_913728051:
            case Revision.PRODUCTION_201601012205_226667486:
            case Revision.PRODUCTION_201611291003_338511768:
                message = new NewCryptoServerMessage(revision);
                break;

            default:
                return(null);
            }

            message?.Init(header);
            return(message);
        }
        public byte[] GetBytes()
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (NewCryptoServerMessage binaryWriter = new NewCryptoServerMessage(memoryStream))
                {
                    binaryWriter.Write(OutgoingHeaders.GameStarting);
                    binaryWriter.Write(this.GameUserID);
                    binaryWriter.Write(true);
                    binaryWriter.Write(true);
                    binaryWriter.Write(true);
                    binaryWriter.Write(0);

                    if (FastFoodGamePlate.Plates != null)
                    {
                        binaryWriter.Write(FastFoodGamePlate.Plates.Count);

                        foreach (FastFoodGamePlate plate in FastFoodGamePlate.Plates)
                        {
                            binaryWriter.Write(plate.ID);
                            binaryWriter.Write(plate.FallMultiplayer.ToString());
                            binaryWriter.Write(plate.ParachuteMultiplayer.ToString());
                            binaryWriter.Write(plate.ParachuteSpeed.ToString());
                            binaryWriter.Write(plate.BigParachuteSpeed.ToString());
                            binaryWriter.Write(plate.PlateTimer);
                        }
                    }
                    else
                    {
                        binaryWriter.Write(0);
                    }

                    if (this.Powerups != null)
                    {
                        binaryWriter.Write(this.Powerups.Count);

                        foreach (KeyValuePair <int, int> powerup in this.Powerups)
                        {
                            binaryWriter.Write(powerup.Key);   //id
                            binaryWriter.Write(powerup.Value); //count
                        }
                    }
                    else
                    {
                        binaryWriter.Write(0); //powerup count
                    }

                    if (this.Users != null)
                    {
                        binaryWriter.Write(this.Users.Count);

                        foreach (FastFoodGameUser user in this.Users)
                        {
                            binaryWriter.Write(user.GameUserID);
                            binaryWriter.Write(user.User.Username);
                            binaryWriter.Write("");     //Figure URL
                            binaryWriter.Write(user.User.Gender);
                            binaryWriter.Write("hhfi"); //hotel

                            if (user.User.Badges != null)
                            {
                                binaryWriter.Write(user.User.Badges.Count);

                                for (int i = 0; i < user.User.Badges.Count; i++)
                                {
                                    binaryWriter.Write(user.User.Badges[i]);
                                    binaryWriter.Write(i);
                                    binaryWriter.Write(""); //URL
                                }
                            }
                            else
                            {
                                binaryWriter.Write(0); //badges count
                            }
                        }
                    }
                    else
                    {
                        binaryWriter.Write(0); //players count
                    }
                }

                return(memoryStream.ToArray());
            }
        }