コード例 #1
0
ファイル: WiredLoaderObject.cs プロジェクト: BjkGkh/R106
        internal static WiredLoaderObject LoadItem(RoomItem item, Room room, IQueryAdapter dbClient)
        {
            InteractionType type = item.GetBaseItem().InteractionType;
            List<RoomItem> items = null;
            if (NeedsFurnitures(type))
            {
                dbClient.setQuery("SELECT trigger_item FROM wired_to_item WHERE wired_id = " + item.Id);
                DataTable dTable = dbClient.getTable();
                RoomItem targetItem;
                items = new List<RoomItem>(5);
                foreach (DataRow dRows in dTable.Rows)
                {
                    targetItem = room.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
                    if (targetItem == null || items.Contains(targetItem))
                    {
                        continue;
                    }

                    items.Add(targetItem);
                }
            }

            string[] settings = null;
            
            if(HasSettings(type))
            {
                settings = new string[4];
                dbClient.setQuery("SELECT data_one, data_two,data_three, data_four FROM wired_data WHERE wired_id = " + item.Id);

                DataRow dRow = dbClient.getRow();
                if (dRow != null)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        settings[i] = dRow[i].ToString();
                    }
                }
                else
                {
                    settings = new string[] { "", "", "", "" };
                }
            }

            Dictionary<uint, OriginalItemLocation> originalPositionList = null;
            if (HasOriginalItemLocations(type))
            {
                originalPositionList = new Dictionary<uint, OriginalItemLocation>(5);
                dbClient.setQuery("SELECT item_id, original_x, original_y, rotation, height, extradata FROM wired_original_item_locations WHERE wired_id = " + item.Id);
                DataTable dTable = dbClient.getTable();
                foreach (DataRow dRows in dTable.Rows)
                {
                    originalPositionList.Add(uint.Parse(dRows[0].ToString()), new OriginalItemLocation(uint.Parse(dRows[0].ToString()), int.Parse(dRows[1].ToString()), int.Parse(dRows[2].ToString()), (double)Convert.ToDecimal(dRows[4]), int.Parse(dRows[3].ToString()), dRows[5].ToString()));
                }
            }
            return new WiredLoaderObject(items, originalPositionList, settings);
        }
コード例 #2
0
ファイル: Timer.cs プロジェクト: habb0/PiciEmulator
 public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
 {
     dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
     dbClient.addParameter("id", (int)this.item.Id);
     DataRow dRow = dbClient.getRow();
     if (dRow != null)
         this.requiredCycles = Convert.ToInt32(dRow[0].ToString());
     else
         this.requiredCycles = 20;
 }
コード例 #3
0
ファイル: EntersRoom.cs プロジェクト: habb0/Bfly
 public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
 {
     dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
     dbClient.addParameter("id", (int)this.item.Id);
     DataRow dRow = dbClient.getRow();
     if (dRow != null)
         this.userName = dRow[0].ToString();
     else
         this.userName = string.Empty;
     this.isOneUser = !string.IsNullOrEmpty(this.userName);
 }
コード例 #4
0
ファイル: GiveScore.cs プロジェクト: BjkGkh/Custom-R2
 public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
 {
     dbClient.setQuery("SELECT trigger_data, trigger_data_2 FROM trigger_item WHERE trigger_id = @id ");
     dbClient.addParameter("id", (int)this.itemID);
     DataRow dRow = dbClient.getRow();
     if (dRow != null)
     {
         this.maxCountPerGame = Convert.ToInt32(dRow[0].ToString());
         this.scoreToGive = Convert.ToInt32(dRow[1].ToString());
     }
     else
     {
         maxCountPerGame = 0;
         scoreToGive = 0;
     }
 }
コード例 #5
0
ファイル: UserSays.cs プロジェクト: TheNaked/Firewind
 public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
 {
     dbClient.setQuery("SELECT trigger_data,  all_user_triggerable FROM trigger_item WHERE trigger_id = @id ");
     dbClient.addParameter("id", (int)this.item.Id);
     DataRow dRow = dbClient.getRow();
     if (dRow != null)
     {
         this.triggerMessage = dRow[0].ToString();
         this.isOwnerOnly = dRow[1].ToString() == "1";
     }
     else
     {
         this.triggerMessage = string.Empty;
         this.isOwnerOnly = false;
     }
 }
