コード例 #1
0
        internal void hotelalert()
        {
            string Notice = GetInput(Params).Substring(4);
            ServerMessage HotelAlert = new ServerMessage(Outgoing.BroadcastMessage);
            HotelAlert.AppendStringWithBreak(LanguageLocale.GetValue("hotelallert.notice") + "\r\n" +
            Notice + "\r\n" + "- " + Session.GetHabbo().Username);
            FirewindEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(HotelAlert);
            FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "HotelAlert", "Hotel alert [" + Notice + "]");

            //FirewindEnvironment.messagingBot.SendMassMessage(new PublicMessage(string.Format("[{0}] => [{1}]", Session.GetHabbo().Username, Notice)), true);
        }
コード例 #2
0
        internal void linkAlert()
        {
            Room TargetRoom = Session.GetHabbo().CurrentRoom;
            // Hotel Alert pluss link :hal <link> <message>
            string Link = Params[1];

            string Message = MergeParams(Params, 2);

            ServerMessage nMessage = new ServerMessage(Outgoing.SendNotif);
            nMessage.AppendStringWithBreak(LanguageLocale.GetValue("hotelallert.notice") + "\r\n" + Message + "\r\n-" + Session.GetHabbo().Username);
            nMessage.AppendStringWithBreak(Link);
            FirewindEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(nMessage);

            //FirewindEnvironment.messagingBot.SendMassMessage(new PublicMessage(string.Format("[{0}] => [{1}] + [{2}]", Session.GetHabbo().Username, Link, Message)), true);
        }
コード例 #3
0
        internal void copylook()
        {
            string copyTarget = Params[1];
            bool findResult = false;

            string gender = null;
            string figure = null;
            DataRow dRow;
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT gender,look FROM users WHERE username = @username");
                dbClient.addParameter("username", copyTarget);
                dRow = dbClient.getRow();

                if (dRow != null)
                {
                    findResult = true;
                    gender = (string)dRow[0];
                    figure = (string)dRow[1];

                    dbClient.setQuery("UPDATE users SET gender = @gender, look = @look WHERE username = @username");
                    dbClient.addParameter("gender", gender);
                    dbClient.addParameter("look", figure);
                    dbClient.addParameter("username", Session.GetHabbo().Username);
                    dbClient.runQuery();
                }
            }

            if (findResult)
            {
                Session.GetHabbo().Gender = gender;
                Session.GetHabbo().Look = figure;
                Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation);
                Session.GetMessageHandler().GetResponse().AppendInt32(-1);
                Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Look);
                Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Motto);
                Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints);
                Session.GetMessageHandler().SendResponse();

                if (Session.GetHabbo().InRoom)
                {
                    Room Room = Session.GetHabbo().CurrentRoom;

                    if (Room == null)
                    {
                        return;
                    }

                    RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

                    if (User == null)
                    {
                        return;
                    }

                    ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation);
                    RoomUpdate.AppendInt32(User.VirtualId);
                    RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look);
                    RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                    RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto);
                    RoomUpdate.AppendInt32(Session.GetHabbo().AchievementPoints);
                    Room.SendMessage(RoomUpdate);
                }
            }
        }
コード例 #4
0
        internal void deleteMission()
        {
            string TargetUser = Params[1];
            GameClient TargetClient = null;
            Room TargetRoom = Session.GetHabbo().CurrentRoom;

            TargetClient = FirewindEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser);

            if (TargetClient == null)
            {
                Session.SendNotif(LanguageLocale.GetValue("input.usernotfound"));
                return;
            }
            if (Session.GetHabbo().Rank <= TargetClient.GetHabbo().Rank)
            {
                Session.SendNotif(LanguageLocale.GetValue("user.notpermitted"));
                return;
            }
            TargetClient.GetHabbo().Motto = LanguageLocale.GetValue("user.unacceptable_motto");
            //TODO update motto

            FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, TargetClient.GetHabbo().Username, "mission removal", "removed mission");

            Room Room = TargetClient.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            ServerMessage RoomUpdate = new ServerMessage(266);
            RoomUpdate.AppendInt32(User.VirtualId);
            RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look);
            RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
            RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto);
            Room.SendMessage(RoomUpdate);
        }
