private static Habbo CreateHabbo(DataRow habboData, string ssoTicket, GameClient session, UserDataFactory otherData) { uint Id = (uint)habboData["Id"]; string Username = (string)habboData["username"]; string Name = (string)habboData["real_name"]; uint Rank = (uint)habboData["rank"]; string Motto = (string)habboData["motto"]; string ip_last = (string)habboData["ip_last"]; string look = (string)habboData["look"]; string gender = (string)habboData["gender"]; int credits = (int)habboData["credits"]; int pixels = (int)habboData["activity_points"]; string account_created = (string)habboData["account_created"]; double activity_points_lastupdate = (double)habboData["activity_points_lastupdate"]; string last_loggedin = (string)habboData["last_loggedin"]; int daily_respect_points = (int)habboData["daily_respect_points"]; int daily_pet_respect_points = (int)habboData["daily_pet_respect_points"]; int unmutetime = (int)habboData["unmute_timestamp"]; double vipha_last = (double)habboData["vipha_last"]; double viphal_last = (double)habboData["viphal_last"]; bool passed_quiz = Essential.StringToBoolean(habboData["quiz_passed"].ToString()); bool passed_safetyquiz = Essential.StringToBoolean(habboData["passed_safety_quiz"].ToString()); double eventwin_last = (double)habboData["eventwin_last"]; return(new Habbo(Id, Username, Name, ssoTicket, Rank, Motto, look, gender, credits, pixels, activity_points_lastupdate, account_created, Essential.StringToBoolean(habboData["is_muted"].ToString()), (uint)habboData["home_room"], (int)habboData["newbie_status"], Essential.StringToBoolean(habboData["block_newfriends"].ToString()), Essential.StringToBoolean(habboData["hide_inroom"].ToString()), Essential.StringToBoolean(habboData["hide_online"].ToString()), Essential.StringToBoolean(habboData["vip"].ToString()), (int)habboData["volume"], (int)habboData["vip_points"], Essential.StringToBoolean(habboData["accept_trading"].ToString()), ip_last, session, otherData, last_loggedin, daily_respect_points, daily_pet_respect_points, vipha_last, viphal_last, Essential.StringToBoolean(habboData["friend_stream_enabled"].ToString()), passed_quiz, passed_safetyquiz, unmutetime, eventwin_last)); }
public void Handle(GameClient Session, ClientMessage Event) { int guildId = Event.PopWiredInt32(); //Console.WriteLine(Event.PopWiredInt32() + " | " + Event.PopWiredInt32() + " | " + Event.PopWiredInt32()); GroupsManager guild = Groups.GetGroupById(guildId); if (guild != null) { if (!guild.UserWithRanks.Contains((int)Session.GetHabbo().Id)) { return; } Room room = Essential.GetGame().GetRoomManager().method_15(Convert.ToUInt32(guild.RoomId)); if (room != null) { int type = Event.PopWiredInt32(); guild.Locked = Groups.IntToType(type); int onlyAdminMove = Event.PopWiredInt32(); guild.canMove = !Essential.StringToBoolean(onlyAdminMove + ""); guild.OnlyAdminsCanMove = onlyAdminMove; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery("UPDATE groups SET locked='" + guild.Locked + "' WHERE id=" + guild.Id); dbClient.ExecuteQuery("UPDATE groups SET members_canmove='" + (guild.canMove ? 1 : 0) + "' WHERE id=" + guild.Id); } room.SaveSettingsPackets(guild, Session); } } }
public void Initialize(DatabaseClient class6_0) { Logging.Write("Loading Bot data.."); this.list_0 = new List <RoomBot>(); DataTable dataTable = class6_0.ReadDataTable("SELECT * FROM bots;"); DataTable dataTable2 = class6_0.ReadDataTable("SELECT Id, bot_id, keywords, response_text, mode, serve_id FROM bots_responses;"); DataTable dataTable3 = class6_0.ReadDataTable("SELECT text, shout, bot_id FROM bots_speech;"); List <BotResponse> list = new List <BotResponse>(); List <RandomSpeech> list2 = new List <RandomSpeech>(); foreach (DataRow dataRow in dataTable2.Rows) { list.Add(new BotResponse((uint)dataRow["Id"], (uint)dataRow["bot_id"], (string)dataRow["keywords"], (string)dataRow["response_text"], dataRow["mode"].ToString(), (int)dataRow["serve_id"])); } foreach (DataRow dataRow in dataTable3.Rows) { list2.Add(new RandomSpeech((string)dataRow["text"], Essential.StringToBoolean(dataRow["shout"].ToString()), (uint)dataRow["bot_id"])); } if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { string text = (string)dataRow["ai_type"]; string text2 = text; if (text2 == null) { goto IL_201; } AIType enum2_; if (!(text2 == "generic")) { if (!(text2 == "guide")) { if (!(text2 == "pet")) { goto IL_201; } enum2_ = AIType.Pet; } else { enum2_ = AIType.Guide; } } else { enum2_ = AIType.Generic; } IL_204: this.list_0.Add(new RoomBot((uint)dataRow["Id"], (uint)dataRow["room_id"], enum2_, (string)dataRow["walk_mode"], (string)dataRow["name"], (string)dataRow["motto"], (string)dataRow["look"], (int)dataRow["x"], (int)dataRow["y"], (int)dataRow["z"], (int)dataRow["rotation"], (int)dataRow["min_x"], (int)dataRow["min_y"], (int)dataRow["max_x"], (int)dataRow["max_y"], ref list2, ref list, (int)dataRow["effect"])); continue; IL_201: enum2_ = AIType.Generic; goto IL_204; } Logging.WriteLine("completed!", ConsoleColor.Green); } }
internal void method_16(string string_0) { DataRow dataRow = null; using (DatabaseClient @class = Essential.GetDatabase().GetClient()) { @class.AddParamWithValue("query", string_0.ToLower()); dataRow = @class.ReadDataRow("SELECT Id,block_newfriends FROM users WHERE username = @query LIMIT 1"); } if (dataRow != null) { if (Essential.StringToBoolean(dataRow["block_newfriends"].ToString()) && !this.method_25().GetHabbo().HasFuse("ignore_friendsettings")) { ServerMessage Message = new ServerMessage(Outgoing.MessengerError); // Updated Message.AppendInt32(39); Message.AppendInt32(3); this.method_25().SendMessage(Message); } else { uint num = (uint)dataRow["Id"]; if (!this.method_8(this.uint_0, num)) { using (DatabaseClient @class = Essential.GetDatabase().GetClient()) { @class.AddParamWithValue("toid", num); @class.AddParamWithValue("userid", this.uint_0); @class.ExecuteQuery("INSERT INTO messenger_requests (to_id,from_id) VALUES (@toid,@userid)"); } GameClient class2 = Essential.GetGame().GetClientManager().GetClient(num); if (class2 != null && class2.GetHabbo() != null) { uint num2 = 0u; using (DatabaseClient @class = Essential.GetDatabase().GetClient()) { @class.AddParamWithValue("toid", num); @class.AddParamWithValue("userid", this.uint_0); num2 = @class.ReadUInt32("SELECT Id FROM messenger_requests WHERE to_id = @toid AND from_id = @userid ORDER BY Id DESC LIMIT 1"); } string gender = Essential.GetGame().GetClientManager().GetDataById(this.uint_0, "gender"); string look = Essential.GetGame().GetClientManager().GetDataById(this.uint_0, "look"); string username = Essential.GetGame().GetClientManager().GetNameById(this.uint_0); if (!(string.IsNullOrEmpty(gender) && string.IsNullOrEmpty(look) && string.IsNullOrEmpty(username))) { MessengerRequest class3 = new MessengerRequest(num2, num, this.uint_0, username, gender, look); class2.GetHabbo().GetMessenger().method_17(num2, num, this.uint_0, username, gender, look); ServerMessage Message5_ = new ServerMessage(Outgoing.SendFriendRequest); // Updated class3.method_0(Message5_); class2.SendMessage(Message5_); } } } } } }
public bool isGuide(uint userid) { if (!this.Guides.Contains(userid)) { using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { bool b = Essential.StringToBoolean(dbClient.ReadString("SELECT is_guide FROM users WHERE id=" + userid)); if (b) { this.Guides.Add(userid); return(true); } } } else { return(true); } return(false); }
public override void OnSelfEnterRoom() { try { this.botResponse = new List <BotResponse>(); this.randomSpeeches = new List <RandomSpeech>(); using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { this.uBot = Essential.GetGame().GetCatalog().RetrBot(dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id=" + (base.GetRoomUser().UId - 1000))); if (this.uBot.BotType != "default") { foreach (DataRow drow in dbClient.ReadDataTable("SELECT * FROM bots_responses WHERE bot_type='" + this.uBot.BotType + "'").Rows) { botResponse.Add(new BotResponse((uint)drow["id"], 0, drow["keywords"].ToString(), drow["response_text"].ToString(), drow["mode"].ToString(), (int)drow["serve_id"])); } } else { foreach (DataRow drow in dbClient.ReadDataTable("SELECT * FROM bots_responses WHERE bot_id='" + this.uBot.BotId + "'").Rows) { botResponse.Add(new BotResponse((uint)drow["id"], 0, drow["keywords"].ToString(), drow["response_text"].ToString(), drow["mode"].ToString(), (int)drow["serve_id"])); } } DataTable dtable = dbClient.ReadDataTable("SELECT * FROM bots_speech WHERE bot_id='" + this.uBot.BotId + "'"); foreach (DataRow drow in dtable.Rows) { randomSpeeches.Add(new RandomSpeech((string)drow["text"], Essential.StringToBoolean(drow["shout"].ToString()), Convert.ToUInt32(drow["bot_id"]))); } speechInterval = dbClient.ReadInt32("SELECT speaking_interval from user_bots WHERE id = " + this.uBot.BotId); canSpeak = Convert.ToBoolean(dbClient.ReadString("SELECT automatic_chat from user_bots WHERE id = " + this.uBot.BotId)); } this.SpeechTimer = speechInterval * 2; this.speechDelta = speechInterval * 2; this.ActionTimer = new Random(((int)this.virtualId ^ 2) + DateTime.Now.Millisecond).Next(10, 30); }catch { } }
public void Initialize(DatabaseClient class6_0) { Logging.Write("Loading Navigator.."); this.list_0.Clear(); this.PublicItems.Clear(); this.dictionary_1.Clear(); DataTable dataTable = class6_0.ReadDataTable("SELECT Id,caption,min_rank,cantrade FROM navigator_flatcats WHERE enabled = '1'"); DataTable dataTable2 = class6_0.ReadDataTable("SELECT * FROM navigator_publics_new ORDER BY ordernum ASC"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { this.list_0.Add(new FlatCat((int)dataRow["Id"], (string)dataRow["caption"], (int)dataRow["min_rank"], Essential.StringToBoolean(dataRow["cantrade"].ToString()))); } } if (dataTable2 != null) { foreach (DataRow row in dataTable2.Rows) { this.PublicItems.Add((int)row["id"], new PublicItem((int)row["id"], int.Parse(row["bannertype"].ToString()), (string)row["caption"], (string)row["description"], (string)row["image"], (row["image_type"].ToString().ToLower() == "internal") ? PublicImageType.INTERNAL : PublicImageType.EXTERNAL, Convert.ToUInt32(row["room_id"]), (int)row["category_id"], (int)row["category_parent_id"], Essential.StringToBoolean(row["recommended"].ToString()), (int)row["typeofdata"], (string)row["tag"])); } } Logging.WriteLine("completed!", ConsoleColor.Green); }
internal void tryLogin(string AuthTicket) { try { UserDataFactory @class = new UserDataFactory(AuthTicket, this.GetConnection().String_0, true); if ([email protected]) { @class = new UserDataFactory(AuthTicket, this.GetConnection().String_0, true); } if ([email protected]) { string str = ""; if (ServerConfiguration.EnableSSO) { str = EssentialEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")"; } SendNotifWithScroll(EssentialEnvironment.GetExternalText("emu_sso_wrong") + str); return; } Habbo class2 = Authenticator.CreateHabbo(AuthTicket, this, @class, @class); Essential.GetGame().GetClientManager().Disconnect(class2.Id, "New Session"); 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.Disconnect("Login Error"); } return; } try { Essential.GetGame().GetBanManager().method_1(this); } catch (ModerationBanException gException) { this.NotifyBan(gException.Message); this.Disconnect("Banned!"); return; } #region "AKS" if (this.MachineId != "" && !Essential.StringToBoolean(this.GetHabbo().GetUserDataFactory().GetUserData()["staff_inacc"].ToString())) { using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { string oldMachineId = dbClient.SpecialString("SELECT machineId FROM user_machineids WHERE userid=" + this.GetHabbo().Id); dbClient.AddParamWithValue("machineid", this.MachineId); if ((oldMachineId == "" || oldMachineId != this.MachineId)) { dbClient.AddParamWithValue("username", this.GetHabbo().Username); dbClient.ExecuteQuery("INSERT INTO user_machineids (username,userid,timestamp,machineId) VALUES (@username," + this.GetHabbo().Id + ",'" + Convert.ToInt32(Essential.GetUnixTimestamp()) + "',@machineid)"); } } } #endregion ServerMessage Message2 = new ServerMessage(Outgoing.Fuserights); 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(Outgoing.AvailabilityStatus); Message3.AppendBoolean(true); Message3.AppendBoolean(false); this.SendMessage(Message3); ServerMessage message = new ServerMessage(Outgoing.UniqueID); message.AppendString(this.MachineId); this.SendMessage(message); ServerMessage Message5_ = new ServerMessage(Outgoing.AuthenticationOK); this.SendMessage(Message5_); if (GetHabbo().HomeRoomId <= 0) { GetHabbo().HomeRoomId = 64259; } ServerMessage Message5 = new ServerMessage(Outgoing.HomeRoom); Message5.AppendUInt(this.GetHabbo().HomeRoomId); Message5.AppendUInt(this.GetHabbo().HomeRoomId); this.SendMessage(Message5); Console.WriteLine("[" + this.GetConnection().UInt32_0 + "] [" + this.GetHabbo().Username + "] [" + this.GetHabbo().Id + "] [" + this.GetConnection().String_0 + "] [" + DateTime.Now.Hour + ":" + DateTime.Now.Minute + "]"); GetHabbo().UpdateCredits(false); GetHabbo().UpdateActivityPoints(false); if (this.GetHabbo().HasFuse("acc_supporttool")) { this.SendMessage(Essential.GetGame().GetModerationTool().SerializeTool()); Essential.GetGame().GetModerationTool().method_4(this); } if (Essential.GetGame().GetPixelManager().CanHaveReward(this)) { Essential.GetGame().GetPixelManager().UpdateNeeded(this); } ServerMessage Message6 = new ServerMessage(Outgoing.FavouriteRooms); Message6.AppendInt32(30); Message6.AppendInt32(this.GetHabbo().list_1.Count); foreach (uint current in this.GetHabbo().list_1) { Message6.AppendUInt(current); } this.SendMessage(Message6); try { this.GetHabbo().CheckTotalTimeOnlineAchievements(); this.GetHabbo().CheckHappyHourAchievements(); this.GetHabbo().CheckTrueHabboAchievements(); this.GetHabbo().CheckRegularVisitorAchievements(); this.GetHabbo().CheckFootballGoalHostScoreAchievements(); this.GetHabbo().CheckStaffPicksAchievement(); } catch { } if (ServerConfiguration.MOTD != "") { this.SendNotification(ServerConfiguration.MOTD, 2); } for (uint num = (uint)Essential.GetGame().GetRoleManager().GetRankCount(); num > 1u; num -= 1u) { if (Essential.GetGame().GetRoleManager().GetBadgeByRank(num).Length > 0) { if (!this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank == num) { this.GetHabbo().GetBadgeComponent().SendBadge(this, Essential.GetGame().GetRoleManager().GetBadgeByRank(num), true); } else { if (this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank < num) { this.GetHabbo().GetBadgeComponent().RemoveBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(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) { Essential.GetGame().GetQuestManager().ActivateQuest(this.GetHabbo().CurrentQuestId, this); } if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$")) { ServerMessage Message5_2 = new ServerMessage(Outgoing.Disconnect); this.SendMessage(Message5_2); } this.GetHabbo().Motto = Essential.FilterString(this.GetHabbo().Motto); DataTable dataTable = null; using (DatabaseClient class3 = Essential.GetDatabase().GetClient()) { dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'"); } if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { Essential.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]); using (DatabaseClient class3 = Essential.GetDatabase().GetClient()) { class3.ExecuteQuery(string.Concat(new object[] { "DELETE FROM achievements_owed WHERE achievement = '", (uint)dataRow["achievement"], "' AND user = '******' LIMIT 1" })); } } } if (this.GetHabbo().list_2 != null && this.GetHabbo().list_2.Count > 0) { ServerMessage IgnoringList = new ServerMessage(Outgoing.IgnoringList); IgnoringList.AppendInt32(this.GetHabbo().list_2.Count); foreach (uint userId in this.GetHabbo().list_2) { IgnoringList.AppendString(Essential.GetGame().GetClientManager().GetNameById(userId)); } this.SendMessage(IgnoringList); } //this.GetClientMessageHandler().method_5(this.GetHabbo().HomeRoomId, ""); }
public void method_1(DataRow Row) { this.Id = (uint)Row["Id"]; this.Name = (string)Row["caption"]; this.Description = (string)Row["description"]; this.Type = (string)Row["roomtype"]; this.Owner = (string)Row["owner"]; this.Achievement = Convert.ToUInt32(Row["achievement"]); string text = Row["state"].ToString().ToLower(); if (text != null) { if (text == "open") { this.State = 0; goto IL_DF; } if (text == "password") { this.State = 2; goto IL_DF; } if (!(text == "locked")) { } } this.State = 1; IL_DF: this.Category = (int)Row["category"]; this.UsersNow = (int)Row["users_now"]; this.UsersMax = (int)Row["users_max"]; this.ModelName = (string)Row["model_name"]; this.CCTs = (string)Row["public_ccts"]; this.Score = (int)Row["score"]; this.OwnerId = 0; this.ModelData = (string)Row["modeldata"]; try { if (Type == "private") { using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.AddParamWithValue("username", (string)Row["owner"]); int result = dbClient.ReadInt32("SELECT id FROM users WHERE username = @username"); if (result > 0) { this.OwnerId = result; } } } } catch { this.OwnerId = 0; } this.Tags = new List <string>(); this.AllowPet = Essential.StringToBoolean(Row["allow_pets"].ToString()); this.AllowPetsEating = Essential.StringToBoolean(Row["allow_pets_eat"].ToString()); this.AllowWalkthrough = Essential.StringToBoolean(Row["allow_walkthrough"].ToString()); this.bool_3 = false; this.Hidewall = Essential.StringToBoolean(Row["allow_hidewall"].ToString()); this.HideOwner = Essential.StringToBoolean(Row["hide_owner"].ToString()); this.Wallthick = (int)Row["wallthick"]; this.Floorthick = (int)Row["floorthick"]; this.Password = (string)Row["password"]; this.Wallpaper = (string)Row["wallpaper"]; this.Floor = (string)Row["floor"]; this.Landscape = (string)Row["landscape"]; this.WalkUnder = Essential.StringToBoolean(Row["can_walkunder"].ToString()); this.Event = null; Dictionary <int, int> IconItems = new Dictionary <int, int>(); string[] array; if (Row["icon_items"].ToString() != "") { array = Row["icon_items"].ToString().Split(new char[] { '|' }); for (int i = 0; i < array.Length; i++) { string text2 = array[i]; if (!string.IsNullOrEmpty(text2)) { string[] array2 = text2.Replace('.', ',').Split(new char[] { ',' }); int key = 0; int value = 0; int.TryParse(array2[0], out key); if (array2.Length > 1) { int.TryParse(array2[1], out value); } try { if (!IconItems.ContainsKey(key)) { IconItems.Add(key, value); } } catch (Exception ex) { Logging.LogException(string.Concat(new string[] { "Exception: ", ex.ToString(), "[", text2, "]" })); } } } } this.myIcon = new RoomIcon((int)Row["icon_bg"], (int)Row["icon_fg"], IconItems); array = Row["tags"].ToString().Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string Tag = array[i]; this.Tags.Add(Tag); } if (ModelData.Length == 0) { this.class28_0 = Essential.GetGame().GetRoomManager().GetModel(this.ModelName, this.Id); } else { RoomModel OrgModel = Essential.GetGame().GetRoomManager().GetModel(this.ModelName, this.Id); this.class28_0 = new RoomModel("custom_model_" + this.Id, OrgModel.DoorX, OrgModel.DoorY, OrgModel.double_0, OrgModel.int_2, ModelData, "", false); } }
public void method_8(DatabaseClient class6_0) { Logging.Write("Loading Room Models.."); this.Models.Clear(); DataTable dataTable = class6_0.ReadDataTable("SELECT Id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only FROM room_models"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { string text = (string)dataRow["Id"]; this.Models.Add(text, new RoomModel(text, (int)dataRow["door_x"], (int)dataRow["door_y"], (double)dataRow["door_z"], (int)dataRow["door_dir"], (string)dataRow["heightmap"], (string)dataRow["public_items"], Essential.StringToBoolean(dataRow["club_only"].ToString()))); } Logging.WriteLine("completed!", ConsoleColor.Green); } }
public void ParsePacket(string data) { string text = data.Split(new char[] { Convert.ToChar(1) })[0]; string text2 = data.Split(new char[] { Convert.ToChar(1) })[1]; GameClient client = null; DataRow dataRow = null; string text3 = text.ToLower(); if (text3 != null) { if (MusCommands.dictionary_0 == null) { MusCommands.dictionary_0 = new Dictionary <string, int>(29) { { "update_items", 0 }, { "update_catalogue", 1 }, { "update_catalog", 2 }, { "updateusersrooms", 3 }, { "senduser", 4 }, { "updatevip", 5 }, { "giftitem", 6 }, { "giveitem", 7 }, { "unloadroom", 8 }, { "roomalert", 9 }, { "updategroup", 10 }, { "updateusersgroups", 11 }, { "shutdown", 12 }, { "update_filter", 13 }, { "refresh_filter", 14 }, { "updatecredits", 15 }, { "updatesettings", 16 }, { "updatepixels", 17 }, { "updatepoints", 18 }, { "reloadbans", 19 }, { "update_bots", 20 }, { "signout", 21 }, { "exe", 22 }, { "alert", 23 }, { "sa", 24 }, { "ha", 25 }, { "hal", 26 }, { "updatemotto", 27 }, { "update_badges", 29 }, { "update_navigator", 40 }, { "startquestion", 31 }, { "roomkick", 37 }, { "setinapp", 38 }, { "lockroom", 39 }, { "updatelook", 28 }, { "infobuspoll", 34 }, { "givebadge", 32 }, { "update_permissions", 33 }, { "update_catalogid", 35 }, { "addFriend", 36 }, { "ref_websocket", 50 }, { "eventha", 51 } }; } int num; if (MusCommands.dictionary_0.TryGetValue(text3, out num)) { uint num2; uint uint_2; Room class4; uint num3; string text5; switch (num) { case 0: using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetItemManager().Initialize(class2); goto IL_C70; } case 1: case 2: break; case 3: { Habbo class3 = Essential.GetGame().GetClientManager().GetClient(Convert.ToUInt32(text2)).GetHabbo(); if (class3 != null) { using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { class3.method_1(class2); goto IL_C70; } } goto IL_C70; } case 4: goto IL_34E; case 5: { Habbo class3 = Essential.GetGame().GetClientManager().GetClient(Convert.ToUInt32(text2)).GetHabbo(); if (class3 != null) { class3.UpdateRights(); goto IL_C70; } goto IL_C70; } case 6: case 7: { num2 = uint.Parse(text2.Split(new char[] { ' ' })[0]); uint uint_ = uint.Parse(text2.Split(new char[] { ' ' })[1]); int int_ = int.Parse(text2.Split(new char[] { ' ' })[2]); string string_ = text2.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3); Essential.GetGame().GetCatalog().CreateGift(string_, num2, uint_, int_); goto IL_C70; } case 8: uint_2 = uint.Parse(text2); class4 = Essential.GetGame().GetRoomManager().GetRoom(uint_2); Essential.GetGame().GetRoomManager().method_16(class4); goto IL_C70; case 37: num3 = uint.Parse(text2.Split(new char[] { ' ' })[0]); class4 = Essential.GetGame().GetRoomManager().GetRoom(num3); if (class4 != null) { Essential.GetGame().GetModerationTool().ClearRoomFromUsers(num3); goto IL_C70; } goto IL_C70; case 38: num3 = uint.Parse(text2.Split(new char[] { ' ' })[0]); class4 = Essential.GetGame().GetRoomManager().GetRoom(num3); if (class4 != null) { Essential.GetGame().GetModerationTool().SetInApp(num3); goto IL_C70; } goto IL_C70; case 39: num3 = uint.Parse(text2.Split(new char[] { ' ' })[0]); class4 = Essential.GetGame().GetRoomManager().GetRoom(num3); if (class4 != null) { Essential.GetGame().GetModerationTool().LockRoom(num3); goto IL_C70; } goto IL_C70; case 40: using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetNavigator().Initialize(dbClient); Essential.GetGame().GetRoomManager().method_8(dbClient); Essential.GetGame().GetRoomManager().LoadMagicTiles(dbClient); Essential.GetGame().GetRoomManager().LoadBillboards(dbClient); } goto IL_C70; case 9: num3 = uint.Parse(text2.Split(new char[] { ' ' })[0]); class4 = Essential.GetGame().GetRoomManager().GetRoom(num3); if (class4 != null) { string string_2 = text2.Substring(num3.ToString().Length + 1); for (int i = 0; i < class4.RoomUsers.Length; i++) { RoomUser class5 = class4.RoomUsers[i]; if (class5 != null && !class5.IsBot && !class5.IsPet) { class5.GetClient().SendNotification(string_2); } } goto IL_C70; } goto IL_C70; case 10: { int int_2 = int.Parse(text2.Split(new char[] { ' ' })[0]); using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Groups.UpdateGroup(class2, int_2); goto IL_C70; } } case 11: goto IL_5BF; case 12: goto IL_602; case 13: case 14: using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { ChatCommandHandler.InitWords(class2); goto IL_C70; } case 15: goto IL_633; case 16: using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Essential.GetGame().LoadServerSettings(class2); goto IL_C70; } case 17: goto IL_6F7; case 18: client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2)); if (client != null) { client.GetHabbo().UpdateVipPoints(true, false); goto IL_C70; } goto IL_C70; case 19: using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetBanManager().Initialise(class2); } Essential.GetGame().GetClientManager().UpdateBans(); goto IL_C70; case 20: using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetBotManager().Initialize(class2); goto IL_C70; } case 21: goto IL_839; case 22: using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { class2.ExecuteQuery(text2); goto IL_C70; } case 23: goto IL_880; case 24: { ServerMessage Message = new ServerMessage(Outgoing.InstantChat); Message.AppendUInt(0u); Message.AppendString("Habbo: " + text2); Message.AppendString(Essential.GetUnixTimestamp() + string.Empty); Essential.GetGame().GetClientManager().SendToStaffs(Message, Message); goto IL_C70; } case 25: { ServerMessage Message2 = new ServerMessage(Outgoing.BroadcastMessage); Message2.AppendStringWithBreak(EssentialEnvironment.GetExternalText("mus_ha_title") + "\n\n" + text2); Message2.AppendStringWithBreak(""); /*ServerMessage Message3 = new ServerMessage(161u); * Message3.AppendStringWithBreak(text2); */ Essential.GetGame().GetClientManager().SendToHotel(Message2, Message2); goto IL_C70; } case 26: { string text4 = text2.Split(new char[] { ' ' })[0]; text5 = text2.Substring(text4.Length + 1); ServerMessage Message4 = new ServerMessage(Outgoing.SendNotif); // Updated Message4.AppendStringWithBreak(string.Concat(new string[] { EssentialEnvironment.GetExternalText("mus_hal_title"), "\r\n", text5, "\r\n-", EssentialEnvironment.GetExternalText("mus_hal_tail") })); Message4.AppendStringWithBreak(text4); Essential.GetGame().GetClientManager().BroadcastMessage(Message4); goto IL_C70; } case 29: { num3 = uint.Parse(text2.Split(new char[] { ' ' })[0]); uint UserIidu3 = num3; client = Essential.GetGame().GetClientManager().GetClient(UserIidu3); if (client != null) { client.GetHabbo().GetBadgeComponent().AddBadge(text2.Split(new char[] { ' ' })[1], 0, false); } ServerMessage Message = new ServerMessage(Outgoing.AddBadge); Message.AppendInt32(1); Message.AppendInt32(4); Message.AppendInt32(1); Message.AppendUInt(0); client.SendMessage(Message); client.SendMessage(client.GetHabbo().GetBadgeComponent().ComposeBadgeListMessage()); goto IL_C70; } case 30: { uint UserIidu = uint.Parse(text2); client = Essential.GetGame().GetClientManager().GetClient(UserIidu); if (client != null) { if (client.GetHabbo().InRoom) { if (client.GetHabbo().CurrentRoom.CCTs.Contains("park")) { if (!client.GetHabbo().CurrentRoom.IsInfobusOpen) { client.GetHabbo().CurrentRoom.IsInfobusOpen = true; } else { client.GetHabbo().CurrentRoom.IsInfobusOpen = false; } for (int i = 0; i < client.GetHabbo().CurrentRoom.RoomUsers.Length; i++) { RoomUser RoomiUser = client.GetHabbo().CurrentRoom.RoomUsers[i]; if (RoomiUser != null) { ServerMessage ParkBusDoorMessage = new ServerMessage(Outgoing.ParkBusDoor); ParkBusDoorMessage.AppendBoolean(client.GetHabbo().CurrentRoom.IsInfobusOpen); RoomiUser.GetClient().SendMessage(ParkBusDoorMessage); } } } else { // client.SendNotification("Sinun täytyy olla puistossa avataksesi tietolinjurin oven!"); } } } goto IL_C70; } case 355: { uint UserIidu2 = uint.Parse(text2.Split(';')[0]); client = Essential.GetGame().GetClientManager().GetClient(UserIidu2); if (client != null) { if (client.GetHabbo().InRoom) { Room Room = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId); DataTable Data = null; int QuestionId = int.Parse(text2.Split(';')[1]); Room.CurrentPollId = QuestionId; string Question; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { Question = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionId + "' LIMIT 1"); Data = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id = '" + QuestionId + "'"); } ServerMessage InfobusQuestion = new ServerMessage(Outgoing.InfobusPoll3); // Updated InfobusQuestion.AppendStringWithBreak(Question); InfobusQuestion.AppendInt32(Data.Rows.Count); if (Data != null) { foreach (DataRow Row in Data.Rows) { InfobusQuestion.AppendInt32((int)Row["id"]); InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]); } } Room.SendMessage(InfobusQuestion, null); Thread Infobus = new Thread(delegate() { Room.ShowResults(Room, QuestionId, client); }); Infobus.Start(); } } goto IL_C70; } case 27: case 28: { uint_2 = uint.Parse(text2); client = Essential.GetGame().GetClientManager().GetClient(uint_2); using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { dataRow = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1"); } client.GetHabbo().Figure = (string)dataRow["look"]; client.GetHabbo().Gender = dataRow["gender"].ToString().ToLower(); client.GetHabbo().Motto = Essential.FilterString((string)dataRow["motto"]); client.GetHabbo().BlockNewFriends = Essential.StringToBoolean(dataRow["block_newfriends"].ToString()); /*ServerMessage Message5 = new ServerMessage(Outgoing.UpdateUserInformation); * Message5.AppendInt32(-1); * Message5.AppendStringWithBreak(client.GetHabbo().Figure); * Message5.AppendStringWithBreak(client.GetHabbo().Gender.ToLower()); * Message5.AppendStringWithBreak(client.GetHabbo().Motto); * client.SendMessage(Message5);*/ if (client.GetHabbo().InRoom) { class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId); RoomUser class6 = class4.GetRoomUserByHabbo(client.GetHabbo().Id); ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation); Message6.AppendInt32(class6.VirtualId); Message6.AppendStringWithBreak(client.GetHabbo().Figure); Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower()); Message6.AppendStringWithBreak(client.GetHabbo().Motto); Message6.AppendInt32(client.GetHabbo().AchievementScore); class4.SendMessage(Message6, null); } text3 = text.ToLower(); if (text3 == null) { goto IL_C70; } if (text3 == "updatemotto") { class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId); RoomUser class6 = class4.GetRoomUserByHabbo(client.GetHabbo().Id); ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation); Message6.AppendInt32(class6.VirtualId); Message6.AppendStringWithBreak(client.GetHabbo().Figure); Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower()); Message6.AppendStringWithBreak(client.GetHabbo().Motto); Message6.AppendInt32(client.GetHabbo().AchievementScore); class4.SendMessage(Message6, null); client.GetHabbo().MottoAchievementsCompleted(); goto IL_C70; } if (text3 == "updatelook") { ServerMessage serverMessage = new ServerMessage(Outgoing.UpdateUserInformation); serverMessage.AppendInt32(-1); serverMessage.AppendStringWithBreak(client.GetHabbo().Figure); serverMessage.AppendStringWithBreak(client.GetHabbo().Gender.ToLower()); serverMessage.AppendStringWithBreak(client.GetHabbo().Motto); serverMessage.AppendInt32(client.GetHabbo().AchievementScore); // serverMessage.AppendStringWithBreak(""); client.SendMessage(serverMessage); class4 = Essential.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId); RoomUser class6 = class4.GetRoomUserByHabbo(client.GetHabbo().Id); ServerMessage Message6 = new ServerMessage(Outgoing.UpdateUserInformation); Message6.AppendInt32(class6.VirtualId); Message6.AppendStringWithBreak(client.GetHabbo().Figure); Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower()); Message6.AppendStringWithBreak(client.GetHabbo().Motto); Message6.AppendInt32(client.GetHabbo().AchievementScore); class4.SendMessage(Message6, null); client.GetHabbo().AvatarLookAchievementsCompleted(); goto IL_C70; } goto IL_C70; } case 31: { int QuestionID = int.Parse(text2.Split(';')[1]); using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { DataRow QuestionRow = dbClient.ReadDataRow("SELECT * FROM infobus_questions WHERE id='" + QuestionID + "' LIMIT 1"); DataTable AnswersTable = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id='" + QuestionID + "'"); Room PollRoom = Essential.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().CurrentRoom; if (PollRoom.Owner == QuestionRow["owner"].ToString() || Essential.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().Rank < 5) { PollRoom.GetPollManager().SetCurrentPoll(PollRoom.GetPollManager().CreateNewRoomPoll(QuestionRow, AnswersTable)); PollRoom.SendMessage(PollRoom.GetPollManager().GetCurrentPoll().PollToServerMessage(new ServerMessage(Outgoing.InfobusPoll3)), null); Thread Poll = new Thread(delegate() { PollRoom.GetPollManager().GetCurrentPoll().ShowResults(); }); Poll.Start(); } } goto IL_C70; } case 32: { uint UserId = uint.Parse(text2.Split(new char[] { ' ' })[0]); string BadgeCode = text2.Split(new char[] { ' ' })[1]; GameClient Session = Essential.GetGame().GetClientManager().GetClientByHabbo(Essential.GetGame().GetClientManager().GetNameById(UserId)); if (Session != null) { Session.GetHabbo().GetBadgeComponent().SendBadge(Session, BadgeCode, true); } else { using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { DataRow dr = dbClient.ReadDataRow("SELECT username FROM users WHERE id=" + UserId + " LIMIT 1"); if (dr != null) { dbClient.AddParamWithValue("badge", BadgeCode); DataRow dr2 = dbClient.ReadDataRow("SELECT * FROM user_badges WHERE user_id=" + UserId + " AND badge_id=@badge LIMIT 1"); if (dr2 == null) { dbClient.AddParamWithValue("badge", BadgeCode); dbClient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO user_badges (user_id,badge_id,badge_slot) VALUES ('", UserId, "',@badge,'0')" })); } } } } } goto IL_C70; case 33: using (DatabaseClient class5 = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetRoleManager().Initialize(class5); } goto IL_C70; case 35: { using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetCatalog().Initialize(class2); } Essential.GetGame().GetCatalog().InitializeCache(); goto IL_C70; } case 36: { uint sender = uint.Parse(text2.Split(new char[] { ' ' })[0]); uint reciever = uint.Parse(text2.Split(new char[] { ' ' })[1]); if (!this.FriendshipExists(reciever, sender)) { using (DatabaseClient @class = Essential.GetDatabase().GetClient()) { @class.AddParamWithValue("toid", reciever); @class.AddParamWithValue("userid", sender); @class.ExecuteQuery("INSERT INTO messenger_friendships (user_one_id,user_two_id) VALUES (@userid,@toid)"); @class.ExecuteQuery("INSERT INTO messenger_friendships (user_one_id,user_two_id) VALUES (@toid,@userid)"); } GameClient SenderClient = Essential.GetGame().GetClientManager().GetClient(sender); GameClient RecieverClient = Essential.GetGame().GetClientManager().GetClient(reciever); if (RecieverClient != null) { RecieverClient.GetHabbo().GetMessenger().method_14(sender); } if (SenderClient != null) { SenderClient.GetHabbo().GetMessenger().method_14(reciever); } } goto IL_C70; } case 50: { Essential.getWebSocketManager().Dispose(); Essential.InitWebsocketManager(); goto IL_C70; } case 51: { Room room = Essential.GetGame().GetRoomManager().GetRoom(uint.Parse(text2.Split(';')[0])); string Eventname = text2.Split(';')[1]; if (Eventname.Length > 1) { Eventname = AntiAd.Utf8ToUtf16(Eventname); string toSend = "5|" + Eventname + "|" + room.Owner + "|" + room.Id; Essential.getWebSocketManager().SendMessageToEveryConnection(toSend); using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.AddParamWithValue("param1", room.Id); dbClient.AddParamWithValue("param2", Eventname); dbClient.ExecuteQuery("INSERT INTO hp_aktivitaetenstream (`user_id`,`type`,`extra_data`,`extra_data2`,`timestamp`) VALUES ('" + room.OwnerId + "','makeevent',@param1,@param2,'" + Convert.ToInt32(Essential.GetUnixTimestamp()) + "');"); } } goto IL_C70; } default: goto IL_C70; } using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetCatalog().Initialize(class2); } Essential.GetGame().GetCatalog().InitializeCache(); Essential.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(Outgoing.UpdateShop)); // Updated goto IL_C70; IL_34E: num2 = uint.Parse(text2.Split(new char[] { ' ' })[0]); num3 = uint.Parse(text2.Split(new char[] { ' ' })[1]); GameClient class7 = Essential.GetGame().GetClientManager().GetClient(num2); class4 = Essential.GetGame().GetRoomManager().GetRoom(num3); if (class7 != null) { ServerMessage Message = new ServerMessage(Outgoing.RoomForward); Message.AppendBoolean(class4.IsPublic); Message.AppendUInt(class4.Id); class7.SendMessage(Message); goto IL_C70; } goto IL_C70; IL_5BF: uint_2 = uint.Parse(text2); using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { Essential.GetGame().GetClientManager().GetClient(uint_2).GetHabbo().method_0(class2); goto IL_C70; } IL_602: Essential.Close(); goto IL_C70; IL_633: client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2)); if (client != null) { int int_3 = 0; using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { int_3 = (int)class2.ReadDataRow("SELECT credits FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0]; } client.GetHabbo().SetCredits(int_3, "MUS UPDATE", ""); client.GetHabbo().UpdateCredits(false); goto IL_C70; } goto IL_C70; IL_6F7: client = Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2)); if (client != null) { int int_4 = 0; using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { int_4 = (int)class2.ReadDataRow("SELECT activity_points FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0]; } client.GetHabbo().ActivityPoints = int_4; client.GetHabbo().UpdateActivityPoints(false); goto IL_C70; } goto IL_C70; IL_839: Essential.GetGame().GetClientManager().GetClient(uint.Parse(text2)).Disconnect("MUS"); goto IL_C70; IL_880: string text6 = text2.Split(new char[] { ' ' })[0]; text5 = text2.Substring(text6.Length + 1); Essential.GetGame().GetClientManager().GetClient(uint.Parse(text6)).SendNotification(text5); } } IL_C70: try { ServerMessage Message9 = new ServerMessage(Outgoing.MusAnswer); Message9.AppendString("Essential 5"); Message9.AppendString("MUS Handler"); this.ClientSocket.Send(Message9.GetBytes()); } catch {} }
public AvatarEffectsInventoryComponent(uint uint_1, GameClient class16_1, UserDataFactory class12_0) { this.Session = class16_1; this.list_0 = new List <AvatarEffect>(); this.uint_0 = uint_1; this.int_0 = -1; this.list_0.Clear(); DataTable dataTable_ = class12_0.GetEffects(); StringBuilder stringBuilder = new StringBuilder(); foreach (DataRow dataRow in dataTable_.Rows) { AvatarEffect @class = new AvatarEffect((int)dataRow["effect_id"], (int)dataRow["total_duration"], Essential.StringToBoolean(dataRow["is_activated"].ToString()), (double)dataRow["activated_stamp"]); if (@class.Boolean_0) { stringBuilder.Append(string.Concat(new object[] { "DELETE FROM user_effects WHERE user_id = '", uint_1, "' AND effect_id = '", @class.int_0, "' LIMIT 1; " })); } else { this.list_0.Add(@class); } } if (stringBuilder.Length > 0) { using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { class2.ExecuteQuery(stringBuilder.ToString()); } } }
public void Initialize(DatabaseClient class6_0) { if (!isLoading) { isLoading = true; Logging.Write("Loading Items.."); this.dictionary_0 = new Dictionary <uint, Item>(); // this.FurnitureAliases = new List<string>(); DataTable dataTable = class6_0.ReadDataTable("SELECT * FROM furniture;"); // DataTable dataTable2 = class6_0.ReadDataTable("SELECT * FROM furniture_aliases WHERE branding_enabled = '1';"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { try { this.dictionary_0.Add((uint)dataRow["Id"], new Item((uint)dataRow["Id"], (int)dataRow["sprite_id"], (string)dataRow["public_name"], (string)dataRow["item_name"], (string)dataRow["type"], (int)dataRow["width"], (int)dataRow["length"], (double)dataRow["stack_height"], Essential.StringToBoolean(dataRow["can_stack"].ToString()), Essential.StringToBoolean(dataRow["is_walkable"].ToString()), Essential.StringToBoolean(dataRow["can_sit"].ToString()), Essential.StringToBoolean(dataRow["allow_recycle"].ToString()), Essential.StringToBoolean(dataRow["allow_trade"].ToString()), Essential.StringToBoolean(dataRow["allow_marketplace_sell"].ToString()), Essential.StringToBoolean(dataRow["allow_gift"].ToString()), Essential.StringToBoolean(dataRow["allow_inventory_stack"].ToString()), (string)dataRow["interaction_type"], (int)dataRow["interaction_modes_count"], (string)dataRow["vending_ids"], dataRow["height_adjustable"].ToString(), Convert.ToByte((int)dataRow["EffectF"]), Convert.ToByte((int)dataRow["EffectM"]), Essential.StringToBoolean(dataRow["HeightOverride"].ToString()))); } catch (Exception e) { Logging.WriteLine("Could not load item #" + (uint)dataRow["Id"] + ", please verify the data is okay."); Logging.LogItemError(e.Message); } } } /* if (dataTable2 != null) * { * foreach (DataRow dataRow in dataTable2.Rows) * { * try * { * this.FurnitureAliases.Add((string)dataRow["item_name"]); * } * catch (Exception e) * { * Logging.WriteLine("Could not load furniture alias " + (string)dataRow["item_name"] + "."); * Logging.LogItemError(e.Message); * } * } * } * */ Logging.WriteLine("completed!", ConsoleColor.Green); /*Logging.smethod_0("Loading Soundtracks.."); //OMA LUOTU :3 * this.dictionary_1 = new Dictionary<int, Soundtrack>(); * DataTable dataTable2 = class6_0.ReadDataTable("SELECT * FROM soundtracks;"); * if (dataTable2 != null) * { * foreach (DataRow dataRow in dataTable2.Rows) * { * try * { * this.dictionary_1.Add((int)dataRow["Id"], new Soundtrack((int)dataRow["Id"], (string)dataRow["name"], (string)dataRow["author"], (string)dataRow["track"], (int)dataRow["length"])); * } * catch (Exception) * { * Logging.WriteLine("Could not load item #" + (uint)dataRow["Id"] + ", please verify the data is okay."); * } * } * } * Logging.WriteLine("completed!", ConsoleColor.Green);*/ Logging.Write("Loading Soundtracks.."); SongManager.Initialize(); Logging.WriteLine("completed!", ConsoleColor.Green); isLoading = false; } }
public void LoadServerSettings(DatabaseClient class6_0) { Logging.Write("Loading your settings.."); DataRow dataRow = class6_0.ReadDataRow("SELECT * FROM server_settings LIMIT 1"); ServerConfiguration.RoomUserLimit = (int)dataRow["MaxRoomsPerUser"]; ServerConfiguration.MOTD = (string)dataRow["motd"]; ServerConfiguration.CreditingInterval = (int)dataRow["timer"]; ServerConfiguration.CreditingAmount = (int)dataRow["credits"]; ServerConfiguration.PointingAmount = (int)dataRow["pixels"]; ServerConfiguration.PixelingAmount = (int)dataRow["points"]; ServerConfiguration.PixelLimit = (int)dataRow["pixels_max"]; ServerConfiguration.CreditLimit = (int)dataRow["credits_max"]; ServerConfiguration.PointLimit = (int)dataRow["points_max"]; ServerConfiguration.PetsPerRoomLimit = (int)dataRow["MaxPetsPerRoom"]; ServerConfiguration.MarketplacePriceLimit = (int)dataRow["MaxMarketPlacePrice"]; ServerConfiguration.MarketplaceTax = (int)dataRow["MarketPlaceTax"]; ServerConfiguration.DDoSProtectionEnabled = Essential.StringToBoolean(dataRow["enable_antiddos"].ToString()); ServerConfiguration.HabboClubForClothes = Essential.StringToBoolean(dataRow["vipclothesforhcusers"].ToString()); ServerConfiguration.EnableChatlog = Essential.StringToBoolean(dataRow["enable_chatlogs"].ToString()); ServerConfiguration.EnableCommandLog = Essential.StringToBoolean(dataRow["enable_cmdlogs"].ToString()); ServerConfiguration.EnableRoomLog = Essential.StringToBoolean(dataRow["enable_roomlogs"].ToString()); ServerConfiguration.EnableExternalLinks = (string)dataRow["enable_externalchatlinks"]; ServerConfiguration.EnableSSO = Essential.StringToBoolean(dataRow["enable_securesessions"].ToString()); ServerConfiguration.AllowFurniDrops = Essential.StringToBoolean(dataRow["allow_friendfurnidrops"].ToString()); ServerConfiguration.EnableRedeemCredits = Essential.StringToBoolean(dataRow["enable_cmd_redeemcredits"].ToString()); ServerConfiguration.EnableRedeemPixels = Essential.StringToBoolean(dataRow["enable_cmd_redeempixels"].ToString()); ServerConfiguration.EnableRedeemShells = Essential.StringToBoolean(dataRow["enable_cmd_redeemshells"].ToString()); ServerConfiguration.UnloadCrashedRooms = Essential.StringToBoolean(dataRow["unload_crashedrooms"].ToString()); ServerConfiguration.ShowUsersAndRoomsInAbout = Essential.StringToBoolean(dataRow["ShowUsersAndRoomsInAbout"].ToString()); ServerConfiguration.SleepTimer = (int)dataRow["idlesleep"]; ServerConfiguration.KickTimer = (int)dataRow["idlekick"]; ServerConfiguration.IPLastBan = Essential.StringToBoolean(dataRow["ip_lastforbans"].ToString()); ServerConfiguration.StaffPicksID = (int)dataRow["StaffPicksCategoryID"]; ServerConfiguration.VIPHotelAlertInterval = (double)dataRow["vipha_interval"]; ServerConfiguration.VIPHotelAlertLinkInterval = (double)dataRow["viphal_interval"]; // ServerConfiguration.BasejumpMaintenance = Essential.StringToBoolean(dataRow["basejump_maintenance"].ToString()); ServerConfiguration.PreventDoorPush = Essential.StringToBoolean(dataRow["DisableOtherUsersToMovingOtherUsersToDoor"].ToString()); Logging.WriteLine("completed!", ConsoleColor.Green); }
public void Handle(GameClient Session, ClientMessage Event) { if (!Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { return; } Room room = Session.GetHabbo().CurrentRoom; uint id = Event.PopWiredUInt(); int ActionType = Event.PopWiredInt32(); RoomUser BotUser = room.getBot(id); /*string Username = Event.PopFixedString(); * * BotUser.RoomBot.Name = Username; * using(DatabaseClient dbClient = Essential.GetDatabase().GetClient()) * { * dbClient.AddParamWithValue("username", Username); * dbClient.ExecuteQuery("UPDATE user_bots SET name=@username WHERE id=" + id); * }*/ List <RandomSpeech> list = new List <RandomSpeech>(); List <BotResponse> list2 = new List <BotResponse>(); int currentX = BotUser.X; int currentY = BotUser.Y; int currentRot = BotUser.BodyRotation; double currentH = BotUser.double_0; UserBot bot = null; switch (ActionType) { case 1: string Look = Session.GetHabbo().Figure; BotUser.RoomBot.Look = Look; room.method_6(BotUser.VirtualId, false); using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.AddParamWithValue("look", Look); dbClient.ExecuteQuery("UPDATE user_bots SET look=@look WHERE id=" + id); bot = Essential.GetGame().GetCatalog().RetrBot(dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id=" + id)); } room.AddBotToRoom(new RoomBot(id, Session.GetHabbo().CurrentRoomId, AIType.UserBot, "freeroam", BotUser.RoomBot.Name, BotUser.RoomBot.Motto, Look, currentX, currentY, 0, currentRot, 0, 0, 0, 0, ref list, ref list2, 0), bot); break; case 2: string Data = Event.PopFixedString(); DataRow BotData; string[] firstdata = Data.Split(';'); string[] toinendata = firstdata[0].Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); string automaticChat = firstdata[2]; string speakingInterval = firstdata[4]; //seconds if (String.IsNullOrEmpty(speakingInterval) || Convert.ToInt32(speakingInterval) <= 0) { speakingInterval = "7"; } using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery("DELETE FROM bots_speech WHERE bot_id = '" + id + "'"); } for (int i = 0; i <= toinendata.Length - 1; i++) { using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.AddParamWithValue("data", toinendata[i]); dbClient.ExecuteQuery("INSERT INTO `bots_speech` (`bot_id`, `text`) VALUES ('" + id + "', @data)"); dbClient.ExecuteQuery("UPDATE user_bots SET automatic_chat='" + automaticChat + "',speaking_interval=" + Convert.ToInt32(speakingInterval) + " WHERE id = " + id); } } using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { BotData = dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id = '" + id + "'"); } DataTable BotSpeech; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { BotSpeech = dbClient.ReadDataTable("SELECT text, shout, bot_id FROM bots_speech;"); bot = Essential.GetGame().GetCatalog().RetrBot(dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id=" + id)); } foreach (DataRow Row2 in BotSpeech.Rows) { list.Add(new RandomSpeech((string)Row2["text"], Essential.StringToBoolean(Row2["shout"].ToString()), Convert.ToUInt32(Row2["bot_id"]))); } room.method_6(BotUser.VirtualId, false); room.AddBotToRoom(new RoomBot((uint)BotData["id"], (uint)BotData["room_id"], AIType.UserBot, "freeroam", (string)BotData["name"], (string)BotData["motto"], (string)BotData["look"], currentX, currentY, 0, currentRot, 0, 0, 0, 0, ref list, ref list2, (int)Session.GetHabbo().Id), bot); break; case 3: //stop dancing break; case 4: if (BotUser.DanceId > 0) { BotUser.DanceId = 0; } else { Random rnd = new Random(); BotUser.DanceId = rnd.Next(1, 4); } ServerMessage message = new ServerMessage(Outgoing.Dance); message.AppendInt32(BotUser.VirtualId); message.AppendInt32(BotUser.DanceId); Session.GetHabbo().CurrentRoom.SendMessage(message, null); break; case 5: string Username = Event.PopFixedString(); if (!Essential.IsValidName(Username)) { break; } BotUser.RoomBot.Name = Username; room.method_6(BotUser.VirtualId, false); using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.AddParamWithValue("username", Username); dbClient.ExecuteQuery("UPDATE user_bots SET name=@username WHERE id=" + id); bot = Essential.GetGame().GetCatalog().RetrBot(dbClient.ReadDataRow("SELECT * FROM user_bots WHERE id=" + id)); } room.AddBotToRoom(new RoomBot(id, Session.GetHabbo().CurrentRoomId, AIType.UserBot, "freeroam", Username, BotUser.RoomBot.Motto, BotUser.RoomBot.Look, currentX, currentY, 0, currentRot, 0, 0, 0, 0, ref list, ref list2, 0), bot); break; default: //nothing break; } }
public static void Load(DatabaseClient class6_0) { Logging.Write("Loading Achievements.."); AchievementManager.dictionary_0.Clear(); DataTable dataTable = class6_0.ReadDataTable("SELECT * FROM achievements"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { AchievementManager.dictionary_0.Add((uint)dataRow["Id"], new Achievement((uint)dataRow["Id"], (string)dataRow["type"], (int)dataRow["levels"], (string)dataRow["badge"], (int)dataRow["pixels_base"], (double)dataRow["pixels_multiplier"], Essential.StringToBoolean(dataRow["dynamic_badgelevel"].ToString()), (int)dataRow["score_base"], (int)dataRow["pixels_base"])); } AchievementManager.dictionary_1.Clear(); dataTable = class6_0.ReadDataTable("SELECT * FROM badges"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { AchievementManager.dictionary_1.Add((string)dataRow["badge"], (uint)dataRow["Id"]); } Logging.WriteLine("completed!", ConsoleColor.Green); } } }