コード例 #6
0
ファイル: BonusManager.cs プロジェクト: LuxuryJared/Coolmemes
        public static void Initialize(IQueryAdapter dbClient)
        {
            dbClient.setQuery("SELECT * FROM bonus_bag WHERE enable = '1' ORDER BY id DESC LIMIT 1");
            DataRow dRow = dbClient.getRow();

            if (dRow != null)
            {
                Item Item = OtanixEnvironment.GetGame().GetItemManager().GetItem(Convert.ToUInt32(dRow["item_id"]));
                if (Item != null)
                {
                    ItemId   = Item.ItemId;
                    ItemName = Item.Name;
                    SpriteId = Item.SpriteId;
                }
                Amount = Convert.ToUInt32(dRow["amount"]);
            }
        }
コード例 #7
0
        public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
        {
            dbClient.setQuery("SELECT trigger_data, trigger_data_2 FROM trigger_item WHERE trigger_id = @id ");
            dbClient.addParameter("id", (int)this.itemID);
            DataRow dRow = dbClient.getRow();

            if (dRow != null)
            {
                this.maxCountPerGame = Convert.ToInt32(dRow[0].ToString());
                this.scoreToGive     = Convert.ToInt32(dRow[1].ToString());
            }
            else
            {
                maxCountPerGame = 0;
                scoreToGive     = 0;
            }
        }
コード例 #8
0
ファイル: UserDataFactory.cs プロジェクト: fuding/Coolmemes
        internal static Habbo GetUserDataCache(uint userId)
        {
            DataRow dUser;

            using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT id, username, real_name, rank, motto, account_created, look, gender, diamonds, machine_last, last_online, achievement_points, favoriteGroup, block_newfriends, block_trade, ignoreRoomInvitations, dontfocususers, prefer_old_chat, alertasAtivados, frankJaApareceu, moedas, corAtual, coresJaTenho, coins_purchased FROM users WHERE id = " + userId);
                dUser = dbClient.getRow();
            }

            if (dUser == null)
            {
                return(null);
            }

            return(HabboFactory.GenerateHabboCache(dUser));
        }
コード例 #9
0
        internal void Initialize(IQueryAdapter dbClient)
        {
            TargetedOffer = null;

            dbClient.SetQuery("SELECT * FROM targeted_offers WHERE active = 'true' LIMIT 1;");
            var row = dbClient.getRow();


            if (row == null)
            {
                return;
            }
            TargetedOffer = new TargetedOffers((int)row["id"], (int)row["limit"], Convert.ToInt32(BiosEmuThiago.GetUnixTimestamp() +
                                                                                                  (((int)row["time"] + 10) * 1)), (row["open"].ToString() == "show"), (row["active"].ToString() == "true"), (string)row["code"],
                                               (string)row["title"], (string)row["description"], (string)row["image"], (string)row["icon"],
                                               (string)row["money_type"], (string)row["items"], (string)row["price"]);
        }
