コード例 #1
0
ファイル: ItemFactory.cs プロジェクト: EmuZoneDEV/HBBO-EMU
        public static List <Item> CreateTeleporterItems(ItemData Data, Habbo Habbo)
        {
            List <Item> Items = new List <Item>();

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,extra_data) VALUES(@did,@uid,@flags);");
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("flags", "");

                int Item1Id = Convert.ToInt32(dbClient.InsertQuery());

                dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,extra_data) VALUES(@did,@uid,@flags);");
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("flags", Item1Id.ToString());

                int Item2Id = Convert.ToInt32(dbClient.InsertQuery());

                Item Item1 = new Item(Item1Id, 0, Data.Id, "", 0, 0, 0, 0, 0, 0, "", null);
                Item Item2 = new Item(Item2Id, 0, Data.Id, "", 0, 0, 0, 0, 0, 0, "", null);

                dbClient.SetQuery("INSERT INTO `tele_links` (`tele_one_id`, `tele_two_id`) VALUES (" + Item1Id + ", " + Item2Id + "), (" + Item2Id + ", " + Item1Id + ")");
                dbClient.RunQuery();

                Items.Add(Item1);
                Items.Add(Item2);
            }
            return(Items);
        }
コード例 #2
0
        internal void AddInventoryItem(int pItemId, int pCount = 1)
        {
            RPItem RPItem = ButterflyEnvironment.GetGame().GetRoleplayManager().GetItemManager().GetItem(pItemId);

            if (RPItem == null)
            {
                return;
            }

            RolePlayInventoryItem Item = GetInventoryItem(pItemId);

            if (Item == null)
            {
                using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO `user_rpitems` (`user_id`, `rp_id`, `item_id`, `count`) VALUES ('" + this._id + "', '" + this._rpId + "', '" + pItemId + "', '" + pCount + "')");
                    int Id = Convert.ToInt32(dbClient.InsertQuery());
                    this._inventory.TryAdd(pItemId, new RolePlayInventoryItem(Id, pItemId, pCount));
                }
            }
            else
            {
                Item.Count += pCount;
                using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
                    dbClient.RunQuery("UPDATE user_rpitems SET count = count + '" + pCount + "' WHERE id = '" + Item.Id + "' LIMIT 1");
            }


            this.SendWebPacket(new AddInventoryItemRpComposer(RPItem, pCount));
        }
コード例 #3
0
        public RoomData CreateRoom(GameClient session, string name, string description, int category, int maxVisitors, int tradeSettings, RoomModel model, string wallpaper = "0.0", string floor = "0.0", string landscape = "0.0", int wallthick = 0, int floorthick = 0)
        {
            if (name.Length < 3)
            {
                session.SendNotification(PlusEnvironment.GetLanguageManager().TryGetValue("room.creation.name.too_short"));
                return(null);
            }

            int roomId = 0;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `rooms` (`roomtype`,`caption`,`description`,`owner`,`model_name`,`category`,`users_max`,`trade_settings`) VALUES ('private',@caption,@description,@UserId,@model,@category,@usersmax,@tradesettings)");
                dbClient.AddParameter("caption", name);
                dbClient.AddParameter("description", description);
                dbClient.AddParameter("UserId", session.GetHabbo().Id);
                dbClient.AddParameter("model", model.Id);
                dbClient.AddParameter("category", category);
                dbClient.AddParameter("usersmax", maxVisitors);
                dbClient.AddParameter("tradesettings", tradeSettings);

                roomId = Convert.ToInt32(dbClient.InsertQuery());
            }

            RoomData data = new RoomData(roomId, name, model.Id, session.GetHabbo().Username, session.GetHabbo().Id, "", 0, "public", "open", 0, maxVisitors, category, description, string.Empty,
                                         floor, landscape, 1, 1, 0, 0, wallthick, floorthick, wallpaper, 1, 1, 1, 1, 1, 1, 1, 8, tradeSettings, true, true, true, true, true, true, true, 0, 0, true, model);

            return(data);
        }
コード例 #4
0
        public void AddView(int userid, int count = -1)
        {
            GroupForumThreadPostView v;

            if ((v = GetView(userid)) != null)
            {
                v.Count = count >= 0 ? count : Posts.Count;
                using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    adap.SetQuery("UPDATE group_forums_thread_views SET count = @c WHERE thread_id = @p AND user_id = @u");
                    adap.AddParameter("c", v.Count);
                    adap.AddParameter("p", this.Id);
                    adap.AddParameter("u", userid);
                    adap.RunQuery();
                }
            }
            else
            {
                v = new GroupForumThreadPostView(0, userid, Posts.Count);
                using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    adap.SetQuery("INSERT INTO group_forums_thread_views (thread_id, user_id, count) VALUES (@t, @u, @c)");
                    adap.AddParameter("t", this.Id);
                    adap.AddParameter("u", userid);
                    adap.AddParameter("c", v.Count);
                    v.Id = (int)adap.InsertQuery();
                    Views.Add(v);
                }
            }
        }
コード例 #5
0
        public Item AddNewItem(int Id, int BaseItem, string ExtraData, int Group, bool ToInsert, bool FromRoom, int LimitedNumber, int LimitedStack)
        {
            if (ToInsert)
            {
                if (FromRoom)
                {
                    using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("UPDATE `items` SET `base_item` = " + BaseItem + ", `room_id` = 0, `user_id` = " + _userId + " WHERE `id` = " + Id);
                    }
                }
                else
                {
                    using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        if (Id > 0)
                        {
                            dbClient.RunQuery("INSERT INTO `items` (`id`,`base_item`, `extradata`,  `user_id`, `limited_number`, `limited_stack`) VALUES ('" + Id + "', '" + BaseItem + "', '" + ExtraData + "', '" + _userId + "', '" + LimitedNumber + "', '" + LimitedStack + "')");
                        }
                        else
                        {
                            dbClient.SetQuery("INSERT INTO `items` (`base_item`, `user_id`, `extra_data`, `limited_number`, `limited_stack`) VALUES ('" + BaseItem + "', '" + _userId + "', '" + ExtraData + "', '" + LimitedNumber + "', '" + LimitedStack + "')");
                            Id = Convert.ToInt32(dbClient.InsertQuery());
                        }

                        SendNewItems(Convert.ToInt32(Id));

                        if (Group > 0)
                        {
                            dbClient.RunQuery("INSERT INTO `items_groups` VALUES (" + Id + ", " + Group + ")");
                        }

                        if (!string.IsNullOrEmpty(ExtraData))
                        {
                            dbClient.SetQuery("UPDATE `items` SET `extra_data` = @extradata WHERE `id` = '" + Id + "' LIMIT 1");
                            dbClient.AddParameter("extradata", ExtraData);
                            dbClient.RunQuery();
                        }
                    }
                }
            }

            Item ItemToAdd = new Item(Id, 0, BaseItem, ExtraData, 0, 0, 0, 0, _userId, Group, LimitedNumber, LimitedStack, string.Empty);

            if (UserHoldsItem(Id))
            {
                RemoveItem(Id);
            }

            if (ItemToAdd.IsWallItem)
            {
                _wallItems.TryAdd(ItemToAdd.Id, ItemToAdd);
            }
            else
            {
                _floorItems.TryAdd(ItemToAdd.Id, ItemToAdd);
            }

            return(ItemToAdd);
        }