コード例 #5
0
ファイル: Room.cs プロジェクト: Kristopher-RZ/Firewind
        internal void FlushSettings()
        {
            List<ServerMessage> messages = new List<ServerMessage>();

            lock (GetRoomItemHandler().mFloorItems)
            {
                foreach (RoomItem Item in GetRoomItemHandler().mFloorItems.Values)
                {
                    ServerMessage Message = new ServerMessage(94);
                    Message.AppendRawUInt(Item.Id);
                    Message.AppendStringWithBreak("");
                    Message.AppendBoolean(false);
                    messages.Add(Message);
                }
            }

            lock (GetRoomItemHandler().mWallItems)
            {
                foreach (RoomItem Item in GetRoomItemHandler().mWallItems.Values)
                {
                    ServerMessage Message = new ServerMessage(84);
                    Message.AppendRawUInt(Item.Id);
                    Message.AppendStringWithBreak("");
                    Message.AppendBoolean(false);
                    messages.Add(Message);
                }
            }

            SendMessage(messages);

            mCycleEnded = true;
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                GetRoomItemHandler().SaveFurniture(dbClient);

            Tags.Clear();
            UsersWithRights.Clear();
            Bans.Clear();
            ActiveTrades.Clear();

            if (GotFreeze())
                freeze = new Freeze(this);
            if (GotBanzai())
                banzai = new BattleBanzai(this);
            if (GotSoccer())
                soccer = new Soccer(this);
            if (gameItemHandler != null)
                gameItemHandler = new GameItemHandler(this);
        }
コード例 #6
0
 internal void massclothes()
 {
     Room currentRoom = Session.GetHabbo().CurrentRoom;
     if (currentRoom != null)
     {
         if (currentRoom.Owner == Session.GetHabbo().Username && Session.GetHabbo().Rank >= 3)
         {
             List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers();
             foreach (RoomUser user in roomUsers)
             {
                 ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation);
                 RoomUpdate.AppendInt32(user.VirtualId);
                 RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look);
                 RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                 RoomUpdate.AppendStringWithBreak(user.GetClient().GetHabbo().Motto);
                 RoomUpdate.AppendInt32(user.GetClient().GetHabbo().AchievementPoints);
                 currentRoom.SendMessage(RoomUpdate);
             }
         }
     }
 }
コード例 #7
0
ファイル: FurniInteractor.cs プロジェクト: TheNaked/Firewind
        internal override bool OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            Room Room = Session.GetHabbo().CurrentRoom;
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            MapStuffData data = (MapStuffData)Item.data;

            string figure = data.Data["FIGURE"];
            string gender = data.Data["GENDER"];

            // We gotta keep our skin and headgear!
            string filteredLook = "";
            string[] sp = Session.GetHabbo().Look.Split('.');
            foreach (string s in sp)
            {
                if ((s.StartsWith("hd") || s.StartsWith("ha") || s.StartsWith("he") || s.StartsWith("fa") || s.StartsWith("ea") || s.StartsWith("hr")))
                {
                    filteredLook += s + ".";
                }
            }
            filteredLook += figure;

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {

                dbClient.setQuery("UPDATE users SET gender = @gender, look = @look WHERE id = @id");
                dbClient.addParameter("id", Session.GetHabbo().Id);
                dbClient.addParameter("gender", gender);
                dbClient.addParameter("look", filteredLook);
                dbClient.runQuery();
            }

            Session.GetHabbo().Look = filteredLook;
            Session.GetHabbo().Gender = gender;

            Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation);
            Session.GetMessageHandler().GetResponse().AppendInt32(-1);
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Look);
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Motto);
            Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints);
            Session.GetMessageHandler().SendResponse();

            ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation);
            RoomUpdate.AppendInt32(User.VirtualId);
            RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look);
            RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
            RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto);
            RoomUpdate.AppendInt32(Session.GetHabbo().AchievementPoints);
            Room.SendMessage(RoomUpdate);

            return true;
        }
コード例 #8
0
        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("");
        }
