private void method_9(bool bool_1) { if (!this.bool_0 && bool_1) { this.bool_0 = true; try { base.Shutdown(SocketShutdown.Both); base.Close(); base.Dispose(); } catch { } Array.Clear(this.mDataBuffer, 0, this.mDataBuffer.Length); this.mDataBuffer = null; this.mDataReceivedCallback = null; this.mRouteReceivedDataCallback = null; HabboIM.GetSocketsManager().method_6(this.uint_0); AntiDDosSystem.FreeConnection(this.string_0); if (HabboIM.GetConfig().data["emu.messages.connections"] == "1") { Console.WriteLine(string.Concat(new object[] { ">> Connection Dropped [", this.uint_0, "] from [", this.String_0, "]" })); } } }
public void RestoreStatistics(DatabaseClient dbClient, int status) { Console.BackgroundColor = ConsoleColor.Black; Logging.Write(HabboIMEnvironment.GetExternalText("emu_cleandb")); bool flag = true; try { if (int.Parse(HabboIM.GetConfig().data["debug"]) == 1) { flag = false; } } catch { } if (flag) { Console.BackgroundColor = ConsoleColor.Black; dbClient.ExecuteQuery("UPDATE users SET online = '0' WHERE online != '0'", 30); dbClient.ExecuteQuery("UPDATE rooms SET users_now = '0' WHERE users_now != '0'", 30); dbClient.ExecuteQuery("UPDATE user_roomvisits SET exit_timestamp = UNIX_TIMESTAMP() WHERE exit_timestamp <= 0", 30); dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE server_status SET status = '", status, "', users_online = '0', rooms_loaded = '0', server_ver = '", HabboIM.Version, "', stamp = UNIX_TIMESTAMP() LIMIT 1;" }), 30); } Logging.WriteLine("Fertig!", ConsoleColor.Green); }
internal void method_4() { using (Class26 class26_ = this.class25_0.Class26_0) { IEnumerator enumerator; using (DatabaseClient @class = HabboIM.GetDatabase().GetClient()) { enumerator = class26_.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { Room class2 = (Room)enumerator.Current; class2.method_65(@class); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } if (HabboIM.GetConfig().data["emu.messages.roommgr"] == "1") { Console.WriteLine("[RoomMgr] Done with furniture saving, disposing rooms"); } enumerator = class26_.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { Room class2 = (Room)enumerator.Current; try { class2.method_62(); } catch { } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (HabboIM.GetConfig().data["emu.messages.roommgr"] == "1") { Console.WriteLine("[RoomMgr] Done disposing rooms!"); } } }
public void Handle(GameClient Session, ClientMessage Event) { uint num = Event.PopWiredUInt(); string string_ = Event.PopFixedString(); Event.PopWiredInt32(); if (HabboIM.GetConfig().data["emu.messages.roommgr"] == "1") { Logging.WriteLine("[RoomMgr] Requesting Private Room [ID: " + num + "]"); } Session.GetClientMessageHandler().method_5(num, string_); }
internal void method_16(Room class14_0) { if (class14_0 != null) { this.class25_0.Remove(class14_0.Id); this.method_18(class14_0.Id); class14_0.method_62(); if (HabboIM.GetConfig().data["emu.messages.roommgr"] == "1") { Logging.WriteLine("[RoomMgr] Unloaded room [ID: " + class14_0.Id + "]"); } } }
public Class114(string string_0, int int_2, int maxConnections, SocketsManager class113_1) { this.int_1 = Process.GetCurrentProcess().Id; this.socket_0 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint localEP = new IPEndPoint(IPAddress.Parse(HabboIM.GetConfig().data["game.tcp.bindip"]), int_2); this.socket_0.Bind(localEP); this.socket_0.Listen(maxConnections + (maxConnections / 2)); this.asyncCallback_0 = new AsyncCallback(this.method_4); this.class113_0 = class113_1; AntiDDosSystem.SetupTcpAuthorization(20000); Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Emulator wurde gestartet! Port: " + int_2 + " | Maximal erlaubte Habbos: " + maxConnections); }
public void Handle(GameClient Session, ClientMessage Event) { Event.PopWiredInt32(); uint num = Event.PopWiredUInt(); Event.PopWiredInt32(); if (HabboIM.GetConfig().data["emu.messages.roommgr"] == "1") { Logging.WriteLine("[RoomMgr] Requesting Public Room [ID: " + num + "]"); } RoomData @class = HabboIM.GetGame().GetRoomManager().method_12(num); if (@class != null && !(@class.Type != "public")) { Session.GetClientMessageHandler().method_5(num, ""); } }
internal void method_5(SocketInformation socketInformation_0, int int_0) { SocketConnection Message = new SocketConnection(Convert.ToUInt32(int_0), socketInformation_0); this.Message1_0[int_0] = Message; HabboIM.GetGame().GetClientManager().method_8((uint)int_0, ref Message); if (HabboIM.GetConfig().data["emu.messages.connections"] == "1") { Logging.WriteLine(string.Concat(new object[] { ">> Connection [", int_0, "] from [", Message.String_0, "]" })); } }
public void HandleRequest(string Request, SocketConnection socket) { //Yes, i know, that's shitty coded, but it works. At least for me.. Do it better & don't hate me :) bool f = false; if (Request.StartsWith("GET")) { string[] Splits = Request.Split(' '); if (Request.Split(' ')[1].Equals("/")) { socket.SendFile("web/index.html"); } else if (Request.Split(' ')[1].StartsWith("/emu/console")) { List <string> alreadySent = new List <string>(); if (Splits[1].Split('?')[1].StartsWith("key") && Splits[1].Split('?')[1].Split('=')[1] == HabboIM.GetConfig().data["web.key"]) { try { /*string[] asdf = "asdf"; * foreach (string line in asdf.ToList<string>()) * { * socket.SendMessage(line + "\n"); * }*/ } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } else { this.Close(socket); } } else if (Request.Split(' ')[1].StartsWith("/emu/exceptions")) { if (Splits[1].Split('?')[1].StartsWith("key") && Splits[1].Split('?')[1].Split('=')[1] == HabboIM.GetConfig().data["web.key"]) { socket.SendFile("exceptions.err"); } else { this.Close(socket); } } else if (Request.Split(' ')[1].StartsWith("/emu/restart")) { if (Splits[1].Split('?')[1].StartsWith("key") && Splits[1].Split('?')[1].Split('=')[1] == HabboIM.GetConfig().data["web.key"]) { socket.SendMessage("Bye!"); this.Close(socket); Console.Clear(); Core.Logging.Disable(); HabboIM.Destroy("Disposing.......", false); Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); Environment.Exit(0); } else { this.Close(socket); } } else if (Request.Split(' ')[1].StartsWith("/emu/console/clear")) { if (Splits[1].Split('?')[1].StartsWith("key") && Splits[1].Split('?')[1].Split('=')[1] == HabboIM.GetConfig().data["web.key"]) { Console.Clear(); } else { this.Close(socket); } } { socket.SendFile("web" + Request.Split(' ')[1]); } } else if (Request.StartsWith("POST")) { if (Request.Split(' ')[1].Equals("/")) { socket.SendFile("web/index.html"); } else { socket.SendFile("web" + Request.Split(' ')[1]); } } if (!f) { this.Close(socket); } }
private void method_12() { int num = int.Parse(HabboIM.GetConfig().data["client.ping.interval"]); if (num <= 100) { throw new ArgumentException("Invalid configuration value for ping interval! Must be above 100 miliseconds."); } while (true) { try { ServerMessage Message = new ServerMessage(50u); List <GameClient> list = new List <GameClient>(); List <GameClient> list2 = new List <GameClient>(); for (int i = 0; i < this.Clients.Length; i++) { GameClient @class = this.Clients[i]; if (@class != null) { if (@class.bool_0) { @class.bool_0 = false; list2.Add(@class); } else { list.Add(@class); } } } foreach (GameClient @class in list) { try { @class.method_12(); } catch { } } byte[] byte_ = Message.GetBytes(); foreach (GameClient @class in list2) { try { @class.GetConnection().SendData(byte_); } catch { @class.method_12(); } } } catch (Exception ex) { Logging.LogThreadException(ex.ToString(), "Connection checker task"); } Thread.Sleep(num); } }
public WebSocketServerManager(string SocketURL) { FleckLog.Level = LogLevel.Error; allSockets = new List <IWebSocketConnection>(); socketbyName = new Dictionary <string, IWebSocketConnection>(); namebySocket = new Dictionary <IWebSocketConnection, string>(); server = new WebSocketServer(SocketURL); server.Start(socket => { socket.OnOpen = () => { if (allSockets.Contains(socket)) { allSockets.Remove(socket); } allSockets.Add(socket); }; socket.OnClose = () => { string name = ""; if (namebySocket.ContainsKey(socket)) { name = namebySocket[socket].ToString(); namebySocket.Remove(socket); } if (socketbyName.ContainsKey(name) && name != "") { socketbyName.Remove(name); } if (allSockets.Contains(socket)) { allSockets.Remove(socket); } if (name != "") { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.AddParamWithValue("name", name); dbClient.ExecuteQuery("UPDATE users SET websocket='0' WHERE username=@name"); } } }; socket.OnMessage = message => { var msg = message; int pId = 0; if (!int.TryParse(msg.Split('|')[0], out pId)) { return; } if (msg.Length > 1024) { return; } if (msg.StartsWith("1|")) { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.AddParamWithValue("auth", msg.Substring(2)); DataRow drow = null; drow = dbClient.ReadDataRow("SELECT username FROM users WHERE auth_ticket= @auth LIMIT 1"); if (drow == null) { socket.Close(); } else { if (socketbyName.ContainsKey((string)drow["username"])) {/* socketbyName[(string)drow["username"]].Close();*/ socketbyName.Remove((string)drow["username"]); } socketbyName.Add(drow["username"].ToString(), socket); if (namebySocket.ContainsKey(socket)) { namebySocket.Remove(socket); } namebySocket.Add(socket, drow["username"].ToString()); dbClient.AddParamWithValue("name", drow["username"].ToString()); } } } else { GameClient Session = HabboIM.GetGame().GetClientManager().GetClientByHabbo(GetNameByWebSocket(socket)); Room room = Session.GetHabbo().CurrentRoom; string[] args = msg.Split('|'); switch (int.Parse(args[0])) { case 88: { GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(args[1])); if (class4 == null) { Session.GetHabbo().Whisper("Diese Person ist bereits offline. Du kannst die Anfrage deshalb nicht mehr annehmen."); break; } if (class4.GetHabbo().sexanfrage != Session.GetHabbo().Id) { Session.GetHabbo().Whisper("Ooops, da lief wohl etwas schief."); break; } if (class4.GetHabbo().boyfriend != 0 || Session.GetHabbo().boyfriend != 0) { Session.GetHabbo().Whisper("Du bist noch mit wem zusammen."); break; } if (args[2] == "1") { class4.GetHabbo().lovepoints = 0; class4.GetHabbo().kissed = 0; class4.GetHabbo().lovedate = 0; class4.GetHabbo().hugged = 0; class4.GetHabbo().hugtime = 0; class4.GetHabbo().kisstime = 0; class4.GetHabbo().boyfriend = 0; Session.GetHabbo().lovepoints = 0; Session.GetHabbo().kissed = 0; Session.GetHabbo().lovedate = 0; Session.GetHabbo().hugged = 0; Session.GetHabbo().hugtime = 0; Session.GetHabbo().kisstime = 0; Session.GetHabbo().lovedate = HabboIM.GetUnixTimestamp(); class4.GetHabbo().lovedate = HabboIM.GetUnixTimestamp(); class4.GetHabbo().boyfriend = Convert.ToInt32(Session.GetHabbo().Id); Session.GetHabbo().boyfriend = Convert.ToInt32(class4.GetHabbo().Id); try { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET boyfriend = '", Session.GetHabbo().Id, "', love_date = '", class4.GetHabbo().lovedate, "' WHERE Id = '", class4.GetHabbo().Id, "' LIMIT 1;" })); dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET boyfriend = '", class4.GetHabbo().Id, "', love_date = '", Session.GetHabbo().lovedate, "' WHERE Id = '", Session.GetHabbo().Id, "' LIMIT 1;" })); } HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Beziehung|Du bist jetzt in einer Beziehung mit " + class4.GetHabbo().Username + "."); HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Beziehung|Du bist jetzt in einer Beziehung mit " + Session.GetHabbo().Username + "."); } catch { } } if (args[2] == "2") { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Beziehungsanfrage|Die Beziehungsanfrage wurde abgelehnt."); HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Beziehungsanfrage|Die Beziehungsanfrage wurde abgelehnt."); } class4.GetHabbo().sexanfrage = 0; Session.GetHabbo().sexanfrage = 0; break; } case 74: { try { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET lastkiss_time = '0', lasthug_time = '0', lovepoints = '0', kisses_bf = '0', hugs_bf = '0', boyfriend = '0' WHERE Id = '", Session.GetHabbo().Id, "' OR Id = '", Session.GetHabbo().boyfriend, "' LIMIT 2;" })); } Session.GetHabbo().lovepoints = 0; Session.GetHabbo().kissed = 0; Session.GetHabbo().lovedate = 0; Session.GetHabbo().hugged = 0; Session.GetHabbo().hugtime = 0; Session.GetHabbo().kisstime = 0; GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(Session.GetHabbo().boyfriend)); if (class4 != null) { class4.GetHabbo().lovepoints = 0; class4.GetHabbo().kissed = 0; class4.GetHabbo().lovedate = 0; class4.GetHabbo().hugged = 0; class4.GetHabbo().hugtime = 0; class4.GetHabbo().kisstime = 0; class4.GetHabbo().boyfriend = 0; HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Trennung|Du hast mit " + class4.GetHabbo().Username + " Schluss gemacht."); HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Trennung|" + Session.GetHabbo().Username + " hat mit dir Schluss gemacht."); } Session.GetHabbo().boyfriend = 0; if (class4 == null) { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Trennung|Du hast Schluss gemacht."); } } catch (Exception x) { } break; } case 6: { try { room = HabboIM.GetGame().GetRoomManager().GetRoom(uint.Parse(args[1])); if (Session != null && room != null) { ServerMessage Message = new ServerMessage(286u); Message.AppendBoolean(room.IsPublic); Message.AppendUInt(room.Id); Session.SendMessage(Message); } } catch { } break; } case 9: { try { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false)) { int ItemId = int.Parse(args[1]); double newZ = double.Parse(args[2]); RoomItem ri = Session.GetHabbo().CurrentRoom.method_28((uint)ItemId); if (ri != null && ri.GetBaseItem().InteractionType == "stackfield") { ri.setHeight(newZ); ri.method_8().method_80(ri); ServerMessage Message = new ServerMessage(94u); Message.AppendRawUInt(ri.uint_0); Message.AppendStringWithBreak(""); Message.AppendBoolean(false); Session.GetHabbo().CurrentRoom.SendMessage(Message, null); ServerMessage Message5_ = new ServerMessage(95u); ri.SerializeStackField(Message5_); Session.GetHabbo().CurrentRoom.SendMessage(Message5_, null); ServerMessage Message1_ = new ServerMessage(93u); ri.SerializeStackField(Message1_); Session.GetHabbo().CurrentRoom.SendMessage(Message1_, null); } } } catch { } break; } case 10: { try { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false)) { uint itemid = uint.Parse(args[1]); int handitemId = int.Parse(args[2]); RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(itemid); if (ri != null && ri.GetBaseItem().InteractionType == "wf_cnd_has_handitem") { ri.string_2 = handitemId.ToString(); ri.UpdateState(true, false); } } } catch { } break; } case 12: { try { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false)) { uint itemid = uint.Parse(args[1]); string team = args[2]; RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(itemid); if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_actor_in_team" || ri.GetBaseItem().InteractionType == "wf_cnd_not_in_team") && Session.GetHabbo().CurrentRoom.IsValidTeam(team)) { ri.string_2 = team; ri.UpdateState(true, false); } } } catch { } break; } case 14: { try { Session.GetHabbo().CurrentRoom.method_56(Session.GetHabbo().Username).CarryItem(int.Parse(args[1])); } catch { } break; } case 32: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && ri.GetBaseItem().InteractionType == "wf_act_yt") { string ytlink = args[2].Split('=')[1]; ri.string_2 = ytlink; ri.UpdateState(true, false); } } catch { } } break; } case 35: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_has_purse" || ri.GetBaseItem().InteractionType == "wf_cnd_hasnot_purse")) { string currency = Session.GetHabbo().CurrentRoom.IsValidCurrency(args[2]) ? args[2] : "credits"; int number = 1337; int.TryParse(args[3], out number); ri.string_2 = currency + ";" + number; ri.UpdateState(true, false); } } catch { } } break; } case 36: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && ri.GetBaseItem().InteractionType == "wf_act_img" && IsValidFile(args[2])) { ri.string_2 = args[2]; ri.UpdateState(true, false); } } catch { } } break; } case 93076201: { if (HabboIM.zufallsrare == false) { HabboIM.zufallsrare = true; uint item = uint.Parse(args[1]); uint user = uint.Parse(args[2]); uint id = uint.Parse(args[3]); uint geschenk = 169; var geschenkmsg = "!HabboIM Zufallsrare - Was hier wohl drin sein mag?"; uint amount = 1; using (DatabaseClient dbclient = HabboIM.GetDatabase().GetClient()) { dbclient.AddParamWithValue("spieler", uint.Parse(args[2])); dbclient.AddParamWithValue("raum", '0'); dbclient.AddParamWithValue("moebel", uint.Parse(args[1])); dbclient.AddParamWithValue("geschenk", geschenk); dbclient.AddParamWithValue("geschenkmsg", geschenkmsg); dbclient.AddParamWithValue("amount", amount); StringBuilder StringGetiditem = new StringBuilder(); DataTable Getiditem = dbclient.ReadDataTable("SELECT * FROM items ORDER BY RAND() LIMIT 1"); foreach (DataRow StaffRow in Getiditem.Rows) { uint num5 = HabboIM.GetGame().GetCatalog().method_14(); dbclient.AddParamWithValue("id", num5); Console.WriteLine(StaffRow["id"]); dbclient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO items (Id,user_id,base_item,wall_pos) VALUES ('", (object)num5, "','", uint.Parse(args[2]), "','169','')" })); dbclient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO items_extra_data (item_id,extra_data) VALUES ('", (object)num5, "','", "!HabboIM Zufallsrare - Was hier wohl drin sein mag?", "')" })); dbclient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('", (object)num5, "','", uint.Parse(args[1]), "','1','')" })); /* * dbclient.ExecuteQuery("INSERT INTO items (id, user_id, room_id, base_item) VALUES ('" + (object)num5 + "', @spieler, @raum, @geschenk)"); * dbclient.ExecuteQuery("INSERT INTO items_extra_data (item_id, extra_data) VALUES ('" + (object)num5 + "', @geschenkmsg)"); * dbclient.ExecuteQuery("INSERT INTO user_presents (item_id, base_id, amount) VALUES ('" + (object)num5 + "', @moebel, @amount)");*/ } } //Staffchat Ausgabe ServerMessage Logging = new ServerMessage(134u); Logging.AppendUInt(0u); Logging.AppendString("INFO: Der Spieler " + args[4] + " hat eine Zufallsrarität erhalten!"); HabboIM.GetGame().GetClientManager().method_16(Logging, Logging); if (int.Parse(HabboIM.GetConfig().data["habboim.customdesign"]) == 1) { string rmessage = "rndrmsg"; HabboIM.GetWebSocketManager().SendMessageToEveryConnection(rmessage); HabboIM.GetGame().GetClientManager().method_WHISPER("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!"); } else { HabboIM.GetGame().GetClientManager().method_WHISPER("Die Zufallsrare wurde soeben verteilt!"); HabboIM.GetGame().GetClientManager().method_WHISPER("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!"); } GameClient gameClient = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(args[2])); if (gameClient != null) { gameClient.SendNotification("Überprüfe dein Inventar, denn du hast eine Zufallsrarität erhalten!"); gameClient.GetHabbo().GetInventoryComponent().method_9(true); ++gameClient.GetHabbo().RandomRares; gameClient.GetHabbo().CheckRandomRares(); } return; } break; } case 51: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_user_count_in" || ri.GetBaseItem().InteractionType == "wfc_cnd_not_user_count") && IsValidFile(args[2])) { int min = 1; int max = 50; int.TryParse(args[2], out min); int.TryParse(args[3], out max); ri.string_3 = min + ";" + max; ri.UpdateState(true, false); } } catch { } } break; } default: break; } } }; }); }
public UserDataFactory(string ssoTicket, string ipAddress, bool getAllData) { if (string.IsNullOrEmpty(ssoTicket)) { this.Validated = false; } else { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.AddParamWithValue("auth_ticket", ssoTicket); string str = ""; if (ServerConfiguration.EnableSSO) { str = "AND ip_last = '" + ipAddress + "' "; } try { if (int.Parse(HabboIM.GetConfig().data["debug"]) == 1) { str = ""; } } catch { } this.UserData = dbClient.ReadDataRow("SELECT * FROM users WHERE auth_ticket = @auth_ticket " + str + " LIMIT 1;"); if (this.UserData != null) { this.Validated = true; uint id = (uint)this.UserData["Id"]; if (getAllData) { this.Achievements = dbClient.ReadDataTable("SELECT achievement_id,achievement_level FROM user_achievements WHERE user_id = '" + id + "'"); this.Favorites = dbClient.ReadDataTable("SELECT room_id FROM user_favorites WHERE user_id = '" + id + "'"); this.Ignores = dbClient.ReadDataTable("SELECT ignore_id FROM user_ignores WHERE user_id = '" + id + "'"); this.Tags = dbClient.ReadDataTable("SELECT tag FROM user_tags WHERE user_id = '" + id + "'"); this.Subscriptions = dbClient.ReadDataTable("SELECT subscription_id, timestamp_activated, timestamp_expire FROM user_subscriptions WHERE user_id = '" + id + "'"); this.Badges = dbClient.ReadDataTable("SELECT user_badges.badge_id,user_badges.badge_slot FROM user_badges WHERE user_id = " + id); this.Items = dbClient.ReadDataTable("SELECT items.Id,items.base_item,items_extra_data.extra_data FROM items LEFT JOIN items_extra_data ON items_extra_data.item_id = items.Id WHERE room_id = 0 AND user_id = " + id); this.Effects = dbClient.ReadDataTable("SELECT user_effects.effect_id,user_effects.total_duration,user_effects.is_activated,user_effects.activated_stamp FROM user_effects WHERE user_id = " + id); this.Friends = dbClient.ReadDataTable("SELECT users.Id,users.username,users.motto,users.look,users.last_online FROM users JOIN messenger_friendships ON users.Id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "'"); this.FriendStream = dbClient.ReadDataTable("SELECT friend_stream.id, friend_stream.type, friend_stream.userid, friend_stream.gender, friend_stream.look, friend_stream.time, friend_stream.data, friend_stream.data_extra FROM friend_stream JOIN messenger_friendships ON friend_stream.userid = messenger_friendships.user_two_id WHERE ( messenger_friendships.user_one_id = '" + id + "' OR friend_stream.userid = '" + id + "' ) AND type = '5' group by friend_stream.id ORDER BY friend_stream.id DESC LIMIT 15"); dbClient.AddParamWithValue("name", (string)this.UserData["username"]); this.Rooms = dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = @name ORDER BY Id ASC LIMIT " + ServerConfiguration.RoomUserLimit); this.Pets = dbClient.ReadDataTable("SELECT Id, user_id, room_id, name, type, race, color, expirience, energy, nutrition, respect, createstamp, x, y, z FROM user_pets WHERE user_id = " + id + " AND room_id = 0"); this.FriendStream = dbClient.ReadDataTable("SELECT friend_stream.id, friend_stream.type, friend_stream.userid, friend_stream.gender, friend_stream.look, friend_stream.time, friend_stream.data, friend_stream.data_extra FROM friend_stream JOIN messenger_friendships ON friend_stream.userid = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "' OR friend_stream.userid = '" + id + "' group by friend_stream.id ORDER BY friend_stream.id DESC LIMIT 15"); Random rnd = new Random(); int rnd1 = rnd.Next(1000, 9999); int rnd2 = rnd.Next(1000, 9999); int rnd3 = rnd.Next(1000, 9999); int rnd4 = rnd.Next(1000, 9999); int rnd5 = rnd.Next(1000, 9999); dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET auth_ticket = CONCAT('HABBOIM-" + rnd1 + "-" + rnd2 + "-" + rnd3 + "-" + rnd4 + "-" + rnd5 + "'), online = '1' WHERE Id = '", id, "' LIMIT 1; UPDATE user_info SET login_timestamp = '", HabboIM.GetUnixTimestamp(), "' WHERE user_id = '", id, "' LIMIT 1;" })); } } else { this.Validated = false; } } } }
internal void method_6(string string_0) { try { UserDataFactory @class = new UserDataFactory(string_0, this.GetConnection().String_0, true); if (this.GetConnection().String_0 == "127.0.0.1" && [email protected]) { @class = new UserDataFactory(string_0, "::1", true); } if ([email protected]) { Console.ForegroundColor = ConsoleColor.Red; string str = ""; if (ServerConfiguration.EnableSSO) { str = HabboIMEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")"; } ServerMessage Message = new ServerMessage(161u); Message.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("emu_sso_wrong") + str); this.GetConnection().SendMessage(Message); Console.ForegroundColor = ConsoleColor.Gray; this.method_12(); return; } Habbo class2 = Authenticator.CreateHabbo(string_0, this, @class, @class); HabboIM.GetGame().GetClientManager().method_25(class2.Id); this.Habbo = class2; this.Habbo.method_2(@class); } catch (Exception ex) { Console.WriteLine("Logging login error because you are on alpha test!"); Logging.LogException(ex.ToString()); if (this != null) { this.SendNotification(ex.ToString()); this.method_12(); } return; } try { HabboIM.GetGame().GetBanManager().method_1(this); } catch (ModerationBanException gException) { this.NotifyBan(gException.Message); this.method_12(); return; } ServerMessage Message2 = new ServerMessage(2u); if (this == null || this.GetHabbo() == null) { return; } if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes) { Message2.AppendInt32(2); } else { if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(1); } else { Message2.AppendInt32(0); } } if (this.GetHabbo().HasFuse("acc_anyroomowner")) { Message2.AppendInt32(7); } else { if (this.GetHabbo().HasFuse("acc_anyroomrights")) { Message2.AppendInt32(5); } else { if (this.GetHabbo().HasFuse("acc_supporttool")) { Message2.AppendInt32(4); } else { if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(2); } else { Message2.AppendInt32(0); } } } } this.SendMessage(Message2); this.SendMessage(this.GetHabbo().GetEffectsInventoryComponent().method_6()); ServerMessage Message3 = new ServerMessage(290u); Message3.AppendBoolean(true); Message3.AppendBoolean(false); this.SendMessage(Message3); ServerMessage Message5_ = new ServerMessage(3u); this.SendMessage(Message5_); if (this.GetHabbo().HasFuse("acc_supporttool")) { this.SendMessage(HabboIM.GetGame().GetModerationTool().method_0()); HabboIM.GetGame().GetModerationTool().method_4(this); } ServerMessage UserLogging = new ServerMessage(517u); UserLogging.AppendBoolean(true); this.SendMessage(UserLogging); if (HabboIM.GetGame().GetPixelManager().method_2(this)) { HabboIM.GetGame().GetPixelManager().method_3(this); } if (GetHabbo().Rank > 5u) { HabboIM.GetGame().GetClientManager().method_18ONLINE(GetHabbo().Username); } ServerMessage Message5 = new ServerMessage(455u); Message5.AppendUInt(this.GetHabbo().HomeRoomId); this.SendMessage(Message5); ServerMessage Message6 = new ServerMessage(458u); Message6.AppendInt32(30); Message6.AppendInt32(this.GetHabbo().list_1.Count); foreach (uint current in this.GetHabbo().list_1) { Message6.AppendUInt(current); } this.SendMessage(Message6); this.GetHabbo().CheckTotalTimeOnlineAchievements(); this.GetHabbo().CheckHappyHourAchievements(); this.GetHabbo().CheckTrueHabboAchievements(); this.GetHabbo().CheckRegularVisitorAchievements(); this.GetHabbo().CheckFootballGoalHostScoreAchievements(); this.GetHabbo().CheckStaffPicksAchievement(); try { if (HabboIM.UserAdType >= 0 && HabboIM.UserAdType <= 2 && HabboIM.UserAdMessage.Count > 0) { if (!(int.Parse(HabboIM.GetConfig().data["ads.disable"]) == 1)) { if (!(int.Parse(HabboIM.GetConfig().data["ads.allowedonlyrandomads"]) == 0)) { int random = HabboIMEnvironment.GetRandomNumber(1, 100); if (random <= 5) { if (HabboIM.UserAdType == 0) { this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 0); } if (HabboIM.UserAdType == 1) { this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 2); } else if (HabboIM.UserAdType == 2 && HabboIM.UserAdLink != "") { ServerMessage Message = new ServerMessage(161u); Message.AppendStringWithBreak(string.Concat(new string[] { " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ", "\r\n", string.Join("\r\n", HabboIM.UserAdMessage), })); Message.AppendStringWithBreak(HabboIM.UserAdLink); this.SendMessage(Message); } } } else { if (HabboIM.UserAdType == 0) { this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 0); } if (HabboIM.UserAdType == 1) { this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 2); } else if (HabboIM.UserAdType == 2 && HabboIM.UserAdLink != "") { ServerMessage Message = new ServerMessage(161u); Message.AppendStringWithBreak(string.Concat(new string[] { " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ", "\r\n", string.Join("\r\n", HabboIM.UserAdMessage), })); Message.AppendStringWithBreak(HabboIM.UserAdLink); this.SendMessage(Message); } } } } } catch { } if (ServerConfiguration.MOTD != "") { this.SendNotification(ServerConfiguration.MOTD, 2); } for (uint num = (uint)HabboIM.GetGame().GetRoleManager().method_9(); num > 1u; num -= 1u) { if (HabboIM.GetGame().GetRoleManager().method_8(num).Length > 0) { if (!this.GetHabbo().GetBadgeComponent().HasBadge(HabboIM.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank == num) { this.GetHabbo().GetBadgeComponent().SendBadge(this, HabboIM.GetGame().GetRoleManager().method_8(num), true); } else { if (this.GetHabbo().GetBadgeComponent().HasBadge(HabboIM.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank < num) { this.GetHabbo().GetBadgeComponent().RemoveBadge(HabboIM.GetGame().GetRoleManager().method_8(num)); } } } } if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { this.GetHabbo().CheckHCAchievements(); } if (this.GetHabbo().IsVIP&& !this.GetHabbo().GetBadgeComponent().HasBadge("VIP")) { this.GetHabbo().GetBadgeComponent().SendBadge(this, "VIP", true); } else { if (!this.GetHabbo().IsVIP&& this.GetHabbo().GetBadgeComponent().HasBadge("VIP")) { this.GetHabbo().GetBadgeComponent().RemoveBadge("VIP"); } } if (this.GetHabbo().CurrentQuestId > 0u) { HabboIM.GetGame().GetQuestManager().method_7(this.GetHabbo().CurrentQuestId, this); } if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$")) { ServerMessage Message5_2 = new ServerMessage(573u); this.SendMessage(Message5_2); } this.GetHabbo().Motto = HabboIM.FilterString(this.GetHabbo().Motto); DataTable dataTable = null; using (DatabaseClient class3 = HabboIM.GetDatabase().GetClient()) { dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'"); } if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { HabboIM.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]); using (DatabaseClient class3 = HabboIM.GetDatabase().GetClient()) { class3.ExecuteQuery(string.Concat(new object[] { "DELETE FROM achievements_owed WHERE achievement = '", (uint)dataRow["achievement"], "' AND user = '******' LIMIT 1" })); } } } }
public void ParsePacket(ref byte[] bytes) { if (bytes[0] == 64) { int i = 0; while (i < bytes.Length) { try { int num = Base64Encoding.DecodeInt32(new byte[] { bytes[i++], bytes[i++], bytes[i++] }); uint uint_ = Base64Encoding.DecodeUInt32(new byte[] { bytes[i++], bytes[i++] }); byte[] array = new byte[num - 2]; for (int j = 0; j < array.Length; j++) { array[j] = bytes[i++]; } if (this.ClientMessageHandler == null) { this.CreateClientMessageHandler(); } ClientMessage @class = new ClientMessage(uint_, array); if (@class != null) { try { if (int.Parse(HabboIM.GetConfig().data["debug"]) == 1) { Logging.WriteLine(string.Concat(new object[] { "[", this.ID, "] --> [", @class.Id, "] ", @class.Header, @class.GetBody() })); } } catch { } Interface @interface; if (HabboIM.GetPacketManager().Handle(@class.Id, out @interface)) { try { @interface.Handle(this, @class); } catch (Exception ex) { Logging.LogException("Error: " + ex.ToString()); this.method_12(); } } } } catch (Exception ex) { if (ex.GetType() == typeof(IndexOutOfRangeException)) { return; } Logging.LogException("Error: " + ex.ToString()); this.method_12(); } } } else { if (true) { this.Connection.SendMessage(CrossdomainPolicy.GetXmlPolicy()); this.Message1_0.SendData(HabboIM.GetDefaultEncoding().GetBytes(CrossdomainPolicy.GetXmlPolicy())); this.Connection.Close(); } } }
internal void HandleSpeech(GameClient Session, string str, bool bool_13) { if (!this.IsBot) { if (Session.GetHabbo().jail == 1 && Session.GetHabbo().jailtime > 10 * 60) { Session.GetHabbo().Whisper("Du bist mehr als 10 Minuten gebannt und kannst deswegen nicht chatten!"); return; } } string object_ = str; string linkRegex = "((http|https):\\/\\/|www.)?[a-zA-Z0-9\\-\\.]+\\b(com|co\\.uk|org|net|eu|cf|info|ml|nl|ca|es|fi)\\b"; if (Session == null || Session.GetHabbo().HasFuse("ignore_roommute") || !this.GetRoom().bool_4) { this.Unidle(); if (!this.IsBot && this.GetClient().GetHabbo().IsMuted) { this.GetClient().GetHabbo().Whisper(HabboIMEnvironment.GetExternalText("error_muted")); } else if (!str.StartsWith(":") || Session == null || !ChatCommandHandler.smethod_5(Session, str.Substring(1))) { uint num = 24u; if (bool_13) { num = 26u; } if (!this.IsBot && Session.GetHabbo().method_4() > 0) { TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0; if (timeSpan.Seconds > 4) { Session.GetHabbo().int_23 = 0; } if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5 && !this.IsBot) { ServerMessage Message = new ServerMessage(27u); Message.AppendInt32(Session.GetHabbo().method_4()); this.GetClient().SendMessage(Message); this.GetClient().GetHabbo().IsMuted = true; this.GetClient().GetHabbo().int_4 = Session.GetHabbo().method_4(); this.GetClient().GetHabbo().GetEffectsInventoryComponent().method_2(620, true); this.GetClient().GetHabbo().Whisper("Du wurdest stumm geschaltet, da du zu schnell getippt hast!"); return; } Session.GetHabbo().dateTime_0 = DateTime.Now; Session.GetHabbo().int_23++; } bool aws = false; if (!this.IsBot && HabboIM.GetGame().AntiWerberStatus) { str = ChatCommandHandler.smethod_4b(Session, object_, "Raum"); str = ChatCommandHandler.amina_zikki(Session, str, "Raum"); if (str != object_) { aws = true; } } if (!this.IsBot) { str = ChatCommandHandler.smethod_4(str); } if (!this.GetRoom().method_9(this, str)) { ServerMessage Message2 = new ServerMessage(num); Message2.AppendInt32(this.VirtualId); if (!this.IsBot && !this.IsPet) { try { if (HabboIM.GetConfig().data.ContainsKey("anti.ads.enable") && HabboIM.GetConfig().data["anti.ads.enable"] == "1") { if (Session.GetHabbo().Rank <= uint.Parse(HabboIM.GetConfig().data["anti.ads.rank"])) { if (Regex.IsMatch(str, linkRegex, RegexOptions.IgnoreCase)) { Session.SendNotification(HabboIM.GetConfig().data["anti.ads.msg"]); return; } } } } catch { } } if (str.Contains("http://") || str.Contains("www.") || str.Contains("https://")) { string[] array = str.Split(new char[] { ' ' }); int num2 = 0; string text = ""; string text2 = ""; string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text3 = array2[i]; if (ChatCommandHandler.InitLinks(text3)) { if (num2 > 0) { text += ","; } text += text3; object obj = text2; text2 = string.Concat(new object[] { obj, " {", num2, "}" }); num2++; } else { text2 = text2 + " " + text3; } } text = text2; string[] array3 = text.Split(new char[] { ',' }); Message2.AppendStringWithBreak(text); if (array3.Length > 0) { Message2.AppendBoolean(false); Message2.AppendInt32(num2); array2 = array3; for (int i = 0; i < array2.Length; i++) { string text4 = array2[i]; string text5 = ChatCommandHandler.smethod_3(text4.Replace("http://", "").Replace("https://", "")); Message2.AppendStringWithBreak(text5.Replace("http://", "").Replace("https://", "")); Message2.AppendStringWithBreak(text4); Message2.AppendBoolean(false); } } } else { Message2.AppendStringWithBreak(str); } Message2.AppendInt32(this.ParseEmoticon(str)); try { if (this.ParseSmileys(str) != 0 && Session.GetHabbo().GetEffectsInventoryComponent().int_0 == 0) { Session.GetHabbo().GetEffectsInventoryComponent().method_2(this.ParseSmileys(str), true); Thread thread = new Thread(delegate() { try { Thread.Sleep(3000); Session.GetHabbo().GetEffectsInventoryComponent().method_2(0, true); } catch { } }); thread.Start(); } } catch { Console.WriteLine("Error in Smiley to Enable Function."); } Message2.AppendBoolean(false); if (!this.IsBot) { if (aws == false) { this.GetRoom().method_58(Message2, Session.GetHabbo().list_2, Session.GetHabbo().Id); } } else { this.GetRoom().SendMessage(Message2, null); } } else if (!this.IsBot) { Session.GetHabbo().Whisper(str); } if (!this.IsBot) { this.GetRoom().method_7(this, str, bool_13); if (Session.GetHabbo().CurrentQuestId > 0u && HabboIM.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHAT_WITH_SOMEONE") { HabboIM.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session); } } if (ServerConfiguration.EnableChatlog && !this.IsBot) { using (DatabaseClient @class = HabboIM.GetDatabase().GetClient()) { @class.AddParamWithValue("message", object_); @class.ExecuteQuery(string.Concat(new object[] { "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('", Session.GetHabbo().Id, "','", this.GetRoom().Id, "','", DateTime.Now.Hour, "','", DateTime.Now.Minute, "',UNIX_TIMESTAMP(),@message,'", Session.GetHabbo().Username, "','", DateTime.Now.ToLongDateString(), "')" }), 30); } } } } }
public Game(int conns) { this.ClientManager = new GameClientManager(conns); if (HabboIM.GetConfig().data["client.ping.enabled"] == "1") { this.ClientManager.method_10(); } DateTime now = DateTime.Now; Logging.Write("Verbinde mit Datenbank.. "); try { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Fertig!", ConsoleColor.Green); HabboIM.Game = this; this.LoadServerSettings(dbClient); this.BanManager = new ModerationBanManager(); this.RoleManager = new RoleManager(); this.HelpTool = new HelpTool(); this.Catalog = new Catalog(); this.Navigator = new Navigator(); this.ItemManager = new ItemManager(); this.RoomManager = new RoomManager(); this.AdvertisementManager = new AdvertisementManager(); this.PixelManager = new PixelManager(); this.AchievementManager = new AchievementManager(); this.ModerationTool = new ModerationTool(); this.BotManager = new BotManager(); this.Marketplace = new Marketplace(); this.QuestManager = new QuestManager(); this.HabboIMEnvironment = new HabboIMEnvironment(); this.Groups = new Groups(); HabboIMEnvironment.LoadExternalTexts(dbClient); this.BanManager.Initialise(dbClient); this.RoleManager.method_0(dbClient); this.HelpTool.method_0(dbClient); this.HelpTool.method_3(dbClient); this.ModerationTool.method_1(dbClient); this.ModerationTool.method_2(dbClient); this.ItemManager.method_0(dbClient); this.Catalog.method_0(dbClient); this.Catalog.method_1(); this.Navigator.method_0(dbClient); this.RoomManager.method_8(dbClient); this.RoomManager.method_0(); this.NavigatorCache = new NavigatorCache(); this.AdvertisementManager.method_0(dbClient); this.BotManager.method_0(dbClient); AchievementManager.smethod_0(dbClient); this.PixelManager.method_0(); ChatCommandHandler.smethod_0(dbClient); this.QuestManager.method_0(); Groups.smethod_0(dbClient); this.RestoreStatistics(dbClient, 1); } } catch (MySqlException e) { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Fehler!", ConsoleColor.Red); Logging.WriteLine(e.Message + " Check the given configuration details in config.conf\r\n", ConsoleColor.Blue); HabboIM.Destroy("", true, true); return; } this.task_0 = new Task(new Action(LowPriorityWorker.Initialise)); this.task_0.Start(); this.StartGameLoop(); }
public static void Initialise() { double lastDatabaseUpdate = HabboIM.GetUnixTimestamp(); double lastDatabaseUpdate2 = HabboIM.GetUnixTimestamp(); while (true) { try { DateTime now = DateTime.Now; TimeSpan timeSpan = now - HabboIM.ServerStarted; new PerformanceCounter("Processor", "% Processor Time", "_Total"); int Status = 1; int UsersOnline = HabboIM.GetGame().GetClientManager().ClientCount; int RoomsLoaded = HabboIM.GetGame().GetRoomManager().LoadedRoomsCount; try { if (HabboIM.GetConfig().data["shutdown-server"] != null) { DateTime shutdown_server_time = Convert.ToDateTime(HabboIM.GetConfig().data["shutdown-server"]); var time = shutdown_server_time.TimeOfDay.TotalSeconds; string s = DateTime.Now.ToString("HH:mm:ss"); DateTime dt2 = DateTime.ParseExact(s, "HH:mm:ss", CultureInfo.InvariantCulture); var time2 = dt2.TimeOfDay.TotalSeconds; try { if (HabboIM.GetConfig().data["shutdown-warning-alert"] != null) { if (time - time2 <= 60 && time - time2 >= 50) { try { if (int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) <= 0) { string str = HabboIM.GetConfig().data["shutdown-warning-alert"]; ServerMessage Message2 = new ServerMessage(808u); Message2.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("cmd_ha_title")); Message2.AppendStringWithBreak(str + "\r\n- " + "Hotel"); ServerMessage Message3 = new ServerMessage(161u); Message3.AppendStringWithBreak(str + "\r\n- " + "Hotel"); HabboIM.GetGame().GetClientManager().method_15(Message2, Message3); } } catch { } } } } catch { } if (time - time2 <= 11 && time - time2 >= 0) { try { if (int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) <= 0) { HabboIM.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true); } } catch { HabboIM.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true); } } } } catch { } double timestamp = HabboIM.GetUnixTimestamp() - lastDatabaseUpdate; if (timestamp >= 5) { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE server_status SET stamp = UNIX_TIMESTAMP(), status = '", Status, "', users_online = '", UsersOnline, "', rooms_loaded = '", RoomsLoaded, "', server_ver = '", HabboIM.Version, "' LIMIT 1" })); uint num3 = (uint)dbClient.ReadInt32("SELECT users FROM system_stats ORDER BY ID DESC LIMIT 1"); if ((long)UsersOnline > (long)((ulong)num3)) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE system_stats SET users = '", UsersOnline, "', rooms = '", RoomsLoaded, "' ORDER BY ID DESC LIMIT 1" })); } } lastDatabaseUpdate = HabboIM.GetUnixTimestamp(); } double timestamp2 = HabboIM.GetUnixTimestamp() - lastDatabaseUpdate2; if (timestamp2 >= 30.0) { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO online_statistik (`useronline`,`rooms_loaded`,`timestamp`) VALUES ('", UsersOnline, "','", RoomsLoaded, "', '", HabboIM.GetUnixTimestamp(), "');" }), 30); } lastDatabaseUpdate2 = HabboIM.GetUnixTimestamp(); } HabboIM.GetGame().GetClientManager().method_23(); Console.Title = string.Concat(new object[] { "HabboIM Emulator | Spieler: ", UsersOnline, " | Räume: ", RoomsLoaded, " | Online: ", timeSpan.Days, " Tage, ", timeSpan.Hours, " Stunden und ", timeSpan.Minutes, " Minuten" }); if (HabboIM.hour_lastlotto != now.Hour) { HabboIM.hour_lastlotto = now.Hour; //ServerMessage Message2 = new ServerMessage(808u); //Message2.AppendStringWithBreak("MyHuBBa Lotterie"); //Message2.AppendStringWithBreak("Aufgepasst, nun könnt ihr an unserer Lotterie teilnehmen. Verwende hierzu den Befehl :lotto ZAHL und schon nimmst du teil. Die Zahl darf zwischen 1 & 50 liegen. Kosten für Teilnahme beträgt 3.500 Taler!\r\n- System"); ServerMessage Message3 = new ServerMessage(161u); //Message3.AppendStringWithBreak("Aufgepasst, nun könnt ihr an unserer Lotterie teilnehmen. Verwende hierzu den Befehl :lotto ZAHL und schon nimmst du teil. Die Zahl darf zwischen 1 & 50 liegen. Kosten für Teilnahme beträgt 3.500 Taler!\r\n- System"); //HabboIM.GetGame().GetClientManager().method_15(Message2, Message3); HabboIM.GetGame().GetClientManager().method_WHISPER("Lotto: Sende jetzt eine Zahl von 0-50 mit :lotto Zahl ein. Kosten: 3.500 Taler."); HabboIM.lotto = true; Random rand = new Random(); int lottozahl = rand.Next(1, 50); // Lottozahlen definieren Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: Ziehung gestartet! Die Zahl lautet " + lottozahl); HabboIM.lottozahl = lottozahl; HabboIM.lottowinner = 0; HabboIM.lotto_end = HabboIM.GetUnixTimestamp() + 5 * 60; //Info für den dummen Hazed: // 5 * 60 steht für 5 Minuten, da 5 Minuten 5 mal 60 Sekunden sind. HabboIM.lotto_einsatz = 3500; } if (HabboIM.GetUnixTimestamp() >= HabboIM.lotto_end && HabboIM.lotto == true) { Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: Ziehung gestoppt!"); HabboIM.lotto = false; HabboIM.GetGame().GetClientManager().resetlotto(); GameClients.GameClient client; try { client = HabboIM.GetGame().GetClientManager().method_2(HabboIM.lottowinner); client.GetHabbo().Credits += HabboIM.lotto_einsatz; client.GetHabbo().UpdateCredits(true); HabboIM.GetGame().GetClientManager().method_WHISPER("" + client.GetHabbo().Username + " hat den Jackpot in Höhe von " + HabboIM.lotto_einsatz.ToString() + " Talern geknackt! (Zahl: " + HabboIM.lottozahl + ")"); HabboIM.lotto_einsatz = 3500; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: " + client.GetHabbo().Username + " hat den Jackpot geknackt."); } catch { HabboIM.GetGame().GetClientManager().method_WHISPER("Lotto: Heute hat leider keiner den Jackpot geknackt!"); HabboIM.lotto_einsatz = 3500; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: Keiner konnte den Jackpot knacken."); } } var minimum_users = int.Parse(HabboIM.GetConfig().data["habboim.zufallsrare_minimum_spieler"]); if (HabboIM.hour_lastrr + HabboIM.nxt_rr * 60 < HabboIM.GetUnixTimestamp()) { HabboIM.hour_lastrr = HabboIM.GetUnixTimestamp(); if (int.Parse(HabboIM.GetConfig().data["habboim.zufallsrare"]) == 1) { //Wenn genug Habbos Online if (UsersOnline >= minimum_users) { //Ausgabe in Konsole Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("____________________________________________________________________________________________________"); Console.WriteLine(" "); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("["); string time1 = DateTime.Now.ToString(); Console.Write(time1 + "] "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Zufallsrare: Verteilt!"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("["); string time2 = DateTime.Now.ToString(); Console.Write(time2 + "] "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!"); Console.WriteLine(); } else { if (UsersOnline < minimum_users) { string time3 = DateTime.Now.ToString(); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("____________________________________________________________________________________________________"); Console.WriteLine(" "); Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("["); Console.Write(time3 + "] "); Console.ForegroundColor = ConsoleColor.Red; Console.Write("Zufallsrare nicht verteilt. Grund: Nicht genug Online! Minimum: " + minimum_users + " Habbos."); Console.WriteLine(); HabboIM.zufallsrare = false; } } if (UsersOnline >= minimum_users) { //Ermittle über Websocket den Gewinner des Zufallsrare HabboIM.zufallsrare = false; string random_rare = "9307620"; HabboIM.GetWebSocketManager().SendMessageToEveryConnection(random_rare); } } //string random_rare = "5|ZUFALLSRARE|Baumstamm|15180"; //HabboIM.GetWebSocketManager().SendMessageToEveryConnection(random_rare); /* using (DatabaseClient stafflist = HabboIM.GetDatabase().GetClient()) * { * //DataTable start = stafflist.ReadDataTable("SELECT id FROM users ORDER BY desc LIMIT 1") * //DataTable Staffs = stafflist.ReadDataTable("SELECT * FROM users WHERE id = '" + testst + "' LIMIT 1"); * StringBuilder StringStaff = new StringBuilder(); * DataTable Staffs = stafflist.ReadDataTable("SELECT * FROM users ORDER BY id desc"); * foreach(DataRow testRow in Staffs.Rows) * { * int dreiund = rand.Next(Staffs.Rows.Count, Staffs.Rows.Count); * Console.WriteLine("ZUFALL (MIT FOREACH) " + dreiund); * } * int testst = rand.Next(Staffs.Rows.Count, Staffs.Rows.Count); * Console.WriteLine("STAFF ROW " + Staffs.Rows.Count); * * Console.WriteLine("ZUFALL (OHNE FOREACH) " + testst); * * * //Console.WriteLine("User gefunden ID:" + testst); * foreach (DataRow baumstammRow in Staffs.Rows) * { * //Console.WriteLine("User gefunden ID:" + testst); * // Console.WriteLine((string)baumstammRow["username"]); * Console.WriteLine(testst); * } * //Console.WriteLine((string)baumstammRow["username"]); * * }*/ } } catch (Exception ex) { Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND); Logging.LogThreadException(ex.ToString(), "Server status update task"); } Thread.Sleep(5000); } }