コード例 #6
0
        public static RecloserSettings SaveRecloserSettings(RecloserSettings mySettings)
        {
            RecloserSettings realSettings = mySettings;
            int realId;

            using (IQueryAdapter dbClient = Core.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO ajustes_linha (creation_service, ftemp_pickup, ftemp_curve, ftemp_dial, ftemp_mrt, finst_pickup," +
                                  "ntemp_pickup, ntemp_curve, ntemp_dial, ntemp_mrt, ninst_pickup, class, num_op, temp_op_1, temp_op_2, temp_op_3, temp_rearm) VALUES " +
                                  "(@scres,@ftp,@ftc,@ftd,@ftm,@ftip,@ntp,@ntc,@ntd,@ntm,@ntip,@sclass,@snum,@top1,@top2,@top3,@tr);");
                dbClient.AddParameter("scres", mySettings.CreationService);
                dbClient.AddParameter("ftp", mySettings.PhasePickUp);
                dbClient.AddParameter("ftc", mySettings.PhaseCurveId);
                dbClient.AddParameter("ftd", mySettings.PhaseDial);
                dbClient.AddParameter("ftm", mySettings.PhaseMRT);
                dbClient.AddParameter("ftip", mySettings.InstantPhasePickUp);
                dbClient.AddParameter("ntp", mySettings.NeutralPickUp);
                dbClient.AddParameter("ntc", mySettings.NeutralCurveId);
                dbClient.AddParameter("ntd", mySettings.NeutralDial);
                dbClient.AddParameter("ntm", mySettings.NeutralMRT);
                dbClient.AddParameter("ntip", mySettings.InstantNeutralPickUp);
                dbClient.AddParameter("sclass", mySettings.Class);
                dbClient.AddParameter("snum", mySettings.NumberOfOperations);
                dbClient.AddParameter("top1", mySettings.Operation1Time);
                dbClient.AddParameter("top2", mySettings.Operation2Time);
                dbClient.AddParameter("top3", mySettings.Operation3Time);
                dbClient.AddParameter("tr", mySettings.Rearm);
                realId = Convert.ToInt32(dbClient.InsertQuery());
            }
            realSettings.Id = realId;
            return(realSettings);
        }
コード例 #7
0
ファイル: ItemFactory.cs プロジェクト: EmuZoneDEV/HBBO-EMU
        public static List <Item> CreateMultipleItems(ItemData Data, Habbo Habbo, string ExtraData, int Amount)
        {
            if (Data == null)
            {
                throw new InvalidOperationException("Data cannot be null.");
            }

            List <Item> Items = new List <Item>();

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                for (int i = 0; i < Amount; i++)
                {
                    dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,extra_data) VALUES(@did,@uid,@flags);");
                    dbClient.AddParameter("did", Data.Id);
                    dbClient.AddParameter("uid", Habbo.Id);
                    dbClient.AddParameter("flags", ExtraData);

                    Item Item = new Item(Convert.ToInt32(dbClient.InsertQuery()), 0, Data.Id, ExtraData, 0, 0, 0, 0, 0, 0, "", null);

                    Items.Add(Item);
                }
            }
            return(Items);
        }
コード例 #8
0
ファイル: ItemFactory.cs プロジェクト: EmuZoneDEV/HBBO-EMU
        public static Item CreateSingleItemNullable(ItemData Data, Habbo Habbo, string ExtraData, int LimitedNumber = 0, int LimitedStack = 0)
        {
            if (Data == null)
            {
                throw new InvalidOperationException("Data cannot be null.");
            }
            Item Item = new Item(0, 0, Data.Id, ExtraData, LimitedNumber, LimitedStack, 0, 0, 0, 0, "", null);


            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,extra_data) VALUES (@did,@uid,@extra_data)");
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("extra_data", ExtraData);
                Item.Id = Convert.ToInt32(dbClient.InsertQuery());

                if (LimitedNumber > 0)
                {
                    dbClient.RunQuery("INSERT INTO items_limited VALUES (" + Item.Id + "," + LimitedNumber + "," + LimitedStack + ")");
                }

                return(Item);
            }
        }
コード例 #9
0
ファイル: ItemFactory.cs プロジェクト: EmuZoneDEV/HBBO-EMU
        public static Item CreateSingleItem(ItemData Data, Habbo Habbo, string ExtraData, int ItemId, int LimitedNumber = 0, int LimitedStack = 0)
        {
            if (Data == null)
            {
                return(null);
            }

            int InsertId = 0;

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `items` (`id`,base_item,user_id,extra_data) VALUES (@id, @did,@uid,@extra_data)");
                dbClient.AddParameter("id", ItemId);
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("extra_data", ExtraData);
                InsertId = Convert.ToInt32(dbClient.InsertQuery());

                if (LimitedNumber > 0 && InsertId > 0)
                {
                    dbClient.RunQuery("INSERT INTO items_limited VALUES (" + ItemId + "," + LimitedNumber + "," + LimitedStack + ")");
                }
            }

            if (InsertId <= 0)
            {
                return(null);
            }

            Item Item = new Item(ItemId, 0, Data.Id, ExtraData, LimitedNumber, LimitedStack, 0, 0, 0, 0, "", null);

            return(Item);
        }