コード例 #9
0
ファイル: RoomUserManager.cs プロジェクト: TheNaked/Firewind
        internal void UpdateUserStatus(RoomUser User, bool cyclegameitems)
        {
            try
            {
                if (User == null)
                    return;
                bool isBot = User.IsBot;
                if (isBot)
                    cyclegameitems = false;

                if (User.Statusses.ContainsKey("lay") || User.Statusses.ContainsKey("sit"))
                {
                    User.Statusses.Remove("lay");
                    User.Statusses.Remove("sit");
                    User.UpdateNeeded = true;
                }

                if (User.Statusses.ContainsKey("sign"))
                {
                    User.Statusses.Remove("sign");
                    User.UpdateNeeded = true;
                }

                //List<RoomItem> ItemsOnSquare = GetFurniObjects(User.X, User.Y);
                CoordItemSearch ItemSearch = new CoordItemSearch(room.GetGameMap().CoordinatedItems);
                List<RoomItem> ItemsOnSquare = ItemSearch.GetAllRoomItemForSquare(User.X, User.Y);
                double newZ;
                if (User.isMounted == true && User.IsPet == false)
                {
                    newZ = room.GetGameMap().SqAbsoluteHeight(User.X, User.Y, ItemsOnSquare) + 1;
                }
                else
                {
                    newZ = room.GetGameMap().SqAbsoluteHeight(User.X, User.Y, ItemsOnSquare);
                }

                if (newZ != User.Z)
                {
                    User.Z = newZ;
                    if (User.isFlying)
                        User.Z += 4 + (0.5 * Math.Sin(0.7 * User.flyk));
                    User.UpdateNeeded = true;
                }

                DynamicRoomModel Model = room.GetGameMap().Model;
                if (Model.SqState[User.X, User.Y] == SquareState.SEAT || User.sentadoBol == true || User.acostadoBol == true)
                {

                    if (User.sentadoBol == true)
                    {
                        if (!User.Statusses.ContainsKey("sit"))
                        {
                            User.Statusses.Add("sit", Convert.ToString(Model.SqFloorHeight[User.X, User.Y] + 0.55).Replace(",", "."));
                        }
                        User.Z = Model.SqFloorHeight[User.X, User.Y];
                        User.UpdateNeeded = true;
                    }
                    else if (User.acostadoBol == true)
                    {
                        if (!User.Statusses.ContainsKey("lay"))
                        {
                            User.Statusses.Add("lay", Convert.ToString(Model.SqFloorHeight[User.X, User.Y] + 0.55).Replace(",", "."));
                        }
                        User.Z = Model.SqFloorHeight[User.X, User.Y];
                        User.UpdateNeeded = true;
                    }
                    else
                    {

                        if (!User.Statusses.ContainsKey("sit"))
                        {
                            User.Statusses.Add("sit", "1.0");
                        }

                        User.Z = Model.SqFloorHeight[User.X, User.Y];
                        if (User.isFlying)
                            User.Z += 4 + (0.5 * Math.Sin(0.7 * User.flyk));
                        User.RotHead = Model.SqSeatRot[User.X, User.Y];
                        User.RotBody = Model.SqSeatRot[User.X, User.Y];

                        User.UpdateNeeded = true;
                    }
                }

                foreach (RoomItem Item in ItemsOnSquare)
                {
                    if (cyclegameitems)
                    {
                        Item.UserWalksOnFurni(User);
                    }

                    if (Item.GetBaseItem().IsSeat)
                    {
                        if (!User.Statusses.ContainsKey("sit"))
                        {
                            User.Statusses.Add("sit", TextHandling.GetString(Item.GetBaseItem().Height));
                        }

                        User.Z = Item.GetZ;
                        if (User.isFlying)
                            User.Z += 4 + (0.5 * Math.Sin(0.7 * User.flyk));
                        User.RotHead = Item.Rot;
                        User.RotBody = Item.Rot;

                        User.UpdateNeeded = true;
                    }

                    switch (Item.GetBaseItem().InteractionType)
                    {
                        case InteractionType.bed:
                            {
                                if (!User.Statusses.ContainsKey("lay"))
                                {
                                    User.Statusses.Add("lay", TextHandling.GetString(Item.GetBaseItem().Height) + " null");
                                }

                                User.Z = Item.GetZ;
                                if (User.isFlying)
                                    User.Z += 4 + (0.2 * 0.5 * Math.Sin(0.7 * User.flyk));
                                User.RotHead = Item.Rot;
                                User.RotBody = Item.Rot;

                                User.UpdateNeeded = true;
                                break;
                            }

                        case InteractionType.fbgate:
                            {
                                if (cyclegameitems)
                                {
                                    if (User.team != Item.team)
                                        User.team = Item.team;

                                    else if (User.team == Item.team)
                                        User.team = Team.none;

                                    if (!string.IsNullOrEmpty(Item.Figure))
                                    {
                                        //User = GetUserForSquare(Item.Coordinate.X, Item.Coordinate.Y);
                                        if (User != null && !User.IsBot)
                                        {
                                            if (User.Coordinate == Item.Coordinate)
                                            {
                                                if (User.GetClient().GetHabbo().Gender != Item.Gender && User.GetClient().GetHabbo().Look != Item.Figure)
                                                {

                                                    User.GetClient().GetHabbo().tempGender = User.GetClient().GetHabbo().Gender;
                                                    User.GetClient().GetHabbo().tempLook = User.GetClient().GetHabbo().Look;

                                                    User.GetClient().GetHabbo().Gender = Item.Gender;
                                                    User.GetClient().GetHabbo().Look = Item.Figure;
                                                }
                                                else
                                                {
                                                    User.GetClient().GetHabbo().Gender = User.GetClient().GetHabbo().tempGender;
                                                    User.GetClient().GetHabbo().Look = User.GetClient().GetHabbo().tempLook;
                                                }

                                                ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation);
                                                RoomUpdate.AppendInt32(User.VirtualId);
                                                RoomUpdate.AppendStringWithBreak(User.GetClient().GetHabbo().Look);
                                                RoomUpdate.AppendStringWithBreak(User.GetClient().GetHabbo().Gender.ToLower());
                                                RoomUpdate.AppendStringWithBreak(User.GetClient().GetHabbo().Motto);
                                                RoomUpdate.AppendInt32(User.GetClient().GetHabbo().AchievementPoints);
                                                room.SendMessage(RoomUpdate);
                                            }
                                        }
                                    }
                                }

                                break;
                            }

                        //33: Red
                        //34: Green
                        //35: Blue
                        //36: Yellow

                        case InteractionType.banzaigategreen:
                        case InteractionType.banzaigateblue:
                        case InteractionType.banzaigatered:
                        case InteractionType.banzaigateyellow:
                            {
                                if (cyclegameitems)
                                {
                                    int effectID = (int)Item.team + 32;
                                    TeamManager t = User.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForBanzai();
                                    AvatarEffectsInventoryComponent efectmanager = User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent();

                                    if (User.team != Item.team)
                                    {
                                        if (t.CanEnterOnTeam(Item.team))
                                        {
                                            if (User.team != Team.none)
                                                t.OnUserLeave(User);
                                            User.team = Item.team;
                                            t.AddUser(User);

                                            if (efectmanager.CurrentEffect != effectID)
                                                efectmanager.ApplyCustomEffect(effectID);
                                        }
                                    }
                                    else
                                    {
                                        //usersOnTeam--;
                                        t.OnUserLeave(User);
                                        if (efectmanager.CurrentEffect == effectID)
                                            efectmanager.ApplyCustomEffect(0);
                                        User.team = Team.none;
                                    }
                                    //((StringData)Item.data).Data = usersOnTeam.ToString();
                                    //Item.UpdateState(false, true);
                                }
                                break;
                            }

                        case InteractionType.freezeyellowgate:
                        case InteractionType.freezeredgate:
                        case InteractionType.freezegreengate:
                        case InteractionType.freezebluegate:
                            {
                                if (cyclegameitems)
                                {
                                    int effectID = (int)Item.team + 39;
                                    TeamManager t = User.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForFreeze();
                                    //int usersOnTeam = 0;
                                    //if (((StringData)Item.data).Data != "")
                                    //usersOnTeam = int.Parse(((StringData)Item.data).Data);
                                    AvatarEffectsInventoryComponent efectmanager = User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent();

                                    if (User.team != Item.team)
                                    {
                                        if (t.CanEnterOnTeam(Item.team))
                                        {
                                            if (User.team != Team.none)
                                                t.OnUserLeave(User);
                                            User.team = Item.team;
                                            t.AddUser(User);

                                            if (efectmanager.CurrentEffect != effectID)
                                                efectmanager.ApplyCustomEffect(effectID);
                                        }
                                    }
                                    else
                                    {
                                        //usersOnTeam--;
                                        t.OnUserLeave(User);
                                        if (efectmanager.CurrentEffect == effectID)
                                            efectmanager.ApplyCustomEffect(0);
                                        User.team = Team.none;
                                    }
                                    //((StringData)Item.data).Data = usersOnTeam.ToString();
                                    //Item.UpdateState(false, true);

                                    ServerMessage message = new ServerMessage(700);
                                    message.AppendBoolean((User.team != Team.none));

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

                        case InteractionType.banzaitele:
                            {
                                room.GetGameItemHandler().onTeleportRoomUserEnter(User, Item);
                                break;
                            }

                    }
                }

                if (cyclegameitems)
                {
                    if (room.GotSoccer())
                        room.GetSoccer().OnUserWalk(User);

                    if (room.GotBanzai())
                        room.GetBanzai().OnUserWalk(User);

                    //if (room.GotFreeze())
                    room.GetFreeze().OnUserWalk(User);
                }
            }
            catch (Exception e)
            {
            }
        }
コード例 #10
0
ファイル: Catalog.cs プロジェクト: TheNaked/Firewind
        internal static ServerMessage SerializePage(CatalogPage Page)
        {
            ServerMessage PageData = new ServerMessage(Outgoing.OpenShopPage);
            PageData.AppendInt32(Page.PageId);

            switch (Page.Layout)
            {
                case "frontpage":

                    PageData.AppendString("frontpage3");
                    PageData.AppendInt32(2);
                    //for (int i = 0; i < 3; i++)
                    //{
                    //    PageData.AppendString("catalog_club_headline1");
                    //}
                    //PageData.AppendInt32(7);
                    //for (int i = 0; i < 7; i++)
                    //{
                    //    PageData.AppendString("#FEFEFE");
                    //}
                    PageData.AppendString("Bundles_ts");
                    PageData.AppendString("");
                    PageData.AppendInt32(11);
                    PageData.AppendString("");
                    PageData.AppendString("");
                    PageData.AppendString("");
                    PageData.AppendString("How to get Habbo Credits");
                    PageData.AppendString("You can get Habbo Credits via Prepaid Cards, Home Phone, Credit Card, Mobile, completing offers and more! " + Convert.ToChar(13) + Convert.ToChar(10) + Convert.ToChar(13) + Convert.ToChar(10) + "To redeem your Habbo Credits, enter your voucher code below.");
                    PageData.AppendString(Page.TextDetails);
                    PageData.AppendString("");
                    PageData.AppendString("#FEFEFE");
                    PageData.AppendString("#FEFEFE");
                    PageData.AppendString(LanguageLocale.GetValue("catalog.waystogetcredits"));
                    PageData.AppendString("credits");
                    break;

                case "recycler_info":

                    PageData.AppendString(Page.Layout);
                    PageData.AppendInt32(2);
                    PageData.AppendString(Page.LayoutHeadline);
                    PageData.AppendString(Page.LayoutTeaser);
                    PageData.AppendInt32(3);
                    PageData.AppendString(Page.Text1);
                    PageData.AppendString(Page.Text2);
                    PageData.AppendString(Page.TextDetails);

                    break;

                case "recycler_prizes":

                    // Ac@aArecycler_prizesIcatalog_recycler_headline3IDe Ecotron geeft altijd een van deze beloningen:H
                    PageData.AppendString("recycler_prizes");
                    PageData.AppendInt32(1);
                    PageData.AppendString("catalog_recycler_headline3");
                    PageData.AppendInt32(1);
                    PageData.AppendString(Page.Text1);

                    break;

                case "spaces_new":

                    PageData.AppendString(Page.Layout);
                    PageData.AppendInt32(1);
                    PageData.AppendString(Page.LayoutHeadline);
                    PageData.AppendInt32(1);
                    PageData.AppendString(Page.Text1);

                    break;

                case "recycler":

                    PageData.AppendString(Page.Layout);
                    PageData.AppendInt32(2);
                    PageData.AppendString(Page.LayoutHeadline);
                    PageData.AppendString(Page.LayoutTeaser);
                    PageData.AppendInt32(1);
                    PageData.AppendStringWithBreak(Page.Text1, 10);
                    PageData.AppendString(Page.Text2);
                    PageData.AppendString(Page.TextDetails);

                    break;

                case "trophies":

                    PageData.AppendString("trophies");
                    PageData.AppendInt32(1);
                    PageData.AppendString(Page.LayoutHeadline);
                    PageData.AppendInt32(2);
                    PageData.AppendString(Page.Text1);
                    PageData.AppendString(Page.TextDetails);

                    break;

                case "pets":

                    PageData.AppendString("pets");
                    PageData.AppendInt32(2);
                    PageData.AppendString(Page.LayoutHeadline);
                    PageData.AppendString(Page.LayoutTeaser);
                    PageData.AppendInt32(4);
                    PageData.AppendString(Page.Text1);
                    PageData.AppendString(LanguageLocale.GetValue("catalog.pickname"));
                    PageData.AppendString(LanguageLocale.GetValue("catalog.pickcolor"));
                    PageData.AppendString(LanguageLocale.GetValue("catalog.pickrace"));

                    break;

                case "soundmachine":

                    PageData.AppendString(Page.Layout);
                    PageData.AppendInt32(2);
                    PageData.AppendString(Page.LayoutHeadline);
                    PageData.AppendString(Page.LayoutTeaser);
                    PageData.AppendInt32(2);
                    PageData.AppendString(Page.Text1);
                    PageData.AppendString(Page.TextDetails);
                    break;

                case "club_buy":

                    PageData.AppendString("vip_buy"); // layout
                    PageData.AppendInt32(2);
                    PageData.AppendString("ctlg_buy_vip_header");
                    PageData.AppendString("ctlg_gift_vip_teaser");
                    PageData.AppendInt32(0);
                    break;

                case "guild_frontpage":
                    PageData.AppendString(Page.Layout);
                    PageData.AppendInt32(2);
                    PageData.AppendString("catalog_groups_en");
                    PageData.AppendString("");
                    PageData.AppendInt32(3);
                    PageData.AppendString(Page.LayoutTeaser);
                    PageData.AppendString(Page.LayoutSpecial);
                    PageData.AppendString(Page.Text1);
                    break;

                default:

                    PageData.AppendString(Page.Layout);
                    PageData.AppendInt32(3);
                    PageData.AppendString(Page.LayoutHeadline);
                    PageData.AppendString(Page.LayoutTeaser);
                    PageData.AppendString(Page.LayoutSpecial);
                    PageData.AppendInt32(3);
                    PageData.AppendString(Page.Text1);
                    PageData.AppendString(Page.TextDetails);
                    PageData.AppendString(Page.TextTeaser);

                    break;
            }

            if (!Page.Layout.Equals("frontpage") && !Page.Layout.Equals("club_buy"))
            {
                PageData.AppendInt32(Page.Items.Count);

                //if (Page.Layout == "trophies") // We have to order descending here!
                foreach (CatalogItem Item in Page.Items.Values)
                {
                    Item.Serialize(PageData);
                }
            }
            else
                PageData.AppendInt32(0);
            PageData.AppendInt32(-1);
            PageData.AppendBoolean(false);

            return PageData;
        }
コード例 #11
0
ファイル: RoomUserManager.cs プロジェクト: TheNaked/Firewind
        internal void RemoveUserFromRoom(GameClient Session, Boolean NotifyClient, Boolean NotifyKick)
        {
            try
            {
                if (Session == null)
                    return;

                if (Session.GetHabbo() == null)
                    return;

                Session.GetHabbo().GetAvatarEffectsInventoryComponent().OnRoomExit();

                if (NotifyClient)
                {
                    if (NotifyKick)
                    {
                        Session.GetMessageHandler().GetResponse().Init(Outgoing.GenericError);
                        Session.GetMessageHandler().GetResponse().AppendInt32(4008);
                        Session.GetMessageHandler().SendResponse();
                    }

                    Session.GetMessageHandler().GetResponse().Init(Outgoing.OutOfRoom);
                    Session.GetMessageHandler().SendResponse();
                }

                RoomUser User = GetRoomUserByHabbo(Session.GetHabbo().Id);

                if (User != null)
                {
                    if (User.team != Team.none)
                    {
                        room.GetTeamManagerForBanzai().OnUserLeave(User);
                        room.GetTeamManagerForFreeze().OnUserLeave(User);
                    }
                    if (User.isMounted == true)
                    {
                        User.isMounted = false;
                        RoomUser usuarioVinculado = GetRoomUserByVirtualId((int)User.mountID);
                        if (usuarioVinculado != null)
                        {
                            usuarioVinculado.isMounted = false;
                            usuarioVinculado.mountID = 0;

                        }
                    }

                    if (User.sentadoBol == true || User.acostadoBol == true)
                    {
                        User.sentadoBol = false;
                        User.acostadoBol = false;
                    }

                    RemoveRoomUser(User);

                    if (Session.GetHabbo() != null)
                    {
                        if (!User.IsSpectator)
                        {
                            if (User.CurrentItemEffect != ItemEffectType.None)
                            {
                                User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect = -1;
                            }
                            //UserMatrix[User.X, User.Y] = false;

                            if (Session.GetHabbo() != null)
                            {
                                if (room.HasActiveTrade(Session.GetHabbo().Id))
                                    room.TryStopTrade(Session.GetHabbo().Id);

                                if (Session.GetHabbo().Username == room.Owner)
                                {
                                    if (room.HasOngoingEvent)
                                    {
                                        ServerMessage Message = new ServerMessage(Outgoing.RoomEvent);
                                        Message.AppendStringWithBreak("-1");
                                        room.SendMessage(Message);

                                        FirewindEnvironment.GetGame().GetRoomManager().GetEventManager().QueueRemoveEvent(room.RoomData, room.Event.Category);
                                        room.Event = null;
                                    }
                                }
                                Session.GetHabbo().CurrentRoomId = 0;

                                try
                                {
                                    if (Session.GetHabbo().GetMessenger() != null)
                                        Session.GetHabbo().GetMessenger().OnStatusChanged(true);
                                }
                                catch { }
                            }

                            //DateTime Start = DateTime.Now;
                            //using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                            //{
                            //    //TimeSpan TimeUsed1 = DateTime.Now - Start;
                            //    //Logging.LogThreadException("Time used on sys part 2: " + TimeUsed1.Seconds + "s, " + TimeUsed1.Milliseconds + "ms", "");

                            //    //if (Session.GetHabbo() != null)
                            //    //    dbClient.runFastQuery("UPDATE user_roomvisits SET exit_timestamp = '" + FirewindEnvironment.GetUnixTimestamp() + "' WHERE room_id = '" + this.Id + "' AND user_id = '" + Id + "' ORDER BY exit_timestamp DESC LIMIT 1");
                            //    //dbClient.runFastQuery("UPDATE rooms SET users_now = " + UsersNow + " WHERE id = " + Id);
                            //    //dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + RoomId + ", " + UsersNow + ")");
                            //    dbClient.runFastQuery("UPDATE room_active SET active_users = " + UsersNow);
                            //}
                        }
                    }

                    usersByUserID.Remove(User.userID);
                    if (Session.GetHabbo() != null)
                        usersByUsername.Remove(Session.GetHabbo().Username.ToLower());

                    User.Dispose();
                }

            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Error during removing user from room:" + e.ToString());
            }
        }
コード例 #12
0
ファイル: Rooms.cs プロジェクト: TheNaked/Firewind
        internal void ForwardToRoom(int flatID)
        {
            if (FirewindEnvironment.ShutdownStarted)
            {
                Session.SendNotif(LanguageLocale.GetValue("shutdown.alert"));
                return;
            }

            if (Session.GetHabbo().IsTeleporting && Session.GetHabbo().TeleportingRoomID != flatID)
                return;

            Room room = FirewindEnvironment.GetGame().GetRoomManager().LoadRoom((uint)flatID);
            if (room == null)
            {
                // Don't actually think this message is used anymore
                Response.Init(Outgoing.NoSuchFlat);
                Response.AppendInt32(flatID); // flatId
                SendResponse();
                return;
            }

            ClearRoomLoading();
            if (Session.GetHabbo().InRoom)
            {
                Room oldRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                if (oldRoom != null)
                {
                    oldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false);
                    Session.CurrentRoomUserID = -1;
                }
            }
            //QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection());

            if (room.UsersNow >= room.UsersMax && !Session.GetHabbo().HasFuse("fuse_enter_full_rooms"))
            {
                if (!FirewindEnvironment.GetGame().GetRoleManager().RankHasRight(Session.GetHabbo().Rank, "fuse_enter_full_rooms"))
                {
                    // This room is full!!!!
                    Response.Init(Outgoing.RoomErrorToEnter);
                    Response.AppendInt32(1);
                    SendResponse();
                    //response.appendResponse(GetResponse());

                    Response.Init(Outgoing.OutOfRoom);
                    SendResponse();
                    //response.appendResponse(GetResponse());

                    //response.sendResponse();
                    return;
                }
            }

            if (!Session.GetHabbo().HasFuse("fuse_enter_any_room") && room.UserIsBanned(Session.GetHabbo().Id))
            {
                if (room.HasBanExpired(Session.GetHabbo().Id))
                {
                    room.RemoveBan(Session.GetHabbo().Id);
                }
                else
                {
                    // You are banned of this room!
                    Response.Init(Outgoing.RoomErrorToEnter);
                    Response.AppendInt32(4);
                    SendResponse();
                    //response.appendResponse(GetResponse());

                    Response.Init(Outgoing.OutOfRoom);
                    SendResponse();
                    //response.appendResponse(GetResponse());

                    //response.sendResponse();
                    return;
                }
            }

            Session.GetHabbo().LoadingRoom = (uint)flatID;
            CurrentLoadingRoom = room;

            Response.Init(Outgoing.PrepareRoomForUsers);
            SendResponse();
            //response.appendResponse(GetResponse());

            if (!Session.GetHabbo().HasFuse("fuse_enter_any_room") && !room.CheckRights(Session, true) && !Session.GetHabbo().IsTeleporting)
            {
                switch (room.State)
                {
                    case 1:
                        if (room.UserCount == 0)
                        {
                            // Aww nobody in da room!
                            Response.Init(Outgoing.DoorBellNoPerson);
                            SendResponse();
                            //response.appendResponse(GetResponse());
                        }
                        else
                        {
                            // Waiting for answer!
                            Response.Init(Outgoing.Doorbell);
                            Response.AppendStringWithBreak("");
                            SendResponse();
                            //response.appendResponse(GetResponse());

                            ServerMessage RingMessage = new ServerMessage(Outgoing.Doorbell);
                            RingMessage.AppendStringWithBreak(Session.GetHabbo().Username);
                            room.SendMessageToUsersWithRights(RingMessage);
                        }
                        //response.sendResponse();
                        return;

                    case 2:
                        //if (password.ToLower() != room.Password.ToLower())
                        {
                            // your password fail :( !

                            Response.Init(Outgoing.GenericError);
                            Response.AppendInt32(-100002); // can be 4009 if you want something like 'need.to.be.vip'
                            SendResponse();
                            //response.appendResponse(GetResponse());

                            Response.Init(Outgoing.OutOfRoom);
                            SendResponse();
                            //response.appendResponse(GetResponse());

                            //response.sendResponse();
                            return;
                        }
                        //break;
                }
            }
            Session.GetHabbo().LoadingChecksPassed = true;

            if (room.RoomData.Badge != null && room.RoomData.Badge != "")
            {
                Session.GetHabbo().GetBadgeComponent().GiveBadge(room.RoomData.Badge, true);
                Session.SendNotif(LanguageLocale.GetValue("user.badgereceived"));
            }

            //response.sendResponse();

            // Every check done, tell client to procceed
            Response.Init(Outgoing.RoomReady);
            Response.AppendStringWithBreak(room.ModelName); // if starts with "model_", roomCategory = 1
            Response.AppendUInt(room.RoomId); // flatId
            SendResponse();
        }
