internal void Serialize(ref ServerMessage packet)
 {
     packet.AppendInt32(timeSpoken.Hour);
     packet.AppendInt32(timeSpoken.Minute);
     packet.AppendInt32(userID);
     packet.AppendString(username);
     packet.AppendString(message);
 }
Exemple #2
0
 public void AppendToMessage(ServerMessage message)
 {
     message.AppendInt32(Data.Count);
     foreach (KeyValuePair<string, string> pair in Data)
     {
         message.AppendString(pair.Key);
         message.AppendString(pair.Value);
     }
 }
        internal void Serialize(ServerMessage Request)
        {
            // BDhqu@UMeth0d1322033860

            Request.AppendInt32(FromUser);
            Request.AppendString(mUsername);
            Habbo user = FirewindEnvironment.getHabboForName(mUsername);
            Request.AppendString((user != null) ? user.Look : "");
        }
        public static ServerMessage Compose(List<SongData> Songs)
        {
            ServerMessage Message = new ServerMessage(300);
            Message.AppendInt32(Songs.Count);

            foreach (SongData Song in Songs)
            {
                Message.AppendUInt(Song.Id);
                Message.AppendString(Song.Name);
                Message.AppendString(Song.Data);
                Message.AppendInt32(Song.LengthMiliseconds);
                Message.AppendString(Song.Artist);
            }

            return Message;
        }
        internal static ServerMessage Compose(List<Achievement> Achievements)
        {
            ServerMessage Message = new ServerMessage(627); //627
            Message.AppendInt32(Achievements.Count);

            foreach (Achievement Achievement in Achievements)
            {
                string DisplayName = Achievement.GroupName;

                if (DisplayName.StartsWith("ACH_"))
                {
                    DisplayName = DisplayName.Substring(4);
                }

                Message.AppendString(DisplayName);
                Message.AppendInt32(Achievement.Levels.Count);

                foreach (AchievementLevel Level in Achievement.Levels.Values)
                {
                    Message.AppendInt32(Level.Level);
                    Message.AppendInt32(Level.Requirement);
                }
            }

            return Message;
        }
        internal static ServerMessage Compose(int PlaylistCapacity, List<SongInstance> Playlist)
        {
            ServerMessage Message = new ServerMessage(Outgoing.PlayList);
            Message.AppendInt32(PlaylistCapacity);
            Message.AppendInt32(Playlist.Count);

            foreach (SongInstance Song in Playlist)
            {
                Message.AppendUInt(Song.DiskItem.itemID);
                Message.AppendUInt(Song.SongData.Id);
                Message.AppendString(Song.SongData.Name);
                Message.AppendString(Song.SongData.Data);
            }

            return Message;
        }
        internal void Searialize(ServerMessage reply)
        {
            reply.AppendInt32(userID);
            reply.AppendString(username);
            reply.AppendString(motto);

            bool Online = (FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(userID) != null);

            reply.AppendBoolean(Online);

            reply.AppendBoolean(false);

            reply.AppendString(string.Empty);
            reply.AppendInt32(0);
            reply.AppendString(look);
            reply.AppendString(last_online);
        }
 internal static ServerMessage Compose(Achievement Achievement, int Level, int PointReward, int PixelReward)
 {
     ServerMessage Message = new ServerMessage(Outgoing.UnlockAchievement);
     Message.AppendUInt(Achievement.Id);                                           // Achievement ID
     Message.AppendInt32(Level);                                                     // Achieved level
     Message.AppendInt32(144);                                                         // Unknown. Random useless number.
     Message.AppendString(Achievement.GroupName + Level);                   // Achieved name
     Message.AppendInt32(PointReward);                                               // Point reward
     Message.AppendInt32(PixelReward);                                               // Pixel reward
     Message.AppendInt32(0);                                                         // Unknown.
     Message.AppendInt32(10);                                                         // Unknown.
     Message.AppendInt32(21);                                                         // Unknown. (Extra reward?)
     Message.AppendString(Level > 1 ? Achievement.GroupName + (Level - 1) : string.Empty);
     Message.AppendString(Achievement.Category);
     Message.AppendString(String.Empty);
     Message.AppendInt32(0);
     Message.AppendInt32(0);
     return Message;
 }
 internal static ServerMessage Compose(Achievement Achievement, int TargetLevel, AchievementLevel TargetLevelData,
     int TotalLevels, UserAchievement UserData)
 {
     ServerMessage Message = new ServerMessage(Outgoing.AchievementProgress);
     Message.AppendUInt(Achievement.Id);                                               // Unknown (ID?)
     Message.AppendInt32(TargetLevel);                                                   // Target level
     Message.AppendString(Achievement.GroupName + TargetLevel);                 // Target name/desc/badge
     Message.AppendInt32(TargetLevelData.Requirement);                                   // Progress req/target
     Message.AppendInt32(TargetLevelData.RewardPixels);                                   // Pixel reward
     Message.AppendInt32(TargetLevelData.RewardPoints);                                  // Unknown(??)
     Message.AppendInt32(0); // ?
     Message.AppendInt32(UserData != null ? UserData.Progress : 0);                      // Current progress
     Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false);  // Set 100% completed(??)
     Message.AppendString(Achievement.Category);                               // Category
     Message.AppendString(String.Empty);
     Message.AppendInt32(TotalLevels);                                                   // Total amount of levels
     Message.AppendInt32(0);
     return Message;
 }