コード例 #10
0
        public static Item CreateSingleItemNullable(ItemData Data, Habbo Habbo, string ExtraData, string DisplayFlags, int GroupId = 0, int LimitedNumber = 0, int LimitedStack = 0)
        {
            if (Data == null)
            {
                throw new InvalidOperationException("Data cannot be null.");
            }

            Item Item = new Item(0, 0, Data.Id, ExtraData, 0, 0, 0, 0, Habbo.Id, GroupId, LimitedNumber, LimitedStack, "");

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,room_id,x,y,z,wall_pos,rot,extra_data,`limited_number`,`limited_stack`) VALUES (@did,@uid,@rid,@x,@y,@z,@wall_pos,@rot,@extra_data, @limited_number, @limited_stack)");
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("rid", 0);
                dbClient.AddParameter("x", 0);
                dbClient.AddParameter("y", 0);
                dbClient.AddParameter("z", 0);
                dbClient.AddParameter("wall_pos", "");
                dbClient.AddParameter("rot", 0);
                dbClient.AddParameter("extra_data", ExtraData);
                dbClient.AddParameter("limited_number", LimitedNumber);
                dbClient.AddParameter("limited_stack", LimitedStack);
                Item.Id = Convert.ToInt32(dbClient.InsertQuery());

                if (GroupId > 0)
                {
                    dbClient.SetQuery("INSERT INTO `items_groups` (`id`, `group_id`) VALUES (@id, @gid)");
                    dbClient.AddParameter("id", Item.Id);
                    dbClient.AddParameter("gid", GroupId);
                    dbClient.RunQuery();
                }
                return(Item);
            }
        }
コード例 #11
0
        public RoomData CreateRoom(GameClient Session, string Name, string Description, string Model, int Category, int MaxVisitors, int TradeSettings)
        {
            if (!_roomModels.ContainsKey(Model))
            {
                Session.SendNotification(LanguageLocale.Get(Session, "invalid_room_model"));
                return(null);
            }

            if (Name.Length < 3)
            {
                Session.SendNotification(LanguageLocale.Get(Session, "invalid_room_name_length"));
                return(null);
            }

            int RoomId = 0;

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `rooms` (`roomtype`,`caption`,`description`,`owner`,`model_name`,`category`,`users_max`,`trade_settings`) VALUES ('private',@caption,@description,@UserId,@model,@category,@usersmax,@tradesettings)");
                dbClient.AddParameter("caption", Name);
                dbClient.AddParameter("description", Description);
                dbClient.AddParameter("UserId", Session.GetHabbo().Id);
                dbClient.AddParameter("model", Model);
                dbClient.AddParameter("category", Category);
                dbClient.AddParameter("usersmax", MaxVisitors);
                dbClient.AddParameter("tradesettings", TradeSettings);

                RoomId = Convert.ToInt32(dbClient.InsertQuery());
            }

            RoomData newRoomData = GenerateRoomData(RoomId);

            Session.GetHabbo().UsersRooms.Add(newRoomData);
            return(newRoomData);
        }
コード例 #12
0
ファイル: RoomManager.cs プロジェクト: sgf/Yupi
        /// <summary>
        ///     Creates the room.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="name">The name.</param>
        /// <param name="desc">The desc.</param>
        /// <param name="model">The model.</param>
        /// <param name="category">The category.</param>
        /// <param name="maxVisitors">The maximum visitors.</param>
        /// <param name="tradeState">State of the trade.</param>
        /// <returns>RoomData.</returns>
        internal RoomData CreateRoom(GameClient session, string name, string desc, string model, int category,
                                     int maxVisitors, int tradeState)
        {
            if (!_roomModels.Contains(model))
            {
                session.SendNotif(Yupi.GetLanguage().GetVar("user_room_model_error"));

                return(null);
            }

            uint roomId;

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO rooms_data (roomtype,caption,description,owner,model_name,category,users_max,trade_state) VALUES ('private',@caption,@desc,@UserId,@model,@cat,@usmax,@tstate)");
                dbClient.AddParameter("caption", name);
                dbClient.AddParameter("desc", desc);
                dbClient.AddParameter("UserId", session.GetHabbo().Id);
                dbClient.AddParameter("model", model);
                dbClient.AddParameter("cat", category);
                dbClient.AddParameter("usmax", maxVisitors);
                dbClient.AddParameter("tstate", tradeState.ToString());
                roomId = (uint)dbClient.InsertQuery();
            }
            RoomData data = GenerateRoomData(roomId);

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

            session.GetHabbo().UsersRooms.Add(data);
            return(data);
        }
コード例 #13
0
        private void IsNewUser()
        {
            if (GetHabbo().NewUser)
            {
                GetHabbo().NewUser = false;

                int RoomId = 0;
                using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO rooms (caption,description,owner,model_name,category,state, icon_bg, icon_fg, icon_items, wallpaper, floor, landscape, allow_hidewall, wallthick, floorthick) SELECT @caption, @desc, @username, @model, category, state, icon_bg, icon_fg, icon_items, wallpaper, floor, landscape, allow_hidewall, wallthick, floorthick FROM rooms WHERE id = '5328079'");
                    dbClient.AddParameter("caption", this.GetHabbo().Username);
                    dbClient.AddParameter("desc", ButterflyEnvironment.GetLanguageManager().TryGetValue("room.welcome.desc", this.Langue));
                    dbClient.AddParameter("username", this.GetHabbo().Username);
                    dbClient.AddParameter("model", "model_welcome");
                    RoomId = (int)dbClient.InsertQuery();
                    if (RoomId == 0)
                    {
                        return;
                    }

                    dbClient.RunQuery("INSERT INTO items (user_id, room_id, base_item, extra_data, x, y, z, rot) SELECT '" + this.GetHabbo().Id + "', '" + RoomId + "', base_item, extra_data, x, y, z, rot FROM items WHERE room_id = '5328079'");

                    dbClient.RunQuery("UPDATE users SET nux_enable = '0', home_room = '" + RoomId + "' WHERE id = '" + this.GetHabbo().Id + "';");
                }
                this.GetHabbo().UsersRooms.Add(ButterflyEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId));
                this.GetHabbo().HomeRoom = RoomId;

                ServerPacket nuxStatus = new ServerPacket(ServerPacketHeader.NuxAlertComposer);
                nuxStatus.WriteInteger(2);
                this.SendPacket(nuxStatus);

                this.SendPacket(new NuxAlertComposer("nux/lobbyoffer/hide"));
            }
        }