コード例 #13
0
ファイル: Rooms.cs プロジェクト: TheNaked/Firewind
        internal void Whisper()
        {
            if (FirewindEnvironment.SystemMute)
                return;

            if (Session == null || Session.GetHabbo() == null)
                return;

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (Session.GetHabbo().Muted)
            {
                Session.SendNotif(LanguageLocale.GetValue("user.ismuted"));
                return;
            }

            if (Room.RoomMuted)
                return;

            TimeSpan SinceLastMessage = DateTime.Now - FloodTime;
            if (SinceLastMessage.Seconds > 4)
                FloodCount = 0;

            if (SinceLastMessage.Seconds < 4 && FloodCount > 5 && Session.GetHabbo().Rank < 5)
            {
                ServerMessage Packet = new ServerMessage(Outgoing.FloodFilter);
                Packet.AppendInt32(30); //Blocked for 30sec
                Session.SendMessage(Packet);
                return;
            }
            FloodTime = DateTime.Now;
            FloodCount++;

            string Params = Request.ReadString();
            string ToUser = Params.Split(' ')[0];
            string Message = Params.Substring(ToUser.Length + 1);

            Message = LanguageLocale.FilterSwearwords(Message);
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            ServerMessage TellMsg = new ServerMessage();
            TellMsg.Init(Outgoing.Whisp);
            TellMsg.AppendInt32(User.VirtualId);
            TellMsg.AppendStringWithBreak(Message);
            TellMsg.AppendInt32(0);
            TellMsg.AppendInt32(0);
            TellMsg.AppendInt32(-1);

            Session.SendMessage(TellMsg);
            User.Unidle();

            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);
            if (ToUser == User.GetUsername() || User2 == null)
                return;

            if (!User2.IsBot)
            {
                if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
                    User2.GetClient().SendMessage(TellMsg);
            }

            List<RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(6);
            if (ToNotify.Count > 0)
            {
                TellMsg = new ServerMessage();
                TellMsg.Init(Outgoing.Whisp);
                TellMsg.AppendInt32(User.VirtualId);
                TellMsg.AppendStringWithBreak(LanguageLocale.GetValue("moderation.whisper") + ToUser + ": " + Message);
                TellMsg.AppendInt32(0);
                TellMsg.AppendInt32(0);
                TellMsg.AppendInt32(-1);

                foreach (RoomUser user in ToNotify)
                    if (user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
                        user.GetClient().SendMessage(TellMsg);

            }
        }
