/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal void Init(IQueryAdapter dbClient) { Polls.Clear(); dbClient.SetQuery("SELECT * FROM polls_data WHERE enabled = '1'"); DataTable table = dbClient.GetTable(); if (table == null) { return; } foreach (DataRow dataRow in table.Rows) { uint num = uint.Parse(dataRow["id"].ToString()); dbClient.SetQuery($"SELECT * FROM polls_questions WHERE poll_id = {num}"); DataTable table2 = dbClient.GetTable(); List <PollQuestion> list = (from DataRow dataRow2 in table2.Rows select new PollQuestion(uint.Parse(dataRow2["id"].ToString()), (string)dataRow2["question"], int.Parse(dataRow2["answertype"].ToString()), dataRow2["answers"].ToString().Split('|'), (string)dataRow2["correct_answer"])).ToList(); Poll value = new Poll(num, uint.Parse(dataRow["room_id"].ToString()), (string)dataRow["caption"], (string)dataRow["invitation"], (string)dataRow["greetings"], (string)dataRow["prize"], int.Parse(dataRow["type"].ToString()), list); Polls.Add(num, value); } }
public static void init() { DataTable Jobs = null; DataTable JobsRanks = null; JobData = new ConcurrentDictionary <int, Job>(); JobRankData = new MultiKeyDictionary <int, int, Rank>(); JobData.Clear(); JobRankData.Clear(); using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM rp_jobs"); Jobs = dbClient.GetTable(); foreach (DataRow Job in Jobs.Rows) { dbClient.SetQuery("SELECT * FROM rp_jobs_ranks WHERE job_id = " + Convert.ToInt32(Job[0]) + ""); JobsRanks = dbClient.GetTable(); foreach (DataRow Rank in JobsRanks.Rows) { JobRankData.Add(Convert.ToInt32(Rank[0]), Convert.ToInt32(Rank[1]), new Rank(Convert.ToInt32(Rank[0]), Convert.ToInt32(Rank[1]), Rank[2].ToString(), Rank[3].ToString(), Rank[4].ToString(), Convert.ToInt32(Rank[5]), Convert.ToInt32(Rank[6]), Rank[7].ToString(), Rank[9].ToString(), Convert.ToInt32(Rank[10]), Convert.ToInt32(Rank[11]), Convert.ToInt32(Rank[12]), Convert.ToInt32(Rank[13]), Convert.ToInt32(Rank[14]), Convert.ToInt32(Rank[15]), Convert.ToInt32(Rank[16]))); } JobData.TryAdd(Convert.ToInt32(Job[0]), new Job(Convert.ToInt32(Job[0]), Job[1].ToString(), Job[2].ToString(), Convert.ToInt32(Job[4]), Convert.ToInt32(Job[6]), Job[7].ToString(), Convert.ToInt32(Job[8]), Convert.ToInt32(Job[9]), Convert.ToInt32(Job[10]), Convert.ToInt32(Job[11]), Job[3].ToString())); } } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal void Init(IQueryAdapter dbClient) { Polls.Clear(); dbClient.SetQuery("SELECT * FROM polls_data WHERE enabled = '1'"); var table = dbClient.GetTable(); if (table == null) return; foreach (DataRow dataRow in table.Rows) { var num = uint.Parse(dataRow["id"].ToString()); dbClient.SetQuery($"SELECT * FROM polls_questions WHERE poll_id = {num}"); var table2 = dbClient.GetTable(); var list = (from DataRow dataRow2 in table2.Rows select new PollQuestion(uint.Parse(dataRow2["id"].ToString()), (string) dataRow2["question"], int.Parse(dataRow2["answertype"].ToString()), dataRow2["answers"].ToString().Split('|'), (string) dataRow2["correct_answer"])).ToList(); var value = new Poll(num, uint.Parse(dataRow["room_id"].ToString()), (string) dataRow["caption"], (string) dataRow["invitation"], (string) dataRow["greetings"], (string) dataRow["prize"], int.Parse(dataRow["type"].ToString()), list); Polls.Add(num, value); } }
/// <summary> /// Loads the rights. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadRights(IQueryAdapter dbClient) { ClearRights(); dbClient.SetQuery("SELECT * FROM server_fuses;"); DataTable table = dbClient.GetTable(); if (table == null) return; foreach (DataRow dataRow in table.Rows) if (!_cmdRights.ContainsKey(dataRow["command"].ToString())) _cmdRights.Add(dataRow["command"].ToString(), dataRow["rank"].ToString()); else Writer.WriteLine($"Duplicate Fuse Command \"{dataRow[0]}\" found", "Yupi.Fuses"); dbClient.SetQuery("SELECT * FROM server_fuserights"); DataTable table2 = dbClient.GetTable(); if (table2 == null) return; foreach (DataRow dataRow2 in table2.Rows) if ((int) dataRow2["min_sub"] > 0) _subRights.Add(dataRow2["fuse"].ToString(), (int) dataRow2["min_sub"]); else if (!_rights.ContainsKey(dataRow2["fuse"].ToString())) _rights.Add(dataRow2["fuse"].ToString(), (uint)dataRow2["min_rank"]); }
public void InitializeCategories() { using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM navigator_pubcats"); DataTable navigatorPublicCats = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM navigator_sub_pubcats"); DataTable navigatorSubCats = dbClient.GetTable(); List <NavigatorSubCategory> subCategories = new List <NavigatorSubCategory>(); if (navigatorSubCats != null) { subCategories.AddRange(from DataRow dataRow in navigatorSubCats.Rows select new NavigatorSubCategory((int)dataRow["id"], (string)dataRow["caption"], (string)dataRow["main_cat"], (string)dataRow["default_state"] == "opened", (string)dataRow["default_size"] == "image")); } if (navigatorPublicCats != null) { InCategories.Clear(); foreach (DataRow dataRow in navigatorPublicCats.Rows) { InCategories.Add((string)dataRow["caption"], new NavigatorCategory((int)dataRow["id"], (string)dataRow["caption"], (string)dataRow["default_state"] == "opened", (string)dataRow["default_size"] == "image", subCategories.Where(c => c.MainCategory == (string)dataRow["caption"]).ToList())); } } } }
public void InitBots() { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`room_id`,`name`,`motto`,`look`,`x`,`y`,`z`,`rotation`,`gender`,`user_id`,`ai_type`,`walk_mode`,`automatic_chat`,`speaking_interval`,`mix_sentences`,`chat_bubble` FROM `bots` WHERE `room_id` = '" + RoomId + "' AND `ai_type` != 'pet'"); DataTable Data = dbClient.GetTable(); if (Data == null) { return; } foreach (DataRow Bot in Data.Rows) { dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = '" + Convert.ToInt32(Bot["id"]) + "'"); DataTable BotSpeech = dbClient.GetTable(); List <RandomSpeech> Speeches = new List <RandomSpeech>(); foreach (DataRow Speech in BotSpeech.Rows) { Speeches.Add(new RandomSpeech(Convert.ToString(Speech["text"]), Convert.ToInt32(Bot["id"]))); } _roomUserManager.DeployBot(new RoomBot(Convert.ToInt32(Bot["id"]), Convert.ToInt32(Bot["room_id"]), Convert.ToString(Bot["ai_type"]), Convert.ToString(Bot["walk_mode"]), Convert.ToString(Bot["name"]), Convert.ToString(Bot["motto"]), Convert.ToString(Bot["look"]), int.Parse(Bot["x"].ToString()), int.Parse(Bot["y"].ToString()), int.Parse(Bot["z"].ToString()), int.Parse(Bot["rotation"].ToString()), 0, 0, 0, 0, ref Speeches, "M", 0, Convert.ToInt32(Bot["user_id"].ToString()), Convert.ToBoolean(Bot["automatic_chat"]), Convert.ToInt32(Bot["speaking_interval"]), PlusEnvironment.EnumToBool(Bot["mix_sentences"].ToString()), Convert.ToInt32(Bot["chat_bubble"])), null); } } }
public static void init() { DataTable Gangs = null; DataTable GangsRanks = null; GangData = new ConcurrentDictionary <int, Gang>(); GangRankData = new MultiKeyDictionary <int, int, GangRank>(); GangData.Clear(); GangRankData.Clear(); using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM rp_gangs"); Gangs = dbClient.GetTable(); foreach (DataRow Gang in Gangs.Rows) { dbClient.SetQuery("SELECT * FROM rp_gangs_ranks WHERE gangid = " + Convert.ToInt32(Gang[0]) + ""); GangsRanks = dbClient.GetTable(); foreach (DataRow Rank in GangsRanks.Rows) { GangRankData.Add(Convert.ToInt32(Rank[0]), Convert.ToInt32(Rank[1]), new GangRank(Convert.ToInt32(Rank[0]), Convert.ToInt32(Rank[1]), Convert.ToString(Rank[2]), Convert.ToInt32(Rank[3]), Convert.ToInt32(Rank[4]), Convert.ToInt32(Rank[5]), Convert.ToInt32(Rank[6]), Convert.ToInt32(Rank[7]))); } GangData.TryAdd(Convert.ToInt32(Gang[0]), new Gang(Convert.ToInt32(Gang[0]), Convert.ToString(Gang[1]), Convert.ToInt32(Gang[2]), Convert.ToInt32(Gang[3]), Convert.ToInt32(Gang[4]), Convert.ToInt32(Gang[5]))); } } initTurfs(); }
/// <summary> /// Gets the user data. /// </summary> /// <param name="userId">The user identifier.</param> /// <returns>UserData.</returns> internal static UserData GetUserData(int userId) { DataRow dataRow; DataRow row; DataTable table; using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery($"SELECT * FROM users WHERE id = {userId} LIMIT 1"); dataRow = queryReactor.GetRow(); Yupi.GetGame().GetClientManager().LogClonesOut((uint)userId); if (dataRow == null) { return(null); } if (Yupi.GetGame().GetClientManager().GetClientByUserId((uint)userId) != null) { return(null); } queryReactor.SetQuery($"SELECT * FROM groups_members WHERE user_id={userId}"); queryReactor.GetTable(); queryReactor.SetQuery($"SELECT * FROM users_stats WHERE id = {userId}"); row = queryReactor.GetRow(); queryReactor.SetQuery($"SELECT * FROM users_relationships WHERE user_id={userId}"); table = queryReactor.GetTable(); } Dictionary <string, UserAchievement> achievements = new Dictionary <string, UserAchievement>(); Dictionary <int, UserTalent> talents = new Dictionary <int, UserTalent>(); List <uint> favouritedRooms = new List <uint>(); List <uint> ignores = new List <uint>(); List <string> tags = new List <string>(); List <Badge> badges = new List <Badge>(); List <UserItem> inventory = new List <UserItem>(); List <AvatarEffect> effects = new List <AvatarEffect>(); Dictionary <uint, MessengerBuddy> friends = new Dictionary <uint, MessengerBuddy>(); Dictionary <uint, MessengerRequest> requests = new Dictionary <uint, MessengerRequest>(); HashSet <RoomData> rooms = new HashSet <RoomData>(); Dictionary <uint, Pet> pets = new Dictionary <uint, Pet>(); Dictionary <int, int> quests = new Dictionary <int, int>(); Dictionary <uint, RoomBot> bots = new Dictionary <uint, RoomBot>(); HashSet <GroupMember> group = new HashSet <GroupMember>(); HashSet <uint> pollData = new HashSet <uint>(); Dictionary <int, Relationship> dictionary = table.Rows.Cast <DataRow>().ToDictionary(dataRow2 => (int)dataRow2["id"], dataRow2 => new Relationship((int)dataRow2["id"], (int)dataRow2["target"], Convert.ToInt32(dataRow2["type"].ToString()))); Habbo user = HabboFactory.GenerateHabbo(dataRow, row, group); return(new UserData((uint)userId, achievements, talents, favouritedRooms, ignores, tags, null, badges, inventory, effects, friends, requests, rooms, pets, quests, user, bots, dictionary, pollData, 0)); }
/// <summary> /// Loads the message presets. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadMessagePresets(IQueryAdapter dbClient) { UserMessagePresets.Clear(); RoomMessagePresets.Clear(); SupportTicketHints.Clear(); ModerationTemplates.Clear(); dbClient.SetQuery("SELECT type,message FROM moderation_presets WHERE enabled = 2"); DataTable table = dbClient.GetTable(); dbClient.SetQuery("SELECT word,hint FROM moderation_tickethints"); DataTable table2 = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM moderation_templates"); DataTable table3 = dbClient.GetTable(); if (table == null || table2 == null) { return; } foreach (DataRow dataRow in table.Rows) { string item = (string)dataRow["message"]; string a = dataRow["type"].ToString().ToLower(); if (a != "message") { switch (a) { case "roommessage": RoomMessagePresets.Add(item); break; } } else { UserMessagePresets.Add(item); } } foreach (DataRow dataRow2 in table2.Rows) { SupportTicketHints.Add((string)dataRow2[0], (string)dataRow2[1]); } foreach (DataRow dataRow3 in table3.Rows) { ModerationTemplates.Add(uint.Parse(dataRow3["id"].ToString()), new ModerationTemplate(uint.Parse(dataRow3["id"].ToString()), short.Parse(dataRow3["category"].ToString()), dataRow3["cName"].ToString(), dataRow3["caption"].ToString(), dataRow3["warning_message"].ToString(), dataRow3["ban_message"].ToString(), short.Parse(dataRow3["ban_hours"].ToString()), dataRow3["avatar_ban"].ToString() == "1", dataRow3["mute"].ToString() == "1", dataRow3["trade_lock"].ToString() == "1")); } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> public void Initialize(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM navigator_flatcats WHERE enabled = '2'"); var table = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM navigator_publics"); var table2 = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM navigator_pubcats"); var table3 = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM navigator_promocats"); var table4 = dbClient.GetTable(); if (table4 != null) { PromoCategories.Clear(); foreach (DataRow dataRow in table4.Rows) { PromoCategories.Add((int)dataRow["id"], new PromoCat((int)dataRow["id"], (string)dataRow["caption"], (int)dataRow["min_rank"], Plus.EnumToBool((string)dataRow["visible"]))); } } if (table != null) { PrivateCategories.Clear(); foreach (DataRow dataRow in table.Rows) { PrivateCategories.Add((int)dataRow["id"], new FlatCat((int)dataRow["id"], (string)dataRow["caption"], (int)dataRow["min_rank"])); } } if (table2 != null) { _publicItems.Clear(); foreach (DataRow row in table2.Rows) { _publicItems.Add(Convert.ToUInt32(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, (uint)row["room_id"], 0, (int)row["category_parent_id"], row["recommended"].ToString() == "1", (int)row["typeofdata"], string.Empty)); } } if (table3 != null) { InCategories.Clear(); foreach (DataRow dataRow in table3.Rows) { InCategories.Add((int)dataRow["id"], (string)dataRow["caption"]); } } }
public void InitMembers() { using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { DataTable GetMembers = null; dbClient.SetQuery("SELECT `user_id`, `rank` FROM `group_memberships` WHERE `group_id` = @id"); dbClient.AddParameter("id", this.Id); GetMembers = dbClient.GetTable(); if (GetMembers != null) { foreach (DataRow Row in GetMembers.Rows) { int UserId = Convert.ToInt32(Row["user_id"]); bool IsAdmin = Convert.ToInt32(Row["rank"]) != 0; if (IsAdmin) { if (!this._administrators.Contains(UserId)) { this._administrators.Add(UserId); } } else { if (!this._members.Contains(UserId)) { this._members.Add(UserId); } } } } DataTable GetRequests = null; dbClient.SetQuery("SELECT `user_id` FROM `group_requests` WHERE `group_id` = @id"); dbClient.AddParameter("id", this.Id); GetRequests = dbClient.GetTable(); if (GetRequests != null) { foreach (DataRow Row in GetRequests.Rows) { int UserId = Convert.ToInt32(Row["user_id"]); if (this._members.Contains(UserId) || this._administrators.Contains(UserId)) { dbClient.RunQuery("DELETE FROM `group_requests` WHERE `group_id` = '" + this.Id + "' AND `user_id` = '" + UserId + "'"); } else if (!this._requests.Contains(UserId)) { this._requests.Add(UserId); } } } } }
public void InitMembers() { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `user_id`, `rank` FROM `group_memberships` WHERE `group_id` = @id"); dbClient.AddParameter("id", Id); DataTable members = dbClient.GetTable(); if (members != null) { foreach (DataRow row in members.Rows) { int userId = Convert.ToInt32(row["user_id"]); bool isAdmin = Convert.ToInt32(row["rank"]) != 0; if (isAdmin) { if (!_administrators.Contains(userId)) { _administrators.Add(userId); } } else { if (!_members.Contains(userId)) { _members.Add(userId); } } } } dbClient.SetQuery("SELECT `user_id` FROM `group_requests` WHERE `group_id` = @id"); dbClient.AddParameter("id", Id); DataTable requests = dbClient.GetTable(); if (requests != null) { foreach (DataRow row in requests.Rows) { int userId = Convert.ToInt32(row["user_id"]); if (_members.Contains(userId) || _administrators.Contains(userId)) { dbClient.RunQuery("DELETE FROM `group_requests` WHERE `group_id` = '" + Id + "' AND `user_id` = '" + userId + "'"); } else if (!_requests.Contains(userId)) { _requests.Add(userId); } } } } }
public void Init() { if (_searchResultLists.Count > 0) { _searchResultLists.Clear(); } if (_featuredRooms.Count > 0) { _featuredRooms.Clear(); } DataTable Table = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `navigator_categories` ORDER BY `id` ASC"); Table = dbClient.GetTable(); if (Table != null) { foreach (DataRow Row in Table.Rows) { if (Convert.ToInt32(Row["enabled"]) == 1) { if (!_searchResultLists.ContainsKey(Convert.ToInt32(Row["id"]))) { _searchResultLists.Add(Convert.ToInt32(Row["id"]), new SearchResultList(Convert.ToInt32(Row["id"]), Convert.ToString(Row["category"]), Convert.ToString(Row["category_identifier"]), Convert.ToString(Row["public_name"]), true, -1, Convert.ToInt32(Row["required_rank"]), NavigatorViewModeUtility.GetViewModeByString(Convert.ToString(Row["view_mode"])), Convert.ToString(Row["category_type"]), Convert.ToString(Row["search_allowance"]), Convert.ToInt32(Row["order_id"]))); } } } } dbClient.SetQuery("SELECT `room_id`,`caption`,`description`,`image_url`,`enabled` FROM `navigator_publics` ORDER BY `order_num` ASC"); DataTable GetPublics = dbClient.GetTable(); if (GetPublics != null) { foreach (DataRow Row in GetPublics.Rows) { if (Convert.ToInt32(Row["enabled"]) == 1) { if (!_featuredRooms.ContainsKey(Convert.ToInt32(Row["room_id"]))) { _featuredRooms.Add(Convert.ToInt32(Row["room_id"]), new FeaturedRoom(Convert.ToInt32(Row["room_id"]), Convert.ToString(Row["caption"]), Convert.ToString(Row["description"]), Convert.ToString(Row["image_url"]))); } } } } } log.Info("Navigator -> LOADED"); }
/// <summary> /// Loads the rights. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadRights(IQueryAdapter dbClient) { this.ClearRights(); dbClient.SetQuery("SELECT command,rank FROM server_fuses;"); DataTable table = dbClient.GetTable(); if (table != null) { foreach (DataRow dataRow in table.Rows) { if (!this._cmdRights.ContainsKey((string)dataRow[0])) { this._cmdRights.Add((string)dataRow[0], (string)dataRow[1]); } else { Logging.LogException(string.Format("Duplicate Fuse Command \"{0}\" found", dataRow[0])); } } } dbClient.SetQuery("SELECT * FROM server_fuserights"); DataTable table2 = dbClient.GetTable(); if (table2 == null) { return; } foreach (DataRow dataRow2 in table2.Rows) { if ((int)dataRow2[3] == 0) { if (!this._rights.ContainsKey((string)dataRow2[0])) { this._rights.Add((string)dataRow2[0], Convert.ToUInt32(dataRow2[1])); } else { Logging.LogException(string.Format("Unknown Subscription Fuse \"{0}\" found", dataRow2[0])); } } else { if ((int)dataRow2[3] > 0) { this._subRights.Add((string)dataRow2[0], (int)dataRow2[3]); } else { Logging.LogException(string.Format("Unknown fuse type \"{0}\" found", dataRow2[3])); } } } }
/// <summary> /// Loads the rights. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadRights(IQueryAdapter dbClient) { ClearRights(); dbClient.SetQuery("SELECT command,rank FROM server_fuses;"); var table = dbClient.GetTable(); if (table != null) { foreach (DataRow dataRow in table.Rows) { if (!_cmdRights.ContainsKey((string) dataRow[0])) { _cmdRights.Add((string) dataRow[0], (string) dataRow[1]); } else { Logging.LogException(string.Format("Duplicate Fuse Command \"{0}\" found", dataRow[0])); } } } dbClient.SetQuery("SELECT * FROM server_fuserights"); var table2 = dbClient.GetTable(); if (table2 == null) { return; } foreach (DataRow dataRow2 in table2.Rows) { if ((int) dataRow2[3] == 0) { if (!_rights.ContainsKey((string) dataRow2[0])) { _rights.Add((string) dataRow2[0], Convert.ToUInt32(dataRow2[1])); } else { Logging.LogException(string.Format("Unknown Subscription Fuse \"{0}\" found", dataRow2[0])); } } else { if ((int) dataRow2[3] > 0) { _subRights.Add((string) dataRow2[0], (int) dataRow2[3]); } else { Logging.LogException(string.Format("Unknown fuse type \"{0}\" found", dataRow2[3])); } } } }
public void Init() { if (this._searchResultLists.Count > 0) { this._searchResultLists.Clear(); } if (this._featuredRooms.Count > 0) { this._featuredRooms.Clear(); } using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { DataTable Table = null; dbClient.SetQuery("SELECT * FROM `navigator_categories` ORDER BY `id` ASC"); Table = dbClient.GetTable(); if (Table != null) { foreach (DataRow Row in Table.Rows) { if (Convert.ToInt32(Row["enabled"]) == 1) { if (!this._searchResultLists.ContainsKey(Convert.ToInt32(Row["id"]))) { this._searchResultLists.Add(Convert.ToInt32(Row["id"]), new SearchResultList(Convert.ToInt32(Row["id"]), Convert.ToString(Row["category"]), Convert.ToString(Row["category_identifier"]), Convert.ToString(Row["public_name"]), true, -1, Convert.ToInt32(Row["required_rank"]), Convert.ToInt32(Row["minimized"]) == 1, NavigatorViewModeUtility.GetViewModeByString(Convert.ToString(Row["view_mode"])), Convert.ToString(Row["category_type"]), Convert.ToString(Row["search_allowance"]), Convert.ToInt32(Row["order_id"]))); } } } } dbClient.SetQuery("SELECT `room_id`,`image_url`,`enabled`, `langue` FROM `navigator_publics` ORDER BY `order_num` ASC"); DataTable GetPublics = dbClient.GetTable(); if (GetPublics != null) { foreach (DataRow Row in GetPublics.Rows) { if (Convert.ToInt32(Row["enabled"]) == 1) { if (!this._featuredRooms.ContainsKey(Convert.ToInt32(Row["room_id"]))) { this._featuredRooms.Add(Convert.ToInt32(Row["room_id"]), new FeaturedRoom(Convert.ToInt32(Row["room_id"]), Convert.ToString(Row["image_url"]), LanguageManager.ParseLanguage(Convert.ToString(Row["langue"])))); } } } } } }
internal static void Load(IQueryAdapter DBClient) { DBClient.SetQuery("SELECT * FROM server_bannedhotels"); DataTable Table = DBClient.GetTable(); bannedHotels = new string[Table.Rows.Count]; int i = 0; foreach (DataRow dataRow in DBClient.GetTable().Rows) { AntiPublicistas.bannedHotels[i] = (dataRow[0].ToString()); i++; } }
/// <summary> /// Gets the achievement levels. /// </summary> /// <param name="achievements">The achievements.</param> /// <param name="dbClient">The database client.</param> internal static void GetAchievementLevels(out Dictionary<string, Achievement> achievements, IQueryAdapter dbClient) { achievements = new Dictionary<string, Achievement>(); dbClient.SetQuery("SELECT * FROM achievements_data"); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) { uint id = Convert.ToUInt32(dataRow["id"]); var category = (string)dataRow["category"]; var text = (string)dataRow["group_name"]; var level = (int)dataRow["level"]; var rewardPixels = (int)dataRow["reward_pixels"]; var rewardPoints = (int)dataRow["reward_points"]; var requirement = (int)dataRow["progress_needed"]; var level2 = new AchievementLevel(level, rewardPixels, rewardPoints, requirement); if (!achievements.ContainsKey(text)) { Achievement achievement = new Achievement(id, text, category); achievement.AddLevel(level2); achievements.Add(text, achievement); } else { if (!achievements[text].CheckLevel(level2)) achievements[text].AddLevel(level2); else Out.WriteLine("Was Found a Duplicated Level for: " + text + ", Level: " + level2.Level, "[Azure.Achievements]", ConsoleColor.Cyan); } } }
public void Parse(GameClient session, ClientPacket packet) { int creditsOwed = 0; DataTable table; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `asking_price` FROM `catalog_marketplace_offers` WHERE `user_id` = '" + session.GetHabbo().Id + "' AND `state` = '2'"); table = dbClient.GetTable(); } if (table != null) { foreach (DataRow row in table.Rows) { creditsOwed += Convert.ToInt32(row["asking_price"]); } if (creditsOwed >= 1) { session.GetHabbo().Credits += creditsOwed; session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits)); } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `catalog_marketplace_offers` WHERE `user_id` = '" + session.GetHabbo().Id + "' AND `state` = '2'"); } } }
public void ProcessOfflineMessages() { DataTable GetMessages = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `messenger_offline_messages` WHERE `to_id` = @id;"); dbClient.AddParameter("id", _userId); GetMessages = dbClient.GetTable(); if (GetMessages != null) { GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(_userId); if (Client == null) { return; } foreach (DataRow Row in GetMessages.Rows) { Client.SendPacket(new NewConsoleMessageComposer(Convert.ToInt32(Row["from_id"]), Convert.ToString(Row["message"]), (int)(UnixTimestamp.GetNow() - Convert.ToInt32(Row["timestamp"])))); } dbClient.SetQuery("DELETE FROM `messenger_offline_messages` WHERE `to_id` = @id"); dbClient.AddParameter("id", _userId); dbClient.RunQuery(); } } }
/// <summary> /// Gets the achievement levels. /// </summary> /// <param name="achievements">The achievements.</param> /// <param name="dbClient">The database client.</param> internal static void GetAchievementLevels(out Dictionary<string, Achievement> achievements, IQueryAdapter dbClient) { achievements = new Dictionary<string, Achievement>(); dbClient.SetQuery("SELECT * FROM achievements_data"); foreach (DataRow dataRow in dbClient.GetTable().Rows) { string achievementName = dataRow["achievement_name"].ToString(); AchievementLevel level = new AchievementLevel((uint) dataRow["achievement_level"], (uint) dataRow["reward_pixels"], (uint) dataRow["reward_points"], (uint) dataRow["progress_needed"]); if (!achievements.ContainsKey(achievementName)) achievements.Add(achievementName, new Achievement((uint) dataRow["id"], achievementName, dataRow["achievement_category"].ToString())); if (!achievements[achievementName].CheckLevel(level)) achievements[achievementName].AddLevel(level); else YupiWriterManager.WriteLine( "Was Found a Duplicated Level for: " + achievementName + ", Level: " + level.Level, "Yupi.Achievements", ConsoleColor.Cyan); } }
/// <summary> /// Create the BanComponent for the RoomInstance. /// </summary> /// <param name="instance">The instance that created this component.</param> public BansComponent(Room Instance) { if (Instance == null) { return; } this._instance = Instance; this._bans = new ConcurrentDictionary <int, double>(); DataTable GetBans = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `user_id`, `expire` FROM `room_bans` WHERE `room_id` = " + this._instance.Id + " AND `expire` > UNIX_TIMESTAMP();"); GetBans = dbClient.GetTable(); if (GetBans != null) { foreach (DataRow Row in GetBans.Rows) { this._bans.TryAdd(Convert.ToInt32(Row["user_id"]), Convert.ToDouble(Row["expire"])); } } } }
public void RefreshVideos() { Videos.Clear(); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("SELECT * FROM users_videos_youtube WHERE user_id = @user_id ORDER BY id DESC"); queryReactor.AddParameter("user_id", UserId); DataTable table = queryReactor.GetTable(); if (table == null) { return; } foreach (DataRow row in table.Rows) { if (Videos.ContainsKey((string)row["video_id"])) { continue; } Videos.Add((string)row["video_id"], new YoutubeVideo((string)row["video_id"], (string)row["name"], (string)row["description"])); } } }
/// <summary> /// Caches farming spots /// </summary> public static void init() { FarmingSpots.Clear(); string Query = "SELECT * FROM rp_farming"; try { using (IQueryAdapter dbClient = Plus.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery(Query); DataTable farmingTable = dbClient.GetTable(); foreach (DataRow row in farmingTable.Rows) { uint Id = Convert.ToUInt32(row["id"]); uint RoomId = Convert.ToUInt32(row["roomid"]); int X = Convert.ToInt32(row["x"]); int Y = Convert.ToInt32(row["y"]); string PlantType = row["type"].ToString(); var farmingspot = new FarmingSpot(Id, RoomId, X, Y, PlantType); FarmingSpots.TryAdd(Id, farmingspot); } } } catch (Exception ex) { Logging.LogQueryError(ex, Query); } }
/// <summary> /// Gets the achievement levels. /// </summary> /// <param name="achievements">The achievements.</param> /// <param name="dbClient">The database client.</param> internal static void GetAchievementLevels(out Dictionary <string, Achievement> achievements, IQueryAdapter dbClient) { achievements = new Dictionary <string, Achievement>(); dbClient.SetQuery("SELECT * FROM achievements_data"); foreach (DataRow dataRow in dbClient.GetTable().Rows) { string achievementName = dataRow["achievement_name"].ToString(); AchievementLevel level = new AchievementLevel((uint)dataRow["achievement_level"], (uint)dataRow["reward_pixels"], (uint)dataRow["reward_points"], (uint)dataRow["progress_needed"]); if (!achievements.ContainsKey(achievementName)) { achievements.Add(achievementName, new Achievement((uint)dataRow["id"], achievementName, dataRow["achievement_category"].ToString())); } if (!achievements[achievementName].CheckLevel(level)) { achievements[achievementName].AddLevel(level); } else { Writer.WriteLine("Was Found a Duplicated Level for: " + achievementName + ", Level: " + level.Level, "Yupi.Achievements", ConsoleColor.Cyan); } } }
public static List <Item> GetItemsForUser(int UserId) { DataTable Items = null; List <Item> I = new List <Item>(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.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 `items`.`room_id` = 0 AND `items`.`user_id` = @uid;"); dbClient.AddParameter("uid", UserId); Items = dbClient.GetTable(); if (Items != null) { foreach (DataRow Row in Items.Rows) { ItemData Data = null; if (PlusEnvironment.GetGame().GetItemManager().GetItem(Convert.ToInt32(Row["base_item"]), out Data)) { I.Add(new Item(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["room_id"]), Convert.ToInt32(Row["base_item"]), Convert.ToString(Row["extra_data"]), Convert.ToInt32(Row["x"]), Convert.ToInt32(Row["y"]), Convert.ToDouble(Row["z"]), Convert.ToInt32(Row["rot"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["group_id"]), Convert.ToInt32(Row["limited_number"]), Convert.ToInt32(Row["limited_stack"]), Convert.ToString(Row["wall_pos"]))); } else { // Item data does not exist anymore. } } } } return(I); }
/// <summary> /// Initializes the EffectsComponent. /// </summary> /// <param name="UserId"></param> public bool Init(Habbo Habbo) { if (_allClothing.Count > 0) { return(false); } DataTable GetClothing = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`part_id`,`part` FROM `user_clothing` WHERE `user_id` = @id;"); dbClient.AddParameter("id", Habbo.Id); GetClothing = dbClient.GetTable(); if (GetClothing != null) { foreach (DataRow Row in GetClothing.Rows) { if (_allClothing.TryAdd(Convert.ToInt32(Row["part_id"]), new ClothingParts(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["part_id"]), Convert.ToString(Row["part"])))) { //umm? } } } } _habbo = Habbo; return(true); }
public WardrobeComposer(GameClient Session) : base(ServerPacketHeader.WardrobeMessageComposer) { WriteInteger(1); using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `slot_id`,`look`,`gender` FROM `user_wardrobe` WHERE `user_id` = '" + Session.GetHabbo().Id + "' LIMIT 10"); DataTable WardrobeData = dbClient.GetTable(); if (WardrobeData == null) { WriteInteger(0); } else { WriteInteger(WardrobeData.Rows.Count); foreach (DataRow Row in WardrobeData.Rows) { WriteInteger(Convert.ToInt32(Row["slot_id"])); WriteString(Convert.ToString(Row["look"])); WriteString(Row["gender"].ToString().ToUpper()); } } } }
public RoomMapManager(Room Room, string Map) { this.Room = Room; LoadValidTiles(Map); using (IQueryAdapter dbClient = DatabaseManager.GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `items` WHERE `room` = @room"); dbClient.AddParameter("room", Room.Id); DataTable data = dbClient.GetTable(); foreach (DataRow row in data.Rows) { RoomItem item = new RoomItem(); item.Id = Convert.ToInt32(row["id"]); item.BaseItem = ItemManager.FurnitureDefinitions[Convert.ToInt32(row["base_id"])]; item.Owner = Convert.ToInt32(row["owner"]); item.Room = Convert.ToInt32(row["room"]); item.X = Convert.ToInt32(row["x"]); item.Y = Convert.ToInt32(row["y"]); item.Z = Convert.ToDouble(row["z"]); item.Rot = Convert.ToInt32(row["rot"]); item.ExtraData = Convert.ToString(row["extra_data"]); RoomItems.Add(item.Id, item); } } }
private List <ChatlogEntry> GetChatlogs(RoomData RoomData, double TimeEnter, double TimeExit) { List <ChatlogEntry> Chats = new List <ChatlogEntry>(); DataTable Data = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `user_id`, `timestamp`, `message` FROM `chatlogs` WHERE `room_id` = " + RoomData.Id + " AND `timestamp` > " + TimeEnter + " AND `timestamp` < " + TimeExit + " ORDER BY `timestamp` DESC LIMIT 100"); Data = dbClient.GetTable(); if (Data != null) { foreach (DataRow Row in Data.Rows) { Habbo Habbo = PlusEnvironment.GetHabboById(Convert.ToInt32(Row["user_id"])); if (Habbo != null) { Chats.Add(new ChatlogEntry(Convert.ToInt32(Row["user_id"]), RoomData.Id, Convert.ToString(Row["message"]), Convert.ToDouble(Row["timestamp"]), Habbo)); } } } } return(Chats); }
/// <summary> /// Reloads the quests. /// </summary> /// <param name="dbClient">The database client.</param> public void ReloadQuests(IQueryAdapter dbClient) { _quests.Clear(); dbClient.SetQuery("SELECT * FROM users_quests"); var table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) { var id = Convert.ToUInt32(dataRow["id"]); var category = (string)dataRow["type"]; var number = (int)dataRow["level_num"]; var goalType = (int)dataRow["goal_type"]; var goalData = Convert.ToUInt32(dataRow["goal_data"]); var name = (string)dataRow["action"]; var reward = (int)dataRow["pixel_reward"]; var dataBit = (string)dataRow["data_bit"]; var rewardType = Convert.ToInt32(dataRow["reward_type"].ToString()); var timeUnlock = (int)dataRow["timestamp_unlock"]; var timeLock = (int)dataRow["timestamp_lock"]; var value = new Quest(id, category, number, (QuestType)goalType, goalData, name, reward, dataBit, rewardType, timeUnlock, timeLock); _quests.Add(id, value); AddToCounter(category); } }
public static List <Pet> GetPetsForUser(int UserId) { List <Pet> P = new List <Pet>(); DataTable dPets = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`user_id`,`room_id`,`name`,`x`,`y`,`z` FROM `bots` WHERE `user_id` = '" + UserId + "' AND `room_id` = '0' AND `ai_type` = 'pet'"); dPets = dbClient.GetTable(); if (dPets != null) { foreach (DataRow dRow in dPets.Rows) { dbClient.SetQuery("SELECT `type`,`race`,`color`,`experience`,`energy`,`nutrition`,`respect`,`createstamp`,`have_saddle`,`anyone_ride`,`hairdye`,`pethair`,`gnome_clothing` FROM `bots_petdata` WHERE `id` = '" + Convert.ToInt32(dRow["id"]) + "' LIMIT 1"); DataRow mRow = dbClient.GetRow(); if (mRow != null) { P.Add(new Pet(Convert.ToInt32(dRow["id"]), Convert.ToInt32(dRow["user_id"]), Convert.ToInt32(dRow["room_id"]), Convert.ToString(dRow["name"]), Convert.ToInt32(mRow["type"]), Convert.ToString(mRow["race"]), Convert.ToString(mRow["color"]), Convert.ToInt32(mRow["experience"]), Convert.ToInt32(mRow["energy"]), Convert.ToInt32(mRow["nutrition"]), Convert.ToInt32(mRow["respect"]), Convert.ToDouble(mRow["createstamp"]), Convert.ToInt32(dRow["x"]), Convert.ToInt32(dRow["y"]), Convert.ToDouble(dRow["z"]), Convert.ToInt32(mRow["have_saddle"]), Convert.ToInt32(mRow["anyone_ride"]), Convert.ToInt32(mRow["hairdye"]), Convert.ToInt32(mRow["pethair"]), Convert.ToString(mRow["gnome_clothing"]))); } } } } return(P); }
public void Init() { if (this._televisions.Count > 0) { _televisions.Clear(); } DataTable getData = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `items_youtube` ORDER BY `id` DESC"); getData = dbClient.GetTable(); if (getData != null) { foreach (DataRow Row in getData.Rows) { this._televisions.Add(Convert.ToInt32(Row["id"]), new TelevisionItem(Convert.ToInt32(Row["id"]), Row["youtube_id"].ToString(), Row["title"].ToString(), Row["description"].ToString(), PlusEnvironment.EnumToBool(Row["enabled"].ToString()))); } } } log.Info("Television Items -> LOADED"); }
public void InitPets() { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`user_id`,`room_id`,`name`,`x`,`y`,`z` FROM `bots` WHERE `room_id` = '" + RoomId + "' AND `ai_type` = 'pet'"); DataTable Data = dbClient.GetTable(); if (Data == null) { return; } foreach (DataRow Row in Data.Rows) { dbClient.SetQuery("SELECT `type`,`race`,`color`,`experience`,`energy`,`nutrition`,`respect`,`createstamp`,`have_saddle`,`anyone_ride`,`hairdye`,`pethair`,`gnome_clothing` FROM `bots_petdata` WHERE `id` = '" + Row[0] + "' LIMIT 1"); DataRow mRow = dbClient.GetRow(); if (mRow == null) { continue; } Pet Pet = new Pet(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["room_id"]), Convert.ToString(Row["name"]), Convert.ToInt32(mRow["type"]), Convert.ToString(mRow["race"]), Convert.ToString(mRow["color"]), Convert.ToInt32(mRow["experience"]), Convert.ToInt32(mRow["energy"]), Convert.ToInt32(mRow["nutrition"]), Convert.ToInt32(mRow["respect"]), Convert.ToDouble(mRow["createstamp"]), Convert.ToInt32(Row["x"]), Convert.ToInt32(Row["y"]), Convert.ToDouble(Row["z"]), Convert.ToInt32(mRow["have_saddle"]), Convert.ToInt32(mRow["anyone_ride"]), Convert.ToInt32(mRow["hairdye"]), Convert.ToInt32(mRow["pethair"]), Convert.ToString(mRow["gnome_clothing"])); var RndSpeechList = new List <RandomSpeech>(); _roomUserManager.DeployBot(new RoomBot(Pet.PetId, RoomId, "pet", "freeroam", Pet.Name, "", Pet.Look, Pet.X, Pet.Y, Convert.ToInt32(Pet.Z), 0, 0, 0, 0, 0, ref RndSpeechList, "", 0, Pet.OwnerId, false, 0, false, 0), Pet); } } }
public void LoadRights() { UsersWithRights = new List <int>(); if (Group != null) { return; } DataTable Data = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT room_rights.user_id FROM room_rights WHERE room_id = @roomid"); dbClient.AddParameter("roomid", Id); Data = dbClient.GetTable(); } if (Data != null) { foreach (DataRow Row in Data.Rows) { UsersWithRights.Add(Convert.ToInt32(Row["user_id"])); } } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal void Initialize(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM catalog_clothing"); ClothingItems = new Dictionary<string, ClothingItem>(); _table = dbClient.GetTable(); foreach (DataRow dataRow in _table.Rows) ClothingItems.Add((string)dataRow["item_name"], new ClothingItem(dataRow)); }
/// <summary> /// Loads the bans. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadBans(IQueryAdapter dbClient) { _bannedUsernames.Clear(); _bannedIPs.Clear(); _bannedMachines.Clear(); dbClient.SetQuery("SELECT bantype,value,reason,expire FROM users_bans"); DataTable table = dbClient.GetTable(); double num = Yupi.GetUnixTimeStamp(); foreach (DataRow dataRow in table.Rows) { string text = (string) dataRow["value"]; string reasonMessage = (string) dataRow["reason"]; double num2 = (double) dataRow["expire"]; string a = (string) dataRow["bantype"]; ModerationBanType type; switch (a) { case "user": type = ModerationBanType.UserName; break; case "ip": type = ModerationBanType.Ip; break; default: type = ModerationBanType.Machine; break; } ModerationBan moderationBan = new ModerationBan(type, text, reasonMessage, num2); if (!(num2 > num)) continue; switch (moderationBan.Type) { case ModerationBanType.UserName: if (!_bannedUsernames.Contains(text)) _bannedUsernames.Add(text, moderationBan); break; case ModerationBanType.Ip: if (!_bannedIPs.Contains(text)) _bannedIPs.Add(text, moderationBan); break; default: if (!_bannedMachines.ContainsKey(text)) _bannedMachines.Add(text, moderationBan); break; } } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> public static void Init(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM pets_breeds"); DataTable table = dbClient.GetTable(); Races = new List<PetRace>(); foreach (PetRace item in from DataRow row in table.Rows select new PetRace { RaceId = (int) row["breed_id"], Color1 = (int) row["color1"], Color2 = (int) row["color2"], Has1Color = (string) row["color1_enabled"] == "1", Has2Color = (string) row["color2_enabled"] == "1" }) Races.Add(item); }
internal void Initialize(IQueryAdapter dbClient) { CraftingRecipes.Clear(); dbClient.SetQuery("SELECT * FROM crafting_recipes"); var recipes = dbClient.GetTable(); foreach (DataRow recipe in recipes.Rows) { CraftingRecipe value = new CraftingRecipe((string)recipe["id"], (string)recipe["items"], (string)recipe["result"]); CraftingRecipes.Add((string)recipe["id"], value); } CraftableItems.Clear(); dbClient.SetQuery("SELECT * FROM crafting_items"); var items = dbClient.GetTable(); foreach (DataRow item in items.Rows) { CraftableItems.Add((string)item["itemName"]); } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal static void Init(IQueryAdapter dbClient) { _values = new Dictionary<string, string[]>(); dbClient.SetQuery("SELECT * FROM pets_speech"); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) _values.Add(dataRow["pet_id"].ToString(), dataRow["responses"].ToString().Split(';')); }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal void Initialize(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM items_pinatas"); Pinatas = new Dictionary<uint, PinataItem>(); _table = dbClient.GetTable(); foreach (DataRow dataRow in _table.Rows) { var value = new PinataItem(dataRow); Pinatas.Add(uint.Parse(dataRow["item_baseid"].ToString()), value); } }
internal static void GetTypes(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM catalog_pets ORDER BY pet_race_id ASC"); DataTable table = dbClient.GetTable(); _petTypes = new Dictionary<string, PetType>(); foreach (DataRow dataRow in table.Rows) _petTypes.Add((string) dataRow["pet_type"], new PetType(dataRow)); }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal static void GetRaces(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM pets_races ORDER BY race_type ASC"); DataTable table = dbClient.GetTable(); _petRaces = new List<PetRace>(); foreach (DataRow dataRow in table.Rows) _petRaces.Add(new PetRace(dataRow)); }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal static void Init(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM pets_commands"); _petCommands = new Dictionary<uint, PetCommand>(); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) _petCommands.Add(uint.Parse(dataRow["id"].ToString()), new PetCommand(dataRow)); }
/// <summary> /// Initializes a new instance of the <see cref="ServerDatabaseSettings" /> class. /// </summary> /// <param name="dbClient">The database client.</param> internal ServerDatabaseSettings(IQueryAdapter dbClient) { DbData = new Dictionary<string, string>(); DbData.Clear(); dbClient.SetQuery("SELECT * FROM server_settings"); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) DbData.Add(dataRow[0].ToString(), dataRow[1].ToString()); }
/// <summary> /// Initializes the offline messages. /// </summary> /// <param name="dbClient">The database client.</param> internal static void InitOfflineMessages(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM messenger_offline_messages"); var table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) { var key = (uint)dataRow[1]; var id = (uint)dataRow[2]; var msg = dataRow[3].ToString(); var ts = (double)dataRow[4]; if (!AzureEmulator.OfflineMessages.ContainsKey(key)) AzureEmulator.OfflineMessages.Add(key, new List<OfflineMessage>()); AzureEmulator.OfflineMessages[key].Add(new OfflineMessage(id, msg, ts)); } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal void Initialize(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM achievements_talents ORDER BY `order_num` ASC"); DataTable table = dbClient.GetTable(); foreach (Talent talent in from DataRow dataRow in table.Rows select new Talent( (int)dataRow["id"], (string)dataRow["type"], (int)dataRow["parent_category"], (int)dataRow["level"], (string)dataRow["achievement_group"], (int)dataRow["achievement_level"], (string)dataRow["prize"], (uint)dataRow["prize_baseitem"])) Talents.Add(talent.Id, talent); }
/// <summary> /// Initializes the offline messages. /// </summary> /// <param name="dbClient">The database client.</param> internal static void InitOfflineMessages(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM messenger_offline_messages"); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) { uint key = (uint) dataRow[1]; uint id = (uint) dataRow[2]; string msg = dataRow[3].ToString(); double ts = (double) dataRow[4]; if (!Yupi.OfflineMessages.ContainsKey(key)) Yupi.OfflineMessages.Add(key, new List<OfflineMessage>()); Yupi.OfflineMessages[key].Add(new OfflineMessage(id, msg, ts)); } }
/// <summary> /// Reloads the quests. /// </summary> /// <param name="dbClient">The database client.</param> public void ReloadQuests(IQueryAdapter dbClient) { _quests.Clear(); dbClient.SetQuery("SELECT * FROM users_quests"); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) { UInt32 id = Convert.ToUInt32(dataRow["id"]); string category = (string)dataRow["type"]; Int32 number = (int)dataRow["level_num"]; Int32 goalType = (int)dataRow["goal_type"]; UInt32 goalData = Convert.ToUInt32(dataRow["goal_data"]); string name = (string)dataRow["action"]; Int32 reward = (int)dataRow["pixel_reward"]; string dataBit = (string)dataRow["data_bit"]; Int32 rewardType = Convert.ToInt32(dataRow["reward_type"].ToString()); Int32 timeUnlock = (int)dataRow["timestamp_unlock"]; Int32 timeLock = (int)dataRow["timestamp_lock"]; Quest value = new Quest(id, category, number, (QuestType)goalType, goalData, name, reward, dataBit, rewardType, timeUnlock, timeLock); _quests.Add(id, value); AddToCounter(category); } }
/// <summary> /// Loads the models. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadModels(IQueryAdapter dbClient) { _roomModels.Clear(); dbClient.SetQuery( "SELECT id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only,poolmap FROM rooms_models"); var table = dbClient.GetTable(); if (table == null) return; foreach (DataRow dataRow in table.Rows) { var key = (string)dataRow["id"]; if (key.StartsWith("model_floorplan_")) continue; var staticFurniMap = (string)dataRow["public_items"]; _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, AzureEmulator.EnumToBool(dataRow["club_only"].ToString()), (string)dataRow["poolmap"])); } dbClient.SetQuery("SELECT roomid,door_x,door_y,door_z,door_dir,heightmap FROM rooms_models_customs"); var dataCustom = dbClient.GetTable(); if (dataCustom == null) return; foreach (DataRow row in dataCustom.Rows) { var modelName = string.Format("custom_{0}", row["roomid"]); _roomModels.Add(modelName, new RoomModel((int)row["door_x"], (int)row["door_y"], (double)row["door_z"], (int)row["door_dir"], (string)row["heightmap"], "", false, "")); } }
/// <summary> /// Initializes the voted rooms. /// </summary> /// <param name="dbClient">The database client.</param> internal void InitVotedRooms(IQueryAdapter dbClient) { dbClient.SetQuery( "SELECT * FROM rooms_data WHERE score > 0 AND roomtype = 'private' ORDER BY score DESC LIMIT 40"); var table = dbClient.GetTable(); foreach ( var data in from DataRow dataRow in table.Rows select FetchRoomData(Convert.ToUInt32(dataRow["id"]), dataRow)) QueueVoteAdd(data); }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal void Initialize(IQueryAdapter dbClient) { Categories = new HybridDictionary(); Offers = new HybridDictionary(); FlatOffers = new Dictionary<uint, uint>(); EcotronRewards = new List<EcotronReward>(); EcotronLevels = new List<int>(); HabboClubItems = new List<CatalogItem>(); dbClient.SetQuery("SELECT * FROM catalog_items ORDER BY id ASC"); DataTable itemsTable = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM catalog_pages ORDER BY id ASC"); DataTable pagesTable = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM catalog_ecotron_items ORDER BY reward_level ASC"); DataTable ecotronItems = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM catalog_items WHERE special_name LIKE 'HABBO_CLUB_VIP%'"); DataTable habboClubItems = dbClient.GetTable(); if (itemsTable != null) { foreach (DataRow dataRow in itemsTable.Rows) { if (string.IsNullOrEmpty(dataRow["item_names"].ToString()) || string.IsNullOrEmpty(dataRow["amounts"].ToString())) continue; string source = dataRow["item_names"].ToString(); string firstItem = dataRow["item_names"].ToString().Split(';')[0]; Item item; if (!Yupi.GetGame().GetItemManager().GetItem(firstItem, out item)) continue; uint num = !source.Contains(';') ? item.FlatId : 0; if (!dataRow.IsNull("special_name")) item.PublicName = (string) dataRow["special_name"]; CatalogItem catalogItem = new CatalogItem(dataRow, item.PublicName); if (catalogItem.GetFirstBaseItem() == null) continue; Offers.Add(catalogItem.Id, catalogItem); if (!FlatOffers.ContainsKey(num)) FlatOffers.Add(num, catalogItem.Id); } } if (pagesTable != null) { foreach (DataRow dataRow2 in pagesTable.Rows) { bool visible = false; bool enabled = false; if (dataRow2["visible"].ToString() == "1") visible = true; if (dataRow2["enabled"].ToString() == "1") enabled = true; Categories.Add((uint) dataRow2["id"], new CatalogPage((uint) dataRow2["id"], short.Parse(dataRow2["parent_id"].ToString()), (string) dataRow2["code_name"], (string) dataRow2["caption"], visible, enabled, false, (uint) dataRow2["min_rank"], (int) dataRow2["icon_image"], (string) dataRow2["page_layout"], (string) dataRow2["page_headline"], (string) dataRow2["page_teaser"], (string) dataRow2["page_special"], (string) dataRow2["page_text1"], (string) dataRow2["page_text2"], (string) dataRow2["page_text_details"], (string) dataRow2["page_text_teaser"], (string) dataRow2["page_link_description"], (string) dataRow2["page_link_pagename"], (int) dataRow2["order_num"], ref Offers)); } } if (ecotronItems != null) { foreach (DataRow dataRow3 in ecotronItems.Rows) { EcotronRewards.Add(new EcotronReward(Convert.ToUInt32(dataRow3["display_id"]), Convert.ToUInt32(dataRow3["item_id"]), Convert.ToUInt32(dataRow3["reward_level"]))); if (!EcotronLevels.Contains(Convert.ToInt16(dataRow3["reward_level"]))) EcotronLevels.Add(Convert.ToInt16(dataRow3["reward_level"])); } } if (habboClubItems != null) { foreach (DataRow row in habboClubItems.Rows) HabboClubItems.Add(new CatalogItem(row, row.IsNull("special_name") ? "Habbo VIP" : (string) row["special_name"])); } }
/// <summary> /// Loads the message presets. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadMessagePresets(IQueryAdapter dbClient) { UserMessagePresets.Clear(); RoomMessagePresets.Clear(); SupportTicketHints.Clear(); ModerationTemplates.Clear(); dbClient.SetQuery("SELECT type,message FROM moderation_presets WHERE enabled = 2"); DataTable table = dbClient.GetTable(); dbClient.SetQuery("SELECT word,hint FROM moderation_tickethints"); DataTable table2 = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM moderation_templates"); DataTable table3 = dbClient.GetTable(); if (table == null || table2 == null) return; foreach (DataRow dataRow in table.Rows) { string item = (string) dataRow["message"]; string a = dataRow["type"].ToString().ToLower(); if (a != "message") { switch (a) { case "roommessage": RoomMessagePresets.Add(item); break; } } else UserMessagePresets.Add(item); } foreach (DataRow dataRow2 in table2.Rows) SupportTicketHints.Add((string) dataRow2[0], (string) dataRow2[1]); foreach (DataRow dataRow3 in table3.Rows) ModerationTemplates.Add(uint.Parse(dataRow3["id"].ToString()), new ModerationTemplate(uint.Parse(dataRow3["id"].ToString()), short.Parse(dataRow3["category"].ToString()), dataRow3["cName"].ToString(), dataRow3["caption"].ToString(), dataRow3["warning_message"].ToString(), dataRow3["ban_message"].ToString(), short.Parse(dataRow3["ban_hours"].ToString()), dataRow3["avatar_ban"].ToString() == "1", dataRow3["mute"].ToString() == "1", dataRow3["trade_lock"].ToString() == "1")); }
/// <summary> /// Loads the items. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadItems(IQueryAdapter dbClient) { _items = new Hashtable(); _items.Clear(); GiftWrappers.Clear(); dbClient.SetQuery("SELECT * FROM catalog_furnis"); var table = dbClient.GetTable(); if (table == null) return; List<double> heights = null; foreach (DataRow dataRow in table.Rows) { try { var id = Convert.ToUInt32(dataRow["id"]); var type = Convert.ToChar(dataRow["type"]); var name = Convert.ToString(dataRow["item_name"]); var flatId = Convert.ToInt32(dataRow["flat_id"]); var stackHeightStr = dataRow["stack_height"].ToString(); double stackHeight; uint modes; uint.TryParse(dataRow["interaction_modes_count"].ToString(), out modes); var vendingIds = (string)dataRow["vending_ids"]; var sub = AzureEmulator.EnumToBool(dataRow["subscriber"].ToString()); var effect = (int)dataRow["effectid"]; var stackable = Convert.ToInt32(dataRow["can_stack"]) == 1; var allowRecycle = Convert.ToInt32(dataRow["allow_recycle"]) == 1; var allowTrade = Convert.ToInt32(dataRow["allow_trade"]) == 1; var allowMarketplaceSell = Convert.ToInt32(dataRow["allow_marketplace_sell"]) == 1; var allowGift = Convert.ToInt32(dataRow["allow_gift"]) == 1; var allowInventoryStack = Convert.ToInt32(dataRow["allow_inventory_stack"]) == 1; var typeFromString = InteractionTypes.GetTypeFromString((string)dataRow["interaction_type"]); int sprite = 0; ushort x = ushort.MinValue, y = ushort.MinValue; var publicName = Convert.ToString(dataRow["item_name"]); bool canWalk = false, canSit = false, stackMultiple = false; if (name.StartsWith("external_image_wallitem_poster")) PhotoId = id; // Special Types of Furnis if (name == "landscape" || name == "floor" || name == "wallpaper") { sprite = FurniDataParser.WallItems[name].Id; x = 1; y = 1; } else if (type == 's' && FurniDataParser.FloorItems.ContainsKey(name)) { sprite = FurniDataParser.FloorItems[name].Id; publicName = FurniDataParser.FloorItems[name].Name; x = FurniDataParser.FloorItems[name].X; y = FurniDataParser.FloorItems[name].Y; canWalk = FurniDataParser.FloorItems[name].CanWalk; canSit = FurniDataParser.FloorItems[name].CanSit; } else if (type == 'i' && FurniDataParser.WallItems.ContainsKey(name)) { sprite = FurniDataParser.WallItems[name].Id; publicName = FurniDataParser.WallItems[name].Name; } else if (name.StartsWith("a0 pet", StringComparison.InvariantCulture)) { x = 1; y = 1; publicName = name; } else if (type != 'e' && type != 'h' && type != 'r' && type != 'b') continue; if (name.StartsWith("present_gen")) GiftWrappers.AddOld(sprite); else if (name.StartsWith("present_wrap*")) GiftWrappers.Add(sprite); // Stack Height Values if (stackHeightStr.Contains(';')) { var heightsStr = stackHeightStr.Split(';'); heights = heightsStr.Select(heightStr => double.Parse(heightStr, CultureInfo.InvariantCulture)) .ToList(); stackHeight = heights[0]; stackMultiple = true; } else { stackHeight = double.Parse(stackHeightStr, CultureInfo.InvariantCulture); } // If Can Walk if (InteractionTypes.AreFamiliar(GlobalInteractions.Gate, typeFromString) || (typeFromString == Interaction.BanzaiPyramid) || (name.StartsWith("hole"))) canWalk = false; // Add Item var value = new Item(id, sprite, publicName, name, type, x, y, stackHeight, stackable, canWalk, canSit, allowRecycle, allowTrade, allowMarketplaceSell, allowGift, allowInventoryStack, typeFromString, modes, vendingIds, sub, effect, stackMultiple, (heights == null ? null : heights.ToArray()), flatId); _items.Add(id, value); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadKey(); Out.WriteLine( string.Format("Could not load item #{0}, please verify the data is okay.", Convert.ToUInt32(dataRow[0])), "Azure.Items", ConsoleColor.DarkRed); } } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> public void Initialize(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM navigator_flatcats WHERE enabled = '2'"); DataTable table = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM navigator_publics"); DataTable table2 = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM navigator_pubcats"); DataTable table3 = dbClient.GetTable(); dbClient.SetQuery("SELECT * FROM navigator_promocats"); DataTable table4 = dbClient.GetTable(); if (table4 != null) { PromoCategories.Clear(); foreach (DataRow dataRow in table4.Rows) PromoCategories.Add((int) dataRow["id"], new PromoCategory((int) dataRow["id"], (string) dataRow["caption"], (int) dataRow["min_rank"], Yupi.EnumToBool((string) dataRow["visible"]))); } if (table != null) { PrivateCategories.Clear(); foreach (DataRow dataRow in table.Rows) PrivateCategories.Add((int) dataRow["id"], new PublicCategory((int) dataRow["id"], (string) dataRow["caption"], (int) dataRow["min_rank"])); } if (table2 != null) { _publicItems.Clear(); foreach (DataRow row in table2.Rows) { _publicItems.Add(Convert.ToUInt32(row["id"]), new PublicItem(Convert.ToUInt32(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, (uint) row["room_id"], 0, (int) row["category_parent_id"], row["recommended"].ToString() == "1", (int) row["typeofdata"], string.Empty)); } } if (table3 != null) { InCategories.Clear(); foreach (DataRow dataRow in table3.Rows) InCategories.Add((int) dataRow["id"], (string) dataRow["caption"]); } }
/// <summary> /// Initializes the specified database client. /// </summary> /// <param name="dbClient">The database client.</param> internal static void Init(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM pets_commands"); _table = dbClient.GetTable(); _petCommands = new Dictionary<string, PetCommand>(); foreach (DataRow row in _table.Rows) { _petCommands.Add(row[1].ToString(), new PetCommand(Convert.ToInt32(row[0].ToString()), row[1].ToString())); } }
public void LoadRights(IQueryAdapter dbClient) { this.ClearPermissions(); dbClient.SetQuery("SELECT * FROM ranks ORDER BY id ASC;"); DataTable table = dbClient.GetTable(); if (table != null) { foreach (DataRow row in table.Rows) { this.RankBadge.Add((uint)row["id"], row["badgeid"].ToString()); } } dbClient.SetQuery("SELECT * FROM permissions_ranks ORDER BY rank ASC;"); table = dbClient.GetTable(); if (table != null) { foreach (DataRow row3 in table.Rows) { } foreach (DataRow row in table.Rows) { this.RankFlood.Add((uint)row["rank"], (int)row["floodtime"]); List<string> list = new List<string>(); if (AzureEmulator.EnumToBool(row["support_tool"].ToString())) { list.Add("support_tool"); } if (AzureEmulator.EnumToBool(row["ambassadeur"].ToString())) { list.Add("ambassadeur"); } if (AzureEmulator.EnumToBool(row["moderator"].ToString())) { list.Add("moderator"); } if (AzureEmulator.EnumToBool(row["manager"].ToString())) { list.Add("manager"); } if (AzureEmulator.EnumToBool(row["admin"].ToString())) { list.Add("admin"); } if (AzureEmulator.EnumToBool(row["staff_chat"].ToString())) { list.Add("staff_chat"); } if (AzureEmulator.EnumToBool(row["user_is_staff"].ToString())) { list.Add("user_is_staff"); } if (AzureEmulator.EnumToBool(row["user_not_kickable"].ToString())) { list.Add("user_not_kickable"); } if (AzureEmulator.EnumToBool(row["user_can_read_whisper"].ToString())) { list.Add("user_can_read_whisper"); } if (AzureEmulator.EnumToBool(row["user_can_change_name"].ToString())) { list.Add("user_can_change_name"); } if (AzureEmulator.EnumToBool(row["user_enter_full_rooms"].ToString())) { list.Add("user_enter_full_rooms"); } if (AzureEmulator.EnumToBool(row["user_enter_any_room"].ToString())) { list.Add("user_enter_any_room"); } if (AzureEmulator.EnumToBool(row["user_control_any_room"].ToString())) { list.Add("user_control_any_room"); } if (AzureEmulator.EnumToBool(row["user_room_staff_pick"].ToString())) { list.Add("user_room_staff_pick"); } if (AzureEmulator.EnumToBool(row["cmd_global_refresh_permissions"].ToString())) { list.Add("cmd_global_refresh_permissions"); } if (AzureEmulator.EnumToBool(row["cmd_user_can_give_currency"].ToString())) { list.Add("cmd_user_can_give_currency"); } if (AzureEmulator.EnumToBool(row["modtool_can_read_chatlog"].ToString())) { list.Add("modtool_can_read_chatlog"); } if (AzureEmulator.EnumToBool(row["modtool_can_send_alert"].ToString())) { list.Add("modtool_can_send_alert"); } if (AzureEmulator.EnumToBool(row["modtool_can_ban_user"].ToString())) { list.Add("modtool_can_ban_user"); } if (AzureEmulator.EnumToBool(row["modtool_can_kick_user"].ToString())) { list.Add("modtool_can_kick_user"); } this.RankPermissions.Add((uint)row["rank"], list); } } }
/// <summary> /// Loads the bots commands. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadBotsCommands(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM bots_commands"); BotCommands = new Dictionary<uint, BotCommand>(); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) BotCommands.Add(uint.Parse(dataRow["id"].ToString()), new BotCommand(dataRow)); }
/// <summary> /// Loads the catalog bots. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadCatalogBots(IQueryAdapter dbClient) { dbClient.SetQuery("SELECT * FROM catalog_bots"); CatalogBots = new Dictionary<string, CatalogBot>(); DataTable table = dbClient.GetTable(); foreach (DataRow dataRow in table.Rows) CatalogBots.Add(dataRow["bot_type"].ToString(), new CatalogBot(dataRow)); }
/// <summary> /// Loads the models. /// </summary> /// <param name="dbClient">The database client.</param> internal void LoadModels(IQueryAdapter dbClient) { _roomModels.Clear(); dbClient.SetQuery("SELECT * FROM rooms_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"]; _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, Yupi.EnumToBool(dataRow["club_only"].ToString()), (string) dataRow["poolmap"])); } dbClient.SetQuery("SELECT * FROM rooms_models_customs"); DataTable dataCustom = dbClient.GetTable(); if (dataCustom == null) return; foreach (DataRow row in dataCustom.Rows) { string modelName = $"custom_{row["roomid"]}"; _roomModels.Add(modelName, new RoomModel((int) row["door_x"], (int) row["door_y"], (double) row["door_z"], (int) row["door_dir"], (string) row["heightmap"], "", false, "")); } }