コード例 #14
0
        public Item AddNewItem(int id, int baseItem, string extraData, int group, bool toInsert, bool fromRoom, int limitedNumber, int limitedStack)
        {
            if (toInsert)
            {
                if (fromRoom)
                {
                    using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("UPDATE `items` SET `room_id` = '0', `user_id` = '" + _userId + "' WHERE `id` = '" + id + "' LIMIT 1");
                    }
                }
                else
                {
                    using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        if (id > 0)
                        {
                            dbClient.RunQuery("INSERT INTO `items` (`id`,`base_item`, `user_id`, `limited_number`, `limited_stack`) VALUES ('" + id + "', '" + baseItem + "', '" + _userId + "', '" + limitedNumber + "', '" + limitedStack + "')");
                        }
                        else
                        {
                            dbClient.SetQuery("INSERT INTO `items` (`base_item`, `user_id`, `limited_number`, `limited_stack`) VALUES ('" + baseItem + "', '" + _userId + "', '" + limitedNumber + "', '" + limitedStack + "')");
                            id = Convert.ToInt32(dbClient.InsertQuery());
                        }

                        SendNewItems(Convert.ToInt32(id));

                        if (group > 0)
                        {
                            dbClient.RunQuery("INSERT INTO `items_groups` VALUES (" + id + ", " + group + ")");
                        }

                        if (!string.IsNullOrEmpty(extraData))
                        {
                            dbClient.SetQuery("UPDATE `items` SET `extra_data` = @extradata WHERE `id` = '" + id + "' LIMIT 1");
                            dbClient.AddParameter("extradata", extraData);
                            dbClient.RunQuery();
                        }
                    }
                }
            }

            Item itemToAdd = new Item(id, 0, baseItem, extraData, 0, 0, 0, 0, _userId, group, limitedNumber, limitedStack, string.Empty);

            if (UserHoldsItem(id))
            {
                RemoveItem(id);
            }

            if (itemToAdd.IsWallItem)
            {
                _wallItems.TryAdd(itemToAdd.Id, itemToAdd);
            }
            else
            {
                _floorItems.TryAdd(itemToAdd.Id, itemToAdd);
            }
            return(itemToAdd);
        }
コード例 #15
0
        public static List <Item> CreateTeleporterItems(ItemData Data, Habbo Habbo, int GroupId = 0)
        {
            List <Item> Items = new List <Item>();

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,room_id,x,y,z,wall_pos,rot,extra_data) VALUES(@did,@uid,@rid,@x,@y,@z,@wallpos,@rot,@flags);");
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("rid", 0);
                dbClient.AddParameter("x", 0);
                dbClient.AddParameter("y", 0);
                dbClient.AddParameter("z", 0);
                dbClient.AddParameter("wallpos", "");
                dbClient.AddParameter("rot", 0);
                dbClient.AddParameter("flags", "");

                int Item1Id = Convert.ToInt32(dbClient.InsertQuery());

                dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,room_id,x,y,z,wall_pos,rot,extra_data) VALUES(@did,@uid,@rid,@x,@y,@z,@wallpos,@rot,@flags);");
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("rid", 0);
                dbClient.AddParameter("x", 0);
                dbClient.AddParameter("y", 0);
                dbClient.AddParameter("z", 0);
                dbClient.AddParameter("wallpos", "");
                dbClient.AddParameter("rot", 0);
                dbClient.AddParameter("flags", Item1Id.ToString());

                int Item2Id = Convert.ToInt32(dbClient.InsertQuery());

                Item Item1 = new Item(Item1Id, 0, Data.Id, "", 0, 0, 0, 0, Habbo.Id, GroupId, 0, 0, "");
                Item Item2 = new Item(Item2Id, 0, Data.Id, "", 0, 0, 0, 0, Habbo.Id, GroupId, 0, 0, "");

                dbClient.SetQuery("INSERT INTO `room_items_tele_links` (`tele_one_id`, `tele_two_id`) VALUES (" + Item1Id + ", " + Item2Id + "), (" + Item2Id + ", " + Item1Id + ")");
                dbClient.RunQuery();

                Items.Add(Item1);
                Items.Add(Item2);
            }
            return(Items);
        }
コード例 #16
0
ファイル: GroupManager.cs プロジェクト: xjoao97/HabboRP
        public bool TryCreateGroup(Habbo Player, string Name, string Description, int RoomId, string Badge, int Colour1, int Colour2, out Group Group)
        {
            Group = new Group(0, Name, Description, Badge, RoomId, Player.Id, (int)PlusEnvironment.GetUnixTimestamp(), 1, Colour1, Colour2, 0,
                              false, Name, Description, 0, 0, 0, "", 0, 1, 2, 2, 3, GenericGangRanks, new ConcurrentDictionary <int, GroupMember>(), new List <int>(), 0, 0, 0, 0);

            try
            {
                if (Gangs.Values.Where(x => x.CreatorId == Player.Id).ToList().Count > 0)
                {
                    return(false);
                }

                if (string.IsNullOrWhiteSpace(Name) || string.IsNullOrWhiteSpace(Badge))
                {
                    return(false);
                }

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO `rp_gangs` (`name`, `desc`, `badge`, `owner_id`, `created`, `room_id`, `state`, `colour1`, `colour2`, `admindeco`) VALUES (@name, @desc, @badge, @owner, UNIX_TIMESTAMP(), @room, '0', @colour1, @colour2, '0')");
                    dbClient.AddParameter("name", Group.Name);
                    dbClient.AddParameter("desc", Group.Description);
                    dbClient.AddParameter("owner", Group.CreatorId);
                    dbClient.AddParameter("badge", Group.Badge);
                    dbClient.AddParameter("room", Group.RoomId);
                    dbClient.AddParameter("colour1", Group.Colour1);
                    dbClient.AddParameter("colour2", Group.Colour2);
                    Group.Id = Convert.ToInt32(dbClient.InsertQuery());

                    if (Gangs.ContainsKey(Group.Id))
                    {
                        return(false);
                    }

                    Gangs.TryAdd(Group.Id, Group);

                    Player.GetClient().GetRoleplay().GangId      = Group.Id;
                    Player.GetClient().GetRoleplay().GangRank    = 6;
                    Player.GetClient().GetRoleplay().GangRequest = 0;

                    Group.AddNewMember(Player.Id, 6, true);

                    UserCache Junk;
                    PlusEnvironment.GetGame().GetCacheManager().TryRemoveUser(Player.Id, out Junk);
                    PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Player.Id);
                }
            }
            catch (Exception e)
            {
                log.Info(e.Message);
                return(false);
            }

            return(true);
        }