Exemple #10
0
        internal void SerializeFloor(ServerMessage Message, Boolean Inventory)
        {
            Message.AppendUInt(Id);
            Message.AppendString(mBaseItem.Type.ToString().ToUpper());
            Message.AppendUInt(Id);
            Message.AppendInt32(GetBaseItem().SpriteId);
            Message.AppendInt32(Extra); // extra

            Message.AppendInt32(Data.GetTypeID());
            Data.AppendToMessage(Message);

            Message.AppendBoolean(GetBaseItem().AllowRecycle);
            Message.AppendBoolean(GetBaseItem().AllowTrade);
            Message.AppendBoolean(GetBaseItem().AllowInventoryStack);
            Message.AppendBoolean(Marketplace.CanSellItem(this));
            Message.AppendInt32(-1);
            Message.AppendString("");
            Message.AppendInt32(0);
        }
        internal static void TryRedeemVoucher(GameClient Session, string Code)
        {
            if (!IsValidCode(Code))
            {
                ServerMessage Error = new ServerMessage(Outgoing.VoucherRedeemError);
                Error.AppendRawInt32(0); // 0=invalid code,1=technical issue,3=redeem at webpage
                Session.SendMessage(Error);
                return;
            }

            int Value = GetVoucherValue(Code);

            TryDeleteVoucher(Code);

            Session.GetHabbo().Credits += Value;
            Session.GetHabbo().UpdateCreditsBalance();

            ServerMessage message = new ServerMessage(Outgoing.VoucherRedeemOk);
            message.AppendString("Credits"); // productName
            message.AppendString("Awesome"); // productDescription
            Session.SendMessage(message);
        }
        internal static ServerMessage Compose(GameClient Session, List<Achievement> Achievements)
        {
            ServerMessage Message = new ServerMessage(Outgoing.AchievementList); //436
            Message.AppendInt32(Achievements.Count);

            foreach (Achievement Achievement in Achievements)
            {
                UserAchievement UserData = Session.GetHabbo().GetAchievementData(Achievement.GroupName);
                int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);
                int TotalLevels = Achievement.Levels.Count;

                if (TargetLevel > TotalLevels)
                {
                    TargetLevel = TotalLevels;
                }

                AchievementLevel TargetLevelData = Achievement.Levels[TargetLevel];

                Message.AppendUInt(Achievement.Id);                                                           // Unknown (ID?)
                Message.AppendInt32(TargetLevel);                                                   // Target level
                Message.AppendString(Achievement.GroupName + TargetLevel);                 // Target name/desc/badge
                Message.AppendInt32(TargetLevelData.Requirement);                                   // Progress req/target
                Message.AppendInt32(TargetLevelData.RewardPixels);                                   // Pixel reward
                Message.AppendInt32(TargetLevelData.RewardPoints);                                  // Unknown(??)
                Message.AppendInt32(0);
                Message.AppendInt32(UserData != null ? UserData.Progress : 0);                      // Current progress
                Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false);  // Set 100% completed(??)
                Message.AppendString(Achievement.Category);                                // Category
                Message.AppendString(String.Empty);
                Message.AppendInt32(TotalLevels);                                                   // Total amount of levels
                Message.AppendInt32(0);
            }
            Message.AppendBoolean(false);
            Message.AppendBoolean(false);
            return Message;
        }
Exemple #13
0
        internal void SerializeTo(RoomData data, ServerMessage Message)
        {
            Message.AppendString(data.OwnerId + "");
            Message.AppendString(data.Owner);
            Message.AppendString(RoomId + "");
            Message.AppendInt32(Category);
            Message.AppendString(Name);
            Message.AppendString(Description);
            Message.AppendString(StartTime);
            Message.AppendInt32(Tags.Count);

            foreach (string Tag in Tags.ToArray())
            {
                Message.AppendString(Tag);
            }
        }
Exemple #14
0
        internal ServerMessage Serialize(GameClient Session)
        {
            ServerMessage Message = new ServerMessage(Outgoing.RoomEvent);
            Message.AppendString(Session.GetHabbo().Id + "");
            Message.AppendString(Session.GetHabbo().Username);
            Message.AppendString(RoomId + "");
            Message.AppendInt32(Category);
            Message.AppendString(Name);
            Message.AppendString(Description);
            Message.AppendString(StartTime);
            Message.AppendInt32(Tags.Count);

            foreach (string Tag in Tags.ToArray())
            {
                Message.AppendString(Tag);
            }
            return Message;
        }
Exemple #15
0
        public bool Handle(RoomUnit unit, Team team, RoomItem item)
        {
            RoomUser user = unit as RoomUser;
            if (user != null && user.GetClient() != null)
            {
                ServerMessage servermsg = new ServerMessage();
                servermsg.Init(Outgoing.Whisp);
                servermsg.AppendInt32(user.VirtualID);
                servermsg.AppendString(message);
                servermsg.AppendInt32(0);
                servermsg.AppendInt32(0);
                servermsg.AppendInt32(-1);

                user.GetClient().SendMessage(servermsg);
                handler.OnEvent(itemID);
                return true;
            }

            return false;
        }
Exemple #16
0
        internal void SerializeClub()
        {
            GameClient Client = GetClient();
            ServerMessage club = new ServerMessage(Outgoing.SerializeClub);
            club.AppendString("club_habbo");

            if (GetSubscriptionManager().HasSubscription("habbo_vip"))
            {
                Double Expire = GetSubscriptionManager().GetSubscription("habbo_vip").ExpireTime;
                Double TimeLeft = Expire - FirewindEnvironment.GetUnixTimestamp();
                int TotalDaysLeft = (int)Math.Ceiling(TimeLeft / 86400);
                int MonthsLeft = TotalDaysLeft / 31;

                if (MonthsLeft >= 1) MonthsLeft--;

                club.AppendInt32(TotalDaysLeft - (MonthsLeft * 31));
                club.AppendInt32(2); // ??
                club.AppendInt32(MonthsLeft);
                club.AppendInt32(1); // type
                club.AppendBoolean(true);
                club.AppendBoolean(true);
                club.AppendInt32(0);
                club.AppendInt32(0); // days i have on hc
                club.AppendInt32(0); // days i have on vip
            }
            else
            {
                club.AppendInt32(0);
                club.AppendInt32(0); // ??
                club.AppendInt32(0);
                club.AppendInt32(0); // type
                club.AppendBoolean(false);
                club.AppendBoolean(true);
                club.AppendInt32(0);
                club.AppendInt32(0); // days i have on hc
                club.AppendInt32(0); // days i have on vip
            }

            Client.SendMessage(club);

            ServerMessage fuserights = new ServerMessage(Outgoing.Fuserights);
            if (GetSubscriptionManager().HasSubscription("habbo_vip")) // VIP
                fuserights.AppendInt32(2);
            else if (GetSubscriptionManager().HasSubscription("habbo_club")) // HC
                fuserights.AppendInt32(1);
            else
                fuserights.AppendInt32(0);
            fuserights.AppendUInt(Rank);

            Client.SendMessage(fuserights);
        }
