internal static RoomBot GenerateBotFromRow(DataRow Row) { uint num = Convert.ToUInt32(Row["id"]); if (Row == null) { return(null); } List <RandomSpeech> list = new List <RandomSpeech>(); DataTable table; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT text, shout FROM bots_speech WHERE bot_id = @id;"); queryreactor.addParameter("id", num); table = queryreactor.getTable(); } foreach (DataRow dataRow in table.Rows) { list.Add(new RandomSpeech((string)dataRow["text"], CyberEnvironment.EnumToBool(dataRow["shout"].ToString()))); } List <BotResponse> list2 = new List <BotResponse>(); return(new RoomBot(num, Convert.ToUInt32(Row["user_id"]), Convert.ToUInt32(Row["room_id"]), AIType.Generic, "freeroam", (string)Row["name"], (string)Row["motto"], (string)Row["look"], int.Parse(Row["x"].ToString()), int.Parse(Row["y"].ToString()), (double)int.Parse(Row["z"].ToString()), 4, 0, 0, 0, 0, ref list, ref list2, (string)Row["gender"], (int)Row["dance"], Row["is_bartender"].ToString() == "1")); }
internal void LoadItems(IQueryAdapter dbClient) { this.Items = new Dictionary <uint, Item>(); dbClient.setQuery("SELECT * FROM furniture"); DataTable table = dbClient.getTable(); if (table != null) { string[] array = null; foreach (DataRow dataRow in table.Rows) { try { uint num = Convert.ToUInt32(dataRow["id"]); int sprite = (int)dataRow["sprite_id"]; int flatId = (int)dataRow["flat_id"]; string publicName = (string)dataRow["public_name"]; string name = (string)dataRow["item_name"]; string type = dataRow["type"].ToString(); int width = (int)dataRow["width"]; int length = (int)dataRow["length"]; double height; if (dataRow["stack_height"].ToString().Contains(";")) { array = dataRow["stack_height"].ToString().Split(new char[] { ';' }); height = Convert.ToDouble(array[0]); } else { height = Convert.ToDouble(dataRow["stack_height"]); } bool stackable = Convert.ToInt32(dataRow["can_stack"]) == 1; bool walkable = Convert.ToInt32(dataRow["is_walkable"]) == 1; bool isSeat = Convert.ToInt32(dataRow["can_sit"]) == 1; bool allowRecycle = Convert.ToInt32(dataRow["allow_recycle"]) == 1; bool allowTrade = Convert.ToInt32(dataRow["allow_trade"]) == 1; bool allowMarketplaceSell = Convert.ToInt32(dataRow["allow_marketplace_sell"]) == 1; bool allowGift = Convert.ToInt32(dataRow["allow_gift"]) == 1; bool allowInventoryStack = Convert.ToInt32(dataRow["allow_inventory_stack"]) == 1; InteractionType typeFromString = InterractionTypes.GetTypeFromString((string)dataRow["interaction_type"]); int modes = (int)dataRow["interaction_modes_count"]; string vendingIds = (string)dataRow["vending_ids"]; bool sub = CyberEnvironment.EnumToBool(dataRow["subscriber"].ToString()); int effect = (int)dataRow["effectid"]; bool stackMultiple = CyberEnvironment.EnumToBool(dataRow["stack_multiplier"].ToString()); Item value = new Item(num, sprite, publicName, name, type, width, length, height, stackable, walkable, isSeat, allowRecycle, allowTrade, allowMarketplaceSell, allowGift, allowInventoryStack, typeFromString, modes, vendingIds, sub, effect, stackMultiple, array, flatId); this.Items.Add(num, value); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadKey(); Logging.WriteLine("Could not load item #" + Convert.ToUInt32(dataRow[0]) + ", please verify the data is okay.", ConsoleColor.Gray); } } } }
internal static MoodlightPreset GeneratePreset(string Data) { string[] array = Data.Split(new char[] { ',' }); if (!MoodlightData.IsValidColor(array[0])) { array[0] = "#000000"; } return(new MoodlightPreset(array[0], int.Parse(array[1]), CyberEnvironment.EnumToBool(array[2]))); }
internal MoodlightData(uint ItemId) { this.ItemId = ItemId; DataRow row; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id = " + ItemId); row = queryreactor.getRow(); } if (row == null) { throw new NullReferenceException("No moodlightdata found in the database"); } this.Enabled = CyberEnvironment.EnumToBool(row["enabled"].ToString()); this.CurrentPreset = (int)row["current_preset"]; this.Presets = new List <MoodlightPreset>(); this.Presets.Add(MoodlightData.GeneratePreset((string)row["preset_one"])); this.Presets.Add(MoodlightData.GeneratePreset((string)row["preset_two"])); this.Presets.Add(MoodlightData.GeneratePreset((string)row["preset_three"])); }
internal static Habbo GenerateHabbo(DataRow dRow, DataRow mRow, HashSet <GroupUser> group) { uint id = uint.Parse(dRow["id"].ToString()); string username = (string)dRow["username"]; string realName = (string)dRow["real_name"]; uint ras = uint.Parse(dRow["rank"].ToString()); string motto = (string)dRow["motto"]; string look = (string)dRow["look"]; string gender = (string)dRow["gender"]; int lastOnline = int.Parse(dRow["last_online"].ToString()); int credits = (int)dRow["credits"]; int activityPoints = (int)dRow["activity_points"]; double lastActivityPointsUpdate = Convert.ToDouble(dRow["activity_points_lastupdate"]); bool muted = CyberEnvironment.EnumToBool(dRow["is_muted"].ToString()); uint homeRoom = Convert.ToUInt32(dRow["home_room"]); int respect = (int)mRow["respect"]; int dailyRespectPoints = (int)mRow["daily_respect_points"]; int dailyPetRespectPoints = (int)mRow["daily_pet_respect_points"]; bool hasFriendRequestsDisabled = CyberEnvironment.EnumToBool(dRow["block_newfriends"].ToString()); bool appearOffline = CyberEnvironment.EnumToBool(dRow["hide_online"].ToString()); bool hideInRoom = CyberEnvironment.EnumToBool(dRow["hide_inroom"].ToString()); uint currentQuestID = Convert.ToUInt32(mRow["quest_id"]); int currentQuestProgress = (int)mRow["quest_progress"]; int achievementPoints = (int)mRow["achievement_score"]; bool vIP = CyberEnvironment.EnumToBool(dRow["vip"].ToString()); double createDate = Convert.ToDouble(dRow["account_created"]); bool online = CyberEnvironment.EnumToBool(dRow["online"].ToString()); string citizenship = dRow["talent_status"].ToString(); int belCredits = int.Parse(dRow["seasonal_currency"].ToString()); uint favId = uint.Parse(mRow["favourite_group"].ToString()); int lastChange = (int)dRow["last_name_change"]; int regTimestamp = int.Parse(dRow["account_created"].ToString()); bool tradeLocked = CyberEnvironment.EnumToBool(dRow["trade_lock"].ToString()); int tradeLockExpire = int.Parse(dRow["trade_lock_expire"].ToString()); bool NuxPassed = CyberEnvironment.EnumToBool(dRow["nux_passed"].ToString()); return(new Habbo(id, username, realName, ras, motto, look, gender, credits, activityPoints, lastActivityPointsUpdate, muted, homeRoom, respect, dailyRespectPoints, dailyPetRespectPoints, hasFriendRequestsDisabled, currentQuestID, currentQuestProgress, achievementPoints, regTimestamp, lastOnline, appearOffline, hideInRoom, vIP, createDate, online, citizenship, belCredits, group, favId, lastChange, tradeLocked, tradeLockExpire, NuxPassed)); }
internal void InitUserBots() { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT * FROM bots WHERE room_id = " + this.RoomId + " AND ai_type = 'generic'"); DataTable table = queryreactor.getTable(); if (table != null) { foreach (DataRow dataRow in table.Rows) { queryreactor.setQuery("SELECT text, shout FROM bots_speech WHERE bots_speech.bot_id = '" + dataRow["id"] + "';"); DataTable table2 = queryreactor.getTable(); RoomBot roomBot = BotManager.GenerateBotFromRow(dataRow); List <RandomSpeech> list = new List <RandomSpeech>(); foreach (DataRow dataRow2 in table2.Rows) { list.Add(new RandomSpeech((string)dataRow2["text"], CyberEnvironment.EnumToBool(dataRow2["shout"].ToString()))); } List <BotResponse> list2 = new List <BotResponse>(); this.roomUserManager.DeployBot(new RoomBot(roomBot.BotId, roomBot.OwnerId, this.RoomId, AIType.Generic, "freeroam", roomBot.Name, roomBot.Motto, roomBot.Look, roomBot.X, roomBot.Y, (double)checked ((int)roomBot.Z), 4, 0, 0, 0, 0, ref list, ref list2, roomBot.Gender, roomBot.DanceId, roomBot.IsBartender), null); } } } }
public void Initialize(IQueryAdapter dbClient) { dbClient.setQuery("SELECT id,caption,min_rank FROM navigator_flatcats WHERE enabled = 2"); DataTable table = dbClient.getTable(); dbClient.setQuery("SELECT * FROM navigator_publics ORDER BY ordernum ASC"); DataTable table2 = dbClient.getTable(); if (table != null) { this.PrivateCategories.Clear(); foreach (DataRow dataRow in table.Rows) { this.PrivateCategories.Add((int)dataRow["id"], new FlatCat((int)dataRow["id"], (string)dataRow["caption"], (int)dataRow["min_rank"])); } } if (table2 != null) { this.PublicItems.Clear(); foreach (DataRow dataRow2 in table2.Rows) { this.PublicItems.Add((int)dataRow2["id"], new PublicItem((int)dataRow2["id"], int.Parse(dataRow2["bannertype"].ToString()), (string)dataRow2["caption"], (string)dataRow2["description"], (string)dataRow2["image"], (dataRow2["image_type"].ToString().ToLower() == "internal") ? PublicImageType.INTERNAL : PublicImageType.EXTERNAL, Convert.ToUInt32(dataRow2["room_id"]), (int)dataRow2["category_id"], (int)dataRow2["category_parent_id"], CyberEnvironment.EnumToBool(dataRow2["recommended"].ToString()), (int)dataRow2["typeofdata"], (string)dataRow2["tag"])); } } }
internal static UserData GetUserData(string sessionTicket, string ip, out byte errorCode) { DataTable dataTable = null; DataRow dataRow; uint Userid; DataTable dataTable2; DataTable table; DataRow row; DataTable dataTable3; DataTable dataTable4; DataTable dataTable5; DataRow dataRow2; DataTable dataTable6; DataTable dataTable7; DataTable dataTable8; DataTable dataTable9; DataTable dataTable10; DataTable dataTable11; DataTable dataTable12; DataTable dataTable13; DataTable table2; DataTable dataTable14; DataTable dataTable15; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT * FROM users WHERE auth_ticket = @sso "); queryreactor.addParameter("sso", sessionTicket); queryreactor.addParameter("ipaddress", ip); dataRow = queryreactor.getRow(); if (dataRow == null) { errorCode = 1; throw new UserDataNotFoundException(string.Format("No user found with ip {0} and sso {1}.", ip, sessionTicket)); } Userid = Convert.ToUInt32(dataRow["id"]); queryreactor.runFastQuery("UPDATE users SET online='1' WHERE id=" + Userid + " LIMIT 1"); if (CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(Userid) != null) { errorCode = 2; CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(Userid).Disconnect(); return(null); } queryreactor.setQuery("SELECT * FROM user_achievement WHERE userid = " + Userid); dataTable2 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_talents WHERE userid = " + Userid); table = queryreactor.getTable(); queryreactor.setQuery("SELECT COUNT(*) FROM user_stats WHERE id=" + Userid); if (int.Parse(queryreactor.getString()) == 0) { queryreactor.runFastQuery("INSERT INTO user_stats (id) VALUES (" + Userid + ");"); } queryreactor.setQuery("SELECT * FROM user_stats WHERE id=" + Userid + " LIMIT 1"); row = queryreactor.getRow(); queryreactor.setQuery("SELECT room_id FROM user_favorites WHERE user_id = " + Userid); dataTable3 = queryreactor.getTable(); queryreactor.setQuery("SELECT ignore_id FROM user_ignores WHERE user_id = " + Userid); dataTable4 = queryreactor.getTable(); queryreactor.setQuery("SELECT tag FROM user_tags WHERE user_id = " + Userid); dataTable5 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_subscriptions WHERE user_id = " + Userid + " AND timestamp_expire > UNIX_TIMESTAMP() ORDER BY subscription_id DESC LIMIT 1"); dataRow2 = queryreactor.getRow(); queryreactor.setQuery("SELECT * FROM user_badges WHERE user_id = " + Userid); dataTable6 = queryreactor.getTable(); queryreactor.setQuery("SELECT `items`.* , COALESCE(`items_groups`.`group_id`, 0) AS group_id FROM `items` LEFT OUTER JOIN `items_groups` ON `items`.`id` = `items_groups`.`id` WHERE room_id='0' AND user_id=" + Userid + " LIMIT 8000"); dataTable7 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_effects WHERE user_id = " + Userid); dataTable8 = queryreactor.getTable(); queryreactor.setQuery("SELECT poll_id FROM user_polldata WHERE user_id = " + Userid + " GROUP BY poll_id;"); dataTable9 = queryreactor.getTable(); queryreactor.setQuery(string.Concat(new object[] { "SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_one_id WHERE messenger_friendships.user_two_id = ", Userid, " UNION ALL SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = ", Userid })); dataTable10 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_stats WHERE id=" + Userid + " LIMIT 1"); row = queryreactor.getRow(); queryreactor.setQuery("SELECT messenger_requests.from_id,messenger_requests.to_id,users.username FROM users JOIN messenger_requests ON users.id = messenger_requests.from_id WHERE messenger_requests.to_id = " + Userid); dataTable11 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM rooms WHERE owner = @name LIMIT 150"); queryreactor.addParameter("name", (string)dataRow["username"]); dataTable12 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM bots WHERE user_id = " + Userid + " AND room_id = 0 AND ai_type='pet'"); dataTable13 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_quests WHERE user_id = " + Userid); table2 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM bots WHERE user_id=" + Userid + " AND room_id=0 AND ai_type='generic'"); dataTable14 = queryreactor.getTable(); queryreactor.setQuery("SELECT group_id,rank FROM group_memberships WHERE user_id=" + Userid); dataTable = queryreactor.getTable(); queryreactor.setQuery(string.Concat(new object[] { "UPDATE user_info SET login_timestamp = '", CyberEnvironment.GetUnixTimestamp(), "' WHERE user_id = ", Userid, " ; " })); queryreactor.addParameter("ip", ip); queryreactor.runQuery(); queryreactor.setQuery("SELECT * FROM user_relationships WHERE user_id=@id"); queryreactor.addParameter("id", Userid); dataTable15 = queryreactor.getTable(); queryreactor.runFastQuery("UPDATE users SET online='1' WHERE id=" + Userid + " LIMIT 1"); } Dictionary <string, UserAchievement> dictionary = new Dictionary <string, UserAchievement>(); foreach (DataRow dataRow3 in dataTable2.Rows) { string text = (string)dataRow3["group"]; int level = (int)dataRow3["level"]; int progress = (int)dataRow3["progress"]; UserAchievement value = new UserAchievement(text, level, progress); dictionary.Add(text, value); } Dictionary <int, UserTalent> dictionary2 = new Dictionary <int, UserTalent>(); foreach (DataRow dataRow4 in table.Rows) { int num2 = (int)dataRow4["talent_id"]; int state = (int)dataRow4["talent_state"]; UserTalent value2 = new UserTalent(num2, state); dictionary2.Add(num2, value2); } List <uint> list = new List <uint>(); foreach (DataRow dataRow5 in dataTable3.Rows) { uint item = Convert.ToUInt32(dataRow5["room_id"]); list.Add(item); } List <uint> list2 = new List <uint>(); foreach (DataRow dataRow6 in dataTable4.Rows) { uint item2 = Convert.ToUInt32(dataRow6["ignore_id"]); list2.Add(item2); } List <string> list3 = new List <string>(); foreach (DataRow dataRow7 in dataTable5.Rows) { string item3 = dataRow7["tag"].ToString().Replace(" ", ""); list3.Add(item3); } Subscription sub = null; if (dataRow2 != null) { sub = new Subscription((int)dataRow2["subscription_id"], (int)dataRow2["timestamp_activated"], (int)dataRow2["timestamp_expire"], (int)dataRow2["timestamp_lastgift"]); } Dictionary <uint, RoomBot> dictionary3 = new Dictionary <uint, RoomBot>(); foreach (DataRow row2 in dataTable14.Rows) { RoomBot roomBot = BotManager.GenerateBotFromRow(row2); dictionary3.Add(roomBot.BotId, roomBot); } List <Badge> list4 = new List <Badge>(); foreach (DataRow dataRow8 in dataTable6.Rows) { string code = (string)dataRow8["badge_id"]; int slot = (int)dataRow8["badge_slot"]; list4.Add(new Badge(code, slot)); } int miniMailCount = 0; try { DataRow Rowi; using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { dbClient.setQuery("SELECT Count( IsReaded ) FROM xdrcms_minimail WHERE InBin = 0 AND IsReaded = 0 AND SenderId != " + Userid + " AND OwnerId = " + Userid); Rowi = dbClient.getRow(); } if (Rowi != null) { // We are using aXDR CMS with MiniMail! miniMailCount = int.Parse(Rowi[0].ToString()); } } catch { } List <UserItem> list5 = new List <UserItem>(); foreach (DataRow dataRow9 in dataTable7.Rows) { uint id = Convert.ToUInt32(dataRow9[0]); uint baseItem = Convert.ToUInt32(dataRow9[3]); string extraData; if (!DBNull.Value.Equals(dataRow9[4])) { extraData = (string)dataRow9[4]; } else { extraData = string.Empty; } uint group = Convert.ToUInt32(dataRow9["group_id"]); string songCode = (string)dataRow9["songcode"]; list5.Add(new UserItem(id, baseItem, extraData, group, songCode)); } List <AvatarEffect> list6 = new List <AvatarEffect>(); foreach (DataRow dataRow10 in dataTable8.Rows) { int effectId = (int)dataRow10["effect_id"]; int totalDuration = (int)dataRow10["total_duration"]; bool activated = CyberEnvironment.EnumToBool((string)dataRow10["is_activated"]); double activateTimestamp = (double)dataRow10["activated_stamp"]; list6.Add(new AvatarEffect(effectId, totalDuration, activated, activateTimestamp)); } HashSet <uint> pollSuggested = new HashSet <uint>(); foreach (DataRow Row in dataTable9.Rows) { uint pId = (uint)Row["poll_id"]; pollSuggested.Add(pId); } Dictionary <uint, MessengerBuddy> dictionary4 = new Dictionary <uint, MessengerBuddy>(); string arg_A3D_0 = (string)dataRow["username"]; int num3 = checked (dataTable10.Rows.Count - 700); if (num3 > 0) { using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor2.runFastQuery(string.Concat(new object[] { "DELETE FROM messenger_friendships WHERE user_one_id=", Userid, " OR user_two_id=", Userid, " LIMIT ", num3 })); queryreactor2.setQuery(string.Concat(new object[] { "SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_one_id WHERE messenger_friendships.user_two_id = ", Userid, " UNION ALL SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = ", Userid })); dataTable10 = queryreactor2.getTable(); } } foreach (DataRow dataRow12 in dataTable10.Rows) { uint num4 = Convert.ToUInt32(dataRow12["id"]); string pUsername = (string)dataRow12["username"]; string pLook = (string)dataRow12["look"]; string pMotto = (string)dataRow12["motto"]; int pLastOnline = Convert.ToInt32(dataRow12["last_online"]); bool pAppearOffline = CyberEnvironment.EnumToBool(dataRow12["hide_online"].ToString()); bool pHideInroom = CyberEnvironment.EnumToBool(dataRow12["hide_inroom"].ToString()); if (num4 != Userid && !dictionary4.ContainsKey(num4)) { dictionary4.Add(num4, new MessengerBuddy(num4, pUsername, pLook, pMotto, pLastOnline, pAppearOffline, pHideInroom)); } } Dictionary <uint, MessengerRequest> dictionary5 = new Dictionary <uint, MessengerRequest>(); foreach (DataRow dataRow13 in dataTable11.Rows) { uint num5 = Convert.ToUInt32(dataRow13["from_id"]); uint num6 = Convert.ToUInt32(dataRow13["to_id"]); string pUsername2 = (string)dataRow13["username"]; if (num5 != Userid) { if (!dictionary5.ContainsKey(num5)) { dictionary5.Add(num5, new MessengerRequest(Userid, num5, pUsername2)); } } else { if (!dictionary5.ContainsKey(num6)) { dictionary5.Add(num6, new MessengerRequest(Userid, num6, pUsername2)); } } } HashSet <RoomData> list8 = new HashSet <RoomData>(); foreach (DataRow dataRow14 in dataTable12.Rows) { uint roomId = Convert.ToUInt32(dataRow14["id"]); list8.Add(CyberEnvironment.GetGame().GetRoomManager().FetchRoomData(roomId, dataRow14)); } Dictionary <uint, Pet> dictionary6 = new Dictionary <uint, Pet>(); foreach (DataRow dataRow15 in dataTable13.Rows) { using (IQueryAdapter queryreactor3 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor3.setQuery("SELECT * FROM bots_petdata WHERE id=" + dataRow15[0] + " LIMIT 1"); DataRow row3 = queryreactor3.getRow(); if (row3 != null) { Pet pet = Catalog.GeneratePetFromRow(dataRow15, row3); dictionary6.Add(pet.PetId, pet); } } } Dictionary <uint, int> dictionary7 = new Dictionary <uint, int>(); foreach (DataRow dataRow16 in table2.Rows) { uint key = Convert.ToUInt32(dataRow16["quest_id"]); int value3 = (int)dataRow16["progress"]; if (dictionary7.ContainsKey(key)) { dictionary7.Remove(key); } dictionary7.Add(key, value3); } HashSet <GroupUser> list9 = new HashSet <GroupUser>(); foreach (DataRow dataRow17 in dataTable.Rows) { list9.Add(new GroupUser(Userid, (uint)dataRow17[0], (int)Convert.ToInt16(dataRow17[1]))); } Dictionary <int, Relationship> dictionary8 = new Dictionary <int, Relationship>(); foreach (DataRow dataRow18 in dataTable15.Rows) { dictionary8.Add((int)dataRow18[0], new Relationship((int)dataRow18[0], (int)dataRow18[2], Convert.ToInt32(dataRow18[3].ToString()))); } Habbo user = HabboFactory.GenerateHabbo(dataRow, row, list9); dataRow = null; dataTable2 = null; dataTable3 = null; dataTable4 = null; dataTable5 = null; dataRow2 = null; dataTable6 = null; dataTable7 = null; dataTable8 = null; dataTable10 = null; dataTable11 = null; dataTable12 = null; dataTable13 = null; dataTable14 = null; dataTable15 = null; dataTable9 = null; errorCode = 0; return(new UserData(Userid, dictionary, dictionary2, list, list2, list3, sub, list4, list5, list6, dictionary4, dictionary5, list8, dictionary6, dictionary7, user, dictionary3, dictionary8, pollSuggested, miniMailCount)); }
internal bool RequestBuddy(string UserQuery) { GameClient clientByUsername = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(UserQuery); uint num; bool flag; if (clientByUsername == null) { DataRow dataRow = null; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT id,block_newfriends FROM users WHERE username = @query"); queryreactor.addParameter("query", UserQuery.ToLower()); dataRow = queryreactor.getRow(); } if (dataRow == null) { return(false); } num = Convert.ToUInt32(dataRow["id"]); flag = CyberEnvironment.EnumToBool(dataRow["block_newfriends"].ToString()); } else { num = clientByUsername.GetHabbo().Id; flag = clientByUsername.GetHabbo().HasFriendRequestsDisabled; } if (flag && this.GetClient().GetHabbo().Rank < 4u) { this.GetClient().GetMessageHandler().GetResponse().Init(Outgoing.NotAcceptingRequestsMessageComposer); this.GetClient().GetMessageHandler().GetResponse().AppendInt32(39); this.GetClient().GetMessageHandler().GetResponse().AppendInt32(3); this.GetClient().GetMessageHandler().SendResponse(); return(false); } uint num2 = num; if (this.RequestExists(num2)) { return(true); } using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor2.runFastQuery(string.Concat(new object[] { "REPLACE INTO messenger_requests (from_id,to_id) VALUES (", this.UserId, ",", num2, ")" })); } CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(this.GetClient(), QuestType.ADD_FRIENDS, 0u); GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(num2); if (clientByUserID == null || clientByUserID.GetHabbo() == null) { return(true); } MessengerRequest messengerRequest = new MessengerRequest(num2, this.UserId, CyberEnvironment.GetGame().GetClientManager().GetNameById(this.UserId)); clientByUserID.GetHabbo().GetMessenger().OnNewRequest(this.UserId); ServerMessage serverMessage = new ServerMessage(Outgoing.ConsoleSendFriendRequestMessageComposer); messengerRequest.Serialize(serverMessage); clientByUserID.SendMessage(serverMessage); this.requests.Add(num2, messengerRequest); return(true); }
internal void OnNewFriendship(uint friendID) { GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID); MessengerBuddy messengerBuddy; if (clientByUserID == null || clientByUserID.GetHabbo() == null) { DataRow row; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT id,username,motto,look,last_online,hide_inroom,hide_online FROM users WHERE id = " + friendID); row = queryreactor.getRow(); } messengerBuddy = new MessengerBuddy(friendID, (string)row["username"], (string)row["look"], (string)row["motto"], (int)row["last_online"], CyberEnvironment.EnumToBool(row["hide_online"].ToString()), CyberEnvironment.EnumToBool(row["hide_inroom"].ToString())); } else { Habbo habbo = clientByUserID.GetHabbo(); messengerBuddy = new MessengerBuddy(friendID, habbo.Username, habbo.Look, habbo.Motto, 0, habbo.AppearOffline, habbo.HideInRoom); messengerBuddy.UpdateUser(clientByUserID); } if (!this.friends.ContainsKey(friendID)) { this.friends.Add(friendID, messengerBuddy); } this.GetClient().SendMessage(this.SerializeUpdate(messengerBuddy)); }
internal void LoadModels(IQueryAdapter dbClient) { this.roomModels.Clear(); dbClient.setQuery("SELECT id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only,poolmap FROM room_models"); DataTable table = dbClient.getTable(); if (table == null) { return; } foreach (DataRow dataRow in table.Rows) { string key = (string)dataRow["id"]; if (key.StartsWith("model_floorplan_")) { continue; } string staticFurniMap = (string)dataRow["public_items"]; this.roomModels.Add(key, new RoomModel((int)dataRow["door_x"], (int)dataRow["door_y"], (double)dataRow["door_z"], (int)dataRow["door_dir"], (string)dataRow["heightmap"], staticFurniMap, CyberEnvironment.EnumToBool(dataRow["club_only"].ToString()), (string)dataRow["poolmap"])); } }
internal void LoadNewModel(string Model) { if (roomModels.Contains(Model)) { roomModels.Remove(Model); } using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only,poolmap FROM room_models WHERE id = @model"); queryreactor.addParameter("model", Model); DataTable table = queryreactor.getTable(); if (table != null) { string key = Model; foreach (DataRow row in table.Rows) { string staticFurniMap = (string)row["public_items"]; this.roomModels.Add(Model, new RoomModel((int)row["door_x"], (int)row["door_y"], (double)row["door_z"], (int)row["door_dir"], (string)row["heightmap"], staticFurniMap, CyberEnvironment.EnumToBool(row["club_only"].ToString()), (string)row["poolmap"])); } } } }