コード例 #17
0
        /// <summary>
        /// Creates the bot from catalog.
        /// </summary>
        /// <param name="botType">Type of the bot.</param>
        /// <param name="userId">The user identifier.</param>
        /// <returns>RoomBot.</returns>
        internal static RoomBot CreateBotFromCatalog(string botType, uint userId)
        {
            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                CatalogBot catalogBot = GetCatalogBot(botType);

                queryReactor.SetQuery($"INSERT INTO bots_data (user_id,name,motto,look,gender,walk_mode,ai_type,bot_type) VALUES ('{userId}', '{catalogBot.BotName}', '{catalogBot.BotMission}', '{catalogBot.BotLook}', '{catalogBot.BotGender}', 'freeroam', 'generic', '{catalogBot.BotType}')");

                return(new RoomBot(Convert.ToUInt32(queryReactor.InsertQuery()), userId, 0u, AiType.Generic, "freeroam", catalogBot.BotName, catalogBot.BotMission, catalogBot.BotLook, 0, 0, 0.0, 0, null, null, catalogBot.BotGender, 0, catalogBot.BotType));
            }
        }
コード例 #18
0
        /// <summary>
        /// Creates a new AvatarEffect with the specified details.
        /// </summary>
        /// <param name="Habbo"></param>
        /// <param name="SpriteId"></param>
        /// <param name="Duration"></param>
        /// <returns></returns>
        public static AvatarEffect CreateNullable(Habbo Habbo, int SpriteId, double Duration)
        {
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `user_effects` (`user_id`,`effect_id`,`total_duration`,`is_activated`,`activated_stamp`,`quantity`) VALUES(@uid,@sid,@dur,'0',0,1)");
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("sid", SpriteId);
                dbClient.AddParameter("dur", Duration);

                return(new AvatarEffect(Convert.ToInt32(dbClient.InsertQuery()), Habbo.Id, SpriteId, Duration, false, 0, 1));
            }
        }
コード例 #19
0
        public static BaySettings CreateNewBaySettings(bool enabled, string creationService, int phasePickUp, double phaseTAP, int phaseCurveId, double phaseDial,
                                                       double phaseMRT, double phaseTimeAdd, int neutralPickUp, double neutralTAP, int neutralCurveId, double neutralDial, double neutralMRT, double neutralTimeAdd,
                                                       int numpOp, int opt1, int opt2, int opt3, int rearm, int instantPhasePickUp, int instantNeutralPickUp,
                                                       double instantPhaseTAP, double instantNeutralTAP)
        {
            int id = 0;

            using (IQueryAdapter dbClient = Core.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO ajustes_bay (creation_service, ftemp_pickup, ftemp_tap, ftemp_curve, ftemp_dial, ftemp_mrt, ftemp_timeadd, finst_pickup," +
                                  "finst_tap,ntemp_pickup,ntemp_tap, ntemp_curve, ntemp_dial, ntemp_mrt,ntemp_timeadd, ninst_pickup, ninst_tap, num_op, temp_op_1, temp_op_2, temp_op_3, temp_rearm) VALUES " +
                                  "(@scres,@ftp,@ftt,@ftc,@ftd,@ftm,@fta,@fip,@fit,@ntp,@ntt,@ntc,@ntd,@ntm,@nta,@nip,@nit,@snum,@top1,@top2,@top3,@tr);");
                dbClient.AddParameter("scres", creationService);
                dbClient.AddParameter("ftp", phasePickUp);
                dbClient.AddParameter("ftt", phaseTAP);
                dbClient.AddParameter("ftc", phaseCurveId);
                dbClient.AddParameter("ftd", phaseDial);
                dbClient.AddParameter("ftm", phaseMRT);
                dbClient.AddParameter("fta", phaseTimeAdd);
                dbClient.AddParameter("fip", instantPhasePickUp);
                dbClient.AddParameter("fit", instantPhaseTAP);
                dbClient.AddParameter("ntp", neutralPickUp);
                dbClient.AddParameter("ntt", neutralTAP);
                dbClient.AddParameter("ntc", neutralCurveId);
                dbClient.AddParameter("ntd", neutralDial);
                dbClient.AddParameter("ntm", neutralMRT);
                dbClient.AddParameter("nta", neutralTimeAdd);
                dbClient.AddParameter("nip", instantNeutralPickUp);
                dbClient.AddParameter("nit", instantNeutralTAP);
                dbClient.AddParameter("snum", numpOp);
                dbClient.AddParameter("top1", opt1);
                dbClient.AddParameter("top2", opt2);
                dbClient.AddParameter("top3", opt3);
                dbClient.AddParameter("tr", rearm);
                id = Convert.ToInt32(dbClient.InsertQuery());
            }

            if (id == 0)
            {
                SystemLogging.SendFatalErrorLog("Falha ao criar ajuste de Bay");
                return(null);
            }

            else
            {
                SystemLogging.SendProcessLog("Ajuste criado de Bay: " + id + " " + creationService);
                BaySettings myNewSettings = new BaySettings(id, enabled, creationService, phasePickUp, phaseTAP, phaseCurveId, phaseDial,
                                                            phaseMRT, phaseTimeAdd, neutralPickUp, neutralTAP, neutralCurveId, neutralDial, neutralMRT,
                                                            neutralTimeAdd, numpOp, opt1, opt2, opt3, rearm, instantPhasePickUp,
                                                            instantNeutralPickUp, instantPhaseTAP, instantNeutralTAP);
                return(myNewSettings);
            }
        }