コード例 #10
0
 internal Guild GetGroup(uint GroupId)
 {
     if (this.Groups != null)
     {
         if (this.Groups.Contains(GroupId))
         {
             return((Guild)this.Groups[GroupId]);
         }
         using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
         {
             queryreactor.setQuery("SELECT * FROM groups WHERE id=" + GroupId + " LIMIT 1");
             DataRow row = queryreactor.getRow();
             Guild   result;
             if (row == null)
             {
                 result = null;
                 return(result);
             }
             queryreactor.setQuery("SELECT user_id, rank FROM group_memberships WHERE group_id=" + GroupId);
             DataTable table = queryreactor.getTable();
             queryreactor.setQuery("SELECT user_id FROM group_requests WHERE group_id=" + GroupId);
             DataTable table2 = queryreactor.getTable();
             Dictionary <uint, GroupUser> dictionary  = new Dictionary <uint, GroupUser>();
             Dictionary <uint, GroupUser> dictionary2 = new Dictionary <uint, GroupUser>();
             List <uint> list = new List <uint>();
             foreach (DataRow dataRow in table.Rows)
             {
                 dictionary.Add((uint)dataRow[0], new GroupUser((uint)dataRow[0], GroupId, int.Parse(dataRow[1].ToString())));
                 if (int.Parse(dataRow[1].ToString()) >= 1)
                 {
                     dictionary2.Add((uint)dataRow[0], new GroupUser((uint)dataRow[0], GroupId, int.Parse(dataRow[1].ToString())));
                 }
             }
             foreach (DataRow dataRow2 in table2.Rows)
             {
                 list.Add((uint)dataRow2[0]);
             }
             Guild group = new Guild((uint)row[0], row[1].ToString(), row[2].ToString(), (uint)row[6], row[3].ToString(), (int)row[5], (uint)row[4], (int)row[8], (int)row[9], dictionary, list, dictionary2, (uint)Convert.ToUInt16(row[7]), (uint)Convert.ToUInt16(row[10]), row["has_forum"].ToString() == "1", row["forum_name"].ToString(), row["forum_description"].ToString(), uint.Parse(row["forum_messages_count"].ToString()), double.Parse(row["forum_score"].ToString()), uint.Parse(row["forum_lastposter_id"].ToString()), row["forum_lastposter_name"].ToString(), int.Parse(row["forum_lastposter_timestamp"].ToString()));
             this.Groups.Add((uint)row[0], group);
             result = group;
             return(result);
         }
     }
     return(null);
 }
コード例 #11
0
        internal void Initialize(IQueryAdapter dbClient)
        {
            TargetedOffer = null;

            dbClient.SetQuery("SELECT * FROM targeted_offers WHERE active = 'true' LIMIT 1;");
            var row = dbClient.getRow();


            if (row == null)
            {
                return;
            }
            // Changed : row["open] > (string)row ["open"] & (string)row["active]" for warning? Still works?
            TargetedOffer = new TargetedOffers((int)row["id"], (int)row["limit"], (QuasarEnvironment.GetUnixTimestamp() +
                                                                                   (((int)row["time"] + 10) * 1)), row["open"] == "show", row["active"] == "true", (string)row["code"],
                                               (string)row["title"], (string)row["description"], (string)row["image"], (string)row["icon"],
                                               (string)row["money_type"], (string)row["items"], (string)row["price"]);
        }
コード例 #12
0
        public void LoadPromotions()
        {
            DataRow GetPromotion = null;

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `room_promotions` WHERE `room_id` = " + this.Id + " LIMIT 1;");
                GetPromotion = dbClient.getRow();

                if (GetPromotion != null)
                {
                    if (Convert.ToDouble(GetPromotion["timestamp_expire"]) > QuasarEnvironment.GetUnixTimestamp())
                    {
                        RoomData._promotion = new RoomPromotion(Convert.ToString(GetPromotion["title"]), Convert.ToString(GetPromotion["description"]), Convert.ToDouble(GetPromotion["timestamp_start"]), Convert.ToDouble(GetPromotion["timestamp_expire"]), Convert.ToInt32(GetPromotion["category_id"]));
                    }
                }
            }
        }
コード例 #13
0
        internal bool LoadGroup(int id)
        {
            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT * FROM groups WHERE id = @id");
                dbClient.addParameter("id", id);
                DataRow row = dbClient.getRow();

                if (row == null || row.ItemArray.Length == 0)
                {
                    return(false);
                }

                Group group = new Group(row, dbClient);

                Groups.Add(id, group);
                return(true);
            }
        }
コード例 #14
0
ファイル: RoomManager.cs プロジェクト: Synaxis/CloudEmu
        public bool RoomExist(int RoomId)
        {
            DataRow Row = null;

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT id FROM rooms WHERE id = " + RoomId + " LIMIT 1");
                Row = dbClient.getRow();
            }

            if (Row == null)
            {
                return(false);
            }



            return(true);
        }