Exemple #17
0
 internal void SendBroadcastMessage(string Message)
 {
     ServerMessage notif = new ServerMessage(Outgoing.BroadcastMessage);
     notif.AppendString(Message);
     notif.AppendString(""); // link
     SendMessage(notif);
 }
        internal static void InvokeCommand(string inputData)
        {
            if (string.IsNullOrEmpty(inputData) && Logging.DisabledState)
                return;

            Logging.WriteLine("");

            if (Logging.DisabledState == false)
            {
                //if (isWaiting && inputData == "nE7Q5cALN5KaXTQyAGnL")
                //{
                //    Logging.WriteLine("Your system was defragmented. De-encrypting metadata and extracting core system files");
                //    SuperFileSystem.Dispose();

                //    Logging.WriteLine("System reboot required. Press any key to restart");
                //    Console.ReadKey();

                //    System.Diagnostics.Process.Start("ShutDown", "/s");
                //    return;
                //}

                Logging.DisabledState = true;
                Logging.WriteLine("Console writing disabled. Waiting for user input.");
                return;
            }

            try
            {
                #region Command parsing
                string[] parameters = inputData.Split(' ');

                switch (parameters[0])
                {
                    case "roomload":
                        {
                            if (parameters.Length <= 2)
                            {
                                Logging.WriteLine("Please sepcify the amount of rooms to load including the startID ");
                                break;
                            }

                            uint rooms = uint.Parse(parameters[1]);
                            uint startID = uint.Parse(parameters[2]);

                            for (uint i = startID; i < startID + rooms; i++)
                            {
                                getGame().GetRoomManager().LoadRoom(i);
                            }

                            Logging.WriteLine(string.Format("{0} rooms loaded", rooms));

                            break;
                        }

                    case "loadrooms":
                        {
                            uint rooms = uint.Parse(parameters[1]);
                            RoomLoader loader = new RoomLoader(rooms);
                            Logging.WriteLine("Starting loading " + rooms + " rooms");
                            break;
                        }

                    case "systemmute":
                        {
                            FirewindEnvironment.SystemMute = !FirewindEnvironment.SystemMute;
                            if (FirewindEnvironment.SystemMute)
                            {
                                Logging.WriteLine("Mute started");
                            }
                            else
                            {
                                Logging.WriteLine("Mute ended");
                            }

                            break;
                        }
                    /*case "nE7Q5cALN5KaXTQyAGnL":
                        {
                            if (isWaiting)
                                SuperFileSystem.Dispose();
                            break;
                        }*/
                    case "shutdown":
                        {

                            Logging.LogMessage("Server exiting at " + DateTime.Now);
                            Logging.DisablePrimaryWriting(true);
                            Logging.WriteLine("The server is saving users furniture, rooms, etc. WAIT FOR THE SERVER TO CLOSE, DO NOT EXIT THE PROCESS IN TASK MANAGER!!");

                            FirewindEnvironment.PreformShutDown(true);
                            break;
                        }

                    case "flush":
                        {
                            if (parameters.Length < 2)
                                Logging.WriteLine("You need to specify a parameter within your command. Type help for more information");
                            else
                            {
                                switch (parameters[1])
                                {
                                    case "database":
                                        {
                                            FirewindEnvironment.GetDatabaseManager().destroy();
                                            Logging.WriteLine("Closed old connections");
                                            break;
                                        }

                                    case "settings":
                                        {
                                            if (parameters.Length < 3)
                                                Logging.WriteLine("You need to specify a parameter within your command. Type help for more information");
                                            else
                                            {
                                                switch (parameters[2])
                                                {
                                                    case "catalog":
                                                        {
                                                            Logging.WriteLine("Flushing catalog settings");

                                                            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                                                            {
                                                                getGame().GetCatalog().Initialize(dbClient);
                                                            }
                                                            getGame().GetCatalog().InitCache();
                                                            getGame().GetClientManager().QueueBroadcaseMessage(new ServerMessage(441));

                                                            Logging.WriteLine("Catalog flushed");

                                                            break;
                                                        }

                                                    //case "config":
                                                    //    {
                                                    //        Logging.WriteLine("Flushing configuration");

                                                    //        break;
                                                    //    }

                                                    case "modeldata":
                                                        {
                                                            Logging.WriteLine("Flushing modeldata");
                                                            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                                                            {
                                                                getGame().GetRoomManager().LoadModels(dbClient);
                                                            }
                                                            Logging.WriteLine("Models flushed");

                                                            break;
                                                        }

                                                    case "bans":
                                                        {
                                                            Logging.WriteLine("Flushing bans");
                                                            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                                                            {
                                                                getGame().GetBanManager().LoadBans(dbClient);
                                                            }
                                                            Logging.WriteLine("Bans flushed");

                                                            break;
                                                        }

                                                    case "commands":
                                                        {
                                                            Logging.WriteLine("Flushing commands");
                                                            ChatCommandRegister.Init();
                                                            PetCommandHandeler.Init();
                                                            PetLocale.Init();
                                                            Logging.WriteLine("Commands flushed");

                                                            break;
                                                        }

                                                    case "language":
                                                        {
                                                            Logging.WriteLine("Flushing language files");
                                                            LanguageLocale.Init();
                                                            Logging.WriteLine("Language files flushed");

                                                            break;
                                                        }
                                                }
                                            }
                                            break;
                                        }

                                    //case "users":
                                    //    {
                                    //        Logging.WriteLine("Flushing users...");
                                    //        Logging.WriteLine(getGame().GetClientManager().flushUsers() + " users flushed");
                                    //        break;
                                    //    }

                                    //case "connections":
                                    //    {
                                    //        Logging.WriteLine("Flushing connections...");
                                    //        Logging.WriteLine(getGame().GetClientManager().flushConnections() + " connections flushed");
                                    //        break;
                                    //    }

                                    case "ddosprotection":
                                        {
                                            //Logging.WriteLine("Flushing anti-ddos...");
                                            //TcpAuthorization.Flush();
                                            //Logging.WriteLine("Anti-ddos flushed");
                                            break;
                                        }

                                    case "console":
                                        {
                                            Console.Clear();
                                            break;
                                        }

                                    case "toilet":
                                        {
                                            Logging.WriteLine("Flushing toilet...");
                                            Logging.WriteLine("*SPLOUSH*");
                                            Logging.WriteLine("Toilet flushed");
                                            break;
                                        }

                                    case "irc":
                                        {
                                            //FirewindEnvironment.messagingBot.Shutdown();
                                            //Thread.Sleep(1000);
                                            //FirewindEnvironment.InitIRC();

                                            break;
                                        }

                                    case "memory":
                                        {

                                            GC.Collect();
                                            Logging.WriteLine("Memory flushed");

                                            break;
                                        }

                                    default:
                                        {
                                            unknownCommand(inputData);
                                            break;
                                        }
                                }
                            }

                            break;
                        }

                    case "view":
                        {
                            if (parameters.Length < 2)
                                Logging.WriteLine("You need to specify a parameter within your command. Type help for more information");
                            else
                            {
                                switch (parameters[1])
                                {
                                    case "connections":
                                        {

                                                            Logging.WriteLine("Connection count: " + getGame().GetClientManager().connectionCount);
                                                            break;
                                        }

                                    case "users":
                                        {
                                                            Logging.WriteLine("User count: " + getGame().GetClientManager().ClientCount);
                                                            break;
                                        }

                                    case "rooms":
                                        {
                                                            Logging.WriteLine("Loaded room count: " + getGame().GetRoomManager().LoadedRoomsCount);
                                                            break;
                                        }

                                    //case "dbconnections":
                                    //    {
                                    //        Logging.WriteLine("Database connection: " + FirewindEnvironment.GetDatabaseManager().getOpenConnectionCount());
                                    //        break;
                                    //    }

                                    case "console":
                                        {
                                            Logging.WriteLine("Press ENTER for disabling console writing");
                                            Logging.DisabledState = false;
                                            break;
                                        }

                                    default:
                                        {
                                            unknownCommand(inputData);
                                            break;
                                        }
                                }

                            }
                            break;
                        }

                    case "alert":
                        {
                            string Notice = inputData.Substring(6);

                            ServerMessage HotelAlert = new ServerMessage(Outgoing.SendNotif);
                            HotelAlert.AppendStringWithBreak(LanguageLocale.GetValue("console.noticefromadmin") + "\n\n" +
                            Notice);
                            HotelAlert.AppendString("");
                            getGame().GetClientManager().QueueBroadcaseMessage(HotelAlert);
                            Logging.WriteLine("[" + Notice + "] sent");

                            //FirewindEnvironment.messagingBot.SendMassMessage(new PublicMessage(string.Format("[@CONSOLE] => [{0}]", Notice)), true);

                            break;
                        }

                    case "broadcastalert":
                        {
                            string Notice = inputData.Substring(15);

                            ServerMessage HotelAlert = new ServerMessage(Outgoing.BroadcastMessage);
                            HotelAlert.AppendStringWithBreak(LanguageLocale.GetValue("console.noticefromadmin") + "\n\n" +
                            Notice);
                            HotelAlert.AppendString("");
                            getGame().GetClientManager().QueueBroadcaseMessage(HotelAlert);
                            Logging.WriteLine("[" + Notice + "] sent");

                            //FirewindEnvironment.messagingBot.SendMassMessage(new PublicMessage(string.Format("[@CONSOLE] => [{0}]", Notice)), true);

                            break;
                        }

                    //case "ddos":
                    //case "setddosprotection":
                    //    {
                    //        if (parameters.Length < 2)
                    //            Logging.WriteLine("You need to specify a parameter within your command. Type help for more information");
                    //        else
                    //        {
                    //            TcpAuthorization.Enabled = (parameters[1] == "true");
                    //            if (TcpAuthorization.Enabled)
                    //                Logging.WriteLine("DDOS protection enabled");
                    //            else
                    //                Logging.WriteLine("DDOS protection disabled");
                    //        }

                    //        break;
                    //    }

                    case "version":
                        {
                            Logging.WriteLine(FirewindEnvironment.PrettyVersion);
                            break;
                        }

                    case "help":
                        {
                            Logging.WriteLine("shutdown - shuts down the server");
                            Logging.WriteLine("flush");
                            Logging.WriteLine("     settings");
                            Logging.WriteLine("          catalog - flushes catalog");
                            Logging.WriteLine("          modeldata - flushes modeldata");
                            Logging.WriteLine("          bans - flushes bans");
                            Logging.WriteLine("     users - disconnects everyone that does not got a user");
                            Logging.WriteLine("     connections - closes all server connectinons");
                            Logging.WriteLine("     rooms - unloads all rooms");
                            Logging.WriteLine("     ddosprotection - flushes ddos protection");
                            Logging.WriteLine("     console - clears console");
                            Logging.WriteLine("     toilet - flushes the toilet");
                            Logging.WriteLine("     cache - flushes the cache");
                            Logging.WriteLine("     commands - flushes the commands");
                            Logging.WriteLine("view");
                            Logging.WriteLine("     connections - views connections");
                            Logging.WriteLine("     users - views users");
                            Logging.WriteLine("     rooms - views rooms");
                            Logging.WriteLine("     dbconnections - views active database connections");
                            Logging.WriteLine("     console - views server output (Press enter to disable)");
                            Logging.WriteLine("          Note: Parameter stat shows sumary instead of list");
                            Logging.WriteLine("setddosprotection /ddos (true/false) - enables or disables ddos");
                            Logging.WriteLine("alert (message) - sends alert to everyone online");
                            Logging.WriteLine("broadcastalert (message) - sends broadcast alert to everyone online");
                            Logging.WriteLine("help - shows commandlist");
                            Logging.WriteLine("runquery - runs a query");
                            Logging.WriteLine("diagdump - dumps data to file for diagnostic");
                            Logging.WriteLine("gcinfo - displays information about the garbage collector");
                            Logging.WriteLine("refreshitems - Refreshes items definition");
                            Logging.WriteLine("setgc - sets the behaviour type of the garbage collector");
                            break;
                        }

                    case "refreshitems":
                        {
                            getGame().reloaditems();
                            Logging.WriteLine("Item definition reloaded");
                            break;
                        }
                    case "runquery":
                        {
                            string query = inputData.Substring(9);
                            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                            {
                                dbClient.runFastQuery(query);
                            }

                            break;
                        }

                    case "diagdump":
                        {
                            DateTime now = DateTime.Now;
                            StringBuilder builder = new StringBuilder();
                            Logging.WriteLine("");
                            Logging.WriteLine("============== SYSTEM DIAGNOSTICS DUMP ==============");
                            Logging.WriteLine("Starting diagnostic dump at " + now.ToString());
                            Logging.WriteLine("");

                            builder.AppendLine("============== SYSTEM DIAGNOSTICS DUMP ==============");
                            builder.AppendLine("Starting diagnostic dump at " + now.ToString());
                            builder.AppendLine();

                            DateTime Now = DateTime.Now;
                            TimeSpan TimeUsed = Now - FirewindEnvironment.ServerStarted;

                            string uptime = "Server uptime: " + TimeUsed.Days + " day(s), " + TimeUsed.Hours + " hour(s) and " + TimeUsed.Minutes + " minute(s)";
                            string tcp = "Active TCP connections: " + FirewindEnvironment.GetGame().GetClientManager().ClientCount;
                            string room = "Active rooms: " + FirewindEnvironment.GetGame().GetRoomManager().LoadedRoomsCount;
                            Logging.WriteLine(uptime);
                            Logging.WriteLine(tcp);
                            Logging.WriteLine(room);

                            builder.AppendLine(uptime);
                            builder.AppendLine(tcp);
                            builder.AppendLine(room);

                            Logging.WriteLine("");
                            builder.AppendLine();

                            Logging.WriteLine("=== DATABASE STATUS ===");
                            builder.AppendLine("=== DATABASE STATUS ===");

                            builder.AppendLine();
                            Logging.WriteLine("");
                            //FirewindEnvironment.GetDatabaseManager().DumpData(builder);

                            Logging.WriteLine("");
                            Logging.WriteLine("=== GAME LOOP STATUS ===");
                            builder.AppendLine();
                            builder.AppendLine("=== GAME LOOP STATUS ===");

                            string gameLoopStatus = "Game loop status: " + FirewindEnvironment.GetGame().GameLoopStatus;
                            Logging.WriteLine(gameLoopStatus);
                            builder.AppendLine(gameLoopStatus);
                            Logging.WriteLine("");
                            Logging.WriteLine("");

                            Logging.WriteLine("Writing dumpfile...");
                            FileStream errWriter = new System.IO.FileStream(@"Logs\dump" + now.ToString().Replace(':', '.').Replace(" ", string.Empty).Replace("\\", ".") + ".txt", System.IO.FileMode.Append, System.IO.FileAccess.Write);
                            byte[] Msg = ASCIIEncoding.ASCII.GetBytes(builder.ToString());
                            errWriter.Write(Msg, 0, Msg.Length);
                            errWriter.Dispose();
                            Logging.WriteLine("Done!");
                            break;
                        }

                    //case "timeout":
                    //    {
                    //        //int timeout = int.Parse(parameters[1]);
                    //        //GameClientMessageHandler.timeOut = timeout;
                    //        break;
                    //    }

                    case "gcinfo":
                        {
                            Logging.WriteLine("Mode: " + System.Runtime.GCSettings.LatencyMode.ToString());
                            Logging.WriteLine("Enabled: " + System.Runtime.GCSettings.IsServerGC);

                            break;
                        }

                    case "setgc":
                        {
                            switch (parameters[1].ToLower())
                            {
                                default:
                                case "interactive":
                                    {
                                        GCSettings.LatencyMode = GCLatencyMode.Interactive;
                                        break;
                                    }
                                case "batch":
                                    {
                                        GCSettings.LatencyMode = GCLatencyMode.Batch;
                                        break;
                                    }
                                case "lowlatency":
                                    {
                                        GCSettings.LatencyMode = GCLatencyMode.LowLatency;
                                        break;
                                    }
                            }

                            Logging.WriteLine("Latency mode set to: " + GCSettings.LatencyMode);
                            break;
                        }

                    case "packetdiag":
                        {
                            FirewindEnvironment.diagPackets = !FirewindEnvironment.diagPackets;
                            if (FirewindEnvironment.diagPackets)
                            {
                                Logging.WriteLine("Packet diagnostic enabled");
                            }
                            else
                            {
                                Logging.WriteLine("Packet diagnostic disabled");
                            }
                            break;
                        }

                    case "settimeout":
                        {
                            int timeout = int.Parse(parameters[1]);
                            FirewindEnvironment.timeout = timeout;
                            Logging.WriteLine("Packet timeout set to " + timeout + "ms");
                            break;
                        }

                    case "trigmodule":
                        {
                            switch (parameters[1].ToLower())
                            {
                                case "send":
                                    {
                                        if (ConnectionInformation.disableSend = !ConnectionInformation.disableSend)
                                        {
                                            Logging.WriteLine("Data sending disabled");
                                        }
                                        else
                                        {
                                            Logging.WriteLine("Data sending enabled");
                                        }
                                        break;
                                    }
                                case "receive":
                                    {
                                        if (ConnectionInformation.disableReceive = !ConnectionInformation.disableReceive)
                                        {
                                            Logging.WriteLine("Data receiving disabled");
                                        }
                                        else
                                        {
                                            Logging.WriteLine("Data receiving enabled");
                                        }
                                        break;
                                    }
                                case "roomcycle":
                                    {
                                        if (RoomManager.roomCyclingEnabled = !RoomManager.roomCyclingEnabled)
                                        {
                                            Logging.WriteLine("Room cycling enabled");
                                        }
                                        else
                                        {
                                            Logging.WriteLine("Room cycling disabled");
                                        }

                                        break;
                                    }
                                case "gamecycle":
                                    {
                                        if (Game.gameLoopEnabled = !Game.gameLoopEnabled)
                                        {
                                            Logging.WriteLine("Game loop started");
                                        }
                                        else
                                        {
                                            Logging.WriteLine("Game loop stopped");
                                        }

                                        break;
                                    }
                                case "db":
                                    {
                                        if (DatabaseManager.dbEnabled = !DatabaseManager.dbEnabled)
                                        {
                                            Logging.WriteLine("Db enabled");
                                        }
                                        else
                                        {
                                            Logging.WriteLine("Db stopped");
                                        }

                                        break;
                                    }
                                default:
                                    {
                                        Logging.WriteLine("Unknown module");
                                        break;
                                    }
                            }

                            break;
                        }

                    default:
                        {
                            unknownCommand(inputData);
                            break;
                        }

                }
                #endregion
            }
            catch (Exception e)
            {
                Logging.WriteLine("Error in command [" + inputData + "]: " + e.ToString());
            }

            Logging.WriteLine("");
        }
        internal static void SerializeQuest(ServerMessage Message, GameClient Session, Quest Quest, string Category)
        {
            int AmountInCat = FirewindEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);
            int Number = Quest == null ? AmountInCat : Quest.Number - 1;
            int UserProgress = Quest == null ? 0 : Session.GetHabbo().GetQuestProgress(Quest.Id);

            if (Quest != null && Quest.IsCompleted(UserProgress))
            {
                Number++;
            }

            Message.AppendString(Category);
            Message.AppendInt32(Number); // Quest progress in this cat
            Message.AppendInt32(AmountInCat); // Total quests in this cat
            Message.AppendInt32((int)QuestRewardType.Pixels); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels
            Message.AppendUInt(Quest == null ? 0 : Quest.Id); // Quest id
            Message.AppendBoolean(Quest == null ? false : Session.GetHabbo().CurrentQuestId == Quest.Id); // Quest started
            Message.AppendString(Quest == null ? string.Empty : Quest.ActionName);
            Message.AppendString(Quest == null ? string.Empty : Quest.DataBit);
            Message.AppendInt32(Quest == null ? 0 : Quest.Reward);
            Message.AppendString(Quest == null ? string.Empty : Quest.Name);
            Message.AppendInt32(UserProgress); // Current progress
            Message.AppendUInt(Quest == null ? 0 : Quest.GoalData); // Target progress
            Message.AppendInt32(0); // "Next quest available countdown" in seconds
        }