コード例 #20
0
ファイル: ModerationTool.cs プロジェクト: sgf/Yupi
        /// <summary>
        ///     Sends the new ticket.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="category">The category.</param>
        /// <param name="type">The type.</param>
        /// <param name="reportedUser">The reported user.</param>
        /// <param name="message">The message.</param>
        /// <param name="messages">The messages.</param>
        internal void SendNewTicket(GameClient session, int category, int type, uint reportedUser, string message,
                                    List <string> messages)
        {
            uint id;

            if (session.GetHabbo().CurrentRoomId <= 0)
            {
                using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery(
                        string.Concat(
                            "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                            category, "','open','", session.GetHabbo().Id, "','", reportedUser,
                            "','0',@message,'0','','", Yupi.GetUnixTimeStamp(), "')"));
                    dbClient.AddParameter("message", message);
                    id = (uint)dbClient.InsertQuery();
                    dbClient.RunFastQuery(
                        $"UPDATE users_info SET cfhs = cfhs + 1 WHERE user_id = {session.GetHabbo().Id}");
                }

                SupportTicket ticket = new SupportTicket(id, 1, category, type, session.GetHabbo().Id, reportedUser, message, 0u,
                                                         "", Yupi.GetUnixTimeStamp(), messages);

                Tickets.Add(ticket);
                SendTicketToModerators(ticket);
            }
            else
            {
                RoomData data = Yupi.GetGame().GetRoomManager().GenerateNullableRoomData(session.GetHabbo().CurrentRoomId);

                using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery(
                        string.Concat(
                            "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                            category, "','open','", session.GetHabbo().Id, "','", reportedUser, "','0',@message,'",
                            data.Id, "',@name,'", Yupi.GetUnixTimeStamp(), "')"));
                    dbClient.AddParameter("message", message);
                    dbClient.AddParameter("name", data.Name);
                    id = (uint)dbClient.InsertQuery();
                    dbClient.RunFastQuery(
                        $"UPDATE users_info SET cfhs = cfhs + 1 WHERE user_id = {session.GetHabbo().Id}");
                }

                SupportTicket ticket2 = new SupportTicket(id, 1, category, type, session.GetHabbo().Id, reportedUser, message,
                                                          data.Id, data.Name, Yupi.GetUnixTimeStamp(), messages);

                Tickets.Add(ticket2);
                SendTicketToModerators(ticket2);
            }
        }
コード例 #21
0
        /// <summary>
        ///     Creates the theGroup.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="desc">The desc.</param>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="badge">The badge.</param>
        /// <param name="session">The session.</param>
        /// <param name="colour1">The colour1.</param>
        /// <param name="colour2">The colour2.</param>
        /// <param name="group">The theGroup.</param>
        internal void CreateGroup(string name, string desc, uint roomId, string badge, GameClient session, int colour1,
                                  int colour2, out Group group)
        {
            Habbo user = session.GetHabbo();
            Dictionary <uint, GroupMember> emptyDictionary = new Dictionary <uint, GroupMember>();

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery(
                    $"INSERT INTO groups_data (group_name, group_description, group_badge, owner_id, created, room_id, colour1, colour2) VALUES(@name,@desc,@badge,'{session.GetHabbo().Id}',UNIX_TIMESTAMP(),'{roomId}','{colour1}','{colour2}')");
                queryReactor.AddParameter("name", name);
                queryReactor.AddParameter("desc", desc);
                queryReactor.AddParameter("badge", badge);

                uint id = (uint)queryReactor.InsertQuery();

                queryReactor.RunFastQuery($"UPDATE rooms_data SET group_id='{id}' WHERE id='{roomId}' LIMIT 1");

                GroupMember memberGroup = new GroupMember(user.Id, user.UserName, user.Look, id, 2, Yupi.GetUnixTimeStamp());
                Dictionary <uint, GroupMember> dictionary = new Dictionary <uint, GroupMember> {
                    { session.GetHabbo().Id, memberGroup }
                };

                group = new Group(id, name, desc, roomId, badge, Yupi.GetUnixTimeStamp(), user.Id, colour1, colour2,
                                  dictionary, emptyDictionary, emptyDictionary, 0, 1,
                                  new GroupForum(0, string.Empty, string.Empty, 0, 0, 0, string.Empty, 0, 0, 1, 1, 2));

                Groups.Add(id, group);

                queryReactor.RunFastQuery(
                    $"INSERT INTO groups_members (group_id, user_id, rank, date_join) VALUES ('{id}','{session.GetHabbo().Id}','2','{Yupi.GetUnixTimeStamp()}')");

                Room room = Yupi.GetGame().GetRoomManager().GetRoom(roomId);

                if (room != null)
                {
                    room.RoomData.Group   = group;
                    room.RoomData.GroupId = id;
                }

                user.UserGroups.Add(memberGroup);
                group.Admins.Add(user.Id, memberGroup);

                queryReactor.RunFastQuery(
                    $"UPDATE users_stats SET favourite_group='{id}' WHERE id='{user.Id}' LIMIT 1");
                queryReactor.RunFastQuery($"DELETE FROM rooms_rights WHERE room_id='{roomId}'");
            }
        }
コード例 #22
0
ファイル: PetUtility.cs プロジェクト: EmuZoneDEV/HBBO-EMU
        public static Pet CreatePet(int UserId, string Name, int Type, string Race, string Color)
        {
            Pet pet = new Pet(404, UserId, 0, Name, Type, Race, Color, 0, 100, 100, 0, (double)ButterflyEnvironment.GetUnixTimestamp(), 0, 0, 0.0, 0, 1, -1, false);

            pet.DBState = DatabaseUpdateState.NeedsUpdate;

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO user_pets (user_id,name,type,race,color,expirience,energy,createstamp) VALUES (" + pet.OwnerId + ",@" + pet.PetId + "name," + pet.Type + ",@" + pet.PetId + "race,@" + pet.PetId + "color,0,100,'" + pet.CreationStamp + "')");
                dbClient.AddParameter(pet.PetId + "name", pet.Name);
                dbClient.AddParameter(pet.PetId + "race", pet.Race);
                dbClient.AddParameter(pet.PetId + "color", pet.Color);
                pet.PetId = (int)dbClient.InsertQuery();
            }
            return(pet);
        }
コード例 #23
0
        public static Pet CreatePet(int UserId, string Name, int Type, string Race, string Color)
        {
            Pet pet = new Pet(0, UserId, 0, Name, Type, Race, Color, 0, 100, 100, 0, PlusEnvironment.GetUnixTimestamp(), 0, 0, 0.0, 0, 0, 0, -1, "-1");

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO bots (user_id,name, ai_type) VALUES (" + pet.OwnerId + ",@" + pet.PetId + "name, 'pet')");
                dbClient.AddParameter(pet.PetId + "name", pet.Name);
                pet.PetId = Convert.ToInt32(dbClient.InsertQuery());

                dbClient.SetQuery("INSERT INTO bots_petdata (id,type,race,color,experience,energy,createstamp) VALUES (" + pet.PetId + ", " + pet.Type + ",@" + pet.PetId + "race,@" + pet.PetId + "color,0,100,UNIX_TIMESTAMP())");
                dbClient.AddParameter(pet.PetId + "race", pet.Race);
                dbClient.AddParameter(pet.PetId + "color", pet.Color);
                dbClient.RunQuery();
            }
            return(pet);
        }