コード例 #15
0
        private static RoomModel GetCustomData(UInt32 roomID)
        {
            DataRow RoomData;

            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT doorx,doory,height,modeldata,poolmap FROM room_models_customs WHERE roomid = " + roomID);
                RoomData = dbClient.getRow();
            }

            if (RoomData == null)
            {
                throw new Exception("The custom room model for room " + roomID + " was not found");
            }

            string Modeldata = (string)RoomData["modeldata"];

            return(new RoomModel((int)RoomData["doorx"], (int)RoomData["doory"], (Double)RoomData["height"], 2, Modeldata, "", 0, string.Empty, new List <PublicRoomSquare>()));
        }
コード例 #16
0
ファイル: CacheManager.cs プロジェクト: Clawed/ProjectHub
        public UserCache GenerateUser(int Id)
        {
            UserCache User = null;

            if (UsersCached.ContainsKey(Id))
            {
                if (TryGetUser(Id, out User))
                {
                    return(User);
                }
            }

            GameClient Client = ProjectHub.GetGame().GetClientManager().GetClientByUserID(Id);

            if (Client != null)
            {
                if (Client.GetHabbo() != null)
                {
                    User = new UserCache(Id, Client.GetHabbo().Username, Client.GetHabbo().Motto, Client.GetHabbo().Look);
                    UsersCached.TryAdd(Id, User);

                    return(User);
                }
            }

            using (IQueryAdapter DbClient = ProjectHub.GetDatabaseManager().GetQueryReactor())
            {
                DbClient.SetQuery("SELECT `username`, `motto`, `look` FROM " + ProjectHub.DbPrefix + "users WHERE id = @id LIMIT 1");
                DbClient.AddParameter("id", Id);

                DataRow DataRow = DbClient.getRow();

                if (DataRow != null)
                {
                    User = new UserCache(Id, DataRow["username"].ToString(), DataRow["motto"].ToString(), DataRow["look"].ToString());
                    UsersCached.TryAdd(Id, User);
                }

                DataRow = null;
            }

            return(User);
        }
コード例 #17
0
        internal static uint GetLinkedTele(uint TeleId, Room pRoom)
        {
            uint result;

            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.setQuery("SELECT tele_two_id FROM tele_links WHERE tele_one_id = " + TeleId);
                DataRow row = queryreactor.getRow();
                if (row == null)
                {
                    result = 0u;
                }
                else
                {
                    result = Convert.ToUInt32(row[0]);
                }
            }
            return(result);
        }
コード例 #18
0
        internal TonerData(uint Item)
        {
            this.ItemId = Item;
            DataRow row;

            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.setQuery("SELECT enabled,data1,data2,data3 FROM room_items_toner WHERE id=" + this.ItemId + " LIMIT 1");
                row = queryreactor.getRow();
            }
            if (row == null)
            {
                throw new NullReferenceException("No toner data found in the database for " + this.ItemId);
            }
            this.Enabled = int.Parse(row[0].ToString());
            this.Data1   = (int)row[1];
            this.Data2   = (int)row[2];
            this.Data3   = (int)row[3];
        }
コード例 #19
0
ファイル: VoucherHandler.cs プロジェクト: TheNaked/Firewind
        internal static int GetVoucherValue(string Code)
        {
            DataRow Data;

            using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT value FROM credit_vouchers WHERE code = @code");
                dbClient.addParameter("code", Code);

                Data = dbClient.getRow();
            }

            if (Data != null)
            {
                return((int)Data[0]);
            }

            return(0);
        }
コード例 #20
0
        public UserCache GenerateUser(int Id)
        {
            UserCache User = null;

            if (_usersCached.ContainsKey(Id))
            {
                if (TryGetUser(Id, out User))
                {
                    return(User);
                }
            }

            GameClient Client = RocketEmulador.GetGame().GetClientManager().GetClientByUserID(Id);

            if (Client != null)
            {
                if (Client.GetHabbo() != null)
                {
                    User = new UserCache(Id, Client.GetHabbo().Username, Client.GetHabbo().Motto, Client.GetHabbo().Look);
                    _usersCached.TryAdd(Id, User);
                    return(User);
                }
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `username`, `motto`, `look` FROM users WHERE id = @id LIMIT 1");
                dbClient.AddParameter("id", Id);

                DataRow dRow = dbClient.getRow();

                if (dRow != null)
                {
                    User = new UserCache(Id, dRow["username"].ToString(), dRow["motto"].ToString(), dRow["look"].ToString());
                    _usersCached.TryAdd(Id, User);
                }

                dRow = null;
            }

            return(User);
        }