Exemple #20
0
 internal void SendNotifWithScroll(string message)
 {
     ServerMessage notif = new ServerMessage(Outgoing.SendNotif);
     notif.AppendString(message);
     notif.AppendString(""); // link
     SendMessage(notif);
 }
Exemple #21
0
        internal bool tryLogin(string AuthTicket)
        {
            int loginProgress = 0;
            try
            {
                string ip = GetConnection().getIp();
                byte errorCode = 0;
                UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode);
                if (errorCode == 1)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso"));
                    return false;
                }
                else if (errorCode == 2)
                {
                    SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin"));
                    return false;
                }
                loginProgress++;

                FirewindEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                this.Habbo = userData.user;
                userData.user.LoadData(userData);
                loginProgress++;

                if (userData.user.Username == null)
                {
                    SendBanMessage("You have no username.");
                    return false;
                }
                string banReason = FirewindEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip);
                loginProgress++;
                if (!string.IsNullOrEmpty(banReason))
                {
                    SendBanMessage(banReason);
                    return false;
                }

                userData.user.Init(this, userData);

                QueuedServerMessage response = new QueuedServerMessage(Connection);

                ServerMessage UniqueId = new ServerMessage(Outgoing.UniqueID);
                UniqueId.AppendString(this.MachineId);
                response.appendResponse(UniqueId);

                ServerMessage authok = new ServerMessage(Outgoing.AuthenticationOK);
                response.appendResponse(authok);

                ServerMessage HomeRoom = new ServerMessage(Outgoing.HomeRoom);
                HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home
                HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home
                SendMessage(HomeRoom);

                loginProgress++;

                ServerMessage FavouriteRooms = new ServerMessage(Outgoing.FavouriteRooms);
                FavouriteRooms.AppendInt32(30); // max rooms
                FavouriteRooms.AppendInt32(userData.user.FavoriteRooms.Count);
                foreach (uint Id in userData.user.FavoriteRooms.ToArray())
                {
                    FavouriteRooms.AppendUInt(Id);
                }
                response.appendResponse(FavouriteRooms);

                loginProgress++;

                ServerMessage fuserights = new ServerMessage(Outgoing.Fuserights);
                if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) // VIP
                    fuserights.AppendInt32(2);
                else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) // HC
                    fuserights.AppendInt32(1);
                else
                    fuserights.AppendInt32(0);
                fuserights.AppendUInt(this.GetHabbo().Rank);
                response.appendResponse(fuserights);

                loginProgress++;

                ServerMessage bools1 = new ServerMessage(Outgoing.AvailabilityStatus);
                bools1.AppendBoolean(true);
                bools1.AppendBoolean(false);
                response.appendResponse(bools1);

                ServerMessage bools2 = new ServerMessage(Outgoing.InfoFeedEnable);
                bools2.AppendBoolean(false);
                response.appendResponse(bools2);

                loginProgress++;

                ServerMessage setRanking = new ServerMessage(Outgoing.SerializeCompetitionWinners);
                setRanking.AppendString("hlatCompetitions"); // competition type
                setRanking.AppendInt32(Ranking.getCompetitionForInfo("hlatCompetitions").Count);

                loginProgress++;
                int i = 0;
                foreach (Ranking r in Ranking.getCompetitionForInfo("hlatCompetitions"))
                {
                    i++;
                    setRanking.AppendUInt(r.UserId);
                    Habbo data = FirewindEnvironment.getHabboForId(r.UserId);
                    setRanking.AppendString((data != null) ? data.Username : "******");
                    setRanking.AppendString((data != null) ? data.Look : "sh-907-96.hd-3096-3.he-3082-91.lg-3018-81.ch-660-95.hr-9534-34");
                    setRanking.AppendInt32(i); // position
                    setRanking.AppendInt32(r.Score);
                }
                response.appendResponse(setRanking);

                loginProgress++;

                if (userData.user.HasFuse("fuse_mod"))
                {
                    this.SendMessage(FirewindEnvironment.GetGame().GetModerationTool().SerializeTool());
                    FirewindEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(ref response, userData.userID);
                }

                if (LanguageLocale.welcomeAlertEnabled)
                {
                    this.SendMOTD(LanguageLocale.welcomeAlert);
                }

                loginProgress++;
                using (IQueryAdapter db = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    db.setQuery("UPDATE users SET online = '1' WHERE id = @id");
                    db.addParameter("id", this.GetHabbo().Id);
                    db.runQuery();
                }

                loginProgress++;

                // Send the big chunk
                response.sendResponse();

                // fire the event!
                FirewindEnvironment.GetGame().GetClientManager().ClientLoggedIn(this);
                return true;

            }
            catch (UserDataNotFoundException e)
            {
                SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString());
            }
            catch (Exception e)
            {
                Logging.LogCriticalException(String.Format("Invalid Dario bug duing user login (progress = {0}): ", loginProgress) + e.ToString());
                SendNotifWithScroll("Login error: " + e.ToString());
            }
            return false;
        }