コード例 #24
0
        public void SendNewTicket(GameClient Session, int Category, int ReportedUser, String Message, List <string> Messages)
        {
            int           TicketId = 0;
            SupportTicket Ticket;

            if (Session.GetHabbo().CurrentRoomId <= 0)
            {
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'" + Category + "','open','" + Session.GetHabbo().Id + "','" + ReportedUser + "','0',@message,'0','','" + QuasarEnvironment.GetUnixTimestamp() + "')");
                    dbClient.AddParameter("message", Message);
                    TicketId = Convert.ToInt32(dbClient.InsertQuery());

                    dbClient.RunQuery("UPDATE `user_info` SET `cfhs` = `cfhs` + '1' WHERE `user_id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
                }

                Ticket = new SupportTicket(TicketId, 1, 7, Session.GetHabbo().Id, ReportedUser, Message, 0, "", QuasarEnvironment.GetUnixTimestamp(), Messages);

                Tickets.Add(Ticket);

                SendTicketToModerators(Ticket);
                // Otherwise return; here - Lets check
                QuasarEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("tickets", "Een Habbi heeft een verzoek om hulp gestuurd, bekijk de Moderator Tickets.", ""));
                return;
            }

            RoomData Data = QuasarEnvironment.GetGame().GetRoomManager().GenerateRoomData(Session.GetHabbo().CurrentRoomId);

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'" + Category + "','open','" + Session.GetHabbo().Id + "','" + ReportedUser + "','0',@message,'" + Data.Id + "',@name,'" + QuasarEnvironment.GetUnixTimestamp() + "')");
                dbClient.AddParameter("message", Message);
                dbClient.AddParameter("name", Data.Name);
                TicketId = Convert.ToInt32(dbClient.InsertQuery());

                dbClient.RunQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");

                QuasarEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("tickets", "Een Habbi heeft een verzoek om hulp gestuurd, bekijk de Moderator Tickets.", ""));
            }



            Ticket = new SupportTicket(TicketId, 1, 7, Session.GetHabbo().Id, ReportedUser, Message, Data.Id, Data.Name, QuasarEnvironment.GetUnixTimestamp(), Messages);
            Tickets.Add(Ticket);
            SendTicketToModerators(Ticket);
        }
コード例 #25
0
ファイル: ItemFactory.cs プロジェクト: pedruhb/RavenServer
        public static List <Item> CreateMultipleItems(ItemData Data, Habbo Habbo, string ExtraData, int Amount, int GroupId = 0)
        {
            if (Data == null)
            {
                throw new InvalidOperationException("Data cannot be null.");
            }

            List <Item> Items = new List <Item>();

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                // lets build the query
                StringBuilder query = new StringBuilder();
                query.Append("INSERT INTO `items` (base_item,user_id,room_id,x,y,z,wall_pos,rot,extra_data) VALUES(@did,@uid,@rid,@x,@y,@z,@wallpos,@rot,@flags)");
                for (int i = 0; i < Amount - 1; i++)
                {
                    query.Append(",(@did,@uid,@rid,@x,@y,@z,@wallpos,@rot,@flags)");
                }
                query.Append(";");

                dbClient.SetQuery(query.ToString());
                dbClient.AddParameter("did", Data.Id);
                dbClient.AddParameter("uid", Habbo.Id);
                dbClient.AddParameter("rid", 0);
                dbClient.AddParameter("x", 0);
                dbClient.AddParameter("y", 0);
                dbClient.AddParameter("z", 0);
                dbClient.AddParameter("wallpos", "");
                dbClient.AddParameter("rot", 0);
                dbClient.AddParameter("flags", ExtraData);
                //execute query
                int firstItemId = Convert.ToInt32(dbClient.InsertQuery());
                for (int i = firstItemId; i < firstItemId + Amount; i++)
                {
                    Items.Add(new Item(i, 0, Data.Id, ExtraData, 0, 0, 0, 0, Habbo.Id, GroupId, 0, 0, ""));
                    if (GroupId > 0)
                    {
                        dbClient.SetQuery("INSERT INTO `items_groups` (`id`, `group_id`) VALUES (@id, @gid)");
                        dbClient.AddParameter("id", Items[i - firstItemId].Id);
                        dbClient.AddParameter("gid", GroupId);
                        dbClient.RunQuery();
                    }
                }
            }
            return(Items);
        }
コード例 #26
0
        public GroupForumThread CreateThread(int Creator, string Caption)
        {
            var timestamp = (int)RocketEmulador.GetUnixTimestamp();
            var Thread    = new GroupForumThread(this, 0, Creator, (int)timestamp, Caption, false, false, 0, 0);

            using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                adap.SetQuery("INSERT INTO group_forums_threads (forum_id, user_id, caption, timestamp) VALUES (@a, @b, @c, @d)");
                adap.AddParameter("a", this.Id);
                adap.AddParameter("b", Creator);
                adap.AddParameter("c", Caption);
                adap.AddParameter("d", timestamp);
                Thread.Id = (int)adap.InsertQuery();
            }

            this.Threads.Add(Thread);
            return(Thread);
        }
コード例 #27
0
        public GroupForumThreadPost CreatePost(int userid, string message)
        {
            var now  = (int)RocketEmulador.GetUnixTimestamp();
            var Post = new GroupForumThreadPost(this, 0, userid, now, message, 0, 0);

            using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                adap.SetQuery("INSERT INTO group_forums_thread_posts (thread_id, user_id, message, timestamp) VALUES (@a, @b, @c, @d)");
                adap.AddParameter("a", this.Id);
                adap.AddParameter("b", userid);
                adap.AddParameter("c", message);
                adap.AddParameter("d", now);
                Post.Id = (int)adap.InsertQuery();
            }

            Posts.Add(Post);
            return(Post);
        }