コード例 #21
0
        public void SaveNewChat()
        {
            DataRow CheckRow = null;

            using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                DB.SetQuery("SELECT NULL FROM rp_chat_rooms WHERE name = @chatname");
                DB.AddParameter("chatname", this.ChatName);

                CheckRow = DB.getRow();
                if (CheckRow == null)
                {
                    DB.SetQuery("INSERT INTO rp_chat_rooms(owner_id, name, password, locked, gang_id, admins) VALUES('" + this.ChatOwner + "', @chatname, '" + this.ChatValues["password"] + "', '" + PlusEnvironment.BoolToEnum(Convert.ToBoolean(this.ChatValues["locked"])) + "', '" + this.ChatValues["gang"] + "', '" + String.Join(":", this.ChatAdmins) + "')");
                    DB.AddParameter("chatname", this.ChatName);
                    DB.RunQuery();

                    this.FromDB = false;
                }
            }
        }
コード例 #22
0
        public static Bot CreateBot(ItemData Data, int OwnerId)
        {
            DataRow BotData = null;

            if (!NeonEnvironment.GetGame().GetCatalog().TryGetBot(Data.Id, out CatalogBot CataBot))
            {
                return(null);
            }

            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO bots (`user_id`,`name`,`motto`,`look`,`gender`,`ai_type`) VALUES ('" + OwnerId + "', '" + CataBot.Name + "', '" + CataBot.Motto + "', '" + CataBot.Figure + "', '" + CataBot.Gender + "', '" + CataBot.AIType + "')");
                int Id = Convert.ToInt32(dbClient.InsertQuery());

                dbClient.SetQuery("SELECT `id`,`user_id`,`name`,`motto`,`look`,`gender` FROM `bots` WHERE `user_id` = '" + OwnerId + "' AND `id` = '" + Id + "' LIMIT 1");
                BotData = dbClient.getRow();
            }

            return(new Bot(Convert.ToInt32(BotData["id"]), Convert.ToInt32(BotData["user_id"]), Convert.ToString(BotData["name"]), Convert.ToString(BotData["motto"]), Convert.ToString(BotData["look"]), Convert.ToString(BotData["gender"])));
        }
コード例 #23
0
ファイル: TeleHandler.cs プロジェクト: nightwolf93/Bfly
        internal static UInt32 GetTeleRoomId(UInt32 TeleId, Room pRoom)
        {
            if (pRoom.GetRoomItemHandler().GetItem(TeleId) != null)
            {
                return(pRoom.RoomId);
            }

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT room_id FROM items_rooms WHERE item_id = " + TeleId);
                DataRow Row = dbClient.getRow();

                if (Row == null)
                {
                    return(0);
                }

                return(Convert.ToUInt32(Row[0]));
            }
        }
コード例 #24
0
        public static int GetTeleRoomId(int TeleId, Room pRoom)
        {
            if (pRoom.GetRoomItemHandler().GetItem(TeleId) != null)
            {
                return(pRoom.RoomId);
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `room_id` FROM `items` WHERE `id` = " + TeleId + " LIMIT 1");
                DataRow Row = dbClient.getRow();

                if (Row == null)
                {
                    return(0);
                }

                return(Convert.ToInt32(Row[0]));
            }
        }
コード例 #25
0
        //Dw`d_GFansites{{2}}Keep tabs on our Fansites.{{2}}M{{2}}{{1}}
        internal void GetGroupdetails()
        {
            if (!PiciEnvironment.groupsEnabled)
            {
                return;
            }

            int groupID = Request.PopWiredInt32();

            DataRow dRow;

            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT name,description,roomid FROM groups_details WHERE id = " + groupID + "");
                dRow = dbClient.getRow();
            }

            if (dRow != null)
            {
                Response.Init(311); // Dw

                Response.Append(groupID);
                Response.Append((string)dRow["name"]);
                Response.Append((string)dRow["description"]);

                int roomID = (int)dRow["roomid"];

                if (roomID > 0)
                {
                    Response.Append(roomID);
                }
                else
                {
                    Response.Append(-1);
                }

                Response.Append("Test");

                SendResponse();
            }
        }