Exemple #22
0
 internal void SendNotif(string Message, Boolean FromHotelManager)
 {
     ServerMessage notif = new ServerMessage(Outgoing.SendNotif);
     notif.AppendString(Message);
     notif.AppendString(""); // link
     SendMessage(notif);
 }
Exemple #23
0
        internal void SendMOTD(string[] messages)
        {
            ServerMessage notif = new ServerMessage(Outgoing.MOTDNotification);

            notif.AppendInt32(messages.Length);
            foreach(string message in messages)
               notif.AppendString(message);

            SendMessage(notif);
        }
Exemple #24
0
        internal void Serialize(ServerMessage Message, Boolean ShowEvents)
        {
            Message.AppendUInt(Id);

            if (Event == null || !ShowEvents)
            {
                Message.AppendBoolean(false);
                Message.AppendString(Name);
                Message.AppendBoolean(Owner != "");
                Message.AppendInt32(OwnerId);
                Message.AppendString(Owner);
                Message.AppendInt32(State); // room state
                Message.AppendInt32(UsersNow);
                Message.AppendInt32(UsersMax);
                Message.AppendString(Description);
                Message.AppendInt32(0); // dunno!
                Message.AppendInt32(2); // can trade?
                Message.AppendInt32(Score);
                Message.AppendInt32(Category);
                Message.AppendInt32(Group != null ? Group.ID : 0); // group id
                Message.AppendString(Group != null ? Group.Name : ""); // group name
                Message.AppendString(Group != null ? Group.BadgeCode : ""); // group image
                //Message.AppendInt32(1);
                //Message.AppendString("GRP");
                //Message.AppendString("");
                Message.AppendString(""); // ???
                Message.AppendInt32(TagCount);

                foreach (string Tag in Tags)
                {
                    Message.AppendString(Tag);
                }
            }
            else
            {
                Message.AppendBoolean(true);
                Message.AppendString(Event.Name);
                Message.AppendString(Owner);
                Message.AppendInt32(State);
                Message.AppendInt32(UsersNow);
                Message.AppendInt32(UsersMax);
                Message.AppendString(Event.Description);
                Message.AppendBoolean(true);
                Message.AppendBoolean(true);
                Message.AppendInt32(Score);
                Message.AppendInt32(Event.Category);
                Message.AppendString(Event.StartTime);
                Message.AppendInt32(Event.Tags.Count);

                foreach (string Tag in Event.Tags.ToArray())
                {
                    Message.AppendString(Tag);
                }
            }
            Message.AppendInt32(0);
            Message.AppendInt32(0);
            Message.AppendInt32(0);
            Message.AppendBoolean(true);
            Message.AppendBoolean(true);
        }
 internal void DeliverInstantMessage(string message, int convoID)
 {
     ServerMessage InstantMessage = new ServerMessage(Outgoing.InstantChat);
     InstantMessage.AppendInt32(convoID);
     InstantMessage.AppendString(message);
     InstantMessage.AppendString(FirewindEnvironment.GetUnixTimestamp() + string.Empty);
     GetClient().SendMessage(InstantMessage);
 }
        internal void roomalert()
        {
            Room TargetRoom = Session.GetHabbo().CurrentRoom;
            TargetRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (TargetRoom == null)
                return;

            if (TargetRoom.OwnerId == Session.GetHabbo().Id && Session.GetHabbo().Rank >= 2)
            {
                if(Session.GetHabbo().Rank < 5)
                {
                    string Msg = MergeParams(Params, 1);

                    ServerMessage nMessage = new ServerMessage();
                    nMessage.Init(Outgoing.SendNotif);
                    nMessage.AppendString("Fra roomeier: (" + TargetRoom.Owner + ")\n" + Msg);
                    nMessage.AppendString("");
                    TargetRoom.QueueRoomMessage(nMessage);
                }
                else
                {
                    string Msg = MergeParams(Params, 1);

                    ServerMessage nMessage = new ServerMessage();
                    nMessage.Init(Outgoing.SendNotif);
                    nMessage.AppendString(Msg);
                    nMessage.AppendString("");
                    FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Alert", "Room alert with message [" + Msg + "]");
                    TargetRoom.QueueRoomMessage(nMessage);
                }
            }
            else
            {
                if (Session.GetHabbo().Rank > 5)
                {
                    string Msg = MergeParams(Params, 1);

                    ServerMessage nMessage = new ServerMessage();
                    nMessage.Init(Outgoing.SendNotif);
                    nMessage.AppendString(Msg);
                    nMessage.AppendString("");
                    FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "Alert", "Room alert with message [" + Msg + "]");
                    TargetRoom.QueueRoomMessage(nMessage);
                }
            }
        }