コード例 #28
0
ファイル: CatalogManager.cs プロジェクト: xXSicilyXx/Yupi
        /// <summary>
        ///     Creates the pet.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="race">The race.</param>
        /// <param name="color">The color.</param>
        /// <param name="rarity">The rarity.</param>
        /// <returns>Pet.</returns>
        internal static Pet CreatePet(uint userId, string name, string type, string race, string color, int rarity = 0)
        {
            uint trace = Convert.ToUInt32(race);

            uint petId = 404u;

            Pet pet = new Pet(petId, userId, 0u, name, type, trace, 0, 100, 150, 0, Yupi.GetUnixTimeStamp(), 0, 0, 0.0,
                              false, 0, 0, -1, rarity, DateTime.Now.AddHours(36.0), DateTime.Now.AddHours(48.0), null, color)
            {
                DbState = DatabaseUpdateState.NeedsUpdate
            };

            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery(
                    "INSERT INTO pets_data (user_id, name, ai_type, pet_type, race_id, experience, energy, createstamp, rarity, lasthealth_stamp, untilgrown_stamp, color) " +
                    $"VALUES ('{pet.OwnerId}', @petName, 'pet', @petType, @petRace, 0, 100, UNIX_TIMESTAMP(), '{rarity}', UNIX_TIMESTAMP(now() + INTERVAL 36 HOUR), UNIX_TIMESTAMP(now() + INTERVAL 48 HOUR), @petColor)");

                queryReactor.AddParameter("petName", pet.Name);
                queryReactor.AddParameter("petType", pet.Type);
                queryReactor.AddParameter("petRace", pet.Race);
                queryReactor.AddParameter("petColor", pet.Color);

                petId = (uint)queryReactor.InsertQuery();
            }

            pet.PetId = petId;

            if (pet.Type == "pet_monster")
            {
                pet.MoplaBreed = MoplaBreed.CreateMonsterplantBreed(pet);
                pet.Name       = pet.MoplaBreed.Name;
                pet.DbState    = DatabaseUpdateState.NeedsUpdate;
            }

            GameClient clientByUserId = Yupi.GetGame().GetClientManager().GetClientByUserId(userId);

            if (clientByUserId != null)
            {
                Yupi.GetGame().GetAchievementManager().ProgressUserAchievement(clientByUserId, "ACH_PetLover", 1);
            }

            return(pet);
        }
コード例 #29
0
        public void SendNewTicket(GameClient Session, int Category, int ReportedUser, string Message)
        {
            RoomData roomData = ButterflyEnvironment.GetGame().GetRoomManager().GenerateNullableRoomData(Session.GetHabbo().CurrentRoomId);
            int      Id       = 0;
            string   roomname = (roomData == null) ? roomData.Name : "Aucun appart";
            int      roomid   = (roomData == null) ? roomData.Id : 0;

            using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                queryreactor.SetQuery("INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'" + Category + "','open','" + Session.GetHabbo().Id + "','" + ReportedUser + "','0',@message,'" + roomData.Id + "',@name,'" + ButterflyEnvironment.GetUnixTimestamp() + "')");
                queryreactor.AddParameter("message", Message);
                queryreactor.AddParameter("name", roomname);
                Id = (int)queryreactor.InsertQuery();
            }
            SupportTicket Ticket = new SupportTicket(Id, 1, Category, Session.GetHabbo().Id, ReportedUser, Message, roomid, roomname, (double)ButterflyEnvironment.GetUnixTimestamp());

            this.Tickets.Add(Ticket);
            SendTicketToModerators(Ticket);
        }
コード例 #30
0
        public static RecloserSettings CreateNewRecloserSettings(int status, string creationService, int phasePickUp, int phaseCurveId, double phaseDial,
                                                                 double phaseMRT, double phaseTimeAdd, int neutralPickUp, int neutralCurveId, double neutralDial, double neutralMRT, double neutralTimeAdd,
                                                                 string s_class, int numpOp, int opt1, int opt2, int opt3, int rearm, int instantaneousNeutralPickUp = 0, int instantaneousPhasePickUp = 0)
        {
            int id = 0;

            using (IQueryAdapter dbClient = Core.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO ajustes_linha (creation_service, ftemp_pickup, ftemp_curve, ftemp_dial, ftemp_mrt, finst_pickup," +
                                  "ntemp_pickup, ntemp_curve, ntemp_dial, ntemp_mrt, ninst_pickup, class, num_op, temp_op_1, temp_op_2, temp_op_3, temp_rearm) VALUES " +
                                  "(@scres,@ftp,@ftc,@ftd,@ftm,@ftip,@ntp,@ntc,@ntd,@ntm,@ntip,@sclass,@snum,@top1,@top2,@top3,@tr);");
                dbClient.AddParameter("scres", creationService);
                dbClient.AddParameter("ftp", phasePickUp);
                dbClient.AddParameter("ftc", phaseCurveId);
                dbClient.AddParameter("ftd", phaseDial);
                dbClient.AddParameter("ftm", phaseMRT);
                dbClient.AddParameter("ftip", instantaneousPhasePickUp);
                dbClient.AddParameter("ntp", neutralPickUp);
                dbClient.AddParameter("ntc", neutralCurveId);
                dbClient.AddParameter("ntd", neutralDial);
                dbClient.AddParameter("ntm", neutralMRT);
                dbClient.AddParameter("ntip", instantaneousNeutralPickUp);
                dbClient.AddParameter("sclass", s_class);
                dbClient.AddParameter("snum", numpOp);
                dbClient.AddParameter("top1", opt1);
                dbClient.AddParameter("top2", opt2);
                dbClient.AddParameter("top3", opt3);
                dbClient.AddParameter("tr", rearm);
                id = Convert.ToInt32(dbClient.InsertQuery());
            }

            if (id == 0)
            {
                SystemLogging.SendFatalErrorLog("Falha ao criar ajuste");
                return(null);
            }
            else
            {
                SystemLogging.SendProcessLog("Ajuste criado: " + id + " " + creationService);
                return(new RecloserSettings(id, status, creationService, phasePickUp, phaseCurveId, phaseDial, phaseMRT, phaseTimeAdd, neutralPickUp, neutralCurveId,
                                            neutralDial, neutralMRT, neutralTimeAdd, s_class, numpOp, opt1, opt2, opt3, rearm, DateTime.Now));
            }
        }