public MoodlightData(int itemId) { ItemId = itemId; DataRow row = null; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery( "SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id = '" + itemId + "' LIMIT 1"); row = dbClient.GetRow(); } if (row == null) { using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery( "INSERT INTO `room_items_moodlight` (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES (" + itemId + ",0,1,'#000000,255,0','#000000,255,0','#000000,255,0')"); dbClient.SetQuery( "SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id=" + itemId + " LIMIT 1"); row = dbClient.GetRow(); } } Enabled = PlusEnvironment.EnumToBool(row["enabled"].ToString()); CurrentPreset = Convert.ToInt32(row["current_preset"]); Presets = new List <MoodlightPreset>(); Presets.Add(GeneratePreset(Convert.ToString(row["preset_one"]))); Presets.Add(GeneratePreset(Convert.ToString(row["preset_two"]))); Presets.Add(GeneratePreset(Convert.ToString(row["preset_three"]))); }
internal bool Init(Habbo habbo) { if (_effects.Count > 0) { return(false); } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `user_effects` WHERE `user_id` = @id;"); dbClient.AddParameter("id", habbo.Id); var getEffects = dbClient.GetTable(); if (getEffects != null) { foreach (DataRow row in getEffects.Rows) { if (_effects.TryAdd(Convert.ToInt32(row["id"]), new AvatarEffect(Convert.ToInt32(row["id"]), Convert.ToInt32(row["user_id"]), Convert.ToInt32(row["effect_id"]), Convert.ToDouble(row["total_duration"]), PlusEnvironment.EnumToBool(row["is_activated"].ToString()), Convert.ToDouble(row["activated_stamp"]), Convert.ToInt32(row["quantity"])))) { //umm? } } } } _habbo = habbo; CurrentEffect = 0; return(true); }
public void LoadModel(string Id) { DataRow Row = null; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery( "SELECT id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only,poolmap,`wall_height` FROM `room_models` WHERE `custom` = '1' AND `id` = '" + Id + "' LIMIT 1"); Row = dbClient.GetRow(); if (Row == null) { return; } var Modelname = Convert.ToString(Row["id"]); if (!_roomModels.ContainsKey(Id)) { _roomModels.Add(Modelname, new RoomModel(Convert.ToInt32(Row["door_x"]), Convert.ToInt32(Row["door_y"]), Convert.ToDouble(Row["door_z"]), Convert.ToInt32(Row["door_dir"]), Convert.ToString(Row["heightmap"]), Convert.ToString(Row["public_items"]), PlusEnvironment.EnumToBool(Row["club_only"].ToString()), Convert.ToString(Row["poolmap"]), Convert.ToInt32(Row["wall_height"]))); } } }
public void LoadModels() { if (_roomModels.Count > 0) { _roomModels.Clear(); } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery( "SELECT id,door_x,door_y,door_z,door_dir,heightmap,public_items,club_only,poolmap,`wall_height` FROM `room_models` WHERE `custom` = '0'"); var Data = dbClient.GetTable(); if (Data == null) { return; } foreach (DataRow Row in Data.Rows) { var Modelname = Convert.ToString(Row["id"]); var staticFurniture = Convert.ToString(Row["public_items"]); _roomModels.Add(Modelname, new RoomModel(Convert.ToInt32(Row["door_x"]), Convert.ToInt32(Row["door_y"]), (double)Row["door_z"], Convert.ToInt32(Row["door_dir"]), Convert.ToString(Row["heightmap"]), Convert.ToString(Row["public_items"]), PlusEnvironment.EnumToBool(Row["club_only"].ToString()), Convert.ToString(Row["poolmap"]), Convert.ToInt32(Row["wall_height"]))); } } }
public void Init() { if (Televisions.Count > 0) { Televisions.Clear(); } DataTable getData = null; using (var 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) { 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"); }
/// <summary> /// Initializes the house list dictionary /// </summary> public void Init() { HouseList.Clear(); DataTable Houses; using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("SELECT * from `rp_houses`"); Houses = DB.getTable(); if (Houses != null) { foreach (DataRow Row in Houses.Rows) { int RoomId = Convert.ToInt32(Row["room_id"]); int OwnerId = Convert.ToInt32(Row["owner_id"]); int Cost = Convert.ToInt32(Row["cost"]); bool ForSale = PlusEnvironment.EnumToBool(Row["for_sale"].ToString()); string[] Upgrades = Row["upgrades"].ToString().Split(','); bool IsLocked = PlusEnvironment.EnumToBool(Row["is_locked"].ToString()); int SignRoomId = Convert.ToInt32(Row["sign_room_id"]); int SignX = Convert.ToInt32(Row["sign_x"]); int SignY = Convert.ToInt32(Row["sign_y"]); int SignZ = Convert.ToInt32(Row["sign_z"]); HouseSign newSign = new HouseSign(SignRoomId, SignX, SignY, SignZ); House newHouse = new House(RoomId, OwnerId, Cost, ForSale, Upgrades, IsLocked, newSign); HouseList.TryAdd(RoomId, newHouse); } } } //log.Info("Carregado " + HouseList.Count + " casas."); }
public void OnNewFriendship(int friendID) { GameClient friend = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID); MessengerBuddy newFriend; if (friend == null || friend.GetHabbo() == null) { DataRow dRow; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT id,username,motto,look,last_online,hide_inroom,hide_online FROM users WHERE `id` = @friendid LIMIT 1"); dbClient.AddParameter("friendid", friendID); dRow = dbClient.getRow(); } newFriend = new MessengerBuddy(friendID, Convert.ToString(dRow["username"]), Convert.ToString(dRow["look"]), Convert.ToString(dRow["motto"]), Convert.ToInt32(dRow["last_online"]), PlusEnvironment.EnumToBool(dRow["hide_online"].ToString()), PlusEnvironment.EnumToBool(dRow["hide_inroom"].ToString()), false); } else { Habbo user = friend.GetHabbo(); newFriend = new MessengerBuddy(friendID, user.Username, user.Look, user.Motto, 0, user.AppearOffline, user.AllowPublicRoomStatus, false); newFriend.UpdateUser(friend); } if (!_friends.ContainsKey(friendID)) { _friends.Add(friendID, newFriend); } GetClient().SendMessage(SerializeUpdate(newFriend)); }
public void Init() { if (_games.Count > 0) { _games.Clear(); } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DataTable GetData = null; dbClient.SetQuery( "SELECT `id`,`name`,`colour_one`,`colour_two`,`resource_path`,`string_three`,`game_swf`,`game_assets`,`game_server_host`,`game_server_port`,`socket_policy_port`,`game_enabled` FROM `games_config`"); GetData = dbClient.GetTable(); if (GetData != null) { foreach (DataRow Row in GetData.Rows) { _games.Add(Convert.ToInt32(Row["id"]), new GameData(Convert.ToInt32(Row["id"]), Convert.ToString(Row["name"]), Convert.ToString(Row["colour_one"]), Convert.ToString(Row["colour_two"]), Convert.ToString(Row["resource_path"]), Convert.ToString(Row["string_three"]), Convert.ToString(Row["game_swf"]), Convert.ToString(Row["game_assets"]), Convert.ToString(Row["game_server_host"]), Convert.ToString(Row["game_server_port"]), Convert.ToString(Row["socket_policy_port"]), PlusEnvironment.EnumToBool(Row["game_enabled"].ToString()))); } } } log.Info("Game Data Manager -> LOADED"); }
/// <summary> /// Initializes the food list dictionary /// </summary> public static void Initialize() { FoodList.Clear(); DataTable Foods; using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("SELECT * from `rp_food`"); Foods = DB.getTable(); if (Foods != null) { foreach (DataRow Food in Foods.Rows) { string Name = Food["name"].ToString(); string Type = Convert.ToString(Food["type"]); int ItemId = Convert.ToInt32(Food["item_id"]); string ExtraData = Food["extra_data"].ToString(); int Cost = Convert.ToInt32(Food["cost"]); int Health = Convert.ToInt32(Food["health"]); int Energy = Convert.ToInt32(Food["energy"]); int Hunger = Convert.ToInt32(Food["hunger"]); string ServeText = Food["serve_text"].ToString(); string EatText = Food["eat_text"].ToString(); bool Servable = PlusEnvironment.EnumToBool(Food["servable"].ToString()); Food newFood = new Food(Name, Type, ItemId, ExtraData, Cost, Health, Energy, Hunger, ServeText, EatText, Servable); FoodList.TryAdd(Name, newFood); } } } log.Info("Carregado " + FoodList.Count + " comidas."); }
public void GetGangData() { Gangs.Clear(); GenericGangRanks.Clear(); GenericGangRanks = GenerateGangRanks(); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `rp_gangs`"); DataTable Table = dbClient.getTable(); if (Table != null) { foreach (DataRow Row in Table.Rows) { int Id = Convert.ToInt32(Row["id"]); string Name = Row["name"].ToString(); string Description = Row["desc"].ToString(); string Badge = Row["badge"].ToString(); int OwnerId = Convert.ToInt32(Row["owner_id"]); int Created = Convert.ToInt32(Row["created"]); int RoomId = Convert.ToInt32(Row["room_id"]); int State = Convert.ToInt32(Row["state"]); int Colour1 = Convert.ToInt32(Row["colour1"]); int Colour2 = Convert.ToInt32(Row["colour2"]); int AdminOnlyDeco = Convert.ToInt32(Row["admindeco"]); bool ForumEnabled = PlusEnvironment.EnumToBool(Row["forum_enabled"].ToString()); int ForumMessagesCount = Convert.ToInt32(Row["forum_messages_count"]); double ForumScore = Convert.ToDouble(Row["forum_score"]); int LastPosterId = Convert.ToInt32(Row["forum_lastposter_id"]); string LastPosterName = PlusEnvironment.GetHabboById(LastPosterId) == null ? "HabboRPG" : PlusEnvironment.GetHabboById(LastPosterId).Username; int LastPosterTimeStamp = Convert.ToInt32(Row["forum_lastposter_timestamp"]); int WhoCanRead = Convert.ToInt32(Row["who_can_read"]); int WhoCanPost = Convert.ToInt32(Row["who_can_post"]); int WhoCanThread = Convert.ToInt32(Row["who_can_thread"]); int WhoCanMod = Convert.ToInt32(Row["who_can_mod"]); int Kills = Convert.ToInt32(Row["gang_kills"]); int Deaths = Convert.ToInt32(Row["gang_deaths"]); int Score = Convert.ToInt32(Row["gang_score"]); int MediPacks = Convert.ToInt32(Row["medipacks"]); List <int> Requests; ConcurrentDictionary <int, GroupMember> Members = GenerateGangMembers(Id, out Requests); Group Gang = new Group(Id, Name, Description, Badge, RoomId, OwnerId, Created, State, Colour1, Colour2, AdminOnlyDeco, ForumEnabled, Name, Description, ForumMessagesCount, ForumScore, LastPosterId, LastPosterName, LastPosterTimeStamp, WhoCanMod, WhoCanPost, WhoCanRead, WhoCanThread, GenericGangRanks, Members, Requests, Kills, Deaths, Score, MediPacks); if (!Gangs.ContainsKey(Id)) { Gangs.TryAdd(Id, Gang); } } } } }
public static MoodlightPreset GeneratePreset(string data) { var bits = data.Split(','); if (!IsValidColor(bits[0])) { bits[0] = "#000000"; } return(new MoodlightPreset(bits[0], int.Parse(bits[1]), PlusEnvironment.EnumToBool(bits[2]))); }
public static void Initialize() { AllCraftingRecipes.Clear(); SecretCraftingRecipes.Clear(); NotSecretCraftingRecipes.Clear(); CraftableItems.Clear(); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `crafting_recipes`"); var recipes = dbClient.getTable(); if (recipes != null) { foreach (DataRow recipe in recipes.Rows) { string Items = recipe["items"].ToString().ToLower(); string Result = recipe["result"].ToString().ToLower(); bool Secret = PlusEnvironment.EnumToBool(recipe["secret"].ToString()); CraftingRecipe Recipe = new CraftingRecipe(Items, Result, Secret); if (!AllCraftingRecipes.ContainsKey(Result)) { AllCraftingRecipes.TryAdd(Result, Recipe); } if (!SecretCraftingRecipes.ContainsKey(Result) && Recipe.Secret) { SecretCraftingRecipes.TryAdd(Result, Recipe); } if (!NotSecretCraftingRecipes.ContainsKey(Result) && !Recipe.Secret) { NotSecretCraftingRecipes.TryAdd(Result, Recipe); } } } dbClient.SetQuery("SELECT * FROM `crafting_items`"); var items = dbClient.getTable(); if (items != null) { foreach (DataRow item in items.Rows) { string ItemName = item["itemName"].ToString(); CraftableItems.Add(ItemName); } } } //log.Info("Carregado " + SecretCraftingRecipes.Count + " secreto e " + NotSecretCraftingRecipes.Count + " receitas secretas de artesanato."); }
public static MoodlightPreset GeneratePreset(string Data) { String[] Bits = Data.Split(','); if (!IsValidColor(Bits[0])) { Bits[0] = "#000000"; } return(new MoodlightPreset(Bits[0], int.Parse(Bits[1]), PlusEnvironment.EnumToBool(Bits[2]))); }
public FarmingStats(DataRow Row) { this.Level = Convert.ToInt32(Row["level"]); this.Exp = Convert.ToInt32(Row["exp"]); this.HasSeedSatchel = PlusEnvironment.EnumToBool(Row["has_seed_satchel"].ToString()); this.HasPlantSatchel = PlusEnvironment.EnumToBool(Row["has_plant_satchel"].ToString()); this.SeedSatchel = new SeedSatchel(Row); this.PlantSatchel = new PlantSatchel(Row); }
public static Habbo GenerateHabbo(DataRow Row, DataRow UserInfo) { return(new Habbo(Convert.ToInt32(Row["id"]), Convert.ToString(Row["username"]), Convert.ToInt32(Row["rank"]), Convert.ToString(Row["motto"]), Convert.ToString(Row["look"]), Convert.ToString(Row["gender"]), Convert.ToInt32(Row["credits"]), Convert.ToInt32(Row["activity_points"]), Convert.ToInt32(Row["home_room"]), PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()), Convert.ToInt32(Row["last_online"]), PlusEnvironment.EnumToBool(Row["hide_online"].ToString()), PlusEnvironment.EnumToBool(Row["hide_inroom"].ToString()), Convert.ToDouble(Row["account_created"]), Convert.ToInt32(Row["vip_points"]), Convert.ToString(Row["machine_id"]), Convert.ToString(Row["volume"]), PlusEnvironment.EnumToBool(Row["chat_preference"].ToString()), PlusEnvironment.EnumToBool(Row["focus_preference"].ToString()), PlusEnvironment.EnumToBool(Row["pets_muted"].ToString()), PlusEnvironment.EnumToBool(Row["bots_muted"].ToString()), PlusEnvironment.EnumToBool(Row["advertising_report_blocked"].ToString()), Convert.ToDouble(Row["last_change"].ToString()), Convert.ToInt32(Row["gotw_points"]), PlusEnvironment.EnumToBool(Convert.ToString(Row["ignore_invites"])), Convert.ToDouble(Row["time_muted"]), Convert.ToDouble(UserInfo["trading_locked"]), PlusEnvironment.EnumToBool(Row["allow_gifts"].ToString()), Convert.ToInt32(Row["friend_bar_state"]), PlusEnvironment.EnumToBool(Row["disable_forced_effects"].ToString()), PlusEnvironment.EnumToBool(Row["allow_mimic"].ToString()), Convert.ToInt32(Row["rank_vip"]))); }
public void InitBots() { using (var 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'"); var 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"]) + "'"); var BotSpeech = dbClient.GetTable(); var 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 void FillRP(DataRow Row) { this.RoleplayEvent = null; this.BankEnabled = PlusEnvironment.EnumToBool(Row["bank_enabled"].ToString()); this.ShootEnabled = PlusEnvironment.EnumToBool(Row["shoot_enabled"].ToString()); this.HitEnabled = PlusEnvironment.EnumToBool(Row["hit_enabled"].ToString()); this.SafeZoneEnabled = PlusEnvironment.EnumToBool(Row["safezone_enabled"].ToString()); this.SexCommandsEnabled = PlusEnvironment.EnumToBool(Row["sexcommands_enabled"].ToString()); this.TurfEnabled = PlusEnvironment.EnumToBool(Row["turf_enabled"].ToString()); this.RobEnabled = PlusEnvironment.EnumToBool(Row["rob_enabled"].ToString()); this.GymEnabled = PlusEnvironment.EnumToBool(Row["gym_enabled"].ToString()); this.DeliveryEnabled = PlusEnvironment.EnumToBool(Row["delivery_enabled"].ToString()); this.TutorialEnabled = PlusEnvironment.EnumToBool(Row["tutorial_enabled"].ToString()); this.DriveEnabled = PlusEnvironment.EnumToBool(Row["drive_enabled"].ToString()); this.TaxiFromEnabled = PlusEnvironment.EnumToBool(Row["taxi_from_enabled"].ToString()); this.TaxiToEnabled = PlusEnvironment.EnumToBool(Row["taxi_to_enabled"].ToString()); this.EnterRoomMessage = Row["enter_message"].ToString(); }
public RentableSpaceData(int Item) { ItemId = Item; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `room_items_rentable_space` WHERE `item_id` = '" + ItemId + "' LIMIT 1"); DataRow Row = dbClient.getRow(); if (Row == null) { dbClient.RunQuery("INSERT INTO `room_items_rentable_space` VALUES ('" + ItemId + "','0','0','0')"); dbClient.SetQuery("SELECT * FROM `room_items_rentable_space` WHERE `item_id` = '" + ItemId + "' LIMIT 1"); Row = dbClient.getRow(); } this.OwnerId = Convert.ToInt32(Row["owner_id"]); this.TimeLeft = Convert.ToInt32(Row["time_left"]); this.Enabled = PlusEnvironment.EnumToBool(Row["enabled"].ToString()); this.House = null; this.FarmingSpace = null; } }
public void Init() { if (this._quests.Count > 0) { _quests.Clear(); } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `quests`"); DataTable dTable = dbClient.getTable(); if (dTable != null) { foreach (DataRow dRow in dTable.Rows) { int id = Convert.ToInt32(dRow["id"]); string category = Convert.ToString(dRow["type"]); int num = Convert.ToInt32(dRow["level_num"]); int type = Convert.ToInt32(dRow["goal_type"]); int goalData = Convert.ToInt32(dRow["goal_data"]); string name = Convert.ToString(dRow["action"]); int reward = Convert.ToInt32(dRow["pixel_reward"]); string dataBit = Convert.ToString(dRow["data_bit"]); int rewardtype = Convert.ToInt32(dRow["reward_type"].ToString()); int time = Convert.ToInt32(dRow["timestamp_unlock"]); int locked = Convert.ToInt32(dRow["timestamp_lock"]); bool isrp = PlusEnvironment.EnumToBool(dRow["is_rp"].ToString()); _quests.Add(id, new Quest(id, category, num, (QuestType)type, goalData, name, reward, dataBit, rewardtype, time, locked, isrp)); AddToCounter(category); } } } //log.Info("Carregado " + _quests.Count + " tarefas."); }
public void Fill(DataRow Row) { Id = Convert.ToInt32(Row["id"]); Name = Convert.ToString(Row["caption"]); Description = Convert.ToString(Row["description"]); Type = Convert.ToString(Row["roomtype"]); OwnerId = Convert.ToInt32(Row["owner"]); OwnerName = ""; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1"); dbClient.AddParameter("owner", OwnerId); string result = dbClient.GetString(); if (!String.IsNullOrEmpty(result)) { OwnerName = result; } } this.Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower()); Category = Convert.ToInt32(Row["category"]); if (!string.IsNullOrEmpty(Row["users_now"].ToString())) { UsersNow = Convert.ToInt32(Row["users_now"]); } else { UsersNow = 0; } UsersMax = Convert.ToInt32(Row["users_max"]); ModelName = Convert.ToString(Row["model_name"]); Score = Convert.ToInt32(Row["score"]); Tags = new List <string>(); AllowPets = Convert.ToInt32(Row["allow_pets"].ToString()); AllowPetsEating = Convert.ToInt32(Row["allow_pets_eat"].ToString()); RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString()); Hidewall = Convert.ToInt32(Row["allow_hidewall"].ToString()); Password = Convert.ToString(Row["password"]); Wallpaper = Convert.ToString(Row["wallpaper"]); Floor = Convert.ToString(Row["floor"]); Landscape = Convert.ToString(Row["landscape"]); FloorThickness = Convert.ToInt32(Row["floorthick"]); WallThickness = Convert.ToInt32(Row["wallthick"]); WhoCanMute = Convert.ToInt32(Row["mute_settings"]); WhoCanKick = Convert.ToInt32(Row["kick_settings"]); WhoCanBan = Convert.ToInt32(Row["ban_settings"]); chatMode = Convert.ToInt32(Row["chat_mode"]); chatSpeed = Convert.ToInt32(Row["chat_speed"]); chatSize = Convert.ToInt32(Row["chat_size"]); TradeSettings = Convert.ToInt32(Row["trade_settings"]); Group G = null; if (PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out G)) { Group = G; } else { Group = null; } foreach (string Tag in Row["tags"].ToString().Split(',')) { Tags.Add(Tag); } mModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(ModelName); this.PushEnabled = PlusEnvironment.EnumToBool(Row["push_enabled"].ToString()); this.PullEnabled = PlusEnvironment.EnumToBool(Row["pull_enabled"].ToString()); this.SPushEnabled = PlusEnvironment.EnumToBool(Row["spush_enabled"].ToString()); this.SPullEnabled = PlusEnvironment.EnumToBool(Row["spull_enabled"].ToString()); this.EnablesEnabled = PlusEnvironment.EnumToBool(Row["enables_enabled"].ToString()); this.RespectNotificationsEnabled = PlusEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString()); this.PetMorphsAllowed = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString()); }
public void Parse(GameClient session, ClientPacket packet) { if (!session.GetHabbo().InRoom) { return; } Room room = session.GetHabbo().CurrentRoom; if (room == null) { return; } DynamicRoomModel model = room.GetGameMap().Model; if (model == null) { return; } ICollection <Item> floorItems = room.GetRoomItemHandler().GetFloor; session.SendPacket(new FloorPlanFloorMapComposer(floorItems)); session.SendPacket(new FloorPlanSendDoorComposer(model.DoorX, model.DoorY, model.DoorOrientation)); session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString()))); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } DynamicRoomModel Model = Room.GetGameMap().Model; if (Model == null) { return; } ICollection <Item> FloorItems = Room.GetRoomItemHandler().GetFloor; Session.SendPacket(new FloorPlanFloorMapComposer(FloorItems)); Session.SendPacket(new FloorPlanSendDoorComposer(Model.DoorX, Model.DoorY, Model.DoorOrientation)); Session.SendPacket(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, PlusEnvironment.EnumToBool(Room.Hidewall.ToString()))); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } if (Session.GetHabbo().InRoom) { Room OldRoom; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out OldRoom)) { return; } if (OldRoom.GetRoomUserManager() != null) { OldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); } } if (!Room.GetRoomUserManager().AddAvatarToRoom(Session)) { Room.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); return;//TODO: Remove? } Room.SendObjects(Session); //Status updating for messenger, do later as buggy. try { if (Session.GetHabbo().GetMessenger() != null) { Session.GetHabbo().GetMessenger().OnStatusChanged(true); } } catch { } if (Session.GetHabbo().GetStats().QuestID > 0) { PlusEnvironment.GetGame().GetQuestManager().QuestReminder(Session, Session.GetHabbo().GetStats().QuestID); } Session.SendMessage(new RoomEntryInfoComposer(Room.RoomId, Room.CheckRights(Session, true))); Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, PlusEnvironment.EnumToBool(Room.Hidewall.ToString()))); RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser != null && Session.GetHabbo().PetId == 0) { Room.SendMessage(new UserChangeComposer(ThisUser, false)); } Session.SendMessage(new RoomEventComposer(Room.RoomData, Room.RoomData.Promotion)); if (Room.GetWired() != null) { Room.GetWired().TriggerEvent(WiredBoxType.TriggerRoomEnter, Session.GetHabbo()); } if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0) { Session.SendMessage(new FloodControlComposer((int)Session.GetHabbo().FloodTime - (int)PlusEnvironment.GetUnixTimestamp())); } Poll Poll = PlusEnvironment.GetGame().GetPollManager().getPollByRoomId(Room.RoomId); if (Poll != null) { if (!Session.GetHabbo().AnsweredPolls.Contains(Poll.Id)) { Session.SendMessage(new SuggestPollMessageComposer(Poll)); } } }
public void Init() { if (this._items.Count > 0) { this._items.Clear(); } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`item_name`,`public_name`,`type`,`width`,`length`,`stack_height`,`can_stack`,`can_sit`,`is_walkable`,`sprite_id`,`allow_recycle`,`allow_trade`,`allow_marketplace_sell`,`allow_gift`,`allow_inventory_stack`,`interaction_type`,`interaction_modes_count`,`vending_ids`,`height_adjustable`,`effect_id`,`wired_id`,`is_rare`,`clothing_id`, `extra_rot` FROM `furniture`"); DataTable ItemData = dbClient.getTable(); if (ItemData != null) { foreach (DataRow Row in ItemData.Rows) { try { int id = Convert.ToInt32(Row["id"]); int spriteID = Convert.ToInt32(Row["sprite_id"]); string itemName = Convert.ToString(Row["item_name"]); string PublicName = Convert.ToString(Row["public_name"]); string type = Row["type"].ToString(); int width = Convert.ToInt32(Row["width"]); int length = Convert.ToInt32(Row["length"]); double height = Convert.ToDouble(Row["stack_height"]); bool allowStack = PlusEnvironment.EnumToBool(Row["can_stack"].ToString()); bool allowWalk = PlusEnvironment.EnumToBool(Row["is_walkable"].ToString()); bool allowSit = PlusEnvironment.EnumToBool(Row["can_sit"].ToString()); bool allowRecycle = PlusEnvironment.EnumToBool(Row["allow_recycle"].ToString()); bool allowTrade = PlusEnvironment.EnumToBool(Row["allow_trade"].ToString()); bool allowMarketplace = Convert.ToInt32(Row["allow_marketplace_sell"]) == 1; bool allowGift = Convert.ToInt32(Row["allow_gift"]) == 1; bool allowInventoryStack = PlusEnvironment.EnumToBool(Row["allow_inventory_stack"].ToString()); InteractionType interactionType = InteractionTypes.GetTypeFromString(Convert.ToString(Row["interaction_type"])); int cycleCount = Convert.ToInt32(Row["interaction_modes_count"]); string vendingIDS = Convert.ToString(Row["vending_ids"]); List <double> heightAdjustable = Row["height_adjustable"].ToString() != String.Empty ? Row["height_adjustable"].ToString().Split(',').Select(x => Convert.ToDouble(x)).ToList() : new List <double>(); int EffectId = Convert.ToInt32(Row["effect_id"]); int WiredId = Convert.ToInt32(Row["wired_id"]); bool IsRare = PlusEnvironment.EnumToBool(Row["is_rare"].ToString()); int ClothingId = Convert.ToInt32(Row["clothing_id"]); bool ExtraRot = PlusEnvironment.EnumToBool(Row["extra_rot"].ToString()); if (!this._gifts.ContainsKey(spriteID)) { this._gifts.Add(spriteID, new ItemData(id, spriteID, itemName, PublicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, cycleCount, vendingIDS, heightAdjustable, EffectId, WiredId, IsRare, ClothingId, ExtraRot)); } if (!this._items.ContainsKey(id)) { this._items.Add(id, new ItemData(id, spriteID, itemName, PublicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, cycleCount, vendingIDS, heightAdjustable, EffectId, WiredId, IsRare, ClothingId, ExtraRot)); } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.ReadKey(); Logging.WriteLine("Não foi possível carregar item #" + Convert.ToInt32(Row[0]) + ", verifiqu os dados."); } } } } //log.Info("Item Manager -> LOADED"); }
public void DownloadFurnis() { #region Variables XDocument xDoc = XDocument.Load(@"furnidata_updated.xml"); string ItemName = ""; string Type = "s"; int SpriteId = 1; int XDim = 0; int YDim = 0; string PublicName = ""; string Description = ""; string AdURL = ""; string CustomParams = ""; int SpecialType = 0; bool ExcludedDynamic = false; bool CanStandOn = false; bool CanSitOn = false; bool CanLayOn = false; string FurniLine = ""; #endregion #region Execute using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { var downloadRoomList = xDoc.Descendants("roomitemtypes").Descendants("furnitype"); var downloadWallList = xDoc.Descendants("wallitemtypes").Descendants("furnitype"); if (downloadRoomList.ToList().Count > 0) { foreach (var downloadRoomItem in downloadRoomList) { #region Set Variables try { ItemName = downloadRoomItem .Attribute("classname") .Value; SpriteId = Convert.ToInt32(downloadRoomItem .Attribute("id") .Value); PublicName = downloadRoomItem .Element("name") .Value; Description = downloadRoomItem .Element("description") .Value; SpecialType = Convert.ToInt32(downloadRoomItem .Element("specialtype") .Value); AdURL = downloadRoomItem .Element("adurl") .Value; CustomParams = downloadRoomItem .Element("customparams") .Value; XDim = Convert.ToInt32(downloadRoomItem .Element("xdim") .Value); YDim = Convert.ToInt32(downloadRoomItem .Element("ydim") .Value); ExcludedDynamic = PlusEnvironment.EnumToBool(downloadRoomItem .Element("excludeddynamic") .Value); CanLayOn = PlusEnvironment.EnumToBool(downloadRoomItem .Element("canlayon") .Value); CanSitOn = PlusEnvironment.EnumToBool(downloadRoomItem .Element("cansiton") .Value); CanStandOn = PlusEnvironment.EnumToBool(downloadRoomItem .Element("canstandon") .Value); FurniLine = downloadRoomItem .Element("furniline") .Value; } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion #region Insert Query try { dbClient.SetQuery("INSERT INTO `furniture_new`" + "(id,item_name,public_name,type,width,length,can_sit,can_lay,is_walkable,sprite_id,description,specialtype,customparams,excludeddynamic,adurl,furniline) VALUES " + "(@id,@item_name,@public_name,@type,@width,@length,@can_sit,@can_lay,@is_walkable,@sprite_id,@description,@specialtype,@customparams,@excludeddynamic,@adurl,@furniline) ON DUPLICATE KEY UPDATE " + "id = VALUES(id)," + "item_name = VALUES(item_name)," + "public_name = VALUES(public_name)," + "type = VALUES(type)," + "width = VALUES(width)," + "length = VALUES(length)," + "can_sit = VALUES(can_sit)," + "can_lay = VALUES(can_lay)," + "is_walkable = VALUES(is_walkable)," + "sprite_id = VALUES(sprite_id)," + "description = VALUES(description)," + "specialtype = VALUES(specialtype)," + "customparams = VALUES(customparams)," + "excludeddynamic = VALUES(excludeddynamic)," + "adurl = VALUES(adurl)," + "furniline = VALUES(furniline);"); dbClient.AddParameter("id", SpriteId); dbClient.AddParameter("item_name", ItemName); dbClient.AddParameter("public_name", PublicName); dbClient.AddParameter("type", Type); dbClient.AddParameter("width", XDim); dbClient.AddParameter("length", YDim); dbClient.AddParameter("can_sit", PlusEnvironment.BoolToEnum(CanSitOn)); dbClient.AddParameter("can_lay", PlusEnvironment.BoolToEnum(CanLayOn)); dbClient.AddParameter("is_walkable", PlusEnvironment.BoolToEnum(CanStandOn)); dbClient.AddParameter("sprite_id", SpriteId); dbClient.AddParameter("description", Description); dbClient.AddParameter("specialtype", SpecialType); dbClient.AddParameter("customparams", CustomParams); dbClient.AddParameter("excludeddynamic", PlusEnvironment.BoolToEnum(ExcludedDynamic)); dbClient.AddParameter("adurl", AdURL); dbClient.AddParameter("furniline", FurniLine); dbClient.RunQuery(); } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion } log.Info("Itens da sala baixados"); } if (downloadWallList.ToList().Count > 0) { foreach (var downloadWallItem in downloadWallList) { #region Set Variables try { ItemName = downloadWallItem .Attribute("classname") .Value; SpriteId = Convert.ToInt32(downloadWallItem .Attribute("id") .Value); PublicName = downloadWallItem .Element("name") .Value; Description = downloadWallItem .Element("description") .Value; SpecialType = Convert.ToInt32(downloadWallItem .Element("specialtype") .Value); FurniLine = downloadWallItem .Element("furniline") .Value; Type = "i"; } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion #region Insert Query try { dbClient.SetQuery("INSERT INTO `furniture_new`" + "(id,item_name,public_name,type,width,length,can_sit,can_lay,is_walkable,sprite_id,description,specialtype,customparams,excludeddynamic,adurl,furniline) VALUES " + "(@id,@item_name,@public_name,@type,@width,@length,@can_sit,@can_lay,@is_walkable,@sprite_id,@description,@specialtype,@customparams,@excludeddynamic,@adurl,@furniline) ON DUPLICATE KEY UPDATE " + "id = VALUES(id)," + "item_name = VALUES(item_name)," + "public_name = VALUES(public_name)," + "type = VALUES(type)," + "width = VALUES(width)," + "length = VALUES(length)," + "can_sit = VALUES(can_sit)," + "can_lay = VALUES(can_lay)," + "is_walkable = VALUES(is_walkable)," + "sprite_id = VALUES(sprite_id)," + "description = VALUES(description)," + "specialtype = VALUES(specialtype)," + "customparams = VALUES(customparams)," + "excludeddynamic = VALUES(excludeddynamic)," + "adurl = VALUES(adurl)," + "furniline = VALUES(furniline);"); dbClient.AddParameter("id", (100000 + SpriteId)); dbClient.AddParameter("item_name", ItemName); dbClient.AddParameter("public_name", PublicName); dbClient.AddParameter("type", Type); dbClient.AddParameter("width", 0); dbClient.AddParameter("length", 0); dbClient.AddParameter("can_sit", 0); dbClient.AddParameter("can_lay", 0); dbClient.AddParameter("is_walkable", 0); dbClient.AddParameter("sprite_id", SpriteId); dbClient.AddParameter("description", Description); dbClient.AddParameter("specialtype", SpecialType); dbClient.AddParameter("customparams", ""); dbClient.AddParameter("excludeddynamic", 0); dbClient.AddParameter("adurl", AdURL); dbClient.AddParameter("furniline", FurniLine); dbClient.RunQuery(); } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion } log.Info("Itens de parede baixados"); } } #endregion }
public void Init() { if (Items.Count > 0) { Items.Clear(); } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `furniture`"); var itemData = dbClient.GetTable(); if (itemData != null) { foreach (DataRow row in itemData.Rows) { try { var id = Convert.ToInt32(row["id"]); var spriteId = Convert.ToInt32(row["sprite_id"]); var itemName = Convert.ToString(row["item_name"]); var publicName = Convert.ToString(row["public_name"]); var type = row["type"].ToString(); var width = Convert.ToInt32(row["width"]); var length = Convert.ToInt32(row["length"]); var height = Convert.ToDouble(row["stack_height"]); var allowStack = PlusEnvironment.EnumToBool(row["can_stack"].ToString()); var allowWalk = PlusEnvironment.EnumToBool(row["is_walkable"].ToString()); var allowSit = PlusEnvironment.EnumToBool(row["can_sit"].ToString()); var allowRecycle = PlusEnvironment.EnumToBool(row["allow_recycle"].ToString()); var allowTrade = PlusEnvironment.EnumToBool(row["allow_trade"].ToString()); var allowMarketplace = Convert.ToInt32(row["allow_marketplace_sell"]) == 1; var allowGift = Convert.ToInt32(row["allow_gift"]) == 1; var allowInventoryStack = PlusEnvironment.EnumToBool(row["allow_inventory_stack"].ToString()); var interactionType = InteractionTypes.GetTypeFromString(Convert.ToString(row["interaction_type"])); var behaviourData = Convert.ToInt32(row["behaviour_data"]); var cycleCount = Convert.ToInt32(row["interaction_modes_count"]); var vendingIds = Convert.ToString(row["vending_ids"]); var heightAdjustable = Convert.ToString(row["height_adjustable"]); var effectId = Convert.ToInt32(row["effect_id"]); var isRare = PlusEnvironment.EnumToBool(row["is_rare"].ToString()); var extraRot = PlusEnvironment.EnumToBool(row["extra_rot"].ToString()); if (!Gifts.ContainsKey(spriteId)) { Gifts.Add(spriteId, new ItemData(id, spriteId, itemName, publicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, behaviourData, cycleCount, vendingIds, heightAdjustable, effectId, isRare, extraRot)); } if (!Items.ContainsKey(id)) { Items.Add(id, new ItemData(id, spriteId, itemName, publicName, type, width, length, height, allowStack, allowWalk, allowSit, allowRecycle, allowTrade, allowMarketplace, allowGift, allowInventoryStack, interactionType, behaviourData, cycleCount, vendingIds, heightAdjustable, effectId, isRare, extraRot)); } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.ReadKey(); //Logging.WriteLine("Could not load item #" + Convert.ToInt32(Row[0]) + ", please verify the data is okay."); } } } } Log.Info("Item Manager -> LOADED"); }
public bool RequestBuddy(string UserQuery) { int userID; bool hasFQDisabled; #region Bot Friendship if (RoleplayBotManager.GetDeployedBotByName(UserQuery) != null) { RoomUser BotUser = RoleplayBotManager.GetDeployedBotByName(UserQuery); if (BotUser.GetBotRoleplay() == null) { return(false); } if (GetClient().GetRoleplay().BotFriendShips.ContainsKey(BotUser.GetBotRoleplay().Id)) { GetClient().SendWhisper("Você já é amigo deste NPC!", 1); return(false); } if (!BotUser.GetBotRoleplay().AddableBot) { GetClient().SendWhisper("Você não pode adicionar este bot!", 1); return(false); } BotUser.Chat("OK " + GetClient().GetHabbo().Username + ", eu adicionei você à lista de contatos do meu telefone!", true); GetClient().GetRoleplay().AddBotAsFriend(BotUser.GetBotRoleplay().Id); return(true); } #endregion if (GetClient().GetRoleplay().PhoneType <= 0) { GetClient().SendWhisper("Você não tem um telefone para fazer isso! Compre um na Loja de Celulares [Quarto ID: 25]", 1); return(false); } GameClient client = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(UserQuery); if (client == null) { DataRow Row = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`block_newfriends` FROM `users` WHERE `username` = @query LIMIT 1"); dbClient.AddParameter("query", UserQuery.ToLower()); Row = dbClient.getRow(); } if (Row == null) { return(false); } userID = Convert.ToInt32(Row["id"]); hasFQDisabled = PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString()); } else { userID = client.GetHabbo().Id; hasFQDisabled = client.GetHabbo().AllowFriendRequests; } if (hasFQDisabled) { GetClient().SendMessage(new MessengerErrorComposer(39, 3)); return(false); } int ToId = userID; if (RequestExists(ToId)) { return(true); } int PhoneType = 0; if (client == null || client.GetHabbo() == null || client.GetRoleplay() == null) { using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `phone` FROM `rp_stats` WHERE `id` = @userid LIMIT 1"); dbClient.AddParameter("userid", userID); PhoneType = dbClient.getInteger(); } } else { PhoneType = client.GetRoleplay().PhoneType; } if (PhoneType <= 0) { GetClient().SendWhisper("Desculpe, " + UserQuery + " não tem um telefone!", 1); return(false); } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("REPLACE INTO `messenger_requests` (`from_id`,`to_id`) VALUES ('" + _userId + "','" + ToId + "')"); } GameClient ToUser = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(ToId); if (ToUser == null || ToUser.GetHabbo() == null) { return(true); } MessengerRequest Request = new MessengerRequest(ToId, _userId, PlusEnvironment.GetGame().GetClientManager().GetNameById(_userId)); ToUser.GetHabbo().GetMessenger().OnNewRequest(_userId); using (UserCache ThisUser = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(_userId)) { if (ThisUser != null) { ToUser.SendMessage(new NewBuddyRequestComposer(ThisUser)); } } _requests.Add(ToId, Request); return(true); }
public void Parse(GameClient session, ClientPacket packet) { if (session == null || session.Habbo == null) { return; } Room room = session.Habbo.CurrentRoom; if (room == null) { return; } if (session.Habbo.InRoom) { if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(session.Habbo.CurrentRoomId, out Room oldRoom)) { return; } if (oldRoom.GetRoomUserManager() != null) { oldRoom.GetRoomUserManager().RemoveUserFromRoom(session, false); } } if (!room.GetRoomUserManager().AddAvatarToRoom(session)) { room.GetRoomUserManager().RemoveUserFromRoom(session, false); return;//TODO: Remove? } room.SendObjects(session); if (session.Habbo.GetMessenger() != null) { session.Habbo.GetMessenger().OnStatusChanged(true); } if (session.Habbo.GetStats().QuestId > 0) { PlusEnvironment.GetGame().GetQuestManager().QuestReminder(session, session.Habbo.GetStats().QuestId); } session.SendPacket(new RoomEntryInfoComposer(room.RoomId, room.CheckRights(session, true))); session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString()))); RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(session.Habbo.Username); if (user != null && session.Habbo.PetId == 0) { room.SendPacket(new UserChangeComposer(user, false)); } session.SendPacket(new RoomEventComposer(room, room.Promotion)); if (room.GetWired() != null) { room.GetWired().TriggerEvent(WiredBoxType.TriggerRoomEnter, session.Habbo); } if (PlusEnvironment.GetUnixTimestamp() < session.Habbo.FloodTime && session.Habbo.FloodTime != 0) { session.SendPacket(new FloodControlComposer((int)session.Habbo.FloodTime - (int)PlusEnvironment.GetUnixTimestamp())); } }
/// <summary> /// Refresh the chats data e.g bans & mutes /// </summary> public void RefreshChatRoomData() { this.ChatValues.Clear(); this.BannedUsers.Clear(); this.MutedUsers.Clear(); this.ChatAdmins.Clear(); DataTable ChatRoomsData; DataRow TheChat; using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("SELECT owner_id, password, locked, admins, gang_id from `rp_chat_rooms` WHERE name = @chatname"); DB.AddParameter("chatname", this.ChatName); TheChat = DB.getRow(); if (TheChat != null) { int OwnerID = Convert.ToInt32(TheChat["owner_id"]); int GangID = Convert.ToInt32(TheChat["gang_id"]); string Password = Convert.ToString(TheChat["password"]); this.ChatAdmins = (!String.IsNullOrEmpty(Convert.ToString(TheChat["admins"])) && Convert.ToString(TheChat["admins"]).Contains(":")) ? (Convert.ToString(TheChat["admins"]).StartsWith(":")) ? Convert.ToString(TheChat["admins"]).Remove(0, 1).Split(':').Select(int.Parse).ToList() : Convert.ToString(TheChat["admins"]).Split(':').Select(int.Parse).ToList() : new List <int>(); bool Locked = PlusEnvironment.EnumToBool(Convert.ToString(TheChat["locked"])); #region Refresh chat admins #endregion #region Refresh chat owner this.ChatOwner = OwnerID; #endregion #region Refresh chat password this.SetChatPassword(Password); #endregion #region Refresh gang id this.SetChatGang(GangID); #endregion #region Refresh locked this.SetLockStatus(Locked); #endregion } } using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("SELECT * from `rp_chat_rooms_data` WHERE chat_name = @chatname"); DB.AddParameter("chatname", this.ChatName); ChatRoomsData = DB.getTable(); if (ChatRoomsData == null) { return; } foreach (DataRow ChatRoomData in ChatRoomsData.Rows) { string DataType = Convert.ToString(ChatRoomData["data_type"]); string DataValue = Convert.ToString(ChatRoomData["data_value"]); double DataExpire = Convert.ToDouble(ChatRoomData["data_timestamp_expire"]); if (DataExpire <= PlusEnvironment.GetUnixTimestamp()) { DB.RunQuery("DELETE FROM rp_chat_rooms_data WHERE data_type = '" + DataType + "' AND data_value = '" + DataValue + "'"); continue; } if (DataType == "ban") { this.InsertBanData(DataValue, DataExpire); } if (DataType == "mute") { this.InsertMuteData(DataValue, DataExpire); } } } }
public void Init(ItemDataManager ItemDataManager) { if (_pages.Count > 0) { _pages.Clear(); } if (_botPresets.Count > 0) { _botPresets.Clear(); } if (_items.Count > 0) { _items.Clear(); } if (_deals.Count > 0) { _deals.Clear(); } if (_promotions.Count > 0) { _promotions.Clear(); } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery( "SELECT `id`,`item_id`,`catalog_name`,`cost_credits`,`cost_pixels`,`cost_diamonds`,`amount`,`page_id`,`limited_sells`,`limited_stack`,`offer_active`,`extradata`,`badge`,`offer_id` FROM `catalog_items`"); var CatalogueItems = dbClient.GetTable(); if (CatalogueItems != null) { foreach (DataRow Row in CatalogueItems.Rows) { if (Convert.ToInt32(Row["amount"]) <= 0) { continue; } var ItemId = Convert.ToInt32(Row["id"]); var PageId = Convert.ToInt32(Row["page_id"]); var BaseId = Convert.ToInt32(Row["item_id"]); var OfferId = Convert.ToInt32(Row["offer_id"]); ItemData Data = null; if (!ItemDataManager.GetItem(BaseId, out Data)) { log.Error("Couldn't load Catalog Item " + ItemId + ", no furniture record found."); continue; } if (!_items.ContainsKey(PageId)) { _items[PageId] = new Dictionary <int, CatalogItem>(); } if (OfferId != -1 && !_itemOffers.ContainsKey(OfferId)) { _itemOffers.Add(OfferId, PageId); } _items[PageId] .Add(Convert.ToInt32(Row["id"]), new CatalogItem(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["item_id"]), Data, Convert.ToString(Row["catalog_name"]), Convert.ToInt32(Row["page_id"]), Convert.ToInt32(Row["cost_credits"]), Convert.ToInt32(Row["cost_pixels"]), Convert.ToInt32(Row["cost_diamonds"]), Convert.ToInt32(Row["amount"]), Convert.ToInt32(Row["limited_sells"]), Convert.ToInt32(Row["limited_stack"]), PlusEnvironment.EnumToBool(Row["offer_active"].ToString()), Convert.ToString(Row["extradata"]), Convert.ToString(Row["badge"]), Convert.ToInt32(Row["offer_id"]))); } } dbClient.SetQuery("SELECT `id`, `items`, `name`, `room_id` FROM `catalog_deals`"); var GetDeals = dbClient.GetTable(); if (GetDeals != null) { foreach (DataRow Row in GetDeals.Rows) { var Id = Convert.ToInt32(Row["id"]); var Items = Convert.ToString(Row["items"]); var Name = Convert.ToString(Row["name"]); var RoomId = Convert.ToInt32(Row["room_id"]); var Deal = new CatalogDeal(Id, Items, Name, RoomId, ItemDataManager); if (!_deals.ContainsKey(Id)) { _deals.Add(Deal.Id, Deal); } } } dbClient.SetQuery( "SELECT `id`,`parent_id`,`caption`,`page_link`,`visible`,`enabled`,`min_rank`,`min_vip`,`icon_image`,`page_layout`,`page_strings_1`,`page_strings_2` FROM `catalog_pages` ORDER BY `order_num`"); var CatalogPages = dbClient.GetTable(); if (CatalogPages != null) { foreach (DataRow Row in CatalogPages.Rows) { _pages.Add(Convert.ToInt32(Row["id"]), new CatalogPage(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["parent_id"]), Row["enabled"].ToString(), Convert.ToString(Row["caption"]), Convert.ToString(Row["page_link"]), Convert.ToInt32(Row["icon_image"]), Convert.ToInt32(Row["min_rank"]), Convert.ToInt32(Row["min_vip"]), Row["visible"].ToString(), Convert.ToString(Row["page_layout"]), Convert.ToString(Row["page_strings_1"]), Convert.ToString(Row["page_strings_2"]), _items.ContainsKey(Convert.ToInt32(Row["id"])) ? _items[Convert.ToInt32(Row["id"])] : new Dictionary <int, CatalogItem>(), ref _itemOffers)); } } dbClient.SetQuery("SELECT `id`,`name`,`figure`,`motto`,`gender`,`ai_type` FROM `catalog_bot_presets`"); var bots = dbClient.GetTable(); if (bots != null) { foreach (DataRow Row in bots.Rows) { _botPresets.Add(Convert.ToInt32(Row[0]), new CatalogBot(Convert.ToInt32(Row[0]), Convert.ToString(Row[1]), Convert.ToString(Row[2]), Convert.ToString(Row[3]), Convert.ToString(Row[4]), Convert.ToString(Row[5]))); } } dbClient.SetQuery("SELECT * FROM `catalog_promotions`"); var GetPromotions = dbClient.GetTable(); if (GetPromotions != null) { foreach (DataRow Row in GetPromotions.Rows) { if (!_promotions.ContainsKey(Convert.ToInt32(Row["id"]))) { _promotions.Add(Convert.ToInt32(Row["id"]), new CatalogPromotion(Convert.ToInt32(Row["id"]), Convert.ToString(Row["title"]), Convert.ToString(Row["image"]), Convert.ToInt32(Row["unknown"]), Convert.ToString(Row["page_link"]), Convert.ToInt32(Row["parent_id"]))); } } } _petRaceManager.Init(); _clothingManager.Init(); } log.Info("Catalog Manager -> LOADED"); }