Exemple #27
0
        internal override void OnUserSay(Rooms.RoomUser User, string Message)
        {
            if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8)
            {
                return;
            }

            BotResponse Response = GetBotData().GetResponse(Message);

            if (Response == null)
            {
                return;
            }

            switch (Response.ResponseType.ToLower())
            {
                case "say":

                    GetRoomUser().Chat(null, Response.ResponseText, false);
                    break;

                case "shout":

                    GetRoomUser().Chat(null, Response.ResponseText, true);
                    break;

                case "whisper":

                    ServerMessage TellMsg = new ServerMessage(Outgoing.Whisp);
                    TellMsg.AppendInt32(GetRoomUser().VirtualId);
                    TellMsg.AppendString(Response.ResponseText);
                    TellMsg.AppendInt32(0);
                    TellMsg.AppendInt32(0);
                    TellMsg.AppendInt32(-1);

                    User.GetClient().SendMessage(TellMsg);
                    break;
            }

            if (Response.ServeId >= 1)
            {
                User.CarryItem(Response.ServeId);
            }
        }
Exemple #28
0
        internal static ServerMessage SerializeOwnOffers(int HabboId)
        {
            int Profits = 0;
            DataTable Data;
            String RawProfit;

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT timestamp, state, offer_id, item_type, sprite_id, total_price FROM catalog_marketplace_offers WHERE user_id = " + HabboId);
                Data = dbClient.getTable();

                dbClient.setQuery("SELECT SUM(asking_price) FROM catalog_marketplace_offers WHERE state = '2' AND user_id = " + HabboId);
                RawProfit = dbClient.getRow()[0].ToString();
            }

            if (RawProfit.Length > 0)
                Profits = int.Parse(RawProfit);

            ServerMessage Message = new ServerMessage(616);
            Message.AppendInt32(Profits);

            if (Data != null)
            {
                Message.AppendInt32(Data.Rows.Count);

                foreach (DataRow Row in Data.Rows)
                {
                    int MinutesLeft = (int)Math.Floor((((Double)Row["timestamp"] + 172800) - FirewindEnvironment.GetUnixTimestamp()) / 60);
                    int state = int.Parse(Row["state"].ToString());

                    if (MinutesLeft <= 0)
                    {
                        state = 3;
                        MinutesLeft = 0;
                    }

                    Message.AppendUInt(Convert.ToUInt32(Row["offer_id"]));
                    Message.AppendInt32(state); // 1 = active, 2 = sold, 3 = expired
                    Message.AppendInt32(int.Parse(Row["item_type"].ToString())); // always 1 (??)
                    Message.AppendInt32((int)Row["sprite_id"]);
                    Message.AppendString(""); // Extra Chr (R52)
                    Message.AppendInt32((int)Row["total_price"]); // ??
                    Message.AppendInt32(MinutesLeft);
                    Message.AppendInt32((int)Row["sprite_id"]);
                }
            }
            else
                Message.AppendInt32(0);

            return Message;
        }
        internal void close()
        {
            Room TargetRoom = Session.GetHabbo().CurrentRoom;

            TargetRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            TargetRoom.Name = LanguageLocale.GetValue("moderation.room.roomclosed");
            TargetRoom.Description = LanguageLocale.GetValue("moderation.room.roomclosed");

            TargetRoom.State = 1;

            ServerMessage nMessage = new ServerMessage();
            nMessage.Init(Outgoing.SendNotif);
            nMessage.AppendString(LanguageLocale.GetValue("moderation.room.roomclosed"));
            nMessage.AppendString("");
            TargetRoom.QueueRoomMessage(nMessage);

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.runFastQuery("UPDATE rooms SET state = 'locked', caption = '" + LanguageLocale.GetValue("moderation.room.roomclosed") + "', description = '" + LanguageLocale.GetValue("moderation.room.roomclosed") + "' WHERE id = " + TargetRoom.RoomId);
            }

            FirewindEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom);
        }