コード例 #26
0
        public bool TryGetGroup(int Id, out Group Group)
        {
            Group = null;

            if (_groups.ContainsKey(Id))
            {
                return(_groups.TryGetValue(Id, out Group));
            }

            lock (_groupLoadingSync)
            {
                if (_groups.ContainsKey(Id))
                {
                    return(_groups.TryGetValue(Id, out Group));
                }

                DataRow Row = null;
                using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT * FROM `groups` WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", Id);
                    Row = dbClient.getRow();

                    if (Row != null)
                    {
                        int created;
                        try
                        {
                            int.TryParse(Row["created"].ToString(), out created);
                        }
                        catch { created = NeonEnvironment.GetIUnixTimestamp(); }
                        Group = new Group(
                            Convert.ToInt32(Row["id"]), Convert.ToString(Row["name"]), Convert.ToString(Row["desc"]), Convert.ToString(Row["badge"]), Convert.ToInt32(Row["room_id"]), Convert.ToInt32(Row["owner_id"]),
                            created, Convert.ToInt32(Row["state"]), Convert.ToInt32(Row["colour1"]), Convert.ToInt32(Row["colour2"]), Convert.ToInt32(Row["admindeco"]), Convert.ToInt32(Row["has_forum"]) == 1, Convert.ToInt32(Row["has_chat"]) == 1);
                        _groups.TryAdd(Group.Id, Group);
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #27
0
        internal MoodlightData(uint ItemId)
        {
            this.ItemId = ItemId;
            DataRow row;

            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.setQuery("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id = " + ItemId);
                row = queryreactor.getRow();
            }
            if (row == null)
            {
                throw new NullReferenceException("No moodlightdata found in the database");
            }
            this.Enabled       = CyberEnvironment.EnumToBool(row["enabled"].ToString());
            this.CurrentPreset = (int)row["current_preset"];
            this.Presets       = new List <MoodlightPreset>();
            this.Presets.Add(MoodlightData.GeneratePreset((string)row["preset_one"]));
            this.Presets.Add(MoodlightData.GeneratePreset((string)row["preset_two"]));
            this.Presets.Add(MoodlightData.GeneratePreset((string)row["preset_three"]));
        }
コード例 #28
0
        /// <summary>
        /// Run a quick database check to see if this ban exists in the database.
        /// </summary>
        /// <param name="Username">The value of the ban.</param>
        /// <returns></returns>
        public bool UsernameBanCheck(string Username)
        {
            if (NeonEnvironment.GetGame().GetModerationManager().IsBanned(Username, out ModerationBan UsernameBanRecord))
            {
                DataRow BanRow = null;
                using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT * FROM `bans` WHERE `bantype` = 'user' AND `value` = @value LIMIT 1");
                    dbClient.AddParameter("value", Username);
                    BanRow = dbClient.getRow();

                    //If there is no more ban record, then we can simply remove it from our cache!
                    if (BanRow == null)
                    {
                        NeonEnvironment.GetGame().GetModerationManager().RemoveBan(Username);
                        return(false);
                    }
                }
            }
            return(true);
        }
コード例 #29
0
ファイル: TeleHandler.cs プロジェクト: nightwolf93/Bfly
        internal static UInt32 GetLinkedTele(UInt32 TeleId, Room pRoom)
        {
            //foreach (RoomItem Item in pRoom.FloorItems.Values)
            //{
            //    if (Item.Id == TeleId)
            //        return Item.Id;
            //}

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT tele_two_id FROM items_tele_links WHERE tele_one_id = " + TeleId);
                DataRow Row = dbClient.getRow();

                if (Row == null)
                {
                    return(0);
                }

                return(Convert.ToUInt32(Row[0]));
            }
        }