コード例 #14
0
ファイル: Rooms.cs プロジェクト: TheNaked/Firewind
        internal void StopEvent()
        {
            Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || !Room.CheckRights(Session, true) || Room.Event == null)
            {
                return;
            }

            //Room.Event = null;

            ServerMessage Message = new ServerMessage(Outgoing.RoomEvent);
            Message.AppendStringWithBreak("-1");
            Room.SendMessage(Message);

            FirewindEnvironment.GetGame().GetRoomManager().GetEventManager().QueueRemoveEvent(Room.RoomData, Room.Event.Category);
        }
コード例 #15
0
ファイル: Rooms.cs プロジェクト: TheNaked/Firewind
        internal void ApplyRoomEffect()
        {
            Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            UserItem Item = Session.GetHabbo().GetInventoryComponent().GetItem(Request.ReadUInt32());

            if (Item == null)
            {
                return;
            }

            string type = "floor";

            if (Item.GetBaseItem().Name.ToLower().Contains("wallpaper"))
            {
                type = "wallpaper";
            }
            else if (Item.GetBaseItem().Name.ToLower().Contains("landscape"))
            {
                type = "landscape";
            }

            switch (type)
            {
                case "floor":

                    Room.Floor = Item.Data.ToString();
                    Room.RoomData.Floor = Item.Data.ToString();

                    FirewindEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.FURNI_DECORATION_FLOOR);
                    break;

                case "wallpaper":

                    Room.Wallpaper = Item.Data.ToString();
                    Room.RoomData.Wallpaper = Item.Data.ToString();

                    FirewindEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.FURNI_DECORATION_WALL);
                    break;

                case "landscape":

                    Room.Landscape = Item.Data.ToString();
                    Room.RoomData.Landscape = Item.Data.ToString();
                    break;
            }

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("UPDATE rooms SET " + type + " = @extradata WHERE id = " + Room.RoomId);
                dbClient.addParameter("extradata", Item.Data);
                dbClient.runQuery();
            }

            Session.GetHabbo().GetInventoryComponent().RemoveItem(Item.Id, false);

            ServerMessage Message = new ServerMessage(Outgoing.RoomDecoration);
            Message.AppendStringWithBreak(type);
            Message.AppendStringWithBreak(Item.Data.ToString());
            Room.SendMessage(Message);
        }