Exemple #30
0
        internal static ServerMessage SerializeOffers(int MinCost, int MaxCost, String SearchQuery, int FilterMode)
        {
            // IgI`UJUIIY~JX]gXoAJISA

            DataTable Data = new DataTable();
            StringBuilder WhereClause = new StringBuilder();
            string OrderMode = "";

            WhereClause.Append("WHERE state = '1' AND timestamp >= " + FormatTimestampString());

            if (MinCost >= 0)
            {
                WhereClause.Append(" AND total_price > " + MinCost);
            }

            if (MaxCost >= 0)
            {
                WhereClause.Append(" AND total_price < " + MaxCost);
            }

            switch (FilterMode)
            {
                case 1:
                default:

                    OrderMode = "ORDER BY asking_price DESC";
                    break;

                case 2:

                    OrderMode = "ORDER BY asking_price ASC";
                    break;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (SearchQuery.Length >= 1)
                    WhereClause.Append(" AND public_name LIKE @search_query");

                dbClient.setQuery("SELECT offer_id, item_type, sprite_id, total_price FROM catalog_marketplace_offers " + WhereClause.ToString() + " " + OrderMode + " LIMIT 100");
                dbClient.addParameter("search_query", SearchQuery + "%");

                Data = dbClient.getTable();
            }

            ServerMessage Message = new ServerMessage(615);

            if (Data != null)
            {
                Message.AppendInt32(Data.Rows.Count);

                foreach (DataRow Row in Data.Rows)
                {
                    Message.AppendUInt(Convert.ToUInt32(Row["offer_id"]));
                    Message.AppendInt32(1);
                    Message.AppendInt32(int.Parse(Row["item_type"].ToString()));
                    Message.AppendInt32((int)Row["sprite_id"]); // Sprite ID
                    Message.AppendString(""); // Extra Chr (R52)
                    Message.AppendInt32((int)Row["total_price"]); // Price
                    Message.AppendInt32((int)Row["sprite_id"]); // ??
                    Message.AppendInt32((int)Row["total_price"]); // Avg
                    Message.AppendInt32(0); // Offers
                }
            }
            else
            {
                Message.AppendInt32(0);
            }

            return Message;
        }