コード例 #30
0
ファイル: MimicCommand.cs プロジェクト: Synaxis/CloudEmu
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, coloque o nome do usuário que deseja copiar!");
                return;
            }

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            DataRow Table;

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `users` WHERE username = '******' LIMIT 1");
                Table = dbClient.getRow();
            }

            Session.GetHabbo().Gender = Table["gender"].ToString();
            Session.GetHabbo().Look   = Table["look"].ToString();

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `gender` = @gender, `look` = @look WHERE `id` = @id LIMIT 1");
                dbClient.AddParameter("gender", Session.GetHabbo().Gender);
                dbClient.AddParameter("look", Session.GetHabbo().Look);
                dbClient.AddParameter("id", Session.GetHabbo().Id);
                dbClient.RunQuery();
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User != null)
            {
                Session.SendMessage(new UserChangeComposer(User, true));
                Room.SendMessage(new UserChangeComposer(User, false));
                Session.SendMessage(new AvatarAspectUpdateMessageComposer(Session.GetHabbo().Look, Session.GetHabbo().Gender)); //esto
            }
        }
コード例 #31
0
        public void LoadModel(string Id)
        {
            DataRow Row = null;

            using (IQueryAdapter dbClient = QuasarEnvironment.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;
                }

                string Modelname = Convert.ToString(Row["id"]);
                if (!this._roomModels.ContainsKey(Id))
                {
                    this._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"]), QuasarEnvironment.EnumToBool(Row["club_only"].ToString()), Convert.ToString(Row["poolmap"]), Convert.ToInt32(Row["wall_height"])));
                }
            }
        }
コード例 #32
0
        public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
        {
            dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
            dbClient.addParameter("id", (int)this.item.Id);
            DataRow dRow = dbClient.getRow();
            if (dRow != null)
                this.requiredCycles = Convert.ToInt32(dRow[0].ToString());
            else
                this.requiredCycles = 0;

            dbClient.setQuery("SELECT triggers_item FROM trigger_in_place WHERE original_trigger = " + this.item.Id);
            DataTable dTable = dbClient.getTable();
            RoomItem targetItem;
            foreach (DataRow dRows in dTable.Rows)
            {
                targetItem = insideRoom.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
                if (targetItem == null || this.items.Contains(targetItem))
                    continue;
                targetItem.OnUserWalksOnFurni += targetItem_OnUserWalksOnFurni;
                this.items.Add(targetItem);
            }
        }
コード例 #33
0
ファイル: ModerationManager.cs プロジェクト: Synaxis/CloudEmu
        /// <summary>
        /// Run a quick database check to see if this ban exists in the database.
        /// </summary>
        /// <param name="MachineId">The value of the ban.</param>
        /// <returns></returns>
        public bool MachineBanCheck(string MachineId)
        {
            ModerationBan MachineBanRecord = null;
            if (CloudServer.GetGame().GetModerationManager().IsBanned(MachineId, out MachineBanRecord))
            {
                DataRow BanRow = null;
                using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT * FROM `bans` WHERE `bantype` = 'machine' AND `value` = @value LIMIT 1");
                    dbClient.AddParameter("value", MachineId);
                    BanRow = dbClient.getRow();

                    //If there is no more ban record, then we can simply remove it from our cache!
                    if (BanRow == null)
                    {
                        CloudServer.GetGame().GetModerationManager().RemoveBan(MachineId);
                        return false;
                    }
                }
            }
            return true;
        }
コード例 #34
0
ファイル: Player.cs プロジェクト: sub2900/osu-server-fail
        public void GetModeData(int modeId)
        {
            using (IQueryAdapter dbClient = Bancho.DatabaseManager.GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * " +
                                  "FROM users_modes_info " +
                                  "WHERE user_id = @id AND mode_id = @modeid " +
                                  "LIMIT 1");

                dbClient.AddParameter("id", this.Id);
                dbClient.AddParameter("modeid", modeId);
                DataRow row = dbClient.getRow();
                if (row != null)
                {
                    this.ModesDatas[modeId] = new ModeData(row)
                    {
                        RankPosition = GetModeRank(modeId)
                    }
                }
                ;
            }
        }
コード例 #35
0
        public RoomData GenerateRoomData(int RoomId)
        {
            if (_loadedRoomData.ContainsKey(RoomId))
            {
                return((RoomData)_loadedRoomData[RoomId]);
            }

            RoomData Data = new RoomData();

            Room Room;

            if (TryGetRoom(RoomId, out Room))
            {
                return(Room.RoomData);
            }

            DataRow Row = null;

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM rooms WHERE id = " + RoomId + " LIMIT 1");
                Row = dbClient.getRow();
            }

            if (Row == null)
            {
                return(null);
            }

            Data.Fill(Row);

            if (!_loadedRoomData.ContainsKey(RoomId))
            {
                _loadedRoomData.TryAdd(RoomId, Data);
            }

            return(Data);
        }
コード例 #36
0
        internal static uint GetTeleRoomId(uint TeleId, Room pRoom)
        {
            if (pRoom.GetRoomItemHandler().GetItem(TeleId) != null)
            {
                return(pRoom.RoomId);
            }
            uint result;

            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.setQuery("SELECT room_id FROM items WHERE id = " + TeleId + " LIMIT 1");
                DataRow row = queryreactor.getRow();
                if (row == null)
                {
                    result = 0u;
                }
                else
                {
                    result = Convert.ToUInt32(row[0]);
                }
            }
            return(result);
        }
コード例 #37
0
ファイル: MoveRotate.cs プロジェクト: habb0/Bfly
        public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
        {
            dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
            dbClient.addParameter("id", (int)this.itemID);
            this.delay = dbClient.getInteger();

            dbClient.setQuery("SELECT rotation_status, movement_status FROM trigger_rotation WHERE item_id = @id");
            dbClient.addParameter("id", (int)this.itemID);
            DataRow dRow = dbClient.getRow();
            if (dRow != null)
            {
                this.rotation = (RotationState)Convert.ToInt32(dRow[0]);
                this.movement = (MovementState)Convert.ToInt32(dRow[1]);
            }
            else
            {
                rotation = RotationState.none;
                movement = MovementState.none;
            }

            dbClient.setQuery("SELECT triggers_item FROM trigger_in_place WHERE original_trigger = " + this.itemID);
            DataTable dTable = dbClient.getTable();
            RoomItem targetItem;
            foreach (DataRow dRows in dTable.Rows)
            {
                targetItem = insideRoom.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
                if (targetItem == null || this.items.Contains(targetItem))
                {
                    continue;
                }

                this.items.Add(targetItem);
            }
        }
コード例 #38
0
ファイル: PositionReset.cs プロジェクト: BjkGkh/07052014
        public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
        {
            dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
            dbClient.addParameter("id", (int)this.itemID);
            DataRow dRow = dbClient.getRow();
            if (dRow != null)
            {
                this.delay = Convert.ToInt32(dRow[0].ToString());
            }
            else
            {
                delay = 20;
            }

            dbClient.setQuery("SELECT triggers_item,extradata FROM trigger_in_place WHERE original_trigger = " + this.itemID);
            DataTable dTable = dbClient.getTable();
            if (dTable == null)
                return;
            //RoomItem targetItem;
            foreach (DataRow dRows in dTable.Rows)
            {
                /*targetItem = insideRoom.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
                if (targetItem == null || this.items.Contains(targetItem))
                    continue;

                string[] Op = dRows[1].ToString().Split(';');
                if (Op[0].Split('-')[0].ToString() == "1")
                {
                    MatchState = 1;
                    State.Add(targetItem, Op[0].Split('-')[1].ToString());
                }
                if (Op[1].Split('-')[0].ToString() == "1")
                {
                    MatchRot = 1;
                    Rot.Add(targetItem, int.Parse(Op[1].Split('-')[1]));
                }
                if (Op[2].Split('-')[0].ToString() == "1")
                {
                    MatchPos = 1;
                    Pos.Add(targetItem, new Point(int.Parse(Op[2].Split('-')[1].Split(',')[0]), int.Parse(Op[2].Split('-')[1].Split(',')[1])));
                }

                this.items.Add(targetItem);*